2016-04-14 15 views
0

誰でも助けてください。私は「在庫切れ」の商品を「関連商品」として表示しないようにしようとしています 商品が見えないように完全に隠したくありません。ここで Shopifyで「在庫切れ」の商品を「関連商品」として表示しないようにする

は、私は現在、related.liquidファイルを持っているコードです

{% comment %}ly_global_begin{% endcomment %}{% include 'ly-global' %}{% comment %}ly_global_end{% endcomment %} 
{% assign found_a_collection = false %} 
{% if collection == null or collection.handle == 'frontpage' or collection.handle == 'all' %} 
    {% for c in product.collections %} 
     {% if found_a_collection == false and c.handle != 'all-products' and c.handle != 'frontpage' and c.handle != 'all' %} 
      {% assign found_a_collection = true %} 
      {% assign coll = c %} 
     {% endif %} 
    {% endfor %} 
{% else %} 
    {% assign found_a_collection = true %} 
    {% assign coll = collection %} 
{% endif %} 


{% if found_a_collection and coll.products.size > 1 %} 
    <div id="related" class="{% if settings.mobile_related_items %}hide-mobile{% endif %} clearfix"> 
     <h3>{% comment %}ly_i18n_replace_for_[ 'products.general.related_items' | t ]_begin{% endcomment %}{% capture ly_template %}{{ 'products.general.related_items' | t }}{% endcapture %}{% include 'ly-static-string' with '1413610' %}{% if ly_translation %}{% assign escape_content = true %}{% assign ly_template = ly_translation %}{% else %}{% assign escape_content = false %}{% endif %}{% if escape_content %}{{ ly_template | escape}}{% else %}{{ ly_template }}{% endif %}{% comment %}ly_i18n_replace_end{% endcomment %}</h3> 
     {% assign max_items = '' %} 
     <ul class="block-grid columns4 collection-th"> 
     {% for prd in coll.products %} 
      {% if prd.handle != product.handle and max_items != '****' %} 
       <li> 
        <a class="prod-th" title="{% comment %}ly_code_replace_for_[ prd.title | escape ]_begin{% endcomment %}{% include 'ly-title' with prd %}{% assign c7cdd42304af0cf1669bffa56a709695 = ly_translation %}{{ c7cdd42304af0cf1669bffa56a709695 | escape }}{% comment %}ly_code_replace_end{% endcomment %}" href="{{ prd.url }}"> 
         <span class="thumbnail"> 
          <img alt="{{ prd.images.first.alt | escape }}" src="{{ prd.images.first | product_img_url: 'medium' }}"> 
         </span> 
          <span class="product-title"> 
           <span class="title"> 
           {% comment %}ly_code_replace_for_[ prd.title | escape ]_begin{% endcomment %}{% include 'ly-title' with prd %}{% assign c7cdd42304af0cf1669bffa56a709695 = ly_translation %}{{ c7cdd42304af0cf1669bffa56a709695 | escape }}{% comment %}ly_code_replace_end{% endcomment %} 
           </span>  
           <span class="price{% unless prd.available %} sold-out{% endunless %}"> 
           {% if prd.available %} 
            {% if prd.compare_at_price > prd.price %} 
             <del>{% assign geolizr_price = prd.compare_at_price %}{% include 'geolizr-currency' with geolizr_price %}{{prd.compare_at_price | money | prepend: geolizr_prepend_code | append: geolizr_append_code }}</del> {% assign geolizr_price = prd.price %}{% include 'geolizr-currency' with geolizr_price %}{{prd.price | money | prepend: geolizr_prepend_code | append: geolizr_append_code }} 
            {% else %} 
             {% if prd.price_varies %}<small>{% comment %}ly_i18n_replace_for_[ 'products.general.from' | t ]_begin{% endcomment %}{% capture ly_template %}{{ 'products.general.from' | t }}{% endcapture %}{% include 'ly-static-string' with '1413611' %}{% if ly_translation %}{% assign escape_content = true %}{% assign ly_template = ly_translation %}{% else %}{% assign escape_content = false %}{% endif %}{% if escape_content %}{{ ly_template | escape}}{% else %}{{ ly_template }}{% endif %}{% comment %}ly_i18n_replace_end{% endcomment %}</small> {% endif%}{% assign geolizr_price = prd.price %}{% include 'geolizr-currency' with geolizr_price %}{{prd.price | money | prepend: geolizr_prepend_code | append: geolizr_append_code }} 
            {% endif %} 
           {% else %} 
            {% comment %}ly_i18n_replace_for_[ 'products.product.sold_out' | t ]_begin{% endcomment %}{% capture ly_template %}{{ 'products.product.sold_out' | t }}{% endcapture %}{% include 'ly-static-string' with '1413612' %}{% if ly_translation %}{% assign escape_content = true %}{% assign ly_template = ly_translation %}{% else %}{% assign escape_content = false %}{% endif %}{% if escape_content %}{{ ly_template | escape}}{% else %}{{ ly_template }}{% endif %}{% comment %}ly_i18n_replace_end{% endcomment %} 
           {% endif %} 
           </span>   
          </span> 
          {% if prd.compare_at_price > prd.price %} 
           {% if settings.show_sale_sticker %} 
           <span class="sale round">{% comment %}ly_i18n_replace_for_[ 'products.general.sale' | t ]_begin{% endcomment %}{% capture ly_template %}{{ 'products.general.sale' | t }}{% endcapture %}{% include 'ly-static-string' with '1413613' %}{% if ly_translation %}{% assign escape_content = true %}{% assign ly_template = ly_translation %}{% else %}{% assign escape_content = false %}{% endif %}{% if escape_content %}{{ ly_template | escape}}{% else %}{{ ly_template }}{% endif %}{% comment %}ly_i18n_replace_end{% endcomment %}</span> 
           {% endif %} 
          {% endif %} 
        </a> 
       </li> 
       {% capture max_items %}{{max_items}}*{% endcapture %} 
      {% endif %} 
     {% endfor %} 
     </ul>  
    </div> 
{% endif %} 

答えて

0

変更この

{% if prd.handle != product.handle and max_items != '****' and product.available == true %}

P.S.この

{% if prd.handle != product.handle and max_items != '****' %}

max_itemsが適切に使用されているかどうかはわかりません。

関連する問題