i fix it by change 2 function in "taxonomy_menu.database.inc"

function _taxonomy_menu_get_menu_items($vid) {

$result = db_query('SELECT mlid, tid FROM {taxonomy_menu} WHERE vid = %d', $vid);
$menu_items = array();
$found_count = 0;
while ($data = db_fetch_object($result)) {
//$menu_items[$data->tid] = $data->mlid;
$menu_items[$found_count]['mlid'] = $data->mlid;
$menu_items[$found_count]['tid'] = $data->tid;
$found_count++;
}
return $menu_items;
}

function _taxonomy_menu_delete_all($vid){
$menu_terms = _taxonomy_menu_get_menu_items($vid);
if (!empty($menu_terms)) {
foreach ($menu_terms as $clear_counter) {
db_query('DELETE FROM {menu_links} WHERE mlid = %d', $clear_counter['mlid']);
}
db_query('DELETE FROM {taxonomy_menu} WHERE vid = %d', $vid);
}
}

Comments

mskicker’s picture

StatusFileSize
new24.5 KB

i finally find main problem
my site have some taxonomy with several parents term
this modules have problem in this position
i add some changes to this modules for support multi parent term
this code is not great but WORK in my site

mskicker’s picture

Title: i have duplicate term after rebuilt » i have duplicate term after rebuilt ++++++++++++ Multi parent terms supported +++++++++++ fixed
Status: Needs review » Needs work
mskicker’s picture

StatusFileSize
new23.97 KB

i found new big bug
when we rebuild all links
all of terms convert to links with their relative but ,
if parents was not created before , relations not affected
to solve this problem
we must convert all terms at first
then add their relation to the links
i Do this
and add alphabetical sort and multi-parents support
my code is not great but WORK for me
i upload it again now

johnv’s picture

Can you create a patch of diff file, so others can see the changes you made? Thanks!

mskicker’s picture

StatusFileSize
new25.43 KB
mskicker’s picture

excuse me
i am not web or linux programmer and i dont now how i can do it
but i think that you can use compare tools in msword

to solve relations bug i add

if ($i==count($terms)){ // when links convert finishd
	$taxonomy_menu_db_menu_items=_taxonomy_menu_get_menu_items($vid); //get menus
	$taxonomy_menu_db_menu_items2=$taxonomy_menu_db_menu_items;//copy off menus
	$terms_items = taxonomy_get_tree($args['vid'], 0, -1);// get taxonomies for relations
				
	foreach($taxonomy_menu_db_menu_items as $key => $t_m_menu_item){
		$link = menu_link_load($t_m_menu_item['mlid']);    //load menu link
		$parents=_taxonomy_menu_get_parents($t_m_menu_item['tid']); //get their parents
		$this_t_m_parents=array();
		foreach($taxonomy_menu_db_menu_items2 as $key3 => $counting_this_t_m){ 
                     // get parents position in the _taxonomy_menu_get_menu_items
		     if ($counting_this_t_m['tid']==$t_m_menu_item['tid']) {$this_t_m_parents[]=$key3;}
		}
	$this_t_m_parents=array_flip($this_t_m_parents);
        // get ID from position in _taxonomy_menu_get_menu_items
	$link['plid']=_taxonomy_menu_get_mlid($parents[$this_t_m_parents[$key]],$vid);
	drupal_set_message('menu link created menu id : '.menu_link_save($link));
    }

}		

to _taxonomy_menu_insert_link_items_process(..) function

johnv’s picture

Can you post an image of your Vocabulary settings page?

johnv’s picture

Issue summary: View changes

typing mistake

dstol’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

The Drupal 6 version is no longer supported