Page 1 of 1

is there a way to list products by the date they were added

Posted: Mon Apr 16, 2012 3:57 pm
by pgdlc
We would like for our products to display in the order in which they were added to the store, showing the newest products first. Is there a way do this?

Re: is there a way to list products by the date they were added

Posted: Mon Apr 16, 2012 6:47 pm
by david-ebt
What page are you trying to sort? If you look at the ConLib\CategoryGridPage.ascx and search for the

Code: Select all

asp:DropDownList ID="SortResults"
code. You should be able to add another list item like this:

Code: Select all

<asp:ListItem Text="Newest Products First" Value="CreatedDate DESC"></asp:ListItem>
If you look at the code behind and search for

Code: Select all

ProductDataSource.NarrowSearch
you can replace the SortResults.SelectedValue with "CreatedDate DESC" to hard code the sort order.

Most of the other product list pages have the same type of set up. I hope that puts you on the right trail.

Re: is there a way to list products by the date they were added

Posted: Tue Feb 19, 2013 3:14 pm
by pgdlc
I tried this but can't get it to work

Re: is there a way to list products by the date they were added

Posted: Wed Feb 20, 2013 10:18 am
by david-ebt
Sorry, my mistake. That sort option won't work on the CategoryGridPage. The only valid sort options are based on the group by in the ProductDataSource.NarrowSearch query:

ProductId, Name, Sku, Price, MSRP, CostOfGoods, Weight, Length, Width, Height, IsFeatured, FTS.RANK, OrderBy, Manufacturer

Sorting by Product CreatedDate would require a special sort handler for the NarrowSearch results before handing them to the grid. See viewtopic.php?f=42&t=12443.