Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to guides #2267

Merged
merged 16 commits into from
Oct 31, 2023
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
26 changes: 16 additions & 10 deletions _data/sidebars/pbc_all_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1728,14 +1728,18 @@ entries:
- title: Import and export data
url: /docs/pbc/all/order-management-system/base-shop/import-and-export-data/import-and-export-order-management-system-data.html
nested:
- title: Orders data export
url: /docs/pbc/all/order-management-system/base-shop/import-and-export-data/orders-data-export/orders-data-export.html
nested:
- title: "Export file details: orders.csv"
url: /docs/pbc/all/order-management-system/base-shop/import-and-export-data/orders-data-export/export-file-details-orders.csv.html
- title: "Export file details: order-expenses.csv"
url: /docs/pbc/all/order-management-system/base-shop/import-and-export-data/orders-data-export/export-file-details-order-expenses.csv.html
- title: "Export file details: order-items.csv"
url: /docs/pbc/all/order-management-system/base-shop/import-and-export-data/orders-data-export/export-file-details-order-items.csv.html
- title: "Import file details: order-status.csv"
url: /docs/pbc/all/order-management-system/base-shop/import-and-export-data/import-file-details-order-status.csv.html
- title: "Export file details: orders.csv"
url: /docs/pbc/all/order-management-system/base-shop/import-and-export-data/export-file-details-orders.csv.html
- title: "Export file details: order-expenses.csv"
url: /docs/pbc/all/order-management-system/base-shop/import-and-export-data/export-file-details-order-expenses.csv.html
- title: "Export file details: order-items.csv"
url: /docs/pbc/all/order-management-system/base-shop/import-and-export-data/export-file-details-order-items.csv.html

- title: Install and upgrade
nested:
- title: Install features
Expand Down Expand Up @@ -1968,6 +1972,8 @@ entries:
url: /docs/pbc/all/payment-service-provider/base-shop/manage-in-the-back-office/edit-payment-methods.html
- title: View payment methods
url: /docs/pbc/all/payment-service-provider/base-shop/manage-in-the-back-office/view-payment-methods.html
- title: Debug payment integrations locally
url: /docs/pbc/all/payment-service-provider/base-shop/debug-payment-integrations-locally.html
- title: Hydrate payment methods for an order
url: /docs/pbc/all/payment-service-provider/base-shop/hydrate-payment-methods-for-an-order.html
- title: Interact with third party payment providers using Glue API
Expand Down Expand Up @@ -2328,13 +2334,13 @@ entries:
url: /docs/pbc/all/price-management/base-shop/manage-using-glue-api/retrieve-prices-when-retrieving-concrete-products.html
- title: Tutorials and HowTos
nested:
- title: "HowTo: Create personalized prices"
- title: Create personalized prices
url: /docs/pbc/all/price-management/base-shop/tutorials-and-howtos/howto-create-personalized-prices.html
- title: "HowTo: Handle twenty five million prices in Spryker Commerce OS"
- title: Handle twenty five million prices in Spryker Commerce OS
url: /docs/pbc/all/price-management/base-shop/tutorials-and-howtos/howto-handle-twenty-five-million-prices-in-spryker-commerce-os.html
- title: "HowTo: Manage business unit specific prices via data import"
- title: Manage business unit specific prices via data import
url: /docs/pbc/all/price-management/base-shop/tutorials-and-howtos/howto-manage-business-unit-specific-prices-via-data-import.html
- title: "HowTo: Schedule cron job for Scheduled Prices"
- title: Schedule cron job for scheduled prices
url: /docs/pbc/all/price-management/base-shop/tutorials-and-howtos/howto-schedule-cron-job-for-scheduled-prices.html
- title: Extend and customize
nested:
Expand Down
21 changes: 6 additions & 15 deletions _data/sidebars/scos_dev_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ entries:
url: /docs/scos/dev/glue-api-guides/routing/create-backend-resources.html
- title: Create routes
url: /docs/scos/dev/glue-api-guides/routing/create-routes.html
- title: Configure the included section
url: /docs/scos/dev/glue-api-guides/configure-the-included-section.html
- title: Configure cross-origin resource sharing
url: /docs/scos/dev/glue-api-guides/configure-cross-origin-resource-sharing-for-glue-api.html
- title: Create and change Glue API conventions
url: /docs/scos/dev/glue-api-guides/create-and-change-glue-api-conventions.html
include_versions:
Expand Down Expand Up @@ -407,6 +411,8 @@ entries:
- "202009.0"
- "202108.0"
- "202204.0"
- title: Integrate a CIAM provider
url: /docs/scos/dev/glue-api-guides/integrate-a-ciam-provider.html
- title: Resolving search engine friendly URLs
url: /docs/scos/dev/glue-api-guides/resolving-search-engine-friendly-urls.html
include_versions:
Expand Down Expand Up @@ -2178,25 +2184,12 @@ entries:
- title: HowTos
url: /docs/scos/dev/tutorials-and-howtos/howtos/about-howtos.html
nested:
- title: Glue API HowTos
url: /docs/scos/dev/tutorials-and-howtos/howtos/glue-api-howtos/glue-api-howtos.html
nested:
- title: Configure cross-origin resource sharing for Glue API
url: /docs/scos/dev/tutorials-and-howtos/howtos/glue-api-howtos/configure-cross-origin-resource-sharing-for-glue-api.html
- title: Configuring Visibility of the Included Section
url: /docs/scos/dev/tutorials-and-howtos/howtos/glue-api-howtos/configuring-visibility-of-the-included-section.html
- title: Managing customer access to Glue API resources
url: /docs/scos/dev/tutorials-and-howtos/howtos/glue-api-howtos/managing-customer-access-to-glue-api-resources.html
- title: "HowTo: Integrate a CIAM provider"
url: /docs/scos/dev/tutorials-and-howtos/howtos/glue-api-howtos/howto-integrate-a-ciam-provider.html
- title: "HowTo: Replace key-value storage with database"
url: /docs/scos/dev/tutorials-and-howtos/howtos/howto-replace-key-value-storage-with-database.html
- title: "HowTo: Force HTTPS"
url: /docs/scos/dev/tutorials-and-howtos/howtos/howto-force-https.html
- title: "HowTo: Customize HTTP headers in AJAX request"
url: /docs/scos/dev/tutorials-and-howtos/howtos/howto-customize-http-headers-in-ajax-request.html
- title: "HowTo: Debug payment integrations locally"
url: /docs/scos/dev/tutorials-and-howtos/howtos/howto-debug-payment-integrations-locally.html
- title: "HowTo: Set up Spryker with MySQL"
url: /docs/scos/dev/tutorials-and-howtos/howtos/howto-set-up-spryker-with-mysql.html
- title: "HowTo: Do better deployments"
Expand All @@ -2211,8 +2204,6 @@ entries:
url: /docs/scos/dev/tutorials-and-howtos/howtos/howto-notify-about-unsupported-browsers.html
- title: "HowTo: Handle graceful shutdown"
url: /docs/scos/dev/tutorials-and-howtos/howtos/howto-handle-graceful-shutdown.html
- title: "HowTo: Install Spryker in AWS environment"
url: /docs/scos/dev/tutorials-and-howtos/howtos/howto-install-spryker-in-aws-environment.html
- title: "HowTo: Set up custom response headers on project level"
url: /docs/scos/dev/tutorials-and-howtos/howtos/howto-set-up-custom-response-headers-on-project-level.html
- title: "HowTo: Set up database connections"
Expand Down
2 changes: 1 addition & 1 deletion _scripts/redirects_generator/redirect_from_generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ process_markdown_files() {
}

# Specify the folder to add `redirect_from` to
folder_path="docs/pbc/all/product-information-management/202307.0/marketplace/import-and-export-data"
folder_path="docs/pbc/all/order-management-system/202307.0/base-shop/import-and-export-data/orders-data-export"

# Check if the folder exists
if [ ! -d "$folder_path" ]; then
Expand Down
2 changes: 1 addition & 1 deletion _scripts/redirects_generator/redirects_generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ process_files() {
}

# Specify the folder containing the files to add paths to
folder_path="docs/pbc/all/product-information-management/202307.0/marketplace/import-and-export-data"
folder_path="docs/pbc/all/order-management-system/202307.0/base-shop/import-and-export-data/orders-data-export"

# Check if the folder exists
if [ ! -d "$folder_path" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ template: concept-topic-template
To learn how data import works and about different ways of importing data, see [Data import](/docs/scos/dev/data-import/{{page.version}}/data-import.html). This section describes the data import files that are used to import data related to the Order Management System PBC:

* [Import file details - order-status.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/import-file-details-order-status.csv.html)
* [Export file details: orders.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/export-file-details-orders.csv.html)
* [Export file details: order-expenses.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/export-file-details-order-expenses.csv.html)
* [Export file details: order-items.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/export-file-details-order-items.csv.html)
* [Export file details: orders.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/orders-data-export/export-file-details-orders.csv.html)
* [Export file details: order-expenses.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/orders-data-export/export-file-details-order-expenses.csv.html)
* [Export file details: order-items.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/orders-data-export/export-file-details-order-items.csv.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
---
title: Orders data export
description: This document shows how to export data from a Spryker shop to an external system
last_updated: Jun 16, 2021
template: concept-topic-template
originalLink: https://documentation.spryker.com/2021080/docs/exporting-data
originalArticleId: 0a38b991-f10c-4f6c-90db-247a62cda2e7
related:
- title: Sales Data Export feature integration
link: docs/pbc/all/order-management-system/page.version/base-shop/install-and-upgrade/install-features/install-the-sales-data-export-feature.html
---

To quickly populate an external system like ERP or OMS with data from your Spryker shop, you can export it as CSV files from the Spryker shop and then import them into the external system.

You can export any of the following data in the CSV format:

* Orders
* Order items
* Order expenses

Spryker Data Export supports the multi-store functionality, so you can define which stores to export data for.


## Prerequisites

[Install the Sales Data Export feature](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/install-and-upgrade/install-features/install-the-sales-data-export-feature.html).

## Defining the data to export

The YML export configuration file lets you define what information to export. The root of data export files is configured globally, and data export does not change it. The following can be exported:
* order
* order-item
* order-expense


By default, the YML export configuration file resides in `./data/export/config/`. The structure of the YML export configuration file is as follows:

```yml
defaults:
filter_criteria: &default_filter_criteria
order_created_at:
type: between
from: '<order_created_at_date-time_from_value>'
to: '<order_created_at_date-time_to_value>'

actions:
- data_entity: order
destination: '{data_entity}s_<store_name_value_1>_{timestamp}.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: [<store_name_value_1>]
- data_entity: order
destination: '{data_entity}s_<store_name_value_2>_{timestamp}.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: [<store_name_value_2>]
- data_entity: order
destination: '{data_entity}s_<store_name_value_n>_{timestamp}.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: [<store_name_value_n>]

- data_entity: order-item
destination: '{data_entity}s_<store_name_value_1>_{timestamp}.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: [<store_name_value_1>]

- data_entity: order-expense
destination: '{data_entity}s_<store_name_value_1>_{timestamp}.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: [<store_name_value_1>]
```

The type of content to export is defined in the `actions` section by `data_entity` and can be any of the following:
* `order`
* `order-item`
* `order-expense`.

For an example, see the default configuration file: [order_export_config.yml](https://github.com/spryker-shop/suite/blob/master/data/export/production/order_export_config.yml).


## Defining the stores to export data from

To define the stores you want to export the order data for, specify them in `destination` for the specific data entities.

You _must_ create individual files for each data entity and each store if your filter criteria include `store_name`.

For example, to export the `order-expenses` data for the DE store and `order-items` data for DE and AT stores, the YML file looks like this:

```yml
defaults:
filter_criteria: &default_filter_criteria
order_created_at:
type: between
from: '2020-05-01 00:00:00'
to: '2020-12-31 23:59:59'

actions:
- data_entity: order-expense
destination: '{data_entity}s_DE_{timestamp}.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: [DE]

- data_entity: order-item
destination: '{data_entity}s_DE_{timestamp}.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: [DE]
- data_entity: order-item
destination: '{data_entity}s_AT_{timestamp}.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: [AT]
```

## Defining the file names

Defining the file names to export data to is important when you are running the export multiple times. Existing data export files are overwritten by running a new export. So, if you want to keep several versions of the export files, you can use the `{timestamp}` tag in the file name. The timestamp tag adds a timestamp to the files names based on the time you run the export.


```yml
defaults:
filter_criteria: &default_filter_criteria
order_created_at:
type: between
from: '2020-05-01 08:00:00'
to: '2020-06-07 08:00:00'

actions:
- data_entity: order-expense
destination: '{data_entity}s_DE_{timestamp}.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: DE
- data_entity: order-expense
destination: '{data_entity}s_AT_{timestamp}.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: AT
...
```

The other way around, if you want to overwrite the previous version of the export files, don't add the `{timestamp}` tag or change the `destination` in any other way.


## Defining the date and time range to export data for

The following sections of the YML configuration file let you define the date the date and time range to export data for per entity.


| SECTION | DESCRIPTION |
| - | - |
| actions | Inclusively defines the date and time range to export data for per entity. If you use the label `order_updated_at`, the range is relative to the date and time the order was updated at. |
| defaults | Defines the default date and time range to export data for. This range is used in case a data and time range is not provided for an entity. |

In the `actions` section of data export configuration file, you can define

```yml
defaults:
filter_criteria: &default_filter_criteria
order_created_at:
type: between
from: '2020-05-01 00:00:00'
to: '2020-06-07 23:59:59'

actions:
- data_entity: order-expense
destination: '{data_entity}s_DE.{extension}'
filter_criteria:
<<: *default_filter_criteria
store_name: DE
- data_entity: order-expense
destination: '{data_entity}s_AT.{extension}'
filter_criteria:
order_created_at:
type: between
from: '2020-05-15 00:00:00'
to: '2020-05-15 23:59:59'
store_name: AT
...
```

## Creating the export files

To generate data export files, run the following command:

```bash
console data:export --config {{CONFIG_FILE_NAME}}
```

Example:

```bash
console data:export --config order_export_config.yml
```

This creates export CSV files in `./data/export/` per the defined configuration.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ template: concept-topic-template
To learn how data import works and about different ways of importing data, see [Data import](/docs/scos/dev/data-import/{{page.version}}/data-import.html). This section describes the data import files that are used to import data related to the Order Management System PBC:

* [Import file details - order-status.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/import-file-details-order-status.csv.html)
* [Export file details: orders.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/export-file-details-orders.csv.html)
* [Export file details: order-expenses.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/export-file-details-order-expenses.csv.html)
* [Export file details: order-items.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/export-file-details-order-items.csv.html)
* [Export file details: orders.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/orders-data-export/export-file-details-orders.csv.html)
* [Export file details: order-expenses.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/orders-data-export/export-file-details-order-expenses.csv.html)
* [Export file details: order-items.csv](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/import-and-export-data/orders-data-export/export-file-details-order-items.csv.html)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: "Export file details: order-expenses.csv"
description: The document explains the format of the orders.csv, order-items.csv, order-expenses.csv export files
last_updated: Jun 16, 2021
template: data-export-template
redirect_from:
- /docs/pbc/all/order-management-system/202307.0/base-shop/import-and-export-data/export-file-details-order-expenses.csv.html
related:
- title: Exporting data
link: docs/scos/dev/data-import/page.version/data-export.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: "Export file details: order_items.csv"
description: The document explains the format of the orders.csv, order-items.csv, order-expenses.csv export files
last_updated: Jun 16, 2021
template: data-export-template
redirect_from:
- /docs/pbc/all/order-management-system/202307.0/base-shop/import-and-export-data/export-file-details-order-items.csv.html
related:
- title: Exporting data
link: docs/scos/dev/data-import/page.version/data-export.html
Expand Down
Loading
Loading