Developer forum

Forum » Development » PriceProvider ignoring currency?

PriceProvider ignoring currency?

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi guys,

I have the following PriceProvider:

  public class InternationalPrices : PriceProvider
  {
    public override PriceRaw FindPrice(Product product, double quantity, string variantId, Currency currency, string unitId, Extranet user)
    {
      // Get the price from the DefaultPriceProvider
      var defaultProvider = new DefaultPriceProvider();
      var rawPrice = defaultProvider.FindPrice(product, quantity, variantId, currency, unitId, user);

      // Todo: implement logic to markup price depending on the current site.

      return rawPrice;
    }
}

When I run this for a German site with EUR as the currency, rawPrice contains "70" which is the price for the default currency (USD). It's not being converted to Euros using the conversion rate. When I take out my provider, the list page shows something like 63.54; the price in Euros as converted from USDs.

Why is the DefaultPriceProvider not returning a price in the proper currency even though the currency is passed in?

Thanks,

Imar


Replies

 
Nicolai Høeg Pedersen
Reply

Could it be related to this issue?

http://developer.dynamicweb.com/forum/ecommerce-standard-features/shipping-fee-value-changed.aspx

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Nicolai,

It certainly seems similar. But wasn't that fixed in 8.8.1.12? That's the version I am currently running on.

I added some more logging and I see this:

var defaultProvider = new DefaultPriceProvider();
var rawPrice = defaultProvider.FindPrice(product, quantity, variantId, currency, unitId, user);

LogToFile.Log(string.Format("Getting price for Product ID {0} {1}{2} Requested currency {3}. Currency on rawPrice: {4}", product.ID, string.IsNullOrEmpty(variantId) ? "" : "Variant ID ", variantId, currency.Code, rawPrice.Currency.Code), LogFolder, LogToFile.LogType.ManyEntriesPerFile);

This logs the following:

[8/31/2016 4:33:38 AM]:    Getting price for Product ID 1371  Requested currency EUR. Currency on rawPrice: USD

Note how I am requesting EUR but get back USD. Bug?

Imar

 

You must be logged in to post in the forum