CMS Element (for Shopping Experiences)

In order for Shopware6 to make Boxalino API requests from the context of CMS pages, the Boxalino API Narrative CMS element must be used.

  1. The CMS element is part of the Framework Layer repository.

  2. The CMS element is part of the Commerce Block category.

  3. Once added on a Layout, the CMS element must be configured

Configurations

 

 

 

Property

Required

Description

Property

Required

Description

1

Widget

yes

The widget property on the API Request Schema
Narrative API - Technical Reference | Base parameters

  • a narrative must exist in Intelligence Admin linked to the widget

2

Sidebar Layout

no

If set to yes - the API Request will have a context parameter position:sidebar

  • the Context Parameter can be used for the narrative layout (check the navigation or search narrative)

3

Add Store Filterable Properties to API Request

no

When active, will add all the Properties defined in your e-shop that have the filterable flag active to the API request.

Available from tag 3.0.3

Benefits:
Facet configuration in IA becomes optional (except for when custom properties on facets are desired)

4

Nr of products returned

yes

The hitCount property on the API Request Schema Narrative API - Technical Reference | Base parameters

5

Group by (field name)

yes (default provided)

The groupBy property on the API Request Schema Narrative API - Technical Reference | Typical parameters

6

Apply Request Parameters

yes

If set to yes - the API request will read the page URL and set the facets

  • recommended for the navigation integration

  • not recommended for the CMS sliders (ex: having a “category best-seller” slider on a category which is not integrated with Boxalino)

7

Returned Fields

no (default provided)

The returnFields property on the API Request Schema Narrative API - Technical Reference | Typical parameters

  • divided by comma

  • list of fields to be returned from the available data index

  • the products_ prefix is required for properties (ex: products_brand)

8

Filters

no

default filters (per integration context) are status, visibility and the Category Filter configuration

  • different filters must be divided by comma (,)

  • multiple filter options must be divided by the division character | (pipe)

9

Category Filter

no (default provided)

Setting a category ID as a filter

  • for navigation widget integration, use the Current Category option

  • for home widget integration (or landing pages, generic contexts), use the Sales Channel Navigation Category option

  • for custom category ids filter, use the Custom category IDs option

10

Category List for Filters

no

When the “Category Filter” option is set to “Custom category IDs”, add the category IDs (HEX) divided by a comma (,)

11

Facets

no

List of custom selected facet filters on the CMS element (ex: products_brand=Killing Inc|Mann Inc,products_size=37 ):

  • different facets must be divided by comma (,)

  • multiple facet options must be divided by the division character | (pipe)

12

Sort

no

The sort option key (for pre-selected sorting in the request)

13

Context Parameters

no

Available from tag 2.4.1

List of custom parameters to be added to the API Request properties (key-value) (ex: campaign=christmas-bestsellers):

  • different parameters must be divided by comma (,)

  • multiple parameter values must be divided by the division character | (pipe)

Practices

For a transparent integration and a consistency across your project, the following practices are recommended:

  1. Creating a Boxalino Navigation Sidebar Landing Page (in Shopping Experiences Layouts)

    1. to be used for navigation-like widgets, as a layout for Category pages (with Navigation CMS element)

    2. to be used for other pages with facets, on which the navigation CMS element is also desired

    3. you can also add EMPTY sections above and bellow (for content top and bottom)

  2. Creating a Boxalino Full Layout Landing Page (in Shopping Experiences Layout)

    1. to be used for navigation-like widget, as a layout for Category pages (without Navigation CMS element)

    2. to be used for other pages, where the Navigation CMS element is not needed

  3. Creating a Boxalino Sidebar Layout Landing Page (in Shopping Experiences)

    1. to be used for sidebar layout contexts

      1. the sidebar content is to be defined in the narrative structure in Boxalino Intelligence Admin

The above elements are contextual.

When used as Layout Assignment in a Category or CMS page, the widget and the other properties can be edited.

 

How the CMS request is done

This is a topic useful for integrators in order to understand how the CMS elements can be extended or rewritten.

The following elements have to be reviewed:

  1. ApiCmsLoaderSubscriber

    1. https://github.com/boxalino/rtux-shopware/blob/master/src/Framework/Content/Subscriber/ApiCmsLoaderSubscriber.php

      1. reads the CMS configurations (as set in the CMS element)

      2. makes the API request (via the ApiCmsLoader)

      3. loads the data in the block/section/slot

      4. updates the sidebar section with the left content

    2. it is used only when integrated in the project`s Integration Layer https://github.com/boxalino/rtux-integration-shopware/blob/master/src/Resources/config/services/api/cms.xml#L25

    3. it is a kernel event subscriber for the CmsPageLoadedEvent

  2. CmsContext

    1. per any integration requirement, the context is explicit defined in the Integration Layer

      1. ex: https://github.com/boxalino/rtux-integration-shopware/blob/master/src/Framework/Request/Context/Cms.php

      2. used to define the default return fields for the CMS context request

    2. it uses the Framework Layer CmsContextAbstract class as base

      1. https://github.com/boxalino/rtux-shopware/blob/master/src/Framework/Request/CmsContextAbstract.php

      2. function addContextParameters(RequestInterface $request) : void used to add new properties (key-value) to the Api Request Schema Narrative API - Technical Reference | Typical parameters

      3. function getContextNavigationId(RequestInterface $request): array used to set the category ID filter (from the options defined in the CMS configurations view)

      4. function addFilters(RequestInterface $request) : void adds the default filters (visibility, active, category ID) and the ones defined in the CMS configurations for filters

      5. function addFacets(RequestInterface $request): ListingContextAbstract : if Apply Request Parameters : yes - parses the URL for the facet filters; else - will set the facets values defined in the CMS configuration

  3. ApiCmsLoader

    1. https://github.com/boxalino/rtux-shopware/blob/master/src/Framework/Content/Page/ApiCmsLoader.php

      1. based on the Shopware6 concept of PageContentLoader

      2. it will return a Shopware6 page https://github.com/boxalino/rtux-shopware/blob/master/src/Framework/Content/Listing/ApiCmsModel.php

        1. the Shopware6 page is declared as a public service https://github.com/boxalino/rtux-shopware/blob/master/src/Resources/config/services/api.xml#L22

      3. it loads the Shopware6 Category model/data which can be used in templates

        1. as described in the wiki https://github.com/boxalino/rtux-integration-shopware/wiki/Navigation-Context#about

        2. as seen in the code https://github.com/boxalino/rtux-shopware/blob/276f1b35b587656e4b787a737bee552c2f587665/src/Framework/Content/Page/ApiCmsLoader.php#L57

    2. it is used only when integrated in the project`s Integration Layer https://github.com/boxalino/rtux-integration-shopware/blob/master/src/Resources/config/services/api/cms.xml#L18