Adding Item to Footer in Magento

Engine: Magento
Editor: Notepad++

This stumped me for a while.  I would have imagined that adding an item (let’s say shop policy) in the footer of Magento would be super easy to do. But I guess because they have cool fancy hover features, and are automatically grabbed, it’s complicated.

The Easy Way | Adding Footer Items in Magento

The easy way to add links that are kind of ugly and just kind of splayed out there is to go into your CMS -> Static Blocks and edit the content of the Footer Links block to include the link you’re looking for.

However, this will not add the new links nicely to the same link bar as the Site Map, Search Terms, Advanced Search,… search bar that has the cool hover effects (in the theme I’m using).

Further, I’ve disabled this Footer Links block so even if I do add an item here it won’t display.

It may work for you.

The Hard Way | Adding Footer Items in Magento

The hard way to add an item into the footer of your Magento install is actually not so hard (I’ve done all the hard work for you now to find the solution!).

Since the items in the Footer menu of Magento are automatically grabbed using some fancy script (<action method=”addLink”>) it can be added to the local.xml file, a file that is always scanned by the browser (forced by the engine) for content to add to pages.

The local.xml file is found at /app/design/frontend/<theme name>/default/layout/local.xml (note: /default/ might also be customized to be a specific style of the theme)

Open the local.xml file in your html editor of choice (this can also be simply notepad, I use a program called Notepad++) and browse to the section on Footer.

I wanted to add a page called Shop Policy, so just under the commented out identification for this section (<!– Add blocks for the footer here –>) I added the following code:

<reference name="footer_links">
      <action method="addLink" translate="label title" ><label>Shop Policy</label><url>http://<store url>/shop-policy</url><title>Shop Policy</title></action>
</reference>

 

Once this new code has been saved to your server, make sure to flush the cache (System -> Cache Management -> Flush Cache) and then refresh your website page to make sure the new footer item has been added!

Assumptions | Adding Footer Items in Magento

So, a few of the assumptions I’ve made.

I have assumed that you’ve already created a page titled Shop Policy with a slug of shop-policy. If not, this is done by going to CMS -> Pages -> add new. If you’re not creating a page called Shop Policy and want to name it something else, make sure the something else is changed in the code above.

I’ve also assumed that your local.xml file exists and that it has the section for a Footer. I will not go into creating this file here.

Finally, I’ve assumed that you have granted the right access to the page to be re-saved. If you’re on lockdown like I am, you’ll need to change the writing privileges to the local.xml file using something similar to:

sudo chmod u+w /directory to install/app/design/frontend/<theme name>/default/layout/local.xml

 

Don’t forget to revoke that access rights though once you’ve saved the file! (chmod u-w)

Hope this helps!

Leave a Reply

seventeen − 11 =