Jump to content

How to hidethe category if all product in category out of stock.


vishalsingh119

Recommended Posts

Hi guys,

 

i am facing an issue ,i have one category that have two disable or out of stock product.so i want to hide category automatically not by admin pannel.How to disable the category if all product in category disable.if any product have stock then category visible.

 

so tell me some msqul query or php script

Link to comment
Share on other sites

You could use a mysql trigger that with each product deletion/disabling/out-of-stock checks whether the categories involved now have zero products and then switches it off. You would need a second trigger that in order to switch it on again when products become available.

Link to comment
Share on other sites

You could use a mysql trigger that with each product deletion/disabling/out-of-stock checks whether the categories involved now have zero products and then switches it off. You would need a second trigger that in order to switch it on again when products become available.

I tried the mysql trigger but they are not working,better if you have some php customization code.so guide me for that,so i change in php file

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...