Author - Robert Popovic

I launched Magebase in April, 2010 and am its editor and contributor. My main topics of interest are Magento development, customization and how to get the most out of Magento with the least amount of headache.

More Info » Follow me on Twitter »

Reader Comments (71)

  1. Eddie
    June 21, 2011 at 8:58 pm /

    An excellent article – particularly appreciated the info on customer_logged_in, etc.
    Regards, Eddie

  2. 5 Useful Tricks For Your Magento local.xml – Tutorials – Magebase | Magento Training Course

    […] 5 useful tricks to manipulate the Magento theme layout using local.xml. Link – Trackbacks source: Topsy – magento tutorial – 5 Useful Tricks For Your Magento […]

  3. WebFlakeStudio
    June 24, 2011 at 8:48 pm /

    Yet another great article about local.xml, thanks!
    Doing different things for logged in vs. not logged in users – not every Magento developer know about this, really very useful handles.

  4. MagePsycho
    July 5, 2011 at 11:18 pm /

    Really Kool tips/tricks. Keep up the great work.

  5. Quick Tip: Conditional Loading of JavaScript and CSS Using Your Module Configuration – Tutorials – Magebase

    […] I do it using my local.xml as outlined in my previous article. However, it would be good practice if module developers would provide the option right from their […]

  6. Jignesh
    August 18, 2011 at 11:54 pm /

    Excellent Article. Came to know about local.xml for the first time.

  7. Quick Tip: Conditional Loading of JavaScript and CSS Using Your Module Configuration |

    […] the styling and don’t want to add bulk to my site.Traditionally, I do it using my local.xml as outlined in my previous article. However, it would be good practice if module developers would provide the option right from their […]

  8. vijay
    August 22, 2011 at 10:19 pm /

    It is not working in my case, when i am trying to remove this

    how can i remove top line through using local.xml
    can you please let me know or
    am i making any mistake?

  9. vijay
    August 22, 2011 at 10:23 pm /

    i don’t know why is my code is not display in my comment but problem is i want to remove top link.

  10. vijay
    August 27, 2011 at 12:32 am /

    Big thx Robert, finaly i got solution………. 🙂

  11. vijay
    August 27, 2011 at 12:34 am /

    Big thx Robert, finaly i got solution……..:)
    and Great Article as well…

  12. Dgent
    September 1, 2011 at 12:23 pm /

    I also visited article. It looks like you are trying to create new theme copying existing theme so that in future, if theme gets upgraded, it wont override your changes. So if we are having new package then we can do whatever we like in available layout from the copied package. In this case, why do we need to create local.xml as layout if we are not doing anything more than default magento layout does?

  13. Lane
    September 8, 2011 at 4:12 am /

    The only problem with adding the jQuery from CDN as a block is that it gets thrown into the header AFTER the Magento layout Engine inserts the calls to . Is there a parameter to load a block before the addJs? All jQuery scripts need to be called in the footer with this technique otherwise.

  14. kumazo
    September 12, 2011 at 10:50 pm /

    Thank you for your your great article. I’ve been trying to show 6 upsell products on the product page, so your “3. Changing default block parameters” helped me a lot. But I tried as below but it doesn’t work. Only 4 upsell products are shown there. Can you please help me if you have any ideas?

    <layout version="0.1.0">
    	    <reference name="upsell_products">
    	        <action method="setItemLimit">
    	        <action method="setColumnCount">

    Thank you.

    1. kumazo
      November 14, 2011 at 5:35 am /

      I got a solution by myself.

      		<!-- デフォルトは2columns-rightだが1列に 20110904 Kubo -->
      		<reference name="root">
      			<action method="setTemplate"><template>page/1column.phtml</template></action>
      	    <reference name="content">
      	    	<reference name="">
      		        <action method="setItemLimit">
      		        <action method="setColumnCount">
      1. Aure
        September 19, 2012 at 10:33 pm /

        Thanks !

  15. Joel
    September 21, 2011 at 3:55 am /

    What is the preferred method to move the ENTIRE footer or Header? Referring to the modern template structure, I want to be able to move both the header-container and the footer-container div outside the page div.

  16. Rodney
    October 13, 2011 at 7:30 am /

    Do you know if the customer_logged_in and customer_logged_out handles are still available in ver 1.6 CE?

  17. katzw
    October 22, 2011 at 7:37 am /

    ^!&@%#$^&!%$# THANK YOUUU!!!! I’ve been trying to solve this for a month! 🙂

  18. Caroline Blijlevens
    November 4, 2011 at 9:56 pm /

    Nice article! Looks way easier than adjusting all the separate files. Thanks! 🙂

  19. Magento Sort By Newest Products Made Easy – Extensions – Magebase

    […] to set the default sort direction for the toolbar, you can do this via the layout XML. Best in your local.xml but you can edit catalog.xml if your theme has overridden […]

  20. Mattias Lyth
    Mattias Lyth
    December 20, 2011 at 9:56 pm /

    Great Article, I like this approach a lot and made modifications to the top links removing a faulty wishlist link that shows up for some reason and adding the correct wishlist link only for logged in customers.

    Everything works fine until I switch one the cache then the removal of the faulty wishlist link doesn’t work anymore. I have refreshed/reloaded and manually removed cahce files from var/cache/. Most of the local.xml modifcations works fine it’s just thins one removal that doesn’t play with the cache, any ideas?



  21. SS
    January 1, 2012 at 11:35 pm /

    ” operates on a localized context, specifically, in the context where you use it. So, if you want to remove a specific block from a specific layout handle and possibly insert it at another position or layout handle, you need to use this approach. ”

    For noobs like me could you be a little more clear in the phrase above ? What do you mean “localized” / “context where you use it” (use who exactly?). What approach are you refering to exactly ?

  22. Spot
    February 12, 2012 at 2:43 pm /

    Thank you, excellent info.

    I’m running a multi-store installation so I’ve extended the Mage_Core_Model_Layout_Update to have it load an extra XML for each store after the local.xml. This way I can do global changes in local.xml and store specific changes in the store specific XML, (in my case the naming convention is: 1,xml, 2,xml, 3,xml…).

    Basically I insert this line into getFileLayoutUpdatesXml :

    $updateFiles[] = "$storeId.xml";
  23. Teesable
    March 14, 2012 at 5:20 pm /

    I’ve been trying to remove the “My Cart” link in top.links and nothing I have found is working for Enterprise Edition of Magento. In my local.xml file I have:

    which have removed everything but this last item. This is the last of all the items that I am trying to remove.

    1. Joel
      March 14, 2012 at 5:36 pm /

      Your code didn’t post. I am using the following in my local.xml:




              <reference name="root">
                  <reference name="top.links">
                  	<!-- Removes 'My Account' link - Default position: 10 -->
      		<action method="removeLinkByUrl"><url helper="customer/getAccountUrl"/></action>
      		<remove name="checkout_cart_link"/>

      This works perfectly for me.

      1. Joel
        March 14, 2012 at 7:03 pm /

        Note for anyone looking later. My comment refers to CE. Robert’s code below is for EE

  24. Teesable
    March 14, 2012 at 6:12 pm /

    Thank you. That did the trick.

  25. Luis
    April 25, 2012 at 6:51 am /

    Hello, first, thanks for the nice useful tutorial. I’m wondering if you may help me:

    From the CMS, I’ve created and added a widget of recently viewed products to the products pages and set it to show up to 6 products using the grid view. So far so good, but now, how can I change the number of columns per row?


  26. user123
    April 27, 2012 at 1:55 am /

    Hi Robert,

    I am having problem adding/removing js/css.
    I have followed the procedure as enumerated by you.
    I am working with custom theme package=>theme name
    Am I making a mistake.


  27. user123
    April 29, 2012 at 3:14 pm /

    Hi Robert,

    Thanks for reply and your time.

    Actually I am a new to Magento and I want to develop a custom theme. However, I am able to make a static frontend but as far as dynamic frontend is concerned, I am stuck for instance as the top links like My Account etc. are not landing to their pages as per their url and how to co-relate xml with phtml in custom theme. I know I am pointing to a big picture here but that is what I am trying to figure out. Can you help me. I just want a little help so I haven’t given any code. Can I achieve it with just local.xml? if yes then how? I tried but no avail.

    Thanks for your valuable time.


  28. Fabian Borg
    May 22, 2012 at 1:59 am /

    Dear Robert,

    Thanks for the great tutorial. I have a multi-store [multi sub domain] running Magento CE v1.7 and would like to remove the topLinks from two stores.

    I did make use of the

    {<action method="unsetChild">}

    in the local.xml but I could not get this to work.

    This is the code I did:

            <reference name="header">
                <action method="unsetChild">
            <update handle="top_links" />
            <update handle="top_links" />

    But I cannot see it making a change. Also I would like guidance how can I make the product page load a js via the local.xml as I am stuck.

    With best regards


  29. Fabian Borg
    May 23, 2012 at 9:38 pm /


    Thanks for your input. With your method of just unsetting the topLinks for the particular stores vs. the one I did to unset toplinks in general and activate the toplinks for the desired stores, just worked fine 😉

    Thanks for the other tip as well 😉

  30. Joakim
    July 6, 2012 at 7:14 am /

    Great article! This will help a lot for my theme development. Thanks!

  31. Web Design
    November 12, 2012 at 5:03 am /

    Great tutorial, Im new to Magento so Ive found it very hand.

  32. Mathew Porter
    December 18, 2012 at 10:58 pm /

    Very useful article, especially point 2 in the article to reference external js files in local.xml.

  33. Naresh
    June 28, 2013 at 10:37 pm /

    Hi Robert

    I’m new to the Magento & i’m using Magento CE1.7

    I m designing my own site in that i created on login page for the sellers, in that page if they want to add a product to my site it has to ask “select category”. if they are going to select category it should open a new pop up window in that should have all categories in tree structure.if they select any of one category automatically that product has to add in that category in my site when i approve that in admin panel.

    Help me please

    for the seller page i’m using marketplace extension

    Thank you for ur suggestions

  34. krite
    November 7, 2013 at 7:22 pm /

    How to add mini cart into header by ajax
    ( in style and position mini cart : under top link
    Shopping cart : picture bags
    0 items : $0.00

    How to create or add it ? Please teach me Thank you very much.

  35. lampix
    January 28, 2014 at 12:46 am /




    So you can remove a link in local.xml without using the mentioned



    This example removes the Sitemap link from the footer:

    <reference name="footer_links">
    	<action method="removeLinkByUrl" ifconfig="catalog/seo/site_map"><url helper="catalog/map/getCategoryUrl" /></action>
  36. Digging Deeper Into Magento’s Layout XML – Part 2

    […] 5 Useful Tricks For Your Magento local.xml […]

  37. Nit
    February 18, 2014 at 11:55 pm /

    Hello Robert,
    Is it possible for guests to use the WISHLISTwithout login/register??
    Thanks in advance.

  38. Nit
    February 18, 2014 at 11:56 pm /

    Hello Robert,
    Is it possible for guests to use the WISHLIST without login/register??
    Thanks in advance.

    1. Bryan Veloso
      August 3, 2014 at 8:23 pm /

      It’s impossible because the wishlist couldn’t be saved for guests.

  39. Shirish
    October 16, 2014 at 8:31 am /

    Well I see that my local.xml file is visited by lots of visitors.

    Can you help me to understand what it is actually?



  40. Dave
    April 12, 2015 at 8:35 pm /

    Hi Rob,

    I cant seem to add css files using the ‘addItem’ method.

    However, the way shown in other tutorials does work, eg:


    What could I be doing wrong?

    Many thanks

    1. Dave
      April 12, 2015 at 8:38 pm /

      I mean I cant get ‘addItem’ method to work, but I can get the ‘addCSS’ method to work.

      I used the code exactly as you have.

  41. Atul kumar
    Atul kumar
    March 19, 2016 at 5:05 pm /

    Pls resolve my issue , I want to remove or hide Google map from contact us page. I m new in magento


  42. Henry Roger
    Henry Roger
    July 22, 2016 at 11:41 pm /

    Add a custom sort by option in Magento Sort by options list. The following blog explains how you can add a Sort by Rating or Sort by popularity option. Please comment where or not it works for you.

    Magento Sort products by Rating


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.