Magento Local.xml not working?

The Magento local.xml file is incredibly useful but what do you do if it isn't working?

First of all let's take a look at what the Magento local.xml file is capable of doing for your e-commerce website - all from one file.

  • Remove unwanted block such as polls, the ntorious 'back to school' poster and the ever-present 'dog'.
  • Remove the Paypal Partner Logo
  • Add extra stylesheets
  • Add some javascript
  • Additional nav in the right or left columns
  • Set the default catalog page layout

There are many more powerful uses for the local.xml file but what happens if you can't get your file to work?

Your local.xml file might be in the wrong place

If you are using any theme other than the default Mgento themes ensure you put your local.xml file in the following place:

app/design/frontend/default/YOURTHEME/layout/local.xml

You copied and pasted your local.xml file from somewhere else and it won't work

Beware - gaps in the wrong place in your local.xml file will stop it from working and cause you to tear your heair out looking for a fix. Take a look at this very basic local.xml file that removes the newsletter sign up form from the left column:

 

<?xml version="1.0"?>
<layout>
    <default>
        <reference name="left">
            <remove name="left.permanent.callout" />
            <remove name="left.newsletter" />
        </reference>
    <default>
</layout>

The above code works fine when placed correctly in your file structure.

However the code below will not work:

 <?xml version="1.0"?>
<layout>
    <default>
        <reference name="left">
            <remove name="left.permanent.callout" />
            <remove name="left.newsletter" />
        </reference>
    <default>
</layout>

Did you spot the difference? Any space before the start of

<?xml version="1.0"?>

Will stop your local.xml file from working! I hope this helps you along your way with Magento!

By Chris Fickling

Magento Local.xml not working?