Hello,
We've got a problem with the following code.
The problem is, that it will cause both VS and the solution to crash, when we run it and ask directly to the product.Discounts class. Also tested on the latest DW 8.4 version
Our test price provider has the following code, the line if (product.Discounts! = Null && product.Discounts.Count> 0) which makes it crache.
I can easily take hold of the individual items in the list, for example. product.Discounts [0]. Price.Price without fail ...?
public class ProductPrice : PriceProvider
{
public override PriceRaw FindPrice(Product product, double quantity, string variantID, Currency currency, string unitID, Extranet user)
{
// Get the price from the DefaultPriceProvider
//DefaultPriceProvider defaultProvider = new DefaultPriceProvider();
//PriceRaw rawPrice = defaultProvider.FindPrice(
product, quantity, variantID, currency, unitID, user);
try
{
if (product.Discounts != null && product.Discounts.Count > 0)
{
Dynamicweb.LogToFile.Log(
"ProductPriceProvider, ProductId=" + product.ID + " Discountprice=" +
product.Discounts[0].Price.
Price, "1stweb_test", LogToFile.LogType.
ManyEntriesPerFile); }
else
{
Dynamicweb.LogToFile.Log(
"ProductPriceProvider, ProductId=" + product.ID + " Discountprice=null", "1stweb_test",
LogToFile.LogType.
ManyEntriesPerFile); }
}
catch (Exception ex)
{
}
return null;
}
}