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 2007/02/16 18:26:02 UTC

svn commit: r508502 - in /ofbiz/trunk/applications: ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh

Author: jleroux
Date: Fri Feb 16 09:26:00 2007
New Revision: 508502

URL: http://svn.apache.org/viewvc?view=rev&rev=508502
Log:
Deals with the problem reported by Baga Raj in https://issues.apache.org/jira/browse/OFBIZ-724 "After choosing Sidedeepcategory and then getting loged in it shows the error like - Product Category Not Found for this Id!"
in a standard way using _PREVIOUS_PARAM_ as recommended by David.
However I kept the category_id session attribute to deal with languages changes. 

I quickly tried to come back to a product page if opened but I finally kept as it is (come back to the product's category page).
I open a trivial Jira issue for this case as I feel that I will need something like that in some future.

Modified:
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh?view=diff&rev=508502&r1=508501&r2=508502
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh Fri Feb 16 09:26:00 2007
@@ -21,7 +21,11 @@
 
 catalogId = CatalogWorker.getCurrentCatalogId(request);
 promoCat = CatalogWorker.getCatalogPromotionsCategoryId(request, catalogId);
-request.setAttribute("productCategoryId", promoCat);
-
-
 
+productCategoryId = session.getAttribute("productCategoryId");
+if (productCategoryId == null) {
+    request.setAttribute("productCategoryId", promoCat);    
+}
+else {
+    request.setAttribute("productCategoryId", productCategoryId);    
+}

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh?view=diff&rev=508502&r1=508501&r2=508502
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh Fri Feb 16 09:26:00 2007
@@ -25,6 +25,7 @@
 import org.ofbiz.base.util.*;
 import org.ofbiz.entity.*;
 import org.ofbiz.product.catalog.*;
+import org.ofbiz.product.category.CategoryWorker;
 
 detailScreen = "categorydetail";
 catalogName = CatalogWorker.getCatalogName(request);
@@ -34,6 +35,19 @@
     productCategoryId = parameters.get("category_id");
 }
 context.put("productCategoryId", productCategoryId);
+
+if (productCategoryId != null) {
+    session.setAttribute("productCategoryId",productCategoryId);// for language change
+    previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
+    if (previousParams != null && previousParams.length() > 0) {
+        previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, UtilMisc.toList("category_id"));
+        previousParams = previousParams + "&category_id=" + productCategoryId;
+    } else {
+        previousParams = "category_id=" + productCategoryId;
+    }
+    session.setAttribute("_PREVIOUS_PARAMS_", previousParams);    // for login
+    context.put("previousParams", previousParams);
+}    
 
 category = delegator.findByPrimaryKeyCache("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId));
 if (category != null) {

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh?view=diff&rev=508502&r1=508501&r2=508502
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh Fri Feb 16 09:26:00 2007
@@ -36,6 +36,18 @@
 detailScreen = "productdetail";
 productId = requestParams.get("product_id");
 
+if (productId != null) {
+    previousParams = session.getAttribute("_PREVIOUS_PARAMS_"); 
+    if (previousParams != null && previousParams.length() > 0) {
+        previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, UtilMisc.toList("product_id"));
+        previousParams = previousParams + "&product_id=" + productId;
+    } else {
+        previousParams = "product_id=" + productId;
+    }
+    session.setAttribute("_PREVIOUS_PARAMS_", previousParams);    // for login
+    context.put("previousParams", previousParams);
+}    
+
 // get the product entity
 if (productId != null) {
     product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));