Hi All,

Similar to https://drupal.org/node/1425694 but for D7 and none of the suggestions in that thread solved the issue for me.

I am using Drupal 7.22, Feeds 7.x-2.x-dev and Feeds Tamper 7.x-1.x-dev.

I have a site where I need to import CSV files through feeds that have three fields containing taxonomy terms. The terms are separated by a ; in the CSV file. I have also tried pipes and commas, and enclosing field values in quotation marks, all to no avail - only the first term is ever picked up.

In the associated content type, the taxonomy term fields are all set to unlimited values. If I manually create a node and assign it multiple taxonomy terms, it works as expected.

Something strange did happen once, in that two of the three fields would be populated by the right terms if I selected "Auto create" in the mappings, but it was actually creating duplicate terms - i.e. if I imported 10 items with the term "orange", I ended up with 10 taxonomy terms of "orange."

Any help/suggestions would be most appreciated!

Comments

doubleedesign’s picture

Sorry, wrong similar issue link. https://drupal.org/node/992420

chrowe’s picture

I seem to be having the same issue with "Auto create" enabled.
Each new import creates a new term with the same name. i.e.
"Counseling & Therapy" -> counseling-therapy
"Counseling & Therapy" -> counseling-therapy-0
"Counseling & Therapy" -> counseling-therapy-1

drupal-7.22
feeds-7.x-2.0-alpha8
feeds_tamper-7.x-1.0-beta4

chrowe’s picture

The fix that seems to have worked for us is to eliminate any blank spaces between the term and the term separator

i.e we had "term1; term2" and needed to make it "term1;term2"
We did this by using the Feeds Tamper trim option to trim both leading and tailing spaces after the explode tamper.

The reason for this is that feeds was looking for the term " term2" with a space but then Drupal was creating a new term without a space, so it never found the ones it had created before since the space was trimmed by Drupal.

doubleedesign’s picture

Thank you so much for posting this chrowe, it solved my issue!

filmninja’s picture

Huzzah! Thanks chrowe! That did the trick.

twistor’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

amacias’s picture

Hi chrowe,

How exactly you do that?

We did this by using the Feeds Tamper trim option to trim both leading and tailing spaces after the explode tamper.

I have feeds tamper to explode a list of taxonomy terms. After exploding them I don't have a string any longer, but an array, so if I add a trim filter after the explode one, I get the following error:

Warning: trim() expects parameter 1 to be string, array given in feeds_tamper_trim_callback() (line 38 of /mysite/sites/all/modules/feeds_tamper/plugins/trim.inc).

How can you trim the individual taxonomy terms after exploding them?

Thanks a lot
Andrés

junedkazi’s picture

Status: Closed (fixed) » Active
nmillin’s picture

Hi amacias,

I ran into this same issue and found a workaround. I was using Feeds Tamper 7.x-1.0-beta3+55-dev and I upgraded to 7.x-1.0-beta-5. The upgrade caused the same warning that you reported.

What I was doing:

  1. Explode - the terms into the array
  2. Trim - the extra whitespace

Workaround:

  1. Find replace - find "; " & replace ";"
  2. Explode - the terms

An example of the terms I'm importing is; "Term 1; Term 2; Term 3". What Drupal likes, is "Term 1;Term 2;Term 3" so duplicate terms aren't created (ex: counseling-therapy, counseling-therapy-0 doesn't happen). If you are exploding something other than a ";", you could tweak this tamper to have it work for you.

I'm not sure why trim doesn't work anymore **shrug**

b33tl3’s picture

I've got a similar issue.

I'm extracting taxonomy term from a xml attribute.
ex :

So I have 1 tamper plugin which is :
- Find replace REGEX
- REGEX to find : /term="(.+?)"/
- Replacement pattern : $1
And a mapping "Search taxonomy terms by Term name" with "auto create" on.

So I had duplicate entries "myTerm1" in my vocabulary. :(

The trim workaround saves me :) ... even if there is no reason I should use it.

thanks folks :D

Feeds : 7.x-2.0-alpha8
Feeds Tamper : 7.x-1.0-beta5
Feeds XPath Parser : 7.x-1.0-beta4

Mark_L6n’s picture

Issue summary: View changes

As an FYI, it appears that a taxonomy term that does not already exist in the Drupal installation will not be imported by Feeds Tamper. Took a lot of experimentation for me to figure out the cause of an import error, leaving a note to help others.

twistor’s picture

Whether a tag is created on import is a Feeds setting. It has nothing to do with Feeds Tamper.

Mark_L6n’s picture

Thank you for the pointer, twistor.
The Feeds setting is in the 'Node Processor' 'mapping' display; in the Tags field, click the cog button in the 'target configuration' column, and check the 'Auto create' box to enable nodes to be created.

twistor’s picture

Assigned: doubleedesign » Unassigned
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Ameer Khan’s picture

its working while removing space after comma. From ", " to "," in CSV file. after changing there were no duplicates.