There seem to be two basic ways for importing and exporting product data: (1) Through CVS files and (2) through XML files. Here we discuss the first option.
When product data is available in a spread sheet or similar format, importing in Ubercart can be a suprisingly smooth process. Even when additional fields have been added through Product classes and the Content Creation Kit. The process described here has succesfully been used for Drupal 5.x/Ubercart 1.x, and chances are that it can be done with Drupal 6/Ubercart 2.x as well.
The process can be separated in three parts:
- Prepare product data
- Activate module
- Import process
Prepare product data
- It seems handy to use the first row of the spreadsheet for column headings: During the import process, Drupal automatically recognizes these headings and makes excellent use of it
- Your product data needs a column Shippable with an appropriate value for each product: 0, 1, yes, y, no, n (maybe there are some more valid values). When this column is absent, import will fail
- Most probably, the data you want to import contains fractional numbers, like in prices. Separators for decimal values should be periods ('.'). In case you live in a part of the world where this is different (typically ','), it is suggested to change this to period. (OpenOffice.org's Calc has a very easy function for doing this: Select the columns that need to be changed, choose Format Cells and change Language to something Anglo-Saxon)
- Export data to a CVS file. OpenOffice.org's Calc with the suggested default options, seems to work just fine.
- Import from a CVS file is handled by the node_import module. This module needs to be installed in the usual way
- node_import Seems to need separate descriptions for every content type that it is requested to import. Such a description is available for Ubercart and can be found at this posting. It needs to be uploaded to the supported directory of the node_import module at your web server. When this file is skipped, node_import can import only to basic node fields and custom added fields (created through CCK or other ways), but cannot import to Ubercart-specific fields, including the SKU field
- When Ubercart is configured for using something else as separator for fractions than '.', this needs to be temporarily changed back. Go to Administrator > Store administration > Configuration > Store settings > Currency format for doing so. The reason for this: it seems you cannot import with another separator than commas in the CSV file. When e.g., using TAB as separator value, you might get a WSOD (White Screen of Death). So, commas need to be reserved as separator for decimal fractions.
- Import is handled through Administer > Content management > Import content. This menu option is automatically created when the node_import module is activated
- Drupal remembers the active import settings, even when you leave the related pages. That provides for great flexibility while importing. This makes the import process a great opportunity for thoroughly debugging your content type definition
- When matching source and destination fields, an easy way to prevent mistakes is by giving the fields the same names