當前位置: 首頁>>代碼示例>>Java>>正文


Java ProductWorker.isShippableToAddress方法代碼示例

本文整理匯總了Java中org.ofbiz.product.product.ProductWorker.isShippableToAddress方法的典型用法代碼示例。如果您正苦於以下問題:Java ProductWorker.isShippableToAddress方法的具體用法?Java ProductWorker.isShippableToAddress怎麽用?Java ProductWorker.isShippableToAddress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.ofbiz.product.product.ProductWorker的用法示例。


在下文中一共展示了ProductWorker.isShippableToAddress方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isShippableToAddress

import org.ofbiz.product.product.ProductWorker; //導入方法依賴的package包/類
private boolean isShippableToAddress(ShoppingCartItem item) {
    if ("SALES_ORDER".equals(getOrderTypeId())) {
        // Verify if the new address is compatible with the ProductGeos rules of
        // the products already in the cart
        GenericValue shippingAddress = null;
        try {
            shippingAddress = item.getDelegator().findOne("PostalAddress", UtilMisc.toMap("contactMechId", this.internalContactMechId), false);
        } catch (GenericEntityException gee) {
            Debug.logError(gee, "Error retrieving the shipping address for contactMechId [" + this.internalContactMechId + "].", module);
        }
        if (shippingAddress != null) {
            GenericValue product = item.getProduct();
            if (UtilValidate.isNotEmpty(product)) {
                return ProductWorker.isShippableToAddress(product, shippingAddress);
            }
        }
    }
    return true;
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:20,代碼來源:ShoppingCart.java

示例2: setShippingContactMechId

import org.ofbiz.product.product.ProductWorker; //導入方法依賴的package包/類
/** Sets the shipping contact mech id. */
public void setShippingContactMechId(int idx, String shippingContactMechId) {
    CartShipInfo csi = this.getShipInfo(idx);
    if (isSalesOrder() && UtilValidate.isNotEmpty(shippingContactMechId)) {
        // Verify if the new address is compatible with the ProductGeos rules of
        // the products already in the cart
        GenericValue shippingAddress = null;
        try {
            shippingAddress = this.getDelegator().findOne("PostalAddress", UtilMisc.toMap("contactMechId", shippingContactMechId), false);
        } catch (GenericEntityException gee) {
            Debug.logError(gee, "Error retrieving the shipping address for contactMechId [" + shippingContactMechId + "].", module);
        }
        if (shippingAddress != null) {
            Set<ShoppingCartItem> shipItems = csi.getShipItems();
            if (UtilValidate.isNotEmpty(shipItems)) {
                for (ShoppingCartItem cartItem : shipItems) {
                    GenericValue product = cartItem.getProduct();
                    if (UtilValidate.isNotEmpty(product)) {
                        if (!ProductWorker.isShippableToAddress(product, shippingAddress)) {
                            throw new IllegalArgumentException("The shipping address is not compatible with ProductGeos rules.");
                        }
                    }
                }
            }
        }
    }
    csi.setContactMechId(shippingContactMechId);
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:29,代碼來源:ShoppingCart.java

示例3: setShippingContactMechId

import org.ofbiz.product.product.ProductWorker; //導入方法依賴的package包/類
/** Sets the shipping contact mech id. */
public void setShippingContactMechId(int idx, String shippingContactMechId) {
    CartShipInfo csi = this.getShipInfo(idx);
    if (isSalesOrder() && UtilValidate.isNotEmpty(shippingContactMechId)) {
        // Verify if the new address is compatible with the ProductGeos rules of
        // the products already in the cart
        GenericValue shippingAddress = null;
        try {
            shippingAddress = this.getDelegator().findOne("PostalAddress", UtilMisc.toMap("contactMechId", shippingContactMechId), false);
        } catch (GenericEntityException gee) {
            Debug.logError(gee, "Error retrieving the shipping address for contactMechId [" + shippingContactMechId + "].", module);
        }
        if (shippingAddress != null) {
            Set<ShoppingCartItem> shipItems = csi.getShipItems();
            if (UtilValidate.isNotEmpty(shipItems)) {
                for(ShoppingCartItem cartItem : shipItems) {
                    GenericValue product = cartItem.getProduct();
                    if (UtilValidate.isNotEmpty(product)) {
                        if (!ProductWorker.isShippableToAddress(product, shippingAddress)) {
                            throw new IllegalArgumentException("The shipping address is not compatible with ProductGeos rules.");
                        }
                    }
                }
            }
        }
    }
    csi.setContactMechId(shippingContactMechId);
}
 
開發者ID:gildaslemoal,項目名稱:elpi,代碼行數:29,代碼來源:ShoppingCart.java


注:本文中的org.ofbiz.product.product.ProductWorker.isShippableToAddress方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。