veszka Posted January 4, 2011 Share Posted January 4, 2011 Hi all, I would like to add a new button to shopping_cart.php, which delete all products from my basket (shopping cart) with one click. I searched in the topics, but didn't find any solution for this feature. Can anybody help me? Kind regards, Tamas Quote Link to comment Share on other sites More sharing options...
veszka Posted January 6, 2011 Author Share Posted January 6, 2011 Amend /includes/application_top.php switch ($HTTP_GET_VARS['action']) { case 'clear_cart': $cart->remove_all(); tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); break; add a new button in shopping_cart.php with an action of "clear_cart" Thank you! Helpfull post. Here is the code of the new button: <span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_REMOVE_CART, 'trash', tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=clear_cart')); ?></span> Quote Link to comment Share on other sites More sharing options...
multimixer Posted January 6, 2011 Share Posted January 6, 2011 And here is a complete tutorial on how to do this Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
veszka Posted January 6, 2011 Author Share Posted January 6, 2011 And here is a complete tutorial on how to do this Great! Thank you! Quote Link to comment Share on other sites More sharing options...
veszka Posted January 29, 2011 Author Share Posted January 29, 2011 And here is a complete tutorial on how to do this I have one problem with this solution. If we use the function remove_all() in this case the items not delete from table customers_basket and if the customer login again, the content of basket will appear... I tried to replace the function to cleanup() , but it doesn't work. I'm waiting for the comments. Quote Link to comment Share on other sites More sharing options...
♥kymation Posted January 29, 2011 Share Posted January 29, 2011 If my memory is working correctly, you can call $cart->reset(true) to clear the cart and the database. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
veszka Posted January 30, 2011 Author Share Posted January 30, 2011 If my memory is working correctly, you can call $cart->reset(true) to clear the cart and the database. Regards Jim It's working. Thak you Jim! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.