what is pvaValue.PriceAdjustment?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
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;
        }
11 years ago
It means that Value will affect the price of the product.

If I have a t-shirt that is $5 and the attribute is Size, I could set the values for Small and Medium to have a price adjustment of 0 but Large adds $1 to the price of the shirt.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.