2016-07-12 4 views
0

제품 유형을 한 페이지에 표시하려고했습니다. 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

좋은 코드 ... 많은 감사합니다. –