Javascript 在shopify中超过50 in for循环的限制
我已将产品列表分页超过50页,以适合整个页面(Javascript 在shopify中超过50 in for循环的限制,javascript,jquery,e-commerce,shopify,Javascript,Jquery,E Commerce,Shopify,我已将产品列表分页超过50页,以适合整个页面(index.liquid)。 但是for循环中的if条件不适用于整个分页项目,因为for循环限制为50个项目。任何帮助都将不胜感激 <td class="collection-reviews"> {% paginate collections.all.products by 1000 %} {% for product in collections.all.products %} {%i
index.liquid
)。
但是for循环中的if条件不适用于整个分页项目,因为for循环限制为50个项目。任何帮助都将不胜感激
<td class="collection-reviews">
{% paginate collections.all.products by 1000 %}
{% for product in collections.all.products %}
{%if product.metafields.spr.reviews %}
<div id="shopify-product-reviews" data-id="{{product.id}}">{{ product.metafields.spr.reviews }}</div>
{%endif%}
{% endfor %}
{%endpaginate%}
</td>
{%1000%分页集合.all.products}
{collections.all.products%中的产品的%s}
{%if product.metafields.spr.reviews%}
{{product.metafields.spr.reviews}
{%endif%}
{%endfor%}
{%endpaginate%}
不,你无法克服它,你可以每页查询多达50个产品,Shopify不允许超过50个产品,以保持服务器负载平衡
来自shopify文档的报价:
不要将一个集合分页超过50页,这是您每页最多应该查询的产品数。尊重Shopify的应用服务器。如果您没有使用任何分页标签,分页确实会在后台启动,您将只收到所述集合中的前50个产品
每页50个项目的限制应该是正确的,并记录在案。除了。。。事实并非如此。实际上,你可以在Shopify中设置一个更高的限制,即每页最多1000个项目,从而绕过这个限制。这只是多余的,下面是一个示例代码:
{% paginate mycollection.products by 250 %}
{% for product in mycollection.products %}
{% include 'my-product-template' %}
{% endfor %}
{% endpaginate %}
也回答了。如果我想在50个项目的堆中迭代整个产品,如果我能够将评论部分分页50,那么您有什么建议。