The following module does what I intended, direct a visitor to the cart with a quote id from the sales_flat_quote table specified using the "quote" GET variable, and it will restore the contents of that cart.

The only way I could get this to work was to add a redirect at the end, a redirect in a "Model" class seems like the wrong approach (this is my first foray into Magento programming). Is there a better way to approach this?

class XXX_RestoreCart_Model_Observer
    public function restoreCart(Varien_Event_Observer $observer)
        $request = Mage::app()->getRequest();
        if (!$quoteId = $request->getParam('quote'))
            return false;

        $quote = Mage::getModel('sales/quote')
        if ($quote->getId()) {

            $session = Mage::getSingleton('checkout/session');


Observer is quite a specific model.

And there's nothing wrong with using redirects there. Lots of companies including us) use this technique in their extensions, and it works absolutely fine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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