close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2104

Table Of Contents

6.1.2 Augmented Categories and Products

Categories and products can be augmented with content of type CMExternalChannel and CMExternalProduct, respectively. These content objects are created in Studio, if you choose the menu item Augment Category for categories or Augment Product for products. See Section 6.2.3, “Adding CMS Content to Your Shop” in Studio User Manual for more details.

If a product is augmented, an augmenting content is created and the product/category is linked internally via the externalId field. If you query the augmentation for the product/category from the Headless Server, the augmenting content can be accessed via the field content. Note that not every product/category is augmented and therefore this field can be null.

In contrast, page grid placements are inherited along the navigation hierarchy. For example, a product variant cannot be augmented itself, instead it inherits placements from the parent product, a product inherits placements from its category, which in turn inherits placements from its parent category or channel, all up the navigation hierarchy.

Page grid placements of categories, products and product variants can be retrieved with the grid field, just the same way as for CMChannel content objects. For categories, the placements of the ordinary page grid are retrieved, while for products the Product Detail Page (PDP) and the corresponding pdpPagegrid is used. Product variants simply inherit all placements from their parent product.

The placements within a page grid might be retrieved as a whole, including the whole grid structure with grid rows. Alternatively, a plain list of placements can be retrieved, optionally filtered by placement names. In the following example, only the placements "header" and "additional" are retrieved for a product:

{
      commerce {
    productAugmentationBySite(externalId: "PC_BRITISH_TEA", siteId: "99c8ef576f385bc322564d5694df6fc2") {
      commerceRef {
        externalId
        siteId
        locale
      }
      content {
        repositoryPath
        ... on CMTeasable {
          title
          teaserText
        }
      }
      pdpPagegrid {
        placements(names: ["header", "additional"]) {
          name
          items {
            name
            type
            ... on CMTeasable {
              teaserTitle
              teaserText
              picture {
                uriTemplate
              }
            }
          }
        }
      }
    }
  }
}

In this example, you also query the title and teaserText fields of an associated content. Note that this content field is only non-null if this product is actually augmented. The same is true for the content in categories - that field is only non-null if exactly this category is augmented, the field value is not inherited from the parent category.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.