My category/subcategory relationships are structured from a cosmetic point of view for the menu:

Root->Parent (no products)->Cosmetic Category (no products)-> actual subcategory (products)

I want my URL for the actual subcategories to exclude the Cosmetic Category. The cosmetic category will always exist at level 2 (if root is level 0). I am trying to implement a check that if the parent category has 0 products and is level 2 then to exclude it from the URL. I have been unsuccessful so far. Any recommendations? Thanks.

1 Answer 1


I think one thing you could do would be to work with the function getCategoryRequestPath in the class Mage_Catalog_Model_Url. In this function there is a check to add the $parentPath if at this point you check to see if the parent has products and then exclude the path if there are no products.

Note: be aware that making this check will have a knock-on effect on performance

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.