Home » Magento Guide

Custom checkout cart – How to send email after successful checkout

21 September 2009 One Comment

Custom checkout cart – How to send email after successful checkout

Recently I have been working on a custom checkout page for one of our clients in Sweden. I had some trouble figuring out how to send default Magento order email with all of the order info. After an hour or so of studying Magento core code, here is the solution on how to send email after successful order has been made.

< ?php
$order = new Mage_Sales_Model_Order();
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();

$order->loadByIncrementId($incrementId);

try
{
$order->sendNewOrderEmail();
} catch (Exception $ex) {  }
?>

Not sure how useful this alone will be for you, so I’ll throw a little advice along the way. When trying to figure how to reuse Magento code, separate some time to study the Model classes with more detail. Then “tapping into” and reusing some of them should be far more easier.

Cheers…

By Branko Ajzele from Inchoo.net

Related posts:

  1. Adding a new tab under one page checkout – full working module
  2. Magento custom emails
  3. Move mini-cart in the sidebar to the header (or anywhere) in Magento
  4. How to use WordPress home page in Magento home page (CMS page)
  5. Add Adwords tracking code to order confirmation page in Magento

One Comment »

  • Razaul said:

    Thank you buddy
    This is really help me much

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree

Security Code: