GetShoppingCartShippingTotal gets called twice from shopping cart page

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 11 ans
Maybe GetShoppingCartTotal could be refactored to have an out param for the shoppingCartShipping

src\Presentation\Nop.Web\Controllers\ShoppingCartController.cs
        [ChildActionOnly]
        public ActionResult OrderTotals(bool isEditable)
        {
            ...

            if (cart.Count > 0)
            {
                ...                

                //shipping info
                model.RequiresShipping = cart.RequiresShipping();
                if (model.RequiresShipping)
                {
                    decimal? shoppingCartShippingBase = _orderTotalCalculationService.GetShoppingCartShippingTotal(cart);
                    if (shoppingCartShippingBase.HasValue)
                    {
                        decimal shoppingCartShipping = _currencyService.ConvertFromPrimaryStoreCurrency(...
                        model.Shipping = _priceFormatter.FormatShippingPrice(shoppingCartShipping, true);

                        //selected shipping method
                        var shippingOption = _workContext.CurrentCustomer.GetAttribute<ShippingOption>(...
                        if (shippingOption != null)
                            model.SelectedShippingMethod = shippingOption.Name;
                    }
                }

                ...

                decimal? shoppingCartTotalBase = _orderTotalCalculationService.GetShoppingCartTotal(cart,
                    out orderTotalDiscountAmountBase, out orderTotalAppliedDiscount,
                    out appliedGiftCards, out redeemedRewardPoints, out redeemedRewardPointsAmount);
                ...
                
                
                
\src\Libraries\Nop.Services\Orders\OrderTotalCalculationService.cs                
        public virtual decimal? GetShoppingCartTotal(IList<ShoppingCartItem> cart,
            out decimal discountAmount, out Discount appliedDiscount,
            out List<AppliedGiftCard> appliedGiftCards,
            out int redeemedRewardPoints, out decimal redeemedRewardPointsAmount,
            bool ignoreRewardPonts = false)
        ...
            //shipping without tax
            decimal? shoppingCartShipping = GetShoppingCartShippingTotal(cart, false);
Il y a 11 ans
Hi Dennis,

Thanks a lot. I've just created a work item
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.