I have fixed the issue. The site is working fine now.
It is a minor bug. The saved cart does not get loaded after log-in in the existing system if the user does not make changes to the cart session before that. For example, if the user first adds a product to the cart and then log-in to the site, it loads the saved cart. But if the user log-in to the site immediately after visiting the site, it will not load the saved cart. I could also reproduce this issue on my local development site.
I made the following change to fix it.
In file -
components/com_virtuemart/helpers/cart.phpOriginal codes between lines 222 to 225:
if(empty(JFactory::getUser()->guest) and !empty($sessionCart->_guest)){
self::$_cart->loadCart(self::$_cart);
self::$_cart->_guest = 0;
}
$sessionCart->_guest property does not exist until some changes are made to the cart session. So I replaced the above code with the following -
if (!property_exists(self::$_cart, '_guest')) {
self::$_cart->_guest = true;
}
if (empty(JFactory::getUser()->guest) and !empty(self::$_cart->_guest)) {
self::$_cart->loadCart(self::$_cart);
self::$_cart->_guest = false;
}
That's it.
