本文整理汇总了C#中MerchantTribe.Commerce.Orders.Order.ClearShippingPricesAndMethod方法的典型用法代码示例。如果您正苦于以下问题:C# Order.ClearShippingPricesAndMethod方法的具体用法?C# Order.ClearShippingPricesAndMethod怎么用?C# Order.ClearShippingPricesAndMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MerchantTribe.Commerce.Orders.Order
的用法示例。
在下文中一共展示了Order.ClearShippingPricesAndMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadShippingMethodsForOrder
private void LoadShippingMethodsForOrder(Order o)
{
SortableCollection<ShippingRateDisplay> rates = MTApp.OrderServices.FindAvailableShippingRates(o);
string rateKey = o.ShippingMethodUniqueKey;
bool rateIsAvailable = false;
// See if rate is available
if ((rateKey.Length > 0))
{
foreach (MerchantTribe.Commerce.Shipping.ShippingRateDisplay r in rates)
{
if ((r.UniqueKey == rateKey))
{
rateIsAvailable = true;
MTApp.OrderServices.OrdersRequestShippingMethod(r, o);
}
}
}
// if it's not availabe, pick the first one or default
if ((rateIsAvailable == false))
{
if ((rates.Count > 0))
{
MTApp.OrderServices.OrdersRequestShippingMethod(rates[0], o);
rateKey = rates[0].UniqueKey;
}
else
{
o.ClearShippingPricesAndMethod();
}
}
ViewBag.ShippingRates = HtmlRendering.ShippingRatesToRadioButtons(rates, 300, o.ShippingMethodUniqueKey);
}
示例2: OrdersRequestShippingMethod
public bool OrdersRequestShippingMethod(Shipping.ShippingRateDisplay r, Order o)
{
bool result = false;
if (r != null) {
o.ClearShippingPricesAndMethod();
o.ShippingMethodId = r.ShippingMethodId;
o.ShippingProviderId = r.ProviderId;
o.ShippingProviderServiceCode = r.ProviderServiceCode;
result = true;
}
return result;
}