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

Product Description field returns null

Started by ssharma, November 07, 2008, 07:13:20 am

Previous topic - Next topic

ssharma

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.

sashwill

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.

julie

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.