tim_o_boy Posted November 16, 2005 Posted November 16, 2005 The shopping cart page has a checkbox next to each product that can be checked and then the re-calculate button is hit to remove that product. I'm looking for a way to display a "Remove" link (or button) instead of the checkbox that starts off the re-calculate. I've come across a few ways to do this using javascript but I'd rather not rely on the user having javascript enabled in their browser. Any help greatly appreciated.
GHWEB Informatique Posted November 16, 2005 Posted November 16, 2005 The shopping cart page has a checkbox next to each product that can be checked and then the re-calculate button is hit to remove that product. I'm looking for a way to display a "Remove" link (or button) instead of the checkbox that starts off the re-calculate. I've come across a few ways to do this using javascript but I'd rather not rely on the user having javascript enabled in their browser. Any help greatly appreciated. Hi! Edit catalog/includes/application_top.php near switch ($HTTP_GET_VARS['action']) { Add: case delete_product_from_cart' : if(isset($HTTP_GET_VARS['pid'])) { $cart->remove($HTTP_GET_VARS['pid']); } tep_redirect(tep_href_link(FILENAME_SHOPPING_CART); break; And replace catalog/shopping_cart.php near $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'])); By this code: $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'action=delete_product_from_cart&pid=' . $products[$i]['id']) . '">' . tep_image_button('button_delete.gif', IMAGE_BUTTON_DELETE) . '</a>'); That's it! Kind Regards Ga?tan Hermann
tim_o_boy Posted November 16, 2005 Author Posted November 16, 2005 Thanks Ga?tan - it works perfectly and is in fact a very simple way to do it. Just a note to anyone else using this method, there were a couple of typos in Ga?tan's code: This: case delete_product_from_cart' : if(isset($HTTP_GET_VARS['pid'])) { $cart->remove($HTTP_GET_VARS['pid']); } tep_redirect(tep_href_link(FILENAME_SHOPPING_CART); break; Should read: case 'delete_product_from_cart' : if(isset($HTTP_GET_VARS['pid'])){ $cart->remove($HTTP_GET_VARS['pid']); } tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); break; An apostrophe and a bracket missing.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.