Shared theme data and rendering inputs
Templates receive routeConfig.viewModel. A page selects its data areas; the storefront render step adds security, search state, account-header data and footer data. Do not assume that every area exists on every page. Error responses use a smaller page model.
Reading the tables
Section titled “Reading the tables”Paths start with viewModel. [] denotes an array element; [id] denotes an identifier-keyed entry. CFML struct keys are case-insensitive. object means a CFML struct. An empty object does not imply that its child fields exist.
Use each template page to find the data available for that rendering context. Optional values depend on shop configuration and the current request. Do not treat a field listed for one page as a global field available everywhere.
Before reading conditional data, check its parent and its prepared availability flags. In catalog mode or a restricted storefront, prices and cart data can be removed or disabled before rendering. Never reconstruct suppressed values.
Common structures
Section titled “Common structures”- Shop identity, branding and theme assets.
- Page metadata, URLs and breadcrumbs.
- Navigation, language switcher and currency switcher.
- Labels, security and account header.
- Cart preview and footer.
The individual template page identifies its shared structures and lists its page-specific data.
Output and formatting
Section titled “Output and formatting”| Value | Rendering |
|---|---|
| Plain text, names, labels | encodeForHtml(value) |
| URLs and HTML attribute values | encodeForHtmlAttribute(value) |
| Prepared price labels | Display unchanged; do not calculate or reformat prices. |
Prepared bodyHtml, textHtml, inputHtml |
Output as HTML only where that field explicitly provides prepared markup. |
| Prepared JSON | Preserve the prepared payload and the script-safe embedding shown in the package. |
| Empty arrays / objects | Show the prepared empty state; do not load replacement data. |
Use security.csrf.inputHtml inside POST forms. For JavaScript POST requests use security.csrf.headerName and security.csrf.token. Keep prepared action URLs and form field names. A theme does not decide authorization or checkout validity.
Render inputs outside viewModel
Section titled “Render inputs outside viewModel”request.pageContent is the rendered page body consumed by the layout. request.resolveStorefrontView(logicalPath, themeKey) resolves an included template.
Local partial inputs, such as productCard, categoryCard, filtersData and customFieldGroups, are documented on their partial pages. Navigation branches use custom-tag attributes. These values are not additional viewModel roots.
<cfset productCard = viewModel.catalog.items[1]><cfset productCardHeadingTag = "h2"><cfinclude template="#request.resolveStorefrontView('partials/product_card.cfm', viewModel.theme.key)#">Only use this example when the catalog contains an item.