I have been trying figure out past 3 days but in vain, iam looking to send a reminder email to customers to reorder their previous purchase. Magento reorder function works with logged in customers with www.yourdomain.com/sales/order/reorder/{order_id} which adds the items from their previous orders to their shopping cart. But if the customer is not signed in it redirects to a guest form. i want to load items from a previous order to their shopping cart even if they are not logged in. so when customer clicks a link, he is then redirected to the checkout/cart page with all items from their previous order. i tried using the following code

include_once 'app/Mage.php';
$orderId= '2986';
$quote = Mage::getModel('sales/order')->load($orderId);
$cart = Mage::getModel('sales/quote')->load($quote);

1 Answer 1


Please use below code for create order based on order id, You can make a link with this order id,

For this you can make an observere before load cart page.

$order=Mage::getModel('sales/order')->load(2); // 2 is order entity_id
 $cart = Mage::getSingleton('checkout/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.')


  • it throws an error stating customer session already exist. i then added $cart->init(); above $items = $order->getItemsCollection(); and it worked. Thank you very much for help.you saved my day @InfoBeans Oct 5, 2016 at 11:52
  • Its my pleasure.
    – InfoBeans
    Oct 6, 2016 at 4:59

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.