Articles in this series

Author - Paryank Kansara

I have extensive experience in web development of community based and enterprise level applications. My expertise includes sectors like: e-Commerce, Social Networking Portals, Content Management Systems, etc.

More Info » Follow me on Twitter »

Reader Comments (19)

  1. Digging Deeper Into Magento’s Layout XML – Part 2 | Magento Training Course

    […] Magneto’s layout rendering process and gives more insight into layout handles and updates. Link – Trackbacks source: Topsy – magento tutorial – Digging Deeper Into Magento’s […]

  2. Happy
    January 30, 2011 at 11:10 am /

    Thanks for Part 2, it covers some things i’ve not seen mentioned elsewhere. Such as the fact you can use block names in after and before rather than having to depend on the parent.

    I’m having troubles with this though. I have a block that displays on the shipment view page in the admin area. That works fine however I cant see to get my block to appear exactly where I want it. I want to display it between the block order_payment and shipment_tracking … so I try passing after=”order_payment”. This just displays my block at the very end of the page, after all other blocks. I also tried before=”shipment_tracking” however this again just displays my block at very start of page before all other blocks.

    So it seems I can get my block to display before and after all other blocks, but cannot nest it inbetween blocks.

    Is this something you have seen before or have an idea on?


    1. Robert
      January 30, 2011 at 12:32 pm /


      Trying to get a specific order for your blocks in the layout xml can sometimes be a challenge and requires some ‘voodoo’. You will need to check all the before and after attribute values for the blocks you are trying to nest between, sometimes they have their own values already and in that case you may need to change those first.

  3. naff
    February 3, 2011 at 8:55 am /

    Thanks so much for the great article.

    I must say that I like the way you explain everything so that’s it’s very easy to understand.

    Thanks so much.

  4. Magento小工
    April 18, 2011 at 4:53 am /

    Very good and usefull info about magento layout and blocks, I like it! Thanks a lot!

  5. 5 Useful Tricks For Your Magento local.xml – Tutorials – Magebase

    […] have covered a lot about Magento’s layout XML in our past 2 articles [1] [2]. We saw that Magento will read the layout XML files in a specific order and that the local.xml file […]

  6. Danny
    August 10, 2011 at 7:14 am /

    Thank you for this great article!

  7. Creating Custom Layout Handles – Tutorials – Magebase

    […] discussed in previous articles about Magento’s Layout XML, Layout Handles in Magento’s layout XML are XML nodes which contain the definition of updates in page […]

  8. 5 Useful Tricks For Your Magento local.xml | 奇才哥的外贸B2C SEO,SEM点滴

    […] have covered a lot about Magento’s layout XML in our past 2 articles [1] [2]. We saw that Magento will read the layout XML files in a specific order and that […]

  9. SS
    January 1, 2012 at 6:33 am /

    Block Name and Alias <— I think that was maybe a headline not in the pinn about "least one output block" ?

  10. Travis
    May 2, 2012 at 11:24 pm /

    Hi, great explanation. First one I’ve seen about non-output blocks. However, I’m still not clear on it.
    For example I have a block that is:

    <reference name="">
        	<block type="freegift/freeproduct"  template="mw_freegift/catalog_gift.phtml" name="freegift.other" as="other" />

    The block appears after all other blocks in the “” parent block.
    I tried added before=”-” and before=”other_block_names” to the block type line above but it didn’t do anything.
    I then found the parent block template uses a getChildHtml(‘other’) and displays this block, at the point where that getChildHtml() code is.
    Effectively, the before attribute is irrelevant in this case.

    Does this mean it is a non-output block?
    Looking at the function for it

    class MW_FreeGift_Block_Freeproduct extends Mage_Core_Block_Template

    Does this mean that Mage_Core_Block_Template is a non-output block?

    How do you know?

    Your list of block types on the first part of this tutorial don’t identify whether they are non-output types. I can find any other references to your discussion of non-output blocks???

    “As explained earlier, the non-output blocks are child blocks of output blocks and are normally rendered…. ”


  11. Ceniy
    July 6, 2012 at 3:16 pm /

    Very easy to understand. Thanks a lot.

  12. Rich D
    Rich D
    January 30, 2015 at 1:16 am /

    This tutorial series is fantastic! Thank you.

    I have some custom tabs that I have added to my product pages via local.xml. Can you tell me if there is a way to show/hide those tabs based on the products parent category using local.xml?

  13. Best tutorials for Magento | Ken Nguyen

    […] Digging Deeper Into Magento’s Layout XML – Part 2 […]

  14. Juniba
    November 1, 2018 at 5:56 pm /

    tutorial looks really good and very helpful fo men thank you 😉


Add a Comment & Join the Discussion

Insert small snippets of code by using [code]{your_code_here}[/code]
For larger code blocks please use and paste your link.

You may also use the following HTML in your comment: <a href="" title=""> <abbr title="">
<acronym title=""> <blockquote cite=""> <cite> <em> <strike> <strong>


This site uses Akismet to reduce spam. Learn how your comment data is processed.