2

EE 2.5.5. I've got a {exp:channel:entries} on products channel. Inside I have a {reverse_related_entries id="reviews"}. I'm getting 4 reviews, when there are only 2. The first 2 are blank. I have 2 products entries, but only displaying 1 product based on URL.

When I go to the other product, I still get 4 reviews, but they're all blank.

Thanks for your help.

Update: Here's the full code for the product page:

{embed='includes/header'}

{exp:channel:entries channel="products" limit="1" }
<div id="hero"><img src="{hero_image}" /></div>
{embed='includes/topnav'}
{if no_results}
<p>Unknown product.</p>
{/if}
<div id="prodinfo">
    <h1>{title}</h1>

    <div id="description" class="desc">{product_description}</div>
    <div id="ulimagescontainer">
    <ul class="prodimages">
        {reverse_related_entries }
        <li>
        <a href="{product_image_video:large}"><img src="{product_image_video:tiny}" /></a>
        </li>
        {/reverse_related_entries}
    </ul>
    </div> <!-- END #ulimagescontainer -->
    <div class="clearboth"></div>

    {if product_features > ''}
    <div id="productfeatures">
    <h3>Features</h3>
    {product_features}
    </div> <!-- END #productfeatures -->
    <div class="clearboth"></div>
    {/if}

    {if vehicle_callouts > ''}
    <div id="vehicle_callouts">
    <img src="{vehicle_callouts}" />
    </div>
    <div class="clearboth"></div>
    {/if}

    {reverse_related_entries id="product_reviews" }
    {if no_reverse_related_entries}
    {if:else}
    {if count == 1}
    <div id="product_reviews">
        <h3>Reviews</h3>
    {/if}

    <div class="reviewitem">
        <div class="synopsis">
        {review_synopsis}
        </div>
        <div class="author">{review_author}</div>
        <div class="link"><a href="{review_link}" target="_blank">{review_publication}</a></div>
    </div>

    {if count == total_results}
    </div>
    <div class="clearboth"></div>
    {/if}
    {/if}
    {/reverse_related_entries}

</div> <!-- END #prodinfo -->
{/exp:channel:entries}


{embed='includes/footer'}
  • 2
    Please post complete code samples. What you've provided isn't enough information. – Anna_MediaGirl Mar 18 '13 at 22:47
2

You're confusing the syntax for related_entries and reverse_related_entries. It's related_entries which gets the id parameter (to signify which field you're asking for). reverse_related_entries expects a channel parameter (among other options).

(See docs.)

So your lower reverse_related_entries tag should look more like this:

{reverse_related_entries channel="reviews"}
{if count == 1}
    <div id="product_reviews">
    <h3>Reviews</h3>
{/if}

<div class="reviewitem">
    <div class="synopsis">
        {review_synopsis}
    </div>
    <div class="author">{review_author}</div>
    <div class="link"><a href="{review_link}" target="_blank">{review_publication}</a></div>
</div>

{if count == total_results}
    </div>
    <div class="clearboth"></div>
{/if}
{/reverse_related_entries}

(Your {if no_reverse_related_entries} conditional was superfluous.)

Likewise, your first reverse_related_entries tag pair should follow the same format (it currently has no channel parameter).

  • Bang on Derek. Thanks. I understand why the conditional was superfluous: I'm testing for count. Not crazy about that pattern; but it is what it is. – NotoriousWebmaster Mar 19 '13 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.