Skip to Content

Magento E-Commerce and the elusive footer links

In the past few months, I've been preparing an online store using Magento. I've been taking it slow, but am trying to get this store ready to launch before the new year. Magento is um, different. Yeah, that's the word. It is NOT a content management system, though it can do some of the same tasks. But because it is not a CMS, doing things that would be simple in other CMS systems can prove challenging. A great example is the footer links.

After getting a theme set up, Magento was showing me the following in my footer.

About Us | Customer Service | Privacy Policy

Site Map Search Terms Advanced Search Orders and Returns Contact Us
© 2012 All Rights Reserved.

The first three links are simple. This actually follows the CMS concept and is a block that can be edited or disabled from the Admin interface. Go to CMS -> Static Blocks and click the Footer Links block to edit it. Hit save when you are done, refresh your cache (System -> Cache Management, select all, set the action to "refresh" and click Submit), and you are all done. That one line will now reflect whatever changes you just made.

The last line - the copyright statement, this is also simple enough. It is set in the configuration menu. In the Admin interface, navigate to System -> Configuration -> General -> Design -> Footer. Set the Copyright text to what you want and save your settings.

BUT, that middle like - the Site Map, Search Terms, etc. - that is not obvious at all. It turns out these are populated by means of Magento's powerful, but complex layout system. Luckily, after wading through that quagmire of information (most of the posts out there are dated and do not apply!) a single file needs to be changed.

Here's the short version of how the layout system works. It has cascading defaults. The "Base" theme is the source for everything. Don't edit this directly. Then the "Default" theme is the core that sets how the site should look. In the community version of Magento, another theme may exist within the Default theme - let's call this the target theme. The target theme only needs to define things that are different from the Default or Base themes. The system falls back through these themes to find the required behavior/layout.

The layout consists of two parts - PHTML files which do the PHP and layout work for the various elements, and .XML files which define the elements. Some of these elements - like the Site Map, Search, etc. create a layout reference to add a link to the footer. One way to turn off the elusive footer links is to edit each of these XML files (only those that apply) and remove the "footer_links" reference.

But there is an easier/faster way.

Because layout is driven by XML, it is possible to edit/create a local.xml file that overrides the layout elements for your particular theme. This file can be found at [[magento dir]]app/design/frontend/default/[[your theme]]/layout/local.xml - or created there if needed. In this file you can refine what site elements, references, or blocks are used. In our case we need to turn off the footer_links block. So edit the local.xml file and add the following just above the </default> tag:

Once you have done that, refresh your cache (see above for how to do that), and reload your site. Voila - the elusive links are gone. This step doesn't remove the CMS style footer block, or the copyright notice. It simply removes the layout element called "footer_links".

Now discovering this was fun, and took some experimenting. But, my info regarding the local.xml file and the overall layout come from the Magento Design Guide. This document isn't going to make you a Magento design expert - but it will point you in the right direction and kickstart your progress.

So a nice long winded way to say add this one line to a file. But I'm hoping that by writing this up in the long form, someone will be spared the pain of digging through this themselves.

Happy e-commerce!!