Page 1 of 1

Sorting Function

Posted: Fri Sep 19, 2008 11:46 am
by butterscotch
Which is the sorting function that allows you to display the products by the order you specified in items within a category in the admin area? Thanks!

Re: Sorting Function

Posted: Fri Sep 19, 2008 6:47 pm
by jmestep
The patch to the page code depends on what category .ascx you are using. Which one are you using?

Re: Sorting Function

Posted: Sun Sep 21, 2008 9:46 pm
by mazhar
Most of the loader function define a sortExpression parameter. You can specify the column name in this parameter for you have to sort the results. For example in order to load contents of a category you can use

Code: Select all

CatalogDataSource.LoadForCategory(int CategoryId,bool publicOnly,string sortExpression)
Where CategoryId will be the id of category for which you want to load contents, publicOnly specify that weather to load the private contents or not and third one defines the sort expression for the results.

Re: Sorting Function

Posted: Mon Sep 22, 2008 8:37 am
by jmestep
Mazhar, Able isn't too clear about how to indicate the sortExpression. Is it just the column name?

Re: Sorting Function

Posted: Mon Sep 22, 2008 2:20 pm
by heinscott
Judy... I am pretty sure that the sort expression is the same is it would appear in an SQL "Order By" expression. So, yes, you would include the column name, but then follow it with either: ASC or DESC for ascending or descending.

Example: "Name ASC" to sort by name.

Scott

Re: Sorting Function

Posted: Mon Sep 22, 2008 9:34 pm
by butterscotch
Thank you all.

Re: Sorting Function

Posted: Mon Sep 22, 2008 10:11 pm
by mazhar
Mazhar, Able isn't too clear about how to indicate the sortExpression. Is it just the column name?
Yes heinscott is right. Also whenever possible try to use the AbleCommerce SortedGridView wherever you need to support the sorting. It will automatically keep track of the sort directions throughout the page life cycle, you just need to specify the default sort expression and direction.

Re: Sorting Function

Posted: Tue Oct 21, 2008 8:50 am
by it@isa-arbor.com
I'd like to do this for the categoryGridPage.

I can add a new default option to the sort drop down list in the ASCX file as I've seen in other posts but can't make the categories/products appear as they are sorted in the back end.

I've been poking around the CS files looking for CatalogDataSource.LoadForCategory(int CategoryId,bool publicOnly,string sortExpression) or sortExpression without much luck.

Any advice would be appreciated.

Best regards,

Ernie Noa

Re: Sorting Function

Posted: Tue Oct 21, 2008 8:55 am
by it@isa-arbor.com
My question was answered in another thread.

viewtopic.php?f=42&t=8011&p=34120&hilit ... ion#p34120


Thank you!