Systems Online LogoPIMInto - Product Information Management System
User guide
×

PIM import Script Example Use Case

 
Use Case: The file received by a distributor from a manufacturer that contains information related to SKU's or products from a specific manufacturer. The data is broken up in to different columns and each of these collections of different columns contain multiple data records divided by the pipe "|" character that needs to be parsed and merged into a single attribute's oftype "string" that contains a "collection" of strings.  Each string in the collection will contain a parsed values (substring)  from one of multiple spreadsheet columns in the provided file
 
Import Source: CSV file. manually transformed to JSON using free online utility.  (Both CSV and JSON formats are supported for import.  The manual conversion to JSON was chosen in this case due to how arrays are handled with JSON source and due  to the initial format of the manufacturer's data. . CSV could also have been used and scripted.  However the import script complexity with CSV would have been Higher.   The path of least resistance was chosen.
 

Map To 'SKU'

Contains the product ID, SKU or code that uniquely identifies the product.

Column B

Contains multiple data records divided by the pipe "|" character.  Each of these records needs to be added to the product attribute "oem_product_parts

Columns C, D, E, F ....

Each Column contains a single data records that needs to be added to the product attribute  "oem_product_parts
 
Destination Attribute:
 
 
Attribute Properties
 
 
Each imported string value will be added as a separate member or string in the collection:
Name: oem_product_models
Type: "String"
is Searchable: True
is Collection: True
 
Import Steps:
 
1) Import as JSON and not CSV.  Columns C,D,E, F... all contain the same Column Name.  Converting the CSV file to JSON will create an ARRAY in the JSON for the columns with the same name.  Mapping this array to oem_product_models will resolve the problem with multiple "columns" containing string data that needs to be added to the attribute because of how a JSON is transformed.
 
2) import script parsing for attribute "oem_product_models" that parses input data from column "B" for the pipe character and assigns values to $output.  The import value parsing script is displayed below: 
 
 
With a few simple lines of script the import process is able to transform the import source to a collection of strings for the assigned attribute.
 
Post Import Result  for single Product SKU: