2017-09-20 1 views
1

Ich bin ziemlich neu zu Shopify, aber ich kann nicht in Einklang zu bringen, warum diese beiden Schnipsel die gleiche Ausgabe produzieren (nämlich, die Produkte verwenden immer das vorgestellte Bild, anstelle der dritten Bild, wie ich sie)Das dritte Bild von einem shopify Produkt anzeigen

Bevor wollen:

{% 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 %} 

nach:

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

Hier, wo die featured_image

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

Antwort

0

Es stellt sich heraus, dass die Datei, die ich bearbeitet habe, die falsche war und nicht mehr benutzt wird. >. <

Verwandte Themen