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.

In Magento 1.7 the top links are now located in the following file/folder:
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() ?>
<?php endif ?>

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


<li><a href=”{{store direct_url=”/about”}}”>About Us</a> </li>
<li><a href=”{{store direct_url=”/herbal_supplements”}}”>Herbal Supplements</a>
<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>

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.