SW6 Data Integration (DI) Layer

The data integration strategy is using the required Boxalino Data Integration Data Structures Data Structure

The DI plugin, provided by Boxalino with the purpose of Shopware6 integrations, is following the documented schemas and property definitions.

Integration Strategy

The integration strategy is done per content type (product, order, user, etc) and integration mode (delta, full, instant), as described in the public wiki https://github.com/boxalino/rtux-integration-shopware/wiki/DI:-Data-Integration

All DI modes (Full/Delta/Instant) can be integrated via console commands (for server crons) or with the use of Shopware6 Scheduled Task.

If declared in the Integration Layer, the updated content ids (product, users, orders) are saved in a tmp index table with the help of the subscribers (as seen in every Resources/config/services/di/<type>-subscriber.xml)

Review the Integration Strategies on our Confluence Integration Strategies

The integration strategy is handled by the integration team.

Integration Flow

The elements part of the Data Integration strategy are:

1.Integration Handler

There is an integration handler per data type and integration mode.

  1. is aware of the integration mode & type (required header for the DI requests)

  2. is setting the required headers tm & ts for the process

  3. requires the configurations for the process

  4. is aware of the list of document handlers required for the given data sync (ex: for product - the doc_language, doc_attribute, doc_attribute_value & doc_product https://github.com/boxalino/rtux-integration-shopware/blob/3.0.0/src/Resources/config/services/di/product-console.xml#L27 )

  5. calls the “integrate” behavior of every document handler https://github.com/boxalino/data-integration-doc-php/blob/3.0.0/src/Service/Integration/Mode/FullIntegrationTrait.php#L39

  6. makes the “sync” call to the DI endpoint Sync Request

2.Document handler

  1. is aware of the document type (required header for the DI request) https://github.com/boxalino/data-integration-doc-php/blob/3.0.0/src/Service/Integration/Doc/DocOrder.php#L36

  2. is aware of the document schema https://github.com/boxalino/data-integration-doc-php/blob/3.0.0/src/Service/Integration/Doc/DocOrder.php#L45

  3. getValues() from the list of property handlers and creates the document content via addDocLine (ex: order )

  4. makes the “load” call to the DI endpoint Load Request

3.Property Handlers

  1. manages the export for a given property (ex: price)

  2. can be activated for the instant mode (via “allowInstantMode” method) (disabled by default)

  3. are added to the document handler in the Integration Layer, which makes it 100% configurable

Data Mapping

Due to the nature of the integration process, there must be done a mapping between e-shop/Shopware6 fields and the documented schema properties.

The following mapping strategies are used in the Data Integration Layer:

  1. for generic source handlers (ex: the services loading information from the main tables - order, product, customer) :

    1. addPropertyNameDocMapping function https://github.com/boxalino/data-integration-shopware6/blob/master/src/Resources/config/product.xml#L161 (ex: product_number is mapped to sku, is_closeout is mapped to show_out_of_stock, restock_time/purchase_price is a numeric_attribute, etc)

    2. addSchemaDefinition function https://github.com/boxalino/data-integration-shopware6/blob/master/src/Resources/config/product.xml#L297 - it will translate the given field to the assigned schema

    3. this is used thoroughly for Service\Document\Order\Entity, Service\Document\User\Entity & Service\Document\Product\Attribute\Entity

  2. property handlers for specific properties (ex: categories, stock, price, order billing, order shipping ,etc) via addPropertyHandler

    1. helps isolate the source of your data (ex: project DB, other sources, etc) and translates them to the required data structure

    2. allows to add multiple custom property types dynamically, as part of your integration layer (ex: extend the DocOrderHandlerInterface with other order sources, change the default/generic property handlers for stock assigned to the DocProductHandlerInterface, etc)

Every document handler, via the createDocLines() function, will generate the document data by merging the values provided by each DocSchemaHandlerIntefrace (content source), grouping them by entity ID. The output will be transformed to the document line object with Every document line/row/item is a representation of the required Data Structure (as documented by Boxalino Data Structure )

Property Handler Options

Edit the property handler in your Doc<Type>HandlerInterface service (ex: product doc handler):

<call method="addPropertyHandler"> <argument type="service" id="new-property-handler-service-id"/> </call>

We recommend to replicate an existing handler in your Integration Layer and update the _getQuery() function (ex: to replace the logic for stock).