Page 1 of 1

Need assistance on product sorting

Posted: Thu Sep 18, 2008 4:33 pm
by alex
My client wants to display products in a specific order on several pages. we can use the arrows on the catalog page to change the order of products. By the default the pages have a drop down menu that sorts items from A-Z. I added a listItem as below:

<asp:DropDownList ID="SortResults" runat="server" AutoPostBack="true" CssClass="sorting" EnableViewState="false">
<asp:ListItem Text="Default" Value="????" Selected="True"></asp:ListItem>
<asp:ListItem Text="By Name (A -> Z)" Value="Name ASC"></asp:ListItem>
<asp:ListItem Text="By Name (Z -> A)" Value="Name DESC"></asp:ListItem>
<asp:ListItem Text="Featured" Value="IsFeatured DESC, Name ASC"></asp:ListItem>
<asp:ListItem Text="By Price (Low to High)" Value="Price ASC"></asp:ListItem>
<asp:ListItem Text="By Price (High to Low)" Value="Price DESC"></asp:ListItem>
<asp:ListItem Text="By Manufacturer (A -> Z)" Value="Manufacturer ASC"></asp:ListItem>
<asp:ListItem Text="By Manufacturer (Z -> A)" Value="Manufacturer DESC"></asp:ListItem>
</asp:DropDownList>

I want to know how to set the value for Default, and we can get the same order as admin page.
Thanks,

Re: Need assistance on product sorting

Posted: Thu Sep 18, 2008 6:44 pm
by AbleMods
Alex,

It sounds like your asking for two things:

1. Adding an additional way to sort.
2. Eliminate the default sorting.

Or are you just wanting to eliminate the default sorting so the products/categories are displayed in the order specified on the Admin side?

Re: Need assistance on product sorting

Posted: Thu Sep 18, 2008 9:50 pm
by meer2005
The default is the first option. If you want items in a specific order, sort them in your admin and then make featured your first option and it will display them in the order you have them sorted in your admin.


Example:
<asp:ListItem Text="Featured" Value="IsFeatured DESC, Name ASC"></asp:ListItem> Moving this to the top makes it the default
<asp:ListItem Text="By Name (A -> Z)" Value="Name ASC"></asp:ListItem>
<asp:ListItem Text="By Name (Z -> A)" Value="Name DESC"></asp:ListItem>
<asp:ListItem Text="By Price (Low to High)" Value="Price ASC"></asp:ListItem>
<asp:ListItem Text="By Price (High to Low)" Value="Price DESC"></asp:ListItem>

Re: Need assistance on product sorting

Posted: Thu Sep 18, 2008 10:22 pm
by AbleMods
Hey thats a pretty slick little trick :)

Re: Need assistance on product sorting

Posted: Fri Sep 19, 2008 1:44 pm
by alex
SolunarServices wrote:Alex,

It sounds like your asking for two things:

1. Adding an additional way to sort.
2. Eliminate the default sorting.

Or are you just wanting to eliminate the default sorting so the products/categories are displayed in the order specified on the Admin side?

Yes, I just want to make the products on front side are displayed in the order specified on the admin side.
thanks,

Re: Need assistance on product sorting

Posted: Fri Sep 19, 2008 1:46 pm
by alex
meer2005 wrote:The default is the first option. If you want items in a specific order, sort them in your admin and then make featured your first option and it will display them in the order you have them sorted in your admin.


Example:
<asp:ListItem Text="Featured" Value="IsFeatured DESC, Name ASC"></asp:ListItem> Moving this to the top makes it the default
<asp:ListItem Text="By Name (A -> Z)" Value="Name ASC"></asp:ListItem>
<asp:ListItem Text="By Name (Z -> A)" Value="Name DESC"></asp:ListItem>
<asp:ListItem Text="By Price (Low to High)" Value="Price ASC"></asp:ListItem>
<asp:ListItem Text="By Price (High to Low)" Value="Price DESC"></asp:ListItem>
Thank you! But I have tried this, but the orders(front side & admin side) are still different.

Re: Need assistance on product sorting

Posted: Fri Sep 19, 2008 2:53 pm
by afm
I think the admin side joins the ac_CatalogNodes table with the ac_Products table and sorts by ac_CatalogNodes.OrderBy. Unfortunately, the client side does not appear to join the ac_CatalogNodes table into the query, so OrderBy is not available for sorting.

Re: Need assistance on product sorting

Posted: Fri Sep 19, 2008 6:37 pm
by jmestep
The code you need to change depends on which category display grid you are using. Which one is it?

Re: Need assistance on product sorting

Posted: Fri Sep 19, 2008 7:25 pm
by ryanstowasser
I created a custom sorting solution a while back and posted some code at the following url.

viewtopic.php?f=44&t=5736&p=23258&hilit ... ort#p23258

I was sorting on a merchant field found in a product template. I hope its helpful.