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

Product List ?????

Started by shirin, June 06, 2008, 12:58:49 pm

Previous topic - Next topic

shirin

Hello Konakart,

I want to load the list of all products at client UI. Can any one guide me, how can i achieve this. ?

Thanks,
Shirin

pete

Hi,

I don't see what the problem is. Can't you just configure the Search Results through the Admin App Configuration>>Maximum Values to be a large value ?

shirin

Hi pete,

Thanks for reply..But i think i not able to describe my problem in last post. Let me clear it. As we have list of many product. All divided in Categories. Now i want the list of all categories with paging at UI side.

I created new Action class as below :
/**
*
*/
package com.konakart.actions;



import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.konakart.al.Constants;
import com.konakart.al.KKAppEng;
import com.konakart.appif.CategoryIf;
import com.konakart.appif.ProductsIf;

public class ShowAllProductsAction extends BaseAction
{

    /**
     *
     * @param mapping
     *            The ActionMapping used to select this instance
     * @param form
     *            The optional ActionForm bean for this request (if any)
     * @param request
     *            The HTTP request we are processing
     * @param response
     *            The HTTP response we are creating
     *
     */
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
    {

       try
        {
            int custId;

            KKAppEng kkAppEng = this.getKKAppEng(request);

            custId = this.loggedIn(kkAppEng, null);

            // Ensure we are using the correct protocol. Redirect if not.
            ActionForward redirForward = checkSSL(request, custId, /* forceSSL */false);
            if (redirForward != null)
            {
                return redirForward;
            }

            ProductsIf pd = kkAppEng.getEng().getAllProducts(kkAppEng.getSessionId(),null,-1);
                       
            for(int i=0;i<pd.getTotalNumProducts();i++) {
               System.out.println(pd.getProductArray().toString());   
            }
           
            kkAppEng.nav.set(Constants.products, request);
           
            return mapping.findForward("ShowAllProds");

        } catch (Exception e)
        {
            return mapping.findForward(super.handleException(request, e));
        }


    }

}

And also configure Struts config :
              <action path="/ShowAllProducts" type="com.konakart.actions.ShowAllProductsAction">
         <forward name="ShowAllProds" path="/CatalogShowProdsPage.do"/>
      </action>

And trying to use existing CatalogShowProdsPage which will used for product listing for all pages.

Here i found no items found message.

Can u guide me where i am committing mistake.

ProductsIf pd = kkAppEng.getEng().getAllProducts(kkAppEng.getSessionId(),null,-1);

I am getting all records in PD but how to rendered it on JSP page ProductsBody.jsp with paging.

Thanks,


pete

If you want to use the existing page then you must use the client engine so that the products are automatically saved on the session. If you don't have many products and you want to get them all, try using kkAppEng.getProductMgr().fetchAllNewProds() in a way similar to ShowAllNewProdsAction(). Once you have retireved the products you may sort them using orderCurrentProds() like in SortProductAction().

shirin

Hi pete,

Thanks for your reply. But i not want only the list of new products. I need all products list. And as you told it's not possible that i can render all products at already given page. It means i need to develop new jsp page for that.

Ok i can develop that. But what extra things i need to keep in mind while developing this new page. And should i need to create new Form for that or just save the product list in Session and access that. What about paging? should i need to write own code for paging. Or Any code available at konakart(i.e. logic) so i can use that for paging.


Thanks for your further assistant.

Thanks
Shirin.

pete

kkAppEng.getProductMgr().fetchAllNewProds() fetches all of the products sorted by date. The number that it fetches depends on how you have configured KonaKart.

shirin

k pete,

I think now i get, let me try to implements this and later will notify you about success.

Thanks