Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

200
Vistas
Smarty add two 0 after ",'

I have my variable

{assign var='reduc' value=$valueprice}
{assign var='prix' value='30,00'}

I did that

{$prix - ($prix * $reduc)}

But i want the result to be displayed with two number after the "," at the end always ! like if the result is :

30 => 30,00 
24,5 => 24,50

I already tried with |string_format:"%.2f" it is not working

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Using float variables for money values is not good, see for example http://floating-point-gui.de/basic/

So if you are using integer values instead you could do something like:

{$dollar},{$cent|string_format:"%02d"}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda