Question

i have one question that check the virtue-mart cart, if cart is empty then page redirected to the my link such as contact page,article.

for example customer click the "order now" button but cart is empty then redirect to contact page

please help me

Was it helpful?

Solution

Try this,

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

for redirections you can use follows

$mainframe = JFactory::getApplication();
$mainframe->redirect('url','message','message type');//message type is message,warning,error etc

Hope its helps..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top