Override import/export routines

Background information

An override is where you create your own routine and place it in a specific folder for CSVI to use. This way you can add or modify the behavior of CSVI when importing or exporting to suit your own needs. The override system allows for great flexibility so you can write your own import/export routines and not having to worry that by updating CSVI your changes are lost.

Creating an override routine

The default location for import routines is plugins/csviaddon/<component>/com_<component>/model/import and for export routines plugins/csviaddon/<component>/com_<component>/model/export

The problem with having your modification in the CSVI folder is, when you update CSVI your modification is lost. Instead of putting your modification directly in the CSVI folder you can put it in your template folder.

1. Location

The import routine overrides are located in the folder:

The export routine overrides are located in the folder:

  • <template>
    This refers to the administrator template e.g. isis
  • <component>
    This refers to the component you are doing the import or export for e.g. com_virtuemart

The default administrator template in Joomla is isis, so the location of the import routines for VirtueMart becomes:

The default administrator template in Joomla is isis, so the location of the export routines for VirtueMart becomes:

2. Procedure

To use the override feature take the following steps:

  1. Copy the import routine you want to modify to the override folder e.g. You can copy the plugins/csviaddon/virtuemart/com_virtuemart/model/import/product.php to administrator/templates/isis/html/com_csvi/com_virtuemart/model/import/productcustom.php
  2. Open the file productcustom.php, since the name of the file has been changed from product.php to productcustom.php, it is a must that the class name for productcustom.php to be changed. Look for text "class Product" inside productcustom.php and change it to "class Productcustom" and save the file.
  3. Also, modify the productcustom.php file according to your needs.
  4. Set the override file in the template by going to template settings and click on Advanced button. A new dropdown Override will appear under Operations. Select the override file you just created and save the template.
  5. Perform the import.

You can follow the same steps for export by changing the folder import to export.