This section provides an overview of the media module's subsections. The following diagram illustrates the steps performed by the media module:
More information about each step is provided below.
Step 1: Sanity Checks
In this initial phase, the following checks are performed:
- Validation of API integration
- Validation of the availability of identifier custom fields (created if necessary)
- Validation of the availability of media data custom fields (created if necessary)
Step 2: Removal of Empty Media Objects
The module has the capability to remove media entities that lack media files. Such entities can result from errors during file uploads, third-party plugins, or manual misconfigurations in the administration panel.
Step 3: Extracting Embedded Assets
The 'extract-assets' subsection extracts 'Assets' from their 'BaseDocuments' before processing them. This extraction enhances the performance during the generation of references from entities (e.g. product entities) to media entities and makes it possible to initialize progresses.
The extraction process separates the uploading of files to Shopware from the assignment of media files to Shopware entities, allowing the use of the Sync API in multiple cases, such as:
- Searching for corresponding media files linked to assets in Shopware
- Creating and updating references to media entities in media-aware entities
Step 4: Initializing Progress
Before mapping media files to Shopware, progress calculations are performed for each subsection. This offers a clear overview on the " Flow Executions" page in the synQup frontend, showing the quantity and types of entities that will be transferred. Progress is calculated based on all assets extracted in step 3.
Step 5: Handling Media Files
Step 5.1: Analyzing Media Files and Comparing Assets to Shopware Files
This step involves analyzing assets and comparing them to existing media entities in Shopware. The file operation generator carries out the following actions:
- Read extracted assets from the cache
- Bulk search for corresponding media entities using asset identifiers
- Compare each asset to its associated media entity (if it exists) to determine whether the media entity/file in Shopware should be created, updated, renamed, or removed. The actual execution of operations occurs in the next step.
Step 5.2: Updating Media Files
This step executes the operations generated in step 5.1.
Step 6: Handling Media Associations
Step 6.1: Analyzing Associations
Depending on the type of association (single media reference vs. media association table like product-media), the module generates Sync API operations to synchronize the media associations. This includes setting covers and positions.
Step 6.2: Updating Associations
In this final phase, the module executes the sync API operations generated in step 6.1.