Page 1 of 1
Remove alphabetical ordering in category list
Posted: Tue Apr 01, 2008 9:44 am
by tonz
I would like to customize category list page so that products appear in the order which they are in Browse Catalog and not the alphabetical order. Anyone any idea? thanks in advance
Re: Remove alphabetical ordering in category list
Posted: Mon Apr 07, 2008 3:34 am
by m_plugables
Locate the following line of code
Code: Select all
string sortExpression = SortResults.SelectedValue;
You can change the sort order and make it like in the Browse Catalog page. For this just make the above line of code look like
Code: Select all
string sortExpression = String.Empty;
means pass an empty string int sort expression parameter then it will display the catalog items without sorting.
Re: Remove alphabetical ordering in category list
Posted: Mon Apr 07, 2008 3:45 am
by m_plugables
Well although the above code works but a much better solution is to modify the sorting options drop down list. You can use the code below instead of the above code for the same task
Edit the
ConLib/CategoryListPage.ascx file and locate the following line of code
Code: Select all
<asp:ListItem Text="By Name (A -> Z)" Value="Name ASC"></asp:ListItem>
and put the following line of code just above it.
Code: Select all
<asp:ListItem Text="<Select Sort>" Value="" Selected="True"></asp:ListItem>
It will make an extra option available in the sort options list. Use this option to keep the result order same as in the Browse Catalog.
Re: Remove alphabetical ordering in category list
Posted: Tue Apr 08, 2008 3:07 am
by tonz
Thanks a lot! Worked great! Our company doesn't have that many products, so the sort header was not even necessary. So I made the changes you suggested, and then I made the sort header disappear from css. Thanks again for sharing your knowledge.
Re: Remove alphabetical ordering in category list
Posted: Fri Jun 06, 2008 12:24 pm
by jmestep
I had to change from the first method to this:
<asp:ListItem Text="<Select Sort>" Value="" Selected="True"></asp:ListItem>
When I used string sortExpression = String.Empty; it retained the catalog order of the products, but the sorting selections didn't work.
Re: Remove alphabetical ordering in category list
Posted: Sun Jun 29, 2008 1:24 pm
by jmestep
I had to switch to using the CategoryGridPage.ascx in order to get the "C" out of my product links on that page . ( It was easier than working with the CategoryGridpage4.ascx).
Anyway, neither of the above codes work on that page. I think this code sets the sort value when the page loads, but I can't figure out how to change it:
ProductList.DataSource = ProductDataSource.NarrowSearch(_Keywords, this.CategoryId, _ManufacturerId, 0, 0, _PageSize, (_HiddenPageIndex * _PageSize), SortResults.SelectedValue);
I think I need to put something else for SortResults.SelectedValue, but I'm not sure what. I tried "" and nothing changed.
Anyone know?
Thanks