Skip to content

Instantly share code, notes, and snippets.

@kstasik
Created Jan 19, 2017
Embed
What would you like to do?
<?php
class Module_Sales_Model_Resource_Quote_Item_Collection extends
Mage_Sales_Model_Resource_Quote_Item_Collection{
/**
* Add products to items and item options
*
* @return Mage_Sales_Model_Resource_Quote_Item_Collection
*/
protected function _assignProducts()
{
parent::_assignProducts();
foreach($this->getItemsByColumnValue('product_type', 'configurable') as $item){
if(!$this->getItemByColumnValue('parent_item_id', $item->getId())){
if($option = $item->getOptionByCode('info_buyRequest')){
$buyRequest = new Varien_Object(unserialize($option->getValue()));
$buyRequest->unsetData('reset_count');
try{
$this->_quote->updateItem((int)$item->getId(), $buyRequest);
}
catch(Exception $e){
// product out of stock
}
}
}
}
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment