RO CSVI

Run an RO CSVI cron job using a URL on the frontend

In the document Setting up a cron job we explain how to run import and export jobs using the command line in RO CSVI. This is the preferred way of running cron jobs because this is generally not limited by the limitations imposed by running an import or export through the browser. However in some cases you may need to run a cron job using a URL on the frontend, in this document we explain how to set this up.

So the first step is to create a template and do the needed settings. This document explains on how to run VirtueMart Product Import using frontend. The same procedure can be followed for any import and export in RO CSVI.

Creating the template

A template can be created by following these steps:

  1. Go to Components -> RO CSVI -> Templates
  2. Click New
  3. Give the template a name, say for example VirtueMart Product import
  4. Set Action to Import
  5. Set Component to VirtueMart
  6. Set Operation to Product
  7. Click Next: Select Source
  8. Source is set default to Load from your computer. Change it Load from server or Load from FTP server and set a server location from where the import file has to be read.
    Setup cron job using URL on frontend
  9. Click Next: Select options
  10. The default values are OK, change if needed.
  11. Click Next: Select fields
  12. Nothing needed here as we set to Use column headers as configuration in step 10.
  13. Click Next: Finalize
  14. All done here
  15. Click Close to return to the list of templates or Edit if you want to fine-tune the template further.

VirtueMart Products import create template

Adding the template fields

Template fields can be added by following these steps:

  1. Go to Components -> RO CSVI -> Templates
  2. Click on Template fields
  3. In the Search Tools select your template
  4. Click on New to add a single field or click on Quick Add to add multiple fields.

Quick Add

The Quick Add Option allows you to quickly add multiple fields to a template. It is not possible to set any settings per field here but that can be done after the fields have been added to the template.

VirtueMart product import create template fields

Setting up the template

Now in the import template change Enable Frontend/cron field to Yes and Set a secret key for the template.

csvi7 frontend cron settings

Creating menu item

To create menu item follow the steps

  1. Go to Joomla Menu >> Menu Items
  2. Click New
  3. Give a Menu title, say for example VirtueMart Product Import
  4. Select Menu item type >> Click on RO CSVI >> Select Import front-end
    Frontend menu item
  5. Select the import template we just created
  6. Set the secret key as set in the template
  7. Save the menu item

 

Select template menu item

Run import on Front-end

Now that the RO CSVI template and Joomla menu has been set. The menu link will be available on frontend. Click on the link so to run the import.

Frontend main menu

Frontend import finished

Using repeatable field values in front-end URL

RO CSVI supports including repeatable field values in front-end export. An example URL for export template to include sort fields in the URL is given below

https://mydomain.com/index.php?option=com_csvi&view=export&csvi_template_id=XX&exportto=tofront&key=XXXX&task=export&tmpl=component&form_sortfields[0][name]=alias&form_sortfields[0][sortby]=ASC&form_sortfields[1][name]=catid&form_sortfields[1][sortby]=ASC

A menu item can also be created and the URL will then look like this.

https://mydomain.com/myexport?form_sortfields[0][name]=alias&form_sortfields[0][sortby]=ASC&form_sortfields[1][name]=catid&form_sortfields[1][sortby]=ASC

alias and catid are the fields included for sort fields. The ordering of fields is ASC for ascending, but this can also be set to DESC for descending.

Using multiple filter field values in front-end URL

If an export template has filters which supports multiple values. Those multiple filter values can be included in URL separated by |. For example in Joomla content export template, if you want to export data from multiple categories. Filtering can be set for these multiple categories in the URL. See the example below

https://mydomain.com/index.php?option=com_csvi&view=export&csvi_template_id=XX&exportto=tofront&key=XXXX@&task=export&tmpl=component&form_content_categories=8|9

A menu item can also be created and the URL will then look like this.

https://mydomain.com/myexport?form_content_categories=8|9

All the Joomla articles of category ID 8 and 9 will be included in export.

Related Articles