This one is a beast of my own design, but I could use some expert EE help to get this more efficient. Here's the deal. EE categories are not as functional as I would like, particularly when it comes to custom fields. I have a large number of products to display by category, and at a category level, the site needs to have a description, multiple images, an meta description to jump up into the footer, etc. So I resorted to using an entry for this info - one entry per category. I'm basically using categories in the site only to provide the connection between the two AND to provide parent/child relationships at the category level that would otherwise not be easily achieved. I'm using GW Code Categories to provide concatenation of the category URLS (though not on the product page, which I may revise.)

Yeah, I know - expensive to process, but much more functional on the data side. On the upside, each product only has one category.

So now, when I'm viewing a product, I'm passing that product's assigned category into an embed, then using an entries loop to get the custom fields I need for the category to display within the product entry (the images at a category level, and some other custom field data, get displayed within an individual entry, rather than repeating that info at a product level within the product entry).

Right now, my URL structure is two fold:

catalog/category-name/subcategory-name (this is done within the index template in the catalog group, and once I hit the end of the tree, the list of all products in the category displays from the products channel, and I only ever go up to 2 deep)

catalog/view/product-id It's within view this template that I need to grab the description and images of the category to which the product is assigned (which matches up with an entry in my "category intros" channel)

Can you EE experts out there envision using the query module to make this marriage of content in two channels more efficient to process?

1 Answer 1


Before giving this query specifically, have you considered exclusively using entries for the categories (as you're doing) but then using Playa to link them together instead of real categories? Have a "Categories" channel, use it to store your category data (again, as you do now) and then either have a single relationship field on your products or a multiple relationship field on the categories to do the assignments. Then, you could use the siblings, parents, children, and other tags to do whatever you need.

  • I considered it but with the categories (via entries) needing parent/child relationships to one another, I couldn't wrap my head around how that would work. Commented Nov 2, 2015 at 19:39
  • @JeanSt-Amand You could have a Playa field in each category entry, for "Parent Category".
    – Matt
    Commented Nov 2, 2015 at 19:49
  • Hmm. i may consider that as a phase 1.5 approach because of the time it would take to implement. Would a query at least be more efficient than what I'm doing now with the embed that includes a second entries loop limited by category id? Commented Nov 2, 2015 at 20:02
  • It's a little hard to know without seeing the debugger. Embeds have high overhead but very complex queries can also. Is it showing as slow for you in the debugger?
    – Matt
    Commented Nov 2, 2015 at 22:19
  • What's showing as slow in the debugger is actually the entries loop itself because I have a series of conditionals within it that are getting parsed despite the outer condition not being met. I have wrapper conditionals that evaluate a URL segment, and conditionals inside each checking to see if there is a value before displaying it for a wide array of custom fields. If the outer condition could parse without the inner conditions, I'd be all set. But it seems even with 2.9+, once you put a conditional inside a conditional, everything inside parses. Commented Nov 5, 2015 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.