News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Duplicate Orders when Checking Out with PayPal - VM 2.6.4

Started by alex2311, May 25, 2014, 07:59:57 AM

Previous topic - Next topic

alex2311

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 but it has already been included.

Any guidance in addressing this issue will be greatly appreciated.

Cheers,

Alex

alex2311

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

alex2311

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

Milbo

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?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

alex2311

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

multigeo

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:

  • cart is filled
  • call cart view from menu
  • $this->checkout_task = 'checkout' + checkout button at bottom does not show 'Confirm'
  • user is not logged in, so do login
  • Press checkout button to proceed to next step
  •   $this->checkout_task = 'confirm' + checkout button at bottom does show 'Confirm'
  • Order is confirmed on screen
  • 2 sets of order mails (to buyer + to shop) are mailed
  • backend shows the 2 new orders, both identical, exept for order_number + order_id

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]

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hotrod

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 
Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

stensbo

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.

alex2311

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:

  • MAKE A BACKUP OF THE CART.PHP FILE!!!!!!!
  • In the cart.php file locate the function "public function add($virtuemart_product_ids=null,&$errorMsg='') "
  • After the line "$post = JRequest::get('default');" add the following line....    "$_SESSION['CartBeenProcessed']=0;"   This will set the 'CartBeenProcessed' to 0 every time an item is added to the cart.
  • Find the function "function confirmedOrder() {".  This is the function creates the orders..
  • Modify the code to include the "$_SESSION['CartBeenProcessed']" as seen below:

                    //Just to prevent direct call:
          if ($this->_dataValidated && $this->_confirmDone && $_SESSION['CartBeenProcessed']==0) {
             $_SESSION['CartBeenProcessed']=1;
             $orderModel = VmModel::getModel('orders');

    The If statement will now check in addition to see if the Cart has been put through this process before.  If it hasn't (is set to "0") the code will run.  The first thing it will do is change the flag "1" so it knows that it has been action so it won't be able to confirm the order more than one.

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

hotrod

Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

Milbo

Then it should be also enough to write

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

because we have such a variable _inCheckOut
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

alex2311

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

hotrod

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..
Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

alex2311

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