Skip to content

Commit

Permalink
#7193 Fixed incorrect using of Combination.OveriddenPrice as Addition…
Browse files Browse the repository at this point in the history
…alCharge in some cases
  • Loading branch information
RomanovM committed May 20, 2024
1 parent 87ed468 commit c172f6f
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions src/Presentation/Nop.Web/Factories/ProductModelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,25 +399,28 @@ protected virtual async Task PrepareSimpleProductOverviewPriceModelAsync(Product
continue;
//get price with additional charge
var additionalCharge = decimal.Zero;
var combination = await _productAttributeParser.FindProductAttributeCombinationAsync(product, attributesXml);
if (combination?.OverriddenPrice.HasValue ?? false)
additionalCharge = combination.OverriddenPrice.Value;
{
(var priceWithoutDiscount, var priceWithDiscount, _, _) = await _priceCalculationService
.GetFinalPriceAsync(product, customer, store, combination.OverriddenPrice.Value, decimal.Zero, true, 1, null, null);
prices.Add((priceWithoutDiscount, priceWithDiscount));
}
else
{
var additionalCharge = decimal.Zero;
var attributeValues = await _productAttributeParser.ParseProductAttributeValuesAsync(attributesXml);
foreach (var attributeValue in attributeValues)
{
additionalCharge += await _priceCalculationService.
GetProductAttributeValuePriceAdjustmentAsync(product, attributeValue, customer, store);
}
}
if (additionalCharge != decimal.Zero)
{
(var priceWithoutDiscount, var priceWithDiscount, _, _) = await _priceCalculationService
.GetFinalPriceAsync(product, customer, store, additionalCharge);
prices.Add((priceWithoutDiscount, priceWithDiscount));
if (additionalCharge != decimal.Zero)
{
(var priceWithoutDiscount, var priceWithDiscount, _, _) = await _priceCalculationService
.GetFinalPriceAsync(product, customer, store, additionalCharge);
prices.Add((priceWithoutDiscount, priceWithDiscount));
}
}
}
Expand Down Expand Up @@ -1075,15 +1078,15 @@ await _priceFormatter.FormatPriceAsync(minimumCustomerEnteredPrice, false, false
//select new values
var selectedValues = await _productAttributeParser.ParseProductAttributeValuesAsync(updatecartitem.AttributesXml);
foreach (var attributeValue in selectedValues)
foreach (var item in attributeModel.Values)
if (attributeValue.Id == item.Id)
{
item.IsPreSelected = true;

//set customer entered quantity
if (attributeValue.CustomerEntersQty)
item.Quantity = attributeValue.Quantity;
}
foreach (var item in attributeModel.Values)
if (attributeValue.Id == item.Id)
{
item.IsPreSelected = true;

//set customer entered quantity
if (attributeValue.CustomerEntersQty)
item.Quantity = attributeValue.Quantity;
}
}
}

Expand Down

0 comments on commit c172f6f

Please sign in to comment.