Magento Ecommerce – Create New CMS Page & Add Link in Top Menu Along with Category Links

Magento Ecommerce: Create a new CMS page and have the link to it show up in the menu alongside the category links.

Brick House Bakery project: adding the Survey page link to the top navigation bar, alongside the existing category links.

1. Create a new CMS page, titled Survey, in Magento’s admin (Admin > CMS > Manage Pages > Add New Page)

This is our newly-created page’s path: http://www.brickhousebakery.com/survey

2. Add “Survey” link as a line-item (<li>) to the top menu (root > magento > app > design > frontend > default > default > template > catalog > navigation > top.phtml)

top.phtml file:

<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* @category   design_default
* @package    Mage
* @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*/
?>
<?php
/**
* Top menu for store
*
* @see Mage_Catalog_Block_Navigation
*/
?>
<div class=”header-nav-container”>
<div class=”header-nav”>
<h4 class=”no-display”><?php echo $this->__(‘Category Navigation:’) ?></h4>
<ul id=”nav”>
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php echo $this->drawItem($_category) ?>
<?php endforeach ?>
<!– bof – added line-item so survey link will appear in the navigation alongside the existing category links –>
<li><a href=”http://www.brickhousebakery.com/survey/”>Survey</a></li>
<!– eof – added line-item so survey link will appear in the navigation alongside the existing category links –>
</ul>
</div>
<?php echo $this->getChildHtml(‘topLeftLinks’) ?>
</div>

No Comments

  1. mark on November 28, 2008 at 5:19 pm

    So is there actually a way to do it dynamically or just hard coded?

    Also – I can’t really find the way to display categories in the top navigation in the first place. I’ve been searching internet for hours now and nothing – any tip?

    Thanks

  2. admin on December 3, 2008 at 1:37 am

    The Survey text link that was added to the navigation bar was hard coding into top.phtml. I don’t know of a way to do it dynamically.

    With regard to displaying category links in the top navigation: do you mean displaying links in the “header-nav,” which contains all of the category titles, or displaying links in the “shop-access” nav, which is part of the “quick-access” section?

    If you mean category links in the “header-nav,” please read: http://www.magentocommerce.com/wiki/welcome_to_the_magento_user_s_guide/chapter_3#creating_categories

    If you mean links in the “shop-access” nav, I haven’t attempted to add any links to that section yet and don’t have any followup information.

    Good luck.

  3. RichAgent on May 30, 2009 at 9:59 pm

    After reading through the Magento User Guide it’s very clear how to create a new category and make the settings so that it will display as a link in the main navigation.

    BUT after making these settings I am still not seeing these categories as links in my navigation.

    After looking at top.phtml file it has the code to pull the categories…

    Any Ideas ? Thanks!

  4. Reid Walley on June 2, 2009 at 11:31 am

    As far as I can tell, Magento requires products to be in a category in order for the category link to appear in the navigation. Please make sure you have products in your categories.

  5. ben on April 16, 2010 at 11:38 am

    Thanks! Exactly what I was looking for.

Leave a Comment