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/14 22:25:19 UTC

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

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="<@o...@ofbizUrl>" name="loginform">
+        <div class="screenlet-body" style="text-align: center;">          
+          <form method="post" action="<@o...@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));



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/

Posted by Jacques Le Roux <ja...@les7arts.com>.
David,

Okay, I will use _PREVIOUS_PARAMS_ for the login part and will keep a session attribute for the language change part.Actyally I'm
most interested by the language change part because I always found strange that when changing language you lost your current page.
And in some specific cases this is very annoying.

Thanks

Jacques


>
> Just a quick comment: we don't discourage putting things in the
> session, though too many things like this would be difficult to
> manage. The point of the _PREVIOUS_PARAMS_ thing is to handle these
> sorts of pass-on request parameters in a generic way rather than
> having to create custom and specific code for each.
>
> One way to spot this sort of problem is to keep in mind that
> something like a login page or script should be fairly generic and
> never need to know about products or categories or any other such thing.
>
> -David
>
>
> On Feb 15, 2007, at 9:46 AM, Jacques Le Roux wrote:
>
> > David,
> >
> > I have perhaps missed something, but I tried to use
> > _PREVIOUS_PARAMS_ and its usage seems much more complicated to me
> > (including
> > CategoryWorker getTrail and setTrail methods). And I can't see
> > clearly its advantages under a simple session attribute.
> > Besides, I noticed several use of session attributes in OFBiz
> > (in .bsh I mean). Why do you discourage its usage in these particular
> > cases (keeping in session the opened category/product page to
> > recall it when login or changing languages) ?
> >
> > Thanks
> >
> > Jacques
> >
> > ----- Original Message -----
> > From: "David E. Jones" <jo...@hotwaxmedia.com>
> > To: <de...@ofbiz.apache.org>
> > Sent: Thursday, February 15, 2007 12:27 AM
> > Subject: 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/
> >
> >
> >>
> >> No problem Jacques, thanks for taking a second look at it.
> >>
> >> -David
> >>
> >>
> >> On Feb 14, 2007, at 3:53 PM, Jacques Le Roux wrote:
> >>
> >>> David,
> >>>
> >>>>
> >>>> 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.
> >>>
> >>> OK, I revert and will try to use _PREVIOUS_PARAMS_ hoping I will be
> >>> able to do the same things also simply.
> >>>
> >>>> What is the reason why that is not, or can not, take care of this?
> >>>
> >>> I just quickly followed the path Baga opened because it was easy.
> >>> That's why I asked for review. Because I foresaw that this was not
> >>> a standard way of doing this kind of things.
> >>>
> >>> Jacques
> >>>
> >>>> -David
> >>>>
> >>>>
> >>>> On Feb 14, 2007, at 2:25 PM, jleroux@apache.org 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));
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>
> >>
> >>
> >
>
>


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/

Posted by "David E. Jones" <jo...@hotwaxmedia.com>.
Just a quick comment: we don't discourage putting things in the  
session, though too many things like this would be difficult to  
manage. The point of the _PREVIOUS_PARAMS_ thing is to handle these  
sorts of pass-on request parameters in a generic way rather than  
having to create custom and specific code for each.

One way to spot this sort of problem is to keep in mind that  
something like a login page or script should be fairly generic and  
never need to know about products or categories or any other such thing.

-David


On Feb 15, 2007, at 9:46 AM, Jacques Le Roux wrote:

> David,
>
> I have perhaps missed something, but I tried to use  
> _PREVIOUS_PARAMS_ and its usage seems much more complicated to me  
> (including
> CategoryWorker getTrail and setTrail methods). And I can't see  
> clearly its advantages under a simple session attribute.
> Besides, I noticed several use of session attributes in OFBiz  
> (in .bsh I mean). Why do you discourage its usage in these particular
> cases (keeping in session the opened category/product page to  
> recall it when login or changing languages) ?
>
> Thanks
>
> Jacques
>
> ----- Original Message -----
> From: "David E. Jones" <jo...@hotwaxmedia.com>
> To: <de...@ofbiz.apache.org>
> Sent: Thursday, February 15, 2007 12:27 AM
> Subject: 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/
>
>
>>
>> No problem Jacques, thanks for taking a second look at it.
>>
>> -David
>>
>>
>> On Feb 14, 2007, at 3:53 PM, Jacques Le Roux wrote:
>>
>>> David,
>>>
>>>>
>>>> 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.
>>>
>>> OK, I revert and will try to use _PREVIOUS_PARAMS_ hoping I will be
>>> able to do the same things also simply.
>>>
>>>> What is the reason why that is not, or can not, take care of this?
>>>
>>> I just quickly followed the path Baga opened because it was easy.
>>> That's why I asked for review. Because I foresaw that this was not
>>> a standard way of doing this kind of things.
>>>
>>> Jacques
>>>
>>>> -David
>>>>
>>>>
>>>> On Feb 14, 2007, at 2:25 PM, jleroux@apache.org 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));
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>


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/

Posted by Jacques Le Roux <ja...@les7arts.com>.
David,

I have perhaps missed something, but I tried to use _PREVIOUS_PARAMS_ and its usage seems much more complicated to me (including
CategoryWorker getTrail and setTrail methods). And I can't see clearly its advantages under a simple session attribute.
Besides, I noticed several use of session attributes in OFBiz (in .bsh I mean). Why do you discourage its usage in these particular
cases (keeping in session the opened category/product page to recall it when login or changing languages) ?

Thanks

Jacques

----- Original Message ----- 
From: "David E. Jones" <jo...@hotwaxmedia.com>
To: <de...@ofbiz.apache.org>
Sent: Thursday, February 15, 2007 12:27 AM
Subject: 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/


>
> No problem Jacques, thanks for taking a second look at it.
>
> -David
>
>
> On Feb 14, 2007, at 3:53 PM, Jacques Le Roux wrote:
>
> > David,
> >
> >>
> >> 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.
> >
> > OK, I revert and will try to use _PREVIOUS_PARAMS_ hoping I will be
> > able to do the same things also simply.
> >
> >> What is the reason why that is not, or can not, take care of this?
> >
> > I just quickly followed the path Baga opened because it was easy.
> > That's why I asked for review. Because I foresaw that this was not
> > a standard way of doing this kind of things.
> >
> > Jacques
> >
> >> -David
> >>
> >>
> >> On Feb 14, 2007, at 2:25 PM, jleroux@apache.org 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));
> >>>
> >>>
> >>
> >>
> >
>
>


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/

Posted by "David E. Jones" <jo...@hotwaxmedia.com>.
No problem Jacques, thanks for taking a second look at it.

-David


On Feb 14, 2007, at 3:53 PM, Jacques Le Roux wrote:

> David,
>
>>
>> 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.
>
> OK, I revert and will try to use _PREVIOUS_PARAMS_ hoping I will be  
> able to do the same things also simply.
>
>> What is the reason why that is not, or can not, take care of this?
>
> I just quickly followed the path Baga opened because it was easy.  
> That's why I asked for review. Because I foresaw that this was not
> a standard way of doing this kind of things.
>
> Jacques
>
>> -David
>>
>>
>> On Feb 14, 2007, at 2:25 PM, jleroux@apache.org 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));
>>>
>>>
>>
>>
>


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/

Posted by Jacques Le Roux <ja...@les7arts.com>.
David,

>
> 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.

OK, I revert and will try to use _PREVIOUS_PARAMS_ hoping I will be able to do the same things also simply.

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

I just quickly followed the path Baga opened because it was easy. That's why I asked for review. Because I foresaw that this was not
a standard way of doing this kind of things.

Jacques

> -David
>
>
> On Feb 14, 2007, at 2:25 PM, jleroux@apache.org 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));
> >
> >
>
>


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/

Posted by "David E. Jones" <jo...@undersunconsulting.com>.
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, jleroux@apache.org 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));
>
>


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/

Posted by "David E. Jones" <jo...@undersunconsulting.com>.
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, jleroux@apache.org 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));
>
>