VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: rupesh1989 on January 18, 2012, 08:50:21 AM

Title: Order Confirmation Emails before Successful PayPal Payment
Post by: rupesh1989 on January 18, 2012, 08:50:21 AM
I've discovered that when a customer goes through the payment process, they complete the checkout process by "confirming order" and being redirected to PayPal.

Regardless of whether or not they make a successful payment, both the prospective buyer and our client, who processes the orders, receives an order confirmation email.

Is there any way to set Virtuemart to only send this email once they have made a successful payment? It's really a must-have for us.

Thank you for your help,
rupesh
Title: Re: Order Confirmation Emails before Successful PayPal Payment
Post by: juagicre on January 19, 2012, 16:58:17 PM
yes... this should be definetly an option... but while this gets done, just a question: where can we find this line of code that sends the order mail?
Title: Re: Order Confirmation Emails before Successful PayPal Payment
Post by: stinga on January 19, 2012, 17:04:58 PM
Loads of other have made various fix's for this, have search there are even instructions on the net for it, try google.

Edit 1:
I think the best place to move it to would be when notify.php is called (or whatever you payment gateway is).
Just need to find the function that gets called, remove it from where it is and move it else where.

vmMail is what sends the email and it is currently called from ./administrator/components/com_virtuemart/classes/ps_checkout.php.

Edit 2:
email_receipt is the name of the function that sends the email and it takes the order id as the only parameter.
It is called from add which I am going to assume adds the order to the system.

So I think you could comment that out and add it into notify.php or a common routine in there some where.
Title: Re: Order Confirmation Emails before Successful PayPal Payment
Post by: jenkinhill on January 20, 2012, 09:49:57 AM
Quote from: stinga on January 19, 2012, 17:04:58 PM
vmMail is what sends the email and it is currently called from ./administrator/components/com_virtuemart/classes/ps_checkout.php.

Not for VM2 - there is no classes directory...
Title: Re: Order Confirmation Emails before Successful PayPal Payment
Post by: rupesh1989 on January 21, 2012, 08:58:01 AM
hi jenkinhill ,

U r right there is no classes folder in VM2  :'(, but then can you please tell me where to do changes so that purchase order emails send to both owner and customers!
In which file we have to do changes so that it works! i 'm using joomla 1.7.3 with VM2!
Title: Re: Order Confirmation Emails before Successful PayPal Payment
Post by: muasif80 on January 21, 2012, 12:16:32 PM
//    2 = don't delete the cart, don't send email and don't redirect
   return $this->processConfirmedOrderPaymentResponse(2, $cart, $order, $html, $new_status);

I have seen this at line no 242 and 243 of paypal payment plugin. This means they are passing 2 as hardcoded value here and it is meant for not sending out the email. The email is sent out inside the function processConfirmedOrderPaymentResponse when 1 is passed. Virtuemart people can confirm this. But this is my understanding.
Title: Re: Order Confirmation Emails before Successful PayPal Payment
Post by: stinga on January 21, 2012, 13:14:49 PM
Oh well, never mind... !!! :-)
Title: Re: Order Confirmation Emails before Successful PayPal Payment
Post by: Everlast on September 25, 2012, 10:19:51 AM
Hi, Repesh. Sorry for the late response, but did you ever find a solution for this?

I'm using Multisafepay. And VM is already sending an e-mail confirming an order when the user is still selecting a payment method. The e-mail has to be sent AFTER the payment, not before :P I guess that's common knowledge, but VM apparently doesn't think that way =p
Title: Re: Order Confirmation Emails before Successful PayPal Payment
Post by: Carl Henry on October 27, 2012, 11:38:49 AM
Hello,

Re: Virtuemart 1.1.9

This might help some one out;

In file: ps_checkout.php
Line 2252

I commented out (//) this line to stop the emails being sent:

$shopper_mail = vmMail( $from_email, $mosConfig_fromname, $shopper_email, $shopper_subject, $shopper_mail_Body, $shopper_mail_AltBody, true, null, null, $EmbeddedImages);

The customer will receive a confirmation from the payment processor (by email) and if you change the status and 'Notify The Customer' they will receive an email from the system.

I hope this helps you,

Regards,

Carl Henry
Carl Henry Global