Author: jonesde
Date: Tue Feb 27 18:14:51 2007
New Revision: 512564

URL: http://svn.apache.org/viewvc?view=rev&rev=512564
Log:
Some small cleanups and an enhancement for the ListPriceRangeConstraint 
parameters in ProductSearchSession to be more flexible, especially with a 
single parameter for both low and high values

Modified:
    
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/advancedsearchprep.bsh
    
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java

Modified: 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/advancedsearchprep.bsh
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/advancedsearchprep.bsh?view=diff&rev=512564&r1=512563&r2=512564
==============================================================================
--- 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/advancedsearchprep.bsh
 (original)
+++ 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/advancedsearchprep.bsh
 Tue Feb 27 18:14:51 2007
@@ -22,8 +22,6 @@
 import org.ofbiz.product.feature.*;
 import org.ofbiz.product.product.*;
 
-delegator = request.getAttribute("delegator");
-
 productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 
2000);
 productFeatureTypeIdsOrdered = new ArrayList(new 
TreeSet(productFeaturesByTypeMap.keySet()));
 

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java?view=diff&rev=512564&r1=512563&r2=512564
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java
 Tue Feb 27 18:14:51 2007
@@ -511,6 +511,31 @@
             searchAddConstraint(new 
ProductSearch.ListPriceRangeConstraint(listPriceLow, listPriceHigh, 
listPriceCurrency), session);
             constraintsChanged = true;
         }
+        if (UtilValidate.isNotEmpty((String) 
parameters.get("LIST_PRICE_RANGE"))) {
+            String listPriceRangeStr = (String) 
parameters.get("LIST_PRICE_RANGE");
+            String listPriceLowStr = listPriceRangeStr.substring(0, 
listPriceRangeStr.indexOf("_")); 
+            String listPriceHighStr = 
listPriceRangeStr.substring(listPriceRangeStr.indexOf("_") + 1); 
+
+            Double listPriceLow = null;
+            Double listPriceHigh = null;
+            String listPriceCurrency = UtilHttp.getCurrencyUom(request);
+            if (UtilValidate.isNotEmpty(listPriceLowStr)) {
+                try {
+                    listPriceLow = Double.valueOf(listPriceLowStr);
+                } catch (NumberFormatException e) {
+                    Debug.logError("Error parsing low part of LIST_PRICE_RANGE 
parameter [" + listPriceLowStr + "]: " + e.toString(), module);
+                }
+            }
+            if (UtilValidate.isNotEmpty(listPriceHighStr)) {
+                try {
+                    listPriceHigh = Double.valueOf(listPriceHighStr);
+                } catch (NumberFormatException e) {
+                    Debug.logError("Error parsing high part of 
LIST_PRICE_RANGE parameter [" + listPriceHighStr + "]: " + e.toString(), 
module);
+                }
+            }
+            searchAddConstraint(new 
ProductSearch.ListPriceRangeConstraint(listPriceLow, listPriceHigh, 
listPriceCurrency), session);
+            constraintsChanged = true;
+        }
         
         // check the ProductStore to see if we should add the 
ExcludeVariantsConstraint
         if (productStore != null && 
!"N".equals(productStore.getString("prodSearchExcludeVariants"))) {


Reply via email to