In this article i am going to explain how we can show our valued customers/visitors how much they have saved by purchasing items/products at a discounted price.
I will also show how to calculate and output total customer's savings i.e. discount on the shopping cart page.
Firstly we need to alter the template "shopping-cart.tpl" under your current theme directory.
Following code will calculate the total savings- discount in the shopping cart.
We need to use following code to display discount on shopping cart page.
I will also show how to calculate and output total customer's savings i.e. discount on the shopping cart page.
Firstly we need to alter the template "shopping-cart.tpl" under your current theme directory.
Following code will calculate the total savings- discount in the shopping cart.
{assign var='totalReductonPercent' value=0}
{assign var='totalReductonValue' value=0}
{foreach $products as $product}
{assign var='totalReductonValue' value=$totalReductonValue + $product.price_without_specific_price * $product.quantity}
{/foreach}
{assign var='totalReductonPercent' value=(($totalReductonValue - $total_products) / $totalReductonValue) * 100}
We need to use following code to display discount on shopping cart page.
<tr class="cart_total_discount">
<td colspan="{$col_span_subtotal}" class="text-right">{l s='Total discount'}</td>
<td colspan="2" class="price" id="total_discount">
{convertPrice price=$totalReductonValue - $total_products}<br>
<span class="price-percent-reduction small">{($totalReductonPercent)|round|string_format:"%d"}%</span><br>
</td>
</tr>





