profoon Posted November 26, 2015 Share Posted November 26, 2015 (edited) I SOLVED it myself. Works fairly well, is not perfect, but does the job. In this way I have done it : Look in your theme folder and open ” shopping-cart-product-line.tpl ” look for: {if (!isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0) && empty($product.gift)} and replace it with: {if (!isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0)}{* && empty($product.gift) *} -------------------------------------------------------------------------- In cart rules, I created different rules (actions> send a free gift) to give a free gift from a certain purchase amount, as a gift at 50 euro, or another gift at 100 euros etc .... The customer can then choose a gift from the list under the vouchers block. Now it would be useful if there is a delete button ( like a normal product ) present if the customer selected a wrong gift to remove it in order to select another gift. I've already looked at the file shopping-cart.tlp but did not immediately find something to fix it. Does anyone have any experience with coding, believed to be a few lines in which tpl file is modified. Best regards, Profoon ps: I use version 1.6.1.1 prestashop Edited November 29, 2015 by profoon (see edit history) Link to comment Share on other sites More sharing options...
Key2014 Posted January 11, 2016 Share Posted January 11, 2016 Hello Your solution is not working for me, The trash icon is displayed but there is no visible action on it and the gift is not removed Is anyone got a solution ? Version : 1.6.1.3 Link to comment Share on other sites More sharing options...
Key2014 Posted January 13, 2016 Share Posted January 13, 2016 UP How can we remove a free gift added on cart to choose another one ? Thanks Link to comment Share on other sites More sharing options...
Deasy-Oak Posted April 19, 2016 Share Posted April 19, 2016 (edited) UP please, Is not working like this, The issue is in the forge : http://forge.prestashop.com/browse/PSCFV-10647 we need to put something maybe after {else} ?? <td class="cart_delete text-center" data-title="{l s='Delete'}"> {if (!isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0) && empty($product.gift)} <div> <a rel="nofollow" title="{l s='Delete'}" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "delete=1&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_address_delivery={$product.id_address_delivery|intval}&token={$token_cart}")|escape:'html':'UTF-8'}"><i class="icon-trash"></i></a> </div> {else} {/if} </td> Edited April 19, 2016 by Deasy-Oak (see edit history) Link to comment Share on other sites More sharing options...
imballo Posted June 29, 2017 Share Posted June 29, 2017 Solution (prestashop 1.6.1.10): In Cart.php modify CartCore::getSummaryDetails by adding this line $gift_product['id_cart_rule_gift']= $cart_rule['id_cart_rule']; after $gift_product = $product; $gift_product['cart_quantity'] = 1; $gift_product['price'] = 0; $gift_product['price_wt'] = 0; $gift_product['total_wt'] = 0; $gift_product['total'] = 0; $gift_product['gift'] = true; In shopping-cart.tpl add this line: {assign var='id_cart_rule_gift' value=$product.id_cart_rule_gift} inside this foreach command: {foreach $gift_products as $product} {assign var='productId' value=$product.id_product} {assign var='productAttributeId' value=$product.id_product_attribute} ... {include file="$tpl_dir./shopping-cart-product-line.tpl" productLast=$product@last productFirst=$product@first} {/foreach} In shopping-cart-product-line.tpl add: {if !empty($product.gift)} {if strlen($product.id_cart_rule_gift)} <a href="{if $opc}{$link->getPageLink('order-opc', true)}{else}{$link->getPageLink('order', true)}{/if}?deleteDiscount={$product.id_cart_rule_gift}" class="price_discount_delete" title="{l s='Delete'}"> <i class="icon-trash"></i> </a> {/if} {/if} inside the else part of this conditional command: {if !isset($noDeleteButton) || !$noDeleteButton} <td class="cart_delete text-center" data-title="{l s='Delete'}" ... {if (!isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0) && empty($product.gift)} <div> ... </div> {else} ********************* add here ****************************** {/if} </td> {/if} 1 Link to comment Share on other sites More sharing options...
Recommended Posts