Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Archived

This topic is now archived and is closed to further replies.

ArtcoInc

Duplicate orders

Recommended Posts

(osC 2334bs)

 

Today, I received two duplicate orders from a customer, 3 seconds apart. There are two different order numbers, and two acknowledgement emails.

 

Payment was through Paypal, and both orders have the same Paypal transaction number (there was only one Paypal payment received).

 

1) How do I go about investigating how this happened? And, how do I prevent this from happening again?

 

2) What is the best method to deal with the duplicate order? Short of editing the database, there is no way to delete the order, or is there?

 

Thanks

 

Malcolm

 

 

Share this post


Link to post
Share on other sites

There are various ways to disable the submit order button, once it is clicked. For example on my website I use simple javascript snippets to display a spinner gif once 'submit' is pressed. You can see the code for it here, (that code is getting a bit out-dated and you'll need to adjust the html for 2.3, but you'll be able to see the idea involved)

 

www dot css-oscommerce dot com/prevent-double-order-submissions-with-jquery/


Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

@@npn2531

 

Thank you very much!  :)

 

How would this apply since I have the Paypal Express module installed? With it, the customer doesn't have to go through the checkout process.  :blush:

 

Malcolm

Share this post


Link to post
Share on other sites

Could someone please post an example of this that works on 2.3.4 standard. I've tried several suggestions and I either don't understand the code (jquery) or I break the button it seems. I've had 3 dup orders this week and would like to stop that.

 

There is this is in checkout_confirmation.php. I'd like to simply have the spinner replace the button once clicked (or spinner on an overlay?)

      <div style="float: right;">
        <?php
            if (is_array($payment_modules->modules)) {
            echo $payment_modules->process_button();
            }
            echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary');
        ?>
        </div>

Thank you in advance

dave


-Dave

Share this post


Link to post
Share on other sites

Hey Dave what do you have for your JavaScript?

 

You need something like

<script>

$(function() {

//$("#confirmation .btn").click(function(){

$(".confirmation").click(function(){

$(this).prop('disabled', true);

});

});

</script>[\code]

Share this post


Link to post
Share on other sites

I could be wrong, but isn't there a setting in PayPal that prevents an order with the same id?

 

Block accidental payments:

You may prevent accidental payments by blocking duplicate invoice IDs

Yes, block multiple payments per invoice ID

No, allow multiple payments per invoice ID

Share this post


Link to post
Share on other sites

@@Tsimi  Where is that setting?

I've been testing with other methods such as check or PO, not with paypal. but the dup orders over the week were paypals.

 

Why does this not work. What am I doing wrong? (this is 2.3.4 standard. Not BS)

<script>
$(function() {
 //$("#confirmation .btn").click(function(){
$(".confirmation").click(function(){
 $(this).prop('disabled', true);
 });
 });
</script>

      <div style="float: right;" class="confirmation">
      <!--<div style="float: right;">-->
        <?php
            if (is_array($payment_modules->modules)) {
            echo $payment_modules->process_button();
            }
//            echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary');
            echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary', array('params' => 'data-loading-text="Loading..." autocomplete="off"'));
        ?>
        </div>

-Dave

Share this post


Link to post
Share on other sites

Ok moved class, but now when clicked the button is disabled from double click, but an order does not process either

<script>
$(function() {
 //$("#confirmation .btn").click(function(){
$(".confirmation").click(function(){
 $(this).prop('disabled', true);
 });
 });
</script>

      <div style="float: right;">
        <?php
            if (is_array($payment_modules->modules)) {
            echo $payment_modules->process_button();
            }
//            echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary');
            echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary', array('params' => 'class="confirmation" data-loading-text="Processing..." autocomplete="off"'));
        ?>
        </div>

-Dave

Share this post


Link to post
Share on other sites

You can try adding in a form submit to your click function.

 

In your function after you disable the button:

 

$("form[name=form_name_here]").submit();


Matt

Share this post


Link to post
Share on other sites

@@mattjt83

 

Matt, as usual your spot on - working and tested in IE FF Chrome.  Thank you very much!

<script>
$(function() {
 //$("#confirmation .btn").click(function(){
$(".confirmation").click(function(){
 $(this).prop('disabled', true);
 $("form[name=checkout_confirmation]").submit(); 
 });
 });
</script>

      <div style="float: right;">
        <?php
            if (is_array($payment_modules->modules)) {
            echo $payment_modules->process_button();
            }
//            echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary');
            echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary', array('params' => 'class="confirmation" data-loading-text="Processing..." autocomplete="off"'));
        ?>
        </div>

With double click disabled I guess its not necessary. but could the above work with the spinner.gif during processing so the customer has some visual indication that processing is occurring?

i.e. <img src="ext/jquery/bxGallery/spinner.gif" />

 

Thx all for the help

Dave


-Dave

Share this post


Link to post
Share on other sites
<script>
$(function() {
    $(".confirmation").click(function(){
        $(this).prop('disabled', true);
        $(this).before('<img src="ext/jquery/bxGallery/spinner.gif" />');
        $("form[name=checkout_confirmation]").submit(); 
    });
});
</script>

Untested but should work...   This would all of course be better suited for a header_tag module.


Matt

Share this post


Link to post
Share on other sites
<script>
$(function() {
 //$("#confirmation .btn").click(function(){
$(".confirmation").click(function(){
 $(this).prop('disabled', true);
 $("form[name=checkout_confirmation]").submit(); 
 });
 });
</script>

      <div style="float: right;">
        <?php
            if (is_array($payment_modules->modules)) {
            echo $payment_modules->process_button();
            }
//            echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary');
            echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary', array('params' => 'class="confirmation" data-loading-text="Processing..." autocomplete="off"'));
        ?>
        </div>

now I'm confused... with above in place a duplicate order just processed.  argghh. back to drawing board.


-Dave

Share this post


Link to post
Share on other sites

Did you get this figured out? I just got a duplicate order come through PayPal Pro Direct. The orders have 2 different numbers as well as transaction numbers from PayPal. I have a modified 2.3.4 BS version site. The orders went through seconds apart so I am guessing customer clicked button twice?

Share this post


Link to post
Share on other sites

×