Sorting Function

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
butterscotch
Lieutenant (LT)
Lieutenant (LT)
Posts: 80
Joined: Fri Sep 19, 2008 11:39 am

Sorting Function

Post by butterscotch » Fri Sep 19, 2008 11:46 am

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!

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Sorting Function

Post by jmestep » Fri Sep 19, 2008 6:47 pm

The patch to the page code depends on what category .ascx you are using. Which one are you using?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Sorting Function

Post by mazhar » Sun Sep 21, 2008 9:46 pm

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.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Sorting Function

Post by jmestep » Mon Sep 22, 2008 8:37 am

Mazhar, Able isn't too clear about how to indicate the sortExpression. Is it just the column name?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
heinscott
Captain (CAPT)
Captain (CAPT)
Posts: 375
Joined: Thu May 01, 2008 12:37 pm

Re: Sorting Function

Post by heinscott » Mon Sep 22, 2008 2:20 pm

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

butterscotch
Lieutenant (LT)
Lieutenant (LT)
Posts: 80
Joined: Fri Sep 19, 2008 11:39 am

Re: Sorting Function

Post by butterscotch » Mon Sep 22, 2008 9:34 pm

Thank you all.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Sorting Function

Post by mazhar » Mon Sep 22, 2008 10:11 pm

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.

it@isa-arbor.com
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Aug 15, 2008 7:56 am

Re: Sorting Function

Post by it@isa-arbor.com » Tue Oct 21, 2008 8:50 am

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

it@isa-arbor.com
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Aug 15, 2008 7:56 am

Re: Sorting Function

Post by it@isa-arbor.com » Tue Oct 21, 2008 8:55 am

My question was answered in another thread.

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


Thank you!

Post Reply