Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Importing products from text files

17/04/2025, by Ivan

Manually adding products is acceptable if your store has only a few items. But what happens if you have hundreds or even thousands of products? This method is time-consuming and not very efficient for large stores. Consider that if you have 10,000 products and inserting one product takes about five minutes, it would take approximately five working months to complete the process. You would also face issues like slow internet connections or command errors. That’s why the best solution is to import products from a text file. You can import products from three file types: comma-separated values, semicolon-separated values, or tab-separated values. A comma-separated values file (CSV) stores the contents of a table or list. The CSV file format represents a table row as a line of text with fields separated by commas. For example, if you have the following table:

Drupal Ubercart import CSV

Here’s the CSV representation of this table:

"Name","Category","SKU","Price"
"iPod Nano","iPods",100001,"199.99"
"iPod Classic","iPods",100002,"249.99"
"iPod Shuffle","iPods",100003,"79.99"

SSV files use a semicolon instead of a comma, and TSV (Tab Separated Values) use tab characters. We'll use CSV files in our example, but the process is the same for the other file types.

Before you can import CSV files into Ubercart, you first need to install the Node import module. Here’s how:

1. Visit http://drupal.org/project/node_import and download the Node import module. Choose the latest version for Drupal 6.x. You’ll also need to download the modules that Node import depends on — Date and Advanced help. Download the Date API module from http://drupal.org/project/date and Advanced help from http://drupal.org/project/advanced_help.

2. Unpack these files and copy them to the sites/all/modules folder.

3. Go to the modules page and activate Date, Advanced help, and Node import.

4. The content import page is available at Administer | Content management | Import content.

Drupal Ubercart import content

There are three tabs on this page:

  • List shows all created imports and uploaded files. You haven’t created anything yet, so the lists are empty.
  • New import opens the import wizard. We’ll get back to it shortly.
  • Settings opens the configuration page.

Before starting an import, click Settings to view the configuration page.

Drupal Ubercart import CSV settings

  • Import directory: where you can upload your CSV files using FTP or the import wizard.
  • If you want to upload files via FTP, check Allow FTP uploads.
  • For security, if you allow FTP uploads, also set an owner file in the next field. Otherwise, uploaded files will be accessible to anyone, even anonymous users.
  • Allowed extensions defines which file types are allowed. All others will be ignored.

For your store, you don't need to change anything, so just click Save configuration to return to the previous page. Before we explore the import wizard, let’s take a closer look at CSV files and the correct structure needed for import.

The easiest way to create a CSV file is to use a spreadsheet editor like Microsoft Excel or OpenOffice. These apps save files in their default formats, but you can easily export them as CSV. Entering data into a spreadsheet is much faster than working directly in Ubercart. Of course, the biggest advantage is if you already have a database in another application, you can convert it to CSV and import it into Ubercart.

In your spreadsheet, each row represents a product, and each column represents a product property. Remember how we created a new product? You need a separate column for each field in that form. Your store won’t need all fields, so you’ll only use the most important ones. For example, I created this table:

Drupal Ubercart Import CSV Excel

Save the table in CSV format.

Drupal Ubercart Import CSV Excel Save

The table has six columns: SKU, name, description, category, price, images. You can create a similar structure in your app and save the file as CSV. The last step is to upload the product images to the server. Using an FTP app, upload all files to sites/default/files. As you can see in the table, we use a new folder named import to separate these images from the rest. By default, images go into the root of sites/default/files. If you add your images to the products folder inside files, change the image path column to use the prefix /products/036.jpg.

Once the CSV file is saved and images are uploaded, go back to Ubercart and click New import to begin.

Drupal Ubercart Import CSV Excel Import

The introduction page shows info about this procedure and displays main buttons. Read through and click Next.

1. On the first page, select the content type you want to import to your site. Choose Product and click Next.

Drupal Ubercart import CSV Excel Import Products

2. On the second page, you need to select and upload your CSV file. If you have uploaded files, they’ll be listed. Select the file you want to use. To upload a new file, click Browse, select the file, and upload it. Once uploaded and selected, click Next.

Drupal Ubercart Import CSV Excel import choose CSV file

3. On the third page, you can set basic file settings. First, choose whether the first row contains column names. In this case, it does, so leave it checked. Then, select the file format — you made a CSV, so no need to change anything. At the bottom, you’ll see sample data from the first four rows.

Microsoft Excel usually saves CSVs with semicolons, while OpenOffice uses commas.

Click Next.

You might see an error like:

Fatal error: Call to undefined function uc_product_node_is_product() in uc_product.inc on line 15

In that case, visit the Ubercart forum for the solution:

http://www.ubercart.org/forum/bug_reports/12843/csv_import_step_3

On line 15 of node_import\supported\ubercart\uc_product.inc:

Replace

uc_product_node_is_product($node_type)

With

uc_product_is_product($node_type)

Drupal Ubercart Import CSV Excel Import delimiter choice

4. On the fourth page, match the file columns to product fields. If you used the suggested headers, the import module should auto-match the fields. Still, check each one to ensure 100% accuracy. If something’s off, select a different column from the dropdown. When ready, scroll down and click Next.

Drupal Ubercart Import CSV field map

5. On the fifth page, you can set some advanced options. You can leave them unchanged. Click Next.

Drupal Ubercart Import CSV page 5

6. On the sixth page, you’ll see default values. These are used when a field is missing from the CSV. If a product field is absent, you can set a default value. Click Next.

Drupal Ubercart Import CSV defaults

7. On the seventh page, you can review the import batch. Carefully inspect the queries to check for errors. If all is well, click Next.

Sometimes you may face encoding issues. The import file must be in UTF-8 encoding. MS Excel saves CSV files in ANSI by default. This can cause garbled characters:

drupal ubercart Import CSV encoding issues

If everything looks good and there are no issues, you can upload your price list.

Drupal Ubercart import CSV product import

8. Now we move to the eighth page, which is the final step before import. You can review key settings and some data samples. Click Start import to proceed. Once complete, you’ll see a report showing imported rows and errors. If you no longer need the CSV file, it’s best to click Delete and remove it from the server.

Drupal Ubercart import CSV start import

Now that the product import is complete, you can view the error report:

Drupal Ubercart Import CSV result

Success! Errors often occur during import, but don’t worry — they’re common, and many are discussed on forums. So with a little Google help, you can find solutions.

Now, on to the catalog — voila:

Drupal Ubercart import CSV successful upload