/** * Lock product items * * @param Mage_CatalogInventory_Model_Stock $stock * @param int|array $productIds * @return Mage_CatalogInventory_Model_Resource_Stock */ public function lockProductItems($stock, $productIds) { $itemTable = $this->getTable('cataloginventory/stock_item'); $select = $this->_getWriteAdapter()->select()->from($itemTable)->where('stock_id in IN(?)', $stock->getStockIds())->where('product_id IN(?)', $productIds)->forUpdate(true); /** * We use write adapter for resolving problems with replication */ $this->_getWriteAdapter()->query($select); return $this; }