You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fraction digits - hardcoded to 2 in Shopsys\FrameworkBundle\Twig\PriceExtension
What is happening
My post from slack:
Hi. I'm trying to remove "fraction" digits from frontend, so only 123Kc will be showed instead of 123.00Kc. And it is almost impossible (there is no GOOD way to do it).
I thought that you are using CommerceGuys\Intl\Currency\CurrencyRepository, so I copied their JSON configs, set fraction_number to zero, change $definitionPath in constructor and NOTHING. Because you are using your own IntlCurrencyRepository, but you have not override CommerceGuys\Intl\Currency\CurrencyRepository constructor. So I tried to skip your IntlCurrencyRepository and use CommerceGuys directly. NOTHING. Because of Shopsys\FrameworkBundle\Twig\PriceExtension where you have "hardcoded" $numberFormatter->setMinimumFractionDigits(self::MINIMUM_FRACTION_DIGITS);. And this class uses so many private properties and functions, so only way I found is to extend whole PriceExtension.
I've got a response that the latest version uses static::MINIMUM_FRACTION_DIGITS, so it could be overridden. But this does not solve an issue when I want to have different fraction digits count for different domain/language/currency/...
Expected result
You are using CommerceGuys\Intl\Currency\CurrencyRepository, so there should be way to use their configs to set fraction digits and they should override MINIMUM_FRACTION_DIGITS (and maximum too)
The text was updated successfully, but these errors were encountered:
Hi, as the solution might not be simple, I have created a user story for that, so now, it needs to be evaluated and planned to a sprint. I will let you know once there is any progress.
Fraction digits - hardcoded to 2 in Shopsys\FrameworkBundle\Twig\PriceExtension
What is happening
My post from slack:
Hi. I'm trying to remove "fraction" digits from frontend, so only 123Kc will be showed instead of 123.00Kc. And it is almost impossible (there is no GOOD way to do it).
I thought that you are using
CommerceGuys\Intl\Currency\CurrencyRepository
, so I copied their JSON configs, set fraction_number to zero, change $definitionPath in constructor and NOTHING. Because you are using your ownIntlCurrencyRepository
, but you have not overrideCommerceGuys\Intl\Currency\CurrencyRepository
constructor. So I tried to skip yourIntlCurrencyRepository
and use CommerceGuys directly. NOTHING. Because ofShopsys\FrameworkBundle\Twig\PriceExtension
where you have "hardcoded"$numberFormatter->setMinimumFractionDigits(self::MINIMUM_FRACTION_DIGITS);
. And this class uses so many private properties and functions, so only way I found is to extend whole PriceExtension.I've got a response that the latest version uses static::MINIMUM_FRACTION_DIGITS, so it could be overridden. But this does not solve an issue when I want to have different fraction digits count for different domain/language/currency/...
Expected result
You are using
CommerceGuys\Intl\Currency\CurrencyRepository
, so there should be way to use their configs to set fraction digits and they should override MINIMUM_FRACTION_DIGITS (and maximum too)The text was updated successfully, but these errors were encountered: