Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Currency format inconsistent #4009

Closed
jaimestuardo opened this issue Apr 5, 2016 · 4 comments
Closed

Currency format inconsistent #4009

jaimestuardo opened this issue Apr 5, 2016 · 4 comments
Assignees
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update

Comments

@jaimestuardo
Copy link

I have the issue with currency format. First, in order to configure my currency to have no decimal numbers, I have modified 3 files in /vendor/magento/zendframework1/library/Zend/Locale/Data: es.xml, es_ES.xml and es_CL.xml (the latter just in case, because locale set is es_ES)

In es.xml I have:
<currencyFormats numberSystem="latn"> <currencyFormatLength> <currencyFormat type="standard"> <pattern>¤ #,##0</pattern> </currencyFormat> <currencyFormat type="accounting"> <pattern>¤ #,##0</pattern> </currencyFormat> </currencyFormatLength> <unitPattern count="one">{0} {1}</unitPattern> <unitPattern count="other">{0} {1}</unitPattern> </currencyFormats>

In both es_ES.xml and es_CL.xml I have:
<currencyFormats numberSystem="latn"> <currencyFormatLength> <currencyFormat type="standard"> <pattern>¤ #,##0;¤ -#,##0</pattern> </currencyFormat> </currencyFormatLength> </currencyFormats>

I have removed /var/cache and /var/view_preprocessed, and even, removed browser cache.

The result: the number placed using JavaScript are not formatted correctly:

image

image

image

image

Regards
Jaime

@antboiko antboiko added the PS label Apr 5, 2016
@mazhalai
Copy link
Contributor

@jamescowie thank you reporting, we have created MAGETWO-51790 to investigate and fix.

@mazhalai mazhalai added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Apr 11, 2016
@okorshenko okorshenko self-assigned this Apr 28, 2016
@okorshenko
Copy link
Contributor

@jaimestuardo , thank you for reporting the issue. Unfortunately, not all parts of Magento use intl php extension to get local information. Some parts still using Zend_Locale. Since you modified Zend files, you got incorrect behavior. We have a ticket in our backlog to cleanup the code and make it more consistent, but this refactoring will take some time. For now, you can pluginize method \Magento\Framework\Locale\FormatInterface::getPriceFormat and change in output array value of requiredPrecision key. Change value from 2 to 0. In this case UI behavior looks correct.
Please let me know if this solution works for you. Thank you!

@jaimestuardo
Copy link
Author

Hi Okorshenko,

For "pluginize" you mean I can create a class under /app/code/[MyCompany]/[MyPlugin] that implements FormatInterface and the system will automatically call my own getPriceFormat method?

@okorshenko
Copy link
Contributor

Hi @jaimestuardo , here is a documentation for Magento 2 plugins. http://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html
Please, let me know if you need some help

magento-engcom-team pushed a commit that referenced this issue Apr 5, 2019
[EngCom] Public Pull Requests - GraphQL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update
Projects
None yet
Development

No branches or pull requests

5 participants