Question

Situation: Stock = 0, in_stock = no Then I process a credit note. Stock = 1, in_stock = no

I would expect the in_stock to be set back to yes. The effect of this is that we have many T-shirts in 1 size of 1 SKU that apparently were returned some day - and now not seen in the store (so not sold). So they are in stock with qty 1, but their flag in_stock is still NO

Question: Is there a solution for this?

Was it helpful?

Solution

I found this:

"I know it's old but because this isn't yet fixed not even in 1.7.0.1 I came up with a better solution.

Tested on 1.5.1 and above:

\app\code\core\Mage\CatalogInventory\Model\Observer.php

in

public function refundOrderInventory($observer)"

after 
Mage::getSingleton('cataloginventory/stock')->revertProductsSale($items);

//add this
foreach ($creditmemo->getAllItems() as $item) {
    $productId = $item->getProductId();
    $product = Mage::getModel('catalog/product')->load($productId);

    if(!$product->isConfigurable()){

        $stockItem = $product->getStockItem();

        //$stockItem->setQty($item->getQty());
        $stockItem->setIsInStock(1);
        $stockItem->save();

        $product->setStockItem($stockItem);
        $product->save();
    }
}

It was taken from https://stackoverflow.com/questions/10453324/magento-credit-memo-return-to-stock-not-updating-stock-availability and they also say another possible solution (although less effective) is found here: http://wrightcreativelabs.com/blog/55-credit-memo-in-stock.html

Does this help?

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top