Change Order of Blocks - ‘before’ and ‘after’ attributes

Use ‘before’ and ‘after’ block attributes to change the order of blocks. You can set the position of a block within a structural block by assigning the name of another block to either ‘before’ or ‘after’ attribute.

For example, if you’d like to put ‘Product Viewed’ box below ‘Cart’ box on the right menu, you can define the layout XML files as follows:

in catalog.xml
<reference name=”right”>
<block type=”reports/product_viewed” before=“cart_sidebar” name=”reports.product.viewed” template=”reports/product_viewed.phtml”/>


You can define block position at the very top or bottom by using before=”-” or after=”-”.

No Comments

Leave a comment