KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: ssharma on November 07, 2008, 07:13:20 am

Title: Product Description field returns null
Post by: ssharma on November 07, 2008, 07:13:20 am
hi,
       I am getting description field value null for all the products "PRODUCTS" table. Here is the sample code. Please let me know ASAP whats wrong with this code?

ProductsIf kkProducts = null;
           
CategoryIf[] categories = eng.getCategoryTree(DEFAULT_LANGUAGE, true);
for(int catNum = 0 ; catNum < categories.length ; catNum++)
{
    if(categories[catNum].getName().equalsIgnoreCase("services"))
    {
        CategoryIf[] subCategories = categories[catNum].getChildren();
        for(int subCatNum=0;subCatNum<subCategories.length;subCatNum++)
        {
            if(subCategories[subCatNum].getName().equalsIgnoreCase("new"))
            {
                CategoryIf[] subSubCategories = subCategories[subCatNum].getChildren();
                //The following loop will parse through all the Master products under new
                for(int subSubCatNum = 0; subSubCatNum<subSubCategories.length; subSubCatNum++)
                {
                    System.out.println(subSubCategories[subSubCatNum].getName());
                    System.out.println(subSubCategories[subSubCatNum].getNumberOfProducts());
                    kkProducts = eng.getProductsPerCategory(sessionId, dataDesc, subSubCategories[subSubCatNum].getId(), true, DEFAULT_LANGUAGE);
                }
            }
        }
    }
}

ProductIf[] products = kkProducts.getProductArray();
for(ProductIf prd : products){
    System.out.println("Description = " + prd.getDescription());
}

It gives "Description = null" for all products, why? Anybody, let me know quick. Thanks.
Title: Re: Product Description field returns null
Post by: sashwill on November 07, 2008, 09:15:42 pm
I had to do this to get some details about a product:
ProductIf product = kkAppEng.getEng().getProduct(getSessionId, productId, LangId);

It seems some of the fields are not populated unless they come straight from the konakart eng.

don't know if this is your case or not.
Title: Re: Product Description field returns null
Post by: julie on November 10, 2008, 05:32:03 pm
In the javadoc for that API call it specifically says:

QuoteThe description (which can be very long) and the array of options are not set.


In general all API calls that return multiple products, do not fully populate them for performance reasons. If you require a fully populated product you should make an extra getProduct() API call for each product passing the product id.