svn commit: r507698 - in /ofbiz/trunk/applications: ecommerce/webapp/ecommerce/ ecommerce/webapp/ecommerce/WEB-INF/actions/ order/webapp/ordermgr/WEB-INF/actions/entry/catalog/

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

svn commit: r507698 - in /ofbiz/trunk/applications: ecommerce/webapp/ecommerce/ ecommerce/webapp/ecommerce/WEB-INF/actions/ order/webapp/ordermgr/WEB-INF/actions/entry/catalog/

jleroux@apache.org
Author: jleroux
Date: Wed Feb 14 13:25:18 2007
New Revision: 507698

URL: http://svn.apache.org/viewvc?view=rev&rev=507698
Log:
From an idea and a kind of patch (word .doc :o) from 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!"

After some refactoring I applied his "patch" and extended it to deal with changes of languages case.
So now you can change the lanquages and keep the same category/product page open.

I can't see any problems. But please if you see an obvious one tell me, I will soon revert. Thanks

Modified:
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/login.bsh
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl
    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/login.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/login.bsh?view=diff&rev=507698&r1=507697&r2=507698
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/login.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/login.bsh Wed Feb 14 13:25:18 2007
@@ -22,7 +22,16 @@
 import org.ofbiz.webapp.control.*;
 
 context.put("autoUserLogin", session.getAttribute("autoUserLogin"));
-context.put("autoLogoutUrl", LoginWorker.makeLoginUrl(request, "autoLogout"));
+context.put("autoLogoutUrl", LoginWorker.makeLoginUrl(request, "autoLogout"));
+
+productId = session.getAttribute("productId");
+if(productId != null) {
+    context.put("productId",productId);
+}
+productCategoryId = session.getAttribute("productCategoryId");
+if(productCategoryId != null) {
+    context.put("productCategoryId",productCategoryId);
+}
 
 previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
 if (previousParams != null && previousParams.length() > 0) {

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=507698&r1=507697&r2=507698
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh Wed Feb 14 13:25:18 2007
@@ -21,5 +21,13 @@
 
 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/ecommerce/webapp/ecommerce/login.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl?view=diff&rev=507698&r1=507697&r2=507698
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl Wed Feb 14 13:25:18 2007
@@ -33,8 +33,8 @@
         <div class="screenlet-header">
             <div class="boxhead">${uiLabelMap.CommonRegistered}</div>
         </div>
-        <div class="screenlet-body" style="text-align: center;">
-          <form method="post" action="<@ofbizUrl>login${previousParams}</@ofbizUrl>" name="loginform">
+        <div class="screenlet-body" style="text-align: center;">          
+          <form method="post" action="<@ofbizUrl>login${previousParams?if_exists}?category_id=${productCategoryId?if_exists}&product_id=${productId?if_exists}</@ofbizUrl>" name="loginform">          
               <div class="tabletext">
                   ${uiLabelMap.CommonUsername}:&nbsp;
                   <input type="text" class="inputBox" name="USERNAME" value="<#if requestParameters.USERNAME?has_content>${requestParameters.USERNAME}<#elseif autoUserLogin?has_content>${autoUserLogin.userLoginId}</#if>" size="20"/>

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=507698&r1=507697&r2=507698
==============================================================================
--- 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 Wed Feb 14 13:25:18 2007
@@ -29,11 +29,17 @@
 detailScreen = "categorydetail";
 catalogName = CatalogWorker.getCatalogName(request);
 delegator = request.getAttribute("delegator");
+
 productCategoryId = request.getAttribute("productCategoryId");
 if (productCategoryId == null) {
     productCategoryId = parameters.get("category_id");
 }
+
 context.put("productCategoryId", productCategoryId);
+
+if (productCategoryId != null) {
+    session.setAttribute("productCategoryId",productCategoryId);
+}
 
 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=507698&r1=507697&r2=507698
==============================================================================
--- 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 Wed Feb 14 13:25:18 2007
@@ -36,6 +36,10 @@
 detailScreen = "productdetail";
 productId = requestParams.get("product_id");
 
+if(productId != null) {
+    session.setAttribute("productId",productId);
+}
+
 // get the product entity
 if (productId != null) {
     product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r507698 - in /ofbiz/trunk/applications: ecommerce/webapp/ecommerce/ ecommerce/webapp/ecommerce/WEB-INF/actions/ order/webapp/ordermgr/WEB-INF/actions/entry/catalog/

David E Jones-2

This change concerns me, and strikes me as not the best way to solve  
the problem.

The normal _PREVIOUS_PARAMS_ stuff should take care of this requirement.

What is the reason why that is not, or can not, take care of this?

-David


On Feb 14, 2007, at 2:25 PM, [hidden email] wrote:

> Author: jleroux
> Date: Wed Feb 14 13:25:18 2007
> New Revision: 507698
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=507698
> Log:
> From an idea and a kind of patch (word .doc :o) from 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!"
>
> After some refactoring I applied his "patch" and extended it to  
> deal with changes of languages case.
> So now you can change the lanquages and keep the same category/
> product page open.
>
> I can't see any problems. But please if you see an obvious one tell  
> me, I will soon revert. Thanks
>
> Modified:
>     ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/
> actions/login.bsh
>     ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/
> actions/main.bsh
>     ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl
>     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/login.bsh
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ 
> ecommerce/webapp/ecommerce/WEB-INF/actions/login.bsh?
> view=diff&rev=507698&r1=507697&r2=507698
> ======================================================================
> ========
> --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/
> actions/login.bsh (original)
> +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/
> actions/login.bsh Wed Feb 14 13:25:18 2007
> @@ -22,7 +22,16 @@
>  import org.ofbiz.webapp.control.*;
>
>  context.put("autoUserLogin", session.getAttribute("autoUserLogin"));
> -context.put("autoLogoutUrl", LoginWorker.makeLoginUrl(request,  
> "autoLogout"));
> +context.put("autoLogoutUrl", LoginWorker.makeLoginUrl(request,  
> "autoLogout"));
> +
> +productId = session.getAttribute("productId");
> +if(productId != null) {
> +    context.put("productId",productId);
> +}
> +productCategoryId = session.getAttribute("productCategoryId");
> +if(productCategoryId != null) {
> +    context.put("productCategoryId",productCategoryId);
> +}
>
>  previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
>  if (previousParams != null && previousParams.length() > 0) {
>
> 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=507698&r1=507697&r2=507698
> ======================================================================
> ========
> --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/
> actions/main.bsh (original)
> +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/
> actions/main.bsh Wed Feb 14 13:25:18 2007
> @@ -21,5 +21,13 @@
>
>  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/ecommerce/webapp/ecommerce/
> login.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ 
> ecommerce/webapp/ecommerce/login.ftl?
> view=diff&rev=507698&r1=507697&r2=507698
> ======================================================================
> ========
> --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl  
> (original)
> +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/login.ftl  
> Wed Feb 14 13:25:18 2007
> @@ -33,8 +33,8 @@
>          <div class="screenlet-header">
>              <div class="boxhead">${uiLabelMap.CommonRegistered}</div>
>          </div>
> -        <div class="screenlet-body" style="text-align: center;">
> -          <form method="post" action="<@ofbizUrl>login$
> {previousParams}</@ofbizUrl>" name="loginform">
> +        <div class="screenlet-body" style="text-align: center;">
> +          <form method="post" action="<@ofbizUrl>login$
> {previousParams?if_exists}?category_id=${productCategoryId?
> if_exists}&product_id=${productId?if_exists}</@ofbizUrl>"  
> name="loginform">
>                <div class="tabletext">
>                    ${uiLabelMap.CommonUsername}:&nbsp;
>                    <input type="text" class="inputBox"  
> name="USERNAME" value="<#if requestParameters.USERNAME?has_content>$
> {requestParameters.USERNAME}<#elseif autoUserLogin?has_content>$
> {autoUserLogin.userLoginId}</#if>" size="20"/>
>
> 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=507698&r1=507697&r2=507698
> ======================================================================
> ========
> --- 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 Wed Feb 14 13:25:18 2007
> @@ -29,11 +29,17 @@
>  detailScreen = "categorydetail";
>  catalogName = CatalogWorker.getCatalogName(request);
>  delegator = request.getAttribute("delegator");
> +
>  productCategoryId = request.getAttribute("productCategoryId");
>  if (productCategoryId == null) {
>      productCategoryId = parameters.get("category_id");
>  }
> +
>  context.put("productCategoryId", productCategoryId);
> +
> +if (productCategoryId != null) {
> +    session.setAttribute("productCategoryId",productCategoryId);
> +}
>
>  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=507698&r1=507697&r2=507698
> ======================================================================
> ========
> --- 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 Wed Feb 14 13:25:18 2007
> @@ -36,6 +36,10 @@
>  detailScreen = "productdetail";
>  productId = requestParams.get("product_id");
>
> +if(productId != null) {
> +    session.setAttribute("productId",productId);
> +}
> +
>  // get the product entity
>  if (productId != null) {
>      product = delegator.findByPrimaryKeyCache("Product",  
> UtilMisc.toMap("productId", productId));
>
>


smime.p7s (3K) Download Attachment