Jump to content

Redondear precio


qlio

Recommended Posts

Me ha pedido un cliente que le ponga el precio por metro para algunos productos en la vista de la categoría. He podido añadirlo con el siguiente fragmento de código

{block name='product_unit_price'}
	{if $product.unit_price_ratio > 0}
    	<p class="product-unit-price sub">{$product.unit_price_tax_included} € metro</p>
    {/if}
{/block}

En el fichero themes/classic/templates/catalog/_partials/miniatures/product.tpl

Pero me muestra 28.999950819914 € metro y necesitaría redondearlo a 29 € metro.

¿Alguna ayuda?

preciosPS.png

Link to comment
Share on other sites

Solucionado, lo copio aquí porque si le sirve a alguien mas:

{if $product.unit_price_ratio > 0}
	<p class="product-unit-price sub">{round($product.unit_price_tax_included, 2, PHP_ROUND_HALF_UP)} € metro</p>
{/if}

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...