Want to make a change in the code, so if the stock go to 0 then and the Manufacturer's Suggested Retail Price are higher then the sale price, then it will change to price to Manufacturer's Suggested Retail Price.

I use Magento ver.




Check checkoutAllSubmitAfter method which is responsible for updating stock qty.

 * Subtract qtys of quote item products after multishipping checkout
 * @param Varien_Event_Observer $observer
 * @return Mage_CatalogInventory_Model_Observer
public function checkoutAllSubmitAfter(Varien_Event_Observer $observer)
    $quote = $observer->getEvent()->getQuote();
    if (!$quote->getInventoryProcessed()) {
    return $this;

Now check following class


registerProductsSale is the main method:

 * Subtract product qtys from stock.
 * Return array of items that require full save
 * @param array $items
 * @return array
public function registerProductsSale($items)
    $qtys = $this->_prepareProductQtys($items);
    $item = Mage::getModel('cataloginventory/stock_item');
    $stockInfo = $this->_getResource()->getProductsStock($this, array_keys($qtys), true);
    $fullSaveItems = array();
    foreach ($stockInfo as $itemInfo) {
        if (!$item->checkQty($qtys[$item->getProductId()])) {
            Mage::throwException(Mage::helper('cataloginventory')->__('Not all products are available in the requested quantity'));
        if (!$item->verifyStock() || $item->verifyNotification()) {
            $fullSaveItems[] = clone $item;
    $this->_getResource()->correctItemsQty($this, $qtys, '-');
    return $fullSaveItems;

Don't modify the core file. Overwrite this class and modify your logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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