2017-09-20 16 views
1

Shopifyには新しくなっていますが、これらの2つのスニペットが同じ出力を生成する理由を調整できていないようです(つまり、製品は常に3番目の後shopify製品の3番目の画像を表示

{% assign featured_image = false %} 
{% if collection.image %}     
    {% assign featured_image = collection %}     
    {% assign featured_image_alt = collection.image.alt | escape %}       
{% elsif collection.products.first.featured_image %}     
    {% assign featured_image = collection.products.first.featured_image %} 
    {% assign featured_image_alt = collection.title | escape %}     
{% endif %} 

::私は彼らがしたいような画像)

前featured_imageが

を使用しますどこ

{% assign featured_image = collection.products[1].images[2] %} 
{% assign featured_image_alt = collection.image.alt | escape %} 

はここです

<div class="list-image-wrapper"> 
    {% if collection.empty? or featured_image == false %} 
    {{ 'collection-' | append: current | placeholder_svg_tag: 'placeholder-svg list-image' }} 
    {% else %} 
    <img 
     class="list-image" 
     src="{{ featured_image | img_url: '600x600' }}" 
     alt="{{ featured_image_alt | escape }}"> 
    {% endif %} 
</div> 

答えて

0

編集していたファイルが間違っていたことが判明し、もう使用されていません。 >。 <

関連する問題