4. Importing Products
This section describes how to perform products import to osCommerce from .csv file - bulk update of products.
Pay attention to each Wizard's page when import products to osCommerce. osCommerce Import is a rather complicated procedure and it may be destructive if performed incorrectly. Create database backup before importing products, especially if you do it for the first time.
To import products to osCommerce follow a few steps:
1. First of all prepare a .csv file for osCommerce Import. Make sure that all the necessary fields and data you'd like to import are listed in the table.
Product ID - is an internal database field. It should be of numeric type only and must have unique values across the entire table. The value from .csv file will not be imported from the file or changed at your store as it should be assigned automatically by shopping cart itself (other database tables can have references to this field pointing to specific products). During the osCommerce Import, ID can be used for identifying products only. Check more about product identification below (step 6).
Model (SKU) - is a standard, alphanumeric string that uniquely identifies the product. It is assigned to the product by manufacturer according to the procedure and is used internationally. You should be able to receive the standard code for all your products from your supplier easily. Just contact your supplier with this request. This field should have unique values and may be used for identifying products during the osCommerce Import, see step 6 for more information about product identification.
In Stock - this field acquires "0" or "1" value only. It states the availability of the product. For example, value "1" means that product is available in stock. In case it has "0" value, then the product is not available for purchasing and will not be displayed at your Store. In case you skip this column, your products will be set as out of stock and will not be shown at frontend of your store. To set in stock status for all products, please indicate 1 value for first product in your .csv file and expand it for all products.
Price - the product price is the cost of the product before taxing or shipping. Do not include any rebates, coupons, or bulk discounts. Prices should consist of whole numbers with a maximum of two decimal places. Price fields are numeric; no text is permitted. Do not include “$” or any other symbols.
Category - specify the category your product belongs to. If the product should be imported into subcategory use pipe character "|" to separate parent and subcategory, for example: "Computers|Keyboards" - the product will be assigned to Keyboards category.
If you need to assign the same product to multiple categories, use double delimiter, in your .csv file. Here is the example: "Computers|Keyboards||Computers|Other". After that the product will be assigned both to Keyboards and to Other category while import.
In our case Pipe is used as category delimiter. Category delimiter character should be specified on the 5-th step. It is used to separate category names and specify full category tree path for given category. Category path is very similar to directory path and is used to specify full file name in Windows, where every directory separated by backslash (\) character, like in the following example: C:\Program Files\eMagicOne\Store Manager for ...\
In case your supplier provides you with the file that has categories in a separate columns, you can merge them to get appropriate format using Expressions field or you can merge them using Excel manually. Please follow these steps to merge categories using Expression field (is recommended to use with osCommerce Automated Product Import):
- At the fifth step “Assign .csv Columns to Database Fields" of osCommerce Import Wizard find the “Category Name” field
- Set the following expressions for this field:
- CONCAT([CSV_COL(1)], '|', [CSV_COL(2)], '|' , ... , [CSV_COL(N)])
- where: [CSV_COL(N)] is the separate column of .csv file with the category name (N is the column number or sort order)
'|' - is category delimiter (which has been chosen at the previous step)
3. Complete the osCommerce Import and check categories
In order to merge category columns in Excel, please, use the following formula:
| - is category delimiter
B2 - is your parent category column in .csv file and
C2 - is sub category column in .csv file.
Product image - allows you to import images for the product. You can choose where you would like to upload images from - your local computer or external web URLs. Please note that in order to import images you have to set-up a proper FTP connection. Please check these articles: how to upload images from local pc , how to upload images if you have external image URLs if you need help.
Attributes - Store Manager requires a specific formatting for product attributes. You are welcome to export a few products with attributes and you'll see the format. Also you can see an example below. Please note that you can use Excel to merge your attributes in case they are in separate columns. You're welcome to contact your administrator for help or ask Google for help.
Also you can import attributes from separate columns of .csv file. Please, note that it is convenient to use if you are updating products from supplier .csv file. In case you are importing products from one store to another one, you can use default system of attributes import, where attributes specified for each products in separate row, not in columns.
Click here to see a sample of correctly configured .csv file. If you cannot download the file, see the attached one at the bottom of the page.
If your vendor provides you product list in Excel, you can convert your Excel files to the CSV format by means of the Microsoft Excel or OpenOffice application, using the Save As option. Then you can access the Save As dialogue box, which contains a list of alternative file formats. Among the file extensions offered, you can find Text CSV file format. By saving your file into CSV format, Microsoft Excel or OpenOffice will export the first active worksheet with the correct delimiters.
2. To start osCommerce Products Import you need to click on button that starts the Import/Export Wizard. Select "Import" and click "Next >" to proceed.
3. Specify the .csv file path and name or use browse button to select one.
Also you can load osCommerce Import Settings that were saved earlier for the .csv file with the same format (file that includes same columns in the same order).
4. Source file preview shows a part of .csv file selected to import. There are no options to set, but you should pay attention to the option fields delimiter and quote character, if any is used.
If you carefully check the very first line of the example, you'll notice that some words enclosed in quotes (") and are separated by comma (,) symbol. That are two important options you have to pay attention to - you will have to setup these settings on the next page. Usually it is enough to see first line, no need to investigate the entire file.
Also you can enable and set the row # you want to start import from.
5. Select fields delimiter and quote character. If you specify wrong values, import may not work.
Delimiter character - is the delimiter that is used to separate values (columns) in the .csv file. Most popular delimiters are comma (,), semicolon (;) and tab character ( ), however other symbols can be used as well. On previous sample page we have noticed that comma symbol was used as delimiter and values were quoted with " symbol. Specify two first settings as shown above.
Note .csv file contains data in row - column format and delimiter character are used to separate one column from another. If you specify incorrect delimiter, file will not be parsed properly and categories will not be imported.
Category delimiter character- we've discussed it on the first step when we prepared .csv file. As you know categories are organized in a form of tree, where parent category can contain one or more subcategories, and subcategory can contain one or more other categories. Category delimiter character is used to separate category names and specify full category tree path for given category. Category path is very similar to directory path used to specify full file name in Windows, where every directory separated by backslash (\) character like in the following example: C:\Program Files\eMagicOne\Store Manager for osCommerce\.
As for example category path Hardware|Graphics Cards allows you to assign product to Graphics Cards category, where pipe (|) character is used as separator.
osCommerce Image Import Options
- Upload images - Enable the option in order to upload images to you server via ftp. Please make sure that you have specified correct FTP defails in Tools -> Preferences -> FTP tab.
- Apply default settings to all images - option allows you to configure default settings to all images.
- Default Images Path - Can be used only for images or product descriptions in combination with "Is External" option. If image name or description file name are incomplete i.e. they do not contain full path including drive letter or "http:// prefix along with domain name (for images only), this default path will be added to image or description file path. If image name or description contain full path, this option may be ignored unless you checked "Keep file path" option (for images only). You can specify local directory path here or HTTP directory URL ("http://www.someimagestorage.com/images/products/ )
- Images Sub Folder - Allows to set path to Images Sub Folder at your FTP.
- Keep Image File Path - Allows you to keep image path and upload images into sub folders. It should be used with Default Images Path option. For example, specify default images path the following: C:\temp\Images if your .csv file contains full image path on your local PC like C:\temp\Images\imagesubdirectory\imagename.jpg and where \imagesubdirectory is the images sub directory(eis) that you would like to create on your server and upload images to. Also names of subdirectories should match the sub directory(ies) on your local PC (where images are located on your desktop).
- Default resize rule - Allows you to specify resizing rules for images.
6. The next page allows you to Link columns from .csv file to appropriate database fields.
First row in .csv file contains field names, but not values - Obviously it should be checked if first row of .csv file contains data, otherwise uncheck this option.
Products Identification Method - It is the topmost option as import will search for a product using selected method of identification. The product will be modified if found, if not - new product will be added. Lets say you choose option Identify Products By Product ID . How it is performed:
1. osCommerce Import takes first row of the .csv file and retrieves value from a .csv column assigned to Product ID field. As you can see above, the Product ID field is assigned to the 1st column from your file and the value is "1"
2. osCommerce Import tries to find product with ID of 1 in your store:
- If product is found it will modify it and set all values from .csv columns of the first line to assigned fields (even if you have let's say some Camera or Keyboard saved under the 1st ID, it will set values from your .csv file). Note that this method cannot be used if IDs in your file are different from the ones in your database.
- if product with ID 1 is not found it will create new product, assign ID automatically (let's say you already have 983 products in your database, so the ID for this product will be 984) and set all values from assigned columns to that new product.
The same is true for Product Model and Name + Model identification methods, except that model and name can be updated in your database from your .csv file.
Note: It is required to assign .csv columns to key fields depending on identification method.
Important Note! Source .csv file can contain multiple records with identical data for identification values (for example same model number for multiple products). All these products (with same ID or Model) will be considered as one. Currently imported to shopping cart product will overwrite previously imported with the same key field values. Note that sometimes one of key fields may be blank. Obviously blank fields contain the same value for all records, thus only one prouduct will be updated.
Database Fields show the list of fields in your database that can receive import data. Database Fields contain such columns:
- Name - contains database field name. Some values in this column contain actual field name, whereas the other are "translated". Anyway these names are clear enough to figure out how to use them.
- csv column - denotes the number of the column in .csv file corresponding to this field - the link between database field and .csv column.
- Set Null - indicates that this field should not contain any data, but should be set to Null. You can either specify column name or check this option, but not both of these actions at one and the same time.
- Set Default - used to set some default value to a field, similar to Set Null, but in this case some value can be assigned to a field.
- Default - enter the value assigned to a field.
- Expression - can be used for calculations while import. It is a good idea to use expressions to calculate the price (add 20% to your supplier's price), add quantity to your current stock (add new products to your current stock), etc. Please see an article for details.
To assign .csv column to database field you should select a field at the left pane and then click a column at the right pane.
[Auto Fill...] button - try to set correspondence automatically for all fields. Auto fill option will work only if .csv column name is the same as database field name ("translated").
[Clear] button - clear all "csv col" values at the left pane.
Click "Next" if you're done.
To import attributes from separate columns you should create additional attribute field for each attribute. Once it is created, you will get 4 additional options: Option, Value, Prefix, Price. You need to assign attribute value, prefix and price for each attribute column of your file to appropriate attribute options of database in each additional field.
7. Base Formats and Separators are used to convert text values from .csv file to numerical and date values. You can just set default values using an appropriate button.
8. Products were not imported to your osCommerce database yet. On osCommerce Import Preview page you can see how .csv file was processed using import settings, which you specified at previous steps. Check whether all columns that you want to be imported are filled with data: some of them may be blank. It means that either you haven't assigned .csv column or it is empty in source (.csv) file. Columns that were not assigned will not be imported whereas empty values will overwrite existing.
If red blinking arrow appears, it means that some errors occurred and you have to fix them.
Also you can enable and set the row # you want to start import from.
9.OsCommerce Import options page settings may affect Import results. Please read and check your selection carefully.
- Default category. If category name is specified in .csv file and column is assigned to database field, Store Manager will create entire category tree for a product. If there's no "category name" column (in .csv) or it is not assigned, all products will be imported to a category specified as Default. If default category is not specified and there's no other way to determine into which category products have to be imported, the program will create "Default category" and place all new products there.
- Default manufacturer is set almost the same as for category, except that product may not have manufacturer at all (it is obligatory). Also you can uncheck option in case you do not want to create new manufacturer if currently imported does not exist in database.
- Delete existing attributes when importing new - if this option is checked, import will clear all current product attributes and then add new. If unchecked, it will just add new attribute - this may cause attributes duplication.
- Delete products that are not listed in .csv file - allows you to clear database and delete products that are not listed in your .csv file.
- Mark unlisted products as "Out of Stock" ( in osCommerce and CRE Loaded this is "In Stock" property of a product) - all products that were not affected by import will be marked as unavailable, but will not be deleted.
- Create new product using ID from source file (Not recommended) - allows you to import products with their original IDs.
- Cache import data - this option may speedup import process. How does it work? Store Manager does huge number of database operations while importing products. There are many tables affected by import and a lot of data that should be processed. With slow database connection it may take too long - several hours or even days - depending on the number of records and connection speed. If cache option is checked, Store Manager will generate database backup file - the same you can do using Backup/Restore wizard with "Product related tables only" option. After the backup is generated, program restores this backup on local database. All further osCommerce import operations will be made locally, much faster than through remote connection. After osCommerce import is completed, it will generate another backup - from local database and then restore this backup on your remote store.
- With "Cache import data" option import procedure will show several backup/restore progress dialogues - this is normal behaviour.
- Note: Cache import data option ignored when currently connected to Embedded database.
osCommerce Import Method
- Add and Modify - method will add new product if it is not available in database yet and modify the products that were found
- Add Only - this option only adds new products
- Modify Only - the method only updates the existing products and does not add new entries, even if current product was not found
- Just Add - this option may produce product duplicates, since Store Manager will not try to find existing products, but will only add all products as new ones
Save osCommerce Import Configuration
All import settings can be stored under some configuration. You can load it next time you decide to import products from a file with similar formatting, column names etc.
Attention! osCommerce Import process will start, when you press "Import" Button! Proceed only if all settings are made, otherwise press "Back" Button and check the settings once more!
10. On the last step of osCommerce Import Products Wizard you will see whether any errors occur during import. Also you will see logs with details.
Most frequent import errors are date, time and number conversion issues, caused by invalid format settings (specified at the previous pages) or improperly assigned columns (i.e. if you assign column containing text data to numeric database field).
Date/time conversion errors might be ignored, whereas other errors (like this one Could not find image: image_name.gif) have to be fixed.
If you need assistance with osCommerce Import configuration, we'll gladly help you to setup everything correctly for additional fee. Please contact us at contact[at]oscommerce-manager[dot]com for details.
Here are some related articles on osCommerce Import: