Author Topic: Cart not emptied after checkout  (Read 959 times)

The Yellow Fellow

  • Beginner
  • *
  • Posts: 25
Cart not emptied after checkout
« on: August 08, 2016, 17:02:14 pm »
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

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8890
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: Cart not emptied after checkout
« Reply #1 on: August 08, 2016, 21:46:28 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

The Yellow Fellow

  • Beginner
  • *
  • Posts: 25
Re: Cart not emptied after checkout
« Reply #2 on: August 09, 2016, 13:27:29 pm »
Okay sorry, missed that...

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

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8890
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: Cart not emptied after checkout
« Reply #3 on: August 09, 2016, 13:33:09 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

The Yellow Fellow

  • Beginner
  • *
  • Posts: 25
Re: Cart not emptied after checkout
« Reply #4 on: August 09, 2016, 15:11:33 pm »
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:

Code: [Select]
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

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8890
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: Cart not emptied after checkout
« Reply #5 on: August 09, 2016, 17:08:22 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9853
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Cart not emptied after checkout
« Reply #6 on: August 09, 2016, 21:32:31 pm »
if the so, he need to change it in the whole function
I should 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

  • Beginner
  • *
  • Posts: 25
Re: Cart not emptied after checkout
« Reply #7 on: August 11, 2016, 08:25:15 am »
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

  • Global Moderator
  • Full Member
  • *
  • Posts: 2234
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Cart not emptied after checkout
« Reply #8 on: August 11, 2016, 08:31:17 am »
Doesn´t this also execute the standard payment when only other payments should be triggered ?

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8890
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: Cart not emptied after checkout
« Reply #9 on: August 11, 2016, 14:06:58 pm »
Quote
Doesn´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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

The Yellow Fellow

  • Beginner
  • *
  • Posts: 25
Re: Cart not emptied after checkout
« Reply #10 on: August 11, 2016, 14:28:39 pm »
Well it is...
How can it be this check fails (or succeeds, depending on how you look at it)?

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2234
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Cart not emptied after checkout
« Reply #11 on: August 11, 2016, 14:36:34 pm »
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.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)