如何使用标签链接获取所有系列产品的所有标签

时间:2020-12-21 05:28:00

标签: shopify translation

我需要获取收藏页面上的所有标签并将其显示在标签链接中。

我使用下面的代码:

{% assign collection = collections.all %}
{% paginate collection.products by 1000 %} 
     <h3>All Tags</h3>
     <div id="tags">
      {% if collection.tags.size == 0 %}
        No tags found.{% else %}
       {% for tag in collection.tags %}
           <a href="{{ collection.url }}/{{ tag | handle }}">
            {{ tag }}
           </a>
          {% unless forloop.last %}, {% endunless %}
      {% endfor %}
        {% endif %}
        </div>
{% endpaginate %}

请帮我解决我的问题。

2 个答案:

答案 0 :(得分:0)

请替换以下代码:

<a href="{{ collection.url }}/{{ tag | handle }}">{{ tag }}</a>

为此:

{{ tag | link_to_tag: tag }}

答案 1 :(得分:0)

我认为您需要使用内置解决方案而不是 searchButton.setOnClickListener{ viewModel.getUser(username.toString()) } 喜欢就用

paginate