Changing the Visibility of Storefront Elements by Using Restrictions

Objective

After completing this lesson, you will be able to prepare restrictions that change the visibility of storefront elements in a static way, including for specific user groups.

Introduction to CMS Restrictions, or Static Personalization

In SAP Commerce Cloud, web content managers have various ways to personalize their content for customers.

In this lesson, we'll focus on CMS restrictions. Think of them as specific rules applicable to components and pages. When applied after matching a predefined condition, they change the visual appearance of a page or component. On the "component level", a customer might see additional components, or a component might be hidden. On the "page level", a customer would simply see a different page, also known as a variation page, which contains different components.

A common example is displaying a "Christmas Sale" banner during Advent. Another approach is to create a page variation tailored for a specific user group. Allowing a category page to showcase different components than usual, but only for that particular category, is also a possible scenario.

Because the conditions that trigger a restriction are predefined and don't change based on user behavior on the storefront, we often refer to these restrictions as "static personalization".

Types of Restrictions

There are three out-of-the-box restriction types manageable within SmartEdit:

  1. Time Restrictions

    Time restrictions limit a component or a variation page to being visible only within a certain date and time range. Outside the defined range, it won't be displayed. For example, on a variation page, the primary page will be shown instead.

    But it can also be the other way around. The component or variation page will explicitly NOT be displayed during the specified time range.

    For example, Laura wants to display a Christmas-related image in December. She creates a corresponding banner component in Basic or Advanced Edit mode. In the Visibility tab, she sets ‘Display component’ to True and creates a Time Restriction, where she sets the date and time:

    Dec 1, 00:00 am until Dec 25, 11:59 pm this year.

    After doing so, she can sync the page and test the results with the Preview Selector by setting the preview time accordingly.

    Let’s see how this looks in SmartEdit:

    A screenshot on the left shows the process of creating a time restriction with a specific date. Another screenshot on the right shows a banner to which the restriction was applied, appearing during the set time and date range.
  2. Usergroup Restrictions

    UserGroup restrictions, as the name suggests, allow or deny a component or a variation page from being visible to members of a specific user group. User groups comprise members who share common characteristics such as gender, address, and so on.

    Laura could, for example, show an additional product carousel on the home page, populated with the newest digital cameras for the user group "tech-lovers". At the same time, all users (including tech-lovers) will still see the original carousel featuring a mix of trending and discounted products.

    To clarify the responsibilities: Laura doesn't assign users to their groups, of course – she simply assigns one or more existing user groups to a restriction.

    Let’s see how that example could be set up with just a few steps in SmartEdit:

    This image consists of three screenshots showing the process for creating a user groupgroup restriction. The first, on the top left, shows the visibility tab for a product carousel component in the Component Editor. A big screenshot on the right then shows the fields that need to be filled to create the restriction. The restriction type, User group Restriction, must be selected, a name entered and a user group chosen. On the bottom right, a screenshot shows the restriction in the Component Editor of the product carousel.

    UserGroup restrictions are also visually supported by SmartEdit’s Preview Selector. It allows selecting a specific user group to view SmartEdit’s pages and components from their perspective, including, for example, matching variation pages and hidden components.

    This screenshot shows the Preview Selector and a highlighted option to choose the perspective from user group together with an already open drop down list of selectable user groups.
  3. Category Restrictions

    Category restrictions limit a component or page to being visible only when certain categories are viewed.

    This restriction is less intuitive, so let’s use an example to illustrate:

    Category pages usually look the same, structure-wise, but with different content/categories listed. If Laura wants to change this behavior for a specific category, she can add a category restriction. The restriction causes any customer visiting this category to see a variation page. This page may show a dedicated banner or other UI component changes.

Step-by-Step Video Content: Applying a Category Restriction to a Variation Page

Now that we know what is possible, let’s see it in action. The demo video you are about to see, will show you how Laura creates a category restriction in practice.

  1. Laura selects a category page called Product List.
  2. In Basic or Advanced Edit, she clones the actual page, making it a variation page that reuses existing components.
  3. Laura creates a category restriction, adds categories to it, including their sub-categories, and applies the restriction to the new variation page. As a result, the new variation category page is created. At first, it looks exactly the same as the original primary page. But because of the new restriction, it can only be displayed for its categories.
  4. Laura adds a banner to the variation page. If she uses a page slot location, it's a simple change in Basic Edit mode.

    Note

    If she uses a shared slot instead, she needs to replace it with an unshared slot. Otherwise, the change to the variation page would be visible on all pages derived from its template. This change would affect the primary page, but could also affect many other pages, too.

  5. After synchronization, the variation page becomes visible in the storefront for the categories defined in its restriction.

Now, let’s refer to the video that covers this topic:

Note

You probably noticed the number of restrictions in the restrictions wizard. There are far more than the three restriction types covered so far. Although they're listed there, they can’t be managed in SmartEdit and are out of scope for this e-learning.

Applying Restrictions to a Page

If the video went a bit too fast for you, then you can go through the details here.

Start under the Pages tab, either while creating a new page, or by editing or cloning an existing page:

  • Creation (1): The Create Page button is located at the top right of the Pages tab. When opening the Page Editor that way, it includes a Restriction tab where Laura can add restrictions.
  • Cloning or Editing (2): By clicking the three dots on any existing page, Laura can select Edit or Clone to open the Page Editor, where she can again find the Restrictions tab.
The image shows a screenshot of the available controls for creating, editing, or cloning a page. Under Pages in SmartEdit, the Create Page button is highlighted. Also highlighted is the three dots menu of a page, with the associated drop down. Here Edit and Clone are highlighted.

Using option 1 Laura can create a variation page and apply a restriction to it. However, she needs to be aware that if she creates a primary page, she does NOT have this option. The Page Creation wizard will show the Display Rules step only on variation pages and not on primary pages.

This image shows a Create Page wizard highlighting the missing tab used to add restrictions.

When choosing option 2, cloning or editing a page, a wizard will guide Laura through the page creation process, including adding a restriction at the end.

This image shows screenshots of the four steps to select a restriction for a page. Flowing from left to right, the first image shows the basic information needed to create a page. The second shows the Information tab, where page name and title must be added. Third is the Restrictions tab, with the Create button highlighted. Beneath is a fourth screenshot, showing the dropdown with various restriction types available. Category Restriction is highlighted.

Note

The same rule regarding primary pages still applies when cloning or editing a page. If Laura wants to clone a primary page for example, the wizard step to add a restriction will not be available.
This screenshot shows the Clone Page wizard with the Display Condition set to Primary highlighted. There are only two steps in this wizard, none covering restrictions.This image shows a Page Editor, with a blank space highlighted, where users would normally expect a tab for Restrictions.

Managing Multiple Applicable Restrictions

If more than one restriction is applied to a page, Laura must specify the condition under which the page is displayed:

Match All:

The page is displayed only when all the page's restriction conditions are met.

In the image below, we see that the page is displayed only if it satisfies both the conditions set in CMSTimeRestriction and CMSUserGroupRestriction.

Match Any:

The page is displayed when at least one page restriction condition is met.

This image shows a Clone Page Editor showing the Restrictions tab. There are two restrictions and the context menu, deciding whether all or any condition of the restrictions need to be fulfilled is highlighted.

Applying One or Multiple Restrictions to a Component

Instead of applying a restriction to a whole page, Laura could also apply it to an individual component.

Laura could, for example, restrict a banner component to be visible or explicitly NOT visible for a specific user group. This is done in Basic or Advanced Edit mode by editing an existing component or while creating a new one. The restriction creation is handled in the Visibility tab of the Component Editor.

If Laura has added multiple restrictions to a component, she must specify the criteria for component visibility. As with multiple restrictions on pages, she can choose either Match All or Match Any in the component editor based on her requirements.

Summary

SmartEdit allows you to change the visibility of storefront elements by using restrictions:

  • The conditions that trigger a restriction are predefined and do not change based on user behavior on the storefront; thus, we often refer to them as "Static Personalization".
  • Time Restrictions limit a component or a variation page to being visible, or, conversely, to becoming explicitly invisible, only within a certain date and time range.
  • Usergroup Restrictions allow or deny a component or a variation page from being visible to members of a specific user group.
  • Category Restrictions limit a component or page to being visible only when certain categories are viewed.
  • If more than one restriction is applied to a page or component, the condition under which it will be displayed is either:

    Match All: Only when all applied restriction conditions are met.

    Match Any: When at least one applied restriction condition is met.

  • Further reading: SAP Commerce Cloud Documentation for SmartEdit – Managing Restrictions