Jump to content

[Solved] help to solve a simple math


Recommended Posts

hi I want to show a simple math in my product page that is markup. so I put this code to the product tpl

 {math equation="(( x / y ) * 100 )" x=$product.price y=$product.wholesale_price}



but its not working can you guys please help me to solve it because of smarty knowledge i am having this issue please help asap.

Link to comment
Share on other sites

hi I want to show a simple math in my product page that is markup. so I put this code to the product tpl

 {math equation="(( x / y ) * 100 )" x=$product.price y=$product.wholesale_price}



but its not working can you guys please help me to solve it because of smarty knowledge i am having this issue please help asap.



Hi,

Your equation is good !

Have you got any ouput value over $product.price and $product.wholesale_price ?

This value is decimal like : xxx.xx, or xxx,xx ?

I found this thread : http://www.smarty.net/forums/viewtopic.php?p=40394&sid=a0109b1c4ea606c65840c7e9961dfaf3

Best regards
Link to comment
Share on other sites

Thanks for reply.

my this function works
{math equation="(x/y)*100" x=$productPrice y=$product->wholesale_price}



but I wanted 2 decimal or round this can you help me?



Try this :
{math equation="(x/y)*100" x=$productPrice y=$product->wholesale_price format="%.2f"}



Best regards

Link to comment
Share on other sites

  • 3 months later...
  • 3 years later...
  • 3 years later...
×
×
  • Create New...