• Welcome to KonaKart Community Forum. Please login or sign up.
 

problem with getDescription()

Started by Anni, November 23, 2007, 10:50:35 am

Previous topic - Next topic

Anni

hi again,

I got another problem. on the shop's home page I want to display the latest product with its description. getting the correct image and the product name is no problem. however, when I try to insert the product description via its getDescription()-method, only null is displayed.  ???
any idea, what went wrong? because it works perfectly on the product's details page ...

regards,
anni

julie

Hi Anni,

When we get an array of products the description isn't fetched because it can be very long and so could stifle performance. In order to get it you have to call the getProduct() method of the engine passing it the language id and the product id. It will return one product including its description in the language that you specify.

Regards,

Julie

Anni

hi julie,

thanks for the answer.
how would I do that in the jsp? something like: kkEng.getProduct(prodId, langID).getDescription()?

regards,
anni

Anni

ok, I've tried that, but it seems to be wrong. now, that jsp isn't displayed anymore.

how do I do this correctly?

regards,
anni

julie

Hi Anni,

This is what you need to do :

if (prod.getDescription() == null ) {

   prod = kkEng.getEng().getProduct(kkEng.getSessionId(), prod.getId(), kkEng.getLangId());

        }


Anni

thanks :) works perfectly now!

regards,
anni

Anni

ok, now I've encountered another problem. next to the latest product I plan to display the two next most recent ones. but my inserted code just prevents the page from being displayed (again)  :-\ ???

this is how I did it:


<%int i=0;%>
<td class="olderIssues">
    <logic:iterate id="prod" name="prodArray" length="3" type="com.konakart.appif.ProductIf">
<%if(i==0){%>
    <%i=1;%>
<%}else{%>
    <div>
<html:link page="/SelectProd.do" paramId="prodId" paramName="prod" paramProperty="id">
  <img src="images/<%=prod.getImage()%>" border="0" alt="<%=prod.getName()%>" title=" <%=prod.getName()%> " />
</html:link>
    </div>
<%}%>
    </logic:iterate>
</td>


do you know, why this is not showing up? I'm really confused as to why it doesn't work ...

regards,
anni

julie

Hi Anni,

The Tomcat log should give you some indication as to what is going wrong.

Regards,

Julie

Anni

the tomcat log says:

Type mismatch: cannot convert from null to int

and

The operator == is undefined for the argument type(s) int, null

??? ???

I have initialised "i", so there is no null!
getting more and more confused...

regards,
anni

kingsulaman

Quote from: julie on November 23, 2007, 12:06:52 pm
Hi Anni,

This is what you need to do :

if (prod.getDescription() == null ) {

   prod = kkEng.getEng().getProduct(kkEng.getSessionId(), prod.getId(), kkEng.getLangId());

        }




Thank you so much i had same problem...and i got fixes up.