teamkenb Posted January 13, 2020 Share Posted January 13, 2020 I just noticed that my customer email confirmations and abandoned cart emails are being sent to the customer twice? The order complete emails to the customer and emails to admin are fine. From the logs it looks like this has been happening for the last couple of weeks. Nothing changed that I know of. Any idea what the problem could be? All products are physical, no digital products. Link to comment Share on other sites More sharing options...
teamkenb Posted January 20, 2020 Author Share Posted January 20, 2020 Does anyone have any idea why this could be happening? Any help is greatly appreciated. Link to comment Share on other sites More sharing options...
bsmither Posted January 20, 2020 Share Posted January 20, 2020 I don't have an immediate answer, but please confirm that you know these emails are getting sent twice and both received by the recipient - as opposed to only getting logged in the Email Log twice. Link to comment Share on other sites More sharing options...
teamkenb Posted January 20, 2020 Author Share Posted January 20, 2020 Yes both are being received by the customer, that is how we became aware of this issue. Customers were concerned that they were placing 2 orders(even though the order # is the same) I have tested it several times and do receive the order confirmation email twice. Link to comment Share on other sites More sharing options...
bsmither Posted January 20, 2020 Share Posted January 20, 2020 Also, are each pair being sent at the same time? Would you be using the Print Order Form gateway module? Link to comment Share on other sites More sharing options...
teamkenb Posted January 20, 2020 Author Share Posted January 20, 2020 They are being sent anywhere from 3 to 5 seconds apart. I do have the Print Order Form and USA Print Order Form modules available but they are not active, I have not used them. Link to comment Share on other sites More sharing options...
teamkenb Posted January 20, 2020 Author Share Posted January 20, 2020 I deleted those Print Order extensions and I am still getting the 2 confirmation emails. I am using CC version 6.2.8 Link to comment Share on other sites More sharing options...
bsmither Posted January 21, 2020 Share Posted January 21, 2020 I will formulate some tests to see if we can determine what is triggering the emails. Link to comment Share on other sites More sharing options...
keat Posted January 22, 2020 Share Posted January 22, 2020 I've see this, but I can't find any reference on the forum. I seem to think it might have been related to: Store Settings > Features > Force Order Completed Emails. An email is sent intitally when the status changes to pending or processing (which ever you have selected), And then another is sent when the status changes to complete. Link to comment Share on other sites More sharing options...
teamkenb Posted January 22, 2020 Author Share Posted January 22, 2020 It is sending the Order Confirmation email twice, the exact same email twice within seconds of each other. When I process the order and mark it complete it sends the Order Complete email as it should. Link to comment Share on other sites More sharing options...
bsmither Posted January 23, 2020 Share Posted January 23, 2020 We will create a code snippet. For each email sent, this will log a debug trace in CubeCart's System Error Log. A debug trace is a list of every PHP script that was involved when the debug command was executed. In admin, Manage Hooks, Code Snippets tab, click Add Snippet. When the next page shows up, fill in the form at the bottom: Enabled: checked Unique ID: traceEmail@cubecart6 Execution Order: 99 Description: Logs a stack trace to the Error Log when sending emails. Trigger: class.mailer.presend Version: 1.0 Author: https://forums.cubecart.com/topic/55651-some-emails-to-customers-being-sent-twice/ PHP Code: <?php if (!function_exists('generateCallTrace')) { function generateCallTrace(){ $e = new Exception(); $trace = explode("\n", $e->getTraceAsString()); $trace = array_reverse($trace); // reverse array to make steps line up chronologically array_shift($trace); // remove {main} array_pop($trace); // remove call to this method $length = count($trace);$result = array(); for ($i = 0; $i < $length; $i++) $result[] = ($i + 1) . ')' . substr($trace[$i], strpos($trace[$i], ' ')); return "\t" . implode("\n\t", $result); } } $GLOBALS['debug']->errorLogger('Trace',"Sending an email:\n".generateCallTrace(),__FILE__,__LINE__); When you next notice an email having been sent twice, examine the System Error Log in CubeCart's admin. The contents of each log entry will be in one single line, so you will need to copy it and split it apart in a text editor. Link to comment Share on other sites More sharing options...
teamkenb Posted January 23, 2020 Author Share Posted January 23, 2020 There are 2 errors 2 seconds apart: #1 [<strong>Unknown (Trace)</strong>] /home/abminfoabm/public_html/cart/includes/extra/snippet_72a41b86017c796b2b1df30b98ac9db6.php:14 - Sending an email: 1) /home/abminfoabm/public_html/cart/index.php(20): include('/home/abminfoab...') 2) /home/abminfoabm/public_html/cart/controllers/controller.index.inc.php(89): Cubecart->loadPage() 3) /home/abminfoabm/public_html/cart/classes/cubecart.class.php(445): Cubecart->_gateway() 4) /home/abminfoabm/public_html/cart/classes/cubecart.class.php(2139): Cubecart->_displayGateways('Card_Capture') 5) /home/abminfoabm/public_html/cart/classes/cubecart.class.php(1961): Gateway->form() 6) /home/abminfoabm/public_html/cart/modules/gateway/Card_Capture/gateway.class.php(212): Gateway->process() 7) /home/abminfoabm/public_html/cart/modules/gateway/Card_Capture/gateway.class.php(106): Order->orderStatus(2, '200123-032949-9...') /home/abminfoabm/public_html/cart/classes/order.class.php(517): Mailer->sendEmail('[email protected],...', Array) 9) /home/abminfoabm/public_html/cart/classes/mailer.class.php(231): include('/home/abminfoab...') #2 [<strong>Unknown (Trace)</strong>] /home/abminfoabm/public_html/cart/includes/extra/snippet_72a41b86017c796b2b1df30b98ac9db6.php:14 - Sending an email: 1) /home/abminfoabm/public_html/cart/index.php(20): include('/home/abminfoab...') 2) /home/abminfoabm/public_html/cart/controllers/controller.index.inc.php(89): Cubecart->loadPage() 3) /home/abminfoabm/public_html/cart/classes/cubecart.class.php(445): Cubecart->_gateway() 4) /home/abminfoabm/public_html/cart/classes/cubecart.class.php(2139): Cubecart->_displayGateways('Card_Capture') 5) /home/abminfoabm/public_html/cart/classes/cubecart.class.php(1961): Gateway->form() 6) /home/abminfoabm/public_html/cart/modules/gateway/Card_Capture/gateway.class.php(212): Gateway->process() 7) /home/abminfoabm/public_html/cart/modules/gateway/Card_Capture/gateway.class.php(195): Mailer->sendEmail('[email protected]', Array) /home/abminfoabm/public_html/cart/classes/mailer.class.php(231): include('/home/abminfoab...') Link to comment Share on other sites More sharing options...
bsmither Posted January 23, 2020 Share Posted January 23, 2020 The first instance is the Card Capture gateway changing the order status to Processing - which sends an email to the customer. The second instance is the Card Capture gateway having its module settings enabled for sending a confirmation email. In the Card Capture module settings page, it is apparent that you have the setting for "Update order status to "Processing" on capture?" enabled, even though you do not know if the card can be transacted. That's up to you, of course. It is also apparent that you have the setting for "Send order confirmation email?" enabled, as if, since the order should stay at pending until transacted, you wish to have CubeCart send an email summarizing the order. (CubeCart does not send an email to the customer on orders that are Pending.) Link to comment Share on other sites More sharing options...
teamkenb Posted January 23, 2020 Author Share Posted January 23, 2020 Thank you so much for helping me out with this issue. I have corrected it now. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.