Data Transformation

The script editor lets you transform imported rows before they are processed. You can edit field values directly in the import workflow using the $row variable.
Key Functionalities
Section titled “Key Functionalities”- Script input: Write transformation logic against the
$rowvariable for each imported row. - Function whitelisting: Only approved PHP functions are available, so you can perform common transformations without exposing the system to unsafe code.
Allowed PHP Functions
Section titled “Allowed PHP Functions”| Function Group | Functions |
|---|---|
| String Functions | strlen, strpos, strtolower, strtoupper, trim, substr, str_replace, explode, implode, htmlspecialchars, ucfirst, lcfirst |
| Hashing Functions | md5, sha |
| Array Functions | in_array, count |
| Math Functions | abs, round, ceil, floor, max, min, rand, sqrt, pow |
| Date/Time Functions | time, date, strtotime, mktime |
| Variable Handling Functions | isset, empty |
| JSON Functions | json_encode, json_decode |
| Multibyte String Functions | mb_ereg_replace, mb_ereg_replace_callback, mb_eregi_replace, mb_split, mb_str_pad, mb_str_split, mb_strcut, mb_strimwidth, mb_stripos, mb_stristr, mb_strlen, mb_strpos, mb_strrchr, mb_strrichr, mb_strripos, mb_strrpos, mb_strstr, mb_strtolower, mb_strtoupper, mb_substr, mb_substr_count |
Example Use Cases
Section titled “Example Use Cases”You can use data transformation to:
- remove extra
$symbols from manufacturer values - replace spaces or separators in options
- increase stock values by a fixed amount
- calculate prices when imported values are empty
- replace commas with
|in keyword fields - concatenate
meta_titleandname
General Format For The $row Script
Section titled “General Format For The $row Script”The $row variable is an associative array. Each key represents a column from the imported file, and each value contains the row data for that column.
1. Access Row Data
Section titled “1. Access Row Data”$manufacturerName = $row['manufacturer_name'];2. Modify Row Data
Section titled “2. Modify Row Data”$row['manufacturer_name'] = str_replace('$', '', $row['manufacturer_name']);3. Use Allowed PHP Functions
Section titled “3. Use Allowed PHP Functions”$row['options'] = strtolower($row['options']);4. Apply Conditional Logic
Section titled “4. Apply Conditional Logic”if (isset($row['stock']) && $row['stock'] > 0) { $row['stock'] += 10;}5. Perform Calculations
Section titled “5. Perform Calculations”if (isset($row['price_gross']) && $row['price_gross'] == 0) { $row['price_gross'] = $row['net'] * 1.19;}6. Save The Modified Row
Section titled “6. Save The Modified Row”You do not need to return anything manually. Changes to $row are applied during the import process.
Full Script Example
Section titled “Full Script Example”$row['manufacturer_name'] = str_replace('$', '', $row['manufacturer_name']);$row['options'] = str_replace(';', '|', trim($row['options']));
if (isset($row['stock'])) { $row['stock'] += 10;}
if (isset($row['price_gross']) && $row['price_gross'] == 0) { $row['price_gross'] = $row['net'] * 1.19;}
$row['keywords'] = str_replace(',', '|', $row['keywords']);$row['meta_title'] = $row['meta_title'] . ' ' . $row['name'];Key Points
Section titled “Key Points”$rowis an associative array of imported column values.- You can access and modify fields with
$row['column_name']. - Only whitelisted PHP functions are allowed.
- All changes are applied directly during the import process.