Configuring Bulk Importer/Exporter¶
Extension settings¶
You find these on the extension's settings page under Extensions. Both apply to import runs only.
| Setting | Type | Default | What it does |
|---|---|---|---|
| Max rows per import run | Number | 5000 |
Upper limit for the number of rows in one import file. If the file has more rows, the whole run fails before any row is processed. Values below 10 are treated as 10. |
| Stop on first error | Select (No / Yes) | No | With Yes, an import run stops after the first failed row. Rows that were already imported stay imported. With No, the run continues and counts the failed rows. |
Permissions¶
The extension adds three permissions to Paymenter's role editor.
| Permission | Key | Allows |
|---|---|---|
| View bulk importer | admin.bulk_importer.view |
See the Bulk Importer navigation entry and the run list, open a run with View, download export files |
| Create import runs | admin.bulk_importer.create |
Create import and export runs with New Run |
| Delete import runs | admin.bulk_importer.delete |
Delete single runs or several runs at once |
Warning
Create import runs lets an admin create and overwrite users, including their password and role_id, and export all user e-mail addresses. Give it only to roles you trust with that.
Run options¶
Every run is configured in the Create Run form (Automation > Bulk Importer > New Run). Which fields are shown depends on Operation and Format.
Fields for every run¶
| Field | Type | Default | What it does |
|---|---|---|---|
| Run Name | Text, required, up to 255 characters | empty | Name shown in the run list. |
| Operation | Select: Import, Export | Import | Chooses import or export. Switching to Export sets Format to CSV, switching to Import sets it to Auto detect. |
| Entity | Select: Users, Categories, Products, Coupons | none | The kind of record to import or export. |
| Format | Select | Auto detect | Import: Auto detect, CSV, JSON, XML. Export: Auto (CSV), CSV, JSON, XML. Auto detection uses the file extension: .csv and .txt are read as CSV, .json as JSON, .xml as XML. For exports, Auto (CSV) writes CSV. |
CSV options¶
Shown when Format is Auto detect, Auto (CSV) or CSV.
| Field | Type | Default | What it does |
|---|---|---|---|
| CSV has header row (import) / Include CSV header row (export) | Toggle | On | Import: the first line holds the column names, which you use as source names in the mapping. When off, columns are named column_1, column_2 and so on. Export: writes the column names as the first line. |
| CSV delimiter | Text, up to 4 characters | , |
Field separator for reading and writing CSV. Use a single character. If left empty, a comma is used. |
Import options¶
| Field | Type | Default | What it does |
|---|---|---|---|
| Dry Run (no data changes) | Toggle | On | Validates every row and writes nothing to Paymenter's tables. Switch it off for a live import. |
| Import File | File upload, required | none | The file to import. Accepted file types: text/csv, text/plain, application/json, application/xml, text/xml. The file is stored in storage/app/tmp/bulk-importer. |
| JSON path (optional) | Text | empty | Shown when Format is JSON. Dot-notation path to the array of records, for example items or data.records. Leave empty if the root of the file is already an array of objects. |
| XML record path (optional) | Text | empty | Shown when Format is XML. Dot-notation path to the repeated record element below the root element, for example record. |
| Update match field | Select, required | Depends on entity | The field used to find an existing record. If a record with this value exists, it is updated; otherwise a new one is created. Options: Users email, id; Categories slug, id, name; Products slug, id, name; Coupons code, id. If nothing is selected, email is used for users, slug for categories and products, code for coupons. |
| Column Mapping | Repeater, required, at least one row | one empty row | Maps source columns to Paymenter fields. See below. |
Warning
The match field must also be a mapped target field. id is offered as a match field but is not available as a target field, so a live import with match field id fails on every row with Match field "id" is missing in mapped row. Use email, slug, name or code.
Each Column Mapping row has four fields:
| Field | Type | Default | What it does |
|---|---|---|---|
| Source column/path | Text, required | empty | CSV column name, or key in a JSON/XML record. Nested values are addressed with dot notation, for example user.email. |
| Target field | Select, required | none | The Paymenter field to fill. The options depend on Entity, see Usage. |
| Fallback value | Text | empty | Used when the source value is missing or an empty string. |
| Transform | Select | none | Converts the value before it is validated and saved. |
Transforms:
| Transform | Effect |
|---|---|
| none | Value as text, unchanged |
| trim | Removes surrounding whitespace |
| lowercase | Trims and converts to lower case |
| uppercase | Trims and converts to upper case |
| integer | Converts to a whole number |
| float | Converts to a decimal number |
| boolean | 1, true, yes and on (any case) become 1, everything else 0 |
| date/time | Parses the value as a date and writes it as YYYY-MM-DD HH:MM:SS. An empty value stays empty. |
A missing value with no fallback stays empty regardless of the transform.
Export options¶
| Field | Type | Default | What it does |
|---|---|---|---|
| Exclude users from export | Multi-select, searchable | empty | Shown when Operation is Export and Entity is Users. The selected users are left out of the export. The list offers the first 5000 users, sorted by e-mail address. |
Exports have no column mapping. Each entity is exported with a fixed set of columns, listed in Usage.