Import API: Types
This API will import product types to your shop.
Import Items Structure
$importItems
The array of $importItems
should be structured as shown below. This should be passed to $padloper->import()
as the first argument:
$importItems = [
// wardrobe type
[
// @NOTE: IF MULTILINGUAL FIELD, WE EXPECT VALUE IS ARRAY; ELSE STRING
// title
'title' => ['default' => 'Wardrobe', 'fi' => 'Vaatekaappi', 'de' => 'Kleiderschrank'],
],
// MORE TYPES ...
];
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
$importType
The expected import type is types
. This should be passed to $padloper->import()
as the second argument.
$importOptions
If required, the following import options can be passed to $padloper->import()
as the third argument when importing types. This must be an array.
$importOptions = [
// @note: setting as unpublished!
'is_unpublished' => true
];
1
2
3
4
2
3
4
Example Import
The following example shows how to import several types into your shop. Please inspect the resultant array for import notifications.
// IMPORT ITEMS
$importItems = [
// wardrobe type
[
// @NOTE: IF MULTILINGUAL FIELD, WE EXPECT VALUE IS ARRAY; ELSE STRING
// title
'title' => ['default' => 'Wardrobe', 'fi' => 'Vaatekaappi', 'de' => 'Kleiderschrank'],
],
// therapy type
[
// title
'title' => ['default' => 'Therapy', 'fi' => 'Terapia', 'de' => 'Therapie'],
],
];
// IMPORT OPTIONS
// not passing any in this example
/** @var array $importResult */
$importResult = $padloper->import($importItems, 'types');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20