如何创建SAP Commerce Cloud Page Templates

215 阅读1分钟

Page Template

Step 1 - You would need to first create a PageTemplate, which define the layout for pages using the following fields below.

首先创建一个新的Page Template:

INSERT_UPDATE PageTemplate;$contentCV[unique=true];uid[unique=true];name;frontendTemplateName;restrictedPageTypes(code);active[default=true]
  • frontendTemplateName is used to define the JSP that shuold be used to render the page for pages with multiple layouts.
  • restrictedPageTypes is used to restrict templates to page types.

ContentSlotNames

Step 2 - Each PageTemplates can have multiple content slot names which helps with the positioning, where we can state a list of valid components for the slot.

Page Templates可以分配多个content slots. 每个slot包含多个Components.

There exists standard set of slots, such as SiteLogo, HeaderLinks MiniCart and NavigationBar, and a number of specific slots for each template.

有些slots是所有page共享的,比如SiteLogo,HeaderLinks,NavigationBar. 有的slot是某些页面特有的。

INSERT_UPDATE ContentSlotName;name[unique=true];template(uid,$contentCV)[unique=true][default='CategoryPage'];validComponentTypes(code);compTypeGroup(code)

Below the INSERT_UPDATE, we can see a number of content slot name available for the specific PageTemplate as specified in the statement default=‘CategoryPage’.

validComponentType or compTypeGroup defined the valid components for the slot.

ContentSlotForTemplate

Step 3 - We need to bind the content slots to page templates as it defines the relationship between team.

这一步,将Content Slot分配给template.

INSERT_UPDATE ContentSlotForTemplate;$contentCV[unique=true];uid[unique=true];position[unique=true];pageTemplate(uid,$contentCV)[unique=true][default='ProductDetailsPageTemplate'];contentSlot(uid,$contentCV)[unique=true];allowOverwrite

Create pages using the template

最后一步,基于之前创建的page template,创建一个新的page.

Step 4 - Finally, pages are created using the template

INSERT_UPDATE ContentPage;$contentCV[unique=true];uid[unique=true];name;masterTemplate(uid,$contentCV);label;defaultPage[default='true'];approvalStatus(code)[default='approved'];homepage[default='false'];previewImage(code, $contentCV)[default='ContentPageModel__function_preview']

masterTemplate: By specifying the page template you have created, you can create a page.