Forums / Bug Reports / [Done v1.3.9a] Duplicate Orders/Order Confirmation

[Done v1.3.9a] Duplicate Orders/Order Confirmation

Locked

Views: 23,606

Results 41 to 50 of 50
This thread is locked. New replies are disabled.
14 Nov 2009, 1:16 PM
#41
thysm00 avatar

thysm00

New Zenner

Join Date:
May 2009
Posts:
30
Plugin Contributions:
0

[Done v1.3.9a] Duplicate Orders/Order Confirmation

Hey just a little solution that works for all major browsers (firefox safari, opera and ie), because i installed your solution and it seems that some browsers don't accept to disable an input type = image

Here is my solution here:
http://www.zen-cart.com/forum/showpost.php?p=802973&postcount=79

It's a little drastic but it seems to work.

14 Nov 2009, 1:46 PM
#42
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: [Done v1.3.9a] Duplicate Orders/Order Confirmation

Strange.....

To be sure I tested it (again) and it works just fine in both Firefox and IE8, also with image buttons. After the click the button is disabled, and after the the timeout it's enabled again.

I guess you mean that the image button does not look disabled? But I think to make an image button look disabled you will need to swap your standard button image with a disabled looking button.

14 Nov 2009, 1:55 PM
#43
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: [Done v1.3.9a] Duplicate Orders/Order Confirmation

Found a (minor?) problem in Chrome though with the image buttons (css buttons work fine). The button is not automaticly enabled again after the timeout.

14 Nov 2009, 2:24 PM
#44
thysm00 avatar

thysm00

New Zenner

Join Date:
May 2009
Posts:
30
Plugin Contributions:
0

Re: [Done v1.3.9a] Duplicate Orders/Order Confirmation

paulm:

Strange.....

To be sure I tested it (again) and it works just fine in both Firefox and IE8, also with image buttons. After the click the button is disabled, and after the the timeout it's enabled again.

I guess you mean that the image button does not look disabled? But I think to make an image button look disabled you will need to swap your standard button image with a disabled looking button.

I tested it yesterday and nothing happened, but maybe that's because i'm on a mac here... I thought i also had to give it a shot because i still get duplicate orders even with your solution and it's driving me crazy...
Btw, did you look at the code when enabling css buttons? It appears that the id "btn_submit" is not associated anymore with that button so i don't understand why that could work, but maybe there is something wrong with my source code, i modified so many things on it that maybe it's my fault. You can check it here if you want: https://www.acousticsamples.net

14 Nov 2009, 3:05 PM
#45
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: [Done v1.3.9a] Duplicate Orders/Order Confirmation

With the Zen Cart css buttons it probably won't work because that code has some bugs. I use the css-buttons add on: http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=272

The issue also was driving me crazy at the time. But the button indeed needs to have an id, without the id it won't do anything.

Here I have a test script online that uses image buttons: http://www.beterelectro.nl/tests/submit-once/image.php
(using css buttons it works better, as it then shows the button is disabled and it does not have the Chrome issue, http://www.beterelectro.nl/tests/submit-once/css.php)

In my case I am sure that the duplicate orders were caused by the original javascript that was supposed to prevent double clicking (it causes a race condition in IE8 I think). So it was not that customers double clicked, but just a single click would trigger the race condition and often cause duplicate orders. But probably there are other possible causes.

14 Nov 2009, 4:35 PM
#46
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: [Done v1.3.9a] Duplicate Orders/Order Confirmation

This gets stranger every time I look at it :blink:

Chrome seems to detect that the data has been posted and does not post it a second time. As if double click protection has been built into Chrome itself?

Using Chrome and css-buttons it looks like it's possible to submit a second time (as the button is enabled again after the timeout), but the second click only disables the button and does not submit the data a second time. Unless the data has changed, then Chrome allows another submit.....

Because image buttons don't show the disabled effect the image buttons seem to do nothing on second click. If no disabled effect would be used for the css-buttons the result would be identical.

23 Feb 2010, 7:33 PM
#47
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: [Done v1.3.9a] Duplicate Orders/Order Confirmation

To hopefully clarify some things:

It's very unlikely, if not impossible, that this fix helps for any PayPal duplicate orders, or with any other "payment provider powered" payment module.

And any issue with duplicate order numbers is unrelated.

This fix does two things:

  • Prevent the checkout_confirmation button/form being submitted twice while the button is only clicked once (bug fix). Without the fix there is a chance of having duplicate money order orders for example.

  • Prevent the checkout_confirmation button being clicked multiple times (the goal of the original submitonce script)

And even if checkout_confirmation is submitted and/or clicked multiple times this should NOT lead to duplicate orders if a payment method like PayPal is being used. So that's a completely different problem.

23 Feb 2010, 7:44 PM
#48
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: [Done v1.3.9a] Duplicate Orders/Order Confirmation

Actually, it does help with gateway-handled orders, such as Authorize.net-AIM and paypal-website-payments-pro and paypal-express-checkout.
It does NOT help for things like PayPal-IPN and Authorize.net-SIM where the payment is completely handled off-site. Duplicates encountered with those modules ARE UNRELATED to the issue discussed in this thread.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Feb 2010, 7:49 PM
#49
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: [Done v1.3.9a] Duplicate Orders/Order Confirmation

The following fix is included in v1.3.9, and should work with all v1.3.x versions:
Change the /includes/modules/pages/checkout_confirmation/jscript_main.php to the following:```

<?php /** * jscript_main * * @package page * @copyright Copyright 2003-2010 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: jscript_main.php 15536 2010-02-20 06:11:54Z drbyte $ */ ?> <script language="javascript" type="text/javascript"><!-- var submitter = null; function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=320,screenX=150,screenY=150,top=150,left=150') } function couponpopupWindow(url) { window.open(url,'couponpopupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=320,screenX=150,screenY=150,top=150,left=150') } function submitFunction($gv,$total) { if ($gv >=$total) { submitter = 1; } } function submitonce() { var button = document.getElementById("btn_submit"); button.style.cursor="wait"; button.disabled = true; setTimeout('button_timeout()', 4000); return false; } function button_timeout() { var button = document.getElementById("btn_submit"); button.style.cursor="pointer"; button.disabled = false; } //--></script>

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Feb 2010, 7:52 PM
#50
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: [Done v1.3.9a] Duplicate Orders/Order Confirmation

Thanks DrByte. I knew I missed something :smile:
(which was the on/off-site handling)