【问题标题】:Use data-filter to categorize products by tags?使用数据过滤器按标签对产品进行分类?
【发布时间】:2014-10-28 00:09:22
【问题描述】:

我将 MixItUp 添加到我的 Shopify 商店。 https://mixitup.kunkalabs.com/

如何使用数据过滤器按标签对产品进行分类?

{% for collection in collections %}
<div class="productwrapper">

<div class="controls">
<a class="logo" href="/"></a> 

  <button class="filter" data-filter="all">Alle Produkte</button>
  <button class="filter" data-filter=".mappen">Mappen</button>
  <button class="filter" data-filter=".ordner">Ordner</button>



  <button class="sort" data-sort="myorder:asc">Beliebtheit</button>
  <button class="sort" data-sort="myorder:desc">A-Z</button>
</div>

<div id="Container" class="container">
{% for product in collection.products limit: settings.pagination_limit %}
{% include 'product-loop' with collection.handle %}
{% endfor %}  


</div>
<div class="gap"></div>
<div class="gap"></div>
</div>  

{% endfor %} 

我的 Shopify 商店:

http://gloria22x.myshopify.com/

谢谢,亚历克斯

【问题讨论】:

    标签: javascript jquery html shopify liquid


    【解决方案1】:

    只需包含产品的正确类名:

    // These will show when .mappen is selected
    <div class="mappen">
        // mappen category product
    </div>
    <div class="mappen">
        // mappen category product
    </div>
    <div class="mappen">
        // mappen category product
    </div>
    
    
    // these will show when .ordner is selected
    <div class="ordner">
       // Ordner category product
    </div>
    <div class="ordner">
       // Ordner category product
    </div>
    <div class="ordner">
       // Ordner category product
    </div>
    

    【讨论】:

    • Data-Filter类和产品标签之间需要js连接。 JavaScript 地狱...
    • 我尝试将mappen 类添加到您的mix div 之一,过滤似乎可以正常工作而无需更改任何其他内容。
    猜你喜欢
    • 1970-01-01
    • 2019-07-27
    • 2020-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-05
    • 1970-01-01
    相关资源
    最近更新 更多