Commerce tenant and site scaffolding
Scaffolding refers to the way that SXA creates a tenant and site using predefined modules. Scaffolding is a quick way to create a tenant and site with default pages and structure. SXA Storefront extends the SXA modules with four scaffolding plans, each of which adds its own features and functionality.
A scaffolding plan is an SXA Storefront feature that manages the creation of site items during site scaffolding. When you install a scaffolding module that contains a scaffolding plan, the script deploys all the items defined as part of the plan to the correct location under the new site. It is similar to branch templates but, unlike branch templates, definition items (or source items) do not have to be under only one branch template or under the same parent. In addition, plan items can have relative links to other items under the site. These links (paths or IDs) are replaced during site creation and scaffolding plan deployment and are resolved to the correct items under the newly created site.
The default SXA Storefront specific plans are detailed in the following table.
Plan name |
Location |
Description |
---|---|---|
Commerce Foundation Scaffolding Plan |
/sitecore/System/Settings/Foundation/Commerce Experience Accelerator/Commerce Foundation/Commerce Foundation Scaffolding Plan |
This is a tenant level plan. It contains snapshot items that belong to the tenant. For Commerce features and functions to be added to the tenant, you must select this plan. |
Habitat Catalog Scaffolding Plan |
/sitecore/System/Settings/Feature/Commerce Experience Accelerator/Habitat Catalog/Habitat Catalog Scaffolding Plan |
This is a site level plan and is used to set Habitat Catalog as the default catalog for the site. This plan is optional. |
Storefront Components Scaffolding Plan |
/sitecore/System/Settings/Feature/Commerce Experience Accelerator/Storefront Components/Storefront Components Scaffolding Plan |
This is a site level plan. It contains snapshot items that belong to the site and builds the storefront components, including data sources and rendering variants. For Commerce features and functions to be added to the site, you must select this plan. |
Storefront Template Scaffolding Plan |
/sitecore/System/Settings/Project/Commerce Experience Accelerator/Storefront Template Scaffolding Plan |
This is a site level plan and contains snapshot items and configurations for the Storefront site template. This plan is optional. |
A scaffolding plan consists of the following items:
-
A definition item
-
A snapshot item
-
A source item
-
A deployment script
-
A deployment scaffolding action
You can customize a scaffolding plan to, for example, add a new page or run a new script automatically when you create a tenant and site.
Definition item
The plan definition item must be based on /sitecore/Templates/Foundation/Commerce Experience Accelerator/Scaffolding/Scaffolding Plan template, and placed under /sitecore/System/Settings/<Foundation or Feature or Project>/<module>/<Scaffolding Module Name>.
Snapshot item
A snapshot item is an auto-generated item created under /sitecore/System/Settings/Foundation/Commerce Experience Accelerator/Scaffolding/Snapshot Items/<scaffolding plan name>/<The location of the source item under Branches templates>. The snapshot item contains metadata of the source item and details where it should be located under the site. It also contains field values, which are tokenized relative links. When deploying the scaffolding plan as an action in the scaffolding module, all the items in the plan are processed individually. This means the source item is copied to the correct location under the site and the associated fields and tokens are resolved with the correct values.
Snapshot items contain the default values for fields. These field values are resolved when you run the scaffolding. Snapshot items are grouped with the same hierarchy as in the branch template. The snapshot item contains all the field values in all available languages in the form of a JSON serialized object. You can see this in the Snapshot Data field. For example, on the Content tab for the Catalog Navigation Page (/sitecore/System/Settings/Foundation/Commerce Experience Accelerator/Scaffolding/Snapshot Items/Commerce Foundation Scaffolding Plan/Foundation/Commerce Experience Accelerator/Commerce Foundation/Tenant Templates/Catalog Navigation Page), you see the following:
Source item
A source item is an item from the branch template that defines the structure of the item to be created during scaffolding. Source items are the main item definitions that are deployed to the new site during scaffolding.
Deployment script
A deployment script is a Sitecore Powershell Extension (SPE) script that when executed processes the items that belong to the scaffolding plan and deploys them to the correct location under the newly created site. It also resolves the tokenized field values based on the snapshot items.
Deployment scaffolding action
A deployment scaffolding action is an ExecuteScript step under the scaffolding module that references the plan deployment script.