Automotive warehouse data import tutorial. How to use an XML importer to integrate multiple features and attributes.

Tutorial

How to integrate with an automotive wholesaler?

This tutorial will show you how to use the CSV & XML Import Manager to import data from product feeds provided by one of the automotive wholesalers in Poland.

If you are unfamiliar with the import module, learn the basics of how it works in the video below. If you are familiar with the module, you can skip this video.

Presenting the problem

One of our customers imports tires directly from his supplier. One of the XML fields in the file from the wholesaler contains the tire size in one entry: 175/70R14. We want to break this record into 3 independent values, so that each dimension is represented by an independent characteristic or attribute. This data can be easily broken down in Excel, but what if we want toautomatically retrieve and update the data directly from the supplier, and get 3 separate characteristics or attributes in the store:

  • 175 - tire width
  • 70 - profile height
  • R14 - rim size

Solution

1 First, match the tire size field three times and configure it as a feature or attribute. You will make multiple matches of the same field in the NON-STANDARD FITS tab. In it, you can specify the path to the same data multiple times and configure it freely each time.

2. we want each of the 3 matched fields to contain only selected data from the 175/70R14 value. To pull out the data of interest, use REGULAR EXPRESSIONS (regex). These can be found in the CONFIGURATION of the matched field in the REPLACEMENT section.

With regex, you can sift through the data in any way you want (for more information on how regular expressions work, see, for example, Wikipedia). In our example, from one value "175/70R14" we want to extract 3 different data, so we need 3 regular expressions:

> For 175 values:
> Find: ~([0-9]+)/([0-9]+)R([0-9]+)~
> Replace: $1

> For the value 70:
> Find: ~([0-9]+)/([0-9]+)R([0-9]+)~
> Replace: $2

> For the value R14:
> Find: ~([0-9]+)/([0-9]+)R([0-9]+)~
> Replace: R$3

Thus, we have extracted the values 175, 70 and R14. We can import this data as independent features or attributes, and then generate combinations.

Curiosity

If one field contains values with a fixed number of characters that you want to separate, you can use a simpler way to edit the data from the file before it goes to your store. Use the functions DELETE FROM BEGIN and DELETE FROM END, which will allow you to remove any number of characters from the beginning and end of the values in the file in each match, leaving only the ones you are interested in.

Comments (2)
from 2

Could we do this with your importer module? Without any other addons?

Greg - Yes, all steps described in post you will do using only our Smart CSV & XML Import Module! :-)

No entries yet.