[ListPrice]
money_format('%i', $ListPrice)
That should get me USD. I am actually looking for it to display in the format of $xxx,xxx.
Can anyone tell me what I am doing wrong?
Thanks!
money_format
12 posts
• Page 1 of 1
money_formatI was wondering how to correctly use 'money_format' in my fields.ini file? I have read the wiki pages and cannot get it to function. I've been trying this:
That should get me USD. I am actually looking for it to display in the format of $xxx,xxx. Can anyone tell me what I am doing wrong? Thanks!
Re: money_formatI don't believe this directive is in 1.3.x... It is marked as requiring version 2.0 which isn't released yet.
The syntax would be something like:
In 1.3.x you could achieve the same thing by implementing a ListPrice__display() method in your delegate class as follows:
-Steve
Re: money_formatThanks Steve,
I tried the following in my /tables/SALE/SALE.php:
and php is generating this error:
Not sure what's happening.
Re: money_formatThat function has to be defined inside the table delegate class.
Please read the following section of the getting started guide for more info on how to create a table delegate class: http://xataface.com/documentation/tutor ... te_classes
Re: money_formatThank you.
I was missing the class tables statement:
However, the format function is not behaving as I'd like it to (I'm sure it is acting correctly as it is programmed, I need to modify the function. It now displays the price as "5000.00". I am looking for it to display as "$5000". Thanks for your help
Re: money_formatCheck out the php documentation page for money_format. There are some examples there.
http://www.php.net/money_format The money_format will depend on the locale that is set. Sometimes I just use the number_format() function instead, and prepend a '$' to it. -Steve
Re: money_formatI use the following:
For version 1.5.x or 2.x, in fields.ini:
For version 1.3.x, in the table delegate class:
The %n (instead of %i) in this case prepends the '$', although Steve's solution to add it manually and use number_format instead may be easier if you only need to consider USD.
Re: money_formatThanks Adobkin!
The function you create works fine. Is it possible to have it omit the decimals. All my values are whole numbers for the field in question. Thanks again
Re: money_formatYes, you need the right precision parameter. Try the string "%.0n" as your money_format value. For more details, see:
http://php.net/money_format Alan
Re: money_formatFantastic.
Thank you, Alan!! -Rich
Re: money_formatI am trying to format the output on my custom function. The following is from a table delegate function section.
However, when I call $childOrigListPrice in my content array, the number is not formatted. Any Ideas?
12 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 20 guests |