Add Home link in Magento top navigation menu

Add Home link in Magento top navigation menu

By default there is no Home link in Magento top navigation menu 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 ?>

Author: Tahir Yasin

Tahir is a Passionate Web Developer from Lahore, Pakistan and a guy with NEVER-STOP-LEARNING attitude who keeps an eye on emerging technologies and customer trends.

1 thought on “Add Home link in Magento top navigation menu”

Leave a Reply

Your email address will not be published. Required fields are marked *