Daniel Ciornei Posted August 2, 2010 Share Posted August 2, 2010 hi, can someone tell me if you know how to make this?I basically want a "empty cart" button in the shopping cart detailed page that can empty the whole cart. thank you Link to comment Share on other sites More sharing options...
rocky Posted August 3, 2010 Share Posted August 3, 2010 Try changing line 36 (in PrestaShop v1.3.1) of cart.php in the root directory of PrestaShop from: if ($add OR Tools::getIsset('update') OR $delete) to: if (Tools::getIsset('empty')) $cart->delete(); elseif ($add OR Tools::getIsset('update') OR $delete) Then add a link in shopping-cart.tpl like the following: <a href="{$base_dir_ssl}cart.php?empty&token={$token_cart}">{l s='Empty Cart'} I haven't tested it, but it should work. Link to comment Share on other sites More sharing options...
Daniel Ciornei Posted August 3, 2010 Author Share Posted August 3, 2010 Thank you, it works perfectly. Link to comment Share on other sites More sharing options...
jillies Posted September 3, 2011 Share Posted September 3, 2011 Hey Rocky, Any idea how we can replicate this on Prestashop version 1.4.4.1? I tried the exact same thing above (except that instead of cart.php, I edited controllers > cartControllers.php on Line 102), but when I added the <a> tag, clicking it brought me to an empty page. Thanks in advance! Link to comment Share on other sites More sharing options...
fifidj Posted December 11, 2011 Share Posted December 11, 2011 A problem for me with 1.3.1 with matrice theme. It work but when I add a voucher it delete the cart too. Any idea ? Link to comment Share on other sites More sharing options...
aminekaddioui Posted January 24, 2013 Share Posted January 24, 2013 Can we please have the solution to this in prestashop 1.5x? Thanks Link to comment Share on other sites More sharing options...
rferrero Posted March 20, 2013 Share Posted March 20, 2013 In shopping-cart.tpl line 82 <th class="cart_delete last_item"><a href="{$link->getPageLink('cart', true, NULL, "emptyCart=1&token={$token_cart}")}" title="{l s='Delete'}">{l s='Eliminar todo'}</a></th> In CartController.php //line 67 if (Tools::getIsset('add') || Tools::getIsset('update')) { $this->processChangeProductInCart(); } else if (Tools::getIsset('emptyCart')) { $this->emptyCart(); } //final .php protected function emptyCart() { $result = array(); $result['summary'] = $this->context->cart->getSummaryDetails(null, true); foreach ($result['summary']['products'] as $key => &$product) { $this->processDeleteProduct($product['id_product'],$product['id_product_attribute'],$product['customization_id'],$product['id_address_delivery']); } } protected function processDeleteProduct($idProd, $idAttrib, $custom_id, $id_address) { if ($this->context->cart->deleteProduct($idProd, $idAttrib, $custom_id, $id_address)) { if (!Cart::getNbProducts((int)($this->context->cart->id))) { $this->context->cart->setDeliveryOption(null); $this->context->cart->gift = 0; $this->context->cart->gift_message = ''; $this->context->cart->update(); } } $removed = CartRule::autoAddToCart(); if (count($removed) && (int)Tools::getValue('allow_refresh')) $this->ajax_refresh = true; } Link to comment Share on other sites More sharing options...
samukacpz Posted June 21, 2013 Share Posted June 21, 2013 and for version 1.4 ? Link to comment Share on other sites More sharing options...
sooroos Posted August 29, 2013 Share Posted August 29, 2013 hi, does anyone know a solution for empty cart button in block cart? Link to comment Share on other sites More sharing options...
zpages Posted March 29, 2014 Share Posted March 29, 2014 and for version 1.4 ? Bump! :-) Is this possible for 1.4? Or please can someone post the solution? Link to comment Share on other sites More sharing options...
pablosteil Posted June 18, 2015 Share Posted June 18, 2015 anyone have the solution to this in prestashop 1.6x? tnks Link to comment Share on other sites More sharing options...
dprovost1990 Posted July 28, 2015 Share Posted July 28, 2015 (edited) Directions for 1.6: https://www.prestashop.com/forums/topic/457653-empty-cart-in-one-click-prestashop-161-delete-all-products-from-cart/ Edited July 28, 2015 by dprovost1990 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now