Author Topic: VM forgets stored cart after logout/login  (Read 259 times)

sandomatyas

  • Jr. Member
  • **
  • Posts: 299
VM forgets stored cart after logout/login
« 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?

sandomatyas

  • Jr. Member
  • **
  • Posts: 299
Re: VM forgets stored cart after logout/login
« Reply #1 on: March 11, 2020, 17:00:34 pm »
I checked a bit and found getCart method in class VirtueMartCart
Code: [Select]
if(empty(JFactory::getUser()->guest) and !empty($sessionCart->_guest)){
self::$_cart->loadCart(self::$_cart);
self::$_cart->_guest = 0;
}
If I remove the second condition
Code: [Select]
and !empty($sessionCart->_guest) it works well.
Any guess?