K2
Import K2 category params field
| K2
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
Import K2 items with extra fields
| K2
Background information
This tutorial will explain how to import extra fields with the K2 Item import.
Open CSVI
Go to Components -> CSVI Pro and click on Templates tab. You are now on the Templates page from where the import and export templates are created.
Preparing the template
Click on New on top left corner to create a new template for import.
- Give a descriptive name for the template say "K2 import"
- Set Enabled to Yes
- Enable logging to Yes to get debug log. 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.
Under Operations select the following:
- Select Import
- Select K2
- Select Item
Save the template by clicking on Save or Save & Close.
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 File for 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.
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
Before we can use the Extra fields as defined in K2 for import, we must tell CSVI that there are extra fields. To do this take the following steps:
- Go to Maintainence Tab > Available Fields in CSVI
- Click on Update
After the update has finished, your extra fields will show up in the field list on the Fields tab and can be used for import and export. The name of the extra fields is combined of 2 parts:
- Name of Extra Field Group
- Name of the Extra Field
Each field name is separated by an _-symbol (underscore). The list will contain these 2 fields:
- CSVI_Place of sale
- CSVI_Date of sale
The next step is to add the fields we want to import to our template. To import properties there are a few fields that are really needed:
- title
- alias
- category_path
- published
- introtext
In addition you can add extra fields as you like. For example, we have 2 extra fields defined in the CSVI group as follows:
- Place of sale
Textfield - Date of sale
Date
Let's tell CSVI which fields you want to import.
- Under the Field name column, select the field name
- The other options we leave empty as they are fine
- Click on the + symbol
- Repeat step 1 - 3 for all fields including the 2 extra fields
- Set the order of the fields in the Order column.
- This can be done manually by entering the correct order and then click Save
- This can be done automatically by clicking on the Reorder icon next to the word Order
To make sure we don't lose anything, click on Save to save your template.
If you do not know which fieldnames to use, check out the Visual Available Fields.
The fields then look like this:
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 an item with 2 extra fields.
"title";"alias";"category_path";"introtext";"CSVI_Place of sale";"CSVI_Date of sale"
"Discounts";"discounts";"News/Discounts";"<p>Find your latest discounts here.</p>";"Rotterdam";"2013-12-05"
Save these 2 lines in a file.
The item is going to be imported in the category:
News
|- Discounts
This structure is found in the category_path field where each category is separated by a / (forward-slash). You will have to make sure that the group these extra fields are in is assigned to this category.
New values custom fields
If your import file contains new values for custom fields, they will be added as default value to the system. There is no need to first add them to your field
If I now import the value Yellow for the field Dictionary it will be added a default value here.
Import time
With our template configured and our file created, we are ready to import. Go to Import tab from Components >> CSVI Pro. Select the template name and click on Select file from top left corner.
Click on Choose file and select your import file. Then click on the Preview button in the top right hand corner. You will see the content of CSV file which is going to be imported.
The result
When the import is done you will see a screen like this:
Here it says Updated but that can also be Added if the category doesn't exist yet. There you go, you have succesfully done a K2 Item Import.
What's next?
The next thing you can do is, experiment. There are a lot of more features in CSVI you can use for example:
- Combine fields
- Replace fields
Further reading
Other good sources of information are:
Export K2 items
| K2
Required fields
- CSVI Pro 6.0+
- Joomla 2.5 /3.x
- K2 Item export
Creating the template
First we will create an export template in which we can store all our preference. Let's call the export page:
- Go to Components
- Go to CSVI Pro
- Click on Templates -> Templates
Now you are on the templates page, this is where the import and export templates are created. Click on New button on top corner and follow the Create a template tutorial to create your export template. Example template is explained below
- Give a descriptive name for the template
- Select Export as Action
- Component as K2
- Operation as item
- Export frontend
If set to Yes, CSVI will allow you to use this template in the frontend for export - Enable logging if set to Yes
This is a very important option. Setting this to Yes will tell CSVI to create a detailed log of all steps taken during export. 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.
Setting the file options
The next step is to tell CSVI something about the information you want to export.
- Filename for exported file
A specific filename can be set here, if left empty, CSVI will generate a filename automatically. - Export type
Here you can choose the type of file you want to export. For this tutorial we leave it at CSV. - Field delimiter
This field must be filled with a single character. This can be a unique character but also a character that is in your data but in that case the text enclosure must be filled out as well. A comma or a semi-colon are common values. - Text enclosure
This must be used if your field delimiter also appears in your data. It is best to always set this to double-quotes. - Excel CSV
If set to Yes, CSVI will add a BOM to the beginning of the file so Excel will read the file as a UTF-8 file. - From Record
If set CSVI will start from the specific record number - To Record, If set CSVI will export till the specified record number
Now that the file options are set, CSVI knows how to export 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 export the following fields:
- title
- alias
- category_path
- fulltext
Let's tell CSVI which fields you want to export. You can follow the tutorial at Adding tempate fields.
When you are done you have 4 fields here.
Creating the export file
To create the export file, go to Export and select your template from the list and click on the Export button.
Depending on your browser you might get a Save dialog or the browser saves the export file directly in your default download folder.
K2 Item Content Fields
| K2
This page shows which K2 Item Content fields you can use for import and export.
Import K2 Items
| K2
Background information
This tutorial will explain how to import extra fields with the K2 Item 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 import".
Under Operations select the following:
- Select Import
- Select K2
- Select Item 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.
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. - 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.
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
The next step is to add the fields we want to import to our template. To import properties there are a few fields that are really needed:
- title
- alias
- category_path
- introtext
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.
The fields then look like this:
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.
"title";"alias";"category_path";"introtext"
"Random article";"random-article";"news/local-news";"<p><a href="/"http://www.example.com/"">A random site</a></p>"
Save these 2 lines in a file.
The item is going to be imported in the category:
News
|- Local news
This structure is found in the category_path field where each category is separated by a / (forward-slash).
Import time
With our template configured and our file created, we are ready to import.
On the Import tab, select the template from the drop downlist and click on select file on top corner.
Select the file we created for importing. Click on Preview on top corner. CSVI will show the rows in csv before importing.
The result
When the import is done you will see a screen like this:
Here it says number of rows processed with the filename. There you go, you have succesfully done a K2 Item Import.
What's next?
The next thing you can do is, experiment. There are a lot of more features in CSVI you can use for example:
- Combine fields
- Replace fields
Further reading
Other good sources of information are: