Monday, June 15, 2015

Managing Countries and Regions within the same site (Part 1) : Getting Started



In one of the projects that I am working on, we are re-platforming a United States and Canada website from Drupal to Sitecore. During the early phases of the project, there was a lot of talk about a "lift-and-shift". As you know, that's never the case. The sites ended up being completely re-done, and the E-Commerce functionality re-worked.

Technologies and integrations include:

  1. Sitecore XP 8 Update-2
  2. Sitecore Commerce Connect 8.0
  3. Adobe Scene7 (custom connector on the Media Framework)
  4. RightNow CRM (custom connector)
  5. Shopatron E-Commerce checkout and inventory lookup.

The Use Case and The Kicker

As I mentioned before, we are re-platforming 2 independent Drupal sites for different countries. The sites are almost identical. Out of the gate, every page on the US site would exist on the Canada site. The only things that would be different would be products (some would appear on the US site and not on Canada),  pricing, and some Shopatron specific API information that we had to pass to Shopatron when a user was ready to complete the checkout process.

Easy enough. We could do all this within a single site with a bit of logic right?

The kicker was that down the road, content authors wanted the ability to add pages and pieces of content that were country-specific. For example, if there was a specific product promotion, they wanted to be able to add their own landing pages, and wanted the ability to display new call to actions (CTAs) on the home and other pages of their site.We couldn't have US pages and CTAs show up on Canada's site and vice versa.

Would we have to build out the US site and then copy it over to create the Canada site?

The Solution

Andy Uzick was in town during the architectural debate, and so we went out to lunch and started throwing out some ideas between his dirty jokes.

This is what we decided:

  1. Stick with a single site for the North America Region.
  2. Create regional settings that we could link to the site's context and items within the site.
  3. Create a "region resolver" pipeline processor within the HttpRequestBegin pipeline that would take a look at the context of the site that was running to determine the region, and then decide if the page or other content should be displayed or not.
  4. Build a custom condition for the Sitecore Rules Engine that content authors could utilize to display regional specific content for pages that existed on both sites.

Creating the Region Settings

The first template we created was the Region template. This would be used to house or site specific regional data:

Next, we created the region content items based on the Region template in our global / shared location in the content tree, so that data could be consumed by our specific data templates:

We then created a base Site Region template with a multilist field that we configured to pull in the regions that we had set up in the global / shared location:

We made sure that the standard values had both regions selected:

We then set the necessary templates that needed regional specific settings such as pages and products, to inherit from the Site Region base template:

Finally, this is what one of the Page items looked like that had the regional settings in place:

At this point, we had everything ready content-wise to start coding against.

Looking Forward

Next up will be Part 2, The Region Resolver -  I will walk through how we built out the region resolver pipeline processor within the HttpBeginRequest pipeline

Part 3,  The Region Custom Condition - I will demonstrate building out the custom condition for the Sitecore Rules Engine.

Part 4, Regions in Action - I will put everything together, and show it in action.


Post a Comment