SergioE Posted January 20, 2017 Share Posted January 20, 2017 (edited) Hola, A veces para que me cuadre un precio según el descuento tengo que poner en vez de 5%, 5.25% por decir algo. En la ficha de producto solo aparece el 5%, pero en product-list me sale con los decimales, es decir, 5.25% y queda horrible. Lo he intentado modificar entrando en product-list.tpl pero no me salgo. Actualmente esta así el código: {if $product.specific_prices.reduction_type == 'percentage'} <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span> {/if} Como se tendría que poner? Saludos Edited February 10, 2017 by SergioE (see edit history) Link to comment Share on other sites More sharing options...
mAchAcA Posted January 20, 2017 Share Posted January 20, 2017 {$number|string_format:"%d"} Link to comment Share on other sites More sharing options...
SergioE Posted January 20, 2017 Author Share Posted January 20, 2017 Donde pongo eso y que tengo que substituir respecto a mi código? Link to comment Share on other sites More sharing options...
mAchAcA Posted January 20, 2017 Share Posted January 20, 2017 (edited) Sería algo así: <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100|string_format:"%d"}%</span> No controlo mucho smarty Edited January 20, 2017 by mAchAcA (see edit history) Link to comment Share on other sites More sharing options...
SergioE Posted January 20, 2017 Author Share Posted January 20, 2017 No funciona :/ Link to comment Share on other sites More sharing options...
SergioE Posted January 21, 2017 Author Share Posted January 21, 2017 Alguien sabe como se tiene que poner? Gracias Link to comment Share on other sites More sharing options...
w3bsolutions Posted January 21, 2017 Share Posted January 21, 2017 Has probado esto? -{$product.specific_prices.reduction * 100|intval}% Link to comment Share on other sites More sharing options...
SergioE Posted January 21, 2017 Author Share Posted January 21, 2017 Si, tampoco funciona :/ Link to comment Share on other sites More sharing options...
w3bsolutions Posted February 10, 2017 Share Posted February 10, 2017 Acabo de comprobar que esto funciona (faltaban los paréntesis en mi respuesta anterior): -{($product.specific_prices.reduction * 100)|intval}% Saludos. Link to comment Share on other sites More sharing options...
SergioE Posted February 10, 2017 Author Share Posted February 10, 2017 Te lo agradezco, funciona! Gracias! Link to comment Share on other sites More sharing options...
Recommended Posts