hi
how should a csv file be structured to import hierarchical taxonomies with feeds? and how does one map the fields in the csv node importer?

My csv file looks as follows

GUID Item Category 1 Category 2
1 Item 1 Tools Hammer
2 Item 2 Tools Drill
3 Item 3 Building Materials Sand
4 Item 4 Bulding Materials Wood

How would I map the categories in the feeds node importer so that they end up in one vocabulary say "products" with category 1 as the parent and category 2 as the child terms?

Should my csv file look like this?

I have already imported the vocabulary terms with taxonomy_csv module so hierarchy is set up in the vocabulary already.

thanks
emk

CommentFileSizeAuthor
#44 taxonomy_hierarchy.inc_.txt5.31 KBjedihe

Comments

rickmanelius’s picture

It appears that some work was done for the Drupal 6 branch.
#1004668: Add support for mapping taxonomy term parents

I'm placing this ticket here as a reference, as well as subscribing because I'm also interested in this functionality.

rickmanelius’s picture

It appears this is a duplicate as an initial patch is posted here #1152940: Feeds term import with hierarchy and weight. I'm leaving this open because the instruction part could still be relevant to this ticket.

johnbarclay’s picture

Status: Active » Closed (duplicate)
timhsieh’s picture

Status: Closed (duplicate) » Closed (works as designed)

I believe that the issues in #1 and #2 are actually referring to a different issue -- that of importing terms into n-level taxonomies -- rather than what the OP was asking: importing nodes and tagging the nodes with terms from an existing n-level taxonomy.

I think this can be accomplished with already existing tools. First, install Feeds Tamper and configure a comma-delimited exploder plugin on the desired mapper field (Category in this case). Next, put your terms in the same column in your csv:

GUID,Item,Category
1,Item 1,"Tools,Hammer"
2,Item 2,"Tools,Drill"
etc

I was able to successfully import nodes and tag them with terms in a 2-level hierarchical select field using this.

vaccinemedia’s picture

That solution worked perfectly for me on one project where the products all belonged to one category / subcategory i.e. "dresses,oriental".

However, I'm about to run an import from another source where the products belong to multiple categories / subcategories like:
"Kids,Fleece" and "Kids Sports,Fleece" or
"T-shirts,Fashion" "T-shirts,Women" "Women's Fashion,T-shirts"

How would this be achievable?

OldAccount’s picture

Thanks for the Feeds Tamper module suggestion, using the Exploder plugin I was able to import my feed with multiple terms attached to one node. Being able to specify the string separator was also very helpful since some of my terms have commas so they're separated by semicolons instead.

pindaman’s picture

i tried to add feeds tamper for this:

GUID,Item,Category
1,Item 1,"Tools,Hammer"
2,Item 2,"Tools,Drill"
etc

in Category i am looking to create:
Tools
+ Hammer (child of tools)
+ Drill (child of tools)

Now it is just a list of terms like:
Tools
Hammer
Drill

dark_underground’s picture

subscribe

GuGuss’s picture

@dark_underground : no need to subscribe since there is the big "follow" green button that'll do the trick ! So Stop subscribing, start following...

pindaman’s picture

http://drupal.org/sandbox/manarth/1540722
will select multiple terms in a hierarchie with the explode option.

Tab10id’s picture

I have csv with structure GUID,Item,Category1,Category2,Category3 and I can import taxonomy structure and nodes with four importers
1) taxonomy structure 1:
import for first level of terms
2) taxonomy structure 2:
import for second level of terms with setting parent term (first level terms)
3) taxonomy structure 3:
import for second level of terms with setting parent term (second level terms)
4) nodes:
simple node importer and connect them to the last term (I use Feeds Tamper for getting last term in row)

---
Sorry for my English

rleroux’s picture

@ Tab10id Thanks for the info. Could you elaborate on your 4th importer: what Feeds tamper plugin do you use?

PeggyOCO’s picture

I am also interested in the 4th step. What filter do you use in Feeds tamper to get the previous last term?

Tab10id’s picture

I use "rewrite" ([v_categories_name_1];[v_categories_name_2];[v_categories_name_3]) and then two cuting with "Find replace REGEX" (/;[\s;]*$/ and /^.*;/) I have not found a better way.

siliconvalet’s picture

Version: 7.x-2.0-alpha3 » 7.x-2.0-alpha5

How to import a taxonomy hierarchy with feeds...

For my example, I'll import vehicles in this fashion - Make, Model, Year. Model being a child of Make, Year being a child of Model.

  • I didn't need multiple parents and don't have any info on that.
  • Feeds tamper wasn't needed for me.
  • You will need an importer for every level in your taxonomy hierarchy and you will import 1 level at a time.

You need to add an "ID" field to your taxonomy. Found here: "admin/structure/taxonomy/taxonomy_name/fields". This can be deleted after your imports are complete.
Your data should look similar to this:


make_id make model_id model year
MK1 Honda MD1 Civic 1994
MK1 Honda MD1 Civic 1995
MK1 Honda MD2 Accord 1994
MK2 Acura MD3 Integra 1994
MK2 Acura MD4 TSX 1994
MK2 Acura MD4 TSX 1994




Note: the last level in the hierarchy doesn't need an ID. Only parents of terms need an ID.


Importer settings - http://www.diigo.com/item/image/32b8r/e5vj


Step 1 - Import your first level - Importer #1

  • Set the "make_id" as the source and the "GUID" as the target.
  • Set the "make_id" as the source and the "ID" as the target. <-- This is the taxonomy field you added above
  • Set the "make" as the source and the "Term name" as the target.

Step 2 - Import your second level - Importer #2

  • Set the "make_id" as the source and the "Parent GUID" as the target.
  • Set the "model_id" as the source and the "GUID" as the target.
  • Set the "model_id" as the source and the "ID" as the target. <-- This is the taxonomy field you added above
  • Set the "model" as the source and the "Term name" as the target.
  • Second level importer settings

Step 3 - Import your third level - Importer #3 - Repeat step 2... and if you had any more than 3 levels, you'd just keep repeating step 2.

  • Set the "model_id" as the source and the "Parent GUID" as the target.
  • Set the "year" as the source and the "Term name" as the target.




If you're having a bit of trouble, remember the concept behind it is to have a unique ID (that you set in your import) and then reference that on your next level import.

Hope this helps.

gboggs’s picture

SiliconValet,

Great post. However, you've left out two steps.

1. Where you add the ID fields to your data. I assume you wrote a script to do this or used excel functions?

2. The last step once you have the terms, how did you import nodes and assign them to the correct taxonomy?

siliconvalet’s picture

  1. I added the ID field to the taxonomy entity -

    You need to add an "ID" field to your taxonomy. Found here: "admin/structure/taxonomy/taxonomy_name/fields". This can be deleted after your imports are complete.

    Regarding creating the ID's, yes, I did do this in excel prior to importing.

  2. I actually didn't import nodes with taxonomy references after these imports. This import creates taxonomy terms (hierarchically).
molnitza’s picture

Version: 7.x-2.0-alpha5 » 7.x-2.x-dev

I want to import a lot of nodes with the node processor. The nodes have three different categories like "Hardware/Notebooks/CID", "Germany/Hamburg/Headquater" and "Brand/Type". If I import the .cvs the terms are all on the 1st level of their vocabulary without parents. Is it possible to import the nodes directly with their categories without using the taxonomy processor?

siliconvalet’s picture

With Feeds? Short answer, No. Reason being, there is no way to reference the correct term (that I know of) through the GUI. I imagine if every term name from every level were unique, you can map it and it would just work. Duplicate term names would probably cause unexpected results.

I'm just getting my feet wet with migrate module. Have you tried it? Promising?

nitvirus’s picture

I am unable to import the sub-taxonomy terms after selecting terms of the taxonomy.
For example I have a taxonomy is subject-topic where maths(term) is the main term and algebra(sub term) and logic are to be choosen.
these sub terms are connected to the node by heirarchical select.
I have used the method as described in #4 but the sub-term is coming blank.

thanks,
Nitish

partyzan’s picture

Great example, thank you, but how then to import nodes using taxonomy IDs.

I mean you'll get the same Taxonomy items "Civic/1994" and "Integra/1994".
Then if youll import nodes and taxanomy reference will be "1994" , and node will be added to the first taxonomy list item "1994".

nitvirus’s picture

I was able to import the sub-terms by giving the sub term name algebra so maths was getting pre selected.

no_angel’s picture

crystaldawn’s picture

So I needed to import hierarchy and I have no idea how to do this with feeds UI and I was not satisfied with having 50+ imports (one for each possible hierarchy level, WTF really? hehe). So I created a custom module that utilizes Tamper module instead that does this WITHOUT the need to have a zillion imports. It's NOT pretty code in the least but I've done my best to comment it so that others could improve upon it and maybe make it a contrib module at some point. It utilizes the already existing drupal 7 taxonomy_term_hierarchy table for looking up the terms.

Here is what it does for the following hierarchical example:

Parent 1 > Child 1 (Parent 2) > Child 2 (Parent of nothing)

NOTE: The > character IS REQUIRED. So your actual CSV data should look like:

Shirts > t-shirts > big shirts

You can change the delimiter if you want, but make sure to update the explode() function with the new delimiter if you do so. You can have whitespace between the > character if you like to make the CSV a little more human readable as everything is trimmed in the below code anyway.

It will look at the 1st level (Parent 1) first and check to see if that term exists or not, if it does not, it autocreates it (this may or may not be what you want, but you can change it's behavior if you dont want that to happen, for my use case I needed every missing level to be autocreated). It also does NOT mark the item as being in every parent taxonomy (something that others may need, but I did not for this particular case). This type of functionality would require a new return value of type ARRAY rather than type TID (int) which is currently not supported by the feeds module.

Then it passes the new parent TID to the 2nd level and repeats the step from above. This process continues all the way through ALL the levels. Then once the last level is reached, it returns the very last child's TID back to feeds and then feeds tags your new content with that taxonomy term. So now you have a term on the content that is tagged with a true hierarchical structure. Pretty snazzy right :) All without having to create 500 imports. God what a nightmare that would have been. UGH.

Requirement modules for this to work:
feeds
feeds_tamper
feeds_tamper_php

Steps to get this functioning (I am putting this here for my own reference, I am sure I'll need this crap again someday and I'd like it here for reference):

1. Create a new field mapping using "Taxonomy" and set it to use "TID" and NOT "TermName"

2. Create a Tamper rule on the taxonomy field using PHP (you get this functionality from the feeds_tamper_php module)

//use this in the PHP textarea
//DONT FORGET THE RETURN PART hehe
return  feeds_import_hierarchical_taxonomy_term($field, $vocab_name = 'YourVocabMACHINENameGoesHere');

3. Now we create a custom module (I realize the naming convention may not be perfect, but none of the function names are currently in use anyway) and put the following code in it:

//This function is used in the feeds import for taxonomy term fields using the tamper module.  It uses the feeds_tamper_php type to call the function.
//It returns the tid of the taxonomy if it exists, and the new tid of the taxonomy was imported/created (this is the tid of the LAST child, not the entire hierarchy)
function feeds_import_hierarchical_taxonomy_term($term_path, $vocab_name)
{
   //If the term was empty, just return nothing.
   if (empty($term_path))
   {
      return '';
   }
   
   //Explode the incoming path from the CSV file (This is where you can change the delimiter if you want)
   $term_hierarchy = explode('>', $term_path);
   
   //Trim up the data to remove excess whitespace  the preg_replace is for UTF8 whitespace is there a better way to handle that?
   foreach ($term_hierarchy AS $key => $value)
   {

      $term_hierarchy[$key] = trim($value);
      $term_hierarchy[$key] = preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u','',$value);
   }

   //If the term is only 1 level, use the helper function and return the tid
   if (count($term_hierarchy) < 2)
   {
      $tid = feeds_import_taxonomy_term(trim($term_hierarchy[0]), $vocab_name);         
      return $tid;
   }
   
   //Get the vocab
   $vocab = taxonomy_vocabulary_machine_name_load($vocab_name);
   
   //First, make sure the 1st level even exists.  If not, create it.
   $parent_tid = feeds_import_taxonomy_term($term_hierarchy[0], $vocab_name);
   
   //Loop through each level to see if that level exists and if not, create the new level
   $level = 0;
   foreach ($term_hierarchy AS $key => $term_name)
   {

      //Only process levels above the first level
      if ($level > 0)
      {
         //Look for a term that has this term_name, this vid, and this parent_tid
         $query = "SELECT ttd.*, th.parent FROM {taxonomy_term_data} AS ttd, {taxonomy_term_hierarchy} AS th WHERE ttd.name = '$term_name' AND ttd.tid = th.tid AND th.parent = '$parent_tid'";
         $result = db_query($query);
         $record = $result->fetchObject();

         //If this level does not exists, then we create it
         if (!$record->parent)
         {
            //This level does not yet exist so we have to create it and set it's parent.
            //This creates a $term var that we can use
            $term->name = $term_name;
            $term->vid = $vocab->vid;
            $term->parent = $parent_tid;
            
            taxonomy_term_save($term);
            
            //$record->tid = $term->tid;   // <---- Why does this not work?  It causes an infinite loop.

            //For some reason PHP cannot USE $term->tid from the taxonomy_term_save() function (even though its populated).  It sits there and times out.  So we just get it manually instead.  If anyone can explain why I was not able to use $term->tid  I would greatly appreciate it.  Go ahead and try it, you'll see it does NOT work.  It should cause your apache to enter into an infinite loop for some reason,  it did for me.  So I simply re-fetch the term from DB and get the tid that way.  The taxonomy_term_save() function is "suppose" to set $term with the returned TID (which it does do),  but then when I go to actually use that term with $tid = $term->tid,  the code results in an infinite loop and I have no idea why.
            $query = new EntityFieldQuery;
            $result = $query
            ->entityCondition('entity_type', 'taxonomy_term')
            ->propertyCondition('name', $term_name)
            ->propertyCondition('vid', $vocab->vid)
            ->execute();
            
            $tid = array_shift($result['taxonomy_term'])->tid;
            $record->tid = $tid;
         }
         
         //Set this tid as the parent for the next child
         $parent_tid = $record->tid;

         //We also set $tid in case it is the last result which we will use as the return value
         $tid = $record->tid;
         
         //Just to be sure, we unset everything
         unset($term);
         unset($query);
         unset($result);
         unset($record);
      }
      
      $level++;
   }

   return $tid;
}

//This function is used in the feeds import for taxonomy term fields using the tamper module.  It uses the feeds_tamper_php type to call the function.
//It returns the tid of the taxonomy if it exists, and the new tid of the taxonomy was imported/created
function feeds_import_taxonomy_term($term_name, $vocab_name)
{
   //Make sure the name is trimmed
   $term_name = trim($term_name);
   
   //Trim does not trim unicode whitespace so we do that here
   $term_name = preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u','',$term_name);
   
   //If the term was empty, just return nothing.
   if (empty($term_name))
   {
      return '';
   }
   
   //Get the vocab
   $vocab = taxonomy_vocabulary_machine_name_load($vocab_name);

   //Get the term if it exists
   $query = "SELECT * FROM {taxonomy_term_data} WHERE vid = '{$vocab->vid}' AND name = '{$term_name}'";
   $results = db_query($query);
   $term = $results->fetchObject();
   
   $tid = $term->tid;

   //The term existed so we return it
   if (!empty($tid))
   {
      return $tid;
   }
   //The term did not exist, so we create it.
   else
   {
      //This creates a $term var that we can use
      $term->name = $term_name;
      $term->vid = $vocab->vid;
      taxonomy_term_save($term);
      return $term->tid;
   }
}
rikki_iki’s picture

@crystaldawn thanks so much for your code! I had this exact issue with an XML feed that I couldn't alter at all, which listed it's categories as Parent > Child. You're code was perfect.

For anyone else, it doesn't require commerce_feeds at all...
And where it says $vocab_name = 'YourVocabNameGoesHere' it's the machine name it's after.

Costa-USSR’s picture

Perfect! Thanx!

crystaldawn’s picture

Hmm yea, the requirements were a copy/paste from my own notes. Commerce_feeds is not needed. I updated #24 to reflect that as well as making the vocab name more obvious that it needs the machine name.

BATDesign-dupe’s picture

This looks to be exactly what i need, but with all the stuff in my head at the moment, I am at a loss on how to exactly implement it. Can i please have some help :)

rikki_iki’s picture

Hey @BATDesign, what specifically is confusing you?

BATDesign-dupe’s picture

Hey @rikki_iki, the steps to get this to work - Do i have to create an actual module to get this to work from the php here or do i add it somewhere else, i think i missed something. Also is this to work as a separate feed importer just for taxonomy or can i use it in the node feeds importer...

BATDesign-dupe’s picture

OOOOOh, the fog may have lifted... I think i worked it out - Yes Module needs to be made and yes it works in node. I have also got it taking the categories from different fields with the rewrite function in tamper. Then I have them exploded again by this script - Working fantasticly - thankyou

BATDesign-dupe’s picture

Do you think it could be extended to add a url alias for each of the taxonomy values it puts in?

rikki_iki’s picture

If you've got pathauto installed you can setup an alias pattern, which will automatically be applied to imported taxonomy terms.

zach harkey’s picture

I followed the instructions and adapted the code in comment #24 and was finally able to successfully import thousands of products into hierarchical categories.

Thank you, @crystaldawn!

drew29’s picture

thanks a lot that works for me.

One question I have the find replace tamper plugin does work with this code is this right?

I need to replace one category name with another.

can you explain me how can i solve it?

kinde regards
drew

masterperoo’s picture

$query = "SELECT ttd.*, th.parent FROM {taxonomy_term_data} AS ttd, {taxonomy_term_hierarchy} AS th WHERE ttd.name = '$term_name' AND ttd.tid = th.tid AND th.parent = '$parent_tid'";

this query fails for term names with single quote - basically quote breaks sql statement.

replacing line with the below fixes it.

$query = "SELECT ttd.*, th.parent FROM {taxonomy_term_data} AS ttd, {taxonomy_term_hierarchy} AS th WHERE ttd.name = '".mysql_real_escape_string($term_name)."' AND ttd.tid = th.tid AND th.parent = '$parent_tid'";
mr4711’s picture

Issue summary: View changes

Solution #24 does not work for me. Sometimes the title is missing (but the tax name and hierarchy is ok, guess when there are entries not on the deepest level) and it is not possible to have same category names in different hierarchies. And - don't know why - #36 leads to duplicate entries. Better change the "'" into "& #8217;" and choose "HTML entity decode" as first plugin. WTF

Better use: https://www.drupal.org/node/2212587

tadesign’s picture

Thanks so much for pointing me in the direction of https://www.drupal.org/node/2212587 mr4711, it worked perfectly for me and much less messing about.

Thanks
Richard

aus007’s picture

@crystaldawn
Hi , Can someone please guide as which files to edit inorder to crystaldawn fix working .
I am new to drupal development .

Thanks

aus007’s picture

Found the Module .Thanks anyways @mr4711

lexbritvin’s picture

The module works fine!
Please, contrib.

aaronelborg’s picture

RE: #24.
I swear I've dealt with this before so perhaps someone could help me remember...

Why do I not have "TID" as an option in the "select a target" dropdown? I have "Term name", however.

Thanks.

alireza.13’s picture

thank you for code.
If taxonomy term like bellow that code select wrong parent term with "asd>bb>asd".
asd2
-asd
--bb
---asd
asd
-bb
--asd
I modify the code to fix it.

<?php
//This function is used in the feeds import for taxonomy term fields using the tamper module.  It uses the feeds_tamper_php type to call the function.
//It returns the tid of the taxonomy if it exists, and the new tid of the taxonomy was imported/created (this is the tid of the LAST child, not the entire hierarchy)
function feeds_import_hierarchical_taxonomy_term($term_path, $vocab_name)
{
   //If the term was empty, just return nothing.
   if (empty($term_path))
   {
      return '';
   }
   
   //Explode the incoming path from the CSV file (This is where you can change the delimiter if you want)
   $term_hierarchy = explode('>', $term_path);
   
   //Trim up the data to remove excess whitespace  the preg_replace is for UTF8 whitespace is there a better way to handle that?
   foreach ($term_hierarchy AS $key => $value)
   {

      $term_hierarchy[$key] = trim($value);
      $term_hierarchy[$key] = preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u','',$value);
   }

   //If the term is only 1 level, use the helper function and return the tid
   if (count($term_hierarchy) < 2)
   {
      $tid = feeds_import_taxonomy_term(trim($term_hierarchy[0]), $vocab_name);         
      return $tid;
   }
   
   //Get the vocab
   $vocab = taxonomy_vocabulary_machine_name_load($vocab_name);
   
   //First, make sure the 1st level even exists.  If not, create it.
   $parent_tid = feeds_import_taxonomy_term($term_hierarchy[0], $vocab_name);
   
   //Loop through each level to see if that level exists and if not, create the new level
   $level = 0;
   foreach ($term_hierarchy AS $key => $term_name)
   {

      //Only process levels above the first level
      if ($level > 0)
      {
         //Look for a term that has this term_name, this vid, and this parent_tid
         $query = "SELECT ttd.*, th.parent FROM {taxonomy_term_data} AS ttd, {taxonomy_term_hierarchy} AS th WHERE ttd.name = '$term_name' AND ttd.tid = th.tid AND th.parent = '$parent_tid'";
         $result = db_query($query);
         $record = $result->fetchObject();

         //If this level does not exists, then we create it
         if (!$record->parent)
         {
            //This level does not yet exist so we have to create it and set it's parent.
            //This creates a $term var that we can use
            $term->name = $term_name;
            $term->vid = $vocab->vid;
            $term->parent = $parent_tid;
            
            taxonomy_term_save($term);
            
            //$record->tid = $term->tid;   // <---- Why does this not work?  It causes an infinite loop.

            //For some reason PHP cannot USE $term->tid from the taxonomy_term_save() function (even though its populated).  It sits there and times out.  So we just get it manually instead.  If anyone can explain why I was not able to use $term->tid  I would greatly appreciate it.  Go ahead and try it, you'll see it does NOT work.  It should cause your apache to enter into an infinite loop for some reason,  it did for me.  So I simply re-fetch the term from DB and get the tid that way.  The taxonomy_term_save() function is "suppose" to set $term with the returned TID (which it does do),  but then when I go to actually use that term with $tid = $term->tid,  the code results in an infinite loop and I have no idea why.
            $query = new EntityFieldQuery;
            $result = $query
            ->entityCondition('entity_type', 'taxonomy_term')
            ->propertyCondition('name', $term_name)
            ->propertyCondition('vid', $vocab->vid)
            ->execute();
            
            $tid = array_shift($result['taxonomy_term'])->tid;
            $record->tid = $tid;
         }
         
         //Set this tid as the parent for the next child
         $parent_tid = $record->tid;

         //We also set $tid in case it is the last result which we will use as the return value
         $tid = $record->tid;
         
         //Just to be sure, we unset everything
         unset($term);
         unset($query);
         unset($result);
         unset($record);
      }
      
      $level++;
   }

   return $tid;
}

//This function is used in the feeds import for taxonomy term fields using the tamper module.  It uses the feeds_tamper_php type to call the function.
//It returns the tid of the taxonomy if it exists, and the new tid of the taxonomy was imported/created
function feeds_import_taxonomy_term($term_name, $vocab_name)
{
   //Make sure the name is trimmed
   $term_name = trim($term_name);
   
   //Trim does not trim unicode whitespace so we do that here
   $term_name = preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u','',$term_name);
   
   //If the term was empty, just return nothing.
   if (empty($term_name))
   {
      return '';
   }
   
   //Get the vocab
   $vocab = taxonomy_vocabulary_machine_name_load($vocab_name);

   //Get the term if it exists
   $query = "SELECT * FROM {taxonomy_term_data} WHERE vid = '{$vocab->vid}' AND name = '{$term_name}'";
   $results = db_query($query);
   $number_of_rows = $results->rowCount();
   dpm($number_of_rows);
   if ($number_of_rows>1) {
      $terms=$results->fetchAll();
      foreach ($terms as $key => $value) {
         $tempquery = "SELECT * FROM {taxonomy_term_hierarchy} WHERE parent = '0' AND tid = '{$terms[$key]->tid}'";
         $temp_result = db_query($tempquery)->fetchObject();
         if ($temp_result!=null) {
            $tid=$terms[$key]->tid;
            break;
         }
         
      }
     
   }
   else {
     $term = $results->fetchObject();
     $tid = $term->tid;
   }

   //The term existed so we return it
   if (!empty($tid))
   {
      return $tid;
   }
   //The term did not exist, so we create it.
   else
   {
      //This creates a $term var that we can use
      $term->name = $term_name;
      $term->vid = $vocab->vid;
      taxonomy_term_save($term);
      return $term->tid;
   }
}
?>
jedihe’s picture

StatusFileSize
new5.31 KB

I'm attaching the code from #24 (with minor code formatting improvements) put into a plugin for Feeds Tamper. Using it should be as easy as dropping inside sites/all/modules/feeds_tamper/plugins (remove .txt extension, only .inc at the end), clearing caches and then looking for "Taxonomy hierarchy" plugin in the Feeds Tamper UI.

Didn't yet look into the improvements mentioned in #43, so this file includes none of those.

ikeigenwijs’s picture