Import API: Brands
This API will import product brands 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 = [
// Ikea brand
[
// @NOTE: IF MULTILINGUAL FIELD, WE EXPECT VALUE IS ARRAY; ELSE STRING
// title
'title' => [
'default' => 'IKEA',
'fi' => 'IKEA',
'de' => 'IKEA'
],
// images (brand logo) @note: can be multiple images BUT ONLY NEED ONE
'padloper_images' => [__DIR__ . "/temp_images/Ikea_logo.png"]
],
// MORE BRANDS ...
];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$importType
The expected import type is brands
. 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 brands. 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 brands into your shop. Please inspect the resultant array for import notifications.
// IMPORT ITEMS
$importItems = [
// IKEA brand
[
// @NOTE: IF MULTILINGUAL FIELD, WE EXPECT VALUE IS ARRAY; ELSE STRING
// title
'title' => [
'default' => 'IKEA',
'fi' => 'IKEA',
'de' => 'IKEA'
],
// images @note: can be multiple images
'padloper_images' => [__DIR__ . "/temp_images/Ikea_logo.png"]
],
// Vornado brand
[
// title
'title' => [
'default' => 'Vornado',
'fi' => 'Vornado',
'de' => 'Vornado'
],
// images
'padloper_images' => [__DIR__ . "/temp_images/vornado_logo.png"]
]
];
// IMPORT OPTIONS
$importOptions = [
// @note: HERE WE ARE SETTING as unpublished; we will publish manually
'is_unpublished' => true
];
/** @var array $importResult */
$importResult = $padloper->import($importItems, 'brands', $importOptions);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38