Not possible to Add Currency Field
https://www.php.net/manual/en/numberformatter.formatcurrency.php
The above example will output:
1.234.567,89 €
Simple to add field but very useful for j4
Labels |
Added:
?
|
There is also no need for a new field as it is already possible to create a custom field with a prefix or suffix.
The code needed is indeed much more complex.
Example:
<?php
$fmt = new NumberFormatter('fr_FR', NumberFormatter::CURRENCY);
$fmt->setTextAttribute(NumberFormatter::CURRENCY_CODE, 'CAD');
$fmt->setPattern( str_replace('¤#',"¤\xC2\xA0#", $fmt->getPattern() ) );
echo $fmt->formatCurrency(1234567.891234567890000, 'CAD');
?>
will display in French format a Canadian Dollar value.
Therefore, one has to check the language in use and the currency chosen for the display, both being defined as variables.
The currencies proposed should be, I guess, proposed as a list.
This needs some code and I am not sure what you mean by creating a custom field with prefix or suffix.
Looks to me we have to create an entirely new field plugin.
Could you explain further?
Therefore, one has to check the language in use and the currency chosen for the display, both being defined as variables.
And the locale
This needs some code and I am not sure what you mean by creating a custom field with prefix or suffix.
Just use a number field and either the prefix or suffix param to display the currency symbol
Looks to me we have to create an entirely new field plugin.
I see no need for this
Where can we find prefix and suffix param in number field?
Just use a number field and either the prefix or suffix param to display the currency symbol
Lost in translation. I was thinking Custom Field plugin with specific code. One cannot use the default core Number field (which is not a plugin) with the necessary code for the formatting. The currency symbol is also added by the code above.
Forget it.
This does not mean that we should create this plugin for core btw.
prefix and suffix param in number field exists only in j4 but in j3 it doesn't exists, is it correct?
prefix and suffix param in number field exists only in j4 but in j3 it doesn't exists, is it correct?
You can test yourself by installing Joomla 3 and Joomla 4. These learning Joomla questions should be better and only asked in Joomlas forum https://forum.joomla.org/ so create a user profile there and ask these questions similar like these there.
If you didnt know Github is for core Joomla developers that focus on developing Joomla not learning how Joomla works or administration of Joomla as siteowen etc
See all Joomla docs where you can learn a lot about how Joomla works. https://docs.joomla.org/Main_Page and there is a lot of tutorials & videos example https://www.youtube.com/channel/UCEmHl8-zBTXbTfqMGLVLYuw and if you want to customise Joomla yourself you can test also Joomla Component Builder JCB https://www.joomlacomponentbuilder.com/ with many learning videos https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE so there you have your solutions!
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-02-26 13:12:09 |
Closed_By | ⇒ | rdeutz |
It is more complex than that as the rules for the position of the currency symbol and the character used for the decimal and thousand separators are different in different countries and different languages.
There is also no need for a new field as it is already possible to create a custom field with a prefix or suffix.