3

Magento Automatically set a product when a certain qty limit is reached: system -> configuration -> catalog -> inventory -> Qty for Item's Status to Become Out of Stock

As pointed out by @pitmeister,Allow qty Below 0 should disable this behavior.

The problem is:

  • I already have Allow qty Below 0 (frontend/backend works as expected so status is not changed)
  • BUT: I'm importing stock information using a third party extension and the import action set product out of stock in case the qty imported is 0.

How can I debug this ? Where is the code that change product stock status to out of stock because of the Qty ?

2 Answers 2

5

If you allow backorders (Allow qty Below 0), the setting 'Stock Availability' will not be set to Out of Stock once the product reaches qty = 0

3
  • Thanks, do you have idea where is the code related to it ?
    – Fra
    May 26, 2014 at 20:20
  • Take a look at Mage_CatalogInventory_Model_Resource_Stock::updateSetOutOfStock
    – pitmeister
    May 27, 2014 at 12:19
  • that method is called when you change the configuration setting Allow qty Below 0. I think it is meant to update the stock for the full catalog ... so it is not what I'm looking for
    – Fra
    May 27, 2014 at 13:55
1

The check for the qty is performed by verifyStock() and on the base of its output the status is set by _beforeSave() method:

  • Mage_CatalogInventory_Model_Stock_Item::_beforeSave()
  • Mage_CatalogInventory_Model_Stock_Item::verifyStock($qty = null)

In case you need to perform some programmatically stock changes, here there is a possible approach: change stock availability programmatically

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.