Background information
This tutorial will explain how to import params field for a category with the K2 category import. For now CSVI supports two params fields as individual available field for import and export, they are inheritFrom and theme. This tutorial will explain how to handle these two fields in import.
Open CSVI
Go to Components -> CSVI Pro and click on Templates tab -> Templates. You are next going to create a template for k2 the import/export.
Preparing the template
The next step is to create a template for import.
On the templates page, click on new and add the name of the template, say for example "K2 category import".
Under Operations select the following:
- Select Import
- Select K2
- Select category import
- Enable logging
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.
Save the template by clicking on Save or Save & Close.
Adding the fields
The next step is to add the fields we want to import to our template. To import category params category_path field is a required field, the other param fields can be added as a single available fields
- category_path
- inheritFrom
- theme
Let's tell CSVI which fields you want to import.
- Under templates tab, select templates fields or you can even add it by selecting the template , under fields tab, click on "Edit template fields" button.
- Select the field name and other options we leave empty as they are fine
- Click on Save or Save & Close or Save & New on top corner.
- Repeat step 1 - 3 for all fields
- Set the order of the fields in the Order column.
To make sure we don't lose anything, click on Save to save your template field.
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 this item.
"category_path";"inheritFrom";"theme"
"News/Discounts";"news/local-news";"blog"
Save these 2 lines in a file.
This structure is found in the category_path field where each category is separated by a / (forward-slash).
An example import is explained below