6

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.

1

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.

0

Try customizing the checkout cart model,

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

$order->loadByIncrementId($incrementId);

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

Alternatively, I would think you can create an event that fires when theres a succesfull checkoud and add an observer to create an email once it fires.

Edit: this answer seems a lot better then mine https://stackoverflow.com/questions/10685021/magento-how-to-stop-invoicing-orders-on-failed-payment-transactions

0

Magento's base events and notifications system will allow you to set these in the admin. To set which emails are sent to customers go Into the system config and enable or disable different default magento sales emails.

System > Config > Sales Emails

Set Order email enabled to no

Set Invoice email to enabled

FYI If you have to update/override the templates those can be found in System > Transactional Emails

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.