简体   繁体   English

如何检查virtmart购物车是否空

[英]How to check virtuemart cart empty or not

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 请帮我

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.. 希望它的帮助..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM