From 62e152ab818e67e37979e4e1decb43563e254e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Fri, 21 Feb 2020 08:42:10 +0100 Subject: [PATCH 1/3] Improve route enhancing --- config/sites/ep-reisen/config.yaml | 14 +++++- .../Routing/Aspect/PassthroughMapper.php | 50 +++++++++++++++++++ .../ext/ep_products/ext_localconf.php | 9 ++-- 3 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 public/typo3conf/ext/ep_products/Classes/Routing/Aspect/PassthroughMapper.php diff --git a/config/sites/ep-reisen/config.yaml b/config/sites/ep-reisen/config.yaml index 1aacfe18..e10539a2 100644 --- a/config/sites/ep-reisen/config.yaml +++ b/config/sites/ep-reisen/config.yaml @@ -125,11 +125,15 @@ routeEnhancers: type: PersistedAliasMapper tableName: tx_epproducts_domain_model_hotel routeFieldName: uid + date_from: + type: PassthroughMapper + date_to: + type: PassthroughMapper requirements: product_uid: '\d' hotel_uid: '\d' - date_from: '\d{4}-\d{2}-\d{2}' - date_to: '\d{4}-\d{2}-\d{2}' + date_from: '\d{4}\-\d{2}\-\d{2}' + date_to: '\d{4}\-\d{2}\-\d{2}' BookingLinkPlugin: type: Extbase extension: EpProducts @@ -163,6 +167,9 @@ routeEnhancers: defaultController: 'Search::searchresult' requirements: filter_settings: '[A-Z\d%\-]+' + aspects: + filter_settings: + type: PassthroughMapper StaticResultsPlugin: type: Extbase extension: EpProducts @@ -178,6 +185,9 @@ routeEnhancers: defaultController: 'Search::staticresult' requirements: filter_settings: '[A-Z\d%\-]+' + aspects: + filter_settings: + type: PassthroughMapper ContingentsIcalPlugin: type: Extbase extension: EpProducts diff --git a/public/typo3conf/ext/ep_products/Classes/Routing/Aspect/PassthroughMapper.php b/public/typo3conf/ext/ep_products/Classes/Routing/Aspect/PassthroughMapper.php new file mode 100644 index 00000000..b14690aa --- /dev/null +++ b/public/typo3conf/ext/ep_products/Classes/Routing/Aspect/PassthroughMapper.php @@ -0,0 +1,50 @@ +, dreipunktnull + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Core\Routing\Aspect\StaticMappableAspectInterface; + +class PassthroughMapper implements StaticMappableAspectInterface +{ + + /** + * @inheritDoc + */ + public function generate(string $value): ?string + { + return $value; + } + + /** + * @inheritDoc + */ + public function resolve(string $value): ?string + { + return $value; + } +} \ No newline at end of file diff --git a/public/typo3conf/ext/ep_products/ext_localconf.php b/public/typo3conf/ext/ep_products/ext_localconf.php index 7beb7c56..8ee78bc2 100644 --- a/public/typo3conf/ext/ep_products/ext_localconf.php +++ b/public/typo3conf/ext/ep_products/ext_localconf.php @@ -403,15 +403,15 @@ $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'gclid' $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'ref'; $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'pa'; $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_searchresult[searchParams]'; -$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_searchresult[filterSettings]'; -$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_product_detail[dateFrom]'; -$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_product_detail[dateTo]'; $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_reseller[reseller]'; $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'][] = 'tx_epproducts_ajax[hotel]'; +$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['aspects']['PassthroughMapper'] = + \EP\EpProducts\Routing\Aspect\PassthroughMapper::class; + $GLOBALS['TYPO3_CONF_VARS']['LOG']['EP']['EpProducts']['Controller']['writerConfiguration'] = [ \TYPO3\CMS\Core\Log\LogLevel::INFO => [ TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class => [ @@ -420,4 +420,5 @@ $GLOBALS['TYPO3_CONF_VARS']['LOG']['EP']['EpProducts']['Controller']['writerConf ], ]; -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['teamSlug'] = \EP\EpProducts\Updates\TeamSlugUpdater::class; +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['teamSlug'] = + \EP\EpProducts\Updates\TeamSlugUpdater::class; From fcb5cfc336341b28815a5f3c15b25759a3b9f75e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Fri, 21 Feb 2020 09:22:59 +0100 Subject: [PATCH 2/3] Remove obsolete config --- public/typo3conf/ext/ep_products/ext_localconf.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/public/typo3conf/ext/ep_products/ext_localconf.php b/public/typo3conf/ext/ep_products/ext_localconf.php index 8ee78bc2..a7b14356 100644 --- a/public/typo3conf/ext/ep_products/ext_localconf.php +++ b/public/typo3conf/ext/ep_products/ext_localconf.php @@ -402,12 +402,6 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php'][ $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'gclid'; $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'ref'; $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'pa'; -$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_searchresult[searchParams]'; -$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_reseller[reseller]'; -$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'][] = 'tx_epproducts_ajax[hotel]'; $GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['aspects']['PassthroughMapper'] = \EP\EpProducts\Routing\Aspect\PassthroughMapper::class; From 5b1be3ac1f1d621f59a2f5219b7b1a1208482c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Fri, 21 Feb 2020 09:23:14 +0100 Subject: [PATCH 3/3] Disable fulltext search for the time being --- .../Domain/Repository/AbstractRepository.php | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php index 33e53872..15b3fea8 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php @@ -280,23 +280,23 @@ abstract class AbstractRepository extends \TYPO3\CMS\Extbase\Persistence\Reposit $this->addTransportationFilterConditions($query, $filterSettings); // Default fulltext search in case autocompletion has not been used - if ((int) $filterSettings->getDestinationUid() === 0 && !empty($filterSettings->getDestinationName())) { - $query - ->andWhere($query->expr()->orX( - $query->expr()->like('LOWER(date.country_name) COLLATE utf8_bin',':destination'), - $query->expr()->like('LOWER(date.country_keywords) COLLATE utf8_bin', ':destination'), - $query->expr()->like('LOWER(date.region_name) COLLATE utf8_bin', ':destination'), - $query->expr()->like('LOWER(date.region_keywords) COLLATE utf8_bin', ':destination'), - $query->expr()->like('LOWER(date.city_name) COLLATE utf8_bin', ':destination'), - $query->expr()->like('LOWER(date.city_keywords) COLLATE utf8_bin', ':destination'), - $query->expr()->like('LOWER(date.hotel_name) COLLATE utf8_bin', ':destination'), - $query->expr()->like('LOWER(date.hotel_keywords) COLLATE utf8_bin', ':destination'), - $query->expr()->like('LOWER(date.product_name) COLLATE utf8_bin', ':destination'), - $query->expr()->like('LOWER(date.product_keywords) COLLATE utf8_bin', ':destination') - )) - ->setParameter('destination', '%' . mb_strtolower($filterSettings->getDestinationName()) . '%') - ; - } +// if ((int) $filterSettings->getDestinationUid() === 0 && !empty($filterSettings->getDestinationName())) { +// $query +// ->andWhere($query->expr()->orX( +// $query->expr()->like('LOWER(date.country_name) COLLATE utf8_bin',':destination'), +// $query->expr()->like('LOWER(date.country_keywords) COLLATE utf8_bin', ':destination'), +// $query->expr()->like('LOWER(date.region_name) COLLATE utf8_bin', ':destination'), +// $query->expr()->like('LOWER(date.region_keywords) COLLATE utf8_bin', ':destination'), +// $query->expr()->like('LOWER(date.city_name) COLLATE utf8_bin', ':destination'), +// $query->expr()->like('LOWER(date.city_keywords) COLLATE utf8_bin', ':destination'), +// $query->expr()->like('LOWER(date.hotel_name) COLLATE utf8_bin', ':destination'), +// $query->expr()->like('LOWER(date.hotel_keywords) COLLATE utf8_bin', ':destination'), +// $query->expr()->like('LOWER(date.product_name) COLLATE utf8_bin', ':destination'), +// $query->expr()->like('LOWER(date.product_keywords) COLLATE utf8_bin', ':destination') +// )) +// ->setParameter('destination', '%' . mb_strtolower($filterSettings->getDestinationName()) . '%') +// ; +// } // Product if ((int) $filterSettings->getProductUid() > 0) {