0

I'm currently trying to get all entries which belong to a section which is related to that category. e.g.

  • Category
    • Brand
      • Offer

Offer belongs to a brand.

Brand has a category field.

{% set entries = craft.entries.section('offers').relatedTo(category).find() %}

Currently trying the above, but returns nothing.

Thanks

-- EDIT --

The offer entries belong to a brand, a brand section belongs to a category. I'm trying to fetch all offers of all the brands which belong to a category.

  • Your code works for me. Did you make sure you fetched the correct category and your category field is not inside a matrix? – Robin Schambach Mar 17 '18 at 16:16
  • Doesn't work for me, the code works but it doesn't return anything. The Section is correct. This is being called on the category page itself. – JMKelley Mar 17 '18 at 16:47
  • yeah but is your relation field in a matrix? because you can't revert search related entries inside matrix elements – Robin Schambach Mar 17 '18 at 17:15
  • Is this an entry where you have a category field & you are trying to display a button with the brand link and name of that category. Or is this a category and you want to show all entries related to it? – mateostabio Mar 18 '18 at 2:20
  • Edited the question. They are not in a matrix. – JMKelley Mar 18 '18 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.