1212use Shopware \Core \Framework \Struct \Struct ;
1313use Shopware \Storefront \Event \StorefrontRenderEvent ;
1414use Shopware \Storefront \Page \GenericPageLoadedEvent ;
15+ use Symfony \Component \DependencyInjection \ParameterBag \ParameterBagInterface ;
1516use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
1617use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
1718use Symfony \Component \Routing \RouterInterface ;
@@ -23,8 +24,10 @@ class ConfigurationSubscriber implements EventSubscriberInterface
2324 private array $ fieldRoles ;
2425 private array $ communicationParameters ;
2526 private array $ addParams ;
27+ private ParameterBagInterface $ params ;
2628
2729 public function __construct (
30+ ParameterBagInterface $ params ,
2831 Communication $ config ,
2932 ExtensionConfig $ extensionConfig ,
3033 RouterInterface $ router ,
@@ -38,6 +41,7 @@ public function __construct(
3841 $ this ->fieldRoles = $ fieldRoles ;
3942 $ this ->communicationParameters = $ communicationParameters ;
4043 $ this ->addParams = $ configurationAddParams ;
44+ $ this ->params = $ params ;
4145 }
4246
4347 public static function getSubscribedEvents ()
@@ -80,6 +84,7 @@ public function onPageLoaded(ShopwareSalesChannelEvent $event): void
8084 'searchImmediate ' => $ this ->isSearchImmediate ($ event ) ? 'true ' : 'false ' ,
8185 'userId ' => $ customer ? $ customer ->getId () : null ,
8286 'ssr ' => $ this ->config ->isSsrActive (),
87+ 'shopwareVersion ' => $ this ->getShopwareVersion (),
8388 ]));
8489 }
8590 }
@@ -135,4 +140,11 @@ private function getServerUrl(): string
135140
136141 return $ this ->config ->getServerUrl ();
137142 }
143+
144+ private function getShopwareVersion (): int
145+ {
146+ $ version = str_replace ('. ' , '' , $ this ->params ->get ('kernel.shopware_version ' ));
147+
148+ return (int ) $ version ;
149+ }
138150}
0 commit comments