javascript - Prestshop Create Discount for total items into shopping cart -
i shopping-cart.tpl discount rules.
but have 2 problems: 1.- when use buttom +/- value don't change. 2.- change happen if refresh page. how can that, without refresh page?, if other field how total products ($productnumber) , price change automatically. code tfoot>
<tfoot> {assign var='totalqty' value=0} {assign var='totalreductonpercent' value=0} {assign var='totalreductonvalue' value=0} {assign var='totalweight' value=0} <!-- value variables assignation --> {foreach $products $product} {assign var='totalreductonvalue' value=$totalreductonvalue + $product.price_without_specific_price} {assign var='totalqty' value=$totalqty + $product.quantity} {/foreach} <!-- discount rules according qty --> {if $productnumber>=16} {assign var='totalreductonpercent' value=20} {else} {if $productnumber>=11} {assign var='totalreductonpercent' value=15} {else} {if $productnumber>=6} {assign var='totalreductonpercent' value=10} {else} {if $productnumber>=3} {assign var='totalreductonpercent' value=5} {/if} {/if} {/if} {/if} <!-- total discount --> <tr class="cart_total_discount"> <td colspan="3" class="text-right"> {l s='total discount ('} <span class="footer-counter"> <span id="summary_products_quantity">{$productnumber} {if $productnumber == 1} {l s=') carton: '} {else} {l s=') cartons: '} {/if} </span> </span> </td> <td colspan="2" class="price" id="total_discount"> {assign var='totalreductonvalue' value=$total_products * ($totalreductonpercent/100)} {convertprice price=$totalreductonvalue}<br> <span class="price-percent-reduction small"> {($totalreductonpercent)|round|string_format:"%d"}% </span> </td> </tr>
i if need pass code php function or javascript function discount rules refresh automatically.
best regards
Comments
Post a Comment