Recently the Category module has been causing OpenConcept significant difficulty - see Ron's post here.
We are transitioning this site from using the Category module to using the core Taxonomy module to categorize our content. We're using Views to build pages of content, something that was done by the Category module previously.
The first step in this transition is making sure that node-category relationships are mirrored by node-term relationships. This is a pretty straightforward database manipulation. Here's a script for doing that operation.
WARNING: back up your database before performing this operation. You can do a lot of damage with a silly input error.
NOTE: the category id and the term id will often be the same - category is designed to work this way. The $category_id is the cid of the term you wish to import from - the $taxonomy_term is the tid of the term you wish to export to.
<?php
$imported = 0;
$category_id = 205; //the cid of the category that you wish to import from
$taxonomy_term = 205; //the tid of the term that you wish to export to
$result = db_query('SELECT `nid` FROM `category_node` WHERE `cid` = %d', $category_id);//get all nodes with this category
while ($row = db_fetch_array($result)) {
$nid = $row['nid'];
$result2 = db_query('SELECT * FROM `term_node` WHERE `nid` = %d AND `tid` = %d', $nid, $taxonomy_term);//get all node-term relationship with this nid and tid
if (!db_fetch_array($result2)){//if the relationship doesn't already exist
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $taxonomy_term);//creates the node/term relationship.
$imported++;
}
}
print $imported . ' node/term relationships have been imported for term ' . $category_id;
?>
$imported = 0;
$category_id = 205; //the cid of the category that you wish to import from
$taxonomy_term = 205; //the tid of the term that you wish to export to
$result = db_query('SELECT `nid` FROM `category_node` WHERE `cid` = %d', $category_id);//get all nodes with this category
while ($row = db_fetch_array($result)) {
$nid = $row['nid'];
$result2 = db_query('SELECT * FROM `term_node` WHERE `nid` = %d AND `tid` = %d', $nid, $taxonomy_term);//get all node-term relationship with this nid and tid
if (!db_fetch_array($result2)){//if the relationship doesn't already exist
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $taxonomy_term);//creates the node/term relationship.
$imported++;
}
}
print $imported . ' node/term relationships have been imported for term ' . $category_id;
?>

