VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: alex2311 on May 25, 2014, 07:59:57 AM

Title: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: alex2311 on May 25, 2014, 07:59:57 AM
Hello,

When checking out using "VM Payment - Standard", only one order is generated in the backend.  When checking out with "VM Payments - PayPal", the order is duplicated in the back end with a different Order Number.  PayPal transacts correctly and the original order status is updated indicating payment was made for the first order.  The second order does nothing.

I checked the code as suggested in the message http://forum.virtuemart.net/index.php?topic=123644.msg422091#msg422091 (http://forum.virtuemart.net/index.php?topic=123644.msg422091#msg422091) but it has already been included.

Any guidance in addressing this issue will be greatly appreciated.

Cheers,

Alex
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: alex2311 on May 29, 2014, 14:51:30 PM
We cannot be the only people experiencing this?  We have been able to replicate on two sites so far?  Any one else experiencing this?

Any help/guidance will be greatly appreciated.

Alex
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: alex2311 on May 30, 2014, 17:13:14 PM
Just went to VM 2.6.6....  And still getting duplicates.

I uninstalled the modules and dropped all the VM table from the database.  I then did a complete re-install...  No errors on install...  But still getting duplicates when checking out with PayPal.

Any advice would be greatly appreciated...

Alex
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: Milbo on June 03, 2014, 15:06:27 PM
Please check the override of your cart layout. We replaced the link against a button, with a js, which prevents that you can hit the button twice. We also changed the checkout. Do you use some OPC of a 3rd party?
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: alex2311 on June 04, 2014, 13:15:35 PM
Hi Milbo,

Thanks for your reply.  The site has "No Override" selected for the Cart Layout.  I am using no other 3rd party One Page Check (OPC) functionality for Virtuemart.  I am only using the default that comes with the Virtuemart download package.

I will PM you a login so you can have a poke around...

Thanks for your help/

Alex
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: multigeo on June 05, 2014, 14:44:29 PM
I have been battling this exact same issue.
My site is on J2.5.20 / VM2.6.6 / VM native OPC
I am using overrides, but the same issue existed when removing all of them, so that's not where the problem lies.
Neither makes switching OPC on/off any difference.

I went through the override for the checkout page and noticed the following:

illustrating the procedure:

After lots of experimenting and playing around I solved it (more extensive testing needed at this time) as follows:
It seems that each click on the checkout button generates an order.
So I disabled it in the override unless $this->checkout_task = 'confirm'
At the same time I clear the variable $taskRoute.

I'm sure this is not the correct solution, but I hope it gets me by until a proper fix is known.
I attached my override for you as an example. (remove the TXT extension)
Examine it well before playing with it. It stores in folder: \templates\<template>\html\com_virtuemart\cart

Any comments from VM guru's is very welcome

Cheers
André

[attachment cleanup by admin]
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: Milbo on June 05, 2014, 19:17:37 PM
Quote from: alex2311 on June 04, 2014, 13:15:35 PM
Thanks for your reply.  The site has "No Override" selected for the Cart Layout.  I am using no other 3rd party One Page Check (OPC) functionality for Virtuemart.  I am only using the default that comes with the Virtuemart download package.

I will PM you a login so you can have a poke around...

We talk about overrides done automatically by joomla and your template. You sent me a pm, but I need superuser rights. Honoring our work of course increases our motivation http://extensions.virtuemart.net/support/virtuemart-supporter-membership-detail

Quote from: multigeo on June 05, 2014, 14:44:29 PM

After lots of experimenting and playing around I solved it (more extensive testing needed at this time) as follows:
It seems that each click on the checkout button generates an order.
So I disabled it in the override unless $this->checkout_task = 'confirm'
At the same time I clear the variable $taskRoute.

I'm sure this is not the correct solution, but I hope it gets me by until a proper fix is known.
I attached my override for you as an example. (remove the TXT extension)
Examine it well before playing with it. It stores in folder: \templates\<template>\html\com_virtuemart\cart

Any comments from VM guru's is very welcome

Cheers
André

Hmm, actually it should create a pending order, but update the old one if there is already one. I just also noticed myself, cancelling the paypal process leads to a new order and the old is in pending state. Thank you for this exact observation.
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: hotrod on June 11, 2014, 19:08:32 PM
I'm in Another thread.. here..  http://forum.virtuemart.net/index.php?topic=123644.msg424933#msg424933
Getting duplicate orders and payment all of a sudden..  did nothing..  turning off SSL stopped it..  any Clue what it can be?
updated last week and got many orders with no problems.. then 3:pm yesterday it went to hell..

VM 2.6.6 
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: stensbo on June 11, 2014, 20:12:52 PM
Using Joomla 2.5.20, Multi language (only DK in VM), Beez20 copy template, Virtuemart 2.6.6, PHP Version 5.3.27, vm override.

Joomla site is live - danrider.dk -  but vm shop is only for registered shopper.

Quote from: alex2311 on May 25, 2014, 07:59:57 AM

When checking out using "VM Payment - Standard", only one order is generated in the backend.

Use vmpayment plugin Standard  -  I have had orders with no issue after upgrade to 2.6.6 - but yesterday I got double ordres with different order no.
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: alex2311 on June 22, 2014, 17:57:27 PM
Thanks everyone for your comments....  I have tried what people have suggested but unfortunately it did not work for.  I have tried to figure out why the function is getting called more than once to generate multiple Orders.  But with my limited PHP coding experience (OK...really no experience.. I have been playing in it for a month.. ;) ), I have had no success (no real surprise there....). But what I did come up with is a work-around that works for me..  It may not be elegant, but it works....!

What follows are the changes I made to make it work... REMEMBER I AM NOT A CODER!!!!!!  So please ensure that you review the changes and make sure it is applicable to you!

The following changes have been made to the "components\com_virtuemart\helpers\cart.php" file:

This code works for me..... it might work for you?  Hopefully the next version will able to fix the root cause of the problem......

Cheers,

Alex
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: hotrod on June 22, 2014, 19:05:13 PM
Wow.. Nice.. I may have to try this..
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: Milbo on June 23, 2014, 15:34:54 PM
Then it should be also enough to write

if ($this->_dataValidated && $this->_confirmDone and !$this->_inCheckOut) {

because we have such a variable _inCheckOut
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: alex2311 on June 23, 2014, 19:03:01 PM
Thanks Milbo,

Being that I am a novice at this... I can't see where the $this->_inCheckOut is set to true after it processed so that it can't be triggered again?

Anyway... I took my code out and tried "if ($this->_dataValidated && $this->_confirmDone and !$this->_inCheckOut) {" as suggested by Milbo.... Unfortunately my duplicates came straight back.  I even tried setting    $this->_inCheckOut=true; straight after... Duplicates still occurred.  Something is obviously resetting the flag somewhere....

So I have put my code back and the duplicates have stopped.

Alex
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: hotrod on June 23, 2014, 19:33:11 PM
Watching this closely..  this should work for my Authorize.net I would assume..

Do you know if your double order are just from Internet Explorer?  Mine are..
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: alex2311 on June 24, 2014, 03:26:19 AM
Hi Hotrod,

In my instance it did not matter if it was IE or Chrome.  I was consistently getting duplicates on PayPal Payments only.

Cheers,

Alex
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: hotrod on June 24, 2014, 16:29:02 PM
As of Now.. it seems this has worked for me..

Ran an order in IE  9.0 which I was getting Duplicate orders from.. and it came thru fine.  I'll keep you guys posted on future orders.
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: tophatco on June 24, 2014, 16:55:40 PM
I am having the same issues with authorize.net, which also started about the same time as yours hotrod, and both of us are redirecting our sites from http://www.domain.com to http://domain.com.

I had been following your issue in the thread below.

http://forum.virtuemart.net/index.php?topic=123644.45

What is your domain alex2311?

I have authorize.net in test mode right now trying to recreate the issue, or see it happen myself.
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: tophatco on June 24, 2014, 18:01:08 PM
Quote from: tophatco on June 24, 2014, 16:55:40 PM
I have authorize.net in test mode right now trying to recreate the issue, or see it happen myself.

With authorize.net in test mode I was able to recreate the problem after 14 orders.  I was switching back and forth between Windows XP/Internet Explorer 8 and Windows 7/Internet Explorer 11 and the duplicate order occurred while I was testing using Windows 7/Internet Explorer 11.

I am going to try alex2311's modifications in test mode and see if it helps.
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: tophatco on June 24, 2014, 19:01:21 PM
Quote from: tophatco on June 24, 2014, 18:01:08 PM
I am going to try alex2311's modifications in test mode and see if it helps.

I still get double orders with alex2311's modifications.
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: Robert_ITMan on June 26, 2014, 16:23:34 PM
See my suggestions here: http://forum.virtuemart.net/index.php?topic=123644.msg425930#msg425930
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: slammy on June 30, 2014, 08:48:54 AM
Hi, we are on jml 2.5.22 and vm2.6.6 since 2 weeks now. We did have normal orders last two weeks. Yesterday, falling from nowhere, we get duplicated orders too (Standard Payment!). our order-frequency ist not as high like others here in the forum, so I will wait for the next orders to see what will happen! Can someone of u tell me if the duplication could be because the user hits "F5" for e.g or use the "browser go back" in the cart after finishing the order?

And because there is some discussion about ssl - a very tip from value for your SEO in my opinion: Don´t switch general ssl on a livesite for longer time if you are actual on http with https in sensitive areas and only want to do tests! You will loose your best-ranking URLs - because the same URL with http or https is interpreted as a different one by google! That means, that google will exchange your best ranking URLs with the new ones. I really know where I speak about and we suffering from it since more than 6 month, because we switched completely from http and https in cart and account to full complete https. Since we did that in November 2013, we lost lot´s of nice ranking URL´s and it took us some time to get again near. We haven´t reached old rankings until today!
regards jens
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: tophatco on July 02, 2014, 18:39:26 PM
Quote from: Robert_ITMan on June 26, 2014, 16:23:34 PM
See my suggestions here: http://forum.virtuemart.net/index.php?topic=123644.msg425930#msg425930

Just to follow up on my experiences since I last posted on this problem.

Hoping to rule out the SSL cert, I bought a different one from a different vendor. We also had a different domain name we wanted to move the entire site to as well.  So with the new SSL, which was not limited to just the domain.com without the www, I put the site back up at www.obxskeeterbeater.com

Since then.  We have started running radio ads and the orders have picked up some. Not only are double orders coming in with authorize.net, they are also coming in on Paypal orders as well. The double authorize.net orders will double charge if the authorize.net plugin is set to Authorize and Capture.  The Paypal orders will go into VM twice, with only one being Confirmed.  The second will be stuck as Pending.  It looks to me that both Paypal orders are going in to VM but only one is being charged with Paypal because the visitor is only visiting the Paypal system once to make a payment.  When both Authorize.net orders go in, both get charged because they are set to Authorize and Capture and does not require the user to go through the charge process for each order.

I have set authorize.net to just Authorize and not Authorize and Capture so visitors do not get charged twice... but I must log in and manually capture the funds in the authorize.net merchant interface, and void the second transaction instead of capturing it if a double order went in.

When authorize.net double orders do go in, the buyer does get two order confirmations, but only charged once with the manual capture.  I don't want to confuse buyers who are getting two order confirmations though.  The Paypal double orders only send the buyer one confirmation because the second is stuck a Pending, which I delete from VM all together.

I am going to try your modifications next Robert_ITMan to see if it fixes it... although I don't think this is a user double click error.  I was easily able to recreate the problems in IE11/Windows 7 myself with authorize.net in test mode, and I wasn't double clicking. It could be a browser issue though and your fix may somehow resolve it so I will give it a shot.

It still seems to be only 1 out of every 10 to 15 orders doing this.  I will follow back up once I attempt Robert_ITMan's changes.
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: oviliz on July 02, 2014, 23:40:17 PM
That's truly crazy...
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: hotrod on July 03, 2014, 02:12:04 AM
I have proven, they are only coming from IE any version other than the newest.
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: tophatco on July 05, 2014, 16:29:23 PM
Quote from: tophatco on July 02, 2014, 18:39:26 PM
It still seems to be only 1 out of every 10 to 15 orders doing this.  I will follow back up once I attempt Robert_ITMan's changes.

Well, after Robert_ITMan's changes I still get double orders.  When you get hit the Checkout button, it disappears, you get the spinning arrow and please wait message... everything seems ok... but the orders still randomly go in double.

It almost seems like 2 carts are being created somehow and when the checkout process takes place, both are being checked out, even though there is only 1 checkout process for the buyer.

Now I have the submitted authorize.net orders go to Pending instead of Confirmed, so buyers do not get duplicate order messages.  With every order that is placed I must first log into VM, change the order to Confirmed so the buyer gets a confirmed order email and Cancel any duplicate order that may have gone in.  Then I have to log into authorize.net and capture the order and void any duplicates.  This way the buyer does not see the issue with duplicate orders if one is placed, but it's way too much to manage.

This is the only site I accept payments on so I am kind of stuck on what to do now. It isn't actually my site, I just built it for a customer, but don't want the customer to have to deal with the double order issue. I can't just keep correcting double orders every day manually though. I either sign up for a support subscription with VM and hope they address the issue, or look for another solution. Do you all think VM would be willing to help if I signed up? Or are there any third party developers/VM experts who I can pay to look at it?
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: Milbo on July 06, 2014, 20:08:46 PM
Quote from: tophatco on July 05, 2014, 16:29:23 PM
. I either sign up for a support subscription with VM and hope they address the issue, or look for another solution. Do you all think VM would be willing to help if I signed up? Or are there any third party developers/VM experts who I can pay to look at it?

We are after this error and already added some fixes to prevent sending of the form twice. Of course if you sign up the subscription, you give this task an higher priority and of course we need someone to test it and this bug is very nasty, cause not everyone have it. If you pay a 3rd party developer, the solution is either not in the core and so you have to add the fix if you are updating, or the developer spends it and I have to add it, spend time with it and so on.
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: T.A. Garrison, LLC on July 14, 2014, 22:17:24 PM
It's nearly a month later and Alex2311 seems to have the only answer.

I was just informed by one of my client's just today that they are seeing duplicate orders. I only found 4 in the last 3 months, which tells me that there are very few people who hit the button twice. But the fact remains, they get charged twice and it's extra bookkeeping...and time.

This particular site uses Authorize.net and "not" PP.
I implemented the resolve Alex2311 posted and I'm hoping it works.

So, Milbo. What's the update?
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: oviliz on July 15, 2014, 00:10:00 AM
+1
Title: Re: Duplicate Orders when Checking Out with PayPal - VM 2.6.4
Post by: Milbo on July 15, 2014, 08:55:56 AM
It appears not only, because the people hit the button twice. And the fix to prevent that people hit the button twice is in there since vm2.6.2 at least. There is a js preventing that the button can be activated again.