Simple php calculation in tpl, is it possile?

Beacuse of poor TAX calculation cheme in cs-cart, I am modifying template to suite my need.



I have managed to recalculate “You save” like this:

{include file="common_templates/price.tpl" value=$product.list_price-$product.taxed_price
```<br />
<br />
But can't recalculate % of discount. I am trying like this:<br />
```php
{include file="common_templates/price.tpl" value=($product.list_price-$product.taxed_price) % $product.list_price
```<br />
<br />
I am getting smarty error, probably because of "(" character<br />
<br />
I would appreciate any help

use {math equasion}

Here is docs {math} | Smarty

you will get something like this:

{math equasion=“your calc” assign=“new_constant”}

{include file=“common_templates/price.tpl” value=$new_constant

[quote name='N1XUS' timestamp='1329123952' post='131152']

use {math equasion}

Here is docs http://www.smarty.ne…e.function.math

you will get something like this:

{math equasion=“your calc” assign=“new_constant”}

{include file=“common_templates/price.tpl” value=$new_constant

[/quote]



Thank you! Thank you!

Just in case anyone is interested in this, I ended with this code



{math equation="round((x-y)*100/x)" x=$product.list_price y=$product.taxed_price assign="discount_prc_cust"}
{include file="common_templates/price.tpl" value=$discount_prc_cust