VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: sandomatyas on March 11, 2020, 16:45:23 PM

Title: VM forgets stored cart after logout/login
Post by: sandomatyas on March 11, 2020, 16:45:23 PM
There is a site with Joomla 3.9.14, VirtueMart 3.6.10 10211, PHP 7.4
I log in with a simple registered username, add something to the cart. I can see this item in #__virtuemart_carts.cartData in cartProductsData array. I log out, the product is still in the cart. I log in again and my cart is empty and the cartProductsData array is also empty
How should I debug/solve this?
Title: Re: VM forgets stored cart after logout/login
Post by: sandomatyas on March 11, 2020, 17:00:34 PM
I checked a bit and found getCart method in class VirtueMartCart
if(empty(JFactory::getUser()->guest) and !empty($sessionCart->_guest)){
self::$_cart->loadCart(self::$_cart);
self::$_cart->_guest = 0;
}

If I remove the second condition and !empty($sessionCart->_guest) it works well.
Any guess?