【发布时间】:2017-05-17 00:15:12
【问题描述】:
下面是我的一段代码,我正在从 Shopify 的常规设置中获取一些项目。花括号中的第一个变量 settings.featured1 将值拉入,但在 contains 语句中却没有。关于为什么的任何想法?
<h1>{{ settings.featured1 }}</h1><div class="leftArrow">❰</div>
<div class="shift-scroll">
{% for collection in collections %}
{% if collection.handle contains settings.featured1 %}
{% tablerow product in collection.products limit:8 %}
<div class="one-third column alpha thumbnail even">
<a href="{{ product.url | within: collection }}" title="{{ product.featured_image.alt | escape }}">
<img class="scroll-img" src="{{ product.images.first | product_img_url: 'medium' }}" alt="{{ product.featured_image.alt | escape }}" />
</a>
</div>
{% endtablerow %}
{% endif %}
{% endfor %}
</div>
【问题讨论】:
-
settings.featured1 的值是多少?
-
是一个字符串值。
-
我想我的想法是你的collection.handle和settings.featured1不一样。前任。看起来 shopify 去除了所有特殊字符并将值从“Cool Page”更改为“cool-page”
-
嗯,settings.featured1 只是存储在 Shopify 设置中的变量。