Magento – Send Order Confirmation after payment successful

magento-1.9orderspaymentpayment-gatewaytransactional-mail

I am new to Magento and took over an already developed site which required some changes.

One of these changes are that an order confirmation should not be sent when the order is placed, but rather after payment is completed. I only have one payment option (Paygate).

How do I go about sending confirmation emails AFTER payment is completed by Paygate? Hell, if I could send the invoice that would even be better.

I don't know what to post, so any comments, and I'll update the question.

Best Answer

As per as magento system, sendNewOrderEmail() function of Sales object responsible (Mage_Sales_Model_Order) new order confirmation mail.

<?php
/* Get Order increment id */
$Order_incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$Order=Mage::getModel('sales/order')->loadByIncrementId($incrementId);
$Order->loadByIncrementId($incrementId);
$Order->sendNewOrderEmail();
?>

If this function is not work then there should be problem on email function.

Related Topic