RO CSVI
I want to import VirtueMart products with images
| RO CSVI
Import product images in VirtueMart using CSVI with few steps. Learn how to do link images to products.
Date and Custom date in Multi replace plugin
| RO CSVI
Most of the times we would need to export or import today's date or a custom format date in our export and import operations. This can be now be easily accompolished using RO CSVI Multi replace rule plugin.
Date format on export
The example here explains on how to create a rule in Multi replace plugin for exporting today's date in your exports, the same can be followed for import too.
- Create a new Multi replace rule for export
- Select Operation as Date
- Under Filter section and Date format field enter the format you want to export date, for example like d-m-Y. Check for other date formats with PHP date documentation.
- Save the rule
- Apply the rule on your export template fields.
Running an export by setting Today's date export on custom template field, an example in export file will look like below
Date format on import
An example for import using date format for field created_on in VirtueMart Product import is explained below.
1. Create VirtueMart Product import template and add created_on as one of the field in import
2. This is the preview page before applying the date rule.
3. Now create a rule using Multi replace plugin with date as operation. Add a date format to the rule.
4. Apply the rule on created_on field
5. Run the import and check the preview page.
Custom date format
It is sometimes needed to change the date format you need to import or export from or to database. Custom date format operation in RO CSVI Multi replace plugin will help you with this. The below example explains changing date format for export, the same can be followed for import too.
Custom date format for export
- Create a new Multi replace rule for export
- Select Operation as Custom date format
- Under Filter section and Date format field enter the format you want to change the date to, for example like m.d.y
- Save the rule
- Apply the rule on your export template fields.
The default date format stored in database is Y-m-d H:i:s where Y is the year, m is the month, d is the date, H is the hour, i is the minutes and s is the seconds. You can change this default format to any needed custom format in your export and in import you can change the date format in your import file to database supported format. Check for other date formats with PHP date documentation.
An example export file created by applying Custom date format rule on created_on field in VirtueMart product export is shown below
Custom date format for import
Here in this example we are explaining about using custom date format to change the format of created_on date on VirtueMart product import to database supported format Y-m-d H:i:s.
1. Create a rule using Multi replace plugin
2. Create VirtueMart Product import template and add created_on as a template field. Apply custom date rule on created_on field.
3. Run the import and check the preview page.
More articles on this subject
Conditional rule plugin for export
| RO CSVI
CSVI introduces a new conditional rule plugin so value of one field can be exported based on another field and its value
In this example export we are going to check if product_price value is greater than a value say 50 and replace it with a new value 75.
1. Create a VirtueMart product export template. To do that create a new template with component as VirtueMart, operation as product and action to be export.
2. On template fields page add fields to be export. In this example we add
- product_sku
- product_name
- product_price
3. Create conditional rule for export and apply on product_price field in template fields page. Run the export and check the product_price field.
More articles on this subject
Creating own HTML export file
| RO CSVI
This article explains how to create your own HTML export file for personalised customisation. By doing this there is no core files modified so updating CSVI extension is easy and the personalised changes are not lost.
To do this, under the folder administrator\components\com_csvi\helper\file\export, look for the file csvimproved.php. This is the actual file which is used for exporting html content. To have your own file, make a copy of this file in the same location. Say for example we are making a copy of the file with name customhtml.php.
Now open the duplicated file and check for the text CsviHelperFileExportHtmlCsvimproved (class name in the file) change it to name matching to the name of the new file. Here it is customhtml.php so the text will be changed to CsviHelperFileExportHtmlCustomhtml and save the file.
On Joomla administrator interface, go to Extension >> Languages. Click on Override on the side menu. Select the override for the language you have as default. Remember we are doing the language override for administrator as it is for CSVI export template settings. For English, it is English(en-GB) - Administrator, click on the new button on top.
Create a language override string for the new class file we created just now and Save it.
Now the new custom html file will be available in the export template settings under file tab.
Custom tables export
| RO CSVI
Requirements
- CSVI 6.0+
- Joomla 3+
Background information
The custom export is a special export which allows you to export data from any available database table in your system.
Creating the template
First we will create an export template in which we can store all our preference. Let's say we are going to do an custom table export
- Go to Components
- Go to RO CSVI
- Click on Templates page
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 template.
- Give a descriptive name for the template
- Select Export as Action
- Component as RO CSVI
- Operation as Custom tables
- 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 options
The next step is to tell CSVI for which custom table you want to export, from the options tab, select the table.
Now that the options are set, Don't forget to click on Save to save your changes in your template and make sure they don't get lost.
Adding the fields
Now that template is created we need to add fields to be exported. Fields depend on the custom table you have selected for exporting. In this tutorial, content table is taken as example, so for exporting from content table, fields are added like
Once the template and template fields are set, Exporting can be done in a normal way.
Supported tables
CSVI supports all tables that are supported in the Joomla installation to be imported/exported.
To know the avaialble fields which can be exported, take these steps:
- Go to Components -> RO CSVI -> Available Fields
- Select Export
- Select RO CSVI
- Select Custom tables
- Click on Go
- Click on the column Table to sort the fields on Table
- Now scroll to the table you want to export and you can see the fields that are available for exporting
Once template and template fields are set, the last step is to do exporting. To do this, go to Export tab and select the template you just created.
CSVI will prepare the export file and download it to your computer.
Once exported, logs and the exported filename will be displayed.