Files loop in related field throws errors

Hi

I have a replicator field that contains multiple sets. Two of those sets have a suggest field. (I have removed the other sets in the code below)

fields:
  content:
    type: hidden

  homepage_assets:
    type: replicator
    instructions: Replicate a new set for each piece of content you need.

    sets:

      lookbook:
        fields:
          photo:
            display: Image
            type: file
            max_files: 1
            allowed: [png, gif, jpg, jpeg]
            destination: assets/img/homepage
            resize:
              width: 3072
              height: 3072
              quality: 80
          related:
            display: Related articles
            type: suggest
            create: false
            content:
              folder: products
              label: title
              value: url
              type: entries

      product:
        display: Just a product
        fields:
          related:
            display: Related article
            type: suggest
            create: false
            content:
              folder: products
              label: title
              value: url
              type: entries
          width:
            display: Width
            type: select
            options:
              w1: Small image
              w2: Medium image
              w6: Large image

Entering content in those fields through the control panel works perfect. However, if I want to show content from the related entries, it goes wrong:

This is the code for the lookbook set:

<div class="item w3">
      <img src="{{ transform src="{{ photo }}" width="1000" height="1000" action="smart" destination="/assets/img/tempresize/" }}" alt="{{ title }}" />

      <ul class="lb-items">
        {{ relate:related }}
        <li class="lb-item">
          <div class="lb-image">
            {{ if photo:0 }}
                 {{ photo first="yes" }}
                <img src="{{ transform src="{{ value }}" width="200" height="200" action="smart" destination="/assets/img/tempresize/" }}" alt="{{ title }}" />
                {{ /photo }}
              {{ else }}
                <img src="{{ transform src="{{ photo }}" width="200" height="200" action="smart" destination="/assets/img/tempresize/" }}" alt="{{ title }}" />
              {{ /if }}
          </div>
{{ bison:item_options product="{ url }" select="no" }}
                 <span class="griditemoption {{ if stock > 0 }}instock{{ else }}oostock{{ /if }}">{{ label|list }}</span>
                 {{ /bison:item_options }}
        </li>
        {{ /relate:related }} 
      </ul>

    </div>

The photo conditional always returns false, even when photo is an array. (If I use the same code directly with the entries instead of related entries, this just works.)

Second case, the code for the product set:

      <div class="item {{ width }}">
        {{ relate:related }}
        {{ if photo:0 }}
            {{ photo }}
            <img src="{{ transform src="{{ value }}" width="700" height="700" action="smart" destination="/assets/img/tempresize/" }}" alt="{{ title }}" />
            {{ /photo }}
          {{ else }}
            <img src="{{ transform src="{{ photo }}" width="700" height="700" action="smart" destination="/assets/img/tempresize/" }}" alt="{{ title }}" />
          {{ /if }}
          <div class="inner-item">
          <div class="item-info">
            <h3>{{ title }}</h3>
                    <h4>€ {{ price }}</h4>

          </div>
          </div>
        {{ /relate:related }} 
        </div> 

This code gives the error "You have a syntax error in your Lex tags." It's also a problem with the photo conditional. The error disappears if I remove that conditional.

What could be the problem here? And an extra if Jason is looking at this thread:

{{ bison:item_options product="{ url }" select="no" }}
                 <span class="griditemoption {{ if stock > 0 }}instock{{ else }}oostock{{ /if }}">{{ label|list }}</span>
                 {{ /bison:item_options }}

only returns options for the first related entry.

>>>>>>> Unanswered <<<<<<<
3 Replies
1 Follower