I have extended Mage_Checkout_Model_Type_Onepage
class via my custom module and overriding saveOrder()
method. All this code is written inside saveOrder()
method.
I am trying to get every item from the current quote object and save it to a new array.
Here is the code:
$quote = $this->getQuote();
//following line printing the quote id
Mage::log("Quote id is : " . $quote->getId() , null, 'mylog.log');
$myArray = array();
foreach ($quote->getAllItems() as $item)
{
$myArray[] = $item;
}
//====following lines doesn't log anything=========
Mage::log($myArray,null,'mylog.log',true);
Mage::log(print_r($myArray,1),null,'mylog.log');
foreach ($myArray as $currItem)
{
// Empty current quote
foreach ($quote->getAllItems() as $item)
{
$quote->getItemsCollection()->removeItemByKey($item->getId());
}
//inserting item to quote from myArray
$quote->addItem($currItem);
}
But I think quote item is not inserting into $myArray and that is why $quote->addItem
method is also not working here.
this
class? Please add more code lines about your current class?