KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: lrkwz on December 09, 2009, 09:17:03 pm

Title: No newProducs after SetLocale_xx_XX.do !?
Post by: lrkwz on December 09, 2009, 09:17:03 pm
If as firsts action in a new instance of a browser i go to http://localhost:8780/konakart/SetLocale_it_IT.do I am forwarded to Welcome.do with no newProducts.
If I go to http://localhost:8780/konakart/Welcome.do then to http://localhost:8780/konakart/SetLocale_it_IT.do I'm redirected back to the Welcome.do page correctly populated.

I do not want users to have to choose their interface language so I would like to define two virtual hosts such as:


It seems that the prodMgr's newProducts property is empty at firrst access if forwarded from SetLocale_xx_XX.do
Title: Re: No newProducs after SetLocale_xx_XX.do !?
Post by: lrkwz on December 09, 2009, 09:32:12 pm
Same proble even if I configure in struts-config

      <action path="/SetLocale_it_IT" type="com.konakart.actions.SetLocaleAction" parameter="it_IT">
         <forward name="SetLocale" path="/CatalogMainPage.do" redirect="true"/>
      </action>
Title: Re: No newProducs after SetLocale_xx_XX.do !?
Post by: Sony George on December 10, 2009, 06:47:17 am
Quote from: lrkwz on December 09, 2009, 09:17:03 pm
If as firsts action in a new instance of a browser i go to http://localhost:8780/konakart/SetLocale_it_IT.do I am forwarded to Welcome.do with no newProducts.
If I go to http://localhost:8780/konakart/Welcome.do then to http://localhost:8780/konakart/SetLocale_it_IT.do I'm redirected back to the Welcome.do page correctly populated.

I do not want users to have to choose their interface language so I would like to define two virtual hosts such as:

  • www.mysite.com --> forwards requests to Tomcat/kk

  • www.mysite.it    --> redirect to www.mysite.com/konakart/SetLocale_it_IT.do



It seems that the prodMgr's newProducts property is empty at firrst access if forwarded from SetLocale_xx_XX.do



I also face this problem, but the main problem for me is,
this do not happen always, still did not get a chance to re-produce this problem for a debug
to report to konakart
Title: Re: No newProducs after SetLocale_xx_XX.do !?
Post by: lrkwz on December 10, 2009, 09:59:35 am
Here are few simple steps to reproduce the problem.



Menu is in german (so you can verify locale has benn changed correctly).
The page shows no products.

Thank click ok Konakart logo (goto Welcome.do), product list appears!
Title: Re: No newProducs after SetLocale_xx_XX.do !?
Post by: lrkwz on December 10, 2009, 05:39:36 pm
No comments? I think THIS is  a bug
Title: Re: No newProducs after SetLocale_xx_XX.do !?
Post by: Sony George on December 10, 2009, 06:01:24 pm
Quote from: lrkwz on December 10, 2009, 05:39:36 pm
No comments? I think THIS is  a bug


a work around for this is to add these line just before

return mapping.findForward("SetLocale");  of SetLocaleAction.java


// Get the new products for all categories
kkAppEng.getProductMgr().fetchNewProductsArray(ProductMgr.DONT_INCLUDE);

Title: Re: No newProducs after SetLocale_xx_XX.do !?
Post by: lrkwz on December 14, 2009, 10:38:54 am
Ok thank you ... quite fixed ... still the name of the products is in the site default language ...

I've tried kkAppEng.SetLangId() with no success :-(
Title: Re: No newProducs after SetLocale_xx_XX.do !? (i18n problem)
Post by: lrkwz on December 14, 2009, 10:10:23 pm
Got it!

In webapps/konakart/WEB-INF/jsp/NewProductsWithDetail.jsp


39             <div class="tile-content">
40                 <table class="tile-content" width="98%">
41                     <% int i=0; %>
42                     <tr>
43                         <logic:iterate id="prod" name="prodArray" length="maxRows" type="com.konakart.appif.ProductIf">
44                             <%prod = kkEng.getEng().getProductWithOptions(kkEng.getSessionId(),prod.getId(),-1, kkEng.getFetchProdOptions());%>


Remove line 44 which overwrites prod with default language contents.
Title: Re: No newProducs after SetLocale_xx_XX.do !? (i18n problem)
Post by: Sony George on December 15, 2009, 04:49:10 am
Quote from: lrkwz on December 14, 2009, 10:10:23 pm
Got it!

In webapps/konakart/WEB-INF/jsp/NewProductsWithDetail.jsp


39             <div class="tile-content">
40                 <table class="tile-content" width="98%">
41                     <% int i=0; %>
42                     <tr>
43                         <logic:iterate id="prod" name="prodArray" length="maxRows" type="com.konakart.appif.ProductIf">
44                             <%prod = kkEng.getEng().getProductWithOptions(kkEng.getSessionId(),prod.getId(),-1, kkEng.getFetchProdOptions());%>


Remove line 44 which overwrites prod with default language contents.



replace the line 44 with this

44                             <%prod = kkEng.getEng().getProductWithOptions(kkEng.getSessionId(),prod.getId(),kkAppEng.getLangId(), kkEng.getFetchProdOptions());%>

when -1 is passed, the default language set in the admin app is used to get the content
kkAppEng.getLangId() gives the current language in the logged in user session

Title: Re: No newProducs after SetLocale_xx_XX.do !? (i18n problem)
Post by: Sony George on December 15, 2009, 06:48:26 pm
Quote from: Sony George on December 15, 2009, 04:49:10 am
Quote from: lrkwz on December 14, 2009, 10:10:23 pm
Got it!

In webapps/konakart/WEB-INF/jsp/NewProductsWithDetail.jsp


39             <div class="tile-content">
40                 <table class="tile-content" width="98%">
41                     <% int i=0; %>
42                     <tr>
43                         <logic:iterate id="prod" name="prodArray" length="maxRows" type="com.konakart.appif.ProductIf">
44                             <%prod = kkEng.getEng().getProductWithOptions(kkEng.getSessionId(),prod.getId(),-1, kkEng.getFetchProdOptions());%>


Remove line 44 which overwrites prod with default language contents.



replace the line 44 with this

44                             <%prod = kkEng.getEng().getProductWithOptions(kkEng.getSessionId(),prod.getId(),kkAppEng.getLangId(), kkEng.getFetchProdOptions());%>

when -1 is passed, the default language set in the admin app is used to get the content
kkAppEng.getLangId() gives the current language in the logged in user session




Sorry for the mistake, it is not kkAppEng.getLangId() it is kkEng.getLangId()

44                             <%prod = kkEng.getEng().getProductWithOptions(kkEng.getSessionId(),prod.getId(),kkEng.getLangId(), kkEng.getFetchProdOptions());%>