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


Java CartShipInfo类代码示例

本文整理汇总了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();
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:45,代码来源:ShoppingCartServices.java


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