I'm having some trouble showing leading zeros on numbers that display a whole price. For example, if the price is $175.72, then it shows correctly as $175.72. But if I have an amount of $175.00, the display on the page is only $175. I would like the trailing zeros for prices that have .00 as cents.
It's the 'Sale' price that is not showing trailing zeros.Code:if ($show_price) { $db->setQuery("SELECT REPLACE(REPLACE(C.currency_positive_style,'{symbol}',C.currency_symbol ),'{number}',cast(P.product_price as decimal(19,2))) As pricetext FROM #__virtuemart_product_prices as P LEFT JOIN #__virtuemart_currencies as C on C.virtuemart_currency_id = P.product_currency WHERE P.virtuemart_product_id = '" . $product_id . "' LIMIT 1 "); $price_object = $db->loadObject(); //var_dump($pr->prices); $price = $pr->prices['salesPrice']; $price = '<div class="productPrice">Retails'.$price_object->pricetext.round($pr->prices,2).'</div>'.'<div class="salesPrice">Sale:'.round($pr->prices['salesPrice'],2).'</div>';
What do I do in this situation?



Reply With Quote



Bookmarks