Paypal express - duplicate order emails
I have been using Paypal express for several years, working OK. Over the last months I've had several Paypal orders where I (and the customers) get 2 emails and 2 order numbers. This is annoying because the customers have to emphesize that they want 1 item, not 2. Payment is done only once, as it should be.
I think this started after PHP was upgraded from 7.2. to 8. When checking the database, customers receiving 2 email orders are not inserted into the paypal table. They are only inserted into the orders and customers tables.
Could anybody give me a clue how I could fix this?
Geir
https://www.osteroy-sogelag.org/butikk157d/
ZC 1.57d
PHP 8.0.29
Norwegian
Re: Paypal express - duplicate order emails
Are there any PHP logs (i.e. myDEBUG*.log files) present in the site's /logs sub-directory around the time of the issues?
If not, try enabling the PayPal payment module's debug-to-file setting so that you'll have a history of what went on when those duplicate emails are sent.
It would also help to know what (if any) plugins are installed for the storefront operations as they might be contributing to the unwanted behavior.
Re: Paypal express - duplicate order emails
Sorry for answering late.
I have 3 log files connected to one of my orders producing duplicated emails, both to me and my customer. These files refers to something wrong with my paypal setup. Here is the content of the files:
File 1:
[02-Jun-2023 18:41:08 UTC] Request URI: /butikk157d/ipn_main_handler.php?type=ec&token=EC-2HM304105A633413S&PayerID=KDLLLUHU7L5TL, IP address: .
#1 paypalwpp->ec_step2_finish() called at [/customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/payment/paypalwpp.php:1900]
#2 paypalwpp->ec_step2() called at [/customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/ipn_main_handler.php:80]
--> PHP Warning: Undefined array key "countries_id" in /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/payment/paypalwpp.php on line 2022.
File 2:
[02-Jun-2023 18:41:11 UTC] PHP Fatal error: Uncaught Error: Undefined constant "OSH_EMAIL_TEXT_COMMENTS_UPDATE" in /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/functions/functions_osh_update.php:79
Stack trace:
#0 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/payment/paypalwpp.php(501): zen_update_orders_history(1067, 'Transaction ID:...', NULL, '2', 0)
#1 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/classes/payment.php(261): paypalwpp->after_process()
#2 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/pages/checkout_process/header_php.php(17): payment->after_process()
#3 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/index.php(35): require('/customers/b/9/...')
#4 {main}
thrown in /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/functions/functions_osh_update.php on line 79
[02-Jun-2023 18:41:11 UTC] Request URI: /butikk157d/index.php?main_page=checkout_process, IP address: .
--> PHP Fatal error: Uncaught Error: Undefined constant "OSH_EMAIL_TEXT_COMMENTS_UPDATE" in /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/functions/functions_osh_update.php:79
Stack trace:
#0 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/payment/paypalwpp.php(501): zen_update_orders_history(1067, 'Transaction ID:...', NULL, '2', 0)
#1 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/classes/payment.php(261): paypalwpp->after_process()
#2 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/pages/checkout_process/header_php.php(17): payment->after_process()
#3 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/index.php(35): require('/customers/b/9/...')
#4 {main}
thrown in /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/functions/functions_osh_update.php on line 79.
File 3:
[02-Jun-2023 18:41:20 UTC] Request URI: /butikk157d/index.php?main_page=checkout_process, IP address: .
#1 order->cart() called at [/customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/classes/order.php:35]
#2 order->__construct() called at [/customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/checkout_process.php:48]
#3 require(/customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/checkout_process.php) called at [/customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/pages/checkout_process/header_php.php:14]
#4 require(/customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/pages/checkout_process/header_php.php) called at [/customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/index.php:35]
--> PHP Warning: Undefined array key "coupon_code" in /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/classes/order.php on line 333.
[02-Jun-2023 18:41:22 UTC] PHP Fatal error: Uncaught Error: Undefined constant "OSH_EMAIL_TEXT_COMMENTS_UPDATE" in /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/functions/functions_osh_update.php:79
Stack trace:
#0 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/payment/paypalwpp.php(501): zen_update_orders_history(1068, 'Transaction ID:...', NULL, '2', 0)
#1 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/classes/payment.php(261): paypalwpp->after_process()
#2 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/pages/checkout_process/header_php.php(17): payment->after_process()
#3 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/index.php(35): require('/customers/b/9/...')
#4 {main}
thrown in /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/functions/functions_osh_update.php on line 79
[02-Jun-2023 18:41:22 UTC] Request URI: /butikk157d/index.php?main_page=checkout_process, IP address: .
--> PHP Fatal error: Uncaught Error: Undefined constant "OSH_EMAIL_TEXT_COMMENTS_UPDATE" in /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/functions/functions_osh_update.php:79
Stack trace:
#0 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/payment/paypalwpp.php(501): zen_update_orders_history(1068, 'Transaction ID:...', NULL, '2', 0)
#1 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/classes/payment.php(261): paypalwpp->after_process()
#2 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/modules/pages/checkout_process/header_php.php(17): payment->after_process()
#3 /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/index.php(35): require('/customers/b/9/...')
#4 {main}
thrown in /customers/b/9/1/c8eok39a9/webroots/r510470/butikk157d/includes/functions/functions_osh_update.php on line 79.
Re: Paypal express - duplicate order emails
That missing constant (OSH_EMAIL_TEXT_COMMENTS_UPDATE) is defined in /includes/languages/english/extra_definitions/orders_status_updates.php (or in a template-override sub-directory).
Perhaps you missed copying that file on a site upgrade?
Re: Paypal express - duplicate order emails
The file you mentioned was missing in my Norwegian directory. After copying the file over, a test buy seems to have solved the problem. Only 1 email was sent.
Thank you for helping me out.
Geir
Re: Paypal express - duplicate order emails
No problems, glad I could help! If you were missing one file, you might be missing others. I'll suggest doing a comparison with the english version just be be sure!
Re: Paypal express - duplicate order emails
You might be right. I'll check.
Geir