Importing CSV Files

You can import or update products in bulk using the Import CSV File tool accessed via the Catalog > Import CSV file menu item.

 

The sample CSV file used in the demo can be accessed via the Tools > Installation > Create sample CSV files menu item.

 

 

 

A CSV file is a text file that can be read by any standard text editor but this type of file is best read and edited  in MS Excel or other spreadsheet applications.

A CSV file contains data separated by commas (or semi-colons in many European countries), the ‘field separators’. Fields also may be contained in double quote characters.

 

The contents of a CSV file might look like this:

 

"Product Name","Quantity"

"Wood table",5

"Folding chair",26

 

Each line can only contain one product, which means that CSV files are unsuitable for storing descriptions.

The first line is reserved  for column headings. Store Commander needs this line to be present in all your CSV files in order to match the data with the appropriate fields.

 

To create a CSV file from an Excel spreadsheet:

With a PC: Select Save as… then CSV (Comma-delimited) in the file type drop-down list;
With a Mac: Select Save as… then CSV (Comma-delimited) or CSV (MS-DOS) in the file type drop-down list.

 

CSV files are used to exchange data between various applications in a simple format. You’ll save a lot of time if your suppliers can provide you with a list of their products in CSV format. With this file, you’ll be able to add the products to your e-store in no time thanks to Store Commander, plus automatically update your available stock if you’re working on a “just in time” or “drop shipping” basis".

 

 

 

 

The Import window is divided into 3 sections:

 

  • Section 1: Select the file to be imported.
  • Section 2: Select the data to be imported.
  • Section 3: Follow the import’s progress until its successful conclusion.

Section 1

 

This section lists the CSV files present on your server (in your /adminXXX/import folder).

 

Toolbar Buttons

 

 Refreshes the file list.

 

 Uploads a new CSV file to the server.

 Deletes the selected CSV files (boxes checked in first column)

 

 

Table Columns and File Options

 

  • First column: Check the boxes to select file(s).
  • Name: CSV file name.
  • Date: CSV file date.
  • Size: CSV file size.
  • Supplier: Store Commander allows you to specify a supplier’s name for the CSV file. If a product is created, this name will automatically be used for the supplier. When the CSV file is analyzed, Store Commander will only search the database for products from that supplier and check to see whether a similar product already exists. If two products have the same name, only the product from that same supplier will be updated.
  • Mapping: Allows you to automatically load a previously-saved mapping (see “Mapping” in section 2 below).
  • Field separator: This is the character, usually a comma, used to separate the fields in your file.
  • Value separator: For certain fields, such as categories or tags, you can specify more than one value, for example Wood table, Furniture|Living Room,5,19.6,8 (in this example, the product can be found in both the Furniture and Living Room categories). In Store Commander, the value separator is the pipe character.
    Note: Problems may arise when using CSV files compiled in countries where the decimal separator is a comma and not a period.
  • Force UTF8: Converts the data to UTF8. In short, if after creating a product with a name that contains accents you see hieroglyphs in the place of accents, this option must be changed and the product re-imported.
  • Identify products by: For each line in your CSV file, Store Commander searches for the corresponding products in the database (and carries out the action specified in the following option). Specify the field search criteria in this box. Each product must have a unique identifier (its name, reference etc...). If the database contains two products with the same identifier, only the first one found will be updated.
  • If product exists: Specifies the action to take if a product with the same identifier is found in the database:

 

  • Skip: SC ignores any products already in the database; products that do not exist are created;
  • Create new product: SC creates a new product for each line: combinations occupying several lines in the CSV file are ignored;
  • Replace product properties: SC does not create a new product and modifies the existing product. If the CSV file contains fields (columns) specifying combinations, SC will create the corresponding combination(s) for the product.

 

 

 

Examples:

 

You want to import some new products from various suppliers whose references are always different:

 

Supplier: Empty

Mapping: Empty

Identify products by: Reference

If product exists: Skip

 

Result: If identical products are found, they are saved to the yourFile.TODO.csv work file to be processed before continuing with the import.

 

You want to update the stock availability for products from the supplier “yourSupplier”:

 

Supplier: yourSupplier

Mapping: yourMapping (the mapping saved previously when you imported the products; no need to re-enter the CSV file à database field links).

Identify products by: Reference

If product exists: Replace properties

The mapping is loaded automatically. You can de-select fields other than “Reference” and “Quantity” if you only wish to update these values (remember to save this mapping for future use).

 

Result: The stock availability for products from this supplier is updated.

 

Section 2

 

A mapping is a set of links between the fields in the CSV file and those in the database. When a CSV file is selected in section 1, Store Commander analyzes the file and displays the list of its columns. For each of these columns, a link needs to be made with the associated field in the database.

 

If you use the sample CSV file provided, Store Commander makes this task even easier by automatically detecting these connections.


 

Toolbar Buttons

Loads a mapping.

Saves a mapping.

 Deletes a mapping.

 

lightbulb Note: Technically, the mapping is saved as an XML file, in the same location as the CSV file.

 

Table Columns; Links between the file and the database

 

Use: Check box to include this field on import.

File field: Column name in the CSV file.

Database field: Name of the associated field in the database.

Options: When the field requires an option to be entered, the table cell is shown with a dark blue background. Options can include for example the languages for the name field, meta_title field etc.

 

Field Specificities

 

  • Name: This field is mandatory when creating products.
  • Default category: If found, the product is placed here; otherwise, a new category named yourFile.TODO.csv (same name as the work file) is created and you will need to allocate the products to the appropriate categories by dragging and dropping them in Store Commander.
  • Categories: You may specify several target categories for the product by using the value separator (see section 1)
  • Price inc. tax: If you use this field, you also must use the Tax field for Store Commander to be able to calculate the pre-tax price.
  • On sale: Indicates whether or not the product is on sale; possible values: 0 or 1.
  • Availability if no stock: 0 => Refuse orders; 1 => Accept orders; 2 => Use e-store settings.
  • Special offer from/to: Store Commander automatically converts all date formats ("yyyy/mm/dd","dd-mm-yyyy",...)
  • link_rewrite: If this field is not specified, it will be created automatically with the product name
  • Tags: You may specify several tags using the value separator (see section 1).
  • ImageURL: Two possibilities: either enter a full URL linking to an image (e.g. http://www.storecommander.com/mypic.jpg), or upload the image to the server and place it in the "/adminXXX/import/images/" folder and enter its path from that folder. For example, if the field value is "house/house01.jpg", Store Commander will search for the image at the location “/adminXXX/import/images/house/house01.jpg". Since each image needs to be resized several times, importing with images is very time-consuming. We recommend you proceed in two phases to avoid overloading the server: first import the products without their images, then re-use the CSV file to import the images, lowering the number of lines to import in each batch.

 

 

Section 3

 

 

Toolbar Buttons

 
This switch, when on (orange background), creates new categories: If the categories in the CSV file do not exist in the database, you can click this button to have them created automatically. By default (off – blue background), products without a category are placed in a new, hidden category with the same name as the imported CSV file. Categories are created by detecting the paths: if “Menswear > Shirts" is the path for a default category, Store Commander will test the path and, if necessary, create the “Menswear” and “Shirts” categories then insert the product.

Sets the number of lines to import. If you wish to process the file in batches, change this value. If you are importing images, the process takes longer, so it’s better to lower the value to allow the server time to process all the data.

Imports the file. In other words, the "Go" button!

 

Import Result

 

It’s worth pointing out that, generally speaking, imports don’t work perfectly first time round. But don’t panic!

 

Firstly, Store Commander creates a work copy of your CSV file named yourFile.TODO.csv. Each time a line is successfully imported, it is deleted from the work file. The lines that remain in the file are those that are causing problems or haven’t been processed. These lines can be edited manually to complete the import without having to start over again. If you prefer to revert to the original file and no longer wish to use the TODO.csv work file, you can delete it. It will be re-created from the original CSV file.

 

Next, Store Commander analyzes the data in your file and offers to create certain item such as suppliers, manufacturers, features etc. that do not already exist in the database for a hassle-free importation. You can then fill in the rest of the information later.

 

After fixing a glitch, click again on the Import button in the toolbar to display any further instructions. Continue doing this until the message appears confirming the successful importation.

 

 

 

 

Reminder: PrestaShop deals with combination prices by recording the difference between the combination price inc. tax and the basic price inc. tax. For example, if the basic price is € 10 inc. tax and the combination price € 12 inc. tax, a value of 2 will be recorded in the database. Therefore, it’s important to enter the applicable tax rate as soon as combinations are created to make sure that this difference is calculated on the price inc. tax and not the pre-tax price.

 

The mapping options allow you to create the following items:

  • Combination attribute: the column in the CSV file contains an attribute for the combination to be imported;
  • Combination attribute – multiple values: the column in the CSV file contains attributes for the combination to be imported, separated by the field separator referred to in Section 1.

 

How does importing with automatic combination creation work?

 

Let’s take the following CSV file as an example:

 

1. Product Name, Color, Size

2. Leather shoe,beige, 8

3. Leather shoe,beige, 9

4. Leather boot, brown, 8;9

5. Leather boot, black, 8;9;10

 

In this example, we’ll choose to identify products by their names using the following mapping:

  • Product Name: Name field, FR
  • Color: Combination attribute field, Color
  • Size: Combination attribute – multiple values field, Size

 

During importation, Store Commander reads the file line by line:

 

Line 1: Contains the headers used to identify the columns.

Line 2: This is a new product with columns relating to combinations; Store Commander creates the product and the associated combination.

Line 3: A product with the same name has been found in the database and the mapping contains combination attributes; Store Commander understands that these are combinations to be added to the existing product.

Line 4: This is a new product with columns relating to combinations; Store Commander creates the product and all the associated combinations by “multiplying” the colors by the sizes. We shall end therefore up with a Brown Size 8 combination and a Brown Size 9 combination.

Line 5: A product with the same name has been found in the database and the mapping contains combination attributes; Store Commander understands that these are combinations to be added to the existing product and the application automatically re-creates them.

 

If you have specific requirements, we can provide customized tools tailored to your needs.

Please don’t hesitate to contact us to turbo charge your data processing!





Related article(s):