jono10 wrote:I'm hoping to add a 'remove' button to each row of the shopping cart page to make it easier for the user to edit their cart. I've tried the solution provided in this post - https://www.nopcommerce.com/boards/t/28190/change-checkbox-for-remove-button-in-cart-page-nopcommerce-ver-320.aspx - and it says to add the following to the cart page:
<input type="submit" name="removefromcart-@(item.Id)" value="@T("ShoppingCart.Remove")" />
...but it doesn't seem to work for V3.40. Does anybody know how to implement this in V3.40?
Hi,
I implemented another way for this issue.
Please have a look my solution:
1) Copy and paste the "OrderSummary.cshtml" file to the "Themes/DefaultClean/Views/ShoppingCart" folder
2) Open this copied file, and then find following block of code
<td class="remove-from-cart">
<span class="td-title">@T("ShoppingCart.Remove"):</span>
<input type="checkbox" name="removefromcart" value="@(item.Id)" />
</td>
replace with following code
<td class="remove-from-cart">
<span class="td-title">@T("ShoppingCart.Remove"):</span>
<input type="checkbox" id="[email protected]" name="removefromcart" value="@(item.Id)" />
<span data-checkbox-id="[email protected]" class="remove-from-cart-item-action ico ico-delete"></span>
</td>
3) And then, add following javascript block at the bottom of this file
<script type="text/javascript">
$(document).ready(function () {
var container = '.order-summary-content';
$('.remove-from-cart span.remove-from-cart-item-action', container).on('click', function () {
$('#' + $(this).data('checkbox-id'), container).prop('checked', true);
$('.update-cart-button', container).click();
});
});
</script>
4) Finally, add following line of codes to the "styles.css" file (inside the "Themes/DefaultClean/Content" folder)
/* Custom remove icon button for each item in the shopping-cart */
.order-summary-content .remove-from-cart > input[type='checkbox'] {
display: none;
}
.order-summary-content .ico {
display: inline-block;
height: 16px;
width: 16px;
}
.order-summary-content .remove-from-cart > .ico-delete {
background: url(images/ico-delete.gif) center center no-repeat;
}
Hope this help :)