Content Management for inline sections in custom controller

Topics: General
Jul 12, 2012 at 3:10 AM

Hi, I am upgrading a CheckoutController for our custom-developed Shopping Basket module, and some of our Products require the user to read and accept a licence agreement before they can purchase the items. The controller action renders a view with a summary of the shopping basket items, the user's details (name, address, etc.) and a checkbox to indicate that they have read and agree to the terms of the licence. I would like to display the licence agreement inline on that page.

I would like the text of the licence agreement to be content-managed, so that our staff can update it independently of the developer. I also plan to have a stand-alone Page where the same licence agreement can be viewed on its own. I don't want our staff to have to maintain two versions of the same document; i.e. I need to re-use the same content.

How can I accomplish this in Orchard? I have a couple of ideas but I'm open to suggestions.

  1. Use a standard Page to set up the licence agreement. This is good because it will have the usual Autoroute, Title and Body parts. This takes care of the stand-alone page. How can I load this *specific* ContentItem from my controller, to be able to .Get<BodyPart>() and pass a shape or something to my view? Would I need a CheckoutSettingsPart with a drop-down to choose the ContentItem's Id, or is there a more dynamic way to reliably locate a particular Page/ContentItem directly from the Content Manager? I can't rely on the Page always having a particular Title or Route.
  2. Store the content in some kind of Dashboard SettingsPart with an Html field for the text (is this even possible? I want to use CKEditor too), and access the field in the controller. This would take care of the inline form, but how would I get the stand-alone page/route working?

If anyone has any thoughts, ideas or suggestions to bounce around, that would be great. Thanks.

Coordinator
Jul 12, 2012 at 6:22 PM

I don't understand what you mean by "a more dynamic way to reliably locate a particular Page/ContentItem directly from the Content Manager". I also don't understand option 2.

Seems to me like a simple example of a relationship between content items.

Jul 13, 2012 at 3:26 AM

OK, sounds like you're saying the simplest way is #1: just store the ContentItem's Id in a SettingsPart. Good, thanks, that's kind of what I thought too, I was only wondering if there was any other good way that I was missing.

Thanks again for your help.