2

I'm trying to filter a list of products based off of a Playa field. The URL for the template is like this: http://www.mysite.com/products/seller/joes-jetpacks

joes-jetpacks is the URL Title of the entry the product is related to. So to display all products that are sold by Joe's Jetpacks, I'm using this tag:

{exp:playa:parents
    channel='products'
    url_title='{segment_3}'
    limit='7'
    disable='member_data|category_fields'
    orderby='title'
    sort='asc'
    paginate='both'
    status='open|Featured'
}
    {!-- channel listing content --}
{/exp:playa:parents}

But that returns no results. Alternately, if I replace the url_title parameter with entry_id, and use the url http://www.mysite.com/products/seller/1234 instead, I get the correct results.

  • EE 2.5.2
  • Playa 4.4.3

1 Answer 1

2

Actually, Playa is doing everything correct here. The parameters you pass on {exp:playa:parents} are for defining what parent entries you want to get; they’re not meant to describe the child, which is what you’re doing with url_title.

If you have a URL Title for an entry and you want to get the parents of that entry, you first have to get the child entry with {exp:channel:entries}:

{exp:channel:entries channel="merchants"
                     url_title="{segment_3}"
                     limit="1"
                     disable="categories|custom_fields|member_data|pagination"}

    {exp:playa:parents channel='products'
                       limit='7'
                       disable='member_data|category_fields'
                       orderby='title'
                       sort='asc'
                       paginate='both'
                       status='open|Featured'}

        {!-- channel listing content --}

    {/exp:playa:parents}
{/exp:channel:entries}
2
  • Makes sense. I think I just got confused because entry_id worked, and I'm used to the two being interchangeable as far as functionality.
    – kmgdev
    Jul 31, 2013 at 21:28
  • Ah yes. entry_id is the one exception to that, which does target the child entry ID. Aug 1, 2013 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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