1

I have 2 channels, artists and artwork.

I want to display the artwork entries where their parent entry, in the artists channel, has the status set to 'open'.

I would like to show all the fields from the artwork entry.

As I can't search against the parent field status using the channel entries tag i presume I will have to use the query module, which I am happy to do.

What query would I use to show the entries?

Thanks

4
  • can you show us what you've tried? – AllInOne Jan 14 '15 at 2:56
  • @allinone I have not tried any query yet. – zizther Jan 14 '15 at 9:13
  • Could you have a channel entries tag that loops through all open Artists? Then set up a relationship field and attach all artwork to the Artist that way. With the relationship field you can specify to only show open entries. Apologies if I've misunderstood the question and equally if you need some code examples let me know. – Kieran McClung Jan 15 '15 at 10:33
  • You need it because you want to create a list of art w/o grouping by artist? – Max Lazar Jan 15 '15 at 14:02
2

If I understand you needs correctly, and you need art list w/o grouping by artists (for list for last artworks as example) :

{exp:query sql='SELECT GROUP_CONCAT(child_id SEPARATOR ',') as art_ids FROM exp_relationships LEFT JOIN exp_channel_titles ON exp_relationships.parent_id=exp_channel_titles.entry_id  WHERE exp_channel_titles.status = "open" AND exp_relationships.field_id = 29 LIMIT 100' parse="inward"}
    {exp:channel:entries channel="artists" entry_id = "{art_ids}" }
        {artwork}
           {artwork:title}
           {artwork:other-custom-fields]
        {/artwork}
    {/exp:channel:entries}
{/exp:query}

in example I select rel based on field_id.

1

Unless I'm missing something this is really straightforward. The channel:entries tag assumes the open status so you don't even need to specify it.

Assuming you have a relationship field in the Artists channel where you specify which pieces from the Artwork channel belong to that artist the cod is roughly:

 {exp:channel:entries channel="artists"}
    {artwork}
       {artwork:title}
       {artwork:other-custom-fields]
    {/artwork}
 {/exp:channel:entries}

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.