Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.4.23</Version>
<Version>10.4.24</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Live Integration</Title>
<Description>Live Integration</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ private static List<PriceProductSelection> GetProductsForRequest(Settings settin
// Check for existence of the given products in the Cache
List<PriceProductSelection> productsForRequest = new List<PriceProductSelection>();
bool getProductInformationForAllVariants = settings.GetProductInformationForAllVariants;
bool showVariantDefault = SystemConfiguration.Instance.GetBoolean("/Globalsettings/Ecom/Product/ShowVariantDefault");

foreach (var productWithQuantity in products)
{
Expand Down Expand Up @@ -317,24 +318,12 @@ private static List<PriceProductSelection> GetProductsForRequest(Settings settin
}
}
}
else

if (showVariantDefault)
{
if (!string.IsNullOrEmpty(product.VariantId) && !string.IsNullOrEmpty(product.DefaultVariantComboId) && !string.Equals(product.VariantId, product.DefaultVariantComboId)
&& GetFilteredVariants(new List<Product>() { product }).Count != 0)
{
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);
}

product = ProductProvider.GetProductFromVariantComboId(product, logger);

if (string.IsNullOrEmpty(product.VariantId) || GetFilteredVariants(new List<Product>() { product }).Count != 0)
{
productIdentifier = ProductProvider.GetProductIdentifier(settings, product, productWithQuantity.UnitId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Cache;
using Dynamicweb.Configuration;
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Cache;
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Configuration;
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Connectors;
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Extensions;
Expand Down Expand Up @@ -30,10 +31,12 @@ public class ProductPriceProvider : PriceProvider, IPriceInfoProvider

List<PriceProductSelection> products = new List<PriceProductSelection>();

Product changedProduct = ProductManager.ProductProvider.GetProductFromVariantComboId(product.Product, logger);
products.Add(changedProduct.GetPriceProductSelection(product.Quantity, product.UnitId));
bool showVariantDefault = SystemConfiguration.Instance.GetBoolean("/Globalsettings/Ecom/Product/ShowVariantDefault");

Product productForRequest = showVariantDefault ? ProductManager.ProductProvider.GetProductFromVariantComboId(product.Product, logger) : product.Product;
products.Add(productForRequest.GetPriceProductSelection(product.Quantity, product.UnitId));
// After GetProductFromVariantComboId the variantId is empty or other product is returned so new identifier must be generated
productIdentifier = ProductManager.ProductProvider.GetProductIdentifier(settings, changedProduct, product.UnitId);
productIdentifier = ProductManager.ProductProvider.GetProductIdentifier(settings, productForRequest, product.UnitId);

bool fetchedProductInfo = ProductManager.FetchProductInfos(products, context, settings, logger, true, SubmitType.Live);
if (fetchedProductInfo &&
Expand Down
Loading