Jump to content

Print Order Form - page refresh sends another e-mail


disco_ii_disco

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

  1. Added `pendingEmailSent` as a tiny integer field in the `order_summary` table;
     
  2. 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']));
            }
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...