Hi
We have a customer that would like to have to types of currency formatting.
One for products with price >= 100 where the price should not be displayed with decimals. (Currency format type C0).
And another one for products with price < 100 where the price should be displayed with two decimals (Currency format type C2).
Is there any way to add another field on currency model that can have a different value from the existing one and where we could apply a price limit?
Or do you have another idea how to implement the feature that the customer wants that can be more flexible?
I would like to avoid replacing the currency.Format() method to with another one on all places in the solution where currency.Format() is used.
That method could maybe look something like this:
private string NewFormatting(decimal price, Globalization.Currency currency)
{
if (price < 100)
{
var newCurrency = new Globalization.Currency("C2");
newCurrency.ExchangeRate = currency.ExchangeRate;
newCurrency.TextFormat = "C2";
newCurrency.Symbol = currency.Symbol;
newCurrency.SymbolPosition = currency.SymbolPosition;
return newCurrency.Format(price, true, CultureInfo.CurrentUICulture);
}
return currency.Format(price, true, CultureInfo.CurrentUICulture);
}
Thank you!
Litium version: [8.8.0]