Magento’s XML layout and template framework and the flexibility that it brings is awesome, but unfortunately it does come with its own learning curve. This can take some time getting used to if you’re unfamiliar with Zend Framework and can turn the most trivial of tasks like modifying the links in the footer of a page somewhat more involved.
So let’s have a look at template/page/html/footer.phtml
You will be able to see that this gives us the footer div and loads most of the content through:
This is looking for xml layout instructions with a reference named “footer”. We find one appearance in cms.xml.
As the comment explains, this merely defines that there is a static block available, named “footer_links” and its content is defined in Magento Admin->CMS->Static Blocks.
You can change the static block that is loaded by updating the block id with the name of your block.
You can then create your list of links as appropriate in the Magento backend, the default footer block contains:
There are a couple of reasons why it’s great to edit the footer links in this way. One is that the store owner can easily change the footer at a later date without needing a professional to hand. Another, is the flexibility to add different content if you so wish, it doesn’t have to be a simple list of links.
Another block with a “footer” reference can be found in page.xml:
In the page/template/links.phtml file we can see a function call to $this->getLinks();
The structure for this Block is in
Now layouts can add links to this structure. So if we take a quick grep of the layout files for block name “footer_links”, we can see what else is adding items to the footer links by the addLink method.
Now that you know where each of these are defined you can remove them if necessary in your theme. Of course, you have now realised that this is also a second method for adding footer links! The advantage of this method is that if all you need is another link, it doesn’t require you to go into the Admin interface to add new cms block. It all can be done in xml files rather than being in the database.
This took me some time to work out first time around, so I hope it’s useful and time-saving to another Magento developer!