dynambee Posted May 15, 2017 Posted May 15, 2017 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.
yaniv14 Posted May 15, 2017 Posted May 15, 2017 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.
dynambee Posted May 16, 2017 Author Posted May 16, 2017 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.
dosbiner Posted May 16, 2017 Posted May 16, 2017 @dynambee +1 that would be great feature, plus auto disable products that has empty stock (I still use mysql trigger to do this)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now