是否可以像这样检查div类simplecart_items中是否有项?
if simplecart_items == 0 {
NO ITEMS IN THE CARD // Shows no add to card, no total coast and no products quantity
}
else {
The "normal" output // Shows add to card, total coasts and products
}有什么办法吗?
发布于 2013-07-05 14:49:54
您可以在simplecartjs脚本的V3中尝试这种方法。
if(simpleCart.items().length == 0)
{
//No items in the cart
}如果您想要检查购物车中已经存在的特定项目,请使用jQuery。
simpleCart.bind('beforeAdd', function (item) {
if (simpleCart.has(item))
{
alert("Already in the Cart");
return false;
}
});https://stackoverflow.com/questions/15116595
复制相似问题