Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions code_samples/data_migration/examples/create_attribute_group.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
options:
choices:
- value: red
label:
"eng-GB": "Red"
label:
"eng-GB": "Red"
- value: white
label:
"eng-GB": "White"
label:
"eng-GB": "White"
- value: black
label:
"eng-GB": "Black"
label:
"eng-GB": "Black"
26 changes: 26 additions & 0 deletions code_samples/data_migration/examples/create_product_asset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- type: content
mode: create
metadata:
contentType: image
mainTranslation: eng-GB
location:
parentLocationId: 51 # Media/Images
fields:
- fieldDefIdentifier: name
languageCode: eng-GB
value: 'Top hat 58cm Black'
- fieldDefIdentifier: image
languageCode: eng-GB
value:
alternativeText: 'Top hat 58cm Black'
fileName: 'top_hat_58cm_black.jpg'
path: top_hat_58cm_black.jpg
references:
- name: top_hat_58cm_black_image_content_id
type: content_id

- type: product_asset
mode: create
product_code: top_hat__58__black
uri: '### "ezcontent://"~reference("top_hat_58cm_black_image_content_id") ###'
tags: []
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
- type: product_price
mode: create
product_code: 'DRESUN'
product_code: top_hat__58
currency_code: 'EUR'
amount: 120
custom_prices:
- customer_group: wholesaler
- customer_group: contractors
base_amount: 120
custom_amount: 100

29 changes: 29 additions & 0 deletions code_samples/data_migration/examples/create_product_variant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- type: content
mode: create
metadata:
contentType: hat
mainTranslation: eng-GB
location:
parentLocationId: 60
fields:
- fieldDefIdentifier: name
languageCode: eng-GB
value: 'Top hat 58cm'
- fieldDefIdentifier: specification
languageCode: eng-GB
value:
code: top_hat__58
attributes:
size: 58
is_virtual: false

- type: product_variant
mode: create
base_product_code: top_hat__58
variants:
- code: top_hat__58__white
attributes:
color: white
- code: top_hat__58__black
attributes:
color: black
60 changes: 48 additions & 12 deletions docs/content_management/data_migration/importing_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ The following data migration step modes are available:
| `object_state` | ✔ | | |
| `object_state_group` | ✔ | | |
| `payment_method` | ✔ | | |
| `product_asset` | ✔ | | |
| `product_availability` | ✔ | | |
| `product_price` | ✔ | | |
| `product_variant` | ✔ | | |
| `role` | ✔ | ✔ | ✔ |
| `section` | ✔ | ✔ | |
| `segment` | ✔ | ✔ | ✔ |
Expand Down Expand Up @@ -246,7 +248,7 @@ Adjust the migration file and configure the `image` field data as follows:
path: src/Migrations/images/example-image.png
```

This migration copies the image to the appropriate directory,
This migration copies the image to the appropriate directory,
in this case `public/var/site/storage/images/3/8/3/0/254-1-eng-GB/example-image.png`,
enabling swift file migration regardless of storage (local, DFS).

Expand All @@ -263,7 +265,7 @@ The following example shows the creation of a `Contributor` Role:
[[= include_file('code_samples/data_migration/examples/create_role.yaml') =]]
```

To update an existing Role, 2 policies' modes are available:
To update an existing Role, two policies' modes are available:

- `replace`: (default) All existing policies are replaced by the ones from the migration.
- `append`: Migration policies are added while already existing ones are kept.
Expand Down Expand Up @@ -299,7 +301,7 @@ You can use an [action](data_migration_actions.md) to assign a Role to the user.
[[= include_file('code_samples/data_migration/examples/create_user.yaml') =]]
```

### Language
### Languages

The following example shows how to create a language.

Expand All @@ -311,6 +313,8 @@ The required metadata keys are: `languageCode`, `name`, and `enabled`.

### Product catalog

#### Attributes and attribute groups

The following example shows how to create an attribute group with two attributes:

``` yaml
Expand All @@ -325,7 +329,7 @@ You can also update attributes, including changing which attribute group they be

You can't change the attribute type of an existing attribute.

#### Product type
#### Product types

The following example shows how to create a product type.

Expand All @@ -338,38 +342,70 @@ A product type must also contain the definition for an `ibexa_product_specificat
[[= include_file('code_samples/data_migration/examples/create_product_type.yaml') =]]
```

#### Customer groups
#### Products

The following example shows how to create a customer group with a defined global price discount:
The following example shows how to create a product:

``` yaml
[[= include_file('code_samples/data_migration/examples/create_customer_group.yaml') =]]
[[= include_file('code_samples/data_migration/examples/create_product_variant.yaml', 1, 18) =]]
```

#### Currencies
#### Product variants

The following example shows how to create a currency:
The following example shows how to create variants for a product identified by its code:

``` yaml
[[= include_file('code_samples/data_migration/examples/create_currency.yaml') =]]
[[= include_file('code_samples/data_migration/examples/create_product_variant.yaml', 20, 29) =]]
```

#### Product assets

The following example creates an image [Content item](#content-items) from a local image file, and then uses it as a product asset for a variant ([created in previous example](#product-variant)):

``` yaml
[[= include_file('code_samples/data_migration/examples/create_product_asset.yaml') =]]
```

#### Prices
This migration uses a [reference](managing_migrations.md#references) to store the created image Content ID, and then uses it while creating the asset.
It uses an [expression syntax](#expression-syntax) to [concat (`~`)]([[= symfony_doc =]]/reference/formats/expression_language.html#string-operators)
the mandatory scheme `ezcontent://` and the image content ID through the [`reference` function](#built-in-functions) used on the reference's name.

#### Product prices

The following example shows how to create a price for a product identified by its code:

``` yaml
[[= include_file('code_samples/data_migration/examples/create_price.yaml') =]]
[[= include_file('code_samples/data_migration/examples/create_product_price.yaml') =]]
```

#### Customer groups

The following example shows how to create a customer group with a defined global price discount:

``` yaml
[[= include_file('code_samples/data_migration/examples/create_customer_group.yaml') =]]
```

#### Currencies

The following example shows how to create a currency:

``` yaml
[[= include_file('code_samples/data_migration/examples/create_currency.yaml') =]]
```

### Commerce [[% include 'snippets/commerce_badge.md' %]]

#### Payment methods

The following example shows how to create a payment method:

``` yaml
[[= include_file('code_samples/data_migration/examples/create_payment_method.yaml') =]]
```

#### Shipping methods

The following example shows how to create a shipping method:

``` yaml
Expand Down