, ( ):
, , .
, . , _removeErrorsFromQuoteAndItem , , , ( ).
, - , sales_quote_item_qty_set_after.
public function reinitQuoteErrorState(Varien_Event_Observer $observer)
{
$item = $observer->getEvent()->getItem();
$quote = $item->getQuote();
if (!$quote) return;
if ($quote->getHasError()) return;
foreach ($quote->getAllItems() as $quoteItem)
{
if ($errorItems = $quoteItem->getErrorInfos())
{
foreach ($errorItems as $errorItem)
{
if ($errorItem['code'] == Mage_CatalogInventory_Helper_Data::ERROR_QTY)
{
$quote->addErrorInfo(
'error',
'cataloginventory',
Mage_CatalogInventory_Helper_Data::ERROR_QTY,
Mage::helper('cataloginventory')->__('Not all products are available in the requested quantity')
);
return;
}
}
}
}
}
. , , XML /app/etc/modules/(:/app/etc/modules/MyCompany_MyModule.xml), , Mage_CatalogInventory_Model_Observer:: checkQuoteItemQty, .
, quoteInfo , - .
<?xml version="1.0" encoding="utf-8"?>
<config>
<modules>
<MyCompany_MyModule>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_CatalogInventory />
</depends>
</MyCompany_MyModule>
</modules>
</config>