The big fact is topmenu can be some other links except categories and I think that is what happens here. I am suspecting that, via a layout update or programmatically those menus are included in top menus.
Let us take the case of categories. Categories are included in menu programmatically. In Mage_Catalog
module, you can see that, it is listening to an event page_block_html_topmenu_gethtml_before
. This is a perfect event which will use by Magento to update topmenu items. Now if you look on the observer method and investigate further, then you will reach in this function at last.
protected function _addCategoriesToMenu($categories, $parentCategoryNode)
{
foreach ($categories as $category) {
if (!$category->getIsActive()) {
continue;
}
$nodeId = 'category-node-' . $category->getId();
$tree = $parentCategoryNode->getTree();
$categoryData = array(
'name' => $category->getName(),
'id' => $nodeId,
'url' => Mage::helper('catalog/category')->getCategoryUrl($category),
'is_active' => $this->_isActiveMenuCategory($category)
);
$categoryNode = new Varien_Data_Tree_Node($categoryData, 'id', $tree, $parentCategoryNode);
$parentCategoryNode->addChild($categoryNode);
if (Mage::helper('catalog/category_flat')->isEnabled()) {
$subcategories = (array)$category->getChildrenNodes();
} else {
$subcategories = $category->getChildren();
}
$this->_addCategoriesToMenu($subcategories, $categoryNode);
}
}
This function do mainly three things.
It will first collect all category tree list and iterate through them and in each time create an array with necessary keys $categoryData
Now it will set this array to an object which would be a new instance of Varien_Data_Tree_Node
Then this object is just get added to the topmenu block using the method addChild()
So the key point that you need to understand is, the exact same thing is happening some other module in your system via a layout update or programmatically. Your job is to find exactly where this happens.
In order to find any layout update that is related to top.menu
, you can perform a grep
operation.
grep -r top.menu
In order to find where topmenu updation happens programmatically
grep -r page_block_html_topmenu_gethtml_before
Hope that would helpe you to resolve this issue.