Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [relatedto]

The tag has no usage guidance.

1
vote
1answer
17 views

Pagination: Next/Previous related to author

I'm having trouble limiting next/previous links in one channel to articles by the author. next/previous links are working correctly on the regular blog but when included on the DJ blog I get unknown ...
1
vote
2answers
25 views

Filtering by categories AND tags with full match

We're trying to filter by categories AND tags in the one form. However can't seem to get things working as we would like. Essentially, we have a form that pulls in the tags and allows multiple ...
0
votes
1answer
14 views

RelatedTo “and” and arrays

I have something I can not get my head around. This works as expected: .relatedTo(['and',{targetElement:22},{targetElement:33}]) But when I am building an array to use as relation criteria like so: ...
1
vote
3answers
33 views

Returning entries that contain both categories

I'm creating a filter and would like to return entries that must contain multiple categories (and behavior, not or). A sample url would be /events?cat=2,3. {% set eventCat = craft.request.getParam('...
1
vote
1answer
48 views

Display categories not related to an entry

I'm trying to output a list of categories that are not related to a particular entry (in order to show a list of services other than the service related to the current entry). I have this code which ...
1
vote
1answer
31 views

SQL error when trying to use sortOrder on Matrix related block (Craft 2)

I'm getting the following SQL error when trying to simply order related entries in a Matrix block. Anyway around this? CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity ...
1
vote
1answer
20 views

Edit entry, on the front end, with the entries field

I currently have front-end code working for a user to create an entry, add a title (text input) and also relate entries via the entries field type and checkboxes. All on a front-end application. ...
1
vote
1answer
22 views

Question about “relatedTo”

I want to get list of entries in my section video related to my current entry {% for video in craft.entries.section('videos').limit('3').relatedTo({targetElement: entry.title, field: 'talents'}) %} ...
3
votes
1answer
65 views

Get related posts excluding current post in Craft 3

In Craft 3, I’m trying to get the five most recent other posts sharing a category with the current post. I got this far: {% for relatedPost in craft.entries.relatedTo(entry.newsCategory).limit(5) %} ...
0
votes
0answers
11 views

Trying to paginate from filtered multi-select within a Matrix

I've been trying to paginate some shoes for a store, I've been able to filter inside the loop but that causes gaps, example if one shoe is filtered out I would get 7 shoes on the page instead of the 8 ...
2
votes
1answer
31 views

How to exclude child elements when looping through categories?

I've got a few categories set up with a few child categories for each. Each one has assets (PDFs) assigned to them, by going into the assets, double clicking, and setting the category field there. So ...
3
votes
1answer
64 views

Filtering multiple categories with URL queries

I am trying to filter using categories. I have to filters type and size, in the url. /products.html?size=medium,large&type=polo-shirt,jeans In my template, I am doing the following {% set sizes ...
1
vote
1answer
20 views

Returning entries based on Relationships across different category groups using 'and'

I'm trying to figure out how to set up my relatedTo paramaters to do a category search. Normally it's not a problem but in this case I need something more complex than normal. I have multiple ...
2
votes
2answers
81 views

Reverse relationships with entries and users

I have a relationship between users and 'locations', and I'm using the code below to output some markers for a map. This all works fine except for two things: I'm repeating a couple of 'for' loops. ...
2
votes
1answer
40 views

Can I get entries related to one category from a specific site?

If I can get entries in a category like this: {% set entries = craft.entries.section('sectionSlug').relatedTo('categorySlug').all() %} And a entries from another site like this: {% set entries = ...
3
votes
1answer
113 views

Craft 3 Element API: Query the “parent” entry of a “child” entry with Matrix blocks connected by an 'Entries' field

In a Matrix block field of a "page" entry, I'm using an Entries field to manually select a list of "article" entries to the "page" entry. When I query an "article" entry, is it possible to query its "...
0
votes
0answers
28 views

Searching for multiple tags with the relatedTo parameter's 'and' / 'or' arguments

I'm trying to get the code in this part of the docs—the "Passing Multiple Relation Criteria" section—working, but something's screwy. The mySection section has multiple tag fields. One field has a ...
1
vote
1answer
38 views

Merging Multiple Relations as params

I have the following code where I'm pulling entries related to another entry which works fine. However I also want to limit the entries returned on a category page and thus am merging in a relatedTo: ...
0
votes
0answers
12 views

How can I pull in a related table?

Each of my entries has a table with budget projections. I loop through related entries. But, how can I loop through and bring in the related table? This is my table for the entry: {% set field = ...
1
vote
2answers
38 views

Group entries by Category and then in each category by related entry field

I have a channel with categories and an entries field. I need to first group all entries by their category. This is working fine. {% set entries = craft.entries.section('publicationsChannel') %} {% ...
0
votes
0answers
42 views

Reverse RelatedTo Super Table in Matrix

Anyway to do this using Super Table? I have it working for Matrix fields but prefer Super Table because of the layout. I have tried this in Super Table but receive no elements. I have Matrix field ...
0
votes
1answer
49 views

Categories Related To Matrix Fields

Please help me build my sandwich locator maker :) I have 3 categories, breads, meats, condiments I have a Section called subShops with a matrix field. My matrix field is called sandwichBuilder, ...
1
vote
1answer
45 views

cannot get relatedTo by slug only ID

Can someone tell me why I am going crazy and cannot figure this simple relatedTo issue out? So I have a categories section called Case Studies and several categories within. I am trying to filter the ...
1
vote
1answer
15 views

List users connected to me

I have a relationship field within my member profile. It allows users to connect to each other, i can list those that currentUser is connected to, but i need to list all other members that are ...
1
vote
1answer
76 views

Include the URL of a related entry field

I would like to add the URL of the channel entry I have selected (atm 2 channels are available to choose from), so I would like a url like: summerhouses/product1 or greehnouses/product2 how would ...
0
votes
0answers
17 views

Related entries for a Shortlist saved entry

I'm using the Shortlist plugin and saving a structure to the Shortlist, this structure has related 'Offers'. I'm trying to show all the entries related to my structure on the lists page. {% set ...
1
vote
1answer
43 views

RelatedTo in plugin based search

$criteria = craft()->elements->getCriteria(ElementType::Entry); $criteria->section = 'stories'; $criteria->search = $this->query; $criteria->order = $this->orderSql(); $criteria-&...
1
vote
0answers
61 views

Category counts for query results

I'm trying to display results from a search. I want to display the categories represented by the search results and the entry count for that category. Think of how Amazon's "refine results" sidebar ...
2
votes
1answer
86 views

Combine Eager-Loading and relatedTo(category)

For a website I'm building for a client I've build a navigation where on hover an image changes dynamically to the image assigned to the entry. See this page for a better understanding: http://...
1
vote
1answer
57 views

Get Related Entries and then filter those by specific category in url segment

Channels: Photographers Photos - entries field handle "photographers" - categories field handle "category" url structure where segment 2 is the photographer slug and segment 3 is the ...
0
votes
0answers
18 views

Find unpopulated categories [duplicate]

I know I can find categories "related to" actual entries so I can list just the populated ones. {% set entries = craft.entries.section('news').ids() %} {% set categories = craft.categories....
2
votes
1answer
44 views

SEOmatic not merging fields from a related entry

I have a pretty specific set up: posts get created via rss feeds and images are not attached to the specific posts, so instead in the entry template I use an image from a related entry. When I try to ...
1
vote
1answer
55 views

relatedTo working for one category group but not another

I'm trying to show a list of entries related to the same category on a page that contains a single entry. I have two category separate category fields in the entry, both with one category each ...
1
vote
1answer
67 views

Get relatedTo from Neo field

In channel A, we have a Neo field with a couple of different block types, in 1 of those types we have an entries field with channel B entries. On the channel B entry, I'd like to find out if it is ...
2
votes
1answer
101 views

How to get all images from entries including Matrix field

I have a photo gallery that pulls in all entries and then finds the images within them and then displays them along with links to the entries that used that image. Except, it's not pulling in the ones ...
1
vote
1answer
37 views

How to save multiple related entries on the frontend with 1 checkbox?

I have a frontend form and would like to save multiple related entries by checking 1 checkbox. I have this working to save 1 related entry: <input type="checkbox" id="user-type-select-{{ userType|...
1
vote
1answer
156 views

Pass 'not' category.id to relatedTo in Craft

I have a search page that filters with these params: {% set results = craft.entries({ section: 'properties', price: range, search: query.location, relatedTo: status, order: ...
0
votes
0answers
28 views

if products related to entry in product entry field, else products related to type

I have an entry field in each of my products that have an entry assigned to them. These are designers that are linked to each product. I also have product types. For each product, I want to show ...
2
votes
2answers
326 views

Multiple category relationship criteria (or)and(or)

Is there a way to do relatedTo categories where the category is (a or b) and (c or d or e)? I can get (a or b) working using: {% paginate craft.commerce.products.relatedTo(categories).limit(20) as ...
0
votes
0answers
53 views

Display all entries related to a source from a specific field

super noob question, but i looked around the forum and i couldn't find a solution, at least none that is working. quickly explained. i have an entry of the type 'produce', a tomato. now i want to ...
1
vote
0answers
76 views

Advanced search entries relatedTo category and unrelated to any category

I know the long-form method for achieving my goal, but I'm hitting a wall in trying to keep the conditionals down. Is it possible to search for entries related to a specific category field AND search ...
2
votes
1answer
220 views

relatedTo currentUser AND entry

I have channel X set up where it's entries have a "users field", an "entries field" (that are picked from channel Y) and a whole bunch of other data with regards to the how a defined user has ...
1
vote
0answers
44 views

Showing products from many categories becomes very slow

We have 8000 products imported in the database, with a few 100 categories, sometimes up to 4 levels deep. What we try to do is that when a user clicks a main category, we show 4 random products of ...
1
vote
2answers
154 views

Filtering dynamic criteria with AND

I have a form that is set up to include multiple values with checkboxes. I pass all those values into an array {% set specsQuery = craft.request.getParam('specs') %} {% set productSpecsCategory = ...
1
vote
1answer
293 views

RelatedTo query with length criteria

I am trying to get results from a relatedTo query, but only if there are more than say 1 results. Right now I am using two queries to achieve this, like so: {% set authors = craft.entries({ ...
2
votes
2answers
36 views

Need a little help with basic understanding of how categories work

I am trying to figure out how I can put categories to use, and I need some help. I have created a category group called "group1", and 2 catogories inside called "cat1" and "cat2". and I have added ...
1
vote
1answer
147 views

Related Entries

I want to glue entries together across multiple sections. My first thought is to use fields that are entry related, like blog would have the fields news, tutorials. The tutorials section would ...
2
votes
1answer
123 views

loop through an entry's “related entries”, grouped by category

Hope somebody can help us with this: Objective: loop through a given Entry's "Related Entries" entry field and output the results - but group the results by the category to which they belong - not ...
3
votes
0answers
47 views

relatedTo doesn't seem to work when using multiple sections in a craft.entries call

I can do craft.entries.section('mySection').relatedTo(item.id) and it will return the result, so i assumed i could do craft.entries.section(['mySection','mySection2','mySection3']).relatedTo(item.id) ...
5
votes
2answers
156 views

Most related articles

I am using the normal relatedTo property to find related articles, but I have an issue which is: craft.entries.section('section').relatedTo("tags").id('not ' ~ entry.id).limit(3) Lets say THIS ...