Adding CMS Pages to Magento Top Nav Bar

A frequent request with customers is adding CMS pages to Magento’s top nav bar. There are many ways to accomplish this, but the best way is to make it a static block so that clients can add or delete links on their own.
UPDATE:

In Magento 1.7 the top links are now located in the following file/folder:
app/design/frontend/default/your-theme/template/page/html/topmenu.phtml.
The file should look like this when done:

<?php $_menu = $this->getHtml('level-top') ?>
<?php if($_menu): ?>
<div class="nav-container">
   <ul id="nav">
   <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('top-navbar-before')->toHtml() ?>
       <?php echo $_menu ?>
       <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('top-navbar-after')->toHtml() ?>
   </ul>
</div>
<?php endif ?>

Create these two static blocks as follows:
top-navbar-before:
<li><a href=”{{store direct_url=”/”}}”>HOME</a></li>

top-navbar-after:

<li><a href=”{{store direct_url=”/about”}}”>About Us</a> </li>
<li><a href=”{{store direct_url=”/herbal_supplements”}}”>Herbal Supplements</a>
<ul>
<li><a href=”{{store direct_url=”qanda”}}”> Q and A</a></li>
<li><a href=”{{store direct_url=”/references”}}”> References</a> </li>
<li><a href=”{{store direct_url=”/research_studies”}}”> Research Studies</a></li>
</ul>
</li>

Once you save your static blocks, they should be visible in the top nav bar.
So, to recap, we have added two static blocks to the top menu, top-navbar-before and top-navbar-after.
We have added an list of links to those static blocks, which will display before and after the categories.

This entry was posted in Magento. Bookmark the permalink.