More flexible categorization

Everyone knows EE's categories suck. What this question presupposes is, maybe they don't have to. What are the best ways to handle more complex categorization schemes? For example, I am about to start development on a website for a funiture maker. There will be a "products" channel, where each product needs to be categorized in several ways: product line, type of product, room of the house. Those categories will be used in various ways across the site, include generating menus, product listings by the various criteria, related products, and so on. Below are the methods I've used before or am familiar with. Am I missing any? What the are upsides or downsides?

• Use EE's native category groups. Assign more than one group to the channel and instruct the client to select at least one of each type. Use the Category Description field as necessary for display on the landing page or what have you.

• Create a new channel for each group of categories and enter each category as a channel entry. Use relationship/Playa fields to select categories. Obviously this gives me a lot more flexibility with what information I can associate with the category, but the content entry workflow is not great. Also, lots of channels cluttering things up.

• Use Tagger/Taggable/SolSpace Tags. This is great for entering content - you can create a new category on the fly from the edit screen - but very limiting in terms of what data you can associate with a category. No category descriptions as far as I know, although I don't have extensive experience with any of these.

• Create duplicate channels for each category. This only works if you know the categories ahead of time and there are very few of them. The only time I have done this was when I was using Structure and wanted to have a page in the tree for each category. Easy to explain to clients... until they want to add a new category.

Am I missing anything? Is there a better way to handle this? What method does everyone else use?

In the past I've done a bit of a hybrid of the first two options mentioned.

Create a channel for the categories, then create an entry in that channel for each category. Rather than using Playa or a relationship field, as long as the URL title of the category and the URL title of of the entry are the same, it's very easy to access both using the segment variables.

For instance you might have a template blog/category, which results in the URL blog/category/news

In your template, rather than using the {exp:channel:categories} tag pair to access your category meta data, you'd simply use a channel entries pair to display it:

{exp:channel:entries dynamic="no" channel="categories" url_title="{segment_3}"}
...
{/exp:channel:entries}


This would make the page a bit heavier with database queries, but gives you a lot more flexibility in what fields you can associate with a category while keeping the UI for selecting and adding categories very simple for the user.

• Look's like Jeremy beat me to it. Basically the same approach – Siebird Nov 21 '12 at 17:53
• This is clever. I don't know that I would trust the average client to add new categories this way, but for sites where they are relatively static this would work well. – Eli Van Zoeren Nov 21 '12 at 18:07
• I guess it depends how you setup the templates. Presumably it could be setup in such a way that adding a new category without adding the associated entry doesn't explode, but I agree, it's definitely a bit more complicated. Still, can't be much worse than tinkering with the limited native category fields. – Jeremy Gimbel Nov 21 '12 at 18:13
• I have used precisely this approach too. It works but the dependence on the url title is fragile. I'm hoping to write an add-on that solves this problem, once and for all. – Mark Croxton Nov 21 '12 at 19:03
• I'm accepting this answer, pending Mark writing another magic add-on that will solve all my problems (like he so often does). – Eli Van Zoeren Dec 1 '12 at 3:00

I think the first two options are your best bet. The last two don't give you the flexibility needed when displaying products based off a segment.

I have done something very similar to your second option w/o Playa. Just mirror the categories as entries and assign that entry the same category (mirrored approach). Then use a extension like Low's Seg2Cat or Litzinger's URL Helper to dynamically display the content.

This doesn't limit what information can be tied to a category (ie. description, 1 image, etc.)

It's not the most efficient, but I've done a true nested URI's category/product that scales nicely with Switchee & URL Helper: https://gist.github.com/4089096