Shared layout between branches of organization

Topics: General
Nov 11, 2013 at 7:47 PM
Edited Nov 11, 2013 at 8:00 PM

I've been asked to explore the possibility of using Orchard for our new corporate website. I think it fits quite nicely, except I'm still in doubt about one thing. Our company has several branches (let's say: Europe, Asia and US), and one part of the website (the services part) should be specific per branch. If we would have a main menu with three items:
  • Products
  • Services
  • History
I would like the "services" link to go to a page to select the branch, and that page would only show services specific for the selected branch. However, the layout for these branch specific services are exactly the same, only the content is different. How would I go about setting something like this up? I don't want to create three separate pages for Europe, Asia and US, I would like it to be one page which load relevant content for the selected branch. I hope you guys understand what I mean...
Perhaps this helps:
                 / Europe \
Home -> Services - Asia    -  -> Services/Region
                 \ US     /
Nov 11, 2013 at 9:34 PM
You can have a single projection (a page with data listing) to query services in the content database according to some request parameter, which you can pass from the navigation menu, something like You might need to implement a query filter for the "service" content type, so that you can use the out of the box projections.

Alternatively, you can implement a MVC controller to do the querying/listing, using the same request parameter strategy.

Nov 12, 2013 at 11:09 AM
Edited Nov 12, 2013 at 2:42 PM
Thanks for your reply. Iive been reading up a lot and it looks like projections are a good way to handle this. Would it be possible to use it like instead of
Edit: after some more research it seems I can use taxonomies for this, correct?
Edit2: after some messing around it seems like taxonomy isn't going to cut it. I also need some content per branch in asidefirst, and I can't use the "current" term there....
Nov 12, 2013 at 2:51 PM
You can do this for sure if you implement your own controller, and a route provider to match the URL you want. You need some routing mechanism to match and pass the region as a request parameter so that you can use that in a query definition. But I'm not sure if something similar for a projection page is available ootb.

If your concern is to modify only one layout in case you need to change look and feel, you can try this: Add a field to page to keep the region name, create a query to match that field with Service content item's region property, and create a query widget for that query. Then you can create as many pages as your regions, set the page property and autoroute url for each page and add this widget to show on a layer defined for URLs starting with /Services/. This way modifications to the query layout affects all service pages.

I haven't tried this. If you can't use a token to match the field of page that keeps the region name, you can use request query string with "ends with" against. Of course you won't need the field in this case.

In any case you will need to provide a filter implementation to use Region name of Service content type in your query.

Nov 13, 2013 at 12:08 PM
Ok I've added a "branch" field to my page content type, added a page with branch "Asia" and one with branch "Europe". I've also created several services with different branches. Now I'm trying to create a query to get the services for the branch set on the page, but I'm at a loss what this query should like. If I hardcode the branch in the query it works fine, but how do I get the Branch property of the page (if even possible)?
Nov 13, 2013 at 4:15 PM
I don't know, probably not possible. Try the other option then

"If you can't use a token to match the field of page that keeps the region name, you can use request query string with "ends with" against. Of course you won't need the field in this case."

I wrote request query string but it would be request URL.

Nov 14, 2013 at 9:40 AM
There is actually a filter in the filter list called "{Content.Fields.Page.Branch}", so my query is now "Service.Branch is equal to '{Content.Fields.Page.Branch}'" but it doesn't work :(