Excellent find. I can also confirm this happens in Internet Explorer 6.
Printable View
Excellent find. I can also confirm this happens in Internet Explorer 6.
This is very interesting and looks like it might well be on the right track.
Can any of the Zen Gurus enlighten us as to the purpose of this code? Why would removing code that is (at first sight) supposed to *prevent* double clicks the cause of them happening?
I have been live for 2 weeks now and have no problems since the change :-)
modernm, do you mean this change?
onsubmit="submitonce(this);"
or do you mean by removing that piece of code.
Bram
Interesting!
I had the same issue and found out that the session data was overwritten in those cases. This is possible because zen cart does not lock the sessions when they are stored into the database. And the double POST submit now explains why it happened so often.
Since I store the sessions in files (then session locking works automaticly), I haven't had any double orders in about 4 months (before I had at least several a week). I also described it previously here: http://www.zen-cart.com/forum/showthread.php?t=82029
Note that it might not be safe to use file based sessions on shared servers.
I've had errors before when I used file based sessions in a shared environment. Once it even came up with another sites customer logged in and their current cart. Since I switched to sql based sessions I've never had that problem.
On versions previous to 1.37 I never had double order issues but then again the volume at the time was much lower on the site as well. Volume has increased over the last 3 months and that is when the duplicate order problem appeared.
Currently I am using 1.37 and also building a 1.38a version to put in place once I get the code modified and I'd really like to verify the source of the problem and get it corrected before I put 1.38a in place.
Hi,
I'm using v.1.3.8, IE 7.
I'm having the Duplicate Order problem too, but noticed one thing REALLY interesting:
It charged me twice (as two orders) as well!
* I noticed this when I logged into the store owner's paypal account, and saw it hit me twice within the 9 seconds.
* I noticed it also listed two orders (as two separate orders) in the admin of the Zen Cart.
BUT REALLY, REALLY INTERESTING:
** Paypal, after about an hour, corrected itself... and removed the duplicates. (Then later in the evening, on another test, only charged it once).
** ZenCart, after a few hours, somehow took out the duplicate orders!!! I'm not kidding on this one. They were there for me to see in the admin control panel, now they're gone... leaving just the real order (even still, it left the order count # as a later count #).
It does this regardless of if it is Paypal Express, or just the regular Paypal Api. I have the credit card method turned 'off' on the site, but do accept check/money order.
Could someone really, really high up at ZenCart look into all this... since I'd imagine it is super, super important?? Payment is pretty darn key when it comes to e-commerce.
I have the log emails from the debug, I'm willing to give some access to someone high up at ZenCart if it will help them look into the problem for a fix.
(Also a note to the high-up cool people at ZenCart: Test ZenCart v.1.3.8 in Firefox, you'll see a lot of funny things going on, duplicate listings, etc.).
Thanks! :-)
- Brian
Brian02138
I think I found the problem!
I decided to write write a small testscript which included the submitonce function and I did lots of tests. And in IE7 the following happened:
- If the user clicks very fast, before the page is fully loaded: no problem, the form is submitted once.
- If the user waits until after the page is fully loaded: no problem: the form is submitted once.
- But if the user clicks just about the time the page finishes loading: the form is submitted twice!
(using IE7, in FF everything works fine)
Now if you open:
/includes/modules/pages/checkout_confirmation/jscript_main.php
You can find the function:
Take a look at this line:Code:function submitonce(){
if (document.checkout_confirmation.btn_submit) {
document.checkout_confirmation.btn_submit.disabled = true;
setTimeout('button_timeout()', 4000);
document.checkout_confirmation.submit();
}
}
I don't know much about Javascript, but it looks like we just submitted the form, then disabled the submit, and then try to submit it here again!? Maybe this line was added to test the submitonce function?Code:document.checkout_confirmation.submit();
So I decided to comment out the above line like this:
After that I have done lots of tests again and I didn't get any duplicate submissions.Code:function submitonce(){
if (document.checkout_confirmation.btn_submit) {
document.checkout_confirmation.btn_submit.disabled = true;
setTimeout('button_timeout()', 4000);
/* document.checkout_confirmation.submit(); */
}
}