svn commit: r619679 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

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

svn commit: r619679 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

sichen
Author: sichen
Date: Thu Feb  7 14:55:39 2008
New Revision: 619679

URL: http://svn.apache.org/viewvc?rev=619679&view=rev
Log:
Add support for calculating prices based on survey responses in the cart.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=619679&r1=619678&r2=619679&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Thu Feb  7 14:55:39 2008
@@ -1073,7 +1073,14 @@
                     priceContext.put("productStoreId", cart.getProductStoreId());
                     priceContext.put("agreementId", cart.getAgreementId());
                     priceContext.put("productPricePurposeId", "PURCHASE");
-                    priceContext.put("checkIncludeVat", "Y");
+                    priceContext.put("checkIncludeVat", "Y");
+
+                    // check if a survey is associated with the item and add to the price calculation
+                    List surveyResponses = (List) getAttribute("surveyResponses");
+                    if (surveyResponses != null && surveyResponses.size() > 0) {
+                        priceContext.put("surveyResponseId", surveyResponses.get(0));
+                    }
+
                     Map priceResult = dispatcher.runSync("calculateProductPrice", priceContext);
                     if (ServiceUtil.isError(priceResult)) {
                         throw new CartItemModifyException("There was an error while calculating the price: " + ServiceUtil.getErrorMessage(priceResult));