From 3b17e80cec7eca33f2de4e7ee2eb1cd35aaf7e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20B=C3=B6swetter?= Date: Wed, 19 Feb 2020 09:19:39 +0100 Subject: [PATCH] [!!!][BUGFIX] updates reinitialization of the shop context in the ApiUrlDecorator to use the correct base URL in language sub-shops [!!!] this is a breaking change, as the URL generation for the entity "pxShopwareUrl" in all API responses may change regarding your setup --- Components/ApiUrlDecorator.php | 13 +++++-------- plugin.xml | 13 ++++++++++++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Components/ApiUrlDecorator.php b/Components/ApiUrlDecorator.php index f98ce7a..9d4d5c4 100644 --- a/Components/ApiUrlDecorator.php +++ b/Components/ApiUrlDecorator.php @@ -77,10 +77,10 @@ public function __construct(\Enlight_Controller_Action $controller, Container $c $this->request = $this->controller->Request(); $this->view = $this->controller->View(); $this->shopResource = Manager::getResource('shop'); - $this->isPxShopwareRequest = ($this->request->getParam('px_shopware') != null) ? (bool)$this->request->getParam('px_shopware') : false; + $this->isPxShopwareRequest = ($this->request->getParam('px_shopware') !== null) ? (bool)$this->request->getParam('px_shopware') : false; if ($this->isPxShopwareRequest) { - $language = ($this->request->getParam('language') != null) ? (int)$this->request->getParam('language') : false; + $language = ($this->request->getParam('language') !== null) ? (int)$this->request->getParam('language') : false; if ($language !== false) { // we cannot use this query, because of bug described here: https://issues.shopware.com/#/issues/SW-15388 // $this->shop = $this->shopResource->getRepository()->queryBy(array('active' => TRUE, 'locale' => $language))->getOneOrNullResult(); @@ -99,9 +99,7 @@ public function __construct(\Enlight_Controller_Action $controller, Container $c } else { // if '___VERSION___' is given, it seems to be a composer installation // composer is available from 5.4 on and there we have the container 'shopware.release' - /** @var \Shopware\Components\ShopwareReleaseStruct $shopwareRelease */ - $shopwareRelease = $this->container->get('shopware.release'); - $currentVersion = $shopwareRelease->getVersion(); + $currentVersion = $this->container->getParameter('shopware.release.version'); } $context = $router->getContext(); @@ -109,8 +107,8 @@ public function __construct(\Enlight_Controller_Action $controller, Container $c // Reuse the host if ($newContext->getHost() === null) { $newContext->setHost($context->getHost()); - $newContext->setBaseUrl($context->getBaseUrl()); - $newContext->setSecure($context->isSecure()); + $newContext->setBaseUrl($this->shop->getBaseUrl() ?: $context->getBaseUrl()); + $newContext->setSecure($this->shop->getSecure() ?: $context->isSecure()); } if (version_compare($currentVersion, '5.4.0', '<')) { // the following methods are removed in Shopware 5.4 @@ -162,7 +160,6 @@ public function addUrl() } $data = $items; } - } $this->controller->View()->clearAssign('data'); diff --git a/plugin.xml b/plugin.xml index c11bb3c..afa3931 100644 --- a/plugin.xml +++ b/plugin.xml @@ -3,7 +3,7 @@ - 2.4.1 + 2.5.0 © 2019 by portrino GmbH @@ -16,6 +16,17 @@ Ermöglicht die Kommunikation mit der TYPO3-Erweiterung "PxShopware" Enables communication with TYPO3-Extension "PxShopware". + + + [!!!][BUGFIX] Aktualisiert die Neuinitialisierung des Shop-Kontexts im ApiUrlDecorator, um die richtige Basis-URL in Sprach-Sub-Shops zu verwenden + [!!!] Dies ist eine wichtige Änderung, da sich die URL-Generierung für die Entität "pxShopwareUrl" in allen API-Antworten in Bezug auf Ihr Setup ändern kann + + + [!!!][BUGFIX] updates reinitialization of the shop context in the ApiUrlDecorator to use the correct base URL in language sub-shops + [!!!] this is a breaking change, as the URL generation for the entity "pxShopwareUrl" in all API responses may change regarding your setup + + + [BUGFIX] Versionsprüfung nicht kompatibel mit Shopware 5.6 -> thx @jonakieling - refs #4