News:

Looking for documentation? Take a look on our wiki

Main Menu

Cart not emptied after checkout

Started by The Yellow Fellow, August 08, 2016, 17:02:14 PM

Previous topic - Next topic

The Yellow Fellow

When customers place an order, their cart is not emptied after checkout. The next time they add an item to the cart, the items from the last order are still in there. How can I fix that?

GJC Web Design

First by providing information!

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

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

the cart is emptied by the payment plugin.. so check what ever one your using
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

The Yellow Fellow

Okay sorry, missed that...

I'm using VM3.0.17.4 with the 'standard' payment plugin on Joomla 3.6.2

GJC Web Design

standard payment plug hasn't changed for ages
the code is there in plugins\vmpayment\standard\standard.php to empty the cart

$modelOrder->updateStatusForOneOrder ($order['details']['BT']->virtuemart_order_id, $order, TRUE);

      //We delete the old stuff
      $cart->emptyCart ();
      vRequest::setVar ('html', $html);
      return TRUE;
   }

Works on all my installs so have no further ideas...  :(
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

The Yellow Fellow

I figured out that inside the function in standard.php that holds the code you just mentioned, there's an if-statement that is true so it returns FALSE:


if (!$this->selectedThisElement ($method->payment_element)) {
    return FALSE;
}


This gets fired so the code doesn't even reach the $cart->emptyCart (); part...

GJC Web Design

hmmm.. on any other payment method I check the check is

if(!$this->selectedThisElement($this->_currentMethod->payment_element)) {
         return FALSE;
      }

have informed Milbo
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milbo

if the so, he need to change it in the whole function
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

The Yellow Fellow

GJC's suggestion unfortunately didn't do the trick.
I commented out the part:

/*
if (!$this->selectedThisElement ($method->payment_element)) {
   return FALSE;
}
*/

from the plgVmConfirmedOrder function (just to see if it works) and now it works just fine!

Jörgen

Doesn´t this also execute the standard payment when only other payments should be triggered ?

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

GJC Web Design

QuoteDoesn´t this also execute the standard payment when only other payments should be triggered ?

agree.. the check is to test if this is the payment plugin we need
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

The Yellow Fellow

Well it is...
How can it be this check fails (or succeeds, depending on how you look at it)?

Jörgen

If th funktion return FALSE it exits without messing with data that not belongs to this plugin :)

Otherwise it is the chosen payment method and OK to compute.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.