Magento 1.9 RWD Theme – Add New Links to Top Links

ce-1.9.0.1local.xmlmagento-1.9rwd-themetoplinks

It's pretty easy to add some types of links to top menu using this method:
http://www.magentocommerce.com/knowledge-base/entry/adding-page-links-in-the-navigation-bar

But I cannot figure out how to add a simple home page link. The above method does not seem to work. It seems that the method requires some type of URL, and if it's left blank or a "/" is used, Magento makes up a link that does not work.

I have custom theme, based on the RWD theme, with a local.xml file. I have tried to add code suggested from various websites, to add a new top link, but the code seems to not work for Magento 1.9.

I have been experimenting with the renderer.phtml file in my theme, with no luck.

Any suggestions for adding a link in the top links of Magento 1.9, especially a home page link?

Best Answer

First copy topmenu.phtml from

/app/design/frontend/rwd/default/template/page/html/

Save this file as topmenu.phtml to

/app/design/frontend/YOUR PACKAGE/YOUR THEME/template/page/html/

Edit this file within lines 38-40, paste the following:

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-link')->toHtml(); ?>

To create:

<ol class="nav-primary">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-link')->toHtml(); ?>
<?php echo $_menu ?>
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('post-menu-links')->toHtml(); ?>
</ol>

Save and re-upload this file.

Create a CMS > Static Block, named home-link enter the following into your block (Hide Editor, as needed):

<li class="level0 nav-1 parent"><a href='{{config path="web/unsecure/base_url"}}' title='Home Page' class='level0'>Home</a></li>

Note: I leave all of the class names consistent with 1.9. Feel free to adjust class names as needed.

Save your new Static Block.

Create a CMS > Static Block, named post-menu-links Enter the following into your block (Hide Editor, as needed):

<li class="level0 nav-1 parent"><a href="CUSTOMPATH-1.HTML" title="LINK TITLE #1" class="level0">LINKNAME #1</a></li>
<li class="level0 nav-1 parent"><a href="CUSTOMPATH-2.HTML" title="LINK TITLE #2" class="level0">LINKNAME #2</a></li>
<!--  and so on, as needed ...  -->

Save your new Static Block.

Be sure to clear the cache and refresh your browser.

Related Topic