Hello, all!
Intro
After setting up my first site without any coding or crazy module mash-ups, I feel like I'm ready to get my hands dirty. My biggest problem is that I don't think there are any modules out there to provide what I need. Don't get me wrong - I'm fine writing my own module, but I'd like to avoid reinventing the wheel.
The Challenge
So, here's the deal. My site has a variety of clothing 'items' such as shirts, pants, shoes, etc. Each item belongs to a 'brand', 'store', and potentially more categories as well.
The brand is something like:
- 'Polo'
- 'Ralph Lauren'
- 'Lucky'
- 'Adidas'
- 'Nike'
- etc.
The store, on the other hand, is something like:
- 'Old Navy'
- 'Nordstroms'
- 'Zappos.com'
- etc
Similar to most Drupal sites, I need to categorize these items according to the brand, store, and new categories as they arise. Now, I know what you're thinking - "Uhh, just use taxonomy. Duh." However, there's a twist. For every category (such as 'Old Navy'), I need to store data specific to that category alone. So, for 'Old Navy' I also need to store the URL to their website, a description of their apparel, and perhaps allow users to add comments on the store. Furthermore, when I generate the view page for an item, I also need to easily access the item's associated store and brand for outputting to the screen. With all of these extra requirements, what we've been calling a category is starting to sound more like a node.
The Solution...?
Taxonomy
So, taxonomy is a likely candidate for getting the job done. However, how are we going to associate the extra meta data with the terms? I suppose I could do some manual coding, putting the store/brand data in a separate table and referencing the term by its tid. This feels, messy, though, and it seems like this sort of functionality is needed frequently enough that it should be easier.
Nodes
With CCK (or just doing it programmatically), I can define my own node types, adding arbitrary metadata to the type. By doing this, I could create two new node types, one for Store and one for Brand. Then, I would just need a way of associating the terms in the taxonomy with a specific node. Can this be done? Maybe I could create a new CCK field type of "Taxonomy Term" which would allow the node to be associated with a specific term. Note that this relationship is different from the classic approach to nodes/terms ('this node can be described by this term'). Rather, this relationship would denote that this node describes the term. (e.g. A 'store' node with information on the store 'Old Navy' would describe (provide meta-data for) the taxonomy term Stores->Old Navy.
Your Thoughts?
I'm new to Drupal development, so I'm sure I'm overlooking some things. This seems like commonly-needed functionality that would be frequently needed by Drupalistas. Maybe my approach of taxonomy/nodes is completely off. If there's a solution that is completely unrelated to anything I've mentioned, I'd be even more interested to hear your thoughts! :)
Thanks so much in advance for any insights that you can provide. :)
Comments
Some thoughts
I would create one content type per "metedata", in your case "Store" and "Brand". I am guessing you also have a "product" content type (or maybe more than one). You could then associate the "store" vocabulary with both the "product" and "Store" content types and the "brand" vocabulary with both the "Brand" and "product" content types. It is then fairly easy to associate the pairs.
You also probably want to check out the Node-Auto Term module which sound like it would be useful to you (I have not tried the module). More generally you might want to look under http://drupal.org/project/Modules/category/71 to see modules that work with taxonomy in some way.
Perfect
Steven, ;)
Thanks so much - the NAT module seems to do the trick! I was planning on implementing a module to do the exact same thing. Looks like I can use NAT to keep the terms and nodes in synch and access the nat table from within my module in order to find node data that has been associated with a term.
Of course, if anyone knows of alternative approaches to doing this, I'd be happy to hear them.
Thanks again, nevets, and to all who frequent these forums.
-Rinogo