From f6f9a31232ed35d7367fcb561783433ec397a7f2 Mon Sep 17 00:00:00 2001 From: Vitalij Mik Date: Wed, 22 May 2024 08:40:48 +0200 Subject: [PATCH] NTR: force javascript use shopware in 6.6 --- src/Resources/app/storefront/src/main.js | 7 ++++--- src/Subscriber/StorefrontBuildSubscriber.php | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Resources/app/storefront/src/main.js b/src/Resources/app/storefront/src/main.js index 25eebab38..4a9a0a3ff 100644 --- a/src/Resources/app/storefront/src/main.js +++ b/src/Resources/app/storefront/src/main.js @@ -5,6 +5,7 @@ import MollieRegistration from './register'; // if it's however necessary to use the built-in all.js, then this would // also work, as long as its built in the Shopware version that uses it. -const molliePlugins = new MollieRegistration(); - -molliePlugins.register(); +if (window.mollie_javascript_use_shopware !== undefined && window.mollie_javascript_use_shopware === '1') { + const molliePlugins = new MollieRegistration(); + molliePlugins.register(); +} \ No newline at end of file diff --git a/src/Subscriber/StorefrontBuildSubscriber.php b/src/Subscriber/StorefrontBuildSubscriber.php index e5fd2003a..563209a36 100644 --- a/src/Subscriber/StorefrontBuildSubscriber.php +++ b/src/Subscriber/StorefrontBuildSubscriber.php @@ -63,6 +63,7 @@ public function onStorefrontRender(StorefrontRenderEvent $event): void if ($this->versionCompare->gte('6.6')) { $molliePayments = $this->pluginRegistry->getConfigurations()->getByTechnicalName('MolliePayments'); $mollieJavascriptAlreadyExists = $molliePayments && ($molliePayments->getScriptFiles()->count() > 0); + $event->setParameter('mollie_javascript_use_shopware', true); } $event->setParameter('mollie_javascript_already_exists', $mollieJavascriptAlreadyExists); }