Import from csv to CCK ?

http://drupal.org/project/cck

CommentFileSizeAuthor
#17 painting_10.csv10.91 KBcoupet
#10 import_taxonomy_0.inc3.78 KBdado

Comments

dado’s picture

Some CCK fields are now importable using the CVS HEAD (Drupal 4.7) version of node_import.
See here
http://drupal.org/node/42763

Please report back which CCK fields do and which don't work for you. Thanks!

coupet’s picture

Using latest version of cck and node_import
- created a cck content type
- created csv files, and import as per wizard.

cck fields values were imported perfectly.

global fields value (taxonomy terms) selected were not assigned to nodes.

All the nodes imported were not assigned taxonomy terms as selected per wizard.

dado’s picture

hmm looks like import_taxonomy.inc is misbehaving. did you only try to import taxonomy terms globally (not as field values on a per record basis)?

coupet’s picture

it is probaly misbehaving as mentioned! only globally.

coupet’s picture

field values on a per record basis works perfectly.

dado’s picture

Title: Import to CCK » Import taxonomy terms globally
Assigned: Unassigned » dado
Category: support » bug

coupet,
could you tell me all settings you have for the vocabulary you are importing into? freetagging? required? what do you see in the node_import form for your taxonomy?
thanks

coupet’s picture

there are four Vocabulary name: vocab1, vocab2, vocab3, vocab4
for each vocabulary, there are 4-5 terms
there is one cck content type: cckname1

Categories
Types: cckname1 (cck content type)
Hierarchy: single
Related terms - Unchecked
Free tagging - Unchecked
Multiple select - Unchecked
Required - Unchecked
Weight - 0

import screen is as follows:

Global fields
Values selected below will be applied to every node imported in this operation.
Categories
vocab1: single select option for terms (, term11, term12, tem13, ...)
vocab2: single select option for terms (, term21, term22, tem23, ...)
vocab3: single select option for terms (, term31, term32, tem33, ...)
vocab4: single select option for terms (, term41, term42, tem43, ...)
content-cckname1

Insert new terms: Yes or No

Preview and Back Button

Note: the cvs file does not include taxonomy field information

coupet’s picture

further observation:

Import as per field values on a per record basis.

Enable the Location module
Enable the Locative information for cck content type in administer » settings » content types

created a cvs file that include location information:
Location Name, Street, Additional Address, City, State or Province, Zip or Postal Code, Country, Latitude, Longitude

Unable to import State or province, Country
Successfully imported Location Name, Street, Additional address, City, Zip or Postal Code

Note: Location module is distributed with State or Province table and Country table

coupet’s picture

unable to import States or Province codes.

as per supported location include files, the field value for States or Provinces can have the following values:
LIV, LND, LUT, MAN, MDW (examples for UK Provinces)
NY, CT, AL, NJ, DC (examples for US States)

The country code import works nicely.
uk, us (examples for United Kingdom and United States)

References
'LIV' => "Liverpool", 'LND' => "London City of", 'LUT' => "Luton", 'MAN' => "Manchester", 'MDW' => Medway"
'NY' => "New York", 'CT' => "Connecticut",

dado’s picture

StatusFileSize
new3.78 KB

coupet,
Thanks for your diligence. I am not able to reproduce these bugs. Please for this thread let's focus on the globally assigning of taxonomy relationships to the entire imported set of nodes. I created a new issue for the location fields not importing. Please see here:
http://drupal.org/node/64234

Regarding global importing of taxonomy relationships: I am unable to reproduce this. Could you replace your file import_taxonomy.inc with the attached and try again? Below is what I see when I try to globally associate the imported nodes with 2 terms: 'park' and 'state park'. You should see something similar.
Thanks

Associating this node w/ terms:
array ( 1 => class stdClass { public $tid = '1'; public $vid = '2'; public $name = 'park'; public $description = ''; public $weight = '0'; }, 2 => class stdClass { public $tid = '2'; public $vid = '2'; public $name = 'state park'; public $description = ''; public $weight = '0'; }, )

coupet’s picture

no messages were displayed.

The wizard executed with the following message at completion:
import
Successfully imported 10 nodes.
File: filename_07.csv (812 bytes)

The nodes imported are not assigned to taxonomy terms.

Robrecht Jacques’s picture

Could you try the current CVS version (import_taxonomy.inc versino 1.5).

coupet’s picture

works great!!! imported and taxonomy were assigned. will report will further tests later. thanks

Robrecht Jacques’s picture

Version: 4.6.x-1.x-dev » master

Setting to cvs version. Taxonomy import is not suported for 4.6.

coupet’s picture

Update(1): Unable to import taxonomy terms as field values on a per record basis
Update(2): Able to import taxonomy terms globally

interesting reversal!?

Robrecht Jacques’s picture

Could you add the CSV file here (not completely, two or three rows is enough - and of course not with sensitive data)?

coupet’s picture

StatusFileSize
new10.91 KB

test cvs file

Robrecht Jacques’s picture

Assigned: dado » Robrecht Jacques

OK. I know what is going on. I'll fix import_taxonomy.inc. Currently you can only have one list of taxonomy terms, while you have 2. Actually it makes more sense to have one column for each vocabulary (in fact, just like dado's import_taxonomy.inc had). I'll extend it and let you know.
Thx for the test-data (I should be able to fix import_location and import_taxonomy now).

Robrecht Jacques’s picture

I think this is fixed in CVS now (import_taxonomy.inc version 1.10). Your example csv file imported without problems.

Let me know.

coupet’s picture

I updated to all latest cvs files, I get the following:

* warning: main(import_content.inc): failed to open stream: No such file or directory in /usr/local/apache/htdocs/sitename.com/dpa/modules/node_import/node_import.module on line 18.
* warning: main(): Failed opening 'import_content.inc' for inclusion (include_path='.:/usr/local/lib/php') in /usr/local/apache/htdocs/sitename.com/dpa/modules/node_import/node_import.module on line 18.

I renamed 'import_cck.inc' to 'import_content.inc' to suppress warnings.

Robrecht Jacques’s picture

Did not test CCK yet (i used your csv file to import to a locatoin-enabled page content type).

Renamed import_cck.inc to import_content.inc for consistency.

Does the taxonomy now work?

coupet’s picture

yes, taxonomy import works prefectly.

The following scenarios work:
- import taxonomy terms as field values on a per record basis
- import taxonomy terms globally
- import both taxonomy terms as field values on a per record basis or globally
(select global terms for taxonomy terms defined but not being imported)
- import both taxonomy terms as field values on a per record basis and globally
(add global terms to existing taxonomy terms)

The UserInfo field value is not being imported, it shows as anonymous, this value is different than Author.

Robrecht Jacques’s picture

OK. Thanks.

I'll check out the "author" problem.

Robrecht Jacques’s picture

Status: Active » Closed (fixed)

OK, this issue got hijacked a couple of times. I'll close it but not before I say:
- taxonomy import should now work,
- node author import should now work,
- cck is next on my list.

Closing it. Open an issue with *one* bug if you still have problems.