/** * Set the available quantity for a given item. * * @param Mage_CatalogInventory_Model_Stock_Item * @param int $quantity the amount to set * @return bool true if the quantity has changed for this product */ protected function updateProductQuantity(Mage_CatalogInventory_Model_Stock_Item $stockItem, $quantity) { $oldQty = $stockItem->getQty(); $change = $oldQty !== $quantity; if ($change) { $stockItem->setQty($quantity); } return $change; }