I need to keep the products in the cart when checkout, or copy last order quote to current session quote. I tried:

$quoteA = Mage::getModel('sales/quote')->load($order->getQuoteId());
$quoteB = Mage::getSingleton('checkout/session')->getQuote();



But this not worked, how can I do this? Thanks.

2 Answers 2


Take a look at the reorder functionality for Magento!

You can build an observer which is triggered after the order is created.

From app/code/core/Mage/Sales/Controller/Abstract.php

 * Action for reorder
public function reorderAction()
    if (!$this->_loadValidOrder()) {
    $order = Mage::registry('current_order');

    $cart = Mage::getSingleton('checkout/cart');
    $cartTruncated = false;
    /* @var $cart Mage_Checkout_Model_Cart */

    $items = $order->getItemsCollection();
    foreach ($items as $item) {
        try {
        } catch (Mage_Core_Exception $e){
            if (Mage::getSingleton('checkout/session')->getUseNotice(true)) {
            else {
        } catch (Exception $e) {
                Mage::helper('checkout')->__('Cannot add the item to shopping cart.')


Take a look in file /home/magento/app/code/core/Mage/Checkout/Block/Onepage/Success.php in lines:

     * Get last order ID from session, fetch it and check whether it can be viewed, printed etc
    protected function _prepareLastOrder()
        $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
        if ($orderId) {
            $order = Mage::getModel('sales/order')->load($orderId);
            if ($order->getId()) {
                $isVisible = !in_array($order->getState(),
                    'is_order_visible' => $isVisible,
                    'view_order_id' => $this->getUrl('sales/order/view/', array('order_id' => $orderId)),
                    'print_url' => $this->getUrl('sales/order/print', array('order_id'=> $orderId)),
                    'can_print_order' => $isVisible,
                    'can_view_order'  => Mage::getSingleton('customer/session')->isLoggedIn() && $isVisible,
                    'order_id'  => $order->getIncrementId(),

and in the file core/Mage/Sales/Model/Order/config.php , here is setup the calls functions of visible/invisible, i believe with that you make this successfully.

  • The first file is a block, and is setting order configuration, the second file is about order status... this will not solve my problem...
    – Eduardo
    Mar 2, 2015 at 16: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.