如何通过单击nopcommerce中的删除按钮来删除购物车项目 [英] How do I remove shopping cart items by clicking remove button in nopcommerce
本文介绍了如何通过单击nopcommerce中的删除按钮来删除购物车项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在ProductBox.cshtml中的每个产品中添加一个删除按钮。通过单击该按钮,我希望将购物车项目减少1(针对特定产品)。请帮忙。
<前lang =CSS> < div class =remove-from-cart>
< input type =submitid =remove-from-cart-@Model.Idname =removefromcartvalue =@(删除)/>
< / div >
我在ProductBox.cxhtml页面中添加了这个。如何通过单击此删除购物车项目。
解决方案
对于nopCommerce 3.9
在OrderSummary.cshtml中修改从卡片div中移除
< 输入 类型 = 复选框 名称 = removefromcart value = @(item.Id) style = display:none / >
add< < span class =code-leadattribute> input type = 提交 名称 = updatecart value = X onclick = deleteItem(@(item.Id)) class = 温泉n> button-2 update-cart-button / >
添加脚本到文件结尾
< script type = 文本/ JavaScript的跨度>>
function deleteItem(id){
var ipt =
( [name = removefromcart] [value = + id.toString( )+ ]);
ipt.attr(' 选中',真跨度>);
}
< / script>
I need to add a remove button in every product in ProductBox.cshtml. By clicking that button I want to reduce shopping cart item by 1(for the specific product). Please help.
[Edit]
<div class="remove-from-cart">
<input type="submit" id="remove-from-cart-@Model.Id" name="removefromcart" value="@("Remove")" />
</div>
I have added this in ProductBox.cxhtml page. How could I delete shopping cart item by clicking this.
解决方案
For nopCommerce 3.9
In OrderSummary.cshtml modify remove from card div
<input type="checkbox" name="removefromcart" value="@(item.Id)" style="display:none" />
add<input type="submit" name="updatecart" value="X" onclick="deleteItem(@(item.Id))" class="button-2 update-cart-button" />
add script to end of the file
<script type="text/javascript"> function deleteItem(id) { var ipt =
("[name=removefromcart][value=" + id.toString() + "]"); ipt.attr('checked', true); } </script>
这篇关于如何通过单击nopcommerce中的删除按钮来删除购物车项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文