0
Wspaniale! (5/5)

Całkowita ocena została obliczona na podstawie  10 opinii zebranych za pośrednictwem serwisu Facebook w ciągu ostatnich 12 miesięcy

Przeczytaj wszystkie opinie
This page is using our module Blog & News. Click here to buy and learn more >>>
This tutorial will show you how to use the PrestaShop Intelligent CSV & XML Import Manager for automatic data selection and importing them to PrestaShop on the example of automotive wholesale....

" />

Data import from automotive wholesaler

- 2 komentarzy

This tutorial will show you how to use the PrestaShop Intelligent CSV & XML Import Manager for automatic data selection and importing them to PrestaShop on the example of automotive wholesale.

Presentation of the problem

One of our customers imports tires directly from your supplier. One of the XML fields in the warehouse file contains tire dimensions in one entry: 175/70R14. We want to break this record into 3 independent values, so that each dimension is represented by a separate feature or attribute. These data can be easily broken down in Excel, but what to do if you want to automatically download and update data directly from the supplier, and in the store get 3 separate features or attributes:

    175 - the width of the tire
    70 - profile height
    R14 - rim size

This tutorial will show you how to use the PrestaShop Intelligent CSV & XML Import Manager for automatic data selection and importing them to PrestaShop.

Solution

1. First match the field with the tire size three times and configure it as a feature or attribute. Multiple matches of the same field are available in the CUSTOM MATCH tab. You can enter in it the path to the same data multiple times and configure it any time.


2. We want only selected data from 175/70R14 to be included in each of the 3 matched fields. To extract the data we are interested in, use REGULAR EXPRESSIONS (regex). They are located in CONFIGURATION of the matched field in the REPLACEMENT section. Thanks to regex, you can sift data in any way (for more information on how regular expressions work, for example, in Wikipedia). In our example, one value "175 / 70R14" is divided into 3 fields, so we will need 3 regular expressions that will extract the data that interests us and remove "/":

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

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

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

Voila! Ready!

Curiosity

If one field contains values ​​with a fixed amount of characters you want to separate, you can use a simpler way to edit data from a file before they reach your store. Use the functions MORE FROM THE BEGINNING and SUCK FROM THE END, thanks to which you will be able to remove any number of characters from the beginning and the end of the value in the file, leaving only those that interest you.

Do you like this artice? Like PrestaShow and be always up to date!

Komentarze

30-12-2018 19:51 | Greg

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

31-12-2018 11:18 | prestashow.pl

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

Check also