Questions tagged [relations]

Questions around Craft's relational field types.

332 questions
3
votes
2 answers

Display Stores by Region with relations

I need display Stores by Region, by example: Alabama Store X Store Y Idaho Store A Store B So: I create two channels Stores and Regions. In the channel Stores I create a entries field type called storesRegion and check Regions source. So…
user8572
3
votes
1 answer

Get entries where relation matches or is empty

I have a channel section (tickets) where each entry has a members field. The members field can either be empty (making the entry 'public') or specific members can be added (making it 'private', to only the selected users). I want to get a list of…
3
votes
4 answers

Get entries NOT related to categories

is it possible to grab all the entries in a section that arent related to a category? So something like craft.entries.section('news').relatedTo('not',category) Doesnt seem to work but is there some other syntax?
Keith Mancuso
  • 2,421
  • 16
  • 27
2
votes
1 answer

Entries related to an entry in a list of entries

I try go get entries (of channel B) related to an entry (of channel A) within a list of entries (of channel A). All entries of channel B have a relationship field and at least one relation to an entry in channel A. But I get no results from channel…
MISC
  • 1,019
  • 7
  • 17
2
votes
3 answers

Displaying Entries That Are Not Related

I have two channels set up, the first creates entries called "databytes" the second is a channel for relating certain databytes to each other called "databyteSeries". In my template I want to output all databytes but if they are related just show…
Gareth
  • 1,605
  • 2
  • 14
  • 35
2
votes
1 answer

How to find entries that are not related?

Is there a simple way to find entries that do not have a relationship with another channel? I see similar questions here and here, but neither seem to work in this context (or I don't know how to adapt their answers). I have 3 channels, 'accounts',…
Douglas McDonald
  • 13,457
  • 24
  • 57
2
votes
1 answer

Can I Relate Afterwards

I've imported Wordpress comments into a post type called 'comments' in a section called 'interactions'. I have the slug stored in 'relatedPostSlug'. How would I relate the 'relatedPostSlug' to the actual posts with that slug?
Shane Hudson
  • 475
  • 3
  • 12
2
votes
1 answer

Querying relational data in plugin

I'm creating a plugin and I need help to query relational data. Here's the table schema I have: collection +----+-------------+---------------------+---------------------+-----+ | id | label | dateCreated | dateUpdated | uid…
sboucher
  • 51
  • 3
2
votes
1 answer

List related siblings

I've been reading a lot of documentation (getSiblings, getDescendants etc) but can't get this to work: I have a structure, named 'areas'. When showing an entry that is a child of an area in 'areas', I would like to list its siblings (that is in the…
osh
  • 91
  • 4
1
vote
1 answer

Display entries filtered by one or two related entry fields ordered by "dateUpdated"

I think I have been staring at this one too long because conceptually it seems fairly straightforward but I can't seem to pull it off. I am pretty sure I am going nowhere due to how complicated I am making my twig code Here is what I have: "News"…
Paulo
  • 209
  • 2
  • 7
1
vote
1 answer

Query entries "with" entries that are actually related

I have a simple query: $paidFeatures = Entry::find() ->section('paidFeatures') ->type(['simpleFeature', 'customFeature']) ->with(['relatedEntries']) ->status(['expired', 'disabled']) …
Sean Delaney
  • 720
  • 6
  • 15
1
vote
1 answer

Entries relations with additional fields

I'm searching for a way to have additional fields on relations. The simplest exemple would be; you have stores entries and products entries, and you want to create a many to many relationship with the price as additional information. How could it be…
Antoine
  • 157
  • 6
1
vote
1 answer

Relationship all to all

I'm trying to pair all my custom product entries to all my dealers with 2 extra fields per product: price per day and price per week. The condition is that all my products are paired to all my dealers in advance. So when adding a new dealer I would…
Dirkv01
  • 13
  • 4
1
vote
1 answer

Grabing data from another channel associated to an entry displayed using category

I have a page that shows a listing of entries (called products) by category. Those product entries have related content (reviews) stored in another channel that are tagged using a relations field. On the category page, I want to show the overall…
therooster
  • 113
  • 2
1
vote
1 answer

Filtering by cousins

I want to do exactly this: Multi-step & bi-directional relations with relatedTo (#1640) Common example: Let’s say you have Books, Authors, and Publishers, and two relationship fields on the Books channel: author and publisher. On a Publisher’s…
1
2