disco_ii_disco Posted December 12, 2014 Share Posted December 12, 2014 Hi all, Just fixing various bugs in the checkout system and just need some advice on this one: If you choose print order form as the payment option, you get a confirmation e-mail. If you then refresh the page you get another e-mail. Would I be right in thinking Cubecart should check if an e-mail has already been sent before sending another one. I could add a `e-mailed` field in the `order_summary` table then perform a look-up against this column before sending the e-mail. Or does anyone else have any brighter ideas? Quote Link to comment Share on other sites More sharing options...
disco_ii_disco Posted December 16, 2014 Author Share Posted December 16, 2014 Just wondered if anyone else sees this as a problem, or should I not waste my time on this one? Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 16, 2014 Share Posted December 16, 2014 I have come across a few instances where an online merchant will include a warning phrase to not click the "Submit" button more than once because the system will then transact the order that many times. So, I'm thinking multiple "Submit" presses, the "Back" button on the browser, and 'page refreshes' are problems all customers must realize exist and that such actions have consequences. All the gateways (I think) do not have a mechanism to interdict the abuse of the browser's Back button, but CubeCart's Cart class does have code that makes sure some things do not happen more than once (sending an email to the admin on a 'new order' notice, for example, when the customer requires more than one attempt to pay). The POF gateway, however, does not interface with the Cart class. It's my opinion that this situation is not 'interesting' enough to warrant finding a solution. Quote Link to comment Share on other sites More sharing options...
disco_ii_disco Posted December 16, 2014 Author Share Posted December 16, 2014 Sorry, couldn't figure out a fix to this the other day - which is why I posted the question. Came at it with a different angle this evening and fixed in 2 seconds. Added `pendingEmailSent` as a tiny integer field in the `order_summary` table; Edited this code (near to the bottom of modules/gateway/print_order_form/gateway.class.php); //CHRIS EDIT - check if pending e-mail has already been sent if ($order_summary['pendingEmailSent']==0) { Mailer::getInstance()->sendEmail($order_summary['email'], $content); //CHRIS EDIT - update e-mail sent status so we don't resend another e-mail $GLOBALS['db']->update('CubeCart_order_summary', array('pendingEmailSent' => 1), array('cart_order_id' => $order_summary['cart_order_id'])); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.