2

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?

1
  • look again theres multiple events for that :)
    – Anton S
    Sep 11, 2011 at 11:19

1 Answer 1

10

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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.