How To Change Callouts in Magento

Here is an easy way to change your left column callouts in Magento. Convert the callouts from a template file item to a CMS Static Block. The static blocks are stored in the database, not as files on the server so updates and changes are much easier.

The Magento demo store has a couple of static block examples. Log in as admin to see them. I think the home page has the “New Products” block, which is pretty useful and shows the syntax for how to use a block in a page.

In Magento,  callouts are hardcoded in the default layout xml to be files on your server. What you want to do is change them to static blocks instead, so you can manipulate them in the admin instead of in the layout files.

Here’s what to do:

In the default theme, the catalog.xml file has this for the left callout: By the way, catalog.xml is in the folder – app/design/frontend/*/*/layout/

<reference name=”left”>

<block type=”core/template” name=”left.permanent.callout” template=”callouts/left_col.phtml”>

<action method=”setImgSrc”><src>images/media/col_left_callout.jpg</src></action>

<action method=”setImgAlt” translate=”alt” module=”catalog”><alt>Our customer service is available 24/7. Call us at (800) DEMO-NUMBER.</alt></action>

<action method=”setLinkUrl”><url>checkout/cart</url></action>

</block>

</reference>

Changed it to this code below. This is just a basic implementation, you can make it whatever you want.:

<reference name=”left”>

<block type=”cms/block” name=”left.permanent.callout”>

<action method=”setBlockId”><block_id>left_column_block</block_id></action>

</block>

</reference>

Next, add a CMS Static Block with an ID of left_column_block. You can put whatever you want in there from the backend (including empty) and it will show in the left column. You can do the same thing with the right column, and can add more in strategic places for future editing in the backend. Good news is, even if you have not created the static block yet, you won’t get any errors.

So there you go, how to change callouts in Magento the easy way.

Comments are closed.