Keep core taxonomy & CCK taxonomy synced

mikeytown2 - February 4, 2009 - 07:04
Project:Content Taxonomy
Version:6.x-1.x-dev
Component:User interface
Category:feature request
Priority:critical
Assigned:Unassigned
Status:active
Description

If "Save values additionally to the core taxonomy system" is checked, have the field check the Taxonomy system to see if it was changed, when the node is saved/edited.
or
Make a Bulk Operations to update/change taxonomy in bulk.

#1

mikeytown2 - March 20, 2009 - 23:34
Title:Support Bulk Operations» Keep core taxonomy & CCK taxonomy synced

Check the database term_node table, see what CCK fields need to be updated? Do a comparison, assuming that the term_* table is always correct, making the various changes to CCK's fields.

#2

Flying Drupalist - April 3, 2009 - 22:18

subscribe

#3

Flying Drupalist - April 6, 2009 - 16:15
Priority:normal» critical

Content Taxonomy needs to sync with taxonomy. The way that all current terms are lost is not good.

#4

thekevinday - April 14, 2009 - 21:08

I have been poking around at this problem myself.

It looks like there is something wrong with the content_taxonomy_field function.
The follow hack+patch causes everything to work, but I have doubts as to whether this is a correct fix:

--- content_taxonomy.module.orig        2009-04-14 15:55:50.000000000 -0500
+++ content_taxonomy.module     2009-04-14 16:03:55.000000000 -0500
@@ -153,7 +153,7 @@
function content_taxonomy_field($op, &$node, $field, &$items, $teaser, $page) {
   switch ($op) {
     case 'presave':
-      if ($field['save_term_node']) {
+      //if ($field['save_term_node']) {
         static $_content_taxonomy_array_cleared;
         if (!is_array($_content_taxonomy_array_cleared) || !$_content_taxonomy_array_cleared[$node->nid][$field['vid']]) {
           _content_taxonomy_taxonomy_unset($node->taxonomy, array($field['vid']));
@@ -183,7 +183,7 @@
         if (empty($node->taxonomy)) {
           $node->taxonomy[$field['vid']] = NULL;
         }
-      }
+      //}
       break;
   }
}

Notice that all I did was comment out the if ($field['save_term_node']) { if statement.

#5

Flying Drupalist - April 17, 2009 - 23:19

What's the expected behavior after making this change?

On my node/edit page the vocabulary loses all other terms except for the one added in CT. On the node view page however all terms are present, CT/and regular taxonomy term.

#6

thekevinday - April 20, 2009 - 14:27

Prior to this hack:
I have multiselect (http://drupal.org/project/multiselect) used as a cck content taxonomy field.
I do not use the original taxonomy fields themselves as they multiblock+content taxonomy+cck is being used to provide a more user-friendly way of assigning taxonomies from a select list.

The problem I noticed is that while the changes I made to this cck field did properly save for the cck field itself, the taxonomy vocabulary itself never registered that these taxonomies were being applied.
So at this point in time, the taxonomy cck field never synced up with the actual taxonomy.
That is to say, no matter what I selected with the cck taxonomy field, the term_node table would never populate with data.

I looked at the taxonomy database tables (if I remember correctly, I think it is the term_node table) and there was no node to taxonomy associations going on despite what the cck taxonomy field was claiming.

With this hack:
When I selected the appropriate taxonomies from the select list and saved, the term_node table now populated with data and the taxonomy core was now synced with what the cck taxonomy fields claim.

#7

Thomas Ash - April 23, 2009 - 08:32

Why was the the if ($field['save_term_node']) { statement there in the first place? I presume someone'd need to check whether removing it does any harm before merging it into module?

#8

Thomas Ash - April 23, 2009 - 08:46
Status:active» closed

Hang on, it seems the if statement just check whether 'Save values additionally to the core taxonomy system (into the 'term_node' table).' is checked at the 'Configure' page for your Content Taxonomy field - I located this by searching for $field['save_term_node'] in the module code. It works for me when I check that box - it'd be nice to be able to have it checked by default but that's another issue.

#9

mikeytown2 - April 23, 2009 - 08:52
Status:closed» active

@Thomas Ash
This is not a UI issue, like your describing. Change a nodes taxonomy via Views Bulk Operation. That change doesn't cross over to the CCK taxonomy field; thus it gets displayed wrong. Other modules change the taxonomy as well, so Content Taxonomy has to detect the change if it happened, and act accordingly.

#10

Thomas Ash - April 23, 2009 - 13:55

OK, good point, I'd forgotten your original issue description. Could you clarify the first half of that description?

#11

thekevinday - April 23, 2009 - 15:54

I apologize, it seems I was so busy thinking about the syncing issue that I misread this thread.

My problem was apparently that I overlooked "Save values additionally to the core taxonomy system" setting somewhere.
Sorry for almost hijacking this thread.

#12

Flying Drupalist - May 21, 2009 - 13:05

I'm not sure if I still want it synched, but I definitely need a way to upgrade from core tax to CT.

My nodes all have lots of terms on them, I can't imagine losing them all in an upgrade.

#13

anrikun - November 12, 2009 - 22:21

+1 Subscribe
Yes it have to be synched
or make a Bulk operation to update content taxonomy

 
 

Drupal is a registered trademark of Dries Buytaert.