price number format
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
price number format
Hello sir
I use laravel aimeos version
aimeos/aimeos-core 2021.07.*
php ~7.1||~8.0
I want to show product price for all currencies with 2 digit decimal like rigtnow
but for IRR currency without decimal number only integer
like if price is 100.65 USD which are equal to 4262527.50 IRR
so in usd it should be 100.65 but for IRR it should be 4262527
I found a artical
mshop/price/manager/precision => 0
but this will convert price as integer for all currencies
but i need for only one currency
Thanks
I use laravel aimeos version
aimeos/aimeos-core 2021.07.*
php ~7.1||~8.0
I want to show product price for all currencies with 2 digit decimal like rigtnow
but for IRR currency without decimal number only integer
like if price is 100.65 USD which are equal to 4262527.50 IRR
so in usd it should be 100.65 but for IRR it should be 4262527
I found a artical
mshop/price/manager/precision => 0
but this will convert price as integer for all currencies
but i need for only one currency
Thanks
Re: price number format
Interesting question 
The number format is generated by the PHP Intl extension and based on the locale (=language) that's used, not on the currency:
https://www.php.net/manual/en/class.numberformatter.php
You can see the code for formatting numbers here:
https://github.com/aimeos/aimeos-base/b ... Locale.php
The PHP number formatter class has a lot of constants that can be used. Maybe you can find a combination the works and post it here so we can add it to the Aimeos view helper.

The number format is generated by the PHP Intl extension and based on the locale (=language) that's used, not on the currency:
https://www.php.net/manual/en/class.numberformatter.php
You can see the code for formatting numbers here:
https://github.com/aimeos/aimeos-base/b ... Locale.php
The PHP number formatter class has a lot of constants that can be used. Maybe you can find a combination the works and post it here so we can add it to the Aimeos view helper.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: price number format
Hello
I changed a code line in a file
vendor\aimeos\aimeos-core\lib\mshoplib\src\MShop\Price\Manager\Standard.php
$this->precision = $context->getConfig()->get( 'mshop/price/precision', 2 );
to
$locale = $this->getContext()->getLocale();
if($locale->getCurrencyId() !== null && $locale->getCurrencyId() == 'IRR'){
$this->precision = '0';
}else{
$this->precision = $context->getConfig()->get( 'mshop/price/precision', 2 );
}
it is working according to our requirement.
for IRR price integer and for other currencies with decimal number,
is it ok?
Thanks
I changed a code line in a file
vendor\aimeos\aimeos-core\lib\mshoplib\src\MShop\Price\Manager\Standard.php
$this->precision = $context->getConfig()->get( 'mshop/price/precision', 2 );
to
$locale = $this->getContext()->getLocale();
if($locale->getCurrencyId() !== null && $locale->getCurrencyId() == 'IRR'){
$this->precision = '0';
}else{
$this->precision = $context->getConfig()->get( 'mshop/price/precision', 2 );
}
it is working according to our requirement.
for IRR price integer and for other currencies with decimal number,
is it ok?
Thanks
Re: price number format
It may work for you if you overwrite the price manager class in your own extension (don't change the core files!) but it's not a common solution. Configuring the PHP NumberFormatter class correctly is the only solution we can integrate into the Aimeos core.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
