Hi everyone,
I was stuck here for some time, every time when user paid through paypal the order confirmation email not being send to the user This is very conman problem with Magento and just wanted to share the solution with you And I already tried multiple solution but it didn't work for me-
Let me give some idea why it is not working-
As I am from India I wanted to show all product's prices in Rs(Indian Currency), So for paypal I need to convert it to US. I did this with some trick you can see in my previous blog.
Ok. Now when use pays through the request send in US dollar only but response comes in Rs. For example if order is of Rs 2000/- then the request should be Paypal i.e $29.866. But On successful payment the response comes to magento is Rs29.866(Yes its Rs) only not Rs 2000/- So Magento detect this as Fraud Payment and it simply not send email to customer. Here is the Code which will solve your issue.
You need to add some code in
app/design/frontend/base/default/template/checkout/success.phtml
<?php
$order = Mage::getModel('sales/order');
$customer = Mage::getSingleton('customer/session')->getCustomer();
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
$countryCode = $order->getShippingAddress()->getCountry();
if($countryCode!='IN')
{
if($order['status']=='payment_complete')
{
try
{
$order->sendNewOrderEmail();
}
catch (Exception $ex)
{
echo "Email Not Sent...";
}
$customer = Mage::getSingleton('customer/session')->getCustomer();
$email = $customer->getEmail();//End Email Sending
}
}?>
its Done Here!!!!
Let me know your comment on this if you like the article.
Thanks for this post, it helps me in Magento 1.8.1. with the Paypal fraud problem. Our german shop, use the same currency but it gives a difference between Gross and Net totals so that paypal give the order the status fraud. Here I find the solution to mail the order confirmation nevertheless. Best regards Robert
ReplyDeleteGrt, will love to help you in future...
ReplyDelete