Orchard Create Projection or Search Based on Filtered Dropdown Selections

Topics: Customizing Orchard, Writing modules
Nov 15, 2012 at 8:57 PM

I have, what I think is, a simple feature that I am trying to add to my Orchard (1.6) site, but I can't find any tutorials or instructions on how to do it. I have a custom type called "Office" and each office has a custom field called "State" indicating which state the office is in. I actually designed my Offices as a custom part in code with specific properties such as State on it, but I "think" it's the same as if I added the State through the Admin interface as a field on the Office content part.

Now, I can create a basic projection to show all the offices with a simple filter of "Content with type Office" to display all offices. However, what I want to do now is to have a drop down list at the top of the page that says "Filter by: [-SELECT STATE-]" with a list of all 50 states. When the user selects a state, the page should refresh and display just the offices in that state.

This is where I'm stuck. Should I do this through the code, or can I do this through the Admin UI? If through the code, should I model it after the Orchard.Search module (which I tried to do, but I am completely lost). If I can do it through the UI, do I use projections? If so, do I have to create 50 separate projections (one for each state)? That seems extremely time consuming to create and maintain.

Any help is GREATLY appreciated!

FYI, the site at http://ktowneric.com/listings/search (which uses Orchard) is very similar what I am looking for, and the developer stated he used projections, but I can't seem to figure out how he did it.

Nov 16, 2012 at 5:14 PM

Didn't you ask that same question on Stack Overflow? I think you got a pretty good response for it too. Is this still an issue? Can you please point to your SO question?

Nov 16, 2012 at 6:27 PM

Yes, it is the same question at SO which can be found at http://stackoverflow.com/questions/13406004/orchard-create-projection-or-search-based-on-filtered-dropdown-selections.  And yes, Brandon provided a good answer which I am testing out.

Nov 16, 2012 at 8:24 PM