Hello,

I have free tagging and a hierarchical vocab for a content type, and when I do content import the taxonomies do not get imported, even though it detected fine the columns in the csv file.

Any ideas?

Are you succeeding with importing terms for your node?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

GreyHawk’s picture

Note: same issue when doing product-type imports.

No problems doing catalog vocabulary imports, tho.

giorgio79’s picture

This issue may be related as well

http://drupal.org/node/437834

giorgio79’s picture

I tried to investigate this.

I notice that even on preview, the taxonomy free tagging terms and the hierarchical taxonomy is empty.

Here is a part of the output of one

 [taxonomy] => Array
        (
            [1] => 
            [tags] => Array
                (
                    [3] => 
                    [2] => 
                )

        )

    [op] => Preview
)

giorgio79’s picture

I just tried the sample csv, but that did not work as well for taxonomy...

Any tips are appreciated :)

ludo1960’s picture

How are defining the Taxonomy in your CSV file ? Print one line here

giorgio79’s picture

Thanks, it is very simple, I have a free tagging, and a hierarchical taxonomy and here they are for example:

TAG_CSV_COLUMN
these,are,my,tags

I am separating them wtih commas, which are offered as the default separators for tags in Node Import. ludo1960 can you tell me if you can import tags and/or terms during importing of nodes?

ludo1960’s picture

Try separating your tags with || double pipe like these||are||my||tags let me know how it goes

kilrizzy’s picture

I am trying to import my catalog terms for products and have had no luck importing. I keep getting the errors:

warning: mb_strlen() expects parameter 1 to be string, array given in /websites/tilegallerypa/html/includes/unicode.inc on line 404.

I have tried a few different methods - "cat1"||"cat2", 1||2, cat1||cat2

Any thoughts?

ludo1960’s picture

Try cat1||cat2|| no commas

giorgio79’s picture

Thanks Ludo, just tried like you say

these||are||my||tags

even with quotes like

"these||are||my||tags"

specifying double pipe || as the separator, but no luck.
Everything else works fine, from title, body to CCK text fields except taxonomy

Regarding kilrizzy's comment, it may be a different issue as I am not getting any error messages. Also I am having these issue via a taxonomy enabled content type import.

kilrizzy’s picture

Still no luck that way. It seems to be splitting the data though, I get two of the errors for every array entry.

To be clear, cat1 represents the machine readable term name correct?

ludo1960’s picture

Sorry that didn't work, JFYI I tried with a Vocab "City" and created terms "North" and "South" I was able to import terms into "South" and "North" seperately but not together, I got the same error as you when I tried.

giorgio79’s picture

Ludo are you referring to an import to ubercart product, or to a content type?

ludo1960’s picture

Content type

Robrecht Jacques’s picture

There are problems with hierarchical vocabularies. As all vocabularies are hierarchical by default on Drupal 6, this means all.

I'm working on it right now.

ludo1960’s picture

Great!

Robrecht Jacques’s picture

Status: Active » Fixed

Fixed in CVS. I'll release a -rc5 with this fix later today. Any of the formats above should work btw.

giorgio79’s picture

Status: Needs work » Fixed

Thanks Jacques, I look forward to this.

Please let me know if you need any help.

I was trying looking at the code and understanding it hoping to fix it myself but it is massive :P

Robrecht Jacques’s picture

@giorgio79 : you could test the -dev release of April 22th.

Things to do in the next couple of days (-rc5 ETA is April 25th):
- node reference fixes (working on now)
- date (including date_repeat) fixes
- book fixes
- get_csv fixes
- Fatal error: Only variables can be passed by reference in ...node_import.inc on line 594
- ...

ludo1960’s picture

Hi Robrecht,

Anything I can do to help?

Thanxs

giorgio79’s picture

Status: Fixed » Needs work

Thanks Jacques, I just tested it but I am still getting empty tags for my free tagging taxonomy import.

I also noticed I cannot set default values for CCK fields, like CCK text field :)

cleanthes’s picture

Status: Fixed » Needs work

Just wanted to say, I have tried the -dev version and Parents are now correctly imported. Thanks! Looking forward to -rc5

giorgio79’s picture

cleanthes have you tried importing a flat, free tagging terms that have no parents?

cleanthes’s picture

Giorgio: No, but if you want to provide me with a test file I'd be happy to try it for you

voidfiles’s picture

Version: 6.x-1.0-rc4 » 6.x-1.x-dev
FileSize
11.78 KB

Hi,

I have been following this bug, and I wanted to share my problems. I have tried to import vocabulary terms with hierarchy >> and I am reciving errors.

Like this

* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') td, term_hierarchy th, term_synonym ts WHERE td.vid = 1 AND th.parent = 10 AND' at line 1 query: SELECT td.tid FROM term_data) td, term_hierarchy th, term_synonym ts WHERE td.vid = 1 AND th.parent = 10 AND td.tid = th.tid AND td.tid = ts.tid AND LOWER(ts.name) = 'jets - american products & pentair' in /home/.furbag/viresh_hwp/ubercart.tastestalkr.com/modules/node_import/supported/taxonomy.inc on line 407.
* Input error: is not allowed for Catalog (not a term or synonym in Catalog).
* Input error: is not allowed for Catalog (not a term or synonym in Catalog).

and this is what I see in the dump

values = Array
(
[created] =>
[node_import_build_mode] => 1
[title] => American Products Luxury Jet Tool
[body] => Tools American Products - Luxury Jet and Diverter Jets
[type] => product
[format] => 2
[cck:field_image_cache:data] => Array
(
)

[cck:field_image_cache:fid] => Array
(
[0] => 2
)

[cck:field_image_cache:list] => Array
(
[0] => 1
)

[model] => AP45271100
[list_price] => 0
[cost] => 4.1600
[sell_price] => 8.3200
[shippable] =>
[weight] => 1
[weight_units] => lb
[length_units] => in
[length] =>
[width] =>
[height] =>
[pkg_qty] =>
[default_qty] => 1
[ordering] => 0
[uid] => 1
[revision] => 0
[log] => Imported with node_import.
[sticky] => 0
[status] => 1
[promote] => 1
[path] =>
[comment] => 2
[field_image_cache] => Array
(
[0] => Array
(
[fid] => 2
[list] => 1
[data] =>
)

)

[name] => admin
[taxonomy] => Array
(
[1] => Array
(
)

)

[op] => Preview
)

I am also attaching the csv I am trying to import

hanjek’s picture

Title: taxonomy terms are not imported » taxonomy terms are NOW imported
Component: Miscellaneous » Code
Status: Needs work » Fixed

For people who import UTF-8 based taxonomy with multiple terms, you need to alter the include->unicode.inc :

function drupal_strlen($text) {
  global $multibyte;
  if ($multibyte == UNICODE_MULTIBYTE) {
    if (is_array($text)) {
      return mb_strlen($text[0]);
    } else {
      return mb_strlen($text);
    }
  } else {
    // Do not count UTF-8 continuation bytes.
    return strlen(preg_replace("/[\x80-\xBF]/", '', $text));
  }
}
giorgio79’s picture

Status: Fixed » Needs review
GreyHawk’s picture

voidfiles -- just revisiting this, and saw your message. I know what part of your import problem is: the Category column is incorrect.

For example, for parent "Spa Parts Catalog >> Pumps >> Aqua-Flo", the keyword you want to apply to that line is aqua flo circ pump" -- you need to change the Parent category of "Category_DataPort_Id" to look like this: ">> Aqua-Flo"

You'd have to sort your list so that any terms which are not already in the appropriate vocabulary but are necessary for assigning as parents are uploaded first, I think, to help avoid problems.

So, you'd go from this:

"Category_DataPort_Id", "Customer_Price", "Keywords", "List_Price", "Large_Image", "Long_Description", "Part_Number", ...

"Spa Parts Catalog >> Pumps >> Aqua-Flo","0.8800","aqua flo circ pump","0","","Pipe Plug O-Ring (#011) #9","AF92200120",

To this:

">> Aqua-Flo","0.8800","aqua flo circ pump","0","","Pipe Plug O-Ring (#011) #9","AF92200120", ...

That would put keyword "aqua flo circ pump" as a child underneath parent term "Aqua-Flo" -- assuming I'm reading the data correctly.

giorgio79’s picture

@hanjek I notice your code requires core modification, which wont go through in Drupal, so we should look for sg we can change in node import.

I tried it anyway but no luck, my tags (several of them separated with a comma) did not import, not even showed on the preview.

fitzed’s picture

Awesome! hanjek's unicode.inc fix above worked perfectly. I'll simply revert to the original include file after my import is complete.

Thanks!

GreyHawk’s picture

@giorgio79 -- are you using the .dev release? Also, are you importing multiple taxonomies as separate values (i.e., separated by comma) or as multiple values in the same cell (separated by a | or whatever the symbol is)?

I found that the .dev release resolved a lot of issues I was having with taxonomies, particularly hierarchies, but I also had to get an example file that worked so that I could figure out the correct way to format my data.

See the response I gave above for an example of at least how I imported a hierarchy, and perhaps attach a small sample of your data...

giorgio79’s picture

Status: Needs review » Fixed

Hereby I would like to thank all you guys for the kind advice and help.

Finally I had some time to dedicate to getting to the bottom of it.

Basically it turned out that during preview my tags and CCK fields showed as empty and I assumed this is a problem and stopped.

Now I ignored this and went ahead with the import, and tags imported fine! Hurrah! :)

Thanks again,

Cheers,
G

giorgio79’s picture

One more thing I found is that I had to disable active tags for my vocabulary as it prevented tags from importing.

coloryan’s picture

For some reason, I need to turn off the hierarchical select module to import taxonomies. No uninstall it completely, just turn off the module.

Status: Fixed » Closed (fixed)

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

diego.paroni’s picture

I confirm #34, if you have installed the module Taxonomy Super Select, you have to disable the Taxonomy Super Select checkboxes in the vocabulary, otherwise the node import generate "warning: Invalid argument supplied for foreach() in ...\modules\taxonomy\taxonomy.module on line 70." and the taxonomy terms are no correct.
Thanx Coloryan!

maaak’s picture

Hi all,
Been trying this for a good few days ;) maybe longer could be weeks
Thankyou to all that have contributed, with the result, i have at last seen a glimmer of product import working !
Got as far as pasting in hanjek 's code for people who import UTF-8 based taxonomy with multiple terms yet i am still getting the catalog error when importing products.
Please look at the sample .csv and advise as to what i am doing incorrectly ............

* Input error: is not allowed for CATALOG (not a term or synonym in CATALOG).
* CATALOG field is required.

.m

maaak’s picture

.....and here is the rejected .csv.................

maaak’s picture

Oops.............
had two versions of uc_powertools loaded !
deleted the offending and Voila ! or as greywolf would say awooooooooooo!
.m

deedeedum’s picture

hanjek's code change in comment #26 fixed my issue. Thanks a bunch!

fonant’s picture

hanjek's hack in #26 worked for me too. So it seems that somewhere in nodeimport we are trying to run drupal_strlen() on an array...

benone’s picture

So I have last Drupal 6.19 and last dev version of node import and clean vocabulary. I have no terms there.
When I am trying to import nodes with hierarchical terms I get this:

* Input error: is not allowed for Categories (not a term or synonym in Categories).
* Input error: is not allowed for Categories (not a term or synonym in Categories).
* Input error: is not allowed for Categories (not a term or synonym in Categories).
* Input error: is not allowed for Categories (not a term or synonym in Categories).
* Input error: is not allowed for Categories (not a term or synonym in Categories).

Can I create vocabulary like that ? Just importing the nodes with proper hierarchy ?
I am stucked since 3 hours and cant do nothing about that.

What can be wrong ?

benone’s picture

Also changed 'hierarchical' to 1 using phpmyadmin and after that I can set the hierarchy string in step 5 of import.
I have ',' for multiple terms and '>' for hierarchy.
What else I can do to import them correctly ?
I use php 5.3.

TheBobbu’s picture

I've tried all the fixes in the rc4 version of node import to no avail, and now trying the dev version it still doesn't want to import my terms into Catalog as a hierarchy. Help?

I can send folks my CSV file if anyone wants to see if the problem is in there?

stinky’s picture

Subscribe

kazah’s picture

Status: Closed (fixed) » Needs review

I've solved it! The hierarchy in terms.

My own method. (Sorry for my bad English)))

1. First of all go to admin/content/taxonomy/edit/vocabulary and select only tags. Nothing more (because it is very important)
2. Edit your csv => taxonomy must be like this: House,Room (without any spaces or other symbols...only commas)
3. Then start import.
4. Are you happy?=))

After all you can change admin/content/taxonomy/edit/vocabulary and unselect tags for more convinience.

Thank you.
I really love drupal.

polmaresma’s picture

#26 and put hierarchy to 1 on vocabulary table worked for me

kazah’s picture

YEAh!! =))

Now it really works. Just follow these steps:
1. go to admin/content/taxonomy/edit/vocabulary and unselect all.
2. go to phpmyadmin and in vocabulary table put 1 in hierarchy.
3. while importing your csv in step 5 choose > in hierarchy (and in csv put > for hierarchy)

Works for me.
Thank you very much.

stinky’s picture

Step five doesn't give me any options! Any thoughts on how I can get options? I have a screen shot here...http://drupal.org/node/993782

delboud’s picture

Im very lost right now, i seem to had tried everything in this thread

I added the 1 to the hierarchy - didnt work

tried the unicode.inc edit from #26 - didnt work

tried #47 and #49 combinations and still didnt work

how come its working for everyone else??

Im putting my terms in like below

Volvo >> V70 >> Engine

and yes its set for >> for hierarchy

any ideas?

kazah’s picture

Write your warning message. What version of node_import do you use?

sittard’s picture

On my site hierarchy was set to 0 in the 'vocabulary' table, simply reordering the terms and saving magically solved this issue. A quick look in the database table and I can see that the hierarchy has now been updated to '1'.

doublejosh’s picture

Turns out it was just Taxonomy Super Select! Turned it off for these vocabs and the import went fine.

BTW: I also killed the hierarchies in the vocab during the import, so it might have been that too :)

matteoraggi’s picture

I have the same problem als owithout subterms, importing ubercart products, both with 1.1 and .dev version.

cristianff’s picture

Hi,
I have the same problem: the import process works correctly with all the fields, but not detect words that are part of a taxonomy content field... I'm desperate!!! :(

I have a qüestion with #47. When you say 1. First of all go to admin/content/taxonomy/edit/vocabulary and select only tags.
Sorry but i don't understand... What do you mean with only tags?

Regards

doublejosh’s picture

Believe they mean to make the vocab into "merely" tags so the module can handle the import.
Then you can change it back to a more specifically controlled taxonomy post import.
Assuming that was the meaning.

psampaz’s picture

Set hierarchy to 0 before importing free tags. http://drupal.org/node/723336

cristianff’s picture

I do it (hierarchy = 0), but I have the same 'bad' results.

jasonabc’s picture

Hi guys - I have a two row CSV (for testing) and am getting this error:

Record 2:

Input error: is not allowed for Catalog (not a term or synonym in Catalog).
Input error: is not allowed for Catalog (not a term or synonym in Catalog).

What's odd is Record 1 imports perfectly?! I have tracked it down to the Catalog Taxonomy column in my CSV:

Record 1: Holiday >> Holiday Party Invitations >> Christmas Party Invitations
Record 2: Party Invitations >> Birthday Invitations >> Kids Birthday Party Invitations

Record 1 imports fine and places the product in the Christmas Party Invitations category. Record 2 fails. If I change Record 2 to the values in Record 1, the entire CSV imports fine.

What is wrong with my taxonomy structure in Record 2? Party Invitations >> Birthday Invitations >> Kids Birthday Party Invitations are all valid categories and the hierarchy correct.

Here is the output:

values = Array
(
[created] =>
[node_import_build_mode] => 1
[title] => Monster Truck Wiggler Invitation
[cck:field_best_seller_order:value] =>
[cck:field_product_paper_weight:value] => Array
(
[0] => 100 lb. cardstock
)

[cck:field_product_size:value] => Array
(
[0] => 4 x 9.25
)

[cck:field_product_printing_method:value] => Array
(
[0] => Flat printing
)

[cck:field_cust_pro_time_max:value] => Array
(
[0] => 3
)

[cck:field_processing_time_max:value] => Array
(
[0] => 2
)

[cck:field_cust_pro_time_min:value] => Array
(
[0] => 2
)

[cck:field_product_proof:value] => Array
(
[0] => FREE Proof emailed within 1 business day
)

[cck:field_product_printer_compat:value] => Array
(
[0] => Laser & Ink Jet Compatible
)

[cck:field_preview_tool_image:list] => Array
(
[0] => 1
)

[cck:field_preview_tool_image:data] =>
[cck:field_preview_tool_image:fid] => Array
(
[0] => 9240
)

[cck:field_image_cache:data] => Array
(
)

[cck:field_image_cache:fid] => Array
(
[0] => 9241
)

[cck:field_image_cache:list] => Array
(
[0] => 1
)

[cck:field_processing_time_min:value] => Array
(
[0] => 1
)

[cck:field_product_envelope_color:value] => Array
(
[0] => White
)

[format] => 2
[cck:field_product_new:value] =>
[type] => product
[body] => This adorable invitation features your text printed on a background with monster truck tracks. The truck appears at the top and is attached to a spring so it wiggles when moved.
[model] => PSP-SCW990
[list_price] =>
[cost] =>
[sell_price] =>
[shippable] =>
[weight] =>
[weight_units] => lb
[length_units] => in
[length] =>
[width] =>
[height] =>
[pkg_qty] =>
[default_qty] => 1
[ordering] => 0
[uid] => 1
[revision] => 0
[log] =>

Imported with node_import.

[promote] => 0
[status] => 1
[sticky] => 0
[path] =>
[comment] => 2
[name] => mc_admin
[taxonomy] => Array
(
[1] => Array
(
)

[6] => Array
(
[0] => 374
)

[7] => Array
(
[0] => 347
)

[4] => 68
)

[field_best_seller_order] => Array
(
)

[field_product_paper_weight] => Array
(
[0] => Array
(
[value] => 100 lb. cardstock
)

)

[field_product_size] => Array
(
[0] => Array
(
[value] => 4 x 9.25
)

)

[field_product_printing_method] => Array
(
[0] => Array
(
[value] => Flat printing
)

)

[field_cust_pro_time_max] => Array
(
[0] => Array
(
[value] => 3
)

)

[field_processing_time_max] => Array
(
[0] => Array
(
[value] => 2
)

)

[field_cust_pro_time_min] => Array
(
[0] => Array
(
[value] => 2
)

)

[field_product_proof] => Array
(
[0] => Array
(
[value] => FREE Proof emailed within 1 business day
)

)

[field_product_printer_compat] => Array
(
[0] => Array
(
[value] => Laser & Ink Jet Compatible
)

)

[field_preview_tool_image] => Array
(
[0] => Array
(
[fid] => 9240
[list] => 1
[data] =>
)

)

[field_image_cache] => Array
(
[0] => Array
(
[fid] => 9241
[list] => 1
[data] =>
)

)

[field_processing_time_min] => Array
(
[0] => Array
(
[value] => 1
)

)

[field_product_envelope_color] => Array
(
[0] => Array
(
[value] => White
)

)

[field_product_new] => Array
(
)

[op] => Preview
)

jasonabc’s picture

UPDATE: not sure how or why this fixed it but I simply removed the first term from both records and now the CSV imports perfectly. So I changed this:

Record 1: Holiday >> Holiday Party Invitations >> Christmas Party Invitations
Record 2: Party Invitations >> Birthday Invitations >> Kids Birthday Party Invitations

to this:

Record 1: Holiday Party Invitations >> Christmas Party Invitations
Record 2: Birthday Invitations >> Kids Birthday Party Invitations

Marko B’s picture

I hade the same problem when using Hierarchy Select and saving Terms Lineage, when this is removed and multiple select is gone, import started working correctly.

tinflute’s picture

I'm having this same problem - can't import content taxonomy fields.
Getting these errors on page 7:

warning: Invalid argument supplied for foreach() in /var/www/sites/all/modules/node_import/supported/content_taxonomy/content_taxonomy.inc on line 93.
An illegal choice has been detected. Please contact the site administrator

Have tried all of the following:
-- applied patch from #26
-- switched field widget types (tries all of them)
-- tried vocabulary.hierarchy at 0 and 1 (it was initially = 0)
-- tried turning on terms checkbox
-- turned off all non-essential modules with 'taxonomy' in the description (did not have hierarchical select on)

My vocabulary is not hierarchical, and there is one term per record, there are no lists of terms.
I'm pasting my devel array below. field_project is the taxonomy field, 'Discovery' is a term in the vocabulary.

...
[name] => ibaradji
    [date] => 2011-12-18 13:26:00 -0400
    [taxonomy] => Array
        (
            [11] => 72
        )

    [field_project] => Array
        (
            [0] => Array
                (
                    [value] => Discovery
                )

        )

    [locations] => Array
        (
            [0] => Array
        ...

Thanks for the great module, and any tips.