当前位置: 首页>>代码示例>>C#>>正文


C# Order.IsOrderFreeShipping方法代码示例

本文整理汇总了C#中MerchantTribe.Commerce.Orders.Order.IsOrderFreeShipping方法的典型用法代码示例。如果您正苦于以下问题:C# Order.IsOrderFreeShipping方法的具体用法?C# Order.IsOrderFreeShipping怎么用?C# Order.IsOrderFreeShipping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MerchantTribe.Commerce.Orders.Order的用法示例。


在下文中一共展示了Order.IsOrderFreeShipping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindAvailableShippingRates

        public Utilities.SortableCollection<Shipping.ShippingRateDisplay> FindAvailableShippingRates(Order o, Accounts.Store currentStore)
        {
            Utilities.SortableCollection<Shipping.ShippingRateDisplay> result = new Utilities.SortableCollection<Shipping.ShippingRateDisplay>();

            // Get all the methods that apply to this shipping address and store
            List<Zone> zones = ShippingZones.FindAllZonesForAddress(o.ShippingAddress, o.StoreId);
            List<ShippingMethod> methods = new List<ShippingMethod>();
            methods = this.ShippingMethods.FindForZones(zones);

            // Get Rates for each Method
            foreach (Shipping.ShippingMethod m in methods)
            {

                Collection<Shipping.ShippingRateDisplay> tempRates = m.GetRates(o, currentStore);
                if (tempRates != null)
                {
                    for (int i = 0; i <= tempRates.Count - 1; i++)
                    {
                        ShippingRateDisplay fRate = tempRates[i].GetCopy();
                        //fRate.AdjustRate(m.AdjustmentType, m.Adjustment);                        
                        result.Add(fRate);
                    }
                }
            }
            
            // Tally up extra ship fees
            decimal totalExtraFees = 0m;
            foreach (LineItem li in o.Items)
            {
                if (li.ExtraShipCharge > 0)
                {
                    totalExtraFees += li.ExtraShipCharge;
                }
            }

            // update results with extra ship fees and handling
            foreach (Shipping.ShippingRateDisplay displayRate in result)
            {
                displayRate.Rate += totalExtraFees + o.TotalHandling;
            }


            // Apply promotions to rates here:

            // Run workflow to get shipping rate discounts
            //BusinessRules.ShippingTaskContext c = new BusinessRules.ShippingTaskContext();
            //c.Rates = result;
            //c.UserId = this.UserID;
            //c.Order = this;
            //BusinessRules.Workflow.RunByName(c, BusinessRules.WorkflowNames.ApplyShippingDiscounts);


            // Sort Rates
            result.Sort("Rate", Utilities.SortDirection.Ascending);

            if (result.Count < 1)
            {
                if (o.IsOrderFreeShipping())
                {
                    result.Add(new Shipping.ShippingRateDisplay("Free Shipping.", "", "", 0m, "FREESHIPPING"));
                }
                else
                {
                    string value = Content.SiteTerms.GetTerm(Content.SiteTermIds.ShippingUnknown);
                    if (!string.IsNullOrEmpty(value))
                    {
                        result.Add(new Shipping.ShippingRateDisplay(value, "", "", 0m, "UNKNOWN"));
                    }
                    else
                    {
                        result.Add(new Shipping.ShippingRateDisplay("To Be Determined. Contact Store for Details", "", "", 0m, "TOBEDETERMINED"));
                    }

                }
            }

            return result;
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:78,代码来源:OrderService.cs


注:本文中的MerchantTribe.Commerce.Orders.Order.IsOrderFreeShipping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。