2

How can I show the subcategories in the frontend even if the parent category is disabled?

Suppose I have categories like following

Electronics
           Cell phones
                      Accessories
                      Digital Camera
           Cameras

I Cellphone category is disabled, is it possible to still show the sub categories Accessories and Digital Camera, under Electronics category?

2
  • show them where? How?
    – Marius
    Commented Feb 13, 2015 at 22:23
  • @Marius, in the example given above if Cellphone category is disabled,I want to display the accessories and the Digital camera under Electronics.
    – Mukesh
    Commented Feb 16, 2015 at 9:41

1 Answer 1

1

In short? No. But you could override the Mage_Catalog_Block_Navigation class, method _renderCategoryMenuItemHtml to not check for isActive.

You would have to commit out line 241-243 and probably remove the link to the category to prevent people from clicking on an inactive and non existing category. So on line 308 it should be something like this

if (category->isActive()):
   $html[] = '<a href="'.$this->getCategoryUrl($category).'"'.$linkClass.'>';
   $html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>';
   $html[] = '</a>';
else:
   $html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>';
endif;

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.