CCK versus Taxonomy for node referencing

kvantomme's picture
public
kvantomme - Sat, 2007-05-19 20:26

I had been looking for a way to have a two-way reference between 2 nodes. You would need this for basic CRM functionality e.g. to be able to link a person to a company or an action to a project. This way you can go to a person and see what company he is part of or go to that company and see all the people that are working in that company.

First I tried to implement this with taxonomy. This however did not give all the functionality I wanted, without any additional modules, you would have to type the name of the parent twice, first as a title for the parent node and then to create the taxonomy for that project.

The NAT (node auto term) module goes in the right direction to solve this problem, by creating a term from the title of a chosen content type when creating a new node. You still however somehow have to connect that term to the parent node that generated it. I'm sure that you could solve this with some php, but the connection wouldn't give information about who is the parent and who's the child...

The other way to link things together is through a node reference field in CCK. A node reference however is only one directional and requires an existing node to link to. So if you got a new contact for a not yet existing company, you would have to first create that company and then create that person separately.

I solved the problem with a combination of CCK, Views and addnode (requires Subform Element):
-First enable the addnode module, this will give you a widget that allows you to either select an existing node or create a new node of the chosen content type (e.g. a company).
-Then you create the parent and child content types. In the child content type you add a node reference field for the parent content type. This creates a clickable link going from the child to the parent.
-To create a reference to all child nodes from the parent node you use a views block.
*Create a new view
*enable block view
*add fields for "node: view link" and any other information you want to display
*add the appropriate nodereference as an argument
*give in the following code in the "Argument Handling Code" area:
$args[0] = arg(1);

and that's how you can get an elegant connection between a parent-node and it's children.

Credit goes to Paul Resnick who posted the above snipet at http://drupal.org/node/70145 and to all the wonderfull people that created these great modules.


Great, sound nice but a bit complex. I'will study and try

ferran's picture
ferran - Sun, 2007-06-03 14:10

One of the think that we need is a way way to select and sort by terms, but also we must to find some solution to search and match profiles
I implemented some very simple taxonomy search but any minimum efficient and professional web tool to search in profiles we have found or see in Drupal at the moment.

The idea is to have a search page where you can select in a selection list (from term, profile fields or free keywords) and find the list of selected profiles (three or four fields i.e. username, organization, country, link to the user profile)

Ferran
we are doing some profile efforts in http://ecentres.net/user/5


I have found this, and also

nachenko's picture
nachenko - Tue, 2007-08-28 11:25

I have found this, and also the relativity module. Both the module and your method seem fine solutions, but I don't get the difference. I see relativity module is older than this post, so...

why did you decide to go this way instead of using Relativity module?


To solve this issue, the erp

singularo@drupal.org's picture
singularo@drupal.org - Mon, 2007-10-15 23:56

To solve this issue, the erp project just uses "customer" as an og node type, all quotes, invoices etc then get grouped under the same organic group. This doesn't link a quote to an invoice though, which we've done with code so far.

It looks like we could probably utilise relativity instead of coding ourselves for the linking.


thx

Eikaa@drupal.org's picture
Eikaa@drupal.org - Tue, 2008-04-22 00:04

just what i was looking for, but for a completely different project


ok I'm a little stuck now

davebalck - Sun, 2008-04-27 19:08

This has been a fantastic help to me, also for a different project.
I have been able to get a primary top menu to open up a left-sidebar submenu and each of these links open up related right-sidebar block which shows a teaser list of items. all good all working but now....
When I click on the individual teaser items I lose both my sidebars. What I ideally want is for the sidebars to stay exactly the same until a new menu or submenu item has be selected.
I hope I have made my problem understandable. I have been looked at numerous ways of solving it, such as Panels, Taxonomy, CCK and Viewfields, Insert Views, and on and on but nothing seems to be able to do this for me.
Any ideas?

I'm 95% there...

smkeesle - Mon, 2008-08-04 11:06

....as usual the last 5% gets ya.

I have a created block display that shows the "child" nodes in a table. I can pass in arguments for nid's that I know and see the preview display the correct "children".

Even though I've activated the block for this display and am trying to show it on the parent nodes, it never shows up (not even its title!). I can create a block that displays the argument

<?php
echo arg(1);
?>

and verify that I am getting the right id.

Anyone have the last 5%?

I'm using Drupal 6.3 with the latest dev releases of views,cck.