could anyone please explain what exactly does "attributesTotalPrice += pvaValue.PriceAdjustment;" do in the following code?
its a method in the Catalog.PriceCalculationService
I am particularly interested in what pva.PriceAdjustment is and how its functioning
Thanks In advance!
/// <summary>
/// Gets the shopping cart unit price (one item)
/// </summary>
/// <param name="shoppingCartItem">The shopping cart item</param>
/// <param name="includeDiscounts">A value indicating whether include discounts or not for price computation</param>
/// <returns>Shopping cart unit price (one item)</returns>
public virtual decimal GetUnitPrice(ShoppingCartItem shoppingCartItem, bool includeDiscounts)
{
var customer = shoppingCartItem.Customer;
decimal finalPrice = decimal.Zero;
var productVariant = shoppingCartItem.ProductVariant;
if (productVariant != null)
{
decimal attributesTotalPrice = decimal.Zero;
var pvaValues = _productAttributeParser.ParseProductVariantAttributeValues(shoppingCartItem.AttributesXml);
if (pvaValues != null)
{
foreach (var pvaValue in pvaValues)
{
attributesTotalPrice += pvaValue.PriceAdjustment;
}
}
if (productVariant.CustomerEntersPrice)
{
finalPrice = shoppingCartItem.CustomerEnteredPrice;
}
else
{
finalPrice = GetFinalPrice(productVariant,
customer,
attributesTotalPrice,
includeDiscounts,
shoppingCartItem.Quantity);
}
}
if (_shoppingCartSettings.RoundPricesDuringCalculation)
finalPrice = Math.Round(finalPrice, 2);
return finalPrice;
}