Contributions

Features (Category Index)
Search: 

Automatic remove button in shopping cart

This contribution will make the remove checkbox in the shopping cart automatically update and remove the item when customer clicks the checkbox (no need for them to click "update")

1 ) Add this between the <head></head> tags in shopping_cart.php (around line 25)

--------------------------------------
<script type="text/javascript" language="JavaScript"><!--
function DoSubmission() {
document.cart_quantity.submit();
}
//--></script>
----------------------------------------

2 ) Search for:

----------------------------------------
'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

----------------------------------------

Change to:

----------------------------------------

'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'], ' ', 'onClick="DoSubmission();"'));
----------------------------------------

3 ) in file includes/functions/html_output.php search for: (around line 189)

----------------------------------------

if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {
$selection .= ' CHECKED';
------------------------------------------

Change to:
-----------------------------------------

if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {
$selection .= '';
-----------------------------------------

and thats it, enjoy

Expand All / Collapse All

give option to confirm removal 13 Nov 2010

'text' => 'Remove?<br>' . tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'],'', 'onclick="var answer= confirm('Remove Product?'); if(answer){document.cart_quantity.submit();}else{ return false;};"',false));//auto update cart

change in shopping cart est (line 189)

one simple step, minor addition 18 Apr 2006
Update ur quantities with javascript 25 Feb 2006
Just one simple step to to it. 23 Feb 2006
Automatic Remove Button In Shopping Cart 23 Feb 2006
Automatic remove button in shopping cart v2 14 Feb 2006
Automatic remove button in shopping cart v2 13 Feb 2006
Automatic remove button in shopping cart v2 13 Feb 2006
the same is good when changing quantity 31 Jan 2006
Updated 7 Jul 2005
Automatic remove button in shopping cart 6 Jul 2005

Note: Contributions are used at own risk.