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

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

Locked

Views: 23,606

Results 21 to 40 of 50
This thread is locked. New replies are disabled.
13 Aug 2008, 9:18 PM
#21
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

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

LOL,

Yes, I've implemented the code changes suggest here in this thread, and am currently using db based sessions.

Yes, I am getting "random" duplicate orders WITH duplicate debits from the buyer's card. NOT EVERY time, strangely enough.

No, I'm not using CSS buttons at the moment, just the graphical ones.

We just had a purchase that did not duplicate. Is the browser info stored anywhere in the purchase information? Once the sessions expires it's no longer in the sessions file.

Glad you've been pounding away at this. Hope the core team has been paying attention.

Will keep you up to date if this has truly fixed the problem.

-chaddro

14 Aug 2008, 12:51 PM
#22
paulm avatar

paulm

Totally Zenned

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

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

:smile:

chadderuski:

Will keep you up to date if this has truly fixed the problem.That would indeed be interesting to know.

The earlier fix worked perfectly in my case, but nevertheless I decided to update. This is how \includes\modules\pages\checkout_confirmation\jscript_main.php looks like now:

<?php
/**
 * jscript_main
 *
 * @package page
 * @copyright Copyright 2003-2006 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 3505 2006-04-24 04:00:05Z 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.disabled = true;
  //button.style.color = "red";
  setTimeout('button_timeout()', 4000);  
  return false;
}
function button_timeout() {
  var button = document.getElementById("btn_submit");
  button.disabled = false;
  //button.style.color = "black";
}

//--></script>

(this replaces the zip attachment from the first post of this thread, which will be removed)

14 Aug 2008, 2:37 PM
#23
paulm avatar

paulm

Totally Zenned

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

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

Demo of a "funnier" version :D

http://www.beterelectro.nl/tests/submit-once/css.php

Replaces the cursor by an hourglass or watch, and replaces the button text, when the form has been submitted (text replacement only on CSS buttons only).

17 Aug 2008, 1:38 PM
#24
craigkendall avatar

craigkendall

New Zenner

Join Date:
May 2007
Posts:
46
Plugin Contributions:
0

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

I have several zen cart installations running on several servers. Yesterday, though it may only be coincidence, the only two of those sites which received orders had duplicate zen cart orders for each transaction (two each). They are exact duplicate orders with different order numbers. There appears to be only one PayPal transaction for each but duplicate zen cart orders and confirmation emails.

I find it hard to believe something magically switched on or off and now the store is doing duplicates of each order, but I find it equally hard to believe that everyone placing an order on two different stores could have double clicked some button twice to register the order twice without two PayPal payments.

Any ideas?

17 Aug 2008, 2:29 PM
#25
vwebworld avatar

vwebworld

New Zenner

Join Date:
Mar 2005
Location:
South coast of MA, USA
Posts:
72
Plugin Contributions:
0

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

craigkendall:

I have several zen cart installations running on several servers. Yesterday, though it may only be coincidence, the only two of those sites which received orders had duplicate zen cart orders for each transaction (two each). They are exact duplicate orders with different order numbers. There appears to be only one PayPal transaction for each but duplicate zen cart orders and confirmation emails.

I find it hard to believe something magically switched on or off and now the store is doing duplicates of each order, but I find it equally hard to believe that everyone placing an order on two different stores could have double clicked some button twice to register the order twice without two PayPal payments.

Any ideas?
I have the same problem... just started too.
ZenCart 1.38a Paypal IPN

~roland

18 Aug 2008, 1:10 AM
#26
stalene avatar

stalene

New Zenner

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

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

Paul,

Thanks for the mod. I installed PayPal IPN for the first time today and like everyone else was getting duplicate orders and confirmations with different order numbers, although the payment was only being processed one. I just made the edits you gave and tested it. So far, so good.

Thanks! :clap:

19 Aug 2008, 6:54 PM
#27
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

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

Paul,

Last code (not the newest) did not work either. Client was able to click twice and get two orders.

Will try your newest code.

This is on a Bluehost shared server. It has been performing okay to date. But I just received an e-mail from client saying it was taking a very very long time after hitting submit button for order to go through. I could see THAT being an issue and a customer double clicking out of impatience!

Really got a head ache over this one!

-cj

19 Aug 2008, 7:48 PM
#28
paulm avatar

paulm

Totally Zenned

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

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

chadderuski:

Paul,

Last code (not the newest) did not work either. Client was able to click twice and get two orders.Now I am curious what that "last code" exactly was that you tried. Can you PM it to me? (but not post it here, to prevent confusion). And are you sure the client was able to click twice, or did you assume he was because two orders were generated?

The only ways that the client is able to click twice (that I can think of, and when using the code posted above) :

  • the client has javascript disabled
  • the processing takes longer than 4 seconds, after that the button is enabled again
  • after clicking the client quickly reloads the page (combined with slow processing), after a reload the button will be enabled again

And if the above code does not help it might be interesting to switch try file based sessions after all I think.

19 Aug 2008, 9:00 PM
#29
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

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

Bugger!

Now I'm getting a migraine. 4 seconds? Try two minutes for the page to submit!

Even if the button WAS disabled, having the page take more than a minute to submit is insane.

THAT has to be an issue with Bluehost. Been talking with client this afternoon and looking at moving the site. Bluehost has done some "odd" things recently.

Example: change some php or css code... upload code... refresh page. Changes not visible.... wait two to five minutes refresh page NOW page changes visible. Before I figured THAT out I was banging my head bloody!

I'll send you a pm. Perhaps you'd like to look at the sight?

-cj

20 Aug 2008, 2:24 PM
#30
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

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

Paul,

I just tested the above posted code, and it did not work as is. What happens if I increase the length of time on the settimeout() function? Will it prevent the page from refreshing until that has run?

It seems that if it takes more then 4 seconds to refresh the page that I can get a second click in.

-cj

20 Aug 2008, 2:52 PM
#31
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

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

okay, setting it to 16 seconds did not prevent the page from refreshing sooner than the 16 seconds.

Curious though, it the function "locked" for THAT session, or if another user attempts to submit an order within that 16 second window, will their submit button be disabled?

-cj

20 Aug 2008, 4:01 PM
#32
paulm avatar

paulm

Totally Zenned

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

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

chadderuski:

Curious though, it the function "locked" for THAT session, or if another user attempts to submit an order within that 16 second window, will their submit button be disabled?It will only be "locked" for the user that clicked the button. But if the process takes that much time the script can not prevent the user from reloading the page and click again anyway.

The script only prevents fast double clicks.

I know that it would also be possible to swap the button by a "Please Wait" button or text. Maybe that would convince the user to not reload the page, or at least to wait a bit longer. But I am really a js noob so please don't expect any quick solutions from me.

Also if the page is not being processed in a couple of seconds I think the cause of that should be found and it should fixed first.

20 Aug 2008, 4:28 PM
#33
paulm avatar

paulm

Totally Zenned

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

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

Hi Chadd,

can you try this version please?

It's the same script, but hopefully it will make clear when the button is disabled and enabled again (by changing the pointer). I tried the site you are talking about but I could not see if the script did it's job, I could not find any errors though.

<?php
/**
 * jscript_main
 *
 * @package page
 * @copyright Copyright 2003-2006 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 3505 2006-04-24 04:00:05Z 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;
  //button.style.color = "red";
  setTimeout('button_timeout()', 4000);  
  return false;
}
function button_timeout() {
  var button = document.getElementById("btn_submit");
  button.style.cursor="pointer";
  button.disabled = false;
  //button.style.color = "black";
}

//--></script>

(the 2 red lines are added)

21 Aug 2008, 4:43 AM
#34
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

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

Hi Paul,

Thanks for taking a look. You'll get a chuckle out of this. Been working with the client and talking about the problem, also had to do a price update and had just posted that. He saw you online of all things and got worried he was being hacked!

I didn't make the connection until later: Paul Tester, LOL! Gotta love that.

I'll add the code in. Jeez, anything that helps.

Oh, I did have one idea. I have seen sites use a semi transparent layer OVER the order submit page to cover up the underlying clickable buttons usually with some sort of "please wait text".

I think I've seen it with ajax, but it should be doable with css and javascript, ya think? Would be a good solution provided java wasn't disabled.

As far as the LOOOONG submit times: I've change to smtp for mail instead of php. This seems a bit faster. But I'll blame bluehost for cramming too many hosts on one box. Not sure if this is THE fix because it's hard to tell just what's going on at bluehost. But the long submit time is positively linked to the e-mail function. Was able to test that from within the admin.

Unfortunately, dedicated or managed hosting is still out of the budget for the time being for this client.

Thanks again ... I'll keep testing. Your latest code works for me using the 16 sec timeout... Tested several times with IE7 attempting to get a duplicate order, and everything worked okay.

I'll poke around for that "white out" layer idea and see what I can find.

-cj

21 Aug 2008, 8:14 AM
#35
paulm avatar

paulm

Totally Zenned

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

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

chadderuski:

You'll get a chuckle out of this. Been working with the client and talking about the problem, also had to do a price update and had just posted that. He saw you online of all things and got worried he was being hacked!

I didn't make the connection until later: Paul Tester, LOL! Gotta love that.:laugh: Next time I will use a name like pAUL da hACKer or something :P

In the mean time I tested it on my own shop (using css buttons) and on a standard 1.3.8a shop (standard image buttons) and it works fine on both. When using css buttons I think a simple but nice solution is to swap the "value" of the button, this will swap the button text. Currently I have it swap to "One moment..." (in Dutch).

Also note there has been a problem at Paypal recently that also resulted in duplicate orders. There is a topic about it somewhere on this board, it seems to be resolved now. This script will not have any effect on typical Paypal issues like that.

If you have duplicate orders and/or multiple transactions with several payment modules, even with moneyorder or cod for example, then this script may help to prevent the duplicates.

3 Sep 2008, 4:12 PM
#36
dhcernese avatar

dhcernese

Zen Follower

Join Date:
Mar 2007
Location:
Pepperell, Massachusetts
Posts:
232
Plugin Contributions:
0

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

paulm:

Hi Chadd,

can you try this version please?

It's the same script, but hopefully it will make clear when the button is disabled and enabled again (by changing the pointer). I tried the site you are talking about but I could not see if the script did it's job, I could not find any errors though.

<?php /** * jscript_main * * @package page * @copyright Copyright 2003-2006 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 3505 2006-04-24 04:00:05Z 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; //button.style.color = "red"; setTimeout('button_timeout()', 4000); return false; } function button_timeout() { var button = document.getElementById("btn_submit"); button.style.cursor="pointer"; button.disabled = false; //button.style.color = "black"; } //--></script>
> (the 2 red lines are added)
I tested this today on my site (included the functions with the red lines) with IE7.  It was successful in preventing multiple clicks!  :clap: However, my cursor did not change to a wait cursor.
 
In fact, my cursor is a normal arrow elsewhere on the page.  Before clicking, when I float over the image button, it turns into a finger.  After clicking, your code changed it to the normal arrow and prevented clicking.
8 Nov 2008, 4:12 PM
#37
confused_aswell avatar

confused_aswell

Zen Follower

Join Date:
Apr 2008
Location:
UK
Posts:
315
Plugin Contributions:
1

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

Hi

Should I change my file to the above text? Will this prevent duplicate orders?

Thanks,

Phil

10 Nov 2008, 8:20 PM
#38
paulm avatar

paulm

Totally Zenned

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

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

Yes, it will prevent duplicate orders that are caused by:

1- The original /includes/modules/pages/checkout_confirmation/jscript_main.php Zen Cart script.

2- Almost all double clicks by customers.

No, it won't prevent duplicate orders that are caused by anything else.

In my case it certainly works. I had several duplicates daily before, and haven't had any since I updated the script.

10 Nov 2008, 8:32 PM
#39
confused_aswell avatar

confused_aswell

Zen Follower

Join Date:
Apr 2008
Location:
UK
Posts:
315
Plugin Contributions:
1

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

Hi

Thanks for getting back to me, I have saved the new file in includes/modules/pages/checkout_confirmation/MY TEMPLATE/jscript_main.php

Will it work ok there?

I guess we will have to see if it works, but I hope it does - it's driving me nuts!

Thanks,

Phil

10 Nov 2008, 8:42 PM
#40
paulm avatar

paulm

Totally Zenned

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

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

confused_aswell:

I have saved the new file in includes/modules/pages/checkout_confirmation/MY TEMPLATE/jscript_main.php

Will it work ok there?No that won't work, the over rides system does not work for the pages. You really need to over write /includes/modules/pages/checkout_confirmation/jscript_main.php !