Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PAYSHIP-2376] Added maintenance page link #1110

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/Adapter/LinkAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
3 changes: 2 additions & 1 deletion src/Presenter/Store/Modules/ContextModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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()),
Expand Down
Loading