Questions tagged [relatedto]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
26 views

Sort entries by separate related entries count

I am working on a sprig board that filters out Lessons from a structure in Craft. This screenshot better illustrates this and how it works. The main table is built using the following: {# Sets default ...
user avatar
  • 1,824
0 votes
0 answers
32 views

Order related entries by the amount they have in common

I am trying to build a function that creates a list of related entries based on a few criteria. This is no issue since this can be easily achieved by using relatedTo. The problem I am facing is, I can'...
user avatar
  • 63
0 votes
0 answers
47 views

How to query relations within Supertable field via GraphQL

I have two Entry types: Albums and Songs. On the Albums entry type, I have a SuperTable field (called tracklist) where you can add tracks and select one Song entry per row. On the song page, I'd like ...
user avatar
1 vote
1 answer
24 views

Fetching entries that are related to 'not null'

I have a channel with Authors. Not all of them are used right now, so I'm trying to construct a query that will fetch all Authors are are related to some article. This is what I've tried so far: {% ...
user avatar
1 vote
1 answer
34 views

Why is my relational query returning zero?

I have an entries page structure section Pages And two structure sections / menus Menu A Menu B Menu A and Menu B have an entry field link called 'entryLink' that is a relation to an entry in the page ...
user avatar
  • 1,888
1 vote
1 answer
37 views

Get parent entry from child entry where relationship is in parent matrix field

I have a parent entry with a matrix field and one of the blocks has a relationship to a child entry. How do I access the parent entry from the child entry page? tried this, where eddChapter is the ...
user avatar
  • 1,907
0 votes
0 answers
112 views

Graphql: How to get all entries and all related entries

I am really new to graphql and the jamstack-thing but i was wondering how is it possible to query all "Events" with all related "Speaker"? Events and Speaker are two sections. In ...
user avatar
  • 165
1 vote
1 answer
58 views

Get entries which are not related in to another section

My scenario is I have entries in sectionA these are related to entries in sectionB. I want to be able to show all entries from sectionA which are not related to any entry in sectionB. SectionB has an ...
user avatar
  • 419
1 vote
1 answer
107 views

Set parent-child relationship in PHP

I'm new to Craft but long time back-end php programmer. I'm trying to assign a parent-child (a ENTRY type to another ENTRY type) relationship in php based on some business rules. I've got my child ...
user avatar
1 vote
1 answer
61 views

Optimize relatedTo query

Given: Channel: Nutrition. 550k entries. It has entries field pointing to the "restaurants" channel. Channel: Restaurants. 300k entries. I'm trying to display restaurants that have at least ...
user avatar
  • 341
2 votes
1 answer
89 views

How many levels will RelatedTo work? In Reverse?

The TL;DR summary: if I have a related Entries field that I access, can I then access an Entries field within that entry? I created a learning project running on MAMP to help me learn Craft, and one ...
user avatar
2 votes
2 answers
94 views

Change link to entry if it's related to another entry

I have a section of reviews that has a selection of entries fields that relate to entries in other sections. For instance Product A Review might relate to Product A pre-release news. On the review ...
user avatar
  • 509
1 vote
1 answer
39 views

How can I make an entries query based on currentUser is author or relatedTo currentUser

My project requires a notifications area. I want to list all notification entries that were created by currentUser or sent to currentUser. I can do created by = craft.entries().section('thename')....
user avatar
1 vote
1 answer
107 views

Order by reverse relationship count

It feels like I’m trying to do the impossible, but I can’t imagine this problem is unique to my project. Hoping someone here has figured it out before! I have two channels, creators and products, and ...
user avatar
1 vote
1 answer
147 views

Multiple relatedTo conditions using a combination of "and" and "or"

We're trying to make a filter that allows you to pick multiple items from 1 category, and multiple items from another category and return back all appropriate elements. We're in PHP land not twig so ...
user avatar
  • 129
1 vote
1 answer
356 views

How to use Sprig's "Load More" Recipe After Update

This is a continuation of a previous question I had (Here). I am using Sprig's Load More Recipe. In my category page, I want the load more function to only pull up entries that equals the current ...
user avatar
1 vote
1 answer
48 views

if entry has specific category, show specific html block

I have entries, which can have several categories. These categories are in different categorie groups. Now if i show an entry page, i want to display i certain html block based on a specific category, ...
user avatar
  • 319
1 vote
1 answer
61 views

Display related entries on a category page filtered by another category field

I have a Structure called "Stoves". Each Entry has two Category fields 'fuelType' and 'output'. Fuel Type categories = ''Wood Burning','Multi-Fuel','Gas' and 'Electric'. Output categories = ...
user avatar
  • 1,173
1 vote
1 answer
264 views

How to use categories with Sprig's "Load More" recipe

I am trying out Sprig's "Load More" Recipe and I am trying to call up entries that are related to the current category page. But when I add .relatedTo(category) to the entry model, it doesn'...
user avatar
1 vote
1 answer
64 views

How to get a list of unique related entries from within a related entries loop

Bear with me as I am not sure the best way to explain this. But to try and summarise... how can I loop through related entries (locations) inside a a related entries loop (exams -> related to the ...
user avatar
  • 1,824
1 vote
1 answer
52 views

Showing Entries based on an Entries Field but also showing a slug in the url

I have a Channel 'Articles' with an Entries field which is linked to entries in 'Staff Members' channel. This is so that articles can be assigned to different members of staff. I have the generic ...
user avatar
  • 1,173
1 vote
1 answer
134 views

Retrieve Matrix Field from Related Category in Element API

I have an API endpoint set up for a category group. This currently provides some details of all entries that have been assigned that category (i.e. related entries). That works well for some high ...
user avatar
0 votes
0 answers
69 views

Search Results not working as expected

I have a search results page set up where there are a number of parameters in the query string used to filter results. I've got 3 out of 5 of these working and am stuck on the final 2. My full ...
user avatar
  • 1,907
1 vote
1 answer
66 views

Pull info from a Related field within Matrix > within Super Table

Ok, my mind is about to implode with this… any help on template syntax very welcome! I have 2 Sections: ‘artists’ and ‘schedules’ In the ‘schedules’ section I have a Matrix field called ‘...
user avatar
  • 1,173
1 vote
2 answers
116 views

Show only and merge the entries from multiple categories related to that entry

I want to show the entries which have same category of that entry. The entry might have multiple categories, so I want to merge the result. If there is a result, then only the whole structure will be ...
user avatar
  • 139
1 vote
1 answer
59 views

Additional criteria to filter status of field passed into RelatedTo

I'm trying to save all the images related to an entry in a variable. I need the images that are added through a matrix field in the entry. I'm using the following code, but am then also getting images ...
user avatar
3 votes
1 answer
494 views

In GraphQL how to query entries where related entry has a specific value

Lets have this query: query test { entries(section: "vacancies") { title ... on vacancies_vacancies_Entry { description organisation { title ... on ...
user avatar
  • 545
1 vote
2 answers
71 views

Display entries sharing the same nested category on an entry page

I'm trying to show the other entries assigned to the same nested category (on an entry template) but get an error if I use .last() which I was hoping would show the nested category assigned entries (...
user avatar
  • 447
0 votes
1 answer
39 views

Multiple Relations Trouble

I'm having trouble setting entries with multiple relations. during testing I've hard coded the theme to 1 specific category {% set themeID = "12309" %} {% set theme = craft.categories.group('...
user avatar
  • 1,907
1 vote
1 answer
989 views

GraphQL - Get related entries based on tags field

I'm trying to retrieve entries related to the current entry, based on a tag field called topics. Simple stuff. Now, I use Craft's native GraphQL implementation so I'm bound to the possibilities this ...
user avatar
  • 111
1 vote
1 answer
49 views

order and limit the occurrences of related categories

I'm generating a list of all related categories of the entries listed on the page. {% for entry in entries %} {% set categories = craft.categories.group('functieGroep').level(2).relatedTo(entry)....
user avatar
1 vote
2 answers
77 views

Sort entries by a related entry (lastName) and then paginate

I have two channels books and authors I need to list all books sorted alphabetically by author. I have this working with the following code: <ul> {# // loop through authors so we can ...
user avatar
  • 1,907
1 vote
0 answers
69 views

Showing entries in same category, excluding the current entry

I'm new to this, so sorry if this is really basic. I want to display a list of entries in the same category as the main entry in my template, excluding the current entry. This is my code: {% for ...
user avatar
  • 11
1 vote
2 answers
167 views

Specific entry type in entry field

This seems like an easy question to answer but I can't seem to figure it out... I'm sure we could do it in Craft 2. Anyway, I'm trying to figure out how to only display a certain entry type in an ...
user avatar
  • 133
1 vote
1 answer
136 views

Get entries related to selected category only and not it's ancestors

The following is using commerce product entries, but I'm reasonably sure it could be any entry. With the following category taxonomy: - Category 1 - Category 1A - Category 2 - Category 3 ... If ...
user avatar
1 vote
1 answer
34 views

relatedTo a category in a matrix field

All, I'm very close, but missing something and any help is appreciated. I have a teamMember matrix block allowing me to add employees with some basic info. One of the fields is a category field called ...
user avatar
1 vote
1 answer
40 views

Pulling blog entries related to a structure entry field type

fairly new to craftCMS. I've wrestled with this now for hours and exhausted all research avenues. I have three main "service pages" (Web Design, Digital Marketing, Hosting & Analytics) These are ...
user avatar
1 vote
1 answer
38 views

Display related entries on the entry page they are related to

I have a number of 'blog' channel entries related to various 'fayre' entries I want to display all the blog entries related to the fayre entry page they are related to (Entry field is 'fayreBlog'), ...
user avatar
  • 141
2 votes
1 answer
191 views

Getting entries from multiple categories

I have two categories, Annual Reviews and Publications. I want to get all entries from these and paginate them. The code I am using is fine for one category - both work individually, but as soon as ...
user avatar
  • 1,888
1 vote
1 answer
228 views

Searching for item SKU in Commerce orders

I'm trying to show some Commerce 2 order information on the front-end. I can't work out the correct syntax. I'm trying to list orders that include a specific product. I have orders for item SKU "...
user avatar
  • 343
1 vote
1 answer
376 views

Get entries based on multiple fields in controller

I am trying to get the entries based on multiple fields. Fields can be of type tags, checkbox, radio box, and number. In my controller currently what I tried is. $extrafilter will be like Array ( ...
user avatar
1 vote
2 answers
921 views

Related To query

Struggling to get multiple relationship filtering working. So want to filter an entry (people) by one or more of the following: - location (entries) - specialism (categories) - team (categories) For ...
user avatar
  • 1,721
1 vote
1 answer
52 views

How to include a lightswitch for each related entry in the source element of a relationship

I have a Services section in which I keep a related entry field for News. (News by Service) The News items to be displayed for each service are selected in a "News" entries field in the Service entry. ...
user avatar
  • 137
1 vote
0 answers
204 views

Querying a supertable field

I have an entry type called people which has a superTable field called programmeAffiliations, with three fields, jobTitle, researchProgramme, primary where: researchProgramme is a category field (...
user avatar
  • 111
1 vote
1 answer
629 views

Order entries by a category field alphabetically then paginate

I've tried so many different things and can't get this to work... {% set makeCat = craft.categories() .group('make') .orderBy('title') .limit(21) %} {% paginate makeCat as pageInfo, ...
user avatar
1 vote
1 answer
94 views

RelatedTo relation - checking matrix block status is enabled

I need to search for all commerce variants related to a custom element "Account". The account element is related to a variant through a matrix field with handle varientaccountmapping, block handle ...
user avatar
  • 198
1 vote
1 answer
348 views

Multiple and or relatedTo in plugin element criteria

I am trying to return entries that relate to a series of categories. For example, I am trying to return clothing, in this example, I want to return all entries related to (flannel or denim) and (blue ...
user avatar
  • 487
1 vote
1 answer
93 views

Get entries related to same category

I have a channel (handle: "infopages") with entries. I have a channel (handle: "products") with entries. I have a category (handle: "productTypes") Every entry from "infopages" has a category field, ...
user avatar
3 votes
2 answers
78 views

Showing a list of selected/related categories to entry

I have a suitability category field in my product type that allows the content writer to select which categories this product is associated with. But my issue is that on the product page I need to ...
user avatar
  • 1,032
2 votes
1 answer
73 views

Relation fallback if no category has been selected

I have a filter with a few different parameters that get pulled in and I was wondering if there was a relatedTo wildcard that I could use. Here's the relevant code: {% set function = craft.app....
user avatar