Zen Cart Logo
Forums / Managing Customers and Orders / Duplicate Orders/Order Confirmation

Duplicate Orders/Order Confirmation

Views: 65,563

Results 21 to 40 of 131
23 Feb 2008, 7:24 PM
#21
modernm avatar

modernm

New Zenner

Join Date:
Dec 2007
Location:
Hoboken, NJ
Posts:
97
Plugin Contributions:
1

Duplicate Orders/Order Confirmation

Excellent find. I can also confirm this happens in Internet Explorer 6.

4 Mar 2008, 5:46 PM
#22
einstin avatar

einstin

New Zenner

Join Date:
Feb 2005
Location:
Atlanta, GA
Posts:
71
Plugin Contributions:
0

Re: Duplicate Orders/Order Confirmation

alex42:

Quick fix:
Remove the javascript function in

includes/templates/[TEMPLATE]/templates/tpl_checkout_confirmation_default.php

>    ```
onsubmit="submitonce();"
```part. 
> Doing so, you will lose the functionality, that the user cannot click twice on the submit button, but orders are not doubled any more.


Since a couple weeks have passed can it be confirmed that this has fixed the issue without any side effects? What if a customer does actually double click?
5 Mar 2008, 10:08 AM
#23
jmouse avatar

jmouse

New Zenner

Join Date:
Mar 2007
Posts:
53
Plugin Contributions:
0

Re: Duplicate Orders/Order Confirmation

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?

5 Mar 2008, 10:39 PM
#24
einstin avatar

einstin

New Zenner

Join Date:
Feb 2005
Location:
Atlanta, GA
Posts:
71
Plugin Contributions:
0

Re: Duplicate Orders/Order Confirmation

I'm wondering if it shouldn't be changed from this;

alex42:

onsubmit="submitonce();"



To this;

onsubmit="submitonce(this);"

Ideas anyone?
12 Mar 2008, 4:12 AM
#25
modernm avatar

modernm

New Zenner

Join Date:
Dec 2007
Location:
Hoboken, NJ
Posts:
97
Plugin Contributions:
1

Re: Duplicate Orders/Order Confirmation

I have been live for 2 weeks now and have no problems since the change :-)

12 Mar 2008, 7:46 AM
#26
manage_it avatar

manage_it

Inactive

Join Date:
May 2006
Posts:
80
Plugin Contributions:
0

Re: Duplicate Orders/Order Confirmation

modernm, do you mean this change?
onsubmit="submitonce(this);"

or do you mean by removing that piece of code.

Bram

12 Mar 2008, 2:04 PM
#27
paulm avatar

paulm

Totally Zenned

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

Re: Duplicate Orders/Order Confirmation

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.

13 Mar 2008, 3:16 PM
#28
einstin avatar

einstin

New Zenner

Join Date:
Feb 2005
Location:
Atlanta, GA
Posts:
71
Plugin Contributions:
0

Re: Duplicate Orders/Order Confirmation

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.

31 Mar 2008, 5:46 AM
#29
brian02138 avatar

brian02138

New Zenner

Join Date:
Nov 2007
Posts:
3
Plugin Contributions:
0

Re: Duplicate Orders/Order Confirmation

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

31 Mar 2008, 11:39 AM
#30
paulm avatar

paulm

Totally Zenned

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

Re: Duplicate Orders/Order Confirmation

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:

function submitonce(){
  if (document.checkout_confirmation.btn_submit) {
    document.checkout_confirmation.btn_submit.disabled = true;
    setTimeout('button_timeout()', 4000);
    document.checkout_confirmation.submit();
  }
}

Take a look at this line:

    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?

So I decided to comment out the above line like this:

function submitonce(){
  if (document.checkout_confirmation.btn_submit) {
    document.checkout_confirmation.btn_submit.disabled = true;
    setTimeout('button_timeout()', 4000);
    /* document.checkout_confirmation.submit(); */
  }
}

After that I have done lots of tests again and I didn't get any duplicate submissions.

31 Mar 2008, 12:31 PM
#31
paulm avatar

paulm

Totally Zenned

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

Re: Duplicate Orders/Order Confirmation

And while you're at it you might as well fix another small error in the same file.

Change:

function button_timeout() {
  document.checkout_confirmation.[B]submit[/B].disabled = false;
}

To:

function button_timeout() {
  document.checkout_confirmation.[B]btn_submit[/B].disabled = false;
}
2 Apr 2008, 2:23 PM
#32
paulm avatar

paulm

Totally Zenned

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

Re: Duplicate Orders/Order Confirmation

Since I have made the changes to my live shop (and switched back the session saving from files to database) we have had no duplicate orders.

Also another issue I had with a typical Dutch payment method seems to be solved. Before I often had two transactions per order with this module (which did not lead to duplicate orders, so it was not a big problem). The first of the two transactions always expired and the second always was the "real" transaction. Until now I have not seen this happening anymore.

Maybe it's a bit early to draw conclusions after a couple of days and a limited amount of orders, but so far it looks very good :smile:

I attached a fixed file to this post for 1.3.6 - 1.3.8, and possibly other versions.
(of course you need to put back the onsubmit="submitonce();" if it has been removed, if you don't the fix won't make any difference).

6 Apr 2008, 11:51 PM
#33
lloyd_borrett avatar

lloyd_borrett

Zen Follower

Join Date:
Mar 2006
Location:
Rosebud, Victoria, Australia
Posts:
308
Plugin Contributions:
2

Re: Duplicate Orders/Order Confirmation

G'day,

Just where does one switch session saving from files to database?

Best Regards, Lloyd Borrett.

7 Apr 2008, 8:05 AM
#34
paulm avatar

paulm

Totally Zenned

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

Re: Duplicate Orders/Order Confirmation

Hi Lloyd,

you would need to edit your includes/configure.php file (the is a setting for it somewhere at the bottom).

But are you sure your sessions are saved into files currently? By default the sessions are saved into the database, and then there is no need to change it.

(I only mentioned it because I had said earlier that I changed this setting to fix the duplicate orders problem, but after the submitonce fix I changed it back to the default)

18 Apr 2008, 3:33 AM
#35
fotofx avatar

fotofx

Zen Follower

Join Date:
Apr 2008
Location:
South Florida
Posts:
195
Plugin Contributions:
0

Re: Duplicate Orders/Order Confirmation

Happening to me also. I get an order that does not show the items and then the next order number with the items and Paypal payment info.. Really strange.

I applied the fix file and have the sessions going to the database. I am going to try file sessions.

Steve

18 Apr 2008, 3:38 AM
#36
fotofx avatar

fotofx

Zen Follower

Join Date:
Apr 2008
Location:
South Florida
Posts:
195
Plugin Contributions:
0

Re: Duplicate Orders/Order Confirmation

Same problem with file sessions. It looks like Paypal is creating a new session on the return???

Steve

18 Apr 2008, 3:42 AM
#37
fotofx avatar

fotofx

Zen Follower

Join Date:
Apr 2008
Location:
South Florida
Posts:
195
Plugin Contributions:
0

Re: Duplicate Orders/Order Confirmation

Just noticed that none of the notification emails are being sent on the lower order number.

If I enter an order, I get an order number 10 that has no products itemized. It only shows totals and no email order is generated.

I will also get an order number 11 that will have the products itemized and all the Paypal info in it. It also sends the order email.

Any Thoughts???

Steve

18 Apr 2008, 6:59 AM
#38
paulm avatar

paulm

Totally Zenned

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

Re: Duplicate Orders/Order Confirmation

I think the issue you have is not related to the topic of this thread (although the issue may seem similar maybe) and so it's probably better to start a new thread about it?

21 Apr 2008, 7:57 AM
#39
paulm avatar

paulm

Totally Zenned

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

Re: Duplicate Orders/Order Confirmation

I decided to start a thread about this issue in bug reports:
http://www.zen-cart.com/forum/showthread.php?p=544255

And I will move the attachment with the fixed js file to that thread.

28 Apr 2008, 12:49 PM
#40
richtom80 avatar

richtom80

New Zenner

Join Date:
Apr 2008
Posts:
3
Plugin Contributions:
0

Re: Duplicate Orders/Order Confirmation

Hi,

I am still having the issue of duplicate payments on every order that is processed via Zen Cart on Paypal IPN. I have tried all the fixes mentioned and still happening in all browsers including FF.

Any help would be greatly received.

Many Thanks

Richard