0

我正在尝试为 Hybris 创建一个新模板,但该模板在 SmartEdit 中未显示为可编辑,是否有人对在 Hybris 中创建新模板有任何指示。我按照在线教程进行操作,但它仍然给我一个无效页面...

IMPEX 定义页面模板

INSERT_UPDATE PageTemplate;$contentCV[unique=true];uid[unique=true];name;frontendTemplateName;restrictedPageTypes(code);active[default=true]
; ; ContentPage2Template ; Content Page 2 Template ; layout/contentLayout2Page ; ContentPage

IMPEX 定义内容槽

INSERT_UPDATE ContentSlotName;name[unique=true];template(uid,$contentCV)[unique=true][default='ContentPage2Template'];validComponentTypes(code)
;SiteLogo;;CMSImageComponent,BannerComponent
;HeaderLinks;;CMSLinkComponent,CMSParagraphComponent
;MiniCart;;MiniCartComponent
;NavigationBar;;NavigationComponent
;Section1;;$wideContent
;Section2;;$wideContent
;Section3;;$narrowContent
;Footer;;CMSLinkComponent,CMSParagraphComponent,FooterNavigationComponent

INSERT_UPDATE ContentSlotForTemplate;$contentCV;uid[unique=true];position[unique=true];pageTemplate(uid,$contentCV)[unique=true][default='ContentPage2Template'];contentSlot(uid,$contentCV)[unique=true];allowOverwrite
;;SiteLogo-ContentPage2;SiteLogo;;SiteLogoSlot;true
;;HomepageLink-ContentPage2;HomepageNavLink;;HomepageNavLinkSlot;true
;;NavigationBar-ContentPage2;NavigationBar;;NavigationBarSlot;true
;;MiniCart-ContentPage2;MiniCart;;MiniCartSlot;true
;;Footer-ContentPage2;Footer;;FooterSlot;true
;;HeaderLinks-ContentPage2;HeaderLinks;;HeaderLinksSlot;true

JSP 模板

<%@ page trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="template" tagdir="/WEB-INF/tags/template" %>
<%@ taglib prefix="cms" uri="/cms2lib/cmstags/cmstags.tld" %>
<%@ taglib prefix="breadcrumb" tagdir="/WEB-INF/tags/nav/breadcrumb" %>

<template:page pageTitle="${pageTitle}">
    <breadcrumb:breadcrumb breadcrumbs="${breadcrumbs}" />
    <cms:slot var="feature" contentSlot="${slots.Section1}">
        <div class="span-24 section1 advert">
            <cms:component component="${feature}"/>
        </div>
    </cms:slot>
    <div class="span-20 section2 advert">
        <cms:slot var="feature" contentSlot="${slots.Section2}">
            <cms:component component="${feature}"/>
            </cms:slot>
    </div>
    <div class="span-4 section3 advert last">
        <cms:slot var="feature" contentSlot="${slots.Section3}">
            <cms:component component="${feature}"/>
        </cms:slot>
    </div>
</template:page>

速度模板 Impex

UPDATE PageTemplate;$contentCV[unique=true];uid[unique=true];velocityTemplate[translator=de.hybris.platform.yacceleratorcore.setup.FileLoaderValueTranslator]
;;ContentPage2Template;$jarResource/yacceleratorcore/import/cmscockpit/structure-view/structure_contentPage2Template.vm

速度模板

<div>
    <table width="100%" cellspacing="0" style="margin:0;padding:0;border:1px solid #1E4EBF;">
        <tbody>
            <tr>
                <td height="125px" width="25%" colspan="2" rowspan="2" class="structureViewSection">
                    <cockpit code="SiteLogo"/>
                </td>
                <td colspan="2" class="structureViewSection">
                    <cockpit code="HeaderLinks"/>
                </td>
                <td width="20%" rowspan="2" class="structureViewSection">
                    <cockpit code="MiniCart"/>
                </td>
            </tr>
            <tr>
                <td colspan="2" height="89px" class="structureViewSection">
                    <div>Header</div>
                </td>
            </tr>
            <tr>
                <td colspan="5" class="structureViewSection">
                    <cockpit code="NavigationBar"/>
                </td>
            </tr>
            <tr>
                <td colspan="5" height="58px" style="vertical-align:middle;" class="structureViewSection">
                    <div>Breadcrumb</div>
                </td>
            </tr>
            <tr>
                <td colspan="5" style="vertical-align:top;" class="structureViewSection">
                    <cockpit code="Section1"/>
                </td>
            </tr>
            <tr>
                <td width="80%" colspan="4" style="vertical-align:top;" class="structureViewSection">
                    <cockpit code="Section2"/>
                </td>
                <td width="20%" style="vertical-align:top;" class="structureViewSection">
                    <cockpit code="Section3"/>
                </td>
            </tr>
            <tr>
                <td height="270px" colspan="5" class="structureViewSection">
                    <cockpit code="Footer"/>
                </td>
            </tr>
        </tbody>
    </table>
    <div style="width:100%; border-top: 2px solid #bbb">
        <cockpit code="editor"/>
    </div>
</div>

现在根据 Hybris,这段代码应该可以工作,但它本身就失败了,我已经修复了这个问题,但是 SmartEdit 仍然没有检测到代码

任何帮助将不胜感激

4

1 回答 1

0

更新:我缺少两个内容槽(NavigationBar 和页脚),这不是我的特定构建的标准。这个脚本现在通过添加来修复;

INSERT_UPDATE ContentSlot;$contentCV[unique=true];uid[unique=true];name;active
; ; NavigationBarSlot ; Navigation Bar ; true
; ; FooterSlot;Footer ; true

第一步之后(IMPEX to Define Page Template)

于 2019-11-25T14:47:22.840 回答