KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: fizzlepop on November 17, 2010, 09:23:50 pm

Title: Configuring product sort order
Post by: fizzlepop on November 17, 2010, 09:23:50 pm
Okay, Yes I have searched the forum and looked at previous threads about customizing the sort order for products, but I didn't see where the suggested solutions apply, so I will re-post this question.

I am using KonaKart 4.2.0.1.

I only want to change the sort order of products as they are displayed when the user is viewing products within a category.  Naturally, I looked at the source of SelectCategoryAction1.  However the only line of code that I can tell which fetches the products is:

int prodsFound = kkAppEng.getCategoryMgr().setCurrentCatAndUpdateProducts1(catIdInt);

I can't modify the source of CategoryMgr.setCurrentCatAndUpdateProducts1 method - or can I?  Where is the appropriate place to customize the product query?

Thanks.

Title: Re: Configuring product sort order
Post by: trevor on November 18, 2010, 06:35:48 pm
Just before that line, try adding ( using the ORDER_BY parameter that you prefer ):

kkAppEng.getProductMgr().setDefaultOrderBy(DataDescConstants.ORDER_BY_NAME_DESCENDING);
Title: Re: Configuring product sort order
Post by: fizzlepop on November 19, 2010, 11:41:32 pm
Thanks!  Sadly, the sort option I want "ORDER_BY_DATE_ADDED_DESC" does not exist.  :-[
Title: Re: Configuring product sort order
Post by: trevor on November 20, 2010, 10:48:08 am
Just use DataDescConstants.ORDER_BY_DATE_ADDED .