vive Posted January 19, 2013 Share Posted January 19, 2013 Hola! ¿Habría alguna forma de insertar un botón para vaciar el carrito por completo, tubiera uno o varios artículos? La idea es que si posteriormente a pulsar ese botón se añade algo al carrito, sea ya otro identificador diferente de carrito. Muchas gracias. Link to comment Share on other sites More sharing options...
Sergio Ruiz Posted January 19, 2013 Share Posted January 19, 2013 Mira esto: http://www.prestashop.com/forums/topic/64829-solved-one-click-empty-cart/ Link to comment Share on other sites More sharing options...
vive Posted January 19, 2013 Author Share Posted January 19, 2013 Gracias por la respuesta Rubalcaba. Actualmente uso la versión 1.4.6.2 y el fichero cart.php del directorio raiz no contiene lo que diche rocky Link to comment Share on other sites More sharing options...
vive Posted January 31, 2013 Author Share Posted January 31, 2013 ¿Alguna opción para que el cliente pueda eliminar su carrito actual y que lo que empiece a añadir Prestashop lo interprete como otro carrito diferente? Link to comment Share on other sites More sharing options...
rferrero Posted March 20, 2013 Share Posted March 20, 2013 en el 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> en la clase 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...
Sergio Ruiz Posted March 20, 2013 Share Posted March 20, 2013 en el 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> en la clase 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; } ¿Seguro? Link to comment Share on other sites More sharing options...
ciricmetal Posted April 17, 2013 Share Posted April 17, 2013 Buenas tardes, Este código dónde se pone exactamente? //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; } Sabéis si funciona en las versiones 1.4.x? Muchas gracias compañeros. Link to comment Share on other sites More sharing options...
Feliz Garcia Posted April 17, 2013 Share Posted April 17, 2013 en el 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> en la clase 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; } Gracias, me ha funcionado. Link to comment Share on other sites More sharing options...
ciricmetal Posted April 18, 2013 Share Posted April 18, 2013 Gracias, me ha funcionado. Hola Feliz, Donde has puesto el código PHP? Gracias Link to comment Share on other sites More sharing options...
Recommended Posts