2016-11-24 65 views
0

我想弄清楚如何在Shopify产品循环内的4个产品后添加水平中断。这可能吗?我已经浏览了他们的文档,但它没有显示计数或遍历循环的可能性。Shopify后4产品添加水平间隔

目前我的循环看起来如下:

{% if collection.all_products_count > 0 %} 
    <div class="w-col w-col-12"> 
    <div class="product-feed w-clearfix"> 
     {% for product in collection.products %} 
      <a class="product product-collection w-inline-block" href="{{ product.url | within:collection }}"> 
      <div class="reveal"> 
       <img src="{{ product.featured_image | product_img_url: 'original' }}" alt="{{ product.title | escape }}" class="product-photo"> 
       <img src="{{ product.images.last | product_img_url: 'original' }}" alt="{{ product.title | escape }}" class="hidden"> 
      </div> 
      <h3 class="product-title">{{ product.title }}</h3> 
      <div class="product-price">{{ product.price | money }}</div> 
      <span class="shopify-product-reviews-badge" data-id="{{ product.id }}"></span> 
      </a> 
     {% endfor %} 
    </div> 
    {% assign count = paginate.pages %} 
     {% for part in (1..count) %} 
     <li {% if paginate.current_page == part %}class="active"{% endif %}><a href="{{ collection.url }}?page={{ forloop.index }}">{{ forloop.index }}</a></li> 
     {% endfor %} 
    {% else %} 
    <p>Sorry, there are no products in this collection</p> 
    {% endif %} 

回答