silvershop / silvershop-core

SilverShop is an e-commerce shopping cart module for the SilverStripe CMS
http://silvershop.github.io
BSD 2-Clause "Simplified" License
113 stars 119 forks source link

ShopCurrency: Scaffold Numeric Fields for Price etc... #818

Open wernerkrauss opened 6 months ago

wernerkrauss commented 6 months ago

I changed in #812 in Product to use a NumericField instead of a TextField to allow other decimal separators etc. for better internationalisation.

Unfortunately we need to hard code the number of decimals in code when we create a numeric field. That's bad when a shop overwrites those numbers cause it needs more decimals for some reasons. Currently I found no way to read out the decimals from DBCurrency, as it's a private value in in those cases we'd need to overwrite all Fields

As we already have ShopCurrency as a subclass replacement for DBCurrency I suppose we add our own scaffoldFormField method, that returns a NumericField with setScale set to the decimals set in Currency.

Furthermore, we could add the current decimals for Nice.