Magento – Configurable product – Inventory – Stock Availability status doesn’t change when all associated Simple products go out of stock

magento-1magento-enterpriseproducts-management

I have an Enterprise site (1.12.0.2) and a Community site (1.7.0) both doing the same thing.

A configurable product (Manage Stock set to Yes) has just one simple product. Somebody orders the last remaining stock item pushing the simple product's Stock Availability Status into "Out of Stock". However, the configurable parent's Stock Availability Status remains "In Stock". Should the parent not go "Out of Stock" when all its children have gone "Out of Stock". I can see no setting for this in System – Config.

I've tried reindexing Stock Status. No joy.

Would somebody please give me the definitive answer? If the answer is No, it never has then is there a quick and easy solution?

I'm trying to get an answer from Magento at the moment (via Enterprise ticket). Not heard back yet.

Many thanks
Tadhg

Best Answer

Magento confirmed this is not part of Magento (Enterprise or Community). The parent (configurable) Stock Availability Status remains untouched regardless of what happens to any of it's children (simple).

Magento actually provided me with a patch (for EE v1.12.0.2) for Enterprise that checks all a parents children status before deciding to display it or not. This seems to work by default in Community 1.7. But this is only a frontend fix.

To fix the parent Availibity Status you can do one of the following:

  1. Listen out for the cataloginventory_stock_item_save_after event. Then in your Observer class for configurable product types (or other types that have children) you can load $product->getTypeInstance()->getUsedProducts(); and do your necessary checks and updates.

  2. Extend the class Mage_CatalogInventory_Model_Stock_Item and in the _afterSave() function do the same as above. Be careful doing rewrites. It might already be extended by another third party module.

Hope this helps. Tadhg