Override default Magento menu with mine

This page explains you how to override the default Magento menu with another one using Advanced Content Manager for Magento 1.

If you have a Magento 2 store, you can use the extension Advanced Mega Menu Manager to simply add and custom any type of menus.

Once your menu is created, the first step is to add the block to your layout.

1. Layout

Edit or create the file app/design/frontend/your_package/your_template/layout/local.xml

Add these lines:

  xml version="1.0"?>
  <layout>
      <default>
          <reference name="catalog.topnav">
              <block type="contentmanager/menu" name="main-menu" />
          reference>
      default>
  layout>

Based on Magento version 1.8 CE.

2. Edit the template file

app/design/frontend/your_package/your_template/template/page/html/topmenu.phtml

If it does not exists copy it from base/default/template/page/html/topmenu.phtml to the above path. Then edit it.
For magento version lower than 1.8, the file is different: template/catalog/navigation/top.phtml

Replace

  
class="nav-container">
    "nav"> echo $_menu ?>
  
class="nav-container"> echo $this->getChildHtml("main-menu"); ?>

3. Make your menu using the same CSS than the default one.

ACM provide template file that can be modified, but you can also create dynamic template file corresponding to your menu.
Click here to learn more about menu template.

Copy file app/design/frontend/default/default/contenttype/menu.phtml to app/design/frontend/your_package/your_theme/contenttype/menu.phtml

This is your new file that will be called to display menu, but ACM also allow you to make a specific template for your specific menu.
Simply rename it from “menu.phtml” to “menu-main-menu.phtml” where “main-menu” match your menu identifier.

Edit it and add the id=”nav” to the

    , line 30.

    Line 30

      
      "nav"> foreach($nodes as $node): ?> echo $menu->render($node); ?> endforeach; ?>
loader
Chargement en cours...