This Function Has Been Available Since:|
(AFCommerce v 2.1, Functions v 1.1)
Formats an amount of money in the current currency your store is using.
string = afc_format_price (total)
This function is used through out all pages in the cart that displays a price, and you should use it to in your own scripts. It does not need to have a currency passed to it, it uses the currency you set in the admin area for your entire store. I could have made the software more flexible to the customer and allow them to switch currencies. I didn't think this feature was necessary because most store owners only want to accept money in their currency, and there is another AFCommerce function, afc_format_number which allows you to format an amount in a currency you pass to it.
So, AFCommerce only allows one currency for your store to make coding easier for you. If users tell me they have a need for this feature, I will add it by default, but for now, you should normally keep it this way, which wouldn't require you to change any of the pages, and whenever you build new features, you would use my AFCommerce function instead of using php function "format_number". My function uses "format_number" for you, but since you tell it what currency to use in the admin area (US Dollar is the default), my function will do the formatting work for you for each currency the store has. You can add new currencies by adding a new row in the currencies database table. I will be adding more over time, but you can add more whenever you want.
total (string) - The amount of money to format.
Returns a string with the amount, formatted in the proper currency with all symbols included.
Open Source: No
There are currently no examples for this function.
Back to Functions List