Sorry for the simple question, but I have basically no PHP experience. I'm theming my invoice. I have:

<?
php print $product->price
?>

I want it to be formatted $00.00 but it keeps formatting 00.00000.

How can I change this to the format that I want? Thanks!

Comments

tr’s picture

Status: Active » Fixed

uc_currency_format($product->price)

tr’s picture

@jan101: Those PHP functions are poor choices for this task because they ignore the currency symbol, symbol location, precision, and decimal/thousands separators chosen in the Ubercart administration menus for the site, require you to hard-wire a format into your template, and prevent your site from working with multiple currencies. All display of pricing in Ubercart should be passed through uc_currency_format().

mrpeanut’s picture

Thank you, TR. Kind of sad that something that simple can be a stumbling block, but without much PHP experience, it would have been. Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mailfox’s picture

Version: 7.x-3.x-dev » 6.x-2.4

Good! echo uc_currency_format($product->price);

tr’s picture

Version: 6.x-2.4 » 7.x-3.x-dev

Restoring version.