本文整理汇总了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;
}