Scheduling synchronization of data between Magento and Synerise

WARNING: Synchronization is disabled by default. Before enabling it, verify the configuration of each item attribute to make sure it contains all data you want to include.

Synchronization options


  • Continuous (based on observers) - Once synchronization is enabled, any updates or creation of new items will be automatically queued to be sent to Synerise. In this approach, the data on each update/creation is sent as a separate request.
  • Full (scheduled for selected scopes) - You can send all currently existing data to Synerise. This requires scheduling and can be used for exporting historical data to Synerise.
  • Batch (scheduled for selected item sets) - You can schedule batches of items whose data you want to send to Synerise. This is based on manually selecting items.

Scope of synchronized data


You can synchronize models for the store views you select.

Click here to expand model description

Model Description Location of data in Synerise
Customers Customer attributes in Magento are qualities assigned to customers. You can send all attributes to Synerise, including custom ones. The list in the Attributes section excludes the required attributes which are sent by default:

- email,
- entity_id,
- firstname,
- lastname,

To deselect or select the attributes, go to Stores > Synerise > Configuration > Data. The changes of attribute selection will apply only for customers who haven’t been sent to Synerise yet. To apply the changes to all customers, run full synchronization.
The Profiles module
Orders Information about orders are stored as product.buy/transaction.charge events. Activity list on the profile of a customer in the Profiles module
Products Product attributes in Magento are qualities assigned to items. You can send all attributes to Synerise, including custom ones. The list in the Attributes excludes the required attributes which are sent by default:

- itemId (sku),
- price,
- productUrl,
- parendId,
- deleted,
- category,
- additionalCategories,
- image,

To include tax value in a product price sent to Synerise, set the Calculate tax field to Yes.

To enable sending the text values and IDs of the attribute options, set the Selectable attribute value to ID & Labels. If this option is set to ID, the values are sent to Synerise in the form of IDs, for example, for the color attribute, Magento sends the following values: 1, 2, 3 instead of black, white, grey.

To deselect or select the attributes go to Stores > Synerise > Configuration > Data. The changes of products selection will apply only for products which haven’t been sent to Synerise yet. To apply the changes to all products, run full synchronization.
Data Management > Catalogs
Subscribers The value of the subscription attribute of a customer. Profile of a customer in the Profiles module

By default, all models and store views are selected to be synchronized.

Changing scope of synchronized data


To exclude store views from synchronization, go to Stores > Synerise > Configuration > Workspaces. In the Stores section, select store views to be synchronized.

WARNING: The selection also affects tracking the store views. If you deselect store views from synchronization, you also deselect them from tracking.

Synchronization will include the scope of data in accordance with the configuration for store and models. Entities that do not contain data for models selected for synchronization will also be ignored.

  • To exclude models from synchronization, go to Stores > Synerise > Configuration > Data. Under Models deselect those that you wish to exclude.
  • To include or exclude values from particular models in synchronization, go to Stores > Synerise > Configuration > Data.

Enriching requests with custom data


Important: The procedure described in this section may require a developer’s help, as it can’t be performed in the interface.

If you want to enrich synchronization requests to Synerise with data which is not available in the models, perform the following steps.
The best way to modify the contents of requests sent to Synerise is to use Plugins/Interceptors.

In the example presented in this section:

  • a custom module has been prepared as prerequisite for this example. To learn more about creating a module, refer to the Magento documentation.
  • a plugin for OrderCRUD class will be prepared

Procedure

  1. Register a new plugin (interceptor) in the etc/di.xml file in the module:

    <config>
        <type name="Synerise\Integration\SyneriseApi\Mapper\Data\OrderCRUD">
            <plugin name="synerise_order_prepare_request" type="CompanyName\ModuleName\Plugin\OrderAttributes" />
        </type>
    </config>
        

  2. Create a plugin class:

    <?php
    namespace CompanyName\ModuleName\Plugin;
    
    use Magento\Sales\Model\Order;
    use Synerise\ApiClient\Model\CreateatransactionRequest;
    use Synerise\Integration\SyneriseApi\Mapper\Data\OrderCRUD;
    
    class OrderAttributes
    {
        public function afterPrepareRequest(
            OrderCRUD $subject,
            CreateatransactionRequest $request,
            Order $order,
            ?string $uuid = null,
            array $snrsParams = []
        ): CreateatransactionRequest
        {
            $metadata = $request->getMetadata();
            $metadata['customAttribute'] = 'Custom Value';
    
            $request->setMetadata($metadata);
    
            return $request;
        }
    }
        
    
  3. To add custom data to the request, replace the placeholder $metadata['customAttribute'] = 'Custom Value'; with your custom logic.

  4. To make sure your changes will produce a valid request, refer to Synerise API documentation .

Deleting customers


You can define how data is synchronized in Synerise when a customer is deleted in Magento.

  1. Go to Stores > Synerise > Configuration > Data.
  2. Expand the Customers model.
  3. From the Delete behavior dropdown list, select one of the following options:
    Option name Behavior in Synerise
    Send an Event A client.deleteAccount event is generated on the profile of the customer deleted in Magento; the customer remains in Synerise. You can create a workflow that anonymizes the customer when this event occurs.
    Remove permanently No event is generated; the customer is deleted
    Ignore No event is generated; the customer remains
The Customers section in Magento
The Customers section in Magento

Enabling continuous synchronization


The procedure described in this section lets you enable synchronization of real-time data. They will be sent as separate requests each time an entity is created or updated.

  1. Go to Stores > Synerise > Configuration > Data.
  2. To enable incremental data synchronization, in the Enabled field, set the value to Yes. In continuous data synchronization, new or modified data will be added to the queue and sent to Synerise.
  3. Define the values to be included in the Products and Customers models. These values will be included in full synchronization and incremental data synchronization.
  4. In the Max items per request fields, enter the number of items which will be sent in a full synchronization request to Synerise.
    Data is split into smaller requests in order to avoid timeouts or other problems resulting from too large requests.
  5. To enable sending the text values of the attribute options instead of their IDs, set the Labels as Values to Yes.
  6. In the upper right corner, click Save Config.

Scheduling full synchronization


This synchronization type lets you send all data (including historical data) to Synerise.

  1. Perform all steps described in the Enabling continuous synchronization section. If you have done it aready, proceed to the next step.

  2. Go to Marketing > Synerise > Synchronization.

  3. From the Scope dropdown list, you can select store view or the All store views option to be synchronized. If you want to synchronize only a few store views, run full synchronization for one store view at a time.

  4. In the table, in the first left column, select the models you want to synchronize.

  5. From the Actions dropdown list, select the Schedule option.

    • In result, all data will be sent to Synerise. To preview the synchronization logs, go to System > Synerise > Bulk Actions Log.
    • In Marketing > Synerise > Synchronization, you can preview amount of data in total and amount of data sent to Synerise for each store view.
    The Synchronization section in the Magento panel
    The Synchronization section in the Magento panel

Scheduling batch synchronization


To synchronize changes within items, orders, customer data, or subscriptions with Synerise:

  1. Go to:
    • Catalogs > Products - to synchronize changes in items.
    • Sales > Orders - to synchronize changes in orders.
    • Customers > All Customers - to synchronize changes in customer data.
    • Marketing > Communication > Newsletter Subscribers - to synchronize changes in subscriptions.
  2. From the list, select the items.
  3. Above the table, from the dropdown list, select Send to Synerise.

Synchronization debugging


You can learn more about the logic of sending data to Synerise through Message Queue Framework and debugging of the synchronization process in the “Message Queues logic” article.

😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker