diff --git a/CHANGELOG.md b/CHANGELOG.md index a5b367a7..7e985017 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased ### Add - Add to cart button for record list +- Add automated feed export base on Shopware Scheduled Task ## [v7.0.0] - 2025.07.23 ### BREAKING diff --git a/README.md b/README.md index c1bd43df..84044172 100755 --- a/README.md +++ b/README.md @@ -208,6 +208,24 @@ Following settings are used for uploading already exported feed to a given FTP/S You can check if the above data is correctly set by clicking on the `Test Connection` button. Please save your settings before clicking on button. +## Automatic Export Settings + +![automatic-export-settings.png](docs/assets/automatic-export-settings.png) + +The plugin provides a configuration section in the administration panel that allows you to enable or disable automatic export and define which sales channel and language should be used for the products export. +By default, the automatic export is disabled. Once the administrator enables it and choose the sales channel and language, the automatic export will be active. +By default, automatic export is performed once every 48 hours. If you want to change this value, you must overwrite the `ExportScheduledTask` file as follows: + + //src/ScheduledTask/ExportScheduledTask.php + public static function getDefaultInterval(): int + { + // change this value to adjust the export interval. This value is in seconds. + // for example: 48 hours = 172800 + return 172800; + } + +Automatic Export is based on Shopware Scheduled Task. For more information, see the [Shopware documentation](https://developer.shopware.com/docs/guides/plugins/plugins/plugin-fundamentals/add-scheduled-task.html) + ## Category Pages Plugin offers a way to use FACT-Finder® Web Components on category pages using page builder Shopping Experiences. There diff --git a/docs/assets/automatic-export-settings.png b/docs/assets/automatic-export-settings.png new file mode 100644 index 00000000..d2d97965 Binary files /dev/null and b/docs/assets/automatic-export-settings.png differ diff --git a/src/Resources/config/config.xml b/src/Resources/config/config.xml index 593ba8de..9cbb4466 100644 --- a/src/Resources/config/config.xml +++ b/src/Resources/config/config.xml @@ -303,4 +303,37 @@ testApiConnection + + + Automatic Export Settings + Einstellungen für automatischen Export + + autoExportEnabled + + + Enable or disable the automatic export feature. More information in the documentation + Aktivieren oder deaktivieren Sie die Funktion für den automatischen Export. + false + + + autoExportSelectedSalesChannel + + + Select the sales channel for automatic export. + Wählen Sie den Vertriebskanal für den automatischen Export. + sales_channel + Select a sales channel... + Vertriebskanal auswählen... + + + autoExportSelectedLanguage + + + Select the language for the export. + Wählen Sie die Sprache für den Export des Vertriebskanals. + language + Select a language... + Sprache auswählen... + + diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 63938d55..f0153e12 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -202,5 +202,16 @@ + + + + + + + + + + + diff --git a/src/ScheduledTask/ExportScheduledTask.php b/src/ScheduledTask/ExportScheduledTask.php new file mode 100644 index 00000000..59049b8d --- /dev/null +++ b/src/ScheduledTask/ExportScheduledTask.php @@ -0,0 +1,22 @@ +systemConfig->get('OmikronFactFinder.config.autoExportEnabled'); + $salesChannel = $this->systemConfig->get('OmikronFactFinder.config.autoExportSelectedSalesChannel'); + $language = $this->systemConfig->get('OmikronFactFinder.config.autoExportSelectedLanguage'); + + if (!$autoExportEnabled || !$salesChannel || !$language) { + $this->factfinderLogger->info('FactFinder auto export is disabled or not configured properly.'); + + return; + } + + try { + $this->feedExportHandler->__invoke(new FeedExport( + $salesChannel, + $language, + 'products' + )); + } catch (\Exception $e) { + $this->factfinderLogger->error($e->getMessage()); + } + } +}