mowax Posted April 5, 2014 Share Posted April 5, 2014 (edited) Hi all, Hoping someone good at php can help me here... I have created a tag called [subtotal_price], which is the [purchase_supplier_price] tag multiplied by [product_quantity] tag. I want to display this in an email template that is sent to suppliers. However, the tag displays no decimal places if it is a whole number. ie it displays $10 instead of $10.00. I really want prices to be consistent and have 2 decimal places. I have created the [subtotal_price] tag as follows in a php file: $product['subtotal_price']=$product['purchase_supplier_price']*$product['product_quantity']; I have tried using number_format and echo round, but my attempts only lead to a white screen in the back-office. Can anyone show me how to add a minimum of 2 decimal places to the [subtotal_price] tag? Thanks for any thoughts! Edited April 5, 2014 by mowax (see edit history) Link to comment Share on other sites More sharing options...
mowax Posted April 5, 2014 Author Share Posted April 5, 2014 figured it out: $product['subtotal_price']= number_format(($product['purchase_supplier_price']*$product['product_quantity']),2); 1 Link to comment Share on other sites More sharing options...
Recommended Posts