I have 3 channels: Reviews, Products and UseCases.

In the section "Reviews" an entry has a list of "Products", based on a matrix field. Every block in this matrix field represents one listed "Product". The block contains of two entries (relationship) fields one to an entry of the Products channel and another one to an entry of the UseCases channel.

Now the question: Based on this setup, is it possible to query all Products with relation to a UseCase? (I am struggling because there is no direct relationship but only an indirect one via a Matrix block.)

I am in general relatively familiar with Craft CMS, but unfortunately not on that level of complexity, therefore I am very happy to get your help.

Thank you very much!

  • You mean like this craftcms.stackexchange.com/a/25521/5557? – Robin Schambach Oct 3 '18 at 13:06
  • I am not sure, but I don't think so. The use of "sourceElement' as well as of 'targetElement' requires from my point of view a direct relationship between entries, while I only have an indirect relationship (defined in a matrix block of a third entry). – MISC Oct 3 '18 at 14:17
  • Yeah your target is a product and the source your matrix block. You want to query for all owners of all matrix blocks that have a certain product/list of products as target so you insert the matrix field handle as link between your entries to tell Craft not to look for matrix elements but for their owners – Robin Schambach Oct 3 '18 at 14:19
  • I was not successful, but thank you very much. – MISC Oct 3 '18 at 18:17

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.