Multi-country content catalogs – hybrismart | SAP hybris under the hood

Multi-country content catalogs


 Situation

  • There are N regional websites, one per country.
  • The global marketing teams are responsible for global content.
  • The local marketing teams should be able to manage local content only.
  • Global teams should be able to manage some local content also if they have enough permissions.
  • The system should be idiot-proof, which means that any changes made by the regional administrators should affect only their website, not other local websites.

There are two ways to implement it partially:

  • Multi-language”: It is good if all the websites have the same design and components. Any exceptions should be implemented as hybris CMS restrictions. It is impossible or very difficult to configure the proper permissions. In this solution, the CA website administrator can change US website content – this is why this solution is partial. When the number of regions/countries is more than 3-4 this solution is also inconvenient.
  • Different pages for different countries. Per-page permissions. It will work, but with data duplications. Out-of-the-box apparel stores are implemented this way.

Complexity

Although the data model is prepared for having multiple content catalogs assigned to a single website (CMSSite), the cockpit itself is not ready. For the single content catalog, out-of-the-box hybris doesn’t have any capabilities to hide a particular content slot for the user who doesn’t have enough permissions to manage it.

Challenge

Hide particular content slots in hybris WCMS, depending on  the current administrator’s rights.

content.png

Solution

Technical solution

Architecture

WCMS part

There is an “interceptor” – the hybris layer between the model class and the service class. This interceptor replaces slot names on the fly.

 

wcms-1-diagram

Sequence diagram of WCMS-LoadInterceptor interaction

 

Storefront part

Page Controller or Filter should set a variable “region” and push into JSP.

JSP’s pageSlot tag has an attribute “position”. In our solution we will build the value of “position” attribute dynamically using value of “region” variable.

content2

PageTemplateModel.onLoad Interceptor

public class LoadVelocityTempateInterceptor implements LoadInterceptor<PageTemplateModel> {

@Resource
UserService userService;

@Resource
SessionService sessionService;

@Resource
CMSSiteService cmsSiteService;

@Override
public void onLoad(PageTemplateModel o, InterceptorContext var2) throws InterceptorException
{
// check if the request is from backoffice (WCMS)
if (cmsSiteService.getCurrentSite() != null) { return; }
String vt = o.getVelocityTemplate();
UserModel currentUser = userService.getCurrentUser();
Set < UserGroupModel > groups = userService.getAllUserGroupsForUser(currentUser);
Iterator < UserGroupModel > iter = groups.iterator();
while (iter.hasNext()) {
UserGroupModel ugm = iter.next();
String groupStr = ugm.getUid();
if (groupStr.indexOf("reg_")!=-1) {
vt = vt.replace("_regional_", "_reg_"+groupStr);
o.setVelocityTemplate(vt);
return;
}
}
}
}

Page Controller

...
model.addAttribute("regional", AreWeOnCanadianWebsite() ? "reg_ca" : "reg_us");
...

JSP template

reg1.png

Velocity Template (for WCMS)

reg2.png

 

© Rauf Aliev, June 2016

12 Responses

  1. Tobias Ouwejan

    Tobias Ouwejan

    Reply

    15 September 2016 at 04:41

    Hi Rauf, interesting article and approach! Thanks for sharing. Not sure if you’re aware, but we (Expert Services) have implemented a multi-country solution to tackle this problem as well and provide that as a solution add-on to hybris. Have a look at https://wiki.hybris.com/display/hybrisALF/Multi+Country+and+Channel+WCMS+Enhancements or find more details at https://wiki.hybris.com/display/hybrisALF/Content+Catalog+Design.

  2. Vikramjit

    Vikramjit

    Reply

    28 September 2016 at 05:11

    Hi Rauf,

    Thanks for sharing the important concepts in and around Multi country content catalog design and implementation

    Is this extension available on request for reference?

  3. npkismyhomeRoy

    npkismyhomeRoy

    Reply

    30 August 2017 at 06:12

    Hi Rauf, Could you share the extension you created for the multi country content catalog implementation or at least a comprehensive document. Thanks in anticipation

  4. Cistus Plus werking

    Cistus Plus werking

    Reply

    29 October 2018 at 05:29

    I enjoy reading through your site. With thanks!

Leave a Reply