diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/SearchController.php b/public/typo3conf/ext/ep_products/Classes/Controller/SearchController.php index 2ba7cc1c..e7b13f5c 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/SearchController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/SearchController.php @@ -87,6 +87,13 @@ class SearchController extends ActionController public function initializeSearchresultAction() { + // Process encoded filtersettings from static search result + $encodedFilterSettings = GeneralUtility::_GET('f'); + if ($encodedFilterSettings) { + $filterSettingsEncoder = new FilterSettingsEncoder(); + $filterSettings = $filterSettingsEncoder->decode($encodedFilterSettings); + $this->request->setArgument('filterSettings', $filterSettings); + } $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); $this->processFilterSettingsArgument($forcedConceptUids); } diff --git a/public/typo3conf/ext/ep_products/Classes/Middleware/StaticSearchParamsMiddleware.php b/public/typo3conf/ext/ep_products/Classes/Middleware/StaticSearchParamsMiddleware.php index 7a18f9b6..302b9e13 100644 --- a/public/typo3conf/ext/ep_products/Classes/Middleware/StaticSearchParamsMiddleware.php +++ b/public/typo3conf/ext/ep_products/Classes/Middleware/StaticSearchParamsMiddleware.php @@ -34,8 +34,11 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\RequestHandlerInterface; +use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; +use TYPO3\CMS\Core\Exception\SiteNotFoundException; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\RedirectResponse; +use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Object\ObjectManager; @@ -44,7 +47,6 @@ class StaticSearchParamsMiddleware implements MiddlewareInterface use DbConnectionTrait; public const PREFIX_PATH_SEGMENT = 'reiseauswahl'; - public const SEARCH_RESULT_URI = '/skireisen/suche/ergebnis/'; public const REDIRECT_RESPONSE_CODE = 302; public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface @@ -74,7 +76,7 @@ class StaticSearchParamsMiddleware implements MiddlewareInterface ]) ; - $row = $query->execute()->fetch(); + $row = $query->execute()->fetchAssociative(); if (!$row) { return $handler->handle($request); @@ -88,9 +90,21 @@ class StaticSearchParamsMiddleware implements MiddlewareInterface $filterSettings = $filterService->getFilterSettingsFromStaticSearchParams($row); $filterSettingsEncoder = new FilterSettingsEncoder(); - $encodedFilterSettings = rawurlencode($filterSettingsEncoder->encode($filterSettings)); + $encodedFilterSettings = $filterSettingsEncoder->encode($filterSettings); - $redirectUri = self::SEARCH_RESULT_URI . $encodedFilterSettings . '/'; + $searchPageUid = GeneralUtility::makeInstance(ExtensionConfiguration::class) + ->get('ep_products', 'searchPageUid'); + + /** @var SiteFinder $siteFinder */ + $siteFinder = GeneralUtility::makeInstance(SiteFinder::class); + try { + $site = $siteFinder->getSiteByPageId((int)$searchPageUid); + } + catch (SiteNotFoundException $exception) { + return $handler->handle($request); + } + + $redirectUri = $site->getRouter()->generateUri($searchPageUid, ['f' => $encodedFilterSettings]); return new RedirectResponse($redirectUri, self::REDIRECT_RESPONSE_CODE); } diff --git a/public/typo3conf/ext/ep_products/ext_conf_template.txt b/public/typo3conf/ext/ep_products/ext_conf_template.txt new file mode 100644 index 00000000..6afb2235 --- /dev/null +++ b/public/typo3conf/ext/ep_products/ext_conf_template.txt @@ -0,0 +1,3 @@ +# customsubcategory=100=General +# cat=epproducts/100/100; type=int; label=Searchresult PID +searchPageUid = 0 diff --git a/public/typo3conf/ext/ep_products/ext_localconf.php b/public/typo3conf/ext/ep_products/ext_localconf.php index 62b7b3c4..80c180b9 100644 --- a/public/typo3conf/ext/ep_products/ext_localconf.php +++ b/public/typo3conf/ext/ep_products/ext_localconf.php @@ -301,6 +301,7 @@ $boot = function () { $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_ajax[months]'; $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_ajax[month]'; $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_ajax[year]'; + $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'f'; $GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['aspects']['PassthroughMapper'] = \EP\EpProducts\Routing\Aspect\PassthroughMapper::class; diff --git a/public/typo3conf/ext/ep_theme/ext_conf_template.txt b/public/typo3conf/ext/ep_theme/ext_conf_template.txt deleted file mode 100644 index 185b8d6a..00000000 --- a/public/typo3conf/ext/ep_theme/ext_conf_template.txt +++ /dev/null @@ -1,3 +0,0 @@ -# customsubcategory=100=General -# cat=eptheme/100/100; type=boolean; label=Compress HTML -compressHtml = 0