This best practice teaches you how to create items and variations using ElasticSync.
|To benefit from this best practice, you should be familiar the basic functionality of ElasticSync. Check the Importing data with ElasticSync page of the manual for general information about ElasticSync.|
To import items and variations using ElasticSync as described here, the following data must be saved in the system:
Go to System » System settings » Settings » ElasticSync to find the button Delete cache. Alternatively, you can find this button in any of the syncs you created.
This button allows you to reset the ElasticSync cache in order to reimport a file that does not contain any changes.
Also helpful is the Test run button.
This imports the first 10 rows of a file without cache. This allows you to check if all values have been assigned correctly before you start syncing all rows.
Check the manual to find out which values are valid for these fields.
Go to Data » Log to access the error messages related to the sync.
3. Example data for creating variations
Download the example CSV file and the JSON file that contains the sync.
3.1. Example file
The following sample file has been used for the sync.
3.1.1. Example sync
You can download the complete sync as a zipped JSON file here.
The data that is saved globally at the item level, e.g. the name, the description, etc. should be saved in every row that contains variations of an item. Alternatively, you can create a separate mapping with specific filters in which you need to specify the description only in the row of the main variation.
Data that is variation based must be entered into the relevant rows of the variations.
When creating the variations, it is important that the structure of the attributes and values are saved in the file matches that of the mapping.
3.3. Variation numbers
In this example, we will create a main variation with 4 variations. For mapping the variations, we use the main variation number.
Because the sync imports data row by row, the main variation is at the top of the file.
There, we manually save the variation number in the field of the same name. The field Main variation number remains empty.
This variation number is now written into the field Main variation number of the variations in order to map them to the main variation. Otherwise, the variations would be imported as separate main variations.
You can also enter the variation numbers of the child variations. If you leave the field empty, the system generates the numbers automatically.
The file will look like this:
Variation numbers must be unique!
Both the number of the main variation and those of the child variations must be unique. The import fails if numbers are assigned more than once.
In our example, we selected attribute selection combination in the format attribute:value;attribute:value:
The first row of the main variation has not been assigned a combination so it is not linked to any attributes.
Main variation without attributes
If you work with variation items, we recommend that you do not assign any attributes to the main variation. This provides you with more flexibility when you create variations. If you assign an attribute to the main variation, you can only create variations with the same attributes.
In our sync, we will import the image URLs in one multi-URL mapping. For that, the field Multi URL must be selected in the mapping. The format of the URL is saved as follows: image1url;positionImage1,image2url;positionImage2
3.6. Category links
You can link several categories in one mapping by specifying them separated by commas. You can either specify category names or category IDs. Also, make sure to specify the full category path for category names. The levels are separated by a semicolon.
Mapping and file
Make sure that the values in the file match the mapping. This is because you can select different values in the mapping. For example, for the field Default category, you can select either the ID or the name. As such, the CSV file must contain either the ID or the name. You cannot use the ID in the mapping but the name in the file.
For the synchronisation, it is important that a variation-specific synchronisation field is used. A good choice is the variation number or the variation ID.
You need to specify the action Import new data, update existing.
In the mapping, we map the fields in the CSV file with the fields in plentymarkets.
We recommend that you only map those fields that you actually want to import. Unnecessary fields can result in errors and should best be deactivated.
There are some mandatory fields for creating items with variations. These fields must be mapped for the sync to work. Those mandatory fields are:
Main variation number
If you want to import stock, the following values must be part of the mapping: Warehouse, Quantity, Storage location
The sync is now ready to go and you can start it.
We recommend that you do a test run before the first sync. This allows you to check if the sync functions as expected. If the sync does not perform as expected, you can now correct it before it is run for real.