How can I add CMS Pages to the Main Menu?

  • See Here
    – dh47
    Commented Feb 2, 2015 at 7:59
  • No work 1.9.1 have not this part app/design/frontend/default/default/template/catalog/navigation/top.phtml
    – andy
    Commented Feb 2, 2015 at 11:46
  • Hi Andy you could create an empty category and select content type as only static block then assign your static block as the page, Its an easy non technical solution
    – NathanielR
    Commented Jun 30, 2015 at 5:25

4 Answers 4


Andy, Magento default does not have this functionality. I do not know why you have add a CMS page to your menu. You may be want to call some CMS content from a link.

I'll give you an alternate solution—create CMS Static Block: Admin > CMS > Static Block.

Then create a new category from admin category and go to that category and assign this Static Block from Display Setting Tab. Select Display mode Static Block Only. That means instead of displaying products at that category, a static block will display on this category.

  • sorry, i dont understand ..but i want to add link in menu...
    – andy
    Commented Feb 2, 2015 at 19:10

The perfect way of adding a topmenu item is to listen to the event page_block_html_topmenu_gethtml_before. For this, you need to create an extension. Suppose your module is Namespace_Module. Then these are the important parts of your extension (I assumes you have basic understanding on how to create a module. If you don't know, GOOGLE is your friend).

File : app\code\local\Namespace\Module\etc\config.xml


Here we are registering an observer. It tells to Magento, whenever Magento process the event page_block_html_topmenu_gethtml_before, it should call my module's observer method addCMSPageToTopmenu().

Now observer will look like this.

File : app\code\local\Namespace\Module\Model\Observer.php

class Namespace_Module_Model_Observer
    const CMS_PAGE_IDENTIFIER = 'your_cms_page_identifier_code';

    public function addCMSPageToTopmenu(Varien_Event_Obsever $observer)
        //retrieves topmenu block
        $block = $observer->getEvent()->getBlock();
        //retrives topmenu parent tree node
        $parentTopmenuNode = $observer->getEvent()->getMenu();

        //retrive cms page.
        $page = $this->_loadCmsPageByIdentifier();

        //it's time to add it to the menu
        if ($page !== false) {
            $cmsNode = $this->_makeCmsMenuNode($parentTopmenuNode, $page);

        return $this;

    protected function _loadCmsPageByIdentifier()
        $cmsPage = Mage::getModel('cms/page')
        if (isset($cmsPage->getPageId())) {
            return $cmsPage;
        return false;

    protected function _generateMenuIdForCmsPage()
        $cmsPageCode = strtolower(self::CMS_PAGE_IDENTIFIER);
        return 'cms-node-' . $cmsPage;

    protected function _makeCmsMenuNode($parentNode, $cms)
        $tree = $parentNode->getTree();
        $url = Mage::helper('cms/page')->getPageUrl(

        $pageData = array(
            'name'      => $cms->getTitle(),
            'id'        => $this->_generateMenuIdForCmsPage(),
            'url'       => $url,
            'is_active' => $cms->getIsActive()
        $cmsNode = new Varien_Data_Tree_Node(
            $pageData, 'page_id', $tree, $parentNode

        return $cmsNode;

Here set your cms page identifier for the constant CMS_PAGE_IDENTIFIER. That's all you need to do. What we are doing here is, we are creating a new Varien_Data_Tree_Node for our cms page and set it's important properties and then add the above node to the parent topmenu node. That's it.

Note 1: As far as I know this is the best and cleaner method. For reference you can look into Mage_Catalog_Model_Observer@addCatalogToTopmenuItems(). This is where category menus are adding to the topmenu node.

Note 2 : I didn't try this code. So I cannot give you 100% garanty. But it is very close. :-)


Find the file called topmenu.phtml in app/design/frontend/default/[yourtheme]/template/page/html and make the following change:

    <ol class="nav-primary">
        <li class="home<?php if($this->getUrl(cms_id)):?> active<?php endif;?>"><a href="<?php echo Mage::helper('cms/page')->getPageUrl(cms_id)?>"><?php echo $this->__('CMS Page') ?></a></li>
        <?php echo $_menu ?>

This will add a cms_id page. Remember to replace cms_id with your CMS id.

Hope this helps.

More info.

This can be done by using URL Rewrite Management

Step 1. go to Catalog -> ‘Manage Categories’ and Highlight Default Category and Click Add Subcategory and then create the subcategory and note the url key.

Step 2.go to Catalog-> ‘URL Rewrite Management’ search the url key your just create in the input "Request Path" ,Your will see ID,Store View,Type,ID Path,Request Path, Target Path..
Note the "ID Path" and "Request Path" click Edit and see ID path and Request Path are there. 
 You will see the "Target Path" are not what you want.so ....

Step 3. Delete it(reminder(Note the "ID Path" and "Request Path" and which store it belong,you may delete more stores as you need).
Step 4 .Click ‘Add URL Rewrite’->Select “Create URL Rewrite:” drop-down to “Custom”
 Then enter “ID Path”: *****
 Enter category url in “Request Path”: 
 Enter the url where you want to redirect in “Target Path”:the URL you need,For example(http://myfavor.ca/)or home(simple url key from your cms page)
 Select “Redirect”: permanent(301)
 then click “Save”.
Step 5. Check it and see the result,if it does not work
Step 6. GO to system and index management to reindex the url.
Step 7. click accept or comment here,I will guide you to fix your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.