OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.23k stars 2.34k forks source link

Provide basic support for displaying NumericField for Currency #10490

Open ns8482e opened 2 years ago

ns8482e commented 2 years ago

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

Skrypt commented 2 years ago

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))
ns8482e commented 2 years ago

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.

Skrypt commented 2 years ago

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 commented 2 years ago

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

ns8482e commented 2 years ago

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

Skrypt commented 2 years ago

A per field setting would cover more use cases though.

sebastienros commented 2 years ago

OK to add new display and edit modes.

sebastienros commented 2 years ago

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

ns8482e commented 2 years ago

May be just have setting for format - like excel has

sebastienros commented 2 years ago

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