Drupal – Import Script

Drupal – Import Script
-Need to implement a script for Drupal6 to import cck data from a file.
-You can use the following links links as a guide:
-A script should be intelligent enough to update a record, instead of inserting,
if a record with the same primary key already exists.
-A primary key field is one of the cck fields, present in an import file.
-Certain cck fields are multi-value, ie contain an array of values.
-As far as I understand, a custom module with this script should be created (I may be wrong)
-The file format is tsv ( tab delimited) ,but I’ll be happy if an xml import format can be implemented instead without increasing the cost of development
-delimiter for values in a multi-value field is a pipe “|”
-the script should fill in all system fields ( type, created, date, format, log etc)

use case:
– a user gets to the page, e.g. cck_upload.php
– an import file already resides on the server side, accessible by a php script
– an input field with a default full file name(eg /var/www/drupal/import.tsv) and an “import” button is displayed
– a user clicks a button “import”
– a script goes through a list of records in a file, and either creates objects or updates existing ones
– create an log file in the same directory as an import file with a log message for each – for each imported record there should be an output of its primary key, status (imported/not) and an error if a record is not imported. the name of the log file can be just “the name of the import file”.log

cck data type:
id ( cck field, primary key)
title (a standard node field)
body (a standard node field)
field_product_small_image (an cck field)
field_product_features (an cck multi-value node field)
taxonomy ( a standard node field)

One last note: I’m looking to establish a long-term relation with a developer(s),
because this is just one of many features I need to develop for a new product reviews website, which is based on Drupal

Leave a Reply

Your email address will not be published. Required fields are marked *