/** * Prepare stock item data for save * * @param Mage_CatalogInventory_Model_Stock_Item $item * @param Mage_Catalog_Model_Product $product * @return Mage_CatalogInventory_Model_Observer */ protected function _prepareItemForSave($item, $product) { $item->addData($product->getStockData())->setProduct($product)->setProductId($product->getId())->setStockId($item->getStockId()); if (!is_null($product->getData('stock_data/min_qty')) && is_null($product->getData('stock_data/use_config_min_qty'))) { $item->setData('use_config_min_qty', false); } if (!is_null($product->getData('stock_data/min_sale_qty')) && is_null($product->getData('stock_data/use_config_min_sale_qty'))) { $item->setData('use_config_min_sale_qty', false); } if (!is_null($product->getData('stock_data/max_sale_qty')) && is_null($product->getData('stock_data/use_config_max_sale_qty'))) { $item->setData('use_config_max_sale_qty', false); } if (!is_null($product->getData('stock_data/backorders')) && is_null($product->getData('stock_data/use_config_backorders'))) { $item->setData('use_config_backorders', false); } if (!is_null($product->getData('stock_data/notify_stock_qty')) && is_null($product->getData('stock_data/use_config_notify_stock_qty'))) { $item->setData('use_config_notify_stock_qty', false); } $originalQty = $product->getData('stock_data/original_inventory_qty'); if (strlen($originalQty) > 0) { $item->setQtyCorrection($item->getQty() - $originalQty); } if (!is_null($product->getData('stock_data/enable_qty_increments')) && is_null($product->getData('stock_data/use_config_enable_qty_inc'))) { $item->setData('use_config_enable_qty_inc', false); } if (!is_null($product->getData('stock_data/qty_increments')) && is_null($product->getData('stock_data/use_config_qty_increments'))) { $item->setData('use_config_qty_increments', false); } return $this; }
/** * Prepare stock item data for save * * @param Mage_CatalogInventory_Model_Stock_Item $item * @param Mage_Catalog_Model_Product $product * @return Mage_CatalogInventory_Model_Observer */ protected function _prepareItemForSave($item, $product) { $item->addData($product->getStockData())->setProduct($product)->setProductId($product->getId())->setStockId($item->getStockId()); if (!is_null($product->getData('stock_data/min_qty')) && is_null($product->getData('stock_data/use_config_min_qty'))) { $item->setData('use_config_min_qty', false); } if (!is_null($product->getData('stock_data/min_sale_qty')) && is_null($product->getData('stock_data/use_config_min_sale_qty'))) { $item->setData('use_config_min_sale_qty', false); } if (!is_null($product->getData('stock_data/max_sale_qty')) && is_null($product->getData('stock_data/use_config_max_sale_qty'))) { $item->setData('use_config_max_sale_qty', false); } if (!is_null($product->getData('stock_data/backorders')) && is_null($product->getData('stock_data/use_config_backorders'))) { $item->setData('use_config_backorders', false); } if (!is_null($product->getData('stock_data/notify_stock_qty')) && is_null($product->getData('stock_data/use_config_notify_stock_qty'))) { $item->setData('use_config_notify_stock_qty', false); } return $this; }