Skip to content

Commit

Permalink
Fix exception if CategoryPath is map and Category Path is empty for s…
Browse files Browse the repository at this point in the history
…ome product at same time.
  • Loading branch information
OlegoO committed May 18, 2022
1 parent 4d54901 commit 81b11b2
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ private async Task LoadProductDependencies(IEnumerable<CsvProduct> csvProducts,
csvProduct.Code = _skuGenerator.GenerateSku(csvProduct);
}
//Properties inheritance
var inheritedProperties = (csvProduct.Category != null ? csvProduct.Category.Properties : csvProduct.Catalog.Properties).OrderBy(x => x.Name).ToList();
var inheritedProperties = GetInheritedProperties(csvProduct);

foreach (var property in csvProduct.Properties.ToArray())
{
Expand Down Expand Up @@ -740,8 +740,15 @@ private async Task LoadProductDependencies(IEnumerable<CsvProduct> csvProducts,
}
}
}
}

}

private static List<Property> GetInheritedProperties(CsvProduct csvProduct)
{
if (csvProduct.Category != null && csvProduct.Category.Properties!=null)
return csvProduct.Category.Properties.OrderBy(x => x.Name).ToList();
return csvProduct.Catalog.Properties.OrderBy(x => x.Name).ToList();
}

private static List<PropertyValue> ParseValuesFromMultivalueString(PropertyValue firstPropertyValue, string additionalDelimiter)
{
var result = new List<PropertyValue>();
Expand Down

0 comments on commit 81b11b2

Please sign in to comment.