diff --git a/src/Adapter/LinkAdapter.php b/src/Adapter/LinkAdapter.php index 9a377e65e..7eaefcdda 100644 --- a/src/Adapter/LinkAdapter.php +++ b/src/Adapter/LinkAdapter.php @@ -60,9 +60,19 @@ public function getAdminLink($controller, $withToken = true, $sfRouteParams = [] $shop = \Context::getContext()->shop; if ((new ShopContext())->isShop17()) { - $link = $this->link->getAdminLink($controller, $withToken, $sfRouteParams, $params); + $adminLink = $this->link->getAdminLink($controller, $withToken, $sfRouteParams, $params); - return $shop->virtual_uri !== '' ? str_replace($shop->physical_uri . $shop->virtual_uri, $shop->physical_uri, $link) : $link; + if ($shop->virtual_uri !== '') { + $adminLink = str_replace($shop->physical_uri . $shop->virtual_uri, $shop->physical_uri, $adminLink); + } + + // We have problems with links in our zoid application, since some links generated don't have domain they redirect to CDN domain + // Routes that use new symfony router are returned without the domain + if (strpos($adminLink, 'http') !== 0) { + return \Tools::getShopDomainSsl(true) . $adminLink; + } + + return $adminLink; } $paramsAsString = ''; diff --git a/src/Presenter/Store/Modules/ContextModule.php b/src/Presenter/Store/Modules/ContextModule.php index b28bf5ab1..0d1bb4119 100644 --- a/src/Presenter/Store/Modules/ContextModule.php +++ b/src/Presenter/Store/Modules/ContextModule.php @@ -154,7 +154,7 @@ public function present() 'shopsTree' => $this->getShopsTree(), 'faq' => $this->getFaq(), 'language' => $this->psContext->getLanguage(), - 'prestashopCheckoutAjax' => (new LinkAdapter($this->psContext->getLink()))->getAdminLink('AdminAjaxPrestashopCheckout'), + 'prestashopCheckoutAjax' => $this->getGeneratedLink('AdminAjaxPrestashopCheckout'), 'translations' => $this->translations->getTranslations(), 'readmeUrl' => $this->getReadme(), 'cguUrl' => $this->getCgu(), @@ -170,6 +170,7 @@ public function present() 'countriesLink' => $this->getGeneratedLink('AdminCountries'), 'currenciesLink' => $this->getGeneratedLink('AdminCurrencies'), 'paymentPreferencesLink' => $this->getGeneratedLink($this->shopContext->isShop17() ? 'AdminPaymentPreferences' : 'AdminPayment'), + 'maintenanceLink' => $this->getGeneratedLink('AdminMaintenance'), 'overridesExist' => $this->overridesExist(), 'submitIdeaLink' => $this->getSubmitIdeaLink(), 'orderTotal' => (new OrderRepository())->count($this->psContext->getShopId()),