【发布时间】:2018-04-18 15:47:45
【问题描述】:
我正在为我的网站制作自己的产品滑块。 我有自己的动态部分,在“自定义主题”中您可以选择 5 个产品。
我可以使用 {{ section.settings.product-1 }} 拉出产品句柄,但是如何获取产品 ID、产品名称、产品价格、产品图片网址等?
像 {{ product.title }} 这样的东西不起作用,因为它不知道从哪里获取信息。
我当前的代码是:
<div class="wrapper">
<div class="section-header text-center">
<h2 class="h1 section-header__title"> {{ section.settings.text-box }}
</h2>
</div>
<div class="rte">
<div class="gallery js-flickity" data-flickity-options='{ "freeScroll": true, "wrapAround": true }'>
<div class="gallery-cell"> </div>
<div class="gallery-cell"> Text </div>
<div class="gallery-cell"> Text </div>
<div class="gallery-cell"> Text </div>
</div>
</div>
</div>
{% schema %}
{
"name": "Featured Slider",
"settings": [
{
"id" : "text-box",
"type" : "text",
"label" : "Title of Section",
"default" : "Featured Products"
},
{
"type" : "product",
"id" : "product-1",
"label" : "Featured Product"
},
{
"type" : "product",
"id" : "product-2",
"label" : "Featured Product"
},
{
"type" : "product",
"id" : "product-3",
"label" : "Featured Product"
},
{
"type" : "product",
"id" : "product-4",
"label" : "Featured Product"
},
{
"type" : "product",
"id" : "product-5",
"label" : "Featured Product"
}],
"presets": [
{
"name" : "Featured Product Slider",
"category" : "Allsops Sections"
}
]
}
{% endschema %}
所以这个想法是在每个画廊单元格中都会有不同的产品。
【问题讨论】: