Bug #23202 Clarification Requested

relationship_field:count always output 1

Version: 3.5.10 Reporter: bronskiy

{relationship_field:count} always output 1

  • Thanks for the report, but I’m not able to replicate locally.

    Can you paste a simplified version of the full tag where you’re seeing the problem. Here’s what my test looked like:

    {exp:channel:entries channel="test" limit="5"}
    <h3>{title}</h3>
    
    {test_rel2 status="open|featured"}
    _ {test_rel2:title} {test_rel2:count} 
    
    {/test_rel2}
    
    {/exp:channel:entries}
    Robin Sowell
    23rd August, 2017 at 11:06am
  • then it is more weirder bug: if I’ll try {if ‘{test_rel2:count}’ != ”} {test_rel2 status=”open|featured”} {test_rel2:title} {test_rel2:count} {/test_rel2} {/if} then all {test_rel2:count} became 1 same with any field that will be used for condition. so temporary solution is to use unused field for condition. for example: {if ‘{test_rel2:entry_date}’ != ”} {test_rel2 status=”open|featured”} {test_rel2:title} {test_rel2:count} {/test_rel2} {/if}

    bronskiy
    29th August, 2017 at 7:55pm
  • I don’t think I’m fully understanding. Inside a relationship tag pair test_rel2:count will never be blank. If there is content returned, then it will start counting at 1. Same for test_rel2:entry_date - that should always have content. Other custom fields might not, though.

    Try putting the full relationship tag contents here inside code tags. Right now, I’m not sure how to test things out.

    Robin Sowell
    29th August, 2017 at 8:06pm
  • for example: you have 2 fields(relationship field and text field). If relationship field is empty then you want to show text field instead. So you have to check if any field in relationship field isn’t empty and if you check {if ‘{test_rel2:title}’ != ”} then all other titles became the same as checked.

    bronskiy
    29th August, 2017 at 8:10pm

You must be signed in to comment on a bug report.

ExpressionEngine News

#eecms, #events, #releases