RO CSVI

File tab settings list in import template

| RO CSVI

File tab is a part of an import template and has very important settings needed for an import. Each setting of the file tab is explained.

Autodetect delimiters

is to tell RO CSVI to read the CSV file and identify the delimiters. If this option is set to No, RO CSVI gives an option to user to enter the needed delimiters.

Use file extnsion

Use file extension is to tell RO CSVI to find extension from the import file or to use specific extension. The options available are Use from file, CSV, XML, XLS and ODT.

I'm Mac

I'm Mac, the option to tell if you are working on Apple Macintosh computer. 

Use file for configuration

Use file for configuration option if set to Yes then RO CSVI to use the headers from the import file as template fields. If set to No, RO CSVI will use template fields added to the template. When a rule is applied to a template field, it is a must that this option should be set to No so that RO CSVI uses template fields and that is because RO CSVI cannot predict the column headers in users import file.

Add extra fields

Consider there are four column headers added to the import file. Use file for configuration is set to Yes. There are six template fields added to the template. To add the two extra fields to the import, we set Add extra fields option to Yes.

Skip first line

If RO CSVI need to skip the first line of the import file. This is to ignore the insertion of column headers in database.

Overwrite existing data

Overwrite existing data will update the values of records in database on import. When set to No, existing records in database will be skipped on import.

Skip new items

Skip new items if set to Yes will skip any new items found in the import file and not there in the database. New records will not be inserted with this option set to Yes.

Record name

When using XML file for import, RO CSVI needs to know the node name of the each record. This node name should be set in the Record name field. This field is used only for XML files. For example, for the XML content like below, record name will be product

<?xml version="1.0" encoding="UTF-8"?>
  <products>
  <product>
    <product_sku>NI091SH97UHYINDFAS</product_sku>
   <product_name>Nike Kaishi 2.0 Grey Sneakers</product_name>
   </product>
  <product>
   <product_sku>PU102SH00KOXINDFAS</product_sku>
   <product_name>Puma Sam Idp Navy Blue Flip Flops</product_name>
  </product>
 </products&gt

File tab

Read more ...

Uninstall RO CSVI

| RO CSVI

When you uninstall RO CSVI via the Extension Manager only the files are removed but the database tables remain. The reason behind this is, if you want to update RO CSVI that you don't lose all your settings.

There may be circumstances where you need to delete the database tables as well. In that case there are 2 ways to do this:

  1. Manually remove all the tables in your database that start with csvi_
  2. Use the built-in option in RO CSVI to remove the tables.

Uninstall RO CSVI tables using Maintenance

The built-in option to remove the RO CSVI tables can be found in the Maintenance area.

Uninstall RO CSVI

  1. Go to Components -> RO CSVI
  2. Click on Maintenance
  3. In the first dropdown select RO CSVI
  4. In the second dropdown choose Remove CSVI tables
  5. Click on Continue
  6. All CSVI tables will now be removed and RO CSVI can be uninstalled via the Extension Manager

After RO CSVI has been uninstalled via the Extension Manager you will have a clean system and ready to install a fresh installation of RO CSVI.

Once the uninstallation is complete you can do an extra check to make sure the following folders are all removed:

  • administrator/components/com_csvi
  • components/com_csvi
  • api/components/com_csvi
  • plugins/csviaddon
  • plugins/csviext
  • plugins/csvirules

Read more ...

Writing a rule plugin

| RO CSVI

Rule plugins are a powerful new tool in CSV Improved because it allows us with surgical precision to tailor the import and export process. Out of the box CSV Improved comes with 4 such plugins:

  • Combine
    This adds the option to combine fields
  • Copy
    This adds the option to copy the content of one field to other fields
  • Margin
    This adds the option to recalculate prices
  • Replace
    This adds the option to replace values in a field

These four plugins are useful but not always what you are looking for as you may need something specific. That is why CSV Improved can be extended by writing your own plugins.

Structure of a rule plugin

A CSVI rule plugin is actually a regular Joomla plugin of the type csvirules. A plugin consists of these files:

  • foo.php
  • form_foo.xml
  • foo.xml

The main file

The main file is foo.php, this file contains all the code that does all the work. This is a class that is created like this:

class PlgCsvirulesFoo extends RantaiPluginDispatcher

A rule plugin must always extend the RantaiPluginDispatcher as this dispatcher calls the plugin.

The class contains several mandatory functions and variables:

  • private $id = 'csvifoo';
  • public function getName() {}
  • public function getSingleName($plugin) {}
  • public function getForm($plugin, $options=array()) {}
  • public function runRule($plugin, $settings, $field, CsviHelperFields $fields) {}
$id

This is the unique ID of your rule.

getName()

The getName() function provides CSVI with the name and ID of your rule, this is shown in the dropdown of available rules when creating a new template field.

getSingleName()

The getSingleName() function provides CSVI with only the name of your rule. This is used for display purposes.

getForm()

The getForm() function provides CSVI with a form the user can fill in if your rule requires certain settings. For example a field that allows the user to set which fields should be affected, or a field with values that needs to be matched. It can be almost anything. This function relies on the existence of the form_foo.xml file.

runRule()

The runRule() function does the actual work, this is where the magic happens. In this function you put all the logic of your rule and update the fields with their new values.

The form file

The form file is form_foo.php. This file is optional and only needed if you want to get input from the user. The fields used are standard JForm fields so you can use any field available in Joomla. The structure of the file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="pluginform">
<fieldset name="foo">
<field name="source"
type="textarea"
rows="5"
required="true"
class="input-xxlarge"
filter="raw" />
</fieldset>
</fields>
</form>

 The only requirement is that the fieldset name matches the name of your rule, in this case foo.

Running your code

The runRule() function is the heart of your rule, without it, nothing is going to happen. Here are some pointers to help you understand what is going on in runRule(). The function takes 4 arguments:

  1. $plugin
  2. $settings
  3. $field
  4. $fields

$plugin

This is the ID of the plugin being called. So you need to check if it is your name being called, if not, do not run your code.

$settings

This is an object with data saved by the user from the form provided by your rule.

$field

The current field being processed.

$fields

An instance of CsviHelperFields. This is the class to use to manipulate the fields because it contains all the fields.

There are 2 ways in which you can modify a field that is being imported:

  • $fields->updateField()
    This function is the same for both import and export
  • $fields->set()
    This function takes different arguments depending on whether it is an import or export. The updateField() is the preferred method of modifying a field.

Identifying a field

Fields are always identified by the value in the xml_node variable. This variable contains the unique identifier for that field. One word of caution, when dealing with XML files that have duplicate nodes, this field may contain a value that is the same for multiple fields.

Installation XML

To be able to install a plugin in Joomla, an XML file is required. This is a regular Joomla XML file, just make sure the group is set to csvirules as shown here:

<extension version="3.3" type="plugin" group="csvirules" method="upgrade">

Language files

In case you want to make your rule plugin multi-lingual you can include language files as per the Joomla standard.

Examples

If you want to check out some examples, have a look at the rule plugins that come with CSV Improved, they contain all kinds of ways of handling the fields.

Read more ...

Source tab option to Load from textfield

| RO CSVI

This option is to paste the import content into a textarea field and import the content from the textarea. The content can be either CSV or XML.

 

Load from textfield

 

 

The field to enter the import content is seen after selecting the import template and before the preview page.

Load from textfield field

 

Read more ...

Not Acceptable error

| RO CSVI

Requirements;

CSVI Pro 5.8+

The following error can be seen on some restrictive servers:

"Not Acceptable

An appropriate representation of the requested resource /administrator/index.php could not be found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."

 

Fixing the problem

  1. Login
  2. You may see an empty screen, click the logout button. This is to reset your session.
  3. Login again
  4. Go to Components -> CSVI Pro -> Settings
  5. Set to the option Use cookies to No
  6. Save the settings
  7. You should be able to use CSVI now

Read more ...