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.
Comment | File | Size | Author |
---|---|---|---|
#2 | feeds-missing_parents-1822484-2.patch | 590 bytes | msti |
Comments
Comment #1
twistor CreditAttribution: twistor commentedA patch would be helpful.
Comment #2
mstiPatch added against branch 7.x-2.x
Comment #4
mstiComment #5
twistor CreditAttribution: twistor commented2: feeds-missing_parents-1822484-2.patch queued for re-testing.