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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

The tag has no usage guidance.

0
votes
1answer
7 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
37 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
9 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
25 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
42 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
18 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
58 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
34 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 = ...
2
votes
1answer
62 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
23 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
29 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
35 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
35 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
34 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
36 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
14 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
72 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
37 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
49 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
69 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
53 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
38 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
51 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
51 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
91 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
33 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
125 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
26 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
306 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
35 views

List entries related to a first category, but not a second one

I have the following situation: I am listing entries from a category field called categories. I am on the category template, so the category variable is set. {% paginate craft.entries.section('...
0
votes
0answers
41 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
70 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
160 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
42 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
135 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
252 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
35 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
144 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
108 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
138 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 ...
1
vote
1answer
41 views

Fetch target entries that have been linked through an Entries field

I have a section Posts that has an Entries-type field called Authors that can be linked to one or more entries in section called People. To make a filter for my posts index, I need to fetch all the ...
3
votes
0answers
130 views

Categories within matrix for relatedTo

I have a matrix field with a category field. I need to group these matrix items by category and give them headings which I'll use for tabs. This is how I'd do it for entries but is it possible for ...
3
votes
1answer
59 views

Basic Relation save

I have two sections: Drinks Ingredients I have a relation/entry field set on the drinks. So for example, two entries in the ingredients section are related to a specific drink. My question: I ...
1
vote
2answers
55 views

Show related entries grouped by category with category title and description

Anyone able to direct me on this? I have a page that allows you to pick related entries (cables) within the page I want to output the related entries (cables) but group them by their category. I have ...
1
vote
0answers
85 views

Element API: Checking for unrequired related entry field in transformer

One thing that is very unclear to me in the docs regarding the Element API is how to properly write up a related entry field, asset, category, etc. In my case, I need to output the title and id of a ...
3
votes
2answers
628 views

How can I filter selected/related entries by their categories?

I have a section called "Events" and an Entries field, we'll call myEntriesField to select related entries from another channel called "Exhibitors" On the Events page, I need to display the related ...