Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Learn how to Update Columns via Layout in Magento

 Hi all,

Welcome to the second instalment in my blog series ‘Tims Tutorials’. My first post for the inventCommerce blog, published back in December, was on Content Rich Upgrade Scripts in Magento which discussed a method that we recently used on a project that we find to be very helpful for creating and filling the CMS content with html that was already supplied. You can read more about that here.

This article is another post for the devs among you, as well our knowledge thirsty Business- As – Usual (BAU) clients. It will give you a quick and easy guide on how to update the left/right hand columns via layout in Magento. So let’s get straight into it!

 


In order to manipulate the left or right sides of the page layouts (two columns with left bar and two columns with right bar) there are a few steps one should take in order to update the blocks that are displayed.

 

1.   Navigate to CMS->Pages->Manage Content

2.      Select the page which you would like to modify.

3.      Select “Design” on the left hand side.

4.      A “Page Layout” tab will now be visible.

5.      For the “Layout” drop-down, “two columns with left bar” or “two columns with right bar” should be selected.

6.      The “Layout Update XML” text area is where we are going to add our XML:

 

To add a block, the XML should look like this:

<reference name='left'>

  <block type='cms/block' name='enter-the-identifier-here'>

   <action method='setBlockId'><block_id>enter-the-identifier-here</block_id></action>

  </block>

</reference>

 

To remove all the blocks, the XML should look like this:

 

<reference name="left">

    <action method="unsetChildren"></action>

</reference>

Note: This will unset all the blocks that have been added so that you could add any blocks of your choice. Also this is referencing the left side, for the right side we would use the reference name “right”.

And that’s all there is to it! As I said, a very quick guide, but one that should lead you easily through all the steps needed to update the columns in Magento. I hope it is of use to you, and as always feedback is welcome. Leave me a comment below and I’ll get back to you.