shopify中for循环的克服限制为50 [英] Overcome limit of 50 in for loop in shopify
问题描述
我已经将产品列表分页超过50,以适应整个页面( index.liquid
)。
但for循环中的if条件不适用于整个分页项,因为循环限制为50项。任何帮助将不胜感激。
I have paginated a product list over a limit of 50 to fit in the whole page (index.liquid
).
But the if condition within for loop doesn't apply over whole paginated items as for loop is limited to 50 items. Any help would be appreciated.
<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>
推荐答案
不,你无法克服它,你可以查询为了维持服务器负载平衡,Shopify将不允许超过50个产品。
No, you cannot overcome it, You can query up to 50 product per page, Shopify won't allow more than 50 products, in order to maintain server load balance.
来自shopify文档的引用: http://docs.shopify.com / manual / configuration / store-customization / page-specific / collections / add-view-all-to-collection-pages
quote from shopify documentation : http://docs.shopify.com/manual/configuration/store-customization/page-specific/collections/add-view-all-to-collection-pages
不要将集合分页超过50,这是每页应查询的最大产品数量。尊重Shopify的应用服务器。如果您没有使用任何paginate标签,则会在场景后面进行分页,您只会收到所述集合中的前50个产品。
Don't ever paginate a collection by more than 50, that's how many products maximum you should query per page. Be respectful of Shopify's app servers. If you are not using any paginate tags, pagination does kick in behind the scene and you will only receive the first 50 products in said collection.
这篇关于shopify中for循环的克服限制为50的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!