1

I do this into shopping-cart.tpl Discount Rules.

But I have 2 problems: 1.- when I use the buttom +/- this value don't change. 2.- This change happen only if I refresh the page. How can I do that, without refresh the page?, if the other field how Total products ($productNumber) and price change automatically. All my code is into tfoot>

<tfoot>
{assign var='totalQty' value=0}
{assign var='totalReductonPercent' value=0}
{assign var='totalReductonValue' value=0}
{assign var='totalWeight' value=0}

<!-- VALUE A VARIABLES ASSIGNATION -->
{foreach $products as $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 for ('}
<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 would like your help if i need pass all this code to a PHP function or Javascript Function for this Discount rules refresh automatically.

Best regards

  • You added your cart rules with php code? and to update values you have to edit the function upQuantity in cart-summary.js with the returned json in javascript from the CartController function processChangeProductInCart You have to add cartRules when adding products to cart. – tarek fellah Mar 29 '17 at 12:01
  • @tarekfellah thanks for your reply, I thinked that and I try do it, but I am not a php programmer. If you know about that could you send me a simple example and i try to do this again – Adolfo Richani Apr 10 '17 at 14:54

0 Answers0