From aab4e73c04c3b76f2e1c8fe88b9de1cb137f39a5 Mon Sep 17 00:00:00 2001 From: Dmitriy Benyuk Date: Thu, 27 Feb 2025 14:44:53 +0200 Subject: [PATCH] Include variant product in the request to fix the Changing primary variant dont show correct price --- ...web.Ecommerce.DynamicwebLiveIntegration.csproj | 2 +- .../Products/ProductManager.cs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj index ceb2adb..150544e 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj @@ -1,6 +1,6 @@  - 10.4.18 + 10.4.19 1.0.0.0 Live Integration Live Integration diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Products/ProductManager.cs b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Products/ProductManager.cs index 7f80979..eb1658b 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Products/ProductManager.cs +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Products/ProductManager.cs @@ -320,6 +320,21 @@ private static List GetProductsForRequest(Settings settin } } } + else + { + if (!string.IsNullOrEmpty(product.VariantId) && !string.IsNullOrEmpty(product.DefaultVariantComboId) && !string.Equals(product.VariantId, product.DefaultVariantComboId) + && GetFilteredVariants(new List() { product }).Any()) + { + productIdentifier = ProductProvider.GetProductIdentifier(settings, product, productWithQuantity.UnitId); + if (!ResponseCache.IsProductInCache(productCacheLevel, productIdentifier, context.User, doCurrencyCheck ? context.Currency : null)) + { + if (ProductProvider.IsLivePriceEnabledForProduct(product) && product.HasIdentifier(settings)) + { + productsForRequest.Add(product.GetPriceProductSelection(productWithQuantity.Quantity, productWithQuantity.UnitId)); + } + } + } + } product = ProductProvider.GetProductFromVariantComboId(product, logger);