Shopify liquid product.thumbnail.liquid 即使没有循环也会重复块
Shopify liquid product.thumbnail.liquid repeats block even there is no loops
[![在此处输入图片描述][1]][1]我的工作太简单了,即只需在产品 thumbnail.liquid.I 的 div 块中添加亚马逊 url添加了简单的 div,然后我发现相同的 div 重复了两次。我还检查过没有发现 forloop
仍然是如何重复的。今天我发现了名为 product-loop.liquid
的文件,其中包含 for
循环并且包含 product thumbnail.liquid
。如果我只需要显示一次 amazon link 块,我需要做什么?整个文件在要点 link.Thanks.
中
产品-loop.liquid
{% assign product_found = false %}
{% assign skip = false %}
{% assign collection_group = products | map: 'id' %}
{% assign collection_group_thumb = collection_group | append : 'thumb' %}
{% assign collection_group_mobile = collection_group | append : 'mobile' %}
{% capture new_row %}
<br class="clear product_clear" />
{% endcapture %}
<div itemtype="http://schema.org/ItemList" class="products">
{% for product in products limit: limit %}
{% if product.id == skip_product.id or skip == true %}
{% assign product_found = true %}
{% else %}
{% if forloop.rindex0 == 0 and product_found == false and forloop.length != products.count and template != 'search' %}
{% assign skip = true %}
{% else %}
{% include 'product-thumbnail', sidebar: sidebar %}
{% if products_per_row == 2 %}
{% cycle collection_group: '', new_row %}
{% elsif products_per_row == 3 %}
{% cycle collection_group: '', '', new_row %}
{% elsif products_per_row == 4 %}
{% cycle collection_group: '', '', '', new_row %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</div>
可能是您在某个部分中包含 product.thumbnail,并且该部分具有循环或条件逻辑。
[![在此处输入图片描述][1]][1]我的工作太简单了,即只需在产品 thumbnail.liquid.I 的 div 块中添加亚马逊 url添加了简单的 div,然后我发现相同的 div 重复了两次。我还检查过没有发现 forloop
仍然是如何重复的。今天我发现了名为 product-loop.liquid
的文件,其中包含 for
循环并且包含 product thumbnail.liquid
。如果我只需要显示一次 amazon link 块,我需要做什么?整个文件在要点 link.Thanks.
产品-loop.liquid
{% assign product_found = false %}
{% assign skip = false %}
{% assign collection_group = products | map: 'id' %}
{% assign collection_group_thumb = collection_group | append : 'thumb' %}
{% assign collection_group_mobile = collection_group | append : 'mobile' %}
{% capture new_row %}
<br class="clear product_clear" />
{% endcapture %}
<div itemtype="http://schema.org/ItemList" class="products">
{% for product in products limit: limit %}
{% if product.id == skip_product.id or skip == true %}
{% assign product_found = true %}
{% else %}
{% if forloop.rindex0 == 0 and product_found == false and forloop.length != products.count and template != 'search' %}
{% assign skip = true %}
{% else %}
{% include 'product-thumbnail', sidebar: sidebar %}
{% if products_per_row == 2 %}
{% cycle collection_group: '', new_row %}
{% elsif products_per_row == 3 %}
{% cycle collection_group: '', '', new_row %}
{% elsif products_per_row == 4 %}
{% cycle collection_group: '', '', '', new_row %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</div>
可能是您在某个部分中包含 product.thumbnail,并且该部分具有循环或条件逻辑。