I was looking through some with a magento when I have had the necessity to bring a block before another. The problem is that in the xml I have not found anything that was useful, as in the template.
Besides as the order of the blocks it can be managed when magento have a “standard” block and personalized blocks?
You can use the ‘before’ and ‘after’ attribute in the block tag to position the blocks.
1. before="-" positions the block before all other blocks
2. after="-" positions the block after all other block
3. before="some_block" positions this block before another block with name="some_block"
4. after="some_block" position this block after another block with name="some_block"
For example <block name="this_block" before="that_block"/>
Where is the list of blocks? I want to put newsletter after callouts, but “callout” doesn’t work.
What if I want to arrange something like the product product.info.simple block?
I wan to add it above the product description. The thing is that is this block is dependent upon product type so it’s called a bit differently in the XML layout file. I tried the before and after attributes and it didn’t seem to work.
You can use the ‘before’ and ‘after’ attribute in the block tag to position the blocks.
1. before="-" positions the block before all other blocks
2. after="-" positions the block after all other block
3. before="some_block" positions this block before another block with name="some_block"
4. after="some_block" position this block after another block with name="some_block"
For example <block name="this_block" before="that_block"/>
any reason “1. before="-" positions the block before all other blocks” wouldn’t work? i can’t seem to get VerNav above the layered nav. :(
You can use the ‘before’ and ‘after’ attribute in the block tag to position the blocks.
1. before="-" positions the block before all other blocks
2. after="-" positions the block after all other block
3. before="some_block" positions this block before another block with name="some_block"
4. after="some_block" position this block after another block with name="some_block"
For example <block name="this_block" before="that_block"/>
any reason “1. before="-" positions the block before all other blocks” wouldn’t work? i can’t seem to get VerNav above the layered nav. :(
For me this doesn’t work either. Can’t put anything above cart_sidebar. Has this changed in 1.4?
Edit: it appears that the cart has a before="-" in checkout.xml
and rename it like
<reference name="header">
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/mini.cart.top.phtml">
</block>
</reference>
place it at above the <reference name="left"> code block
(2)
now copy template -> cart -> checkout -> sidebar.php and save it in the same folder as mini.cart.top.phtml.
Thats it.
For more explanation here is my code for checkout.xml