在shopify product-loop.liquid中迭代产品

在shopify product-loop.liquid中迭代产品,shopify,liquid,product,Shopify,Liquid,Product,我在Shopify中使用代码片段product-loop.liquid显示产品集合时遇到问题。代码基本上如下所示 {% capture collection_handle %}{{ product-loop | handleize }}{% endcapture %} {% capture url %}{% if collection_handle != "" %}/collections/{{ product-loop }}{{ product.url }}{% else %}{{ produ

我在Shopify中使用代码片段product-loop.liquid显示产品集合时遇到问题。代码基本上如下所示

{% capture collection_handle %}{{ product-loop | handleize }}{% endcapture %}
{% capture url %}{% if collection_handle != "" %}/collections/{{ product-loop }}{{ product.url }}{% else %}{{ product.url }}{% endif %}{% endcapture %}
<div class="product span3 {% if template == 'collection' %}adaptive-grid{% endif %}">



</div>

{% unless template contains 'collection' %}
{% cycle 'clear-product-loop': '', '', '', '<div style="clear:both;"></div>' %}
{% endunless %}

最后,我通过删除以下行解决了问题:

.span3.adaptive-grid:nth-child(6n+7) {clear: none;}
.span3.adaptive-grid:nth-child(4n+5) {clear: both;}

来自Shopify样式文件(最小主题)。现在,产品网格在不同分辨率下显示为ok,而不中断线条。

什么是
产品循环
清除产品循环
?有多少种产品?我在这里看不到加工产品的循环。大约有20种产品,所以在数量上没有问题。product loop和clear product loop我认为这是Shopify的标准产品,如果我错了,很抱歉,嗯,不,它们一定有主题。您是否可以发布
{{product loop}}
的输出,并且您错误地使用了
cycle
语法。从控制台我得到:ReferenceError:product未定义。cycle有什么问题吗?我要求的是液体输出中的
{{{product loop}}
,而不是javascript控制台<代码>循环将在
for
循环中使用,语法为
{%cycle'a',b',c',d'…%}
。您的代码中没有
for
循环,并且
'clear-product-loop':“
是错误的语法。
.span3.adaptive-grid:nth-child(6n+7) {clear: none;}
.span3.adaptive-grid:nth-child(4n+5) {clear: both;}