From caf6b3a2ed032b96d6879939a9345ef62a5d472d Mon Sep 17 00:00:00 2001 From: Ilja Weber Date: Wed, 5 Oct 2022 11:51:44 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Verkaufkanaleinstellung=20hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mit diesem Commit fügen wir eine Einstellungsmöglichkeit für das Plugin. Die Einstellung ermöglicht, das man pro Verkaufskanal (Sales Channel) einstellen kann, ob das Plugin aktiv oder inaktiv sein soll. --- src/Resources/config/config.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Resources/config/config.xml b/src/Resources/config/config.xml index b2c09fa2..b50d58c9 100644 --- a/src/Resources/config/config.xml +++ b/src/Resources/config/config.xml @@ -29,8 +29,20 @@ + + + Sales-Channel Settings + Verkaufskanaleinstellungen + + enderecoActiveInThisChannel + + + true + If this toggle is set to active, then the plugin will be activated in this sales channel. + Mit dieser Einstellung kann man das Plugin in bestimmten Verkaufkanälen deaktivieren. + From 80da54012319b3e37b2825a723927c11bd7c2a2f Mon Sep 17 00:00:00 2001 From: Ilja Weber Date: Wed, 5 Oct 2022 12:12:05 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Je=20nach=20Einstellung=20die=20Bl=C3=B6cke?= =?UTF-8?q?=20=C3=BCberschreiben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mit diesem Commit werden TWIG nur dann erweitert, wenn das Plugin im Sales Channel aktiv ist. Die Templates werden zwar grundsätzlich überschrieben, aber der Code, der hinzugefügt werden muss, wird nur bei aktiven Sales Channels hizugefügt. --- src/EnderecoShopware6Client.php | 2 +- src/Resources/views/storefront/base.html.twig | 14 ++++---- .../component/address/address-form.html.twig | 32 ++++++++++--------- .../views/storefront/layout/meta.html.twig | 3 ++ src/Service/AddDataToPage.php | 2 ++ 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/EnderecoShopware6Client.php b/src/EnderecoShopware6Client.php index d10dde24..95b86a00 100644 --- a/src/EnderecoShopware6Client.php +++ b/src/EnderecoShopware6Client.php @@ -6,7 +6,7 @@ use Shopware\Core\Framework\Plugin\Context\UninstallContext; use Shopware\Core\Framework\Plugin\Context\InstallContext; use Shopware\Core\Framework\Plugin\Context\UpdateContext; -use Shopware\Core\Framework\Log\LoggerFactory; + class EnderecoShopware6Client extends Plugin { diff --git a/src/Resources/views/storefront/base.html.twig b/src/Resources/views/storefront/base.html.twig index b081c097..ebc2daef 100644 --- a/src/Resources/views/storefront/base.html.twig +++ b/src/Resources/views/storefront/base.html.twig @@ -2,10 +2,12 @@ {% block base_body_script %} {{ parent() }} - + {% if page.endereco_config.pluginActive %} + + {% endif %} {% endblock %} diff --git a/src/Resources/views/storefront/component/address/address-form.html.twig b/src/Resources/views/storefront/component/address/address-form.html.twig index e4e6f063..65478294 100644 --- a/src/Resources/views/storefront/component/address/address-form.html.twig +++ b/src/Resources/views/storefront/component/address/address-form.html.twig @@ -2,19 +2,21 @@ {% block component_address_form_address_fields %} {{ parent() }} - + {% if page.endereco_config.pluginActive %} + + {% endif %} {% endblock %} diff --git a/src/Resources/views/storefront/layout/meta.html.twig b/src/Resources/views/storefront/layout/meta.html.twig index dd15d445..4bd4d3dc 100644 --- a/src/Resources/views/storefront/layout/meta.html.twig +++ b/src/Resources/views/storefront/layout/meta.html.twig @@ -1,6 +1,7 @@ {% sw_extends '@Storefront/storefront/layout/meta.html.twig' %} {% block layout_head_meta_tags %} + {% if page.endereco_config.pluginActive %} + {% endif %} + {{ parent() }} {% endblock %} diff --git a/src/Service/AddDataToPage.php b/src/Service/AddDataToPage.php index 9ee954a1..26e3afeb 100644 --- a/src/Service/AddDataToPage.php +++ b/src/Service/AddDataToPage.php @@ -80,6 +80,8 @@ public function addEnderecoConfigToPage(GenericPageLoadedEvent $event): void $configContainer->enderecoAllowCloseIcon = $this->systemConfigService->get('EnderecoShopware6Client.config.enderecoAllowCloseIcon', $salesChannelId); $configContainer->enderecoConfirmWithCheckbox = $this->systemConfigService->get('EnderecoShopware6Client.config.enderecoConfirmWithCheckbox', $salesChannelId); + $configContainer->pluginActive = $this->systemConfigService->get('EnderecoShopware6Client.config.enderecoActiveInThisChannel', $salesChannelId); + $countries = $this->countryRepository->search(new Criteria(), $context); $mapping = []; From 06c338e1de3de3783c6f0371f36264d2bfbbd589 Mon Sep 17 00:00:00 2001 From: Ilja Weber Date: Wed, 5 Oct 2022 13:09:01 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Erh=C3=B6he=20die=20Version=20auf=201.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ae711c51..fa41ee3d 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "endereco/endereco-shopware6-client", "description": "Checks customers' addresses in real time. In case of errors, the customer is prompted to correct his address before sending via warning windows and error messages.", - "version": "1.0.7", + "version": "1.1.0", "type": "shopware-platform-plugin", "license": "AGPL-3.0-or-later", "authors": [