3

If you don't have tons and tons of creators, you could do that by querying creators and re-arranging the results: {# Get all creators and eager-load the products #} {% set creators = craft.entries() .section('creators') .with('products') .all() %} {# Declare an array to store all related product ID #} {% set products = [] %} {# Build an array ...


3

Lots of pieces to this question. Since you need to check each field, something like: {% set whichField = null %} {% for checkField in ['field1','field2','field3','field4'] %} {% if attr(relatedReview,checkField) is not empty %} {% set whichField = checkField %} {%endif%} {% endfor %} {{ relatedReview.url ~ '#' ~ whichField }}


3

So if I'm understanding corrently, your Review entries contain multiple entries fields, one of which stores News entries related to the product review? If that's correct, then let's assume that field is called relatedNews. You can utilize advanced relations to find what you're looking for. So for an individual News entry you could do the following: {% set ...


2

Just to clear up a potential source of confusion: For Craft, the only 'real' parent-child relationships are the hierarchies in Structures (a type of Section). Entry fields and by extension relations (including the relatedTo parameter) are technically many-to-many relations (even if you allow only one related entry in your recommendedSystem field). The ...


2

Problems I think you're just mixing up a couple of variables in your template. Just simplifying your template and better naming for variables will help you spot the errors. In particular: {% set myEntryQuery = craft.entries().section('nflTeams').all() %} This isn't used at all, what is it doing there? Get rid of unused code. {% set players = craft.entries....


1

If the relation is (a) confined to a single field in sectionA and (b) that field can only relate to sectionB entries, you can just query for entries without a relation in that field using the :empty: parameter: {% set sectionAEntriesWithoutRelation = craft.entries() .section('sectionA') .related_section_b(':empty:') .all() %} Replace ...


1

Are the nutrition entries associated with restaurant entries through a single field or multiple fields? If it's only one field and you only want to query for restaurants that have any nutrition associated with them, you don't need to load all the IDs. Instead, you can just use :notempty: to find restaurants where the nutrition entries field is not empty. ...


1

A blanket relatedTo query should do the trick. craft.entries().section('thename').relatedTo(currentUser).all()


1

I know this question is 1.5+ years old but I landed here looking for something similar and think I found the answer: relatedToEntries. In the docs: https://craftcms.com/docs/3.x/graphql.html#relations Something like this (replacing 'attributeHandle' and "valueYouWant"): query test { entries(section: "vacancies", relatedToEntries({...


Only top voted, non community-wiki answers of a minimum length are eligible