【发布时间】:2016-11-14 06:15:55
【问题描述】:
我试图在一页中显示我网站的所有产品类型,2 天前它列出了所有产品类型。
但是现在当该页面加载时,它会出现 "shopify Liquid 错误:超出内存限制"
之类的错误这是我的代码
<div class="rte">
{{ page.content }}
<ul class="vendor-list block-grid three-up mobile one-up">
{% for product_type in shop.types %}
{% assign its_a_match = false %}
{% capture my_collection_handle %} {{ type | handleize | strip | escape }} {% endcapture %}
{% assign my_collection_handle_stripped = my_collection_handle | strip | escape %}
{% for collection in collections %}
{% if my_collection_handle_stripped == collection.handle %}
{% assign its_a_match = true %}
{% endif %}
{% endfor %}
{% if its_a_match %}
<li class="vendor-list-item"><a href="/collections/{{ product_type | handleize }}">{{ product_type }}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>
我该如何克服这个问题?
【问题讨论】:
-
Shopify 服务器只能在单个
forloop中呈现 40000 件商品。它们是否嵌套在彼此内部都没关系。根据您的要求尝试不同的逻辑。 -
我没有超过 40000 个项目。我只有独特的 2000 件物品。 @HymnZ
-
对于每个product_type,所有的集合都在循环;
shop.types * collections可以得到 40000。检查数学并告诉我。 -
还有
{{ type | handleize | strip | escape }}中的type是什么?你的意思是product_type?
标签: shopify liquid liquid-layout