If you have a term importer with a source that can set multiple parents to a single term you may want to use multiple columns as "Parent: term name". But his will result in errors if you have rows that don't have all parent rows fill (some terms have only 1 parent, some have 2, some have 3) because feeds will try to insert the same key multiple times to the term_hierarchy table (term_id and parent ID as 0 multiple times).

On my case the solution is just to eliminate this lines from FeedsTermProcessor.inc

--- a/plugins/FeedsTermProcessor.inc
+++ b/plugins/FeedsTermProcessor.inc
@@ -134,12 +134,6 @@ class FeedsTermProcessor extends FeedsProcessor {
           if (!empty($parent_tid)) {
             $target_term->parent[] = $parent_tid;
           }
-          else {
-            $target_term->parent[] = 0;
-          }
-        }
-        else {
-          $target_term->parent[] = 0;
         }
         break;
       case 'parentguid':

Because if you are setting the parent for a term you almost always don't need to set any missing parents as 0.

CommentFileSizeAuthor
#2 feeds-missing_parents-1822484-2.patch590 bytesmsti
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

twistor’s picture

Issue summary: View changes
Status: Needs review » Needs work

A patch would be helpful.

msti’s picture

Version: 7.x-2.0-alpha7 » 7.x-2.x-dev
Status: Needs work » Needs review
FileSize
590 bytes

Patch added against branch 7.x-2.x

Status: Needs review » Needs work

The last submitted patch, 2: feeds-missing_parents-1822484-2.patch, failed testing.

msti’s picture

Status: Needs work » Needs review
twistor’s picture

Status: Needs review » Needs work

The last submitted patch, 2: feeds-missing_parents-1822484-2.patch, failed testing.