Reputation: 21
I'm trying to set it up so that when a product in the Magento store has a quantity of 0 or less, it changes the visibility of that product to Search only, instead of Search/Catalog.
The store is set up so customers can still order products even if the stock goes below 0, so it is not set up to automatically change to Out Of Stock or anything like that, I just want the visibility to change.
Has anyone ever been able to set up something like this before or can anyone advise me on where to look in order to add this functionality?
Thanks in advance!
Upvotes: 0
Views: 406
Reputation: 2338
Your best bet is to set up an observer.
What's an observer?
Observers work similarly to alarm clocks - when a certain time comes they go off, similarly an observer does something when a certain action happens.
So what should I do?
You should probably set an observer for whenever a product is loaded (or saved) it should check for the product's quantity and then if it's 0 set its visibility to what you want.
Ok, I'm sold on the observer thing how do I do it?
here is another stackoverflow question which shows how to build one.
You can also look at this tutorial.
Hope this was helpful.
Upvotes: 1