Hi--
I have a pretty heavily modified node type and use numerous custom node fields. The value of these node fields is set by selecting a "field level" taxonomy term from a drop down. The node itself also has taxonomy terms that are set by "node level" vocabularies.
To make this more clear, I have a node taxonomy term "Year." I also have custom fields "Paint condition" and "Body condition" that are set by choosing good, bad, etc from the "Condition" vocabulary.
When I use VBO to modify node taxonomy terms, I select n number of nodes with the intent of changing the taxonomy term for Year...say from 2011 to 2012. When doing this, I select "Replace terms within same vocabulary" and set the value for Year to 2012. When I execute this operation, the value for Year is updated on the selected nodes...but the values for Paint Condition, Body Condition, etc... are wiped out.
What appears to be happening is the taxonomy terms for my custom fields are being updated even though I havent explicitly chosen to set a new term for these fields.
Is this a bug or user error?
Thanks again,
PP
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | node_products.txt | 64.2 KB | ppmax |
| Screen Shot 2012-01-07 at 4.28.25 PM.JPG | 86.94 KB | ppmax |
Comments
Comment #1
infojunkieWhich CCK/Taxonomy integration module are you using? It might be useful to export your content type and attach it here.
Comment #2
ppmax commentedThanks for the reply infojunkie. Im using CCK with the Content Taxonomy field.
Here's the export for this node type:
Comment #3
ppmax commentedArgh...probably too much text for a comment. Now attached as txt file.
If you open the txt file and search for 'field_engine_belts_condition' you'll see this is a taxonomy lookup field. The values for this field take a value from a vocabulary with words like good, better, best.
When using VBO to update the value of a single vocabulary, the value of other vocabularies is overwritten with empty/null values. As my screenshot shows, Im using the radio button option "Replace terms within same vocabulary." FWIW I've tried using other radio button options and they all seem to exhibit the same behavior and will overwrite "unselected" field values.
thx--let me know if you have any ideas or if I'm holding it wrong ;)
PP
Comment #4
ppmax commentedI've been investigating this a bit and have a rough idea of what is happening:
There are a class of vocabularies that are associated with the custom node type...there are another set of vocabularies that are referenced by CCK Content Taxonomy fields. When performing a VBO Modify node taxonomy terms, the CCK Content Taxonomy field taxonomy terms are overwritten. Interestingly, it appears the content taxonomy action works as expected.
Looking at the taxonomy.action.inc file, it looks like the case statement at line 56 may be unsetting terms incorrectly. I have to see what terms get returned by calling taxonomy_node_get_terms($node) on one of my nodes.
thx
PP
Comment #5
ppmax commentedHm... calling taxonomy_node_get_terms($node) on one of my nodes only returns the node level terms and vocab ID's...no joy there...
Comment #6
ppmax commentedOK--If I'm reading this right I think I found the culprit: in taxonomy.action.inc line 99 is a conditional for content_taxonomy fields. The test for $field['type'] == 'content_taxonomy' doesnt appear to be working for me so array $term_values is basically null, and the content_taxonomy fields are nulled out at line 111.
thoughts?
thx
PP
Comment #7
infojunkieThanks for debugging.
$term_valuesis populated by$term_values = $node->taxonomy[$field['vid']]- what's the value of the right-hand side? of$node?Comment #8
ppmax commentedI'll have to rebuild some of your functionality in my node view to see what's happening. Hope to get to this later today or tonight. I do know that the correct vid's are being found here (lines 98-100):
Out of curiosity: why even touch these content_taxonomy values if the action is only updating node taxonomy?
thx
PP
Comment #9
ppmax commentedHi again--
Im not seeing any values from $node->taxonomy[$field['vid']].
The action Im using is Modify node taxonomy terms--not Modify content taxonomy terms. I may not be grokking the point of this function, but the taxonomy that is associated with my content_taxonomy fields isnt related to the node. In the DB, my custom content_type_products products table references the node id, and then contains columns for the custom fields I've defined. For the content_taxonomy fields I see the vocab id.
Instead of:
$term_values = $node->taxonomy[$field['vid']];
shouldn't this be something like:
taxonomy_node_get_terms_by_vocabulary($node, $vid);
Any suggestions?
thx
PP
Comment #10
ppmax commentedI've dug in to this a bit more; without some discussion about this I'm hesitant to declare this a fix. As I mentioned above, I'm not sure why the taxonomy.action.inc file is even interested with content_taxonomy field values since this plugin seems to be intended for changing node taxonomy only.
Anyways, this code will return all the content_taxonomy terms associated with my custom node type:
In the meantime, I've commented out line 111 from taxonomy.action.inc which seems to preserve the content_taxonomy terms assigned to my nodes.
Hope this helps--
PP
Comment #11
ppmax commentedPS: Im marking this as critical because (at least in my case) led to loss of data.
PP
Comment #12
dabro commentedI'm running into this same wall, can you clarify what you hacked to get this to not unset your existing terms? Any progress?
Comment #12.0
dabro commentededit for clarification