Add “Home” link in Magento top navigation menu

Add "Home" link in Magento top navigation menu
Standard

Magento’s default navigation menu has no “Home” link but you can easily add it yourself.

1- Copy following 2 files

design/frontend/base/template/page/html/topmenu.phtml
design/frontend/base/template/catalog/navigation/top.phtml

TO

design/frontend/default/yourtheme/template/page/html/topmenu.phtml
design/frontend/default/yourtheme/template/catalog/navigation/top.phtml

2. Replace the content with following code

<?php $_menu = $this->getHtml('level-top') ?>
<?php if($_menu): ?>
<div class="nav-container">
    <ul id="nav">
         <!-- HOME BUTTON HACK -->
        <?php $_anyActive = false; foreach ($this->getStoreCategories() as $_category) { $_anyActive = $_anyActive || $this->isCategoryActive($_category); } ?>
        <li class="<?php echo !$_anyActive ? 'active' : '' ?>"><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home') ?></a></li>
        <!-- HOME BUTTON HACK -->
        <?php echo $_menu ?>
    </ul>
</div>
<?php endif ?>
Advertisements

4 thoughts on “Add “Home” link in Magento top navigation menu

  1. usman

    My menu is not showing a homepage link and the sub categories also. the sub categories work fine when i access them for other pages. help please

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: