Ben,
Reading through this topic, I just wanted to ask if you can guide me where to look for the logic that's sending the email before the order is complete. I can look through to see if I can fix it.
My customers are complaining the they are getting an email even before the payment is processed or if they cancel the order.
Thanks,
Reading through this topic, I just wanted to ask if you can guide me where to look for the logic that's sending the email before the order is complete. I can look through to see if I can fix it.
My customers are complaining the they are getting an email even before the payment is processed or if they cancel the order.
Thanks,
The email is sent out when the order is placed (i.e. successfully saved in the database) but before it is handed over for payment processing.
The file '~/Modules/CheckoutConfirm.ascx.cs' calls OrderManager.PlaceOrder() in the btnNextStep_Click event. OrderManager.PlaceOrder() is a very long method, but towards the end, you'll find the following lines of code:
int orderPlacedCustomerNotificationQueuedEmailId = MessageManager.SendOrderPlacedCustomerNotification(order, order.CustomerLanguageId);
if (orderPlacedCustomerNotificationQueuedEmailId > 0)
{
InsertOrderNote(order.OrderId, string.Format("\"Order placed\" email (to customer) has been queued. Queued email identifier: {0}.", orderPlacedCustomerNotificationQueuedEmailId), false, DateTime.Now);
}
The first line here is the one that queues the email for sending. If you don't want the email to be sent, simply comment out all these lines. Alternatively, you may wish to comment out just the first line, and modify the 'InsertOrderNote()' line to simply state that the 'Order has been placed', which is always useful for audit trail purposes.
HTH.