[ 
https://issues.apache.org/jira/browse/OFBIZ-1255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12529920
 ] 

abhishake edited comment on OFBIZ-1255 at 9/24/07 10:20 AM:
------------------------------------------------------------

To solve this issue, I have written a JavaScript function in the header.ftl i.e.

<script type="text/javascript">
         function doSubmit(formName){

          //remove the jsessionid if present in th url
           var action1 = document.forms[formName].action;
                        if(action1.indexOf(";") > -1){
                                        action1 = 
action1.substr(0,action1.indexOf(";") );
                                
                                }
                //take url in the browser and substring the url with the start 
of ~
                var action2 = document.location.href;
                        if(action2){
                                if(action2.indexOf("~") > -1){
                                        var queryString = 
action2.substr(action2.indexOf("~") - 1);
                                        action1 = action1 + queryString ;
                                
                                }
                        }
                document.forms[formName].action = action1;
                document.forms[formName].submit();
          
          }
        </script>   


also login part is put under a form with following modification (resolves the 
problem faced after login)

<form method="post" action="<@ofbizUrl>checkLogin<#if   
requestAttributes._CURRENT_VIEW_?exists>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>"
 name="loginForm">

        <a 
href="javascript:doSubmit('loginForm');">${uiLabelMap.CommonLogin}</a>
                
</form>

and set locale part is modified as, (to resolve the problem while setting 
locale)

<form method="post" action="<@ofbizUrl>setSessionLocale<#if 
requestAttributes._CURRENT_VIEW_?exists>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>"
 name="localeForm">
           
              <select name="locale">
                <#list availableLocales as availableLocale>
                    <#assign langAttr = availableLocale.toString()?replace("_", 
"-")> 
                    <#assign langDir = "ltr">
                    <#if "ar.iw"?contains(langAttr?substring(0, 2)) && 
langAttr?substring(0, 2) =    docLangAttr?substring(0, 2)>
                        <#assign langDir = "rtl">
                    </#if>
                    <option lang="${langAttr}" dir="${langDir}" 
value="${availableLocale.toString()}"<#if locale.toString() = 
availableLocale.toString()> 
selected="selected"</#if>>${availableLocale.getDisplayName(locale)}</option>
                </#list>
              </select>
              <input type="button" value="${uiLabelMap.CommonSet}" 
onclick="doSubmit('localeForm')"/>
   </form>


I tested this and I found everything is working fine with it, also as per david 
suggestion, I tried doing this in the same way as add to cart funtionality.

Please advise me whether I have done this correctly.
also, I am new to ofbiz and I don't know how to submit patch. 

      was (Author: abhishake):
    To solve this issue, I have written a JavaScript function in the header.ftl 
i.e.

<script type="text/javascript">
         function doSubmit(formName){

          //remove the jsessionid if present in th url
           var action1 = document.forms[formName].action;
                        if(action1.indexOf(";") > -1){
                                        action1 = 
action1.substr(0,action1.indexOf(";") );
                                
                                }
                //take url in the browser and substring the url with the start 
of ~
                var action2 = document.location.href;
                        if(action2){
                                if(action2.indexOf("~") > -1){
                                        var queryString = 
action2.substr(action2.indexOf("~") - 1);
                                        action1 = action1 + queryString ;
                                
                                }
                        }
                document.forms[formName].action = action1;
                document.forms[formName].submit();
          
          }
        </script>   


also login part is put under a form with following modification (resolves the 
problem faced after login)

<form method="post" action="<@ofbizUrl>checkLogin<#if   
requestAttributes._CURRENT_VIEW_?exists>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>"
 name="loginForm">

        <a 
href="javascript:doSubmit('loginForm');">${uiLabelMap.CommonLogin}</a>
                
</form>

and set locale part is modified as,

<form method="post" action="<@ofbizUrl>setSessionLocale<#if 
requestAttributes._CURRENT_VIEW_?exists>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>"
 name="localeForm">
           
              <select name="locale">
                <#list availableLocales as availableLocale>
                    <#assign langAttr = availableLocale.toString()?replace("_", 
"-")> 
                    <#assign langDir = "ltr">
                    <#if "ar.iw"?contains(langAttr?substring(0, 2)) && 
langAttr?substring(0, 2) =    docLangAttr?substring(0, 2)>
                        <#assign langDir = "rtl">
                    </#if>
                    <option lang="${langAttr}" dir="${langDir}" 
value="${availableLocale.toString()}"<#if locale.toString() = 
availableLocale.toString()> 
selected="selected"</#if>>${availableLocale.getDisplayName(locale)}</option>
                </#list>
              </select>
              <input type="button" value="${uiLabelMap.CommonSet}" 
onclick="doSubmit('localeForm')"/>
   </form>


I tested this and I found everything is working fine with it, also as per david 
suggestion, I tried doing this in the same way as add to cart funtionality.

Please advise me whether I have done this correctly.
also, I am new to ofbiz and I don't know how to submit patch. 
  
> product not found for product id
> --------------------------------
>
>                 Key: OFBIZ-1255
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1255
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ecommerce
>    Affects Versions: Release Branch 4.0
>         Environment: Ubuntu 7.4
>            Reporter: abhishake
>             Fix For: Release Branch 4.0
>
>         Attachments: productdetail.png, Screenshot2.png
>
>
> when  we get login  after visiting  the product detail screen i.e I should 
> see the same product detail after login but this is not happening instead I 
> see a message " product not found for product id". This problem doesn't come 
> when you add the product to a cart from product detail screen and then get 
> login.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to