bleroy / Nwazet.Commerce

Idiomatic commerce module for Orchard CMS.
BSD 3-Clause "New" or "Revised" License
26 stars 21 forks source link

OrderPart currency #102

Closed MatteoPiovanelli-Laser closed 7 years ago

MatteoPiovanelli-Laser commented 7 years ago

As discussed in #99 we should be storing the currency in the Order.

I already tried adding a CurrencyCode property (also a corresponding attribute in the xml that is stored). This works for new orders, where this code can be populated when the order is created.

I don't see a generic way to add a CurrencyCode to pre-existing orders. On display/edit I could show or set the currency given by the current ISelectedCurrencyProvider (see #99), but there is no guarantee that is correct. I cannot trust to read the currency that is currently written in the Order's title, because that is simply given by Title.ToString("c").

Can anyone advise on how to overcome that issue?

bleroy commented 7 years ago

Ideally, existing orders would behave the same they were before the update, so maybe falling back on the current culture's currency is actually the right thing to do when the order's currency is not found. If we don't think this is best, can we fix them in a migration?

MatteoPiovanelli-Laser commented 7 years ago

On principle we could set a currency in a migration. Any currency, really, I am not sure there is a way to know which is the right one, but setting the site's culture's is probably the safest bet.

bleroy commented 7 years ago

Yes.

MatteoPiovanelli-Laser commented 7 years ago

I added the migration for this in #103

MatteoPiovanelli-Laser commented 7 years ago

closing because of the merge of #103