You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2011/01/24 12:24:26 UTC

svn commit: r1062733 - in /ofbiz/trunk/applications/order: src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java webapp/ordermgr/entry/catalog/productdetail.ftl

Author: jleroux
Date: Mon Jan 24 11:24:26 2011
New Revision: 1062733

URL: http://svn.apache.org/viewvc?rev=1062733&view=rev
Log:
A patch from Leon "Desired Delivery Date and comment are lost when selecting a variant product into shopping cart" (https://issues.apache.org/jira/browse/OFBIZ-4133) - OFBIZ-4133

>From "ordermgr/control/additem/product" page, if you try to select a "virtual" product into shopping cart with some comments or "desired delivery date" input, you'll be redirect to varaints selection page. After you select neccessary features and submit, the variant product appears in shopping cart item list, but the comments and "desired delivery date" you input ealier is lost.
1. add some hidden fields to store the values from previous "additem" form
2. add paramMap to request attributes in case those values were lost again if an error occurs

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1062733&r1=1062732&r2=1062733&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Mon Jan 24 11:24:26 2011
@@ -264,6 +264,7 @@ public class ShoppingCartEvents {
 
                 // check if features are selected
                 if (UtilValidate.isEmpty(selectedFeatures)) {
+                    request.setAttribute("paramMap", paramMap);
                     request.setAttribute("product_id", productId);
                     request.setAttribute("_EVENT_MESSAGE_", UtilProperties.getMessage(resource_error, "cart.addToCart.chooseVariationBeforeAddingToCart", locale));
                     return "product";
@@ -273,12 +274,14 @@ public class ShoppingCartEvents {
                 if (UtilValidate.isNotEmpty(variantProductId)) {
                     productId = variantProductId;
                 } else {
+                    request.setAttribute("paramMap", paramMap);
                     request.setAttribute("product_id", productId);
                     request.setAttribute("_EVENT_MESSAGE_", UtilProperties.getMessage(resource_error, "cart.addToCart.incompatibilityVariantFeature", locale));
                     return "product";
                 }
 
             } else {
+                request.setAttribute("paramMap", paramMap);
                 request.setAttribute("product_id", productId);
                 request.setAttribute("_EVENT_MESSAGE_", UtilProperties.getMessage(resource_error, "cart.addToCart.chooseVariationBeforeAddingToCart", locale));
                 return "product";

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl?rev=1062733&r1=1062732&r2=1062733&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl Mon Jan 24 11:24:26 2011
@@ -433,6 +433,12 @@ ${virtualJavaScript?if_exists}
       </#if>
 
       <form method="post" action="<@ofbizUrl>additem<#if requestAttributes._CURRENT_VIEW_?exists>/${requestAttributes._CURRENT_VIEW_}</#...@ofbizUrl>" name="addform"  style="margin: 0;">
+        <#if requestAttributes.paramMap?has_content>
+          <input type="hidden" name="itemComment" value="${requestAttributes.paramMap.itemComment?if_exists}" />
+          <input type="hidden" name="shipBeforeDate" value="${requestAttributes.paramMap.shipBeforeDate?if_exists}" />
+          <input type="hidden" name="shipAfterDate" value="${requestAttributes.paramMap.shipAfterDate?if_exists}" />
+          <input type="hidden" name="itemDesiredDeliveryDate" value="${requestAttributes.paramMap.itemDesiredDeliveryDate?if_exists}" />
+        </#if>
         <#assign inStock = true>
         <#-- Variant Selection -->
         <#if product.isVirtual?if_exists?upper_case == "Y">