This project is read-only.

Sorting a list

Topics: Customizing Orchard, General
Jun 4, 2013 at 10:28 AM
Hi, please help!

I am trying to sort a list by price. I have created a projection which does this but I can only see a way to add it to a menu but I want it to be part of a dropdown box.

Any ideas please?

Thanks, Kirsty
Jun 5, 2013 at 5:44 AM
There are Querystring tokens that you can use for that.
Jun 18, 2013 at 1:31 PM
Hi there

I have looked into Querystring tokens and have watched Sebastien's useful tutorial on You Tube which includes Querystring tokens.
I still cannot figure out how to use these in the context of sorting. (I know how to use them with filtering e.g. adding something like {Request.QueryString:Location} to the Value.

I have a drop-down box on my menu bar which says order by price ascending / descending. All my projection pages default to showing properties price ascending anyway but how can I get this to show properties on the current page (within a projection) to display price descending?

Any help much appreciated.

Jun 20, 2013 at 9:42 AM
Can anyone help with this please?
Jun 26, 2013 at 6:15 AM
There are no token-based sorting providers built-in. You'd have to build your own. If you watch that should give you some good hints on how to do that.
Aug 13, 2013 at 12:42 PM
I have watched this and it is very in depth and does not really cover filtering and sorting but is more focused on advanced layouts.

I have a results page of properties. On this page I would like to add 2 buttons - one for sorting properties ascending by prices and one for sorting properties descending by price. Can anyone give me any tips on how to do this please?

Thanks in advance,
Aug 13, 2013 at 4:41 PM

I believe you have two options:

1- Follow Bertrands advice and create your own tokens for sorting.
2- Using Controllers and querying the content manager doing the filtering and sorting there.

I was having that problem as well, and decided for option 2, if you are used to code in MVC it´s problably the easyiest path.

Aug 15, 2013 at 9:47 AM

Thanks Nuno for you reply.

I am not used to coding in MVC but have learnt a lot on this project! I will investigate and look into both ways.

Thank you.


Mar 21, 2015 at 7:15 AM
Any advance on Ordering queries based on query string? In a few days I will start to work in an issue where I need this functionality. So I was wondering if this have evolved in Orchard or I have to create my own token provider for ordering a query for a projection.
Mar 21, 2015 at 7:23 AM
I've just find a related issue.
The point is it looks not any advance. So, I will try to make my own provider