Importing into hierarchical vocab

giorgio79 - May 31, 2008 - 20:42
Project:Taxonomy CSV import/export
Version:5.x-1.4
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi.

When I am importing into a hierarchical vocabulary, the existing term are never taken into account.

Lets say I have

World;Europe;France

already as a hierarchical taxonomy.

When I try to import
France;Paris

it is always placed on the same level with World, therefore it does not put Paris under France as I would like it to be.

Any ideas?

#1

naquah - June 2, 2008 - 08:02

When importing the second file, it will look for the term 'France' on the first level. However, the existing term 'France' is on the third level. Therefore, it will create a new term 'France' on the first level.

You would either have to 'merge' the two files, or prepend (prefix) 'World;Europe;France;' to each line in your 'Cities of France' file.

If you think it should be possible to change this behavior, suggestions on how to implement this in the user interface are welcome.

#2

giorgio79 - June 3, 2008 - 15:27

Thanks Naquah, I will try to put together a patch, not sure if I am capable of it.

Here is what I envision:

When I first saw "Update existing term" option I somewhat thought that if the term exists, but the children don't, then the child terms will be added to the already existing term.

Since, this option does not do this, perhaps we can add a 3d option

"If your taxonomy is hierarchical and the term being imported already exists at some level but the children don't, add the children to the already existing term."

What I know is that we can certainly determine if the term exists already in the current vocab with a SELECT, and then

we can include the already existing term id as the parent id with the term array that is passed to

taxonomy_save_term(&$term)

Will try to come up with a patch although I am a complete newbie and will be a couple more months until I understand the ins and outs.

#3

naquah - June 18, 2008 - 08:58
Category:support request» feature request
 
 

Drupal is a registered trademark of Dries Buytaert.