Sorting Function
-
- Lieutenant (LT)
- Posts: 80
- Joined: Fri Sep 19, 2008 11:39 am
Sorting Function
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!
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Sorting Function
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
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
Re: Sorting Function
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
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.
Code: Select all
CatalogDataSource.LoadForCategory(int CategoryId,bool publicOnly,string sortExpression)
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Sorting Function
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
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
Re: Sorting Function
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
Example: "Name ASC" to sort by name.
Scott
-
- Lieutenant (LT)
- Posts: 80
- Joined: Fri Sep 19, 2008 11:39 am
Re: Sorting Function
Thank you all.
Re: Sorting Function
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.Mazhar, Able isn't too clear about how to indicate the sortExpression. Is it just the column name?
-
- Lieutenant (LT)
- Posts: 54
- Joined: Fri Aug 15, 2008 7:56 am
Re: Sorting Function
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
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
-
- Lieutenant (LT)
- Posts: 54
- Joined: Fri Aug 15, 2008 7:56 am
Re: Sorting Function
My question was answered in another thread.
viewtopic.php?f=42&t=8011&p=34120&hilit ... ion#p34120
Thank you!
viewtopic.php?f=42&t=8011&p=34120&hilit ... ion#p34120
Thank you!