Shopify-是否可以按';供应商';

Shopify-是否可以按';供应商';,shopify,liquid,Shopify,Liquid,Shopify似乎只允许通过标签进行过滤。如果要按供应商筛选(这是一个标准的Shopify字段),首先需要创建具有相同名称的标记,并在筛选器侧栏中手动使用这些标记 这是正确的吗?看起来非常不必要,更重要的是,这使得动态更新变得困难 Shopify目前不允许供应商进行过滤(同时保持与供应商的收款关系) 这一点在最近与Shopify的一次现场问答中提到,并确认他们正在测试这一点。更多信息可在此处查看: 您现在必须坚持使用标签。Shopify目前不允许按供应商进行过滤(同时保持与供应商的收款关系) 这

Shopify似乎只允许通过标签进行过滤。如果要按供应商筛选(这是一个标准的Shopify字段),首先需要创建具有相同名称的标记,并在筛选器侧栏中手动使用这些标记


这是正确的吗?看起来非常不必要,更重要的是,这使得动态更新变得困难

Shopify目前不允许供应商进行过滤(同时保持与供应商的收款关系)

这一点在最近与Shopify的一次现场问答中提到,并确认他们正在测试这一点。更多信息可在此处查看:


您现在必须坚持使用标签。

Shopify目前不允许按供应商进行过滤(同时保持与供应商的收款关系)

这一点在最近与Shopify的一次现场问答中提到,并确认他们正在测试这一点。更多信息可在此处查看:


您现在必须坚持使用标签。

经过近2天的尝试和错误,再加上对论坛和文档的大量挖掘,我想出了这段代码来创建一个有效的供应商过滤器

请注意以下事项:

  • 这些类和ID是由模块化Shopify主题创建的。我只是重复使用了它们,请为您的主题使用适当的类/ID
  • 供应商过滤器不适用于标记过滤器或排序方式选项。这些是隐藏的,如下所述
  • 
    {%comment%}新供应商筛选器{%endcomment%}
    按供应商浏览
    全部的
    {shop.vendors%}
    {%if collection.current_vendor包含产品_vendor%}
    {{产品供应商}}
    {%else%}
    {{产品供应商}}
    {%endif%}
    {%endfor%}
    {%comment%}结束新供应商筛选器{%endcomment%}
    {%if show_filter==true和collection.current_vendor==blank%}
    {{'collections.tag_filtering.filter_label'|t}
    {{'collections.tag_filtering.default_filter'| t}
    {%用于集合中的标记。所有_标记%}
    {%如果当前_标记包含标记%}
    {{tag}}
    {%else%}
    {{tag}}
    {%endif%}
    {%endfor%}
    {%endif%}
    {%if show_sort_filter==true和collection.current_vendor==blank%}
    {{'collections.sorting_dropdown.label'|t}
    {%assign sort_by=collection.sort_by%}
    {{'collections.sorting_下拉列表.all'| t}
    {{'集合.排序{下拉列表.最畅销{t}
    {{'集合.排序_下拉列表.价格_升序| t}
    {{'集合.排序{u下拉列表.价格{u下降}
    {{'集合.排序_下拉列表.标题_升序| t}
    {{'集合.排序_下拉列表.标题_递减| t}
    {{'collections.sorting_dropdown.created_ascending'| t}
    {{'集合.排序{u下拉列表.创建{u递减}
    {%endif%}
    
    以下是值得一提的重要事项:

  • onChange=“window.location.href=this.value”
    是从供应商下拉列表中获取值并更新网址(URL)所必需的一点JavaScript
  • 商店中的产品供应商的
    。供应商
    是抓住所有供应商并一次向下拉列表提供一个供应商所必需的一点液体
  • 如果collection.current_vendor包含产品_vendor,则在使用供应商过滤器时,还需要一点液体。它检查活动的供应商过滤器,并在页面重新加载后在下拉列表中选择它
  • {{product_vendor|url_for_vendor}}
    提供了上面#1中JavaScript使用的url
  • {{product\u vendor}}
    为列表提供了实际的供应商名称
  • 和collection.current\u vendor==blank
    告诉页面,如果选择了供应商过滤器,则隐藏标记和排序下拉列表
  • 以下是Shopify文档,它们确实帮助了我。这假设您已经了解and,and是编程的基本组件

  • 理解力
  • 理解力
  • 理解力
  • 理解力
  • 理解力

  • 经过近2天的反复试验,再加上对论坛和文档的大量挖掘,我想出了这段代码来创建一个可用的供应商过滤器

    请注意以下事项:

  • 这些类和ID是由模块化Shopify主题创建的。我只是重复使用了它们,请为您的主题使用适当的类/ID
  • 供应商过滤器不适用于标记过滤器或排序方式选项。这些是隐藏的,如下所述
  • 
    {%comment%}新供应商筛选器{%endcomment%}
    按供应商浏览
    全部的
    {shop.vendors%}
    {%if collection.current_vendor包含产品_vendor%}
    {{产品供应商}}
    {%else%}
    {{产品供应商}}
    {%endif%}
    {%endfor%}
    {%comment%}结束新供应商筛选器{%endcomment%}
    {%if show_filter==true和collection.current_vendor==blank%}
    
              <div class="grid-filter block">
    
                {% comment %} New Vendor Filter {% endcomment %}
                <div class="tag-filter block">
                    <label for="#vendorFilter">Browse by Vendor</label>
                    <span class="selectArrow"></span>
                    <select class="vendorFilter filter" id="vendorFilter" onChange="window.location.href=this.value">
                      <option value="/collections/all">All</option>
                      {% for product_vendor in shop.vendors %}
                        {% if collection.current_vendor contains product_vendor %}
                            <option value="{{ product_vendor | url_for_vendor }}" selected>{{ product_vendor }}</option>
                        {% else %}
                            <option value="{{ product_vendor | url_for_vendor }}">{{ product_vendor }}</option>
                        {% endif %}
                      {% endfor %}
                    </select>
                  </div>
                {% comment %} END New Vendor Filter {% endcomment %}
    
                {% if show_filter == true and collection.current_vendor == blank %}
                  <div class="tag-filter block">
                    <label for="#tagFilter">{{ 'collections.tag_filtering.filter_label' | t }}</label>
                    <span class="selectArrow"></span>
                    <select class="tagFilter filter" id="tagFilter">
                      <option value="/collections/{{ collection.handle }}">{{ 'collections.tag_filtering.default_filter' | t }}</option>
                      {% for tag in collection.all_tags %}
                        {% if current_tags contains tag %}
                          <option value="/collections/{{ collection.handle }}/{{ tag | handle }}" selected>{{ tag }}</option>
                        {% else %}
                          <option value="/collections/{{ collection.handle }}/{{ tag | handle }}">{{ tag }}</option>
                        {% endif %}
                      {% endfor %}
                    </select>
                  </div>
                {% endif %}
                {% if show_sort_filter == true and collection.current_vendor == blank %}
                <div class="collectionGrid-filter block">
                  <label for="#collectionFilter">{{ 'collections.sorting_dropdown.label' | t }}</label>
                  <span class="selectArrow"></span>
                  {% assign sort_by = collection.sort_by %}
                  <select class="filter" id="collectionFilter">
                    <option value="">{{ 'collections.sorting_dropdown.all' | t }}</option>
                    <option value="best-selling" {% if sort_by == "best-selling" %}selected{% endif %}>{{ 'collections.sorting_dropdown.best_selling' | t }}</option>
                    <option value="price-ascending" {% if sort_by == "price-ascending" %}selected{% endif %}>{{ 'collections.sorting_dropdown.price_ascending' | t }}</option>
                    <option value="price-descending" {% if sort_by == "price-descending" %}selected{% endif %}>{{ 'collections.sorting_dropdown.price_descending' | t }}</option>
                    <option value="title-ascending" {% if sort_by == "title-ascending" %}selected{% endif %}>{{ 'collections.sorting_dropdown.title_ascending' | t }}</option>
                    <option value="title-descending" {% if sort_by == "title-descending" %}selected{% endif %}>{{ 'collections.sorting_dropdown.title_descending' | t }}</option>
                    <option value="created-ascending" {% if sort_by == "created-ascending" %}selected{% endif %}>{{ 'collections.sorting_dropdown.created_ascending' | t }}</option>
                    <option value="created-descending" {% if sort_by == "created-descending" %}selected{% endif %}>{{ 'collections.sorting_dropdown.created_descending' | t }}</option>
                  </select>
                </div>
                {% endif %}
              </div>