本文整理汇总了Java中org.ofbiz.order.shoppingcart.ShoppingCart.CartShipInfo类的典型用法代码示例。如果您正苦于以下问题:Java CartShipInfo类的具体用法?Java CartShipInfo怎么用?Java CartShipInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CartShipInfo类属于org.ofbiz.order.shoppingcart.ShoppingCart包,在下文中一共展示了CartShipInfo类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: if
import org.ofbiz.order.shoppingcart.ShoppingCart.CartShipInfo; //导入依赖的package包/类
public static Map<String, Object>setShippingOptions(DispatchContext dctx, Map<String, Object> context) {
ShoppingCart cart = (ShoppingCart) context.get("shoppingCart");
Integer groupIndex = (Integer) context.get("groupIndex");
String shippingContactMechId = (String) context.get("shippingContactMechId");
String shipmentMethodString = (String) context.get("shipmentMethodString");
String shippingInstructions = (String) context.get("shippingInstructions");
String giftMessage = (String) context.get("giftMessage");
Boolean maySplit = (Boolean) context.get("maySplit");
Boolean isGift = (Boolean) context.get("isGift");
Locale locale = (Locale) context.get("locale");
ShoppingCart.CartShipInfo csi = cart.getShipInfo(groupIndex.intValue());
if (csi != null) {
int idx = groupIndex.intValue();
if (UtilValidate.isNotEmpty(shipmentMethodString)) {
int delimiterPos = shipmentMethodString.indexOf('@');
String shipmentMethodTypeId = null;
String carrierPartyId = null;
if (delimiterPos > 0) {
shipmentMethodTypeId = shipmentMethodString.substring(0, delimiterPos);
carrierPartyId = shipmentMethodString.substring(delimiterPos + 1);
}
cart.setShipmentMethodTypeId(idx, shipmentMethodTypeId);
cart.setCarrierPartyId(idx, carrierPartyId);
}
cart.setShippingInstructions(idx, shippingInstructions);
cart.setShippingContactMechId(idx, shippingContactMechId);
cart.setGiftMessage(idx, giftMessage);
if (maySplit != null) {
cart.setMaySplit(idx, maySplit);
}
if (isGift != null) {
cart.setIsGift(idx, isGift);
}
} else {
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderCartShipGroupNotFound", UtilMisc.toMap("groupIndex",groupIndex), locale));
}
return ServiceUtil.returnSuccess();
}