问题描述
我按照此处发布的答案添加了从购物车中删除产品时的确认对话框: confirmation message before deleting an item from cart
现在我正在尝试做类似的事情,在使用 touchspin 将购物车上的产品数量从 1 减少到 0 时显示相同的确认消息,如果确认,则应将产品从购物车中移除。
function refreshDataLinkAction() {
$('[data-link-action="delete-from-cart"]').each(function(){
$(this).attr('data-link-action','confirm-remove-item');
});
}
$(document).on('click','[data-link-action="confirm-remove-item"]',function(e) {
e.preventDefault();
if (confirm('Are you sure you want to remove product from cart?')) {
$(this).attr('data-link-action','delete-from-cart');
$(this).trigger('click');
}
return false;
});
$(document).ready(function () {
refreshDataLinkAction();
prestashop.on('updatedCart',function (event) {
refreshDataLinkAction();
});
});
知道如何做到这一点吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)