0

I've got quite a bizarre setup to get the most recent "Rated" entries (Via Solspace Rating Module) and output the related Product & Video to that entry (Which is handled via Playa)

{exp:rating:entries
    collection="Video Reviews"
    orderby="rating_date"
    sort="desc"
    limit="1"
    dynamic="no"
}

    {exp:channel:entries channel="entry_video" orderby="date" limit="1" dynamic="off" entry_id="{entry_id}"}

        {title}

        {cf_video_related_products limit="1"}
            {title}
        {/cf_video_related_products}

        {cf_video_related_video limit="1"}
            {title}
        {/cf_video_related_video}

    {/exp:channel:entries}

{/exp:rating:entries}

Now when I run this, it works... Except I get something like this:

Rating Title
Rating Title
Rating Title

When really I want it to be:

Rating Title
Product Title
Video Title

Now I know what's happening... There is multiple title tags and it's possibly pulling the {title} from the Rating module or the Channel Entries loop for every {title} var.

I thought of changing this, so i use the var_prefix parameter supplied by Playa, but this doesn't work:

{exp:rating:entries
    collection="Video Reviews"
    orderby="rating_date"
    sort="desc"
    limit="1"
    dynamic="no"
}

    {exp:channel:entries channel="entry_video" orderby="date" limit="1" dynamic="off" entry_id="{entry_id}"}

        {title}

        {cf_video_related_products limit="1"}
            {title}
        {/cf_video_related_products}

        {exp:playa:children field="cf_video_related_products" limit="1" var_prefix="product"}
            {product:title}
        {/exp:playa:children}

        {exp:playa:children field="cf_video_related_video" limit="1" var_prefix="video"}
            {video:title}
        {/exp:playa:children}

    {/exp:channel:entries}

{/exp:rating:entries}

But all this does is output:

{product:title}
{video:title}

Am I doing something wrong? I've tried parse="inward" but that doesn't help neither. Because I thought it might of been the parse order causing this.

  • Jason, that should work. Have you tried this without the Ratings module in play? A reduction test is going to be your best bet in figuring this out. – Lisa May 21 '13 at 18:10
0

I looks like you're using both the field tags and module tags for cf_video_related_products playa field.

Try removing the field tag and add the entry_id="{entry_id}" parameter to each of the exp:playa:children module tags. Typically the module tags defaults to the current entry's ID if within the exp:channel:entries tag pair, but that might thrown off because of the nested ratings and entries call.

If that doesn't work, you could always use an embed:

Parent Template:

{exp:rating:entries
    collection="Video Reviews"
    orderby="rating_date"
    sort="desc"
    limit="1"
    dynamic="no"
}
    
    {embed="tmpl_group/tmpl_name" entry_id="{entry_id}"}

{/exp:rating:entries}

Child Template:

{exp:channel:entries channel="entry_video" orderby="date" limit="1" dynamic="off" entry_id="{embed:entry_id}"}

    {title}

   {exp:playa:children field="cf_video_related_products" entry_id="{entry_id}" limit="1" var_prefix="product"}
        {product:title}
    {/exp:playa:children}

    {exp:playa:children field="cf_video_related_video" entry_id="{entry_id}" limit="1" var_prefix="video"}
        {video:title}
    {/exp:playa:children}

{/exp:channel:entries}
| improve this answer | |
  • I'll give this a bash. Ideally I don't want to use an embed. – Jason Mayo May 21 '13 at 15:26

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.