OrchardCore icon indicating copy to clipboard operation
OrchardCore copied to clipboard

Provide basic support for displaying NumericField for Currency

Open ns8482e opened this issue 4 years ago • 12 comments

Is your feature request related to a problem? Please describe.

For non-developer, who's using Orchard Core CMS for their local web site - needs a way for NumericFiled to be displayed as Currency, without any programming knowledge

  • Probably based on Site settings without Localization feature.

ns8482e avatar Oct 13 '21 20:10 ns8482e

This is a ContentField custom Display Mode. We talked about it on Gitter.

@Model.ContentItem.Content.ContTentTypeName.Price.Value.ToString("C0", CultureInfo.GetCultureInfo(CultureInfo.CurrentUICulture))

Skrypt avatar Oct 13 '21 22:10 Skrypt

Yes, to have Display and Editor option of Currency that use above code.

However CultureInfo for currency to configured in Site Settings similar to time zone and not depend on Localization feature. So that even with enabled Localization feature for different culture for contents - the currency stays same based to site setting.

ns8482e avatar Oct 14 '21 00:10 ns8482e

At this point, I'm not sure if Site Settings is appropriate. Probably would not cover every use case. Need to think about it. I understand your point though. You want this to be configurable apart from the Localization feature because on a field you could want to use a specific culture currency that is different than the CurrentUICulture.

I'm not sure if this makes sense to use a field for currency. If I look at the OrchardCore.Commerce repository they used a PricePart because it requires to pass into a MoneyService which probably handles these things.

Skrypt avatar Oct 14 '21 03:10 Skrypt

Well never mind, I guess for a "basic" display that would make sense.

Skrypt avatar Oct 14 '21 03:10 Skrypt

Yes - from site setting - because each tenant can set different setting independent of OS CultureInfo.CurrentUICulture

ns8482e avatar Oct 14 '21 17:10 ns8482e

A per field setting would cover more use cases though.

Skrypt avatar Oct 14 '21 18:10 Skrypt

OK to add new display and edit modes.

sebastienros avatar Oct 21 '21 17:10 sebastienros

After some discussions with @Skrypt it might be that you need a new field with Value and Currency properties, not dependent of the culture.

sebastienros avatar Oct 21 '21 17:10 sebastienros

May be just have setting for format - like excel has

ns8482e avatar Oct 21 '21 18:10 ns8482e

Better have custom display modes instead. Like "content only (no label)"

sebastienros avatar Oct 21 '21 18:10 sebastienros

https://github.com/OrchardCMS/OrchardCore.Commerce/issues/678

infofromca avatar Oct 20 '25 17:10 infofromca

@infofromca luckly I replied to your issue there, because I already developed such field

hishamco avatar Oct 20 '25 17:10 hishamco