RO CSVI
Removing HTML tags on export
| RO CSVI
The removal of HTML tags on export is a question that is quite simple to do with CSVI using the Replacement feature.
Requirements:
- CSVI 7 or higher
Steps to remove HTML tags:
- Go to Components -> CSVI
- Click on Rules in the left menu
- Click on New
- Fill in a name for the replacement rule
- Select the Action
- Select the plugin CSVI Multireplace
- Click on Save to store the settings and load the rule
- Now select the Operation Find and replace
- Fill in Find with /<[\/\!]*?[^<>]*?>/i
- Leave Replace empty
- Set Multiple values to No
- Set Method to Regular expression
- Optionally set an order
- Click on Save & Close
- Go to Template fields
- Select the template where you want to apply the replacement rule to
- Click on the fieldname where the rule needs to be applied to
- Now under Rules select the rule you created
- Click on Save & Close to save the changes
- You will see a wand behind the fieldname indicating that a rule has been applied
- Run the export on your export template and you will see that the exported file will have no HTML in the chosen field
Replacement: Append text
| RO CSVI
To add some custom text to the end of a field you can use the Replacement feature of RO CSVI.
Let's say you want to add FREE POSTAGE to your product description field, here is how:
- Go to Replacement
- Make a new entry with the following settings
- New Old value: /$/
- New New value: FREE POSTAGE
- Type: Regular expression
- Template: Select the template you use for the export
- Field: Select the field the replacement is to be used for
- Click on the Add icon
- Do an export of your template
The value of FREE POSTAGE is only an example here of course, you can add any value you like to any field you like.
Troubleshooting import errors
| RO CSVI
Often when we import files we run into errors that the file is not being read correctly. Where to start looking for the cause of the issue and how to solve this?
Checkpoints
Follow these checkpoints to make sure that you have the basics right.
- Up-to-date Available Fields
The list of available fields should be up-to-date before importing starts. If the field list is not up-to-date the import may fail due to missing fields. To update the list of available fields go to Maintenance -> Available Fields -> Click Update or follow Missing fields in RO CSVI document. - A clean CSV file
A CSV file should not have any extra characters in any place. A good CSV file may look like this:
A bad CSV file may look like this:"product_sku","product_name"
Here the " at the beginning and end of the line are wrong"product_sku,product_name"
Here the trailing comma is wrongproduct_sku,product_name, - Delimiters
The template must use the same delimiters as your file has. The type of delimiters does not matter. To know what delimiters your file uses look at your file with Notepad for example.
Some examples of delimiters are:Sample Field delimiter Text enclosure "product_sku","product_name" , " ~product_sku~^~product_name~ ^ ~ product_sku|product_name |
Check that you have the delimiters filled in your template settings. RO CSVI needs this to know how to read the CSV file. Alternatively you can use the Automatic delimiter detection. - Encoding
The file must always be encoded in UTF-8 format. No other encoding is supported. See this Save file as UTF-8 on how to save your file as UTF-8 using Notepad2 or using LibreOffice/OpenOffice. This is important because files imported not in UTF-8 encoding will not import correctly with special characters like ë and sentences will be cut off. - Field names
Use only fieldnames that are available for the type of import you are doing. To see which fieldnames are available go to RO CSVI ---> Available Fields and filter on the type of import you want to do. It is not possible to use any other name. This means that if your CSV file contains the names sku, price, name that these cannot be used, you have to translate them to RO CSVI fieldnames. Your column names will change like this:
- sku --> product_sku
- price --> product_price
- name --> product_name
- Field data
Make sure the data is properly formatted according to the specifications. Information on the fields can be found in respective tutorials. - Line endings
It is best to use Unix or Windows line endings. Mac line endings can give issues, by default they are not supported by PHP. If you have Mac line endings, you can select the option I'm Mac in your template, this will tell RO CSVI to try to read Mac line endings. - Use the RO CSVI Analyzer to check your file for any issues. The CSVI Analyzer is included in RO CSVI and can be found by going to Components -> RO CSVI -> Maintenance -> Analyzer.
- Check the debug information
The debug report shows every step RO CSVI takes when importing the file. See the How to collect debug information on how to get your debug report. Check the debug information for anything that might be going wrong or post it in the forum.
After having checked these checkpoints your import should be running smoothly. Check out also this Does my CSV file look correct tutorial on checking your CSV file.
Excel and CSV
| RO CSVI
The flexibility of Excel with CSV files is quite limited, so limited even that you cannot use your own field delimiter, text enclosure and encoding when opening a CSV file.
Incorrect column count
| RO CSVI
The single most seen message by users is probably the "Incorrect column count".
What does it actually mean?
The incorrect column count means that the columns CSV Improved has found in your file is not the same as the columns in your configuration. Let's clarify this with some examples.
Example 1, incorrect delimiters:
The CSV file looks like this:
"product_sku","poduct_name","category_path"
The template has delimiters set to:
Field delimiter: ^
Text delimiter: ~
Having incorrect delimiters makes it impossible for CSV Improved to read your file. As CSV Improved looks for the ^ character but it cannot find one, it will read the complete line as a single field. This cannot be identified as a supported field and as a result it gives the error message. Always make sure the delimiters match.
Example 2, the trailing field delimiter:
The CSV file looks like this:
product_sku,poduct_name,category_path
PROD1,Product 1,Products/Software,
The field delimiter used is a comma, this means we have a total of 3 fields:
- product_sku
- product_name
- category_path
The product information we want to import has a total of 4 fields:
- PROD1
- Product 1
- Products/Software
Now we can clearly see that there is an incorrect column count because 3 is not the same as 4. Why are there 4 fields for the product information? As we use the comma as field delimiter, after every comma a new field starts. So the comma after Products/Software also creates a new field. The trailing comma must be removed. Always check your file for trailing field delimiters.
Example 3, the duplicate fields:
The CSV file looks like this:
product_sku,poduct_name,product_name,category_path
PROD1,Product 1,Product 1,Products/Software
The field delimiter used is a comma, this means we have a total of 3 fields:
- product_sku
- product_name
- category_path
The product information we want to import has a total of 4 fields:
- PROD1
- Product 1
- Product 1
- Products/Software
Since the product_name field already exists already the same name again is ignored. This leaves you with 3 fields to import while the data contains 4. Either rename or remove the column to solve the issue.
Example 4, the missing field:
The CSV file looks like this:
product_sku,product_name,category_path,product_publish
PROD1,Product 1,Products/Software
The field delimiter used is a comma, this means we have a total of 4 fields:
- product_sku
- product_name
- category_path
- product_publish
The product information we want to import has a total of 3 fields:
- PROD1
- Product 1
- Products/Software
Here we have a situation where the configuration fields are more than the data fields. What happens is that in a spreadsheet program like Excel a cell is not exported until it is "touched". In this case the column header product_publish was added but no value was put in for the product. To solve this the cell must be given a space or anything actually so it becomes a used cell after that it will be exported.
Example 5, the wrong number of fields:
It is possible to use the column headers in a file to tell CSV Improved what fields you want to use. There is another way and that is to assign fields to the template used for import via the templates menu.
The CSV file looks like this:
PROD1,Product 1,Products/Software
The template fields assignment looks like:
product_sku
product_name
attribute
category_path
This means we have a total of 4 fields:
- product_sku
- product_name
- attribute
- category_path
The product information we want to import has a total of 3 fields:
- PROD1
- Product 1
- Products/Software
This is another situation where the configuration fields are more than the data fields. The solution here is to remove the assigned fields that are not being used.