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

Get All Products Unconditionally

Started by dnlsmns, August 26, 2010, 08:13:43 pm

Previous topic - Next topic

dnlsmns

I am noticing a strange result when attempting to return all products from the server, where in some cases the limit is being set to zero.  Here is my code:

            KKAppEng appEng = getAppEng();
            appEng.getProductMgr().fetchNewProductsArray(ProductMgr.DONT_INCLUDE, /* fetchDescription */
                   true);
            ProductIf[] products = appEng.getProductMgr().getNewProducts();

With debug mode turned on the query that is problematic ends with: DESC LIMIT 0

And the query that returns the correct result ends with: DESC LIMIT 9

NOTE: I currently have 9 products total. 

Could there be something wrong with my initialization process?  Is there a better way to get all products?

dnlsmns

I found a solution that appears to be working:

KKAppEng appEng = getAppEng();
            ProductSearchIf prodSearch = new ProductSearch();
            DataDescriptorIf dataIf = new DataDescriptor();
            dataIf.setLimit(-1);
            dataIf.setOffset(0);
            appEng.getProductMgr().setDataDesc(dataIf);
            appEng.getProductMgr().searchForProducts(prodSearch);
            ProductIf[] products = appEng.getProductMgr().getCurrentProducts();

This seems to be full-proof.