My magento version is 1.9 and i am using rwd theme.
I want to remove link from the menu on homepage... I tried the following stuff but it didn't work:
- Create some folder as this path: app/code/local/Mage/Catalog/Block
- Copy file Navigation.php from app/code/core/Mage/Catalog/Blocktoapp/code/local/Mage/Catalog/Block
- Go to function - _renderCategoryMenuItemHtml()
 Replace the code- $html[] = '<a href="'.$this->getCategoryUrl($category).'"'.$linkClass.'>'; $html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>'; $html[] = '</a>';- with this code - if($category->getLevel()== 2 && $hasActiveChildren) { $html[] = '<a href="[removed]void(0);"'.$linkClass.'>'; $html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>'; $html[] = '</a>'; } else { $html[] = '<a href="'.$this->getCategoryUrl($category).'"'.$linkClass.'>'; $html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>'; $html[] = '</a>'; }
- 
 1Ok, so you tried some stuff, but... what did happen (or didn't)? And what did you want to happen/achieve? I'm missing the actual question here, as "How to ...?", "Why ...?", "What ...?"7ochem– 7ochem2015年06月09日 07:50:47 +00:00Commented Jun 9, 2015 at 7:50
- 
 i want to remove link from the menu on homepage...i tried the above stuff bt it didnt workedkarsh– karsh2015年06月09日 08:00:46 +00:00Commented Jun 9, 2015 at 8:00
2 Answers 2
If i understand your request correctly, you want to remove a category in your main product category structure from the main menu.
You can do this in the admin of your site catalog->manage-categories. Select the category you wish to hide and under the general information tab you have the Include in Navigation Menu * option that you can set to no. 
Starting version 1.7, the top menu is not rendered anymore using the app/code/core/Mage/Catalog/Block/Navigation.php block.
Instead it makes use of an event called page_block_html_topmenu_gethtml_before through which you can add anything to the top menu, not only categories.
The categories are added to the top menu using Mage_Catalog_Model_Observer::addCatalogToTopmenuItems that calls _addCategoriesToMenu from the same class
In this last mentioned method you will find the configuration of the menu item: 
 $categoryData = array(
 'name' => $category->getName(),
 'id' => $nodeId,
 'url' => Mage::helper('catalog/category')->getCategoryUrl($category),
 'is_active' => $this->_isActiveMenuCategory($category)
 );
you can replace the line 'url' with something like this:
'url' => ($category->getLevel()== 2 && $hasActiveChildren) ? '[removed]void(0);' : Mage::helper('catalog/category')->getCategoryUrl($category),
- 
 i want remove link from menu and my magento version is 1.9 rwd themekarsh– karsh2015年06月09日 07:57:50 +00:00Commented Jun 9, 2015 at 7:57
Explore related questions
See similar questions with these tags.