Import configuration is an option that allows administrators to configure import procedures better when it comes to importing Products.
The new feature can be found in the back-end area under the page named "Import configuration":
Keep in mind that the options described here refer to importing Products only. Neither Categories nor Producers are affected.
There are two main benefits of using the Import configuration feature:
- You no longer have to adjust the column layout of each CSV file before importing it so that you can set up a list of dependencies between your own CSV format and DJ-Catalog2 product structure just once.
- The import process becomes more flexible and powerful as you can, for example, merge three columns into one or look up the attribute in the database and replace it with the returned value.
To create a dependency, you have to click the "New" button, and the "Import dependency" form will be displayed.
A dependency consists of the following attributes:
- Name – it's a friendly name of your dependency.
- Published – only published dependency will be used.
- CSV column – the column's exact name inside the CSV file should be paired with the target attribute.
- Target column – e.g. "name", "description", "images", "_custom_field_1". The exact name of target column inside #__djc2_items table. See the guidelines for more information and the article describing how to import data to custom attributes.
- Database lookup* – enabled this option if you want to look up the source value (from CSV column) in the database and be replaced by returned value. See the example below:
- Lookup table – name of the table, e.g. #__djc2_producers.
- Lookup column – e.g. "name"
- Lookup value – e.g. "id"
- Comparison operator – the operator which should be used when comparing the source value against values inside "lookup column".
- Optional "WHERE" – additional condition that should used in the SQL query, e.g. published=1
- Merging – the merging will occur when more than one dependencies refer to the same target column. In such a case, you can replace the previous value with a new one or concatenate it BEFORE or AFTER. The perfect example is merging values from the "first name" and "last name" columns into one "name" column.
- HTML wrap – you may surround the value with HTML tags such as <p>, <div>, <span>
*) Database lookup usage example. Dependency displayed below will take the string value (assuming its name of the producer) from the "manufacturer" column, insert it into SQL query, which looks for producer ID from #__djc2_producers table based on the "name" column, and finally replace the old value with returned ID.
In other words, the following SQL query will be performed:
- SELECT `id` FROM `#__djc2_producers` WHERE `name` LIKE "?" LIMIT 1