How to Sort list of Products

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Mike718NY
Commodore (COMO)
Commodore (COMO)
Posts: 485
Joined: Wed Jun 18, 2008 5:24 pm

How to Sort list of Products

Post by Mike718NY » Wed Aug 06, 2008 11:52 am

This gives a list of products for a Manufacturer.
But how can I sort it by Name, ASC ???

ProductCollection productByManList = ProductDataSource.LoadForCriteria("ManufacturerId = 3");
foreach (Product p in productByManList)
{
...............

Same here, I want to sort this by Name, ASC :

ManufacturerCollection allMans = ManufacturerDataSource.LoadForStore();
foreach (Manufacturer thisMan in allMans)
{
.........

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

Re: How to Sort list of Products

Post by heinscott » Wed Aug 06, 2008 12:02 pm

ProductCollection productByManList = ProductDataSource.LoadForCriteria("Manufacturer = 3", "name ASC");
The second argument "name ASC" is the Order By sql statement.

Scott

Mike718NY
Commodore (COMO)
Commodore (COMO)
Posts: 485
Joined: Wed Jun 18, 2008 5:24 pm

Re: How to Sort list of Products

Post by Mike718NY » Wed Aug 06, 2008 12:33 pm

thanks again Scott

Post Reply