Poppy381 Posted January 25, 2015 Share Posted January 25, 2015 (edited) Hi, I was searching for a way to hide decimales while using convertPrice function which works with several currencies. I've found a trick on the forum but it only works with one kind of currency. Here is my trick and it works with all the different currencies format : {if $currency->format == 1 || $currency->format == 4 || $currency->format == 5} {convertPrice|regex_replace:'/[.][0-9]+/':'' price=$yourprice * $currency->conversion_rate} {elseif $currency->format == 2 || $currency->format == 3} {convertPrice|regex_replace:'/[,][0-9]+/':'' price=$yourprice * $currency->conversion_rate} {else} {convertPrice price=$yourprice* $currency->conversion_rate} {/if} If $yourprice is a productprice you don't have to write "*$currency->conversion rate". Just add $product.price . If you want to round your price : price=round($product.price) The else can be empty, it's just in case of an override of the Tools.php with new specific format rules . Hope you like it . Edited January 25, 2015 by Poppy381 (see edit history) 1 Link to comment Share on other sites More sharing options...
Gangadhar KM Posted November 11, 2015 Share Posted November 11, 2015 I need to separate the decimal left & right part in smarty in prestashop , kindly help me. Link to comment Share on other sites More sharing options...
Poppy381 Posted November 11, 2015 Author Share Posted November 11, 2015 Provide an example please Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now