Published on Monday, 23 January 2012 13:05
- CSVI 4.0+
- VirtueMart 2.0.2
- Joomla 2.5+
- PHP 5.3+
Creating the template
First we will create an import template in which we can store all our preference. Let's call the import page:
- Go to Components
- Go to CSVI / CSVI Pro
- Click on Process
Now you are on the process page, this is where the import and export takes place.
It's time to tell CSVI what you like to do, under the Manual import/export set the following options:
- Product Import
finally click on Go.
You have now told CSVI that you want to do a product import for VirtueMart and CSVI loads the settings for this specific import.
Click on Save as new to save your template and give your template a name. There is a separate tutorial that explains how to manage your templates.
The template has now been created.
Setting the file options
The next step is to tell CSVI something about the file you want to import.
- Auto detect delimiters
If your CSV file is using both the field delimiter and the text enclosure. You can set this to Yes otherwise it must be set to No and you can specify your own delimiters.
- I'm Mac
This is only needed if you are using a Mac computer and your file might be using Mac line-endings as opposed to Windows or Linux line-endings.
- Use headers/nodes as configuration
CSVI can read the fields you want to import from 2 locations:
- Import file
- Template fields
If you set this to Yes, the first line from your import file will be used to read the fieldnames you want to import. If you set this to No, CSVI will use the fields you have specified on the fields tab. Important: the field names in your file must be valid CSVI fieldnames. Set this to No now for this tutorial.
- Skip first line
This can be used if you let CSVI take the fields from the template and not from the file and your file has your own column headers.
- Overwrite existing data
Overwrite existing data will overwrite all fields set in the import file for each product. If you set this to No, any existing product will be skipped if it exists.
- Ignore non-existing items
If set to Yes, ignore non-existing items will not create any new products.
- Skip default value
Default values set on the fields tab will not be used when set to Yes.
- Collect debug information
This is a very important option. Setting this to Yes will tell CSVI to create a detailed log of all steps taken during import. This is a very useful report to find any potential problems. Whenever you post a question on the forum, make sure you post this file also. It is the only way to help you out. The How to collect debug information article explains this in further detail.
Now that the file options are set, CSVI knows how to read your file. Click on Save to save your changes in your template and make sure they don't get lost.
Adding the fields
In this tutorial we are going to import the following fields:
To know what these fields represent have a look at the Visual Available Fields category.
Do not use fields that end with _id, for example virtuemart_product_id/virtuemart_category_id.
Let's tell CSVI which fields you want to import.
- Under the Field name column, select the first field in your file, product_sku
- The other options we leave empty as they are fine
- Click on the + symbol
- Repeat step 1 - 3 for all the other fields
When you are done you have 4 fields here. To make sure we don't lose anything, click on Save again to save your template.
Fine-tuning of the options
The last step is to fine-tune our import settings.
In VirtueMart 2.0.2 it is necessary to choose the language for which you want to import your product descriptions. Before you can do this, make sure you have set in VirtueMart which languages you want VirtueMart to support. You can do this in the VirtueMart configuration.
- Category separator
The default value is to separate categories and sub-categories with a /. In case you are using something else, you can change that here.
- Append categories
If you want to add more categories to existing products but not delete the already existing categories set this option to Yes.
- Import based on
By default CSVI updates products based on the Product SKU. It is not recommended to change this unless you are sure what you are doing. You can check the tooltip for more information.
- Unpublish products before import
If you are doing a complete new product import and don't want old products to remain available. You can set this option to Yes and CSVI will unpublish all your products before it starts importing new products.
- Use ICEcat data
If you have an ICEcat account and would like to get product information from there, set this option to Yes. Make sure you have fulfilled all other ICEcat requirements too.
This completes setting up the template, click on Save 1 more time and now your template is ready for import.
Creating the import file
With the template ready it is necessary to create our import file. You can create your import in almost any kind of spreadsheet or text editor. There are a few things to look out for though. The file must:
- be UTF-8 encoded
- have correct delimiters
Let's create our CSV file. We are going to import a hammer with the product SKU H01 and we have categorized it as Hand Tool used to be Indoors.
"H01","Hammer","Hand Tool/Indoors","A great hammer to let out all your frustration","Y"
Save these 2 lines in a file or download the file by clicking here.
With our template configured and our file created, we are ready to import.
On the source option we will load the file from our computer. Click on Browse and select your import file. The last thing that remains is to click on the Process button in the top right hand corner.
When the import is done you will see a screen like this:
Here it says Updated but that can also be Added if the product doesn't exist yet. There you go, you have succesfully done a VirtueMart Product Import.
The next thing you can do is, experiment. There are a lot of more features in CSVI you can use for example:
Other good sources of information are: