In DJ-Catalog2 ver. 3.5.6 we have added new option that allows administrators to better configure import procedure 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 in here refer to importing Products only. Neither Categories nor Producers are affected.
There are two main benefits of using Import configuration feature:
- You no longer have to adjust the column layout of each CSV file before importing it, so 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 returned value.
In order to create a dependency you have to click "New" button and the "Import dependency" form will be displayed.
A dependency consists of following attributes:
- Name - it's a friendly name of your depency.
- Published - only published depency will be used.
- CSV column - the exact name of the column inside CSV file that should be paired with 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 retured 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 there are more than one dependencies which refer to the same target column. In such case you can replace the previous value with new one or concatenate it BEFORE or AFTER. The perfect example is merging values from "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 it's name of the producer) from "manufacturer" column, insert it into SQL query which looks for producer ID from #__djc2_producers table based on "name" column and finally replace the old value with returned ID.
In other words, following SQL query will be performed:
SELECT `id` FROM `#__djc2_producers` WHERE `name` LIKE "?" LIMIT 1