Not sure if this is a bug or a feature - the module seems to be working right and creates new taxonomy terms with the node title, but it doesn't seem to create a term_node association so when you look at the taxonomy you don't see the type which created it..

Should it? and if not, could it!?!?!

Comments

csc4’s picture

I've been looking at the code and I'm wondering if the issue is in lines 292-305

292    // $edit is passed by reference and 'tid' is set with the tid of the new term. 
293    unset($edit['tid']);
294
295    $edit['vid'] = $vid;
296    // Save hierarchy for vocabularies also present in the node form.
297    if (isset($hierarchy[$vid])) {
298      $edit['parent'] = $hierarchy[$vid];
299    }
300    else {
301      $edit['parent'] = array();
302    }
303    taxonomy_save_term($edit);
304    $tids[] = $edit['tid'];
305  }

Doesn't 293 mean that 304 can only ever save blank? Should 293 happen after 304?

csc4’s picture

Title: Create node link » Not creating node -> taxonomy link
Category: support » bug
Priority: Normal » Critical

I'm pretty sure this is a bug and would appreciate someone having a look.

I'm also using it to add to a free tagging vocabulary - but it appears to be creating duplicate entries (ie if the entry already exists it doesn't find it and use it) - is that a bug as well?

csc4’s picture

I could really use some help please! At the moment it creates the taxonomy entry (with duplicates where they already exist) but as it doesn't create a node-taxonomy link I can't get the nodes listed under the taxonomy!!! Surely someone has had this problem before?

Zen’s picture

I have to dust off my 4.7 Drupal install mate. I'll try and test this out tomorrow.

-K

Zen’s picture

Upon reading your issue further, it seems I've misunderstood your basic problem:

- When a node is associated with a taxonomy via NAT, you expect the node to become a child of the associated term. This is not a feature of this module. However, there _is_ a feature request for it.
- By default, this module does not care about duplicates. It also does not check to see if a vocabulary is a free tag vocabulary or not. This could be construed as something of a bug, but fixing this would involve extra DB calls which is a little wasteful. The raison d'etre of this module is to allow for simple node to node associations and this, from my experience, usually does not involve free tag vocabularies. However, if your use case demands it, I recommend handling it via a validate hook.

Regards,
-K

csc4’s picture

Thanks for looking at this.

I think I must be confused - if the node isn't created as a child of the taxonomy term how do you use the taxonomy to get the node back???

I'm creating author profiles using CCK and NAT - so if I create John Smith I wanted it to appear in an author taxonomy and then when I take the John Smith taxonomy I want to see everything tagged with John Smith - including the profile... I think you're saying that's not possible?

I think you're also saying that if John Smith already exists in the author taxonomy there's no check so I'll end up with two John Smith entries - the existing one with all the existing nodes, and a new one created by NAT with no nodes??

Zen’s picture

Category: bug » support
Priority: Critical » Normal

Hello again,

I'm creating author profiles using CCK and NAT - so if I create John Smith I wanted it to appear in an author taxonomy and then when I take the John Smith taxonomy I want to see everything tagged with John Smith - including the profile... I think you're saying that's not possible?

When you click on the parent, you get a list of children. If you want the parent listed as a child of itself, you will have to do so yourself. The NAT module comes with functions to aid you in this. There is a feature request for this. However, I'm not terribly inclined toward this as I happily sort this out with a few lines of code when needed.

I think you're also saying that if John Smith already exists in the author taxonomy there's no check so I'll end up with two John Smith entries - the existing one with all the existing nodes, and a new one created by NAT with no nodes??

Duplicates are again a tricky issue. If you check the taxonomy module, you will find that you can have duplicate vocabularies, terms etc. There are valid reasons for this and the same reasons hold for the NAT module. There are also issues with the upgrade path and sync feature (in D5) for existing content and so on. However, an optional feature to handle this is on the TODO list. Patches welcome :)

csc4’s picture

Hello again. Thanks for trying to help

When you click on the parent

I'm confused by this terminology. I'm creating a node, and using NAT to create a taxonomy entry. When I then click on that taxonomy - I don't see the node. Surely that's not right?

As to duplicates - I'm aware you _can_ create duplicates but Drupal freetagging doesn't by default. I think it's because it's not using the Drupal taxonomy creation as I don't get duplicates if I create a page and an event and use the same taxonomy term - only when I use NAT - which strongly suggests it's a module issue???

If you create a free tagging taxonomy, assign it to page, event and a CCK type with NAT and create a page with the term Test - you have one term test
create an event with the term Test - you have one term test and if you click on the taxonomy link you see two nodes
create the CCK with the term Test - you have _two_ terms test, click on one and you see the two nodes (one page and one event), click on the other and you see _nothing_

As to patches - I wish! - I'm on a learning curve and will be happy to when I've figured out which way is up!

Zen’s picture

Status: Active » Fixed

As the project page states, the purpose of this module is to establish node to node relationships via the taxonomy module. You create a node X which creates a term X. When you create a node Y, you could assign it to the term X. Therefore, node X and node Y now have a parent-child relationship via term X.

A node being a child of itself is not what we are aiming for here. However, there is a feature request for it.

Duplicates: Handling duplicates - on a best effort basis - is on the todo-list. That said, free tagging is inherently incompatible with this module as it is not read-only. In other words, using free tagging you will be able to create a term that does not have a node associated with it which generally does not fit the use case of this module.

Thanks,
-K

csc4’s picture

But they don't - if you click on term X you see only node Y - you can't see or get at node X at all...

What you describe is exactly what I thought it did - and can't get it to do!!!

I don't see that the node being in the taxonomy heirarchy makes it a child of itself??

Zen’s picture

No, the NAT module only creates the node-term association and provides the requisite functions that enable you to do various crazy things with said association. When you click on a taxonomy term, you will get the nodes that have been classified under that term. In other words, you will see the normal taxonomy page. If you want to see a page with the associated NAT node displayed above the term's child nodes, then you will have to create it yourself etc. etc.

All this module does is create and manage the associations and provide functions allowing you to perform extra magickery with it.

I hope that clarifies things :)

-K

csc4’s picture

OK - I'm clear - if disappointed ;)

But I'd like to thank you a lot for spending so much time and trouble in talking to me about this.

smitty’s picture

Status: Fixed » Closed (duplicate)

Seems to be solved by: http://drupal.org/node/144864

csc4’s picture

Thanks for the post but that thread seems to end with you asking the same question as me - and it's not fixed otherwise you wouldn't be asking the question!!

I really really wish this module at least offered the option of also adding the taxonomy to the node, would make life a lot lot easier!

doublejosh’s picture

Trying to figure out if this is actually about this: #155411: Can the associated node be assigned the taxonomy term?
Sorry if not.