【问题标题】:Liquid Template Shopify Not Rendering液体模板 Shopify 不呈现
【发布时间】:2017-05-17 00:15:12
【问题描述】:

下面是我的一段代码,我正在从 Shopify 的常规设置中获取一些项目。花括号中的第一个变量 settings.featured1 将值拉入,但在 contains 语句中却没有。关于为什么的任何想法?

    <h1>{{ settings.featured1 }}</h1><div class="leftArrow">&#10096</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 设置中的变量。

标签: shopify liquid


【解决方案1】:

Jacob 的回答将我引向了正确的方向。我不得不小写设置变量。

  {% assign search_term = settings.featured2 | downcase %}
  {% for collection in collections %}
  {% if collection.handle contains search_term %}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-17
    • 2012-06-06
    • 1970-01-01
    相关资源
    最近更新 更多