Resolving multi-country feature with OG

13 February 2013

Glasgow: The major point to consider here is that content classification is very easy with Organic Groups -- which after all is one of the primary uses of this module -- allowing groupings of users and content. The first step is to create the content types:

  1. Country
  2. Event
  3. News
  4. Article
  5. Product

For this, Events and News are considered country-specific contents, and Articles and Products are general content visible in all of the countries. The strategy to achieve this is straightforward:

  1. The Country content type only contains a title, a body, and a country field -- use the Countries module to get a dropdown selector of the ISO code for every country. We define this content type as the definitive “Group type” for Organic Groups configuration, as the Country is the basis upon which we are grouping most content. At this point, we can set up the actual countries we want to serve, using this content type (node/1 ends up being México, node/2 = Argentina, etc.).
  2. For the country-specific content types, we add a field of type “Group Audience.” This creates a reference between the content and the Country OG.
  3. Finally, we create the individual pages to display content for specific countries, e.g. News for México, Argentina, Ecuador etc. For this we create a View that filters by content type News ordered by date desc, and the trick is to add the Contextual Filter OG (gid) that is the ID of our country. This way if we give our view a path like /news, it will receive a second argument for the country which filters the results, e.g. /news/1 (where “1” corresponds to our country, e.g. México).

This configuration is repeated for all of the country-specific content types, and we have resolved the first problem.
Of course, at this point, some questions may arise. You’re probably wondering things like:

  1. How to manage the navigation for country-specific items when the menu items in Drupal can handle only a static path. So if I have a “News” link in my menu, for example, to which country will I link?
  2. How to preserve the context of a country when a user is navigating through the content of a specific country; e.g., how do we preserve a consistent URL structure for all Argentina content?
  3. How to convert the ugly news/1, news/2, news/3 URLs to be SEO friendly.

Drupal CMS Development

Why Fortune Innovations?

  • Save your project cost up to 40%
  • Hire remote web developers & web designers
  • Glasgow based project management
  • 50 plus strong off shore development team based in Bangalore, India
  • Innovative team members with Web 2.0 expertise
  • Quality driven delivery model
  • Detailed time sheets & daily reporting
  • WordPress Development in Glasgow
  • Drupal Development in Glasgow
  • Joomla Development in Glasgow
  • eCommerce Magento Glasgow
  • Web Development Glasgow
  • Web Design Glasgow
  • jQuery development Glasgow
  • Zend framework development Glasgow
  • Airline IBE GDS Integration Navitaire Glasgow
  • Airline IBE GDS Integration Aamadeus Glasgow