Hello,

I would like to create a "collection of existing nodes" according to several criteria but I'm not sure about what's the best way to do it, so I'll explain my original idea so anyone can tell me if it's right or not and how to achieve it.

I have several nodes that are CDs (music) and my site's idea is to create periodical "collections" of CDs (for example: summer nights, or rare funk music... whatever) in order to do that I created a free-tagging taxomy field and each taxonomy would be a collection. That would work fine, but since I want to explain the reason of the collection, some background and add some pictures as well, I created another content type called "collection", my idea was to "link" the "collection node type" with the selected nodes using the taxonomy field and create a block that would be displayed in "collection" node and would show only the albums' covers (which are another content type) and create a block to be displayed on each album node that would display all the collections that have included that album. I think this makes sense, but the problem is that I do not know how to "link" the two node types: collection and albums.

Can anyone help me, please?

Thanks

Comments

bgilday’s picture

Your approach to creating a separate Collection content type to describe the collection sounds like the right approach to me.

For your CD content type I would skip the free tagging taxonomies and instead add a node reference CCK field to CDs that references the Collection nodes. For each CD node you could then create a reference to one or more collection nodes. Alterntatively you could add the node reference field to the Collection content type and then reference multiple CDs. There are pros/cons depending on your end goal for display

Once you have that setup, you can use a combination of views and/or custom node templates to achieve your desired display of collections with all the related CDs for that collection.

I hope this helps.

Brian Gilday
Municode
www.municode.com

c-c-m’s picture

Thank you for your quick response, shifthappens. I am glad to hear that you like the approach I want to do. If I have to tell you the truth my first idea was to create nodereferences, but I quickly desestimated it for two reasons:

1. One node can belong to more than one collection per time
2. By the time of creating the node, the collection may not exists. On the contrary: only after having several album nodes that have a certain taxonomy (or that are elegible to belong to one collection) the collection node would be created.

I think that I would be able to do the "link" between the two node types if I used nodereference, but I do not know how to do it with taxonomy.
Any other ideas?

Thanks

bgilday’s picture

You need a CCK Taxonomy reference field, if one existed ;-)

So, it sounds like you don't want to go the node reference route because of the volume of CDs that would be associated with a collection. This would require a great deal of manual effort every time you create a new collection to identify and reference the appropriate CDs.

I have another approach that might work for you. Bear with me as I try to explain.

First of all, regarding you issue #1 above: a node reference field CAN reference multiple items so it will support referencing a CD with multiple collections or conversely referencing a collection with multiple CDs. You set this up in the node reference field configuration to allow multiple values.

Regarding #2 - I believe that I have a workaround.

First a note about node reference. As you may already know, the node reference field allows you to filter the possible selection values based on a "View" of nodes. I think you can take advantage of this functionality in my proposed solution to make it relatively easy for you to create a new collection and quickly associate all relevant CDs to that collection.

My recipe:

1. In your CD content type, use taxonomy to tag your CDs as you described in your original post.
2. Create 5-6 test CD nodes and assign the 'summer nights" tag to some, the 'rare funk music' tag to some others, and assign a few with both those tags
3. Create a view that will be leveraged with your Collection content type called "CDs_Filtered_By_Taxonomy_Tag" or something similar and for now set it to filter CDs based on the 'summer nights' term. Don't worry about anything other than the Default Display. We won't need a page or block view.
4. In your Collection content type, create a node reference field called something like "CDs_within_collection" and configure it as a A) check box/radio button, B) allow multiple values (use 0 for infinite), AND C)set it to filter based on the CDs_Filtered_By_Taxonomy_Tag view you created in step 3.
5. Now create a new collection called "Summer Nights" and it should display all the node Titles of the CDs that you assigned the summer nights tag. Click the check box next to those nodes. You now have your summer nights collection ready to go.
6. Before creating your rare funk music collection, modify your view to filter by rare funk music. Now create your collection node and the 'rare funk music' CDs should appear as the only nodes available to select. Once again, select them all and you now have your rare funk music collection.
7. As your CDs grow and you want to create new collections based on the most popular tags, just repeat step #6.
8. If you want to update a collection because you have added new CDs with that tag AFTER the collection was created, simply update your view like in #6, edit the collection, and all the new CDs that have that tag will show up in the node reference field with their check box unchecked. Go ahead and check those boxes and your collection will now be updated.

This is an alternative approach...not sure it gets you exactly exactly what you want but hopefully fairly close.

Brian Gilday
Municode
www.municode.com