Avoid duplicate orders


english 3839
In order to avoid duplicate orders, I recommend immediately deactivating the button for submitting the order after the first click and providing the customer with a message that their order is being processed as long as the "checkout_confirmation.php" page is not yet open was redirected.

Sometimes the processing takes a little longer and the customer clicks the button again to send the order and this is then carried out twice. For this reason, the following code is recommended.

Find in: catalog/checkout_confirmation.php
  require('includes/template_top.php');
?>

Add after:

<script type="text/javascript">
function SubmitOrderButton(){
        document.getElementById("submitmain").style.display = "none";    
    
    if (navigator.appName == "Microsoft Internet Explorer") {
    document.getElementById("pleasewait").innerHTML = "";
    document.getElementById("pleasewait").style.display = "block";
    document.getElementById("pleasewait").innerHTML = "<img src='images/pleasewait.gif' alt='Please Wait'>";
    } else {
    document.getElementById("pleasewait").style.display = "block";        
    }
}
</script>

Change this code:

      <?php
      if (is_array($payment_modules->modules)) {
        echo $payment_modules->process_button();
      }
      echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'fa fa-ok', null, 'primary', null, 'btn-success');
      ?>

With:

<span id="submitmain">
<?php
if (is_array($payment_modules->modules)) {
echo $payment_modules->process_button();
}
?>
<br>
<?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'fas fa-check-circle', null, 'primary', null, 'btn-success btn-block btn-lg');?>
</span>
<span id="pleasewait" style="display:none">

<span class="col-sm-12 w3-padding w3-round w3-table w3-border w3-bottombar w3-border-deep-orange w3-food-apricot w3-text-black w3-center w3-large">
<i class="w3-spin fab fa-cloudscale fa-2x"></i>&nbsp;<?php echo TEXT_PROCCESSING_ORDER;?></span>
</span>

Add in: catalog/includes/languages/english/checkout_confirmation.php

define('TEXT_PROCCESSING_ORDER', 'Order is being processed');
Why your email address?
If necessary, I will contact you to help you with the implementation.
Your email address will not be made public.
Is this post helpful to you?
There are currently no product reviews.
Information(1)
General information
 Free advertising
Post counter
Current information status:
Categories: 9
Posts: 104
Support pages: 55
Downloads for members: 104
Download counter: 646
Reviews total61
Companies: 26
Support: 28
Information: 7