Esempio n. 1
0
        public string GetShippingCost(bool useProductShippingCost, string productID, string shippingID, object price)
        {
            decimal shippingCost = 0;
            decimal handlingFee  = 0;
            Product product      = DataAccessContext.ProductRepository.GetOne(
                AdminConfig.CurrentCulture, productID, new StoreRetriever().GetCurrentStoreID());

            CartItem      cartItem      = new CartItem(Cart.Null.CartID, product, 1);
            CartItemGroup cartItemGroup = new CartItemGroup(cartItem);

            ShippingOption shippingOption = DataAccessContext.ShippingOptionRepository.GetOne(
                AdminConfig.CurrentCulture, shippingID);

            if (!shippingOption.IsNull)
            {
                ShippingMethod shippingMethod = shippingOption.CreateNonRealTimeShippingMethod();

                shippingCost = shippingMethod.GetShippingCost(cartItemGroup, WholesaleStatus.Null, 0)
                               + CartItemPromotion.GetShippingCostFromPromotion(shippingMethod,
                                                                                cartItemGroup,
                                                                                WholesaleStatus.Null,
                                                                                0);
                handlingFee = shippingMethod.GetHandlingFee(cartItemGroup, WholesaleStatus.Null);
            }
            return(FormatNumber(shippingCost + handlingFee));
        }
Esempio n. 2
0
    private void CalculateShippingCost(
        ShippingOption shippingOption,
        out decimal shippingCost,
        out decimal handlingFee)
    {
        OrderCalculator orderCalculator = new OrderCalculator();

        ShippingMethod shippingMethod = shippingOption.CreateNonRealTimeShippingMethod();

        if (StoreContext.CheckoutDetails.Coupon.DiscountType == Vevo.Domain.Discounts.Coupon.DiscountTypeEnum.FreeShipping)
        {
            shippingCost = 0;
        }
        else
        {
            shippingCost = orderCalculator.GetShippingCost(
                shippingMethod,
                StoreContext.ShoppingCart.SeparateCartItemGroups(),
                StoreContext.WholesaleStatus,
                StoreContext.GetOrderAmount().Discount)
                           + CartItemPromotion.GetShippingCostFromPromotion(shippingMethod,
                                                                            StoreContext.ShoppingCart.SeparateCartItemGroups(),
                                                                            StoreContext.WholesaleStatus,
                                                                            StoreContext.GetOrderAmount().Discount);
        }

        handlingFee = orderCalculator.GetHandlingFee(
            shippingMethod,
            StoreContext.ShoppingCart.SeparateCartItemGroups(),
            StoreContext.WholesaleStatus);
    }