I'm working on this. I think I've done the inc file OK, but I'm waiting on another internal group for some test data. That could be soon, or it could be a couple of weeks. Once I've tested, I'll post the inc file here.

Comments

Robrecht Jacques’s picture

Great. If you need any help with it, ask here.

GreyHawk’s picture

My catalog taxonomy isn't importing; definitely interested in what you come up with.

Robrecht Jacques’s picture

Maybe you could post the .inc even if it is untested?

criz’s picture

I am very interested in this feature too and would love to do some testing...

epicsauce’s picture

I would also love to get my hands on this / help with testing. Patiently awaiting the inc file -- any updates?

afox’s picture

Subscribing.

I have used the latest -dev -release, with checkboxes as taxonomy, with the following import results:
- If the field is set as required, the import will give "Illegal choice in field_name element."
- set to not required, the import works but only the first value is imported (tried with only 2 items).

rconstantine’s picture

Version: 6.x-1.x-dev » 6.x-1.0-rc4
StatusFileSize
new718 bytes

@ #6, I have no idea what you're talking about.

All - I've got test data and I think I'm close. It's really a small module. I wonder whether it is complete for all cases. Anyway, I have a bug. I'll attach what I have so far and below is the 'preview' on step 7 of 8 with the error I get. The output looks fine to me, so I wonder what is wrong.

Put the attached file in 'supported/cck'

Record 1:

---------here is the error--------------->Building and Department field is required.

values = Array
(
[created] =>
[node_import_build_mode] => 1
[title] => ant
[cck:field_accounting_unit:value] => Array
(
[0] => 45669000
)

[cck:field_ip_address:value] => Array
(
[0] => 10.30.8.101
)

[cck:field_duplex:value] => Array
(
[0] => Duplex
)

[cck:field_asset_status:value] =>
[cck:field_serial:value] => Array
(
[0] => USQA045540
)

[cck:field_device:value] => Array
(
[0] => HP LaserJet 4050N
)

[cck:field_lawson_req_loc:value] => Array
(
[0] => 53ALR
)

[cck:field_queue_name:value] => Array
(
[0] => ALRAD01Q
)

[cck:field_build_dept:value] => Array
(
[0] => An address here that I'm changing for posting purposes <------------------------------these are the taxonomy terms
[1] => A department here that I'm changing for posting purposes <--------------------------they start as strings, so must be converted
)

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

[cck:field_status:value] => Array
(
[0] => Deployed
)

[cck:field_company_num:value] => Array
(
[0] => 180
)

[type] => printer
[cck:field_num_trays:value] => Array
(
[0] => 3
)

[log] => Imported with node_import.
[uid] => 1
[revision] => 0
[promote] => 0
[status] => 1
[sticky] => 0
[path] =>
[name] => admin
[taxonomy] => Array
(
)

[field_accounting_unit] => Array
(
[0] => Array
(
[value] => 45669000
)

)

[field_ip_address] => Array
(
[0] => Array
(
[value] => 10.30.8.101
)

)

[field_duplex] => Array
(
[value] => Array
(
[Duplex] => Duplex
)

)

[field_asset_status] => Array
(
[value] => Array
(
)

)

[field_serial] => Array
(
[0] => Array
(
[value] => USQA045540
)

)

[field_device] => Array
(
[0] => Array
(
[value] => 45
)

)

[field_lawson_req_loc] => Array
(
[0] => Array
(
[value] => 224
)

)

[field_queue_name] => Array
(
[0] => Array
(
[value] => 623
)

)

[field_build_dept] => Array
(
[0] => Array
(
[value] => 2218 <----------------------------here are the terms converted to TIDs
)

[1] => Array
(
[value] => 2221 <----------------------------they look like they aren't empty, so why the error message?????
)

)

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

)

[field_status] => Array
(
[value] => Array
(
[Deployed] => Deployed
)

)

[field_company_num] => Array
(
[value] => Array
(
[180] => 180
)

)

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

)

[op] => Preview
)

rconstantine’s picture

Version: 6.x-1.0-rc4 » 6.x-1.x-dev
rconstantine’s picture

Version: 6.x-1.0-rc4 » 6.x-1.x-dev

OK. I figured out what to do. I just finished the case for using the content_taxonomy_tree widget. I'm not sure whether I'll have time to do the others, so I'll post what I do here regardless. One last thing I want to do is convert a portion of the function into a recursive function so as to handle any depth of tree. Presently, since my test data only has two levels, that's all I coded for. Expect a post here in another couple of days with the inc file as I have it.

barkam’s picture

I already have 9000 nodes in csv file. Every node has assigned taxonomy term. Is it possible with this feature to import nodes with already assigned taxonomy terms ?

rconstantine’s picture

StatusFileSize
new1.38 KB

I'm fairly certain that the regular operation of node_import doesn't allow adding data to existing nodes if that's what you're asking.

Anyway, here is the new file...

Like I said, work may need to be done for other widgets. See my comments in the file itself.

rconstantine’s picture

Status: Active » Needs review
VeeLin’s picture

So can I just add the content_taxonomy.inc to the module? Or what do I do with it if I want to test it? Node Import works great but like others being able to import content_taxonomy fields is critical to me.

Thanks,

V

VeeLin’s picture

So to answer my own question in case any other newbies are wondering: Put the .inc file in sites\all\modules\node_import\supported
Then I ran the update.php - just to make sure and it worked great!

Thanks for writing this code! It saved us about 2 months worth of data entry.

rconstantine’s picture

Sorry, I thought I mentioned where to place it. I actually put mine in sites\all\modules\node_import\supported\cck, but it doesn't really matter I don't think. I'm not sure which is better in this case. I figure the maintainer can decide.

@VeeLin - can you tell us which content_taxonomy widget your content type is using? I have just two cases defined - first is the special case where you are using the tree widget - second is for all other widgets. I was assuming that the second might not work for all widgets and that we'd need to add support for them later. So if anyone else tests this, please let us know what widget you're using. For all I know, the second case does work for all of the other widgets.

VeeLin’s picture

I'm not 100% sure what you mean by widget. I am using a Content Taxonomy Field in the custom content type. The vocabulary does NOT have hierarchy. It is a one level vocabulary. I'm also importing another vocabulary which adds coma separated vocabulary terms to the node. This is also through a content taxonomy field but this taxonomy adds new terms to the vocabulary while the other does not allow addition of terms.

I hope this answers your question - if not I'll try to elaborate.

Kind Regards,

V

rconstantine’s picture

By widget, I mean the second drop down you use when adding a new field. The first column is the Human-readable name, the second is the machine-name, the third is the cck field type, the fourth is the widget. Options for a content taxonomy field are: Autocomplete (Freetagging), Checkboxes/Radios, Select List, and if you have it enabled somewhere, Tree. I don't recall whether that last one is standard or an add-on module.

Anyway, that should answer your question.

afox’s picture

Can't get this addon working with content_taxonomy_options (Content Taxonomy Checkboxes)

The data displays fine when I put some print array -codebits inside the previously posted code. I can't find yet why it doesn't save the correct data.My taxonomy field is set as required, so it selects only the first one, even though I have 2-3 in every row. And by the first one I mean, the first listed taxonomy term available, not first of the imported ones.

rconstantine’s picture

Like I said, support for the other widgets might need to be added. Sounds like it does. Anyone want to pitch in and help? You would just add a new 'else if' to the content_taxonomy_node_import_values_alter function.

It would start with:
if ($fieldinfo['widget']['type'] == 'content_taxonomy_options') {

VeeLin’s picture

OK - so to answer the question a few back I am using a few widgets sucessfully:

Autocomplete (Freetagging): works in most cases. There were a few terms it had an isssue with but adding them to the vocabulary before import fixed this - wired bug but can be overcome. one of the terms was "autoloaded".

checkboxes/Radial buttons: From this you can only select one term. No issues but your formatting must be bang on - ensure there are no leading or ending spaces.

Did not use select list widget.

My import is complete. Thank you for all your help.

Also it was almost 5000 nodes and ran for about 3.5 hours with no issues.

Cheers,

V

rconstantine’s picture

Thanks for the info VeeLin! Now if we can get some help filling in the blanks, we'll have a complete patch.

I noticed the ending spaces problem too.

Looks like I'll have to test the select list widget this week, so I'll add code if needed.

friolator’s picture

hmm. we've installed this (and have run update.php) and I'm a little confused. our test content type has three content_taxonomy fields:

State
Region
Resort

All three of those use Autocomplete (Free Tagging) widgets. State and Region are set so that the user can't add new tags, Resort is set so new tags can be added.

On Step 4 - the node_import Map File Columns page - we see the Resort selection as a pulldown menu showing the column headers for the imported CSV file. We don't see anything for mapping State, and for Region (which as of right now doesn't have a corresponding column in the CSV file, we see a multi-select field showing the imported files column headers, rather than a pulldown. I'm not sure why the inconsistency in the types of selection widgets here, but that's what we're getting.

In any case, since "Resort" seems to work normally, we map it to the "Resort" column in the imported file, and we go ahead with the import. The resulting nodes don't have the Resort Content Taxonomy field filled in, and we have to do them manually. By the way, the resort names already exist in the Resort vocabulary, so we're not trying to add them. Any ideas?

friolator’s picture

quick update on my previous post: this module wasn't working because for some reason my ftp client didn't give it the right permissions. so it wasn't being loaded. In any case, I fixed that and the State content_taxonomy field works. However, the Resort Name content_taxonomy field doesn't work. It's really weird - as far as I can tell there's no difference between the two fields. (I've set Resorts so that users cannot add terms, which is how State is set up), and there are matching resort names in the Vocabulary, imported from the same spreadsheet using the Taxonomy Import module. So I know there are no spelling differences or anything like that.

any ideas why some fields would work but others wouldn't?

rconstantine’s picture

i don't want to ignore you, but i don't have any ideas. if you don't have existing nodes yet, you can try deleting the offending field and rebuilding it.

ianchan’s picture

subscribe

friolator’s picture

@rconstantine: that seems to have done the trick. thanks.

ianchan’s picture

I tried the file from #11 and importing data into content_taxonomy fields worked! Thanks for adding support for content_taxonomy.

paganwinter’s picture

Subscribing...
Great work done here... :)

gavranha’s picture

#11 Works fine for me.
@rconstantine: thanks a lot for the very useful code.

temp’s picture

@rconstantine
hello, big thanks for .inc for taxonomy_content, but it not working for tree widget in my case (i'm make import by change it to select list widget)
i have big, multi parent vocabulary, with 7 level depth, and on step 7 i have error mesage from #7.
But big thanks anyway.

regmanabq’s picture

a big thanks indeed!!

thadwheeler’s picture

Thanks for this, I was looking at a solid couple days of input - this patch was perfect.

Bodo Maass’s picture

Thanks, the patch from #11 worked for me too and saved me a lot of time.

As others have pointed out, all terms need to exist before they get added, otherwise it won't work. Apart from this, it works well.

30equals’s picture

yeah, the patch from #11 is working for me as well. however, it seems content taxonomy import is case sensitive... ?
maybe there should be an option to choose between case sensitive and insensitive ?

anyway, this is a very useful module nonetheless.thanx

30equals’s picture

StatusFileSize
new1.52 KB

for anyone who's interested. attached is an adaptation of the #11 patch, so it supports content_taxonomy checkboxes as well now.
let me know it this is working for anyone.

danylevskyi’s picture

Today I tried this inc and it worked great!! Thanks guys!!!!

BenK’s picture

Subscribing and will test....

danieldd’s picture

Thanks very much for the patch (#11). I have installed it with the latest dev release of node import.

I am attempting to use it to import a content type with 2 taxonomies, both with heirarchies, but running into difficulty. I have prepopulated both taxonomies with terms/ parents etc.

I seem able to import content with taxonomy terms if I just list the child term (eg "banana") in my CSV file against the node but not if I show the parent with the child (eg "banana>>fruit"). Unfortunately because in my taxonomy the same child can have several parents (eg banana>>fruit, banana>>yellow etc), I need to import it with the parent relationship.

Does this patch support this functionality? And, if so, am I using the correct syntax to show the child/ parent relationship? (I am using banana>>fruit , as mentioned).

Also, I notice during the import (step 4) that there is an option to map terms to both the Content taxonomy field and core taxonomy field, even though these fields duplicate one another. I'm not sure what I should do here, and have tried all combinations of importing to one, or the other or both of these fields. However, nothing seems to work when I try to import a parent/child taxonomy term.

Also note that I have set both vocabularies to freetagging (deny new terms). I don't know whether I need to use a different widget to get this to work?

Would really appreciate any advice from someone who understands the module/ patch better than me or who has successfully imported content.

Thanks

erwanpia’s picture

Status: Needs review » Patch (to be ported)
StatusFileSize
new1.6 KB

for anyone who's interested, attached is an adaptation of the #35 patch, so it supports content_taxonomy free tags as well now :

when a tag does not exist, it was not created, it now creates taxonomy term when not in vocabulary when importing nodes (see lines 155 - 123)

let me know it this is working for anyone.

liquid06’s picture

#39 seems to be working for me when applied to a slightly older 6.x-1.x dev version of node_import - thank you for posting this!

christiaan_’s picture

Version: 6.x-1.x-dev » 6.x-1.0-rc4

#39 Works perfectly for me. version 6.x-1.0-rc4 thank you very much erwanpia

deva1983’s picture

Thank You! Thank You! Thank You!

#39 works perfectly for me, and in fact if I wouldn't have been able to do my import (4 different vocabularies, one of them freetagging) without it.

cyberwolf’s picture

Subscribing.

jolidog’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

#39 worked for me to, 3 vocabularies, one of them freetagging.

I think this should be marked as "reviewed & tested" and only after committed marked as patch to be ported? right?

gmclelland’s picture

#39 Worked for me too

rconstantine’s picture

glad to see work continued. so is this ready to be committed?

jolidog’s picture

From what I tested, yes.
Thanks!

jordan.schmitt’s picture

I just ran patch #39 -- thanks so much. I was about to go postal on Drupal before finding this patch.

ahabman’s picture

What format is required to add multiple tags? I've tried all the following, and each time only one tag is applied. So, I'll get concatenated tags like: "one two", "one two three". But I'm hoping to get separated tags like:"one", "two", "three".

title tags body
foo one two three lorem...
foo2 "one, two, three" lorem...
foo3 one\, two\, three lorem...
foo4 [one two three] lorem...
foo5 "one" "two" "three" lorem...

Thanks

jolidog’s picture

I think the default option is a |

As in: one | two | three

I'm not sure though...
I can't remember, if it was something you could specify...
Let us know how it goes...

Robrecht Jacques’s picture

Probably "||" (double pipe).

If the content field is set to have multiple values, you should be presented with a "Multiple separator" option on the "Set options" wizard page.

mavenmatt’s picture

Excuse me if this sounds ignorant, but where/how do I need to install this patch? We're developing a large music community site, and are using CCK taxonomy to tag all of our content. We're looking to import large spreadsheets of data surrounding concerts, and one of the fields is a dependent taxonomy term (it must be in the system for a user to add it). I can import all the other content, minus this CCK taxonomy field, but without this field, none of the other data is worth importing.

jolidog’s picture

This is not really a patch...

Just place this file in sites\all\modules\node_import\supported\cck

I don't know if it's necessary, but run update.php, just in case...

arievdonk’s picture

I think its going wrong when u use a special character like (&).
In my case it is isnt importing fields which contains such a character.
is there a workaround or could you adjust the code for it?

30equals’s picture

arievdonk

make sure the file you use to import, is encoded as UTF-8

arievdonk’s picture

well it makes the problem funny because it is UTF-8 encoded.
Maybe the problem is somewhere in the sql, i cant see anything what looks like escaping special characters.

arievdonk’s picture

bump

dicreat’s picture

erwanpia, thanks!
#39 work for me.

zkrebs’s picture

I set up content taxonomy fields that have pre-defined parents. For example, everything falls under "Product". Then I have

Product
-- Product Year
-- Product Type
-- Product Detail

When I set up this patch to import into product year, it just import the NEW terms into the highest level taxonomy. Why? Is there any way to get this module to obey the structure I have set up for hierarchy in CCK/Hierarchical Select if the term DOES NOT exist already, and is being imported anew?

Its strange. It seems to update the CCK Content_Taxonomy path correctly on the node page as product/product_year/1900 but in the stock Drupal taxonomy administrator the term 1900 is at the highest level, equal with product. Strange. Help would be appreciated. Perhaps it would make more sense to import all my Taxonomy term options first, then do this import?

richbaldwin’s picture

Spent all day trying to import records into content type using content taxonomy.
The setup/wizard seemed to work but I would get 100% errors on import.

Came across this in the issue queue unzipped content_taxonomy.zip from #39 and seeks to work.
Using node_import-6.x-1.x-dev.
three content_taxonomy fields.

Thanks for the module and thanks for the patch....good stuff.

shaneonabike’s picture

Issue tags: +CSV, +content taxonomy, +node import

So I tested this out and I'm not sure if it is working for my use case. I could use some help with this...

Basically, we have a taxonomy structure that allows for child terms such as Arcade>>DonkeyKong

In our CSV file we have associated these terms in that manner (using the >>) structure. But I am receiving errors as I think that they are not formatted properly.

This is not documented well as I'm unsure as to whether we should be using the taxonomy id's or the actual names for taxonomy terms. Here is a dump (below) from the validate_tree function... when I use 270>>271 in my CSV it doesn't work properly...

 [field_resource_grade_level] => Array
                (
                    [value] => Array
                        (
                            [270] => Array
                                (
                                    [children] => Array
                                        (
                                            [271] => Array
                                                (
                                                    [checkbox] => 271
                                                )
                                        )
                                )
                        )
                )

Any help would be fantastic!

thanks

shaneonabike’s picture

In response to this (so that others know how this works)... basically you just need to use the name indicated in the Taxonomy not the actual ID. The code that you can download will resolve everything properly for you.

Also, you can use whatever separators that you wanted as you are prompted in one stage.

shaneonabike’s picture

Issue tags: +patch

The patch that you created is fantastic... but unfortunately I was having some problems where most of my taxonomy items weren't actually being setup properly (and nothing was being imported). After a big of work and debugging I figured out what was happening.

Two cases (patch below):
1. In the code you take the first Taxonomy term found $term[0] which in my case doesn't work b/c we have multiple taxonomies with the same terms
2. You also check for an empty parent data... but since you are searching for the terms by name you probably don't actually need to do this check (and commenting it out works for my child terms)

Hope this code helps others.

51,64c51,57
<         $foundterms = taxonomy_get_term_by_name($value['value']);
< 
< 	// Need to loop through the found terms to find a the proper VID match
<         foreach ($foundterms as $index => $termfound) {
<           if ($termfound->vid == $vid) {
<             $tid = $termfound->tid;
<             $terms[$tid] = (array)$termfound;
<             $children = taxonomy_get_children($tid, $vid);
<             $terms[$tid]['children'] = $children;
<             $parents = taxonomy_get_parents($tid);
<             $terms[$tid]['parents'] = $parents;
<             break;
<           }
<         }
---
>         $term = taxonomy_get_term_by_name($value['value']);
>         $tid = $term[0]->tid;
>         $terms[$tid] = (array)$term[0];
>         $children = taxonomy_get_children($tid, $vid);
>         $terms[$tid]['children'] = $children;
>         $parents = taxonomy_get_parents($tid);
>         $terms[$tid]['parents'] = $parents;
68c61
< //        if (empty($data['parents'])) {//we only want top level terms here
---
>         if (empty($data['parents'])) {//we only want top level terms here
77c70
< //        }
---
>         }

temp’s picture

What i can make with '>>' separator between two terms?
When i use '||' i assign two and more terms for one node. - this i know
But what means '>>' separator?

temp’s picture

freetag cck field have option:
Freetagging settings:
- Allow and insert new terms by the user into the vocabulary
- Deny any new terms

latest patch don't support this option, terms creatin in any case.

briand44’s picture

Has there been any work done for the content taxonomy hierarchical select widget?

aelling’s picture

We have a content taxonomy field that uses Hierarchical Select on a custom content type. We would like to use node import to mass load new nodes from a csv file into the site. We want each node imported to retain its term hierarchy structure from the csv file. We see that the node import by default will let a person set a hierarchy specific delimiter but that only functions if you are using core taxonomy and not content taxonomy as a cck field. So essentially my question is the same as briand44's, has there been any work on a content taxonomy hierarchical select widget for node import or does anyone have suggestions or tips on how to begin writing one?

sczizzo’s picture

StatusFileSize
new2.14 KB

Attached is an updated version of #39 to support using TIDs in addition to term names. This was a quick edit, and the code isn't pretty, but it has worked in the few tests I have run. The code assumes that if the tag you entered was numeric then you meant for it to be treated as a TID. Let me know how it goes.

This may be useful for people (like me) who need support for hierarchical imports: I imported my vocabulary using the taxonomy_csv module, exported it via Taxonomy Manager to grab TIDs, and wrote myself a script to replace terms with their TIDs before I use Node Import. Kind of a hack, but it works.

realityloop’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new6.53 KB

Patch attached for #68 applies to dev

shaneonabike’s picture

shaneonabike’s picture

Alright I found a few issues with your code ...

Problem I found:

  1. TID's are returned as an object so you can't actually reference $term[0] as you did. It kept crashing on me until I made the changes in the patch. I also had to shift some of the code around to make it work better.
  2. There was a check in the code to see if the item did not have parents. I'm not sure why this was in the code but in my case it prevented the selection of terms lower down in the content taxonomy.

Something else worth mentioning is the following case...

If you have taxonomy built like the following:

  1. Fruit
    1. Carrots
  2. Orange
    1. Carrots

And you put the term Carrot into your uploaded CSV file it will pick the first term it finds (as it's hard-coded to use the first 0 array item. Ooops this is probably not good. We need a better mechanism to actually specify the parent path better...

Like if you put Fruit>>Carrot this tells content_taxonomy to use that path instead? Does anyone else know how to make changes in the code to parse that properly?

rconstantine’s picture

StatusFileSize
new11.83 KB

I have added support for the Hierarchical_select widget. It handles full hierarchies using the >> operator. This should address the carrots issue in the post above too, but probably not for the other widgets. Note in my initial release I stated that only levels of a certain depth would work. Sorry about grabbing the first one.

Anyone care to adjust the other widgets? I made a function called "content_taxonomy_node_import_get_children" which is recursive and can either be used as-is by the other widgets or might need just a slight modification.

Anyway, this work was sponsored by Heartland Communication Inc.

Rename the extension to .inc.

Oh, I discovered an issue whereby if you had terms that were numbers, then the contributed code provided in #68, above, would kick in, thinking they were TIDs. The work around is to prefix your number terms with a # sign and then let my code remove that #, leaving just the number. If, for some reason you need your term to start with an actual # sign, then just double them up as ## and the first one will be stripped off.

I also integrated the code from #35 and #39. So if anyone wants to test this Frankenstein monster and maybe debug some more for us all, that would be great.

shaneonabike’s picture

Wow!

That's really awesome @rconstantine I'll have to give it a try a little later.

I have to chuckle b/c I was just about to report the same issue with the number problem. Although my 'solution' was to do the following:

$termfound = null
is_numeric(value) -> $termfound = grab value from taxonomy by id
if (empty termfound) termfound = grab value from taxonomy name

This way if it thinks it's a number and fails to find the result then it will try again using the name... the only problem I see with your solution is that it may not be clear to people to put the # in front (dunno).

Thanks for your awesome work!

rconstantine’s picture

@ShaneOnABike - I thought of doing it your way, but what if a low number was needed as a term. Low numbers are almost guaranteed to be valid TIDs. So you'd pick it up as a TID when it shouldn't be. What I did, at the top of the inc file was to put the instructions which I outlined in #72 above. If this file someday gets rolled into the official release, then it would be added to the README. Simple as that. Many modules have specific handling requirements, so I wasn't worried about that. Of course, this way was fast to code. Another option would be to include a checkbox in the wizard so you could tell the wizard which to use - TIDs or terms.

Do the other widgets need the hierarchical code? I didn't even stop to look. What else is there, tree, checkboxes, freetagging... anything else?

shaneonabike’s picture

Okay that's a pretty fair approach and will work for sure. I was originally going to say that reversing the order (string check then number) could be effective. Then I realised that all these calls are damn expensive so it's probably better to approach it from your side.

Nice work btw! I'll be able to test this in a little while.

PS - Freetagging wouldn't have this issue but perhaps checkboxes (although I haven't used it)

rconstantine’s picture

i was thinking about checkboxes. i think each box has the 'value' of the tid. if that is the case, then the way it's handled should be a bit different. it might be the case that although the hierarchy from the csv needs to be worked out to find out what that leaf term is, that might be all that is needed. i'm pretty sure the way i had it in the first place, where one specifies just the leaf term, that it would still save all parents too if you check that box. in other words, by finding the leaf term you find the parents. or is that check box only for hierarchical_select? if i had time, i'd just look at it to see.

if someone gets a chance, they should see whether my hierarchical select solution works with multiple-parent hierarchies. like if you had the word 'banana' under 'fruit>>tropical>>banana' and 'slug>>banana' (the animal), would it all work? i'm particularly curious about banana being at both level 2 and 3.

el56’s picture

subscribe

amorsent’s picture

Oh man, thank you so much Drupal community!!!!

Andrew Gorokhovets’s picture

subscribe

benone’s picture

wow! subscribe

benone’s picture

rconstantine: can I import taxonomy to HS field using your plugin not having any terms in voc ?
this is what I really looking for..

benone’s picture

this is what i need to import for example:

Online Communities >> Social Networks, Internet & Telecom >> Email & Messaging, Internet & Telecom >> Web Apps & Online Tools

so it is 3 multiples with hierarchy. I have empty voc by now..

rconstantine’s picture

@benone - i think so. it's been a few weeks since i last posted here and my memory isn't so great. i do think that terms that didn't yet exist were being added, but i think it was someone else's code that was contributed earlier that was doing it. i just made sure to incorporate all of the changes this thread has come up with into the latest patch/version.

benone’s picture

ok, i understand. so i can confirm that this option is not added. when I tried with the example categories and emtpy vocabulary, I got info from line 221 of your file:

  if (empty($foundterms)) {
    node_import_input_error(t("The term %value was not found at the expected level in your taxonomy hierarchy. Please check your import file and try again.", array('%value' => $top)));
    return NULL;
  }

My categories look like this:


Online Communities >> Social Networks, Internet & Telecom >> Email & Messaging, Internet & Telecom >> Web Apps & Online Tools

How can I fill categories in vocabulary while import instead of before ?

rconstantine’s picture

i recommend you use taxonomy import to get the taxonomy into your system. can't remember the exact name of the module. let's you use csv files and many different formats.

Andrew Gorokhovets’s picture

#72 works perfectly with Autocomplete (Freetagging), Checkboxes/Radios, hs_Content Taxonomy

kbk’s picture

Status: Needs review » Reviewed & tested by the community

It appears, from #84 & #85, that this patch requires the vocabulary exist prior to import. As modules already exist for importing vocabularies (e.g., Taxonomy XML and Taxonomy CSV) I would propose that functionality does not need to be included in this patch.

I can also confirm, along with #86, that this patch works. Changing status to Reviewed & Tested.

rconstantine’s picture

I would agree that vocab import need not be included here. I have used and like Taxonomy CVS which was mentioned in #87.

Andrew Gorokhovets’s picture

Status: Reviewed & tested by the community » Needs work

I have noticed bug.
When I do import of numerical values (1,2,3,4) for CCK Taxonomy CheckBox they do not saved!

Node Import cannot define tid of the term

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

            [value] => Array
                (
                )

        )
rconstantine’s picture

some stuff i made mention of in #72 may need to be extended to work with checkboxes.

Andrew Gorokhovets’s picture

So, will be it fix?

benone’s picture

I can confirm that #72 works great for hierarchy but the problem is when you have multiple hierarchy, like

"Online Communities >> Social Networks, Internet & Telecom >> Email & Messaging, Internet & Telecom >> Web Apps & Online Tools"

In this case it imports only the last - Internet & Telecom >> Web Apps & Online Tools.

I have option in step 5 - Multiple values are separated by: - for this field but it seems not to work.

Can any of you confirm that or its just something wrong with my configuration.

THX

taisei516’s picture

Status: Needs work » Fixed

erwanpia, thanks!
#39 work for me.

kbk’s picture

Status: Fixed » Needs work

Taisei, please don't change the issue status prematurely. See #72 and #89, specifically.

vadym.kononenko’s picture

Hi, all.

I've found wrong order of functions calls from node_import/node_import.inc:726

In my case it is:

drupal_alter: book
drupal_alter: taxonomy
drupal_alter: user
drupal_alter: content_taxonomy
drupal_alter: date
drupal_alter: location_cck
drupal_alter: location
drupal_alter: content
drupal_alter: nodereference
drupal_alter: optionwidgets
drupal_alter: userreference
drupal_alter: node

I see that 'node_import/supported/cck/content.inc' prepares values and changes fieldname from 'cck:FIELDNAME:value' to 'FIELDNAME' format, that expected by 'node_import/supported/cck/content_taxonomy.inc' file.

Construction 'foreach (node_import_cck_fields($type, 'content_taxonomy') as $fieldname => $fieldinfo) {' in line 49 of this file return just FIELDNAME without prefix and suffix.

Dumps of 'values' argument made after construction:
'if (($node_type = node_import_type_is_node($type)) !== FALSE) {'
of file 'node_import/supported/cck/content.inc:81'

and before closing bracket of this 'if' shows this transformations.

Maybe this is a key of wrong behaviour?
Who is know which correct ordering logic should be here?
I see a hook on content.inc should be called before other CCK fields handlers, but where is the correct identifiers for that?

vadym.kononenko’s picture

You can see similar manipulation in 'node_import/supported/location/location_cck.inc:80'
// Get location_cck fields for this node type
foreach (node_import_cck_fields($type, 'location_cck') as $field => $settings) {..
//dsm($values);
//$settings = content_fields('field_location', $node_type);
// $values['locations_cck'] = array();
$cck_field = 'location_cck:' . $field;

Somewhere lies the error, or it is here, or in 'content_taxonomy.inc', 'userreference.inc', 'filefield.inc'... Who can say where here is TRUTH?

vadym.kononenko’s picture

I've found solution: UPDATE system SET weight = -1 WHERE name='content' ( http://drupal.org/node/110238 )

Now I have such order:

drupal_alter: content
drupal_alter: book
drupal_alter: taxonomy
drupal_alter: user
drupal_alter: content_taxonomy
drupal_alter: date
drupal_alter: location_cck
drupal_alter: location
drupal_alter: nodereference
drupal_alter: optionwidgets
drupal_alter: userreference
drupal_alter: node

and 'content_taxonomy.inc' see all it's values (I don't see any errors). However values were not stored.

I've tried such widgets type for CCK field:
HS - doesn't save any values.
Tree - doesn't save any values.
Multiselect - all values were saved correctly.

tayzlor’s picture

subscribing, want to check this out later

vadym.kononenko’s picture

While my attempt #97 when I've used 'Multiselect' widget I've got several terms in the imported field but without hierarchy.

I see on the page 'admin/content/node_import/add' "(step 5 of 8)" that module is proposing me to set 'Multiple values separator'.
But I use Hierarchy Vocabulary and want to import terms as an hierarchy.

I saw to the code and found 'content_taxonomy.inc' doesn't declare any parameters for imported fields ('has_multiple', 'has_hierarchy' and so one...) as opposed to 'taxonomy.inc'

It's a bug or here is unknown to me dependence between 'content_taxonomy.inc' and 'taxonomy.inc'?

vadym.kononenko’s picture

I've found that I shouldn't set 'Multiple values separator' for this field to '>>', so 'content_taxonomy.inc' parse it itself (if we use 'content_taxonomy_hs' widget).

But in this case I've catch errors with Term import. I'll see what's wrong.

roball’s picture

Version: 6.x-1.0-rc4 » 6.x-1.x-dev

The .inc file from #72 by rconstantine added to the latest 6.x-1.x-dev (2010-Jul-11) enabled importing a content_taxonomy field for me.

vadym.kononenko’s picture

StatusFileSize
new7.32 KB

I've added ability for HS fields to create new terms if it was not found in vocabulary.
Functionality in #72 only fills field from vocabularies values for 'content_taxonomy_hs' widget type.

This patch should be applied to 'node_import' module with #72 file in 'support/cck/'.

Andrew Gorokhovets’s picture

To my previous post (#89- http://drupal.org/node/434572#comment-3581688 )

This is not a bug!
This is limitations of node_import (taxonomy, content_taxonomy).
If I have a term, which name is a number, I must write his tid in my import file (not a name!).

So, in my case, all works greate!

tjmoyer’s picture

It seems to me that, as mentioned in #86, #87 and #88 by rconstantine and kbk, the importing of taxonomy should be done outside of this. Yet the patch, as is, imports taxonomy terms if the widget is not one of the ones defined, which falls under "other widgets". So if you have a standard content_taxonomy_select widget, all new terms are imported.

I'm adding a patch to #72's version that first checks whether free tagging is turned on before saving new terms. This filters out all new imports unless the taxonomy specifies it accepts new terms added by node submission.

tjmoyer’s picture

Ooops, downloaded and saved patch to windows system, which added the ".txt" to the file. Here's the correct one.

tjmoyer’s picture

Actual Linux file for the patch:

heacu’s picture

#39 ok with 6.x-1.0-rc4, though i should probably try later patches

roball’s picture

Patch from #72 is working perfectly for me with the 6.x-1.x-dev version of Node import.

Would be great if someone could commit it and release 6.x-1.0-rc5 or even a final 6.x-1.0.

joecanti’s picture

#72 works great for me too.

Many thanks +1

Joe

taisei516’s picture

sorry kbk!

finraag’s picture

I used #39 to solve my problem. It works good. But I see there is a new patches - #72 etc. So how can I install new patches (they are not .inc like #105) to use in future?

roball’s picture

Version: 6.x-1.x-dev » 6.x-1.0
Status: Needs work » Reviewed & tested by the community

Yeah, finally the final 6.x-1.0 version of this great module has been released!

Unfortunately, the .inc file to support content_taxonomy did not do it into the release. You can add it manually like this:

[root@www modules]# cd node_import/supported/cck
[root@www supported]# wget http://drupal.org/files/issues/content_taxonomy.txt
[root@www supported]# mv content_taxonomy.txt content_taxonomy.inc
[root@www supported]# cd -
Robrecht Jacques’s picture

Status: Reviewed & tested by the community » Fixed

Patch of #72 has been committed to 6.x-1.x. Will be included in 6.x-1.1 release.

roball’s picture

Excellent - 6.x-1.1 is actually the first version that works completely perfect for me out of the box.

Status: Fixed » Closed (fixed)
Issue tags: -patch, -CSV, -content taxonomy, -node import

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