We have 2 different type of taxe rate, some products have 8% some others have 18%
We encounter problems about taxe included prices when we want to create discounts
We try to solve this problem manually.
We solved it by multiplying product templates.
sample
{$display_price = $product.original_price|default:$product.base_price}
{$display_price = $display_price * 0.10 * 1.08}
{include file=“common/price.tpl” value=$display_price span_id=“old_price_$obj_prefix``$obj_id
” class=“ty-list-price-old ty-nowrap”}
1.08 here means %8 taxe
but in cart page wrong calculations happens because there are products with 18% taxe too.
due to this reason we need to calculate with product’s own taxe rate.
sample
{include file=“common/price.tpl” value=$product.discount * 1.08 span_id=“discount_subtotal_$key
” class=“none”}{/if}
1+$tax.rate_value must come to the place where 1.08 is written.
A line like its shown below creates error.
{include file=“common/price.tpl” value=$product.discount * 1+$tax.rate_value span_id=“discount_subtotal_$key
” class=“none”}{/if}
$tax.rate_value value must be 8 and it should be calculated like this : /100 + 1 = 1.08
It looks complicated but it’s very important to show right taxe included prices to clients when they look at their cart.
Use the {math} smarty tag to calculate taxed value before sending the calculated value to the price.tpl template.
Thank you eComLabs, can you show a sample code please?
[quote name='webus' timestamp='1425938577' post='207489']
Thank you eComLabs, can you show a sample code please?
[/quote]
{math equation="x * (1 + y)" x=$product.discount y=$tax.rate_value assign="new_price"}
{include file="common/price.tpl" value=$new_price span_id="discount_subtotal_`$key`" class="none"}
[quote name='webus' timestamp='1425938577' post='207489']
Thank you eComLabs, can you show a sample code please?
[/quote]
Please use the following link for the extended info about {math}: {math} | Smarty
Sincerely yours,
CS-Market.
[quote name='CS-Market' timestamp='1425980896' post='207546']
Please use the following link for the extended info about {math}: http://www.smarty.ne…nction.math.tpl
[/quote]
- The content is displayed in Russian with your link
- The correct link is already provided in post #2