close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2010

Table Of Contents

6.4.2 Augmented Categories and Products

Categories and products can be augmented with content of type CMExternalChannel and CMExternalProduct, respectively. These content objects are created by 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, the augmenting content is available in the externalProduct. Note that this externalProduct field is only non-null if this product is actually augmented. The same is true for the externalChannel in categories - that field is only non-null if exactly this category is augmented, the field value is not inherited from the parent category.

In contrast, page grid placements are inherited along the navigation hierarchy. For example, a product variant 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) page grid 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 {
    product(siteId: "sfra-en-gb",
            externalId: "sfcc:///catalog/product/25448070M") {
      externalId
      name
      externalProduct {
        name
        teaserTitle
      }
      grid {
        placements(names: ["header", "additional"]) {
          name
          items {
            name
            type
            ... on CMTeasable {
              teaserTitle
              teaserText
              picture {
                uriTemplate
              }
            }
          }
        }
      }
    }
  }
}

In this example, you also query the name and teaserTitle fields of an associated externalProduct. Note that this externalProduct field is only non-null if this product is actually augmented. The same is true for the externalChannel 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