2016-07-12 14 views
0

私のサイトの製品タイプを1ページに表示しようとしましたが、2日後にはすべての製品タイプが一覧表示されました。今shopify液体エラー:メモリ制限を超えました

しかし、そのページがあるのようなその与えるエラーロード「shopifyリキッドエラー:メモリの制限を超えて、」ここで

を私のコードは、どのように私はこの問題を克服することができます

<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> 

のですか?

+0

Shopifyサーバーは、単一の 'forloop'内に40000個のアイテムしかレンダリングできません。どちらかが互いに入れ子になっているかどうかは関係ありません。要件に応じて異なるロジックを試してください。 – HymnZ

+0

私は40000以上のアイテムがありません。私は一意の2000項目しか持っていません。 @HymnZ –

+0

各product_typeについて、すべてのコレクションが循環されています。 'shop.types * collections'は40000になります。数学をチェックして教えてください。 – HymnZ

答えて

1

以下を試してください。より高速で効率的です。

<div class="rte"> 
    {{ page.content }} 
    <ul class="vendor-list block-grid three-up mobile one-up"> 
    {% for product_type in shop.types %} 

    {% assign type = product_type | strip | escape | handleize %} 

    {% assign collection = collections[type] %} 

    {% if collection.handle != '' %} 
     <li class="vendor-list-item"><a href="/collections/{{ collection.handle }}">{{ product_type }}</a></li> 
    {% endif %} 

    {% endfor %} 
    </ul> 
</div> 
+0

細かいコード...多くのありがとう –

関連する問題