Using hybris PCM for handling non-product items


Situation

There are the following business requirements for one of the grocery stores:
  • add a news feed with
    • news categories and
  • add a recipe list with
    • recipes filtering
    • cross-links with products: each recipe may be linked with ingredients from the product catalog, relevant recipes at the product page
A general approach to implement these requirements is the following:
  • Create custom item types,
    • News item type. One of the attributes is a category (or list of categories).
    • News category item type..
    • Recipe item type.
    • Relation: Recipe<->Product (N:N)
  • Create custom CMS page controllers
    • News page controller
      • News list. Shows a list of News items.
      • News  details. Shows a selected News page.
    • News Category navigation. Shows a list of categories.
    • Recipes controller
      • Recipe list. Show a list of recipes.
      • Recipe details. Shows a selected Recipe page.

Complexity

There is a lot of existing news and recipes that are supposed to be migrated from the existing website. Possibly, the client will need to add search capabilities in the future as well as the filtering/tagging.

Challenge

How to speed up the development without losing flexibility? How to leverage existing hybris functionality?

Solution

The solution is to use product data model to store non-product items like news and recipes. The additional product type should be added. Product categories will serve as news categories. Product page details might be used for news detail and recipe details. News and recipes could be stored in the SOLR index to re-use product list and search results capabilities and templates. However, this solution has its pros and cons. Using improper objects for news and recipes could make the solution less clear. Some side effects could occur as well – especially if the hybris content development has not been harmonized with the hybris commerce development. © Rauf Aliev, June 2016

2 Responses

  1. Monica Secelean

    Monica Secelean

    Reply

    20 February 2017 at 07:56

    In the situation described above, I would rather go for the clean, straight-forward solution, namely modeling news and recipe as custom item types. Considering them products violates the abstraction principle (as described by G. Booch in Object-Oriented Design With Applications “An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of object and thus provide crisply defined conceptual boundaries, relative to the perspective of the viewer.” – one can hardly consider news or recipe products to be bought in a grocery store).
    One would need the Product Details Page to be able to – obviously – see the details of a product and, as stated in the requirement to see “relevant recipes at the product page”, so you could not use it as recipe/news details page, because you might have other attributes/need another view for your custom types – for eg. you may not have prices for news 🙂
    Finally, you could add your custom types to be indexed by SOLR without considering them Products, so that you can search through them efficiently.

Leave a Reply