We are looking to improve our top navigation menu so that we can offer customers different ways to find products on our site. Currently we have the following top navigation structure:

  • Category 1
  • Category 2
  • Category 3

Now we would like to enhance this to offer customers the following top navigation options eg:

  • Shop By Product
    • Category 1
    • Category 2
    • Category 3
  • Shop By Room
    • Room A
    • Room B
    • Room C
  • Shop By Type
    • Type 1
    • Type 2
    • Type 3

The same products would appear within each menu but with a different route to finding items depending on how the customer prefers to browse for products (eg by room, type, etc).

Can someone suggest the best way to do this?

  • is room a and room b are products? also for types are this products or categories? May 14, 2015 at 16:38
  • Room A and Room B could be either categories or attributes, so we would have a structure like this: Shop By Room > Bedroom > Table Lamps > Product 1.
    – Chris
    May 14, 2015 at 22:12

1 Answer 1


This is a broad subject. I doubt you will get a fully working solution.
But I can give you a few tips.
The category menu is generated using the code in Mage_Catalog_Model_Observer::addCatalogToTopmenuItems and Mage_Catalog_Model_Observer::_addCategoriesToMenu.
You need to modify the first one I mentioned to add a new menu item, then add all categories under that menu.
Something like (untested code):

public function addCatalogToTopmenuItems(Varien_Event_Observer $observer)
    $item = array(
            'name' => Mage::helper('catalog')->__('Shop by category'),
            'id' => $nodeId,
            'url' => '#',
            'is_active' => false
    $node = new Varien_Data_Tree_Node(item, 'id', $tree, $observer->getMenu());
    $this->_addCategoriesToMenu(Mage::helper('catalog/category')->getStoreCategories(), $node);

Now, you have to use the event page_block_html_topmenu_gethtml_before to add all your other nodes. Here is an example on how to use the event](Adding links to category menu).
You need to add 2 top menu items Shop By Room and Shop By Type. And for these menu items you need to add as submenus the values of a certain attribute (room and type).
The best way to do it is to make the 2 attributes used in advanced search and then put the link in the menu to the advanced search page with the attributes selected.
you can get the url of the advanced search with a certain value for a certain attribute like this

Mage::getUrl('catalogsearch/advance/result', array('_query'=>'attribute_code=value'));

Now, to get all options of a certain attribute you can do this:

$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'attribute_code_here');
$options = $attribute->getSource()->getAllOptions(false);

then loop through the $options variable.
I hope you can put all these together and come up with a fully working solution.

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.