redoli Posted October 5, 2014 Share Posted October 5, 2014 (edited) Hello everybody, I have a module that shows a percentage of the remaining products in stock, the thing is it shows a lot of decimals and I don't want to show this, I only want to display the whole number, here is part of the module code {if $valuepercen<100}<div class="weempty"><span class="percent">{*{$item}*}{100-$valuepercen}% </span><span class="restante">{l s='STOCK RESTANTE' mod='soldcountdown'}</span></div>{/if} Edited October 5, 2014 by redoli (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted October 6, 2014 Share Posted October 6, 2014 I believe you could use the smarty math function to round the number. Review the following page for details and an example http://www.smarty.net/docsv2/en/language.function.math.tpl Link to comment Share on other sites More sharing options...
redoli Posted October 6, 2014 Author Share Posted October 6, 2014 Hello Bellini, thank you so much for your reply, I have looking for smarty function and I used this one |number_format:0 and it worked! Here is the code modified, maybe it is usefull to somebody: {if $valuepercen<100}<div class="weempty"><span class="percent">{*{$item}*}{100-$valuepercen|number_format:0}% </span><span class="restante">{l s='STOCK RESTANTE' mod='soldcountdown'}</span></div>{/if} 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