vansrv7 Posted April 20, 2014 Share Posted April 20, 2014 I have a problem using a voucher to give a free products (PS 1.5.6.1 with custom theme). I set up a cart rule to give a product for free if the cart contains certain product. The problem is that in the cart if I click on the cart rule name (on the side of voucher field) it puts in the field the cart rule name instead than the voucher code, so it returns an error "this voucher does not exists". If I use as cart rule name the generated voucher (ie. NXIFRD), it works correctly. Any help? Link to comment Share on other sites More sharing options...
obewanz Posted February 25, 2016 Share Posted February 25, 2016 Almost a year later and I have the same problem with NO SOLUTION being posted here... Link to comment Share on other sites More sharing options...
obewanz Posted February 25, 2016 Share Posted February 25, 2016 I found the fix for this in Prestashop 1.6.0.9 - Sooo, I am adding this as another post in the hope that you get notified. Go to your themes directory and find the file shopping-cart.tpl (should be /themes/theme_name/shopping-cart.tpl) and search for the string val('{$voucher.name}') it is line 256 in my theme, but could be something different in yours. Following is the whole section of code dealing with this voucher issue: <form action="{if $opc}{$link->getPageLink('order-opc.php', true)}{else}{$link->getPageLink('order.php', true)}{/if}" method="post" id="voucher"> <fieldset class="bordercolor"> <h2>{l s='Vouchers'}</h2> <p class="text"> <label for="discount_name">{l s='Code:'}</label> <input type="text" id="discount_name" name="discount_name" value="{if isset($discount_name) && $discount_name}{$discount_name}{/if}" /> </p> <p class="submit"><input type="hidden" name="submitDiscount" /><input type="submit" name="submitAddDiscount" value="{l s='Add'}" class="button" /></p> {if $displayVouchers} <div class="clearblock"></div> <div id="display_cart_vouchers"> <h4>{l s='Take advantage of our offers:'}</h4> {foreach from=$displayVouchers item=voucher} <div><span onclick="$('#discount_name').val('{$voucher.name}');return false;" class="voucher_name">{$voucher.name}</span> — {$voucher.description}</div> {/foreach} </div> {/if} </fieldset> </form> The line where the error exists is as follows: <div><span onclick="$('#discount_name').val('{$voucher.name}');return false;" class="voucher_name">{$voucher.name}</span> — {$voucher.description}</div> Change it to match this and it should fix your problem: <div><span onclick="$('#discount_name').val('{$voucher.code}');return false;" class="voucher_name">{$voucher.name}</span> — {$voucher.description}</div> The variable $voucher.name in the first reference should be changed to $voucher.code That should fix the checkout page putting the title/name of the voucher in the box instead of the voucher code - which is what causes the error. Link to comment Share on other sites More sharing options...
Recommended Posts