Attached is a first-stab at this, based on a conversion of the latest 5.x head version. I'm sure that some of the new formAPI changes in D6 mean that there is a more elegant way to do a multistep form (using $form_state), but this version works for me at least.
I would have liked to look into the ? [] etc. unicode/non-ascii problems that people (including myself) have had as well, but this is very hard to test! This version works with csv files with unicode characters on two different installations I have of Drupal-RC1 and Drupal-beta4, on both Mac and PC, so long as the file is converted to UTF-8 first.
Summary of changes made:
- Changed .info and.install file to use D6 schema
- added hook_theme() function to register theme functions
- changed hook_help() to D6 syntax
- changed hook_menu() to D6 syntax
- changed all form builder functions to include $form_state argument (even though this is not used in the form workflow)
- various coder module warnings about string formatting etc.
- changed hook_form_alter functions in taxonomy.inc
- Added call to module_load_include('inc', 'node', 'node.pages') in node.inc to make node_form() work.
regards,
t.
Comments
Comment #1
frank ralf commentedThis is a first stab at modifying the file supported/event.inc for working with Event module for Drupal 6.
Any comments and suggestions for improvements welcome.
Frank Ralf
Comment #2
dergachev commentedWorked beatifully for me to import a large CSV file into Drupal, with a content type that has CCK fields.
There was an error when I clicked "delete uploaded file from server", though.
Also, it gave me some SQL warning about a duplicate insert into this module's table.
But, it did the job. I can't thank tanoshimi enough for posting the patch, and it should probably be released as Alpha.
Comment #3
jcwatson11 commentedThere were 2 errors for me. The first had to do with supported/cck/content.inc trying to access an array element that didn't exist. I fixed that with the attached patch.
The second has to do with the fact that I don't have something installed right. The node_import module is looking for a function called date_iso2array() and can't find it. The full error message reads:
Fatal error: Call to undefined function date_iso2array() in /opt/sws/avnet/app/httpd/htdocs/www.avnet.com/modules/node_import/node_import/supported/cck/content.inc on line 103what am I missing?
Comment #4
jcwatson11 commentedNever mind... the patch from http://drupal.org/node/227681 fixed this issue. Looks like the date functions were still using older libs from date instead of date 2.
All ahead full.
Comment #5
jwaxman commentedI needed to fix the issue described in this node to get this to work.
http://drupal.org/node/192211
Comment #6
jcwatson11 commentedjwaxman -
The patch from the article you posted looks almost identical to the patch I posted here for content.inc. If you compare the 2 patches, only the variable names are different. Nice to know I'm not alone.
Jon
Comment #7
ak commentedThe updated Drupal 6.x module works great so far in my installation.
In the meanwhile the official Drupal 5.x module supports uploads for nodes. Using the upload.inc file in the Drupal 6.x version fails on submission and results in a blank screen. The upload.inc file really isn't big. What needs to be done to upload.inc to work in drupal 6.x? Can anybody help?
Comment #8
frank ralf commented@ak
Just a very quick guess:
upload.inc does some direct modification of the database in its implementation of hook_node_import_postprocess().
You might first have a look, whether the database tables and fields of Upload are the same in Drupal 5 and 6.
However, Drupal 6 now uses a special Schema API for database access (http://drupal.org/node/114774#schema-api) so that might be the place to look.
Regards,
Frank
Comment #9
ak commentedOk, here's my progress in detail. I didn't really dig and understand the Drupal Schema API due to my lac of skills. But indeed the database tables aren't the same.
Drupal 5 table: fid, nid, filename, filepath, filemime, filesize
Drupal 6 table: fid, uid, filename, filepath, filemime, filesize, status, timestamp
It's significant that the nid became a uid and the file_revisions table of Drupal 5 doesn't exist in Drupal 6 anymore. So heres the current Drupal 5 upload.inc hook_node_import_postprocess() implementation:
To get a further idea of what has to be done I took a look in the devel module that is able to auto generate nodes with attachments. Heres the related devel function:
Some things are different here. A $file class is created and stored in $node->files and a $_SESSION variable I'm not aware of. This wasn't necessary in the Drupal 5 version. Most fields are hardcoded here. I can't see the list, description and weight fields get stored in the files table nor how the node nid the file belongs to is saved for further reference anymore. No idea where this information lives in the Drupal database. Maybe somebody can bring me some light into the darkness.
Never the less, here's my attempt to merge these two functions into one that potentially works for Drupal 6:
Regarding the issues above that I don't understand, it looks as if this code could work. If someone would look over my mockup I'd be very thank full.
MfG
Comment #10
jcwatson11 commentedIn my experience, a blank screen can be the result of:
1. Not enough memory. Increase your php memory limit to 100MB and see if that helps. If not, then...
2. display_errors and display_startup_errors are turned of, so PHP isn't telling you anything.
To change any of these settings, use the ini_set() php function, documented at php.net. The three variables in question are:
memory_limit
display_errors
display_startup_errors
A good place to put the code is inside $drupaldir/sites/default/settings.php, right at the top.
If you're working on a production site, and can't display errors on-screen, you can use:
This should set your memory limit up to 100MB, and turn on file-based error reporting. Assuming you are putting this code in sites/default/settings.php as mentioned above, then a file called php_errors.log will appear in the site root.
Error log file permissions: If you're still getting a blank page and still don't see the file, make sure your drupal folder is writable by apache. Apache can't always write to all folders everywhere.
Avoid setting chmod o+w however, beacuse you don't want public users to write to your webroot folder. Best way to do this is to create php_errors.log as yourself with $:/> touch php_errors.log from the command line, then chown it to user.apache where 'user' is your user name and 'apache' is the apache group. You may have to fiddle with user group membership, but Linux group membership is out of the scope of this response. There are lots of great places you can go to learn about that online.
Anyway, you get the idea.
Oh... if you're running in safe_mode, the ini_set() function may not work... But I don't think drupal can run in safe mode anyway. Not sure.
Comment #11
Coupon Code Swap commentedDoes this version support updating existing nodes based on a unique key such as NID or title?
Comment #12
AppleAp commentedHello guys,
Can someone give me a link to the latest Node Import for 6.x snapshot please?
Comment #13
tarvid commentedI'd like to import profiles set up with content_profile. Profile is an option but it doesn't see the added fields. The CSV import files are not parsed. I am probably going to have to resort to writing the script but if there is hope for node_import, I'd like to give it a shot.
Comment #14
tarvid commentedThe zip file worked fine. All the profiles are attributed to the root user. A few of the "profiles" have signed up as users and it was easy to transfer the profile.
Comment #15
Anonymous (not verified) commentedthe original zip worked fine for a >4000 node import into cck nodes. However, I can confirm the feature "delete CVS file from server" doesn't work - instead, it restarts the import resulting in duplicate nodes.
Comment #16
larynAre the patches listed here being added to the file linked at the top, or not yet? (File doesn't list a time stamp)
I will be doing some testing of this -- extremely glad to find node-import for 6.x!
Comment #17
frank ralf commentedChanged title back after reading http://drupal.org/node/244931#comment-1029298 ("Please make a 6.x version of this module").
I think we really need an "official" HEAD version for Drupal 6 to bundle all development efforts.
Frank Ralf
Comment #18
labrown commentedI'm trying to use this version of Node Import to move data from another CMS into a D6 install and am having problems with a CCK 'datetime' field I've added to a standard node content type. The Title and Description comes through fine, but both values (start and end) for the date field are filled in with 'now' instead of the dates in the CSV file.
Anyone seen this behaviour?
Comment #19
labrown commentedMore information. Node Import for 6.x doesn't work with CCK fields set to 'datetime' and with multiple values in the field (from and to in this case). I've not dug far enough into D6 to figure out how to fix this yet.
Comment #20
frank ralf commentedThere's the suggestion over in http://drupal.org/node/244931 ("Drupal 6.x port") to port the Import/Export API module instead (http://drupal.org/project/importexportapi). Might be a good idea.
Frank
Comment #21
3cwebdev commentedfollowing... :)
Comment #22
mkjones commentedWhat's the latest on this? And does it import your URL re-directs?
Comment #23
Chris CharltonSubscribing.
Comment #24
miro.log commentedHi, and many thanks for the module upgrade.
any chance to have the book page: parent link function working (soon)?
Sorry for this direct question, I just think that this functionality, together with CCK and a little work in views-view-xml.tpl.php (Views Datasource module), can turn a basic D6 installation into a powerful database-publishing workstation for pre-press purposes.
I'm currently using node_import (in D5) and export_dxml to render complex publications into a large and unique Indesign-compatible XML file, but D6 and views2 offer a much more powerful and elegant approach to this kind of issue.
Of course if anybody is interested I will post about this.
Thanks,
Miro
Comment #25
sammy-node commentedsub
Comment #26
sam6 commentedSubscribing
Comment #27
jtjones23 commentedsub
Comment #28
jvinci commentedsubscribing
Comment #29
joncup commentedsubscribing *bump*
Comment #30
T1TAN23 commentedsubscribing too
Comment #31
danielb commentedI have tried the D6 port and it gives a lot of errors.
EDIT: Ignore this - it is a duplicate titles problem causing duplicate paths, i can work around it.
Comment #32
traviscarden commentedThis code needs the patch at #227681: Date 2 API breaks node imports with dates.
Comment #33
geodaniel commentedWith this port, I have problems if I'm importing content that doesn't have location information into a content type that has location information enabled (but not mandatory). I get the following errors:
warning: Invalid argument supplied for foreach() in /sites/all/modules/location/location.module on line 1677.
You must fill in both latitude and longitude or leave them both blank.
Just a note as well that it seems the module maintainer has started to port the module to D6 (see the dev snapshot), though it doesn't look to be based off this port as the interface is considerably different.
Comment #34
danielb commentedI don't seem to get any fields except lat/lon for location when doing the mapping. My solution is to create the location fields as CCK, do the import to the CCK fields, and then use a custom script to move the information to the correct field using node_load and node_save.
Comment #35
Robrecht Jacques commentedThe port in 6.x-1.x-dev is a rewrite to finally make use of the new features of Drupal 5.x and 6.x especially the extended form functionality (drupal_execute()). This will for the biggest part remove the need for many duplicated form validation code and weird data manipulation of the $node object to get it in the right format for saving which will make the module as a whole more stable.
Normally each day some new part will be added with the basic functionality ready by next weekend (with complete support for most core modules like upload and taxonomy).
Next week CCK should follow.
So I'm not going to commit the patch of this issue to CVS. Just to let you all know.
Comment #36
geodaniel commentedThanks for the update Robrecht, great to hear it's being refactored. Looking forward to trying it out.
Comment #37
dman commentedGood to see.
I sneaked a look at the DRUPAL-6--1 in CVS. Looks like the code will be good and clean, but not doing much yet ;-)
You probably know, but the 'text delimiter' isn't working yet. Isn't there a PHP func for that? http://nz.php.net/fgetcsv or are your needs even more clever than that?
Comment #38
Robrecht Jacques commentedcomment #37 : yes, still very clean :-)
'text delimiter' doesn't work yet. I know about the fgetscsv function but previously there were many problems with it (not reading UTF8 characters, text length is limited). Probably due to people using PHP < 4.3.5 (at which point it became binary safe).
Comment #39
mtndan commentedWonderful work! Will you be porting the location import feature?
Comment #40
DanielJohnston commentedSubscribing. Oh yes.
Comment #41
niklp commentedAlso see this: http://drupal.org/node/333031
Comment #42
sam6 commentedSubscribing
Comment #43
jcwatson11 commentedI know Robrecht Jacques is working on a more official release of this module for 6.x. However, for those of you who don't want to go through the trouble of applying the patches mentioned at the top of this thread, I have created a tar.gz file of the 6.x node_import module with those patches applied.
Please note that this is not the official release, but will probably work. Just use with caution and understand that Robrecht's release is coming soon and will be completely different.
EDIT: I actually couldn't get this working on my development machine for some reason. I think there might be something wierd with my install. Some feedback on whether this roll-up wroks would be appreciated. This actually caused my drupal install to hang accessing any admin page until I deleted the node_import folder. Not sure why this is happening. Sorry.
Comment #44
giorgio79 commentedI was just trying the latest dev release from csv but a text cck field did not show up unfortunately.
Comment #45
sammy-node commentedsub
Comment #46
adam_b commentedThis version (jcwatson11 #43) installs fine for me and the content-mapping all looks correct, but when I click the "Next (preview)" button I get the error:
Fatal error: Call to undefined function date_unix2iso() in W:\www\sites\all\modules\node_import\supported\cck\content.inc on line 99If I comment out that function, then I get the error:
Fatal error: Call to undefined function date_iso2array() in W:\www\sites\all\modules\node_import\supported\cck\content.inc on line 104I tried removing the Date information from the CSV file but got the same error, so I believe it's related to the CCK Date field used for this content type.
Hope this works soon... feel free to let me know if I can help with testing.
Comment #47
adam_b commentedFeedback (possibly unwanted, but still...) on Robrecht's dev snapshot of 6.x-1.x-dev from 15 November:
- still no CCK fields in mapping
- interface now gets to the point where I can ask it to start the import
- but the importing task never completes :(
Please let me know if I can help with any testing - am waiting for this module so I can import a large batch of data.
Comment #48
zeezhao commentedsubscribing. thanks.
Comment #49
jcwatson11 commentedadam_b - do you have the date module installed?
Comment #50
frank ralf commented@jcwatson11 (#43)
Got it working with my development installation.
Only "Delete file from server" still creates duplicates (instead of deleting the file).
Thanks!
Frank
Comment #51
adam_b commentedre #49 - yes, I have the date module v 6.x-2.0-rc4 installed
the CCK fields for the content type into which I'm importing the data are:
- field_author Content Taxonomy Fields
- field_editor Text
- field_date Date
- field_publisher Content Taxonomy Fields
- field_subjects Content Taxonomy Fields
Comment #52
jcwatson11 commentedre #50 - That's good news. The delete file from server was an issue that existed prior to my combining of patches. There must simply be something wrong with the drupal instance I tried it on. Thanks also to adam_b for testing.
re #51 - Sorry. I got nothin else for you to try on that front. You'll have to figure that one out on your own. I know the module does require the date module for date support. And there may be issues with your version of PHP with regard to the date module. Note that the date module can be difficult to get working properly on PHP <=5.2.
Comment #53
adam_b commentedre #51 - okay, I changed the date field to an integer (it's only holding the year, so doesn't really need to be a date at all). I can now import content, but there are some issues:
- the "author" and "publisher" field are mapped, but don't appear in the preview and the data isn't imported
- when I tried importing 10 records there's no error, but when importing 100 records I got an error message:
user warning: Duplicate entry '0-300' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (286, 300, 0) in W:\www\modules\taxonomy\taxonomy.module on line 702.Comment #54
Road Runner commentedDownloaded version on Nov 19.
All OK up to reading tab delimited files (my file was created by Text Wrangler on Mac). The column headings in first line not recognized (all put together in first column as if it doesn't see the tabs between fields. All records were loaded into first column just like the column headings - no field delimiter recognized (tab separated)
While not critical the file extensions don't appear to do anything my file was read and uploaded without the correct extension. I changed it to tsv just to be sure that wasn't causing any problems.
I have Attached 4 record file called test no extension. The first record is field headers.
thnx
Edit
After much messing around I was able to get all 8 screens to work. Apparently I needed to create the file using , delimited fields with "(quotes) delimiting text and then save file (using Text Wrangler) using Unix file structure and UTF-8 Unicode. Column names recognized and imported file looked like it was recognized.
Problems:
1. Can't use none in options for text and escape delimiters throws off errors
2. Doesn't recognize CCK field in the mapping screen
3. When import is started it just stays busy - no import.
4. Related to import and busy - no way to stop process just hangs. Then must go and uninstall module to get it to stop.
I can help test if you need it. Using Mac, Text Wrangler, xCel and Drupal 6.6. I then have working test site on a hosting provider to test - not using MAMP to test this.
Thnx for your efforts.
Comment #55
juan_g commentedFor more people willing to help testing, the port to Drupal 6 node_import 6.x-1.x-dev (currently unstable) is available through the View all releases link of the module.
Comment #56
Robrecht Jacques commentedAn update on the status of 6.x-1.x-dev:
First of all, it is a development version which means not everything is implemented yet and may or may not work on a day to day basis. If you want to have something reliable, wait until a proper 6.x-1.0-rc1 release.
The only module that is currently supported is node.module. This means the following (and only the following) fields: Title, Body, Input format (of Body), Authored by, Authored on and the Publishing options.
What are the next steps before a proper 6.x-1.0-rc1 release:
Hope this clears up things.
Comment #57
adam_b commentedThanks Robrecht. It's helpful to have the list of what's supported – now that I know CCK definitely isn't supported then it's clear why my import isn't working.
I'll await the release clients with impatience – sorry to be harassing you but it's just such a useful module :)
Comment #58
niklp commented@Robrecht, do we have any idea of timescales for these RCs? I need CCK functionality quite urgently, and may be able to help move the development along.
I will refer the guy who is contracted to implement my node imports to this thread and see if he can be of any assistance, if this is going to be helpful?
Comment #59
Robrecht Jacques commented@NikLP: difficult to say.
Aim is to have -rc1 (core) ready/usable by Tuesday - I'm 95% sure this will be possible.
-rc2 (+CCK) could be ready by next week Friday - depending on how much I'm able to work on it during the week (and this weekend - which is unfortunately quite full) - 50% chance, otherwise it will be a week later.
Do you have a list of CCK modules you use for your content type(s)?
A sample CSV file to import is always useful. Including how the content type is configured.
Other than that, the code is still somewhat in a flux so it's difficult for others to help out on short term.
Comment #60
cpill commentedRE: Robrecht Jacques
Hey I need this working with CCK, Location and possibly Ubercart for 3 different projects (2 of which are paid) so I offer my services to help you out.
I made wrote a similar module for Ubercart, which already had an XML Importer interface so I wrote a CSV -> XML which was then pasred and imported into Drupal/Ubercart. I made a similar API, supplying hooks to to integrate any/all other modules, I see you've come to the same design decision. I have tried to figure out what your API is but would feel better if you could give out a little info on which hooks are available and what their input/output is.
Perhaps then, myself (and others?) could start an effort to get other modules (and possibly their developers) to start integrating with it and speed up this development process. The alternative is that I will just take what you've done so far and start hacking into it to make it work for what I need it to and the code will be thrown away at the end of the job. Would seem like a waste to me.
Send me an message if your interested in my help.
Comment #61
Robrecht Jacques commented@cpill
Yeah, I need to write docs too. You can look at
supported/node_import.incwhich has some documentation, but maybe a more global document describing stuff would be better.Ubercart support is a long term goal, so if you could help me out with that, I'd appreciate it.
The XML format uc_importer uses is a lot more flexible than CSV. Maybe I should follow a similar path although the goal of node_import is to import tabular data right now. This means we have to do some strange stuff to allow for multiple vocabulary terms to be assigned to a node (eg
"term1||term2||term3"in 5.x). A XML format may be supported later on.Currently working on the -rc1 release... This will make clearer how to map columns to contain multiple values (such as terms). If you can wait another day, we can work together to get a cck, location and uc release out by the end of the week. The commit I'm working on right now extends quite a bit the API (to allow for taxonomy mainly).
Basically, for the wizard, following hooks are called:
The import itself uses following hooks to get a list of
values:
I'll create some documentation for developers after -rc1.
Comment #62
niklp commented@Robrecht
The stuff I'm using is listed here. I would suggest that implementing support for the more commonly used cck field types would be widely welcomed. These are listed in the order that I think is most appropriate.
Date
Email
Link
Node Reference
Number
Text
User Reference
FileField (tricky!)
ImageField (tricky!)
Also if support for content_profile and autoassignrole could be implemented alongside any support for importing users (even if only in the case of users as nodes) that would probably be a noble cause as well! :)
Comment #63
stewsnoozeYou should look at this patch that may allow you to do some stuff with maintaining nids on import
Enhanced data import - node_save() and user_save()
Comment #64
adam_b commentedRe #62: the only field type I'd like to add is "Content Taxonomy Fields". Even if it only handled a single value to start with, this would be useful for my selfish purposes...
Comment #65
niklp commentedContent_taxonomy isn't even clear in its instructions as to how it actually works. See my post here on that module: http://drupal.org/node/332454
Further to that, if c_t actually worked how it *said* it does, it would be possible to import the taxonomy as normal, which would be less complicated than importing the data as cck values (c_t's "alternative" (but seemingly enforced) storage method).
Comment #66
B747 commentedIs CCK support meant to work yet? Because it doesn't seem to with me...
Can you shed any light on this, please / give an ETA?
Regards,
heebie.
Comment #67
tomhung commentedsubscribe... awaiting CCK support
Comment #68
banglogic commentedSubscribing...
Comment #69
Gumk-1 commentedsubscribe... awaiting Ubercart support
Comment #70
cpill commented@Robrecht Jacques (#61)
Thats a good start with the documentation mate! Once you know what the hooks are and have an idea of what they are supposed to do then it makes sniffing them out of the example code easier.
I guess if you get some API doc out after RC1 then the "NON-Programmers" here can redirect their pressure towards the actual developers of the modules they want to see integrated with your fine work.
The hard part is now to figure out how CCK works so i can make an attempt at an integration. I just helped out on the imagefield_import module and got that working thanks to the code here: http://drupal.org/node/292904 which doesn't really give many insights as to what is happening under the hood of filefield but its a starting point.
Will check back in when RC1 comes out. I guess I'll be on holiday before any of this happen.
merry Xmas ppl :)
Comment #71
robbertnl commentedsubscribed, also awaiting CCK support
Comment #72
jcamfield commentedCCK and Location support is key to me; I'm anxiously awaiting information about this (and having one column of data being able to be applied to vocabularies would be a bonus; too!). Looking forward to having this working with the D6/Location3 setup! If you need some test data; I have ~1200 records with CCK, Event, 3 Taxonomy vocab lists, and Location data I want to import to a site I'm working on - I can set you up as a privileged user or just keep good notes of the process when the next release comes out.
Comment #73
cbosner commentedsubscribed
Comment #74
brip commentedSubscribe
Comment #75
juan_g commentedRelease Candidate 2 has been released yesterday (no CCK yet; maybe for RC3?). Thank you for the work.
Comment #76
darrellhq commentedSubscribe
Comment #77
MidGe48 commentedSubscribe
Eagerly awaiting CCK support for 6.x. I have 20,000 CCK nodes to import. I wish I could help bring it along, or help in anyway for that matter.
Thanks for all the Node-Import team efforts
Comment #78
aquamaureen commentedI'm a Node Import fan too! Eagerly and appreciatively waiting CCK support. Thank you for all you do.
In the interim I really had to find something that would bring in my thousands of CCK nodes. If anyone else is desperate I just tried Feed api + CSV Parser + Feed Element Mapper and it worked! I had to do multiple sheets to avoid memory errors, but I had to do that with node import too.
http://drupal.org/project/feedapi
http://drupal.org/project/parser_csv
http://drupal.org/project/feedapi_mapper
Comment #79
sockah commentedThanks Robrecht for all the great work on this module and thanks aqua for posting an alternative while we wait for CCK support. I'm going to try it now.
Comment #80
drupaloSa commentedsubscribing
Comment #81
daniel.hunt commentedSubscribing, and awaiting full CCK support
Comment #82
clivesj commentedAquamaureen,
could you eleborate a little on how tou did set-up those 3 modules to import cck-nodes?
Than you very much in advance.
Comment #83
arojoal commentedSubscribing, waiting full CCK support plus Location support.
Comment #84
portulacasubscribe, can't wait for cck, my fields of interest are text, number and image.
thank you aquamaureen for the workaround, I'll try it out.
Comment #85
brainski commentedSubscribing and waiting CCK Import too.. Thanks for all efforts!
Comment #86
petey318 commentedsubscribing - eagerly awaiting CCK text, date.
Comment #87
clivesj commentedSorry for becoming off-topic and poisening this thread. But in case you, like me, can't wait here's an alternative to import your nodes programmatically.
In my case the CCk fields where pretty straight forward. Writing an import script was easier for me then configuring feed.api (but i thinks that's because I dont understand feeds.)
In case you are interested:
In case there are questions about the code I suggest to open a new thread.
Comment #88
Chris CharltonDoes the roadmap need to be updated to mention CCK coming in another rc?
Comment #89
hvalentim commentedSubscribing. Eagerly waiting for support to CCK custom fields & location.
Actually, I was planning a site along these lines working for 4.7 (KML feeds and Gmaps with multiple markers based on Taxonomy) and had everything else settled when I finally came to the CSV import part and surprisingly found the last step met an obstacle.
Drupal seems to be an amazingly promising CMS but the lack of support for CCK custom fields & Location is definitely an Achilles' heel hampering its potential right now.
Comment #90
vidmarc commentedAlso awaiting CCK support - none of my custom fields are available in the "map file columns" step.
Comment #91
StuartDH commentedHi Clive,
Could you post some more info about doing it this way. Where do you put the csv file? If you have a content type for 'food' with fields for title, description, size, price etc. And is the final script above just added to the server as a php file that you go to the url to invoke the script?
Thanks
Stu
Comment #92
liliplanet commentedawaiting CCK support, thanx!
Comment #93
clivesj commented@StuartDH
I like to work with modules, so I wrote one.
It is very straight forward: Just a menu to call the function and the function itsself.
You can import your CSV-table into the drupal database. There are several way to do this. You can do it with a MYSQL function or by PHP or use PHPMyAdmin.
I use Navicat and that's really very easy to use.
You could also read the file from yor harddrive and import the nodes, like node_import does, but this way is easier.
The example puts a menu called "import food" into admin/settings. By selecting this menu the import will start.
You can call it also from the url: www.mysite.com/admin/settings/importfood
The difficult part is to find out how the data of your cck node is structured. You can use print_r to find out.
I like to remind you that this is really a dirty way to do the job. It works fine but remember to back-up your data.
Good Luck
Comment #94
juan_g commentedWhile waiting for Node Import's CCK support, there is also the workaround mentioned by aquamaureen on this issue, with CSV Parser and other modules. See also the handbook page Migrating to Drupal.
Comment #95
portulacaI was successful at importing data from CSV file into drupal CCK nodes using what aquamaureen suggested above #78 so this is now a workaround for me.
First I installed FeedApi and FeedApi_mapper and I was successful in importing some feeds and their components into CCK nodes and fields. I chose SimplPie parser as it offers more feed components to map.
Then I installed CSV parser and the only difference is you enter the link to the CSV file into the Feed field instead of the feed link.
It was a bit confusing reading the instructions at first so I'll try to give some useful info:
You need to have one content type to be a container of all the nodes to be created, and that container content type has to be "Feed enabled" (that's not the exact expression but you'll recognize it in the handbook when you get to it). I guess you can say that this content type resembles (or is equivalent to or something like that) the CSV file you're importing. I recommend using the already created Feed content type for testing it out.
The other content type is the actual result you want to achieve, CCK you probably already have and you're eager to get CSV data into it, this content type resembles (or is equivalent to or something like that) the rows of CSV data. This content type should not be "Feed enabled".
The rest shouldn't be too hard to get while reading the instructions, if needed I'll write a more detailed instructions of how I did it.
Sorry for hijacking the thread but this is just a workaround, as soon as CCK in Node import is available I'm switching :)
Comment #96
juan_g commentedAnother workaround -using the Node Import version for Drupal 5, instead of 6- has been mentioned by WorldFallz on the forum thread Importing data into cck:
"What I did was setup a bare d5 site with just the modules I needed for the import, then imported the data, and upgraded the site to d6."
See the CCK project page for details on updating from version 5.x to 6.x.
Comment #97
barry_fisher commentedLooking forward to CCK support. Many thanks. Subscribing...
www.reallifedesign.co.uk
Comment #98
juan_g commentedAbout importing into CCK, an additional workaround apart from the already mentioned modules (Node Import 5.x and upgrading D5->D6, or CSV Parser for D6, etc.) is the one suggested on this issue by others of developing custom PHP scripts. For those interested, there are for example migration tips with some techniques. I've just added a brief paragraph about this on the handbook page Migrating to Drupal.
Also for CCK, there is a recent related thread (alternatives to node_import?) on the support mailing list.
Comment #99
juicytoo commentedHi Robrecht,
I see rc3 is out. Does that mean CCK support is there?
also interested in cck Address field is that's possible.
Are there any work instructions on how to use this module?
ie. is there an example csv file or some doco.
cheers
Ed
Comment #100
juan_g commentedjuicytoo wrote:
>I see rc3 is out. Does that mean CCK support is there?
See the release notes: no support for CCK yet. I think that's currently under development by Robrecht. There are workarounds for the time being, mentioned on this issue.
Comment #101
yanivnizry commentedWaiting for cck support , Subscribing . thanks
Guzzus and Meikan
Comment #102
juan_g commentedA related issue is When to expect CCK imports for 6.x? This seems to be coming soon, at least partially for RC4.
Comment #103
petey318 commentedHmm. So now there's two threads for the maintainer to update.
<rant>did someone think that by starting a duplicate thread on this issue, that it would get resolved any quicker??</rant>Comment #104
niklp commentedMarked the other thread as duplicate. Everyone calm down! :)
Comment #105
timlie commentedsubscribe
Really GREAT module!!!
Comment #106
mattheweigand commentedi'm very much looking forward to CCK support as well.
Comment #107
rikvd commentedcheck out the repository, cck is available there. be carefull. no official release.
Comment #108
yurtboy commentedcould not find rc4 which I heard had cck. Any hints to where it is?
Comment #109
yurtboy commentedcould not find rc4 which I heard had cck. Any hints to where it is?
Comment #110
kenorb commentedsubscribing
Comment #111
acrollet commentedsubscribing
Comment #112
lbrown commentedI really need the ability to import products for ubercart. All the product fields including attributes fields and images are my main desires.
www.lenabrown.com
Lena
Comment #113
kevinwalsh commentedsubscribin'
Comment #114
doughold commentedsubscribing
Comment #115
rezboom commentedsubscribe
Comment #116
kepford commentedSubscribed and awaiting the CCK port
Comment #117
hansrossel commentedShould the dev release (http://drupal.org/node/328041) be tested? If so maybe should be put a bit more visible on the project page, with the remarks that it is unstable so it is easier to find? thx
Comment #118
Robrecht Jacques commented-dev releases should only be tested if you know what you are doing. If you know what you are doing, you'll find it. Because I want to avoid many issues on an unstable -dev release I prefer that the majority tests the -rcX or official releases. It is easier for me to have an issue on -rcX then "I have downloaded -dev on X feb and ...".
Comment #119
Robrecht Jacques commentedLet's split this issue up and set it as "duplicate":
Working on getting -rc4 out. It will include most of the above except probably the file ones (Upload, ImageField, FileField, Ubercart).
If you have any ideas on how to support file related modules, post them in http://drupal.org/node/374343 : Core upload module. My problem is mostly: how are the files uploaded (what directory)? Should there be an options to specify the directory? etc.
Comment #120
juan_g commentedI see Node Import 6.x-1.0-rc4 has just been released, with support for Profile, Location and CCK modules. Thank you very much!
Comment #121
kevinwalsh commentedYes, thank you!
I've done one test run with some data, and it looks like cck, taxonomy, location are working great. it's even doing automatic geocoding from the location data i'm feeding it, which i guess i wasn't necessarily expecting.
the only bug i've encountered so far was going "back" a page (from the field mapping step) and encountering a script that hung. let me know if you would like more details, i'll replicate it.
Kevin
Comment #122
Robrecht Jacques commentedNormally I don't read duplicate issues.
Node_import has to do fewer things then in 5.x because it programmatically submits the node creation form. Location acts on the submitted values and node_import gets this geocoding automatically. This is the advantage of the new design.
Of course, the problem is now to submit the correct values... which gives other problems all together (eg Drupal caching things it shouldn't) :-)
If you can replicate this all the time, I'd like to investigate this further. Although I have no clue right now why going from "Map file columns" back to "Set file options" would have the script hang. Create a new issue for it if you feel like looking into it.
Comment #123
jcamfield commentedGreat work Rob! I'm having an odd problem with a CCK checkbox field, I can't seem to get anything past it's illegal values field (even not importing data for it, and it's not a required field!) - I've tried a few options (using a value pulled from the DB, using a number, using NULL in the field, and it rejects everything.
Also, the default values page doesn't seem to list CCK fields; it'd be a lot easier to troubleshoot this if I didn't have to re-upload a file every time :)
Going back to the CCK field itself, I didn't have key values defined, adding in key|label values for these seems to have repaired the validation problem
Comment #124
a_c_m commentedmuch as i hate adding nothing with a "subscribe" comment, i really want to track this :) Promise to test at some point soon and feed back if i find anything.
Comment #125
alegacy commentedThis is something I need so I am subscribing too for CCK imports. I think if I really do need it then I will try it as it is but if not wil wait.
Comment #126
latte commentedCannot wait for this. CCK and Location import is soooo very awesome.
Comment #127
blup commentedsubscribing
Comment #128
Maccers commentedI think I'm in the right place. Trying to import Location data, but none of the location fields are showing in the node import wizard.
I'm new to Drupal and still in the process of finding my way around. I created the location content type using CCK. From what I understand node import supports Location but not CCK Location. How can I create a Location fields(long, lat and address) that can be used to display pinpoints on a google map, without using CCK?
Apologies if I should be raising this query elsewhere.
Comment #129
ckidowsubscribing
Comment #130
kenorb commentedComment #131
spl13 commentedThis event.inc in post #1 seems to have trouble with dates. Is there an updated version that works with the latest D6 Node Import module?