Hi fellows,

I have a website with over 40k pages. Around 5k of them are taxonomy terms from a free tagging vocabulary with no hierarchy.
As it often happens, people like to follow their own way instead of the guidelines, the terms included redundant data e.g. state,states,voice, voices, A.D. , AD, B.C. , BC, etc
So i thought of using the merge function from the taxonomy manager to merge the terms into one single term, starting with terms containing decimals.

Anyways, it served the purpose and I can see the terms joined together. But to my dismay when I went to the categories option I can no longer see any terms in the vocabularies. Although in the database the terms exist. So, I am not sure whats going wrong? I tried to disable the taxonomy module and the taxonomy manager module but that did no good either.
Tried to see if the tables are broken or corrupt but mysql query came clean.
So, any hunch what might be the cause . Below is the code responsible , I believe.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

$start=30000; // the tid of the starting term 
$range=65000; // the tid of the ending term 


for ($i=$start;$i<$range;$i++)
{
$alpha=new stdclass();
$altered=array();
$notaltered=array();
$dmerged = new stdclass();
$alpha=taxonomy_get_term($i);
$mystring=$alpha->name;
$pos = strpos($mystring, ".");
$burma= str_replace (".","",$mystring);
$replica=taxonomy_get_term_by_name($burma);
if ($pos != false AND $replica) 
{echo "Actual string > $mystring  | &nbsp &nbsp &nbsp   TID > $i   |&nbsp &nbsp &nbsp AlteredSearch > $burma | &nbsp &nbsp &nbsp This is the count for actual string" . taxonomy_term_count_nodes($i) . "| &nbsp";
if ($replica)
{
foreach($replica as $tud=>$dar);
{$dmerged = $dar;
$altered[]=$dmerged->tid;
$notaltered[]=$i;
//$notaltered[]=$dmerged->tid;
echo "TID of altered string >" . $dmerged->tid . "| &nbsp &nbsp PRINTR ALTERED ";
print_r($altered);
echo "| &nbsp &nbsp PRINTR NONALTERED ";
print_r($notaltered);
echo "This is the count for new string" . taxonomy_term_count_nodes($dmerged->tid) . " &nbsp ";

taxonomy_manager_merge($altered,$notaltered);
echo "| <br/>";

} 
}
}
unset($dmerged);
unset($altered);
unset($notaltered);



}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Comments

alihammad’s picture

Forgot to add that if i visit
mysite.thetld/taxonomy/terms/THE TERMS HERE ;
it works. The only problem is that I can no longer see them in the categories>vocabularies>list terms

ivnish’s picture

Status: Active » Closed (outdated)