I have a menu on my Magento website generated from my categories.

For this menu I am using images. The problem is when I remove a category then the image for the links are not attach to the right link... Because the classes that I am using for CSS are numbered and not named.

So is there a way to add my own class for a category link?

  • Are you using Page Topmenu or Catalog Navigation?
    – Aboodred1
    Commented Nov 21, 2013 at 0:56
  • Catalog Navigation.
    – jnbdz
    Commented Nov 21, 2013 at 7:09

1 Answer 1


Sadly changes to the Catalog Navigation are not that easy. The function that does all the work is Mage_Catalog_Block_Navigation::_renderCategoryMenuItemHtml

This adds the category link with the following lines:

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

I would suggest that the best way to do this would be to create a module that rewrites this class you you could change these lines to meet your needs.

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.