Templates详解
templates
templates存放的是每个页面内容部分的数据
1.每个页面的结构:
- header
 - 内容部分
 - footer
 
对于header和footer存放到sections里面,因为header和footer在每个页面下都是一样的,因此存放的值也是只有一份
而对于content,每个页面类型下的内容都是不一样的,因此内容部分,每个页面对应templates文件夹下的一个文件
- 譬如:首页对应:templates/home.json
 
tempaltes-页面对应关系
tempaltes文件夹里面的每一个文件,对应一个页面的内容部分
1.首页:/
- home.json
 
2.商品专辑页面: /collections/xxxxxx
- 以collection开头的文件
 - 默认:collection.json
 - collection.filter-left-sidebar.json
 - collection.filter-right-sidebar.json
 - collection.full-width.json
 - collection.grid-2-columns.json
 - collection.grid-3-columns.json
 - collection.grid-4-columns.json
 - collection.grid-5-columns.json
 - collection.hidden-sidebar.json
 
2.1全部专辑:/collections
- list-collections.json
 
2.2全部商品:/collections/all
3.商品搜索页面:/search?q=xxxx
- search.json
 
4.商品详情页:/products/xxxxx
- 以product开头的文件
 - 默认:product.json
 - product.grid-1-column.json
 - product.grid-2-columns.json
 - product.grid-max-columns.json
 
5.账号中心
- 账号登录:customer_login.json
 - 账号注册:customer_register.json
 - 忘记密码:customer_reset_password.json 和 customer_resetpw.json (一个提交表单页面,一个邮件验证后的修改密码页面)
 - 订单列表:customer_order.json
 - 订单详细:customer_order_info.json
 - 收藏商品:customer_favorite.json
 - 收货地址:customer_address.json
 - B2C询盘:customer_b2c_inquire.json
 
6.购物车页面:/cart
- cart.json
 
7.订单: /checkout/xxxx
- 订单结账:checkout.json
 
7.1支付确认页面:/checkout/paypal
- 支付:checkout_payment.json
 
7.2订单完成页面:/pay_success/D907133419391027
- pay_success.json
 
8.404
- 404.json
 
9.自定义页面
- page.json
 - page.about-us.json
 - page.faqs.json
 
10.博客专辑
- blog_collection.json
 - blog_collection.list-1-column.json
 
11.博客文章
- blog_article.json
 
12.contacts
- contacts.json
 
13.优惠券单页
- coupon_page.json
 
14.满减活动
- rebate_page.json
 
15.评论汇总
- review_page.json
 
16.限时促销
- seckill_page.json
 
17.联盟营销
- affiliate_apply.json
 - affiliate_balance.json
 - affiliate_commission.json
 - affiliate_dashboard.json
 - affiliate_guide.json
 - affiliate_help.json
 - affiliate_level.json
 - affiliate_link.json
 - affiliate_payment.json
 - affiliate_report.json
 
sections配置结构
文件里面是一个json文件(打开文件:templates/home.json)
- sections:是一个section group,里面是多个section,section值的结构,详细参看:Section-值结构
 - order:多个section进行显示的顺序
 
{
  "sections": {
    "slider-3GSZxxXG7S": {},
    "banner-with-slider-3apvhWWOtl": {},
    "rich-text-u9s91sMegJ": {}
  }
  "order": [
    "slider-3GSZxxXG7S",
    "banner-with-slider-3apvhWWOtl",
    "rich-text-u9s91sMegJ"
  ]
}
需要注意的是,templates下面的文件内容,是在模版装修,进该页面进行模版装修后,加入的内容,一般不需要手动编辑(除非您对这个方面非常熟悉)
- 当然,有一些页面不支持模版装修,譬如:账户中心,那么这些页面如果想加入一些装修卡片,就只能手动更改对应的template文件,进行手动更改
 
支持模版装修的页面
在这里,可以看到支持模版装修的页面
- 这些页面,对应的templates文件,不需要手动编辑,通过模版装修修改即可
 

譬如:首页,模版装修
- 左侧是模版装修添加的卡片
 - 点击右侧的发布按钮,将进行保存内容部分的卡片,保存到
template/home.json文件 

通过这里,我们可以详细的了解到
- templates下面的每个文件,对应一个页面。
 - 每个文件的json配置内容,就是这个页面在模版装修添加的卡片,进行发布后,保存后的配置值