首页 文章

是否可以在自定义Shopify集合模板中连续覆盖默认的#products?

提问于
浏览
0

我为我正在研究的shopify网站创建了一个备用collection.liquid模板 . 我的斗争是无法控制网格中连续出现的产品数量 . 我开发了自定义模板,这样我就不会影响其他集合上出现的产品/行数 .

在我的液体模板中显示网格的代码是:

<div class="four columns section_select {% unless settings.collection_sort %}offset-by-four omega{% endunless %}">
{% for tag in collection.all_tags %}
        {% if forloop.first %}
<label for="tag_filter" class="inline">
{{ 'collections.sorting.filter' | t }}: </label> 
<select name="tag_filter" id="tag_filter">
<option {% unless current_tags %}selected="selected"{% endunless %} value="{% if collection.handle == "all" %}/collections/all{% else %}{{ collection.url }}{% endif %}">{{ 'collections.general.all_collection_title' | t: title: collection.title }}</option>
        {% endif %}
        {% unless tag contains 'meta-related-collection-' %}
          <option {% if current_tags contains tag %}selected="selected"{% endif %} value="/collections/{% if collection.handle != blank %}{{ collection.handle }}{% else %}all{% endif %}/{{ tag | handleize }}">{{ tag }}</option>
        {% endunless %}

        {% if forloop.last %}
          </select>
        {% endif %}
      {% endfor %}
      </div>

即使我将class class =“four columns”更改为其他内容,也不会反映在我的收藏中 .

问题可能在于我的代码中指定了此集合中有多少产品,但我似乎无法发挥作用 .

{% case products_per_row %}
  {% when '1' %}
    {% assign grid_item_width = 'medium--one-third large--one-whole' %}
  {% when '2' %}
    {% assign grid_item_width = 'medium-down--one-half large--one-half' %}
  {% when '3' %}
    {% assign grid_item_width = 'medium--one-third large--one-third' %}
  {% when '4' %}
    {% assign grid_item_width = 'medium-down--one-half large--one-quarter' %}
  {% when '5' %}
    {% assign grid_item_width = 'medium-down--one-half large--one-fifth' %}
{% endcase %}

任何帮助都会很棒!

1 回答

  • 0

    看起来你的主题是使用木材网格 . 您将在此处找到要在文档中使用的网格结构和类:https://shopify.github.io/Timber/

    HTH

相关问题