Monday, April 12, 2010

Move footer links to the top

Problem: How to move footer links to the top of the page
More details here:http://www.magentocommerce.com/boards/viewthread/178685/ or here http://www.magentocommerce.com/boards/viewthread/177423/

Possible solution:
Edit this file:
app/design/frontend/{interface}/{theme}/layout/page.xml
Look for this line:
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
It should be inside of an other <block> tag named footer.
Remove it from there and put it inside the <block> named 'header' (same file).
It should look like this (or close to it):
BEFORE:
<block type="page/html_header" name="header" as="header">
<block type="page/template_links" name="top.links" as="topLinks"/>
<block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
<block type="core/text_list" name="top.menu" as="topMenu"/>
</block>
AFTER:
<block type="page/html_header" name="header" as="header">
<block type="page/template_links" name="top.links" as="topLinks"/>
<block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
<block type="core/text_list" name="top.menu" as="topMenu"/>
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
</block>

Then edit app/design/frontend/{interface}/{theme}/template/page/html/header.phtml
Add this line at the end of the file (or where ever it fits your needs)
<?php echo $this->getChildHtml('footer_links') ?>
Clear the contents of dir var/cache and it should work. You might need to do some css work so the new added links would look nice.

7 comments:

  1. I tried doing this but all it did was my categories at the top of the page disappear and nothing else.

    ReplyDelete
  2. This is strange. The categories shouldn't disappear because you don't delete anything. Do you? Make sure you didn't remove anything. I tested it on the default theme and it worked. It looked let's say 'not to nice' :) but it worked.

    ReplyDelete
  3. No I need this on a modern theme, what i really want is a nice navigation bar(grey color) with the footer links inside that navigation bar horizontally from left to right. If you can provide me with the code to do this, i would be more than happy to paypal you the money.
    Thanks
    Nick

    ReplyDelete
  4. Sorry man. I'm no designer (I'm barely a programmer :) ). The code above should move the footer links on th top. (It worked for me) After that you need designer skills (which I don't have) to make it look nice.

    ReplyDelete
  5. No problem, thanks for the input, high appreciated.

    ReplyDelete
  6. Excelent job! It works fine for me. Thanks, Marius!

    ReplyDelete
  7. My whole site just froze. It wasn't really a good idea here. Happy that I tested it locally before.
    I think that this might work for some people, so thanks for sharing.

    ReplyDelete