How can I detect when a product's inventory level reaches 0 or it's status is changed to "Out of Stock" by Magento (not necessarily by the user)? I looked for an event, but I don't see one. Is my only choice to override the Stock_Item model?
Look in app/code/core/Mage/CatalogInventory/Model/Stock/Item.php and notice that the $_eventPrefix is set to cataloginventory_stock_item. That means that you can use the generic Object Saving events detailed in this blog post to register an Observer, e.g. cataloginventory_stock_item_save_after and inspect the values of the object.
You will almost never need to override the model when you use the generic events.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With