Dynamic product list and product detail pages with aspect types
Key Takeaway
An aspect type lets one Page Designer template serve many categories or products. At runtime, a component attribute with dynamic_lookup takes the aspect attribute's value unless the merchant saved a value on the component. PageMgr.getPageByCategory() walks up the category tree when a subcategory has no page of its own.
A dynamic page is a Page Designer page whose content is filled in at runtime from attributes such as a category or product. Because of that, one Product List or Product Detail template can serve many categories. The developer makes this possible with an aspect type, a meta definition file that declares which runtime attributes the page needs and which business object (category or product) merchants can assign the page to.
What a dynamic page is
A normal Page Designer page shows content the merchant set at design time. A dynamic page also uses dynamic attributes passed in at runtime to decide what it shows. As a result, one template page can stand in for many category pages.
The work splits between the developer and the merchant:
- The developer creates an aspect type for a business use, such as Product List or Product Detail.
- The developer assigns the aspect type to a page type, which defines the layout.
- The merchant creates a template page from that page type and assigns it to categories.
- When the storefront needs a page for an assigned category, the template displays. Its content comes from that category.
When a merchant assigns a template page to a category, all of that category's subcategories are implicitly selected. To preview the template in the Visual Editor, the merchant picks a category under "Preview Settings for Dynamic Attributes".