1

I am working with a module that has a lot of hard-coded calls to Mage::getSingleton('checkout/session')->getQuote() I am trying to call it from Adminhtml and in stead of rewriting a huge chunk of the module, I thought I would set the checkout session quote to the quote stored in my object (which is valid). However when I type the code:

Mage::getSingleton('checkout/session') ->setQuote($this->getQuote()) ->save();

I get the following error:

Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'Mage_Core_Model_Config_Element' is not allowed'

Is there a quick way to override the checkout/session's quote?

1 Answer 1

1

Normally if you want to load a quote from the admin you would use

/**
 * Retrieve quote object
 *
 * @return Mage_Sales_Model_Quote
 */
protected function _getQuote()
{
    return $this->_getSession()->getQuote();
}

/**
 * Retrieve session object
 *
 * @return Mage_Adminhtml_Model_Session_Quote
 */
protected function _getSession()
{
    return Mage::getSingleton('adminhtml/session_quote');
}

So if you know the quote id then you could try loading the quote

$this->_getSession()->clear();
$this->_getQuote()->setQuoteId($id)->setStoreId($store_id)->setIsActive(true)->load($id);
1
  • Although this wasn't exactly what I was trying to do since I wanted to avoid editing the 3rd party module, I ended up going with this. Thanks R.S. Commented Aug 15, 2014 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.