VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: MKI-Miro on January 13, 2023, 13:57:41 PM

Title: Multiple emails for same order
Post by: MKI-Miro on January 13, 2023, 13:57:41 PM
Hi

after upgrade Virtuemart 3->4.0.12 and also Joomla (4.2.6) we recieve multiple same emails for order.

Any tip where to search for problem?

Thank you
Title: Re: Multiple emails for same order
Post by: jenkinhill on January 13, 2023, 17:20:53 PM
I'm guessing that you are using PayPal?  There is a suggestion that the multi-emails may be a server issue. But changing the PayPal plugin may help:

http://forum.virtuemart.net/index.php?topic=149367.msg533172#msg533172
http://forum.virtuemart.net/index.php?topic=148961.msg533648#msg533648
http://forum.virtuemart.net/index.php?topic=149297.msg533052#msg533052
Title: Re: Multiple emails for same order
Post by: MKI-Miro on January 23, 2023, 12:07:21 PM
nothing helped :(

how can I check if my (default) IPN address works?
Title: Re: Multiple emails for same order
Post by: MKI-Miro on January 23, 2023, 13:39:13 PM
I just recieved information from PayPal:

check your server that handles PayPal Instant Payment Notifications (IPN). IPNs sent to the following URL(s) are failing:


https://www.tiens-usa.com/index.php?option=com_virtuemart&view=vmplg&task=notify&tmpl=component&lang= https://www.tiens-usa.com/index.php?option=com_virtuemart&view=vmplg&task=notify&tmpl=component&lang=en-US

when I try to open this url, its blanks

Any suggestions?
Title: Re: Multiple emails for same order
Post by: GJC Web Design on January 23, 2023, 15:37:31 PM
it should be blank .. it is just a notification ..

Request URL: https://www.tiens-usa.com/index.php?option=com_virtuemart&view=vmplg&task=notify&tmpl=component&lang=en-US
Request Method: GET
Status Code: 200
Remote Address: 37.9.175.155:443

it is a 200 so no error .. but the url should contain more info like pm=2&on=123456 etc so the vmplg knows what to do with it...

maybe it errors when that data is sent?
Title: Re: Multiple emails for same order
Post by: MKI-Miro on January 23, 2023, 21:47:12 PM
I the code I can see this (also same in most recent virtuemart code)



$post_variables['return'] = JURI::root() . 'index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=' . $this->order['details']['BT']->order_number . '&pm=' . $this->order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . vRequest::getInt('Itemid') . $lang;
$post_variables['notify_url'] = JURI::root() . 'index.php?option=com_virtuemart&view=vmplg&task=notify&tmpl=component' . '&lang=' . vRequest::getCmd('lang', '');
$post_variables['cancel_return'] = JURI::root() . 'index.php?option=com_virtuemart&view=vmplg&task=pluginUserPaymentCancel&on=' . $this->order['details']['BT']->order_number . '&pm=' . $this->order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', '');

Title: Re: Multiple emails for same order
Post by: Alexb65 on January 24, 2023, 10:55:51 AM
While trying to understand the reason behind this here is a really dirty hack to stop multiple notificatiions if order is already in Accetpetd (C) state.

In paypal.php



function plgVmOnPaymentResponseReceived(&$html) {

....

691                 // if status is already acceted then exit : dirty hack to multiple email
692                 if ($order['status'] =="C") {
693                         return;
694                 }



this simply ignores further notifications from paypal if the order is already accepted

Not clean (we should not need this) but just works for now
Title: Re: Multiple emails for same order
Post by: MKI-Miro on January 24, 2023, 15:23:19 PM
This is extremly weird that nobody has solution for this problem. The only solution I have found is to install another plugin.
Title: Re: Multiple emails for same order
Post by: MKI-Miro on January 24, 2023, 15:27:17 PM
What i just found in logs:


[php:warn] [pid 5711] [client 173.0.81.140:58016] PHP Warning:  Undefined array key "txn_type" in /data/8/c/8cebda2e-e64f-4f2a-9ed5-25033aa98354/tiens-usa.com/web/plugins/vmpayment/paypal/paypal/helpers/paypal.php on line 463

[php:warn] [pid 19116] [client 173.0.81.65:40750] PHP Warning:  Attempt to read property "txn_id" on int in /data/8/c/8cebda2e-e64f-4f2a-9ed5-25033aa98354/tiens-usa.com/web/plugins/vmpayment/paypal/paypal/helpers/paypal.php on line 707