VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: fabioweb on October 17, 2016, 10:05:01 AM

Title: Empty Cart
Post by: fabioweb on October 17, 2016, 10:05:01 AM
Hello!
if i go to cart without product what's the best way to add a message: Your cart is empty?
http://seratadigala.tioitalia.it/it/il-mio-carrello

Thank you
Title: Re: Empty Cart
Post by: GJC Web Design on October 17, 2016, 10:12:48 AM
in the cart default template do a if and else

detect if the cart has  products .. if so display the template..  if not show the message
Title: Re: Empty Cart
Post by: fabioweb on October 17, 2016, 10:32:42 AM
Oky i can't see anything so i've add this code:
it works correctly in my 3.0.18 version and i hope also for future updates

$cart = VirtueMartCart::getCart();
if(sizeof($cart->products) > 0){
echo 'Cart have products';
}
else{
echo 'Your cart is empty';
}


Thank you :)