Developer forum

Forum » Development » VariantInfo Prices

VariantInfo Prices

Tor Leeberg
Reply

Hi,

When I GET /dwapi/ecommerce/products/{productId} with "Price" included in VariantInfoSettings.FilledProperties I get the following error:

"InnerException": {
            "Message": "An error has occurred.",
            "ExceptionMessage": "Value cannot be null.\r\nParameter name: key",
            "ExceptionType": "System.ArgumentNullException",
            "StackTrace": "   at System.Collections.Concurrent.ConcurrentDictionary`2.TryGetValue(TKey key, TValue& value)\r\n   at Dynamicweb.Caching.DictionaryCache`2.GetCacheResult(IEnumerable`1 keys)\r\n   at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys)\r\n   at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key)\r\n   at Dynamicweb.Ecommerce.Prices.PriceManager.GetPrice(Product product, String currencyCode, String countryCode, String unitId, Int32 userId, String shopId, StockLocation stockLocation)\r\n   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass27_0.<CreateVariantInfo>b__0()\r\n   at System.Lazy`1.CreateValue()\r\n   at System.Lazy`1.LazyInitValue()\r\n   at GetPrice(Object )\r\n   at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)"
        }

Prices on VariantInfo work when VariantInfoSettings.FilledProperties is omitted from the query


Replies

 
Nicolai Pedersen
Reply

And what do add to VariantInfoSettings.FilledProperties?

Notice it should be ProductSettings.VariantInfoSettings.FilledProperties

 
Nicolai Pedersen
Reply

And what version?

 
Tor Leeberg
Reply

WebAPI version 0.11.1 and DynamicWeb version 9.10.22

This works:

and this fails: 

 
Nicolai Pedersen
Reply

VariantInfoSettings.FilledProperties
should be

ProductSettings.VariantInfoSettings.FilledProperties

 
Tor Leeberg
Reply

Using ProductSettings.VariantInfoSettings.FilledProperties has the same effect as not including it at all in the query.

Just noticed that your screenshot is from POST /dwapi/ecommerce/products and I'm using GET /dwapi/ecommerce/products/{id}, so does ProductSettings.VariantInfoSettings.FilledProperties still apply?

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Good catch!

Was using the product list.

So this is my request - it works.

{{HostName}}/dwapi/Ecommerce/Products/Prod7?LanguageId=LANG1&CurrencyCode=EUR&CountryCode=DK&FilledProperties=Id,Name,VariantInfo,Price&VariantInfoSettings.FilledProperties=ProductID,ProductName,Price&PriceSettings.FilledProperties=Price,PriceFormatted

But this does not:

Votes for this answer: 1
 
Tor Leeberg
Reply

Adding CurrencyCode and CountryCode fixed it. Thanks!

 
Nicolai Pedersen
Reply

I'll take a look at why it will not get default currency and country... And if we should even do that.

Anyways - glad we figured it out!!

 

You must be logged in to post in the forum