Skip to content

Instantly share code, notes, and snippets.

@edannenberg
Created October 17, 2013 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edannenberg/7023429 to your computer and use it in GitHub Desktop.
Save edannenberg/7023429 to your computer and use it in GitHub Desktop.
Fixes catalogInventoryStockItemUpdate api call (V2) in Magento 1.8. Whats broken: The api method got refactored and now does not call $product->save() anymore. As a result the stock_id for new items is not set as the observer that takes care of that is hooked to the product_save_after event. Fix 1: Apply patch below. *OR* Fix 2: Update db schema…
--- mage_org/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php 2013-10-17 12:24:37.773265017 +0200
+++ src_shop/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php 2013-10-17 13:09:30.141351173 +0200
@@ -54,6 +54,7 @@
/** @var $stockItem Mage_CatalogInventory_Model_Stock_Item */
$stockItem = $product->getStockItem();
+ $stockItem->setStockId($stockItem->getStockId());
$stockData = array_replace($stockItem->getData(), (array)$data);
$stockItem->setData($stockData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment