svn commit: r931595 - in /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart: ShoppingCart.java shipping/ShippingEvents.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r931595 - in /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart: ShoppingCart.java shipping/ShippingEvents.java

doogie-3
Author: doogie
Date: Wed Apr  7 15:47:34 2010
New Revision: 931595

URL: http://svn.apache.org/viewvc?rev=931595&view=rev
Log:
Make ShoppingCart.getProductStoreShipMethId() work with the multiple
shipgroup system.  This fixes a bug, where multiple
ProductStoreShipmentMeth are configured, each one using the *same*
carrierPartyId and shipmentMethodTypeId, but have different cost
estimates attached, while making use of include/exclude geos, and other
restrictions.  In effect, no matter what specific
ProductStoreShipmentMeth you selected, when updating the total shipping
estimates(for display on a summary cart screen), it would try to do a
find on just the carrierPartyId/shipmentMethodTypeId pair, and basically
choose one at random.  So if there were multiple configured estimates on
USPS/FIRST_CLASS, it was unknown which would be chosen.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=931595&r1=931594&r2=931595&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Wed Apr  7 15:47:34 2010
@@ -89,7 +89,6 @@ public class ShoppingCart implements Ite
     private String quoteId = null;
     private String workEffortId = null;
     private long nextItemSeq = 1;
-    private String productStoreShipMethId = null;
 
     private String defaultItemDeliveryDate = null;
     private String defaultItemComment = null;
@@ -2362,12 +2361,22 @@ public class ShoppingCart implements Ite
         return this.getCarrierPartyId(0);
     }
 
+    public String getProductStoreShipMethId(int idx) {
+        CartShipInfo csi = this.getShipInfo(idx);
+        return csi.productStoreShipMethId;
+    }
+
     public String getProductStoreShipMethId() {
-        return productStoreShipMethId;
+        return this.getProductStoreShipMethId(0);
+    }
+
+    public void setProductStoreShipMethId(int idx, String productStoreShipMethId) {
+        CartShipInfo csi = this.getShipInfo(idx);
+        csi.productStoreShipMethId = productStoreShipMethId;
     }
 
     public void setProductStoreShipMethId(String productStoreShipMethId) {
-        this.productStoreShipMethId = productStoreShipMethId;
+        this.setProductStoreShipMethId(0, productStoreShipMethId);
     }
 
     public void setShipGroupFacilityId(int idx, String facilityId) {
@@ -4326,6 +4335,7 @@ public class ShoppingCart implements Ite
         public Timestamp shipAfterDate = null;
         private String shipGroupSeqId = null;
         public String vendorPartyId = null;
+        public String productStoreShipMethId = null;
         public Map<String, Object> attributes = FastMap.newInstance();
 
         public void setAttribute(String name, Object value) {

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java?rev=931595&r1=931594&r2=931595&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java Wed Apr  7 15:47:34 2010
@@ -100,7 +100,7 @@ public class ShippingEvents {
 
         String shipmentMethodTypeId = cart.getShipmentMethodTypeId(groupNo);
         String carrierPartyId = cart.getCarrierPartyId(groupNo);
-        String productStoreShipMethId = cart.getProductStoreShipMethId();
+        String productStoreShipMethId = cart.getProductStoreShipMethId(groupNo);
 
         return getShipGroupEstimate(dispatcher, delegator, cart.getOrderType(), shipmentMethodTypeId, carrierPartyId, null,
                 cart.getShippingContactMechId(groupNo), cart.getProductStoreId(), cart.getSupplierPartyId(groupNo), cart.getShippableItemInfo(groupNo),