remove decimal value from price

Help for integrating the Laravel package
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!
User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

remove decimal value from price

Post by VirtualSpy » 24 May 2023, 13:21

laravel version 9.48.0 , Aimeos version 2022.10.4 and PHP version 8.1.3 (Win)

I changed the "value" column type from decimal to int from table mshop_price & mshop_index_price but the price is still showing in decimal. why?

I also checked this template using die dump (dd) here getting decimal value https://github.com/aimeos/ai-client-htm ... 70C3-L77C1

on function getValue() return the value using function formatNumber() . and precision value

Code: Select all

$priceItem->getPrecision()
is getting 2 , from here

Code: Select all

https://github.com/aimeos/aimeos-core/blob/master/src/MShop/Price/Manager/Standard.php#LL330C3-L331C1
now using config anyone can change the precision value :)
And sorry Aimeos before getting a response from you I found the solution so, I edited my post again and again.

User avatar
aimeos
Administrator
Posts: 7858
Joined: 01 Jan 1970, 00:00

Re: remove decimal value from price

Post by aimeos » 25 May 2023, 06:29

Number formatting is done in the Number view helper:
https://github.com/aimeos/aimeos-base/b ... hp#L46-L57

Set the number of decimals with that config option:

Code: Select all

mshop/price/precision = 0
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply