Magento – How to disable navigation menu link

magento-1.9menuoverridesrwd-theme

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:

  1. Create some folder as this path: app/code/local/Mage/Catalog/Block
  2. Copy file Navigation.php from app/code/core/Mage/Catalog/Block to app/code/local/Mage/Catalog/Block
  3. 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>';
    }
    

Best Answer

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.

enter image description here

Related Topic