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?
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
Okay sorry, missed that...
I'm using VM3.0.17.4 with the 'standard' payment plugin on Joomla 3.6.2
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... :(
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...
hmmm.. on any other payment method I check the check is
if(!$this->selectedThisElement($this->_currentMethod->payment_element)) {
return FALSE;
}
have informed Milbo
if the so, he need to change it in the whole function
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!
Doesn´t this also execute the standard payment when only other payments should be triggered ?
regards
Jörgen @ Kreativ Fotografi
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
Well it is...
How can it be this check fails (or succeeds, depending on how you look at it)?
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