Jump to content
thirty bees forum

Hide empty categories?


Recommended Posts

Is there any way to automatically hide categories (front office) that don't have any products assigned to them?

Basically if there are products in the category I want customers to see the category. If there aren't products in the category then I'd prefer if the category doesn't appear in the front office.

Link to comment
Share on other sites

There are many ways to achieve this. I would probably override getSubCategories() function or assignSubcategories() from the controller. This will only deal with category page. You will also need to override blockcategories module getTree() function if you want to hide it from the module as well. If you need to hide it from the top menu than its a bit more complicated.

of course you can also do it inside the template, but I don't recommend it.

Link to comment
Share on other sites

Thanks everyone. It seems like something that would make an ideal standard back office option for 30bz, but I'm sure there are other higher priority things to implement.

For now I will manage this through the API by setting the "displayed" option as needed depending on if there are any available items in a given category.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...