How To: Add Home Link to Menu Bar

For the Home link in the menu bar of the main template you can add some code to one of the template files.

Find the file called top.phtml in app/design/frontend/default/default/template/catalog/navigation/ and make the following change:

<div class="header-nav-container">
    <div class="header-nav">
        <h4 class="no-display"><?php echo $this->__('Category Navigation:') ?></h4>
        <ul id="nav">
 
        <!-- HOME BUTTON HACK -->
        <li><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home') ?></a></li>
        <!-- HOME BUTTON HACK -->
 
        <?php foreach ($this->getStoreCategories(10) as $_category):?>
            <?php echo $this->drawItem($_category) ?>
        <?php endforeach ?>
        </ul>
    </div>
    <?php echo $this->getChildHtml('topLeftLinks') ?>
</div>

 

If you want the home button to behave as te rest (get the active class when activated) change the above code to the following: (beware this is just as an hack as the previous example, but still, it works)

<div class="header-nav-container">
    <div class="header-nav">
        <h4 class="no-display"><?php echo $this->__('Category Navigation:') ?></h4>
        <ul id="nav">
 
    $_SERVER['REQUEST_URI'] == '/' ? $root = 'active' : $root = '';
 
        <!-- HOME BUTTON HACK -->
        <li class="<?php echo $root ?>"><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home') ?></a></li>
        <!-- HOME BUTTON HACK -->
 
        <?php foreach ($this->getStoreCategories(10) as $_category):?>
            <?php echo $this->drawItem($_category) ?>
        <?php endforeach ?>
        </ul>
    </div>
    <?php echo $this->getChildHtml('topLeftLinks') ?>
</div>

Was this answer helpful?

 Print this Article

Also Read

How To: Move Magento from Subdomain to Main Domain

Moving Magento from your Subdomain to your Main Domain (and vice versa) is very seamless and...

How To: Install Magento using Installatron Script Installer

There are a few easy steps that you will need to take to install Magento using Installatron...

Magento Security Patches

From time to time Magento will release patches for security vulnerabilities or simply standard...

How To: Remove Add to Cart buttons from Catalog Pages

If you want to remove the “Add to Cart” buttons from the catalog pages, this is how...

How To: Add Attributes to Product Grid in Category

Introduction Here we will show how to add your more attributes to the category view product list...