Magento: Adding a ‘Home Link’ To The Top Menu

By default Magento does not have a Home Link in the top menu. If you have just created your Magento site with the sample data provided on the Magento site, you would have something similar to:

magento-sample-store

As you can see, there is no Home Link in the top menu. To go back to the Home page, a user is expected to click on the store logo which is something that a lot of users will not realise. Magento does not provide a method through which you can add a Home Link to your navigation menu using the Admin Panel.

So how can you add a Home Link to the top menu?

In order to add the Home Link to the top menu, open app/design/frontend/[your-theme]/default/template/page/html/topmenu.phtml. After Line 37 of this file which should read:

<ul id=”nav”>
add
<li class="home">
 <a href="<?php echo $this->getUrl(''); ?>">
   Home
 </a>
</li>

If you want to add an icon for the Home Link instead of text, you can accomplish that by:

<li class=”home”>
   <a href=”<?php echo $this->getUrl(”); ?>>
      <img src=”<?php echo $this->getSkinUrl(‘images/HOME_ICON_NAME’); ?>/>
  </a>
</li>

where HOME_ICON_NAME is the name of the icon you want to use and it has been uploaded to skin/frontend/[your-theme]/default/images.

Posted in Magento and tagged , , , .

Leave a Reply