Auto remove items from cart

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
I already use nopcommerce since version 1.6 and since that time I have never liked much of customer method to remove items from the shopping cart.

So I have modified the scripts for customers to click on a picture, for example one cross, and at once this article is out of the shopping cart.

In the news versions 2.xx is very simple to add this "feature", skiping the process of rebuild.

I give you a small example, which can then be adapted to your needs:

Open OrderSummary.cshtml and insert at the top, before the fisrt div:

              <script type="text/javascript" language="JavaScript">
                function triggerupdatecart(id) {
                  if (document.getElementById(id).checked) {
                    $('#updatecart').trigger("click");
                  }
                }
              </script>

Then replace:
<input id="removefromcart" type="checkbox" name="removefromcart" value="@(item.Id)" />

with:
<input onclick="triggerupdatecart('removefromcart@(item.Id)');" id="removefromcart@(item.Id)" type="checkbox" name="removefromcart" value="@(item.Id)" />

You can also use this system to update the quantities, with the "onchange" (instead of onclick) on the textarea's for quantities.

if you want hide the updatebuttom you can use the css class "updatecartbutton"

Try it
12 years ago
similar discussed here
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.