Hide empty categories?
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.
Afaik, only with paid modules
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.
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.
@dynambee +1 that would be great feature, plus auto disable products that has empty stock (I still use mysql trigger to do this)