Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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]

CSS
<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.
Posted
Updated 8-Nov-18 22:55pm
v2
Comments
[no name] 17-Nov-14 4:59am    
What code have you written for this?? Please post the code.
If you need suggestions for implementation mention the same.
Thanks.
Jakaria shimul 18-Nov-14 1:40am    
<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.
coder771 30-Jan-15 7:30am    
hi, you can get the whole working code if you download nopcommerce with source code, and have a look in it.

1 solution

For nopCommerce 3.9
In OrderSummary.cshtml modify remove from card div
HTML
<input type="checkbox" name="removefromcart" value="@(item.Id)" style="display:none" />

add
HTML
<input type="submit" name="updatecart" value="X" onclick="deleteItem(@(item.Id))" class="button-2 update-cart-button" />


add script to end of the file

JavaScript
<script type="text/javascript">
           function deleteItem(id) {
               var ipt = $("[name=removefromcart][value=" + id.toString() + "]");
               ipt.attr('checked', true);
           }

       </script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900