详情模板
详情模板功能允许商户创建可复用的商品详情页模板,通过使用预定义的变量,可以快速生成标准化的商品详情内容。
功能说明
在商品管理中,您可以创建多个详情模板,并在发布或编辑商品时选择使用。模板支持HTML代码编辑,并提供了丰富的变量供调用。
模板管理
进入 商品 > 详情模板 页面,您可以进行以下操作:
- 新建模板:点击"新建模板"按钮创建一个新的详情模板。
- 编辑模板:修改现有模板的名称、描述、内容等。
- 设为默认:将常用模板设为默认,发布商品时可优先选择。
- 复制模板:基于现有模板快速创建一个副本。
- 预览:查看模板渲染后的效果。
- 启用/禁用:控制模板是否在商品编辑页显示。
模板编辑
在编辑模板时,您需要填写以下信息:
- 模板名称:用于识别模板,必填。
- 模板描述:简要说明模板的用途或适用商品类型。
- 排序:数字越小越靠前。
- 状态:启用或禁用。
- 设为默认:是否作为默认模板。
- 模板内容:使用HTML和变量编写模板结构。
模板语法
系统支持简单的模板语法:
- 变量输出:使用
{{变量名}}输出变量值。例如:{{name}}输出商品名称。 - 条件判断:使用
{{#变量名}}...{{/变量名}}进行条件判断,当变量有值时才显示包裹的内容。
示例:
html
<!-- 基础使用 -->
<p>商品名称:{{name}}</p>
<!-- 条件判断 -->
{{#author}}
<p>作者:{{author}}</p>
{{/author}}可用变量
以下是可以在模板中使用的变量列表:
基础信息
| 变量名 | 说明 | 示例 |
|---|---|---|
{{id}} | 商品ID | {{#id}}<span data-id="{{id}}"></span>{{/id}} |
{{extId}} | 外部商品ID | {{#extId}}<p>商品编号:{{extId}}</p>{{/extId}} |
{{extSecondaryId}} | 外部商品编码 | {{#extSecondaryId}}<p>编码:{{extSecondaryId}}</p>{{/extSecondaryId}} |
{{name}} | 商品名称 | {{#name}}<h2>{{name}}</h2>{{/name}} |
{{price}} | 市场价 | {{#price}}<p>定价:¥{{price}}</p>{{/price}} |
{{barcode}} | 条码/ISBN | {{#barcode}}<p>ISBN:{{barcode}}</p>{{/barcode}} |
通用商品属性
| 变量名 | 说明 | 示例 |
|---|---|---|
{{brand}} | 品牌 | {{#brand}}<p>品牌:{{brand}}</p>{{/brand}} |
{{model}} | 型号 | {{#model}}<p>型号:{{model}}</p>{{/model}} |
{{specification}} | 规格 | {{#specification}}<p>规格:{{specification}}</p>{{/specification}} |
{{color}} | 颜色 | {{#color}}<p>颜色:{{color}}</p>{{/color}} |
{{material}} | 材质 | {{#material}}<p>材质:{{material}}</p>{{/material}} |
{{weight}} | 重量 | {{#weight}}<p>重量:{{weight}}</p>{{/weight}} |
{{origin}} | 产地 | {{#origin}}<p>产地:{{origin}}</p>{{/origin}} |
{{unit}} | 单位 | {{#unit}}<p>单位:{{unit}}</p>{{/unit}} |
{{packingList}} | 包装清单 | {{#packingList}}<p>包装清单:{{packingList}}</p>{{/packingList}} |
{{warranty}} | 质保信息 | {{#warranty}}<p>质保:{{warranty}}</p>{{/warranty}} |
{{category}} | 商品分类 | {{#category}}<p>分类:{{category}}</p>{{/category}} |
{{categoryPath}} | 分类路径 | {{#categoryPath}}<p>{{categoryPath}}</p>{{/categoryPath}} |
{{tags}} | 标签 | {{#tags}}<span>{{tags}}</span>{{/tags}} |
{{keywords}} | 关键词 | {{#keywords}}<meta name="keywords" content="{{keywords}}" />{{/keywords}} |
{{productType}} | 商品类型 | {{#productType}}<span>类型:{{productType}}</span>{{/productType}} |
{{description}} | 商品描述 | {{#description}}<div>{{description}}</div>{{/description}} |
图书专用属性
| 变量名 | 说明 |
|---|---|
{{author}} | 作者 |
{{translator}} | 译者 |
{{publish}} | 出版社 |
{{publishDate}} | 出版日期 |
{{printingDate}} | 印刷日期 |
{{edition}} | 版次 |
{{impression}} | 印次 |
{{seriesTitle}} | 丛书名 |
{{binding}} | 装帧 |
{{pageNum}} | 页数 |
{{wordsNum}} | 字数 |
{{size}} | 开本 |
{{clc}} | 中图法分类号 |
{{editorRecommendation}} | 主编推荐 |
{{contentIntroduce}} | 内容简介 |
{{catalog}} | 目录 |
{{digest}} | 摘要 |
{{authorIntroduce}} | 作者简介 |
{{preface}} | 精彩内容/前言 |
{{mediaComment}} | 媒体评论 |
媒体资源
| 变量名 | 说明 |
|---|---|
{{image}} | 商品主图URL |
{{imageList}} | 商品图片列表 |
{{details}} | 采集描述/详情HTML |
{{platform}} | 数据来源平台 |
{{sourceUrl}} | 商品URL |
系统字段
| 变量名 | 说明 |
|---|---|
{{createTime}} | 创建时间 |
{{updateTime}} | 更新时间 |
