Aspect Types

To implement a dynamic page, create an aspect type meta definition file that defines the attributes required for a particular business use. The aspect type meta definition file also defines the business object type that the merchant can bind to the page when the page is created. In the meta definition file for the page type, specify which aspect types are supported for the page type.

To view the schema file that describes the JSON formatting for the aspect type meta definition file, see Page Designer JSON Schemas.

Put the aspect type meta definition file in the following directory of the custom cartridge, or any arbitrary subdirectory within this directory:

<your_cartridge>/cartridge/experience/aspects

Currently, category is the only supported value for object_types. You can also create an aspect type with no supported object type declared. For example, you could implement a Product List page that depends on the results of a query, not the assignment of a category, to determine which products to display on the page.

The following examples show aspect meta definition files for a Product List page and a Product Detail page. The Product List page aspect type has one attribute for category and supports the object type category, which the merchant assigns during page creation. The Product Detail page aspect type has two attributes, one for product and one for category. The Product Detail page also supports the object type category, which the merchant assigns during page creation. All products in the assigned categories use the Product Detail page.

aspects/plp.json

{
  "name": "Product List Page",
  "description": "The product list page for a given category.",
  "attribute_definitions": [
      {
          "id": "category",
          "name": "Category",
          "type": "category"
      }
  ],
  "supported_object_types": [
      "category"
  ]
}
aspects/pdp.json

{
  "name": "Product Details Page",
  "description": "The product details page for a given product.",
  "attribute_definitions": [
      {
          "id": "product",
          "name": "Product",
          "description": "The product to render the pdp for.",
          "type": "product",
          "required": true
      },
      {
          "id": "breadcrumb_category",
          "name": "Breadcrumb Category",
          "description": "The optional category context of the pdp, for breadcrumb purposes.",
          "type": "category",
          "required": false
      }
  ],
  "supported_object_types": [
      "category" 
  ]
}

Specify the supported aspect types in the page definition file for the page type, as in the following example. Because this page type declares support for the plp aspect type, the page requires the category attribute defined in the plp.json meta definition file. Category is the dynamic attribute that the controller or script uses to render the page in the storefront.

pages/plplayout.json

{
	"name": "Product List Page Layout",
	"description": "A layout for a product list page with a region to contain a product grid component.",
	"supported_aspect_types": [
		"plp"
	],
	"region_definitions": [{
		"id": "main",
		"name": "Main Region"
	}]
}

You can create a page type that supports more than one aspect type. During page creation, the merchant selects which aspect type to use for the page by selecting a Page Purpose in the page creation wizard.

pages/dynamiclayout.json

{
	"name": "Dynamic Layout",
	"description": "A generic layout whose region can use any kind of component.",
	"supported_aspect_types": [
		"plp",
		"pdp"
	],
	"region_definitions": [{
		"id": "main",
		"name": "Main Region"
	}]
}
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.