Dear Dynamicweb,
We see a performance penalty when using the product viewmodel as the property HandlePricesExclusively in our custom PriceProviders are not respected. Please see the code marked with red here:
private List<PriceListViewModel> GetPrices(PriceViewModelSettings settings, IList<Product> products, ref bool pricesHasBeenPrepared, object @lock, Product product)
{
var context = settings.GetPriceContext();
PreparePrices(context, ref pricesHasBeenPrepared, @lock, products);
var prices = product.Prices.Where(price => DefaultPriceProvider.ShowPrice(price, context, product, false));
var result = new List<PriceListViewModel>(
prices.Select(price =>
{
var priceRaw = new PriceRaw(price.Amount, price.Currency) { PriceSource = PriceSource.PriceMatrix };
var calculated = PriceCalculated.Create(context, priceRaw, product);
if (price.IsWithVat && !PriceHelper.PricesInDatabaseIncludeVat)
{
calculated.RawPriceIncludesVat = true;
}
calculated.Calculate();
return new PriceListViewModel()
{
Quantity = price.Quantity,
Price = CreateView(settings, calculated)
};
})
);
return result;
}
Hope it can be adjusted?
Best regards, Anders