0

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!

4

1 回答 1

1

你最好的选择是设置一个观察者。

什么是观察者?

观察者的工作类似于闹钟——当某个时间到来时,它们会响起,类似地,当某个动作发生时,观察者会做一些事情。

所以我该怎么做?

您可能应该设置一个观察者,每当加载(或保存)产品时,它应该检查产品的数量,然后如果它为 0,则将其可见性设置为您想要的。

好的,我对观察者的事情很感兴趣,我该怎么做?

是另一个stackoverflow问题,它展示了如何构建一个。

你也可以看看这个教程

希望这会有所帮助。

于 2012-08-16T17:08:11.080 回答