Development Guide
How does data exchange work?
- Pimcore writes a JSON file for an export job to a configured directory on the file system
- Shopware processes the
.json
file via a provided messenger transport; the file extension of the JSON file is renamed to.work
before processing to avoid duplicate import processes. - Once Shopware has completed processing, the
.work
file is renamed to.done
- Pimcore processes the
.done
file and sends an import report via email. Pimcore moves the.done
file toPIMCORE_ROOT/var/logs/shopware/
Check Pimcore export data
Export via CLI
To verify the output of the export job during development, an export can be started via CLI in addition to scheduling through the Pimcore Admin interface.
php bin/console twocream:shopware-connector:export example@twocream.com shop_stage --products --attributes --pretty
In this example, an export will be executed with the adapters with package names products
and attributes
for the target system shop_stage
. The reports about the export are sent to example@twocream.com
.
With --pretty
, it is specified that the JSON is created in a readable form and not minified.
For more details, see: Pimcore Export Command
Queue System
If an export job is started via the admin interface, the following command must be used to run the queue:
php bin/console twocream:shopware-connector:queue
Shopware Import
To import export jobs into Shopware for testing purposes, a CLI command is provided alongside the Symfony Messenger.
Testing
For testing/debugging purposes within development, the following command can be used to import a single file.
This has the advantage that the original .json
file remains intact and is not deleted after import.
This allows continuous testing during the implementation of the import module without scheduling new export jobs.
php bin/console twocream:json:import path/to/file.json
For more details, see: JSON Import Command
Messenger Transport
To import export jobs via the queue, the Symfony Messenger transport json
must be consumed, which is done by executing the following command in Shopware:
php bin/console messenger:consume json
The messenger transport handles processing of the JSON files stored in the directory defined in the configuration.