Page 1 of 1

Remove product in one click without Confirm?

Posted: Thu Mar 17, 2011 9:46 am
by Buildanewcomputer
Hello,

I was looking into removing this Confirm? message when a product is being removed from the cart. I modified the code to now remove the product on click. if you interested i have posted directions below.


1. find your cart.tpl file in your template directory exp: catalog\view\theme\default\template\module

2. remove the following code in bold and leave no spaces.

Before:

$(document).ready(function () {
$('.cart_remove').live('click', function () {
if (!confirm('<?php echo $text_confirm; ?>')) {
return false;
}

$(this).removeClass('cart_remove').addClass('cart_remove_loading');
$.ajax({
type: 'post',
url: 'index.php?route=module/cart/callback',
dataType: 'html',
data: 'remove=' + this.id,
success: function (html) {
$('#module_cart .middle').html(html);
if (getUrlParam('route').indexOf('checkout') != -1) {
window.location.reload();


After:

$(document).ready(function () {
$('.cart_remove').live('click', function () {
$(this).removeClass('cart_remove').addClass('cart_remove_loading');
$.ajax({
type: 'post',
url: 'index.php?route=module/cart/callback',
dataType: 'html',
data: 'remove=' + this.id,
success: function (html) {
$('#module_cart .middle').html(html);
if (getUrlParam('route').indexOf('checkout') != -1) {
window.location.reload();


Hope this helps :)

Re: Remove product in one click without Confirm?

Posted: Sat Mar 19, 2011 1:11 am
by RJonesUSC
Thanks, that will be useful.