From 74d46bd43bff75b0cf68752c2530cbd16e259879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Sun, 7 Oct 2018 15:25:17 +0200 Subject: [PATCH] Remove filtersettings from url arguments completely --- .../Classes/Controller/ProductController.php | 21 +- .../Domain/Repository/DateRepository.php | 26 +- .../RequestArgumentTypeConversionTrait.php | 6 +- .../Resources/Private/Assets/js/_app.js | 6 +- .../Private/Assets/js/_filtersettings.js | 1 + .../Assets/js/components/HotelList.vue | 35 ++ .../Assets/js/components/PriceRangeSelect.vue | 7 +- .../Assets/js/components/ProductDetail.vue | 7 +- .../Assets/js/components/ReferrerLink.vue | 28 ++ .../Assets/js/components/SearchResult.vue | 5 +- .../Assets/js/components/SearchResultItem.vue | 23 +- .../Private/Partials/Hotel/TeaserWide.html | 39 +- .../Partials/Product/HeaderDetail.html | 18 +- .../Private/Templates/Product/Detail.html | 438 +++++++++--------- .../Private/Templates/Product/HotelList.html | 87 ++-- .../Templates/Search/Searchresult.html | 29 +- 16 files changed, 420 insertions(+), 356 deletions(-) create mode 100644 web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/HotelList.vue create mode 100644 web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ReferrerLink.vue diff --git a/web/typo3conf/ext/ep_products/Classes/Controller/ProductController.php b/web/typo3conf/ext/ep_products/Classes/Controller/ProductController.php index 59612aa7..2a3c5542 100644 --- a/web/typo3conf/ext/ep_products/Classes/Controller/ProductController.php +++ b/web/typo3conf/ext/ep_products/Classes/Controller/ProductController.php @@ -35,15 +35,12 @@ use EP\EpProducts\Service\DateService; use EP\EpProducts\Service\FilterService; use EP\EpProducts\Service\HotelDataService; use EP\EpProducts\Service\ProductDataService; -use EP\EpProducts\Traits\RequestArgumentTypeConversionTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class ProductController extends ActionController { - use RequestArgumentTypeConversionTrait; - /** * @var \EP\EpProducts\Domain\Repository\ProductRepository */ @@ -100,22 +97,15 @@ class ProductController extends ActionController $this->filterService = $filterService; } - public function initializeAction() - { - $this->processFilterSettingsArgument(); - } - /** * @param Product $product * @param Hotel $hotel - * @param int $referringPageUid * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException */ public function detailAction( Product $product = null, - Hotel $hotel = null, - $referringPageUid = null + Hotel $hotel = null ) { // Get product to display from flexform settings if not provided via url @@ -137,7 +127,6 @@ class ProductController extends ActionController if ($product->getHotels()->count() > 1) { $arguments = [ 'product' => $product, - 'referringPageUid' => $referringPageUid, ]; $this->forward('hotelList', null, null, $arguments); } @@ -153,8 +142,6 @@ class ProductController extends ActionController $this->view->assignMultiple([ 'hotel' => $hotel, 'product' => $product, - 'referringPageUid' => $referringPageUid, - 'currentPageUid' => $GLOBALS['TSFE']->id, 'isProductWithExcludedConcept' => $isProductWithExcludedConcept, 'isProductWithNoInfoConcept' => $isProductWithNoInfoConcept, ]); @@ -178,18 +165,16 @@ class ProductController extends ActionController /** * @param Product $product - * @param int $referringPageUid */ public function hotelListAction( - Product $product, - $referringPageUid = null + Product $product ) { $hotels = $this->hotelDataService->getList($product); $this->view->assignMultiple([ 'hotels' => $hotels, 'product' => $product, - 'referringPageUid' => $referringPageUid, + 'currentPageUid' => $GLOBALS['TSFE']->id, 'linkHotel' => true, ]); } diff --git a/web/typo3conf/ext/ep_products/Classes/Domain/Repository/DateRepository.php b/web/typo3conf/ext/ep_products/Classes/Domain/Repository/DateRepository.php index 2d0eef0c..2b661552 100644 --- a/web/typo3conf/ext/ep_products/Classes/Domain/Repository/DateRepository.php +++ b/web/typo3conf/ext/ep_products/Classes/Domain/Repository/DateRepository.php @@ -129,13 +129,13 @@ class DateRepository extends AbstractRepository $qb = $this->getDbConnection()->createQueryBuilder(); $query = $qb - ->select('hotel uid') + ->select('hotel as uid') ->addSelectLiteral('REPLACE(hotel_name, "\r\n", " ") name') ->from('tx_epproducts_domain_model_date', 'date') ->where('product_searchable = 1') ->andWhere($qb->expr()->orX( - $qb->expr()->like('LOWER(hotel_name) COLLATE utf8_bin',':searchName'), - $qb->expr()->like('LOWER(hotel_keywords) COLLATE utf8_bin', ':searchKeywords') + $qb->expr()->like('hotel_name',':searchName'), + $qb->expr()->like('hotel_keywords', ':searchKeywords') )) ->orderBy('hotel_name') ->groupBy('hotel_name') @@ -170,14 +170,14 @@ class DateRepository extends AbstractRepository ->from('tx_epproducts_domain_model_date', 'date') ->where('product_searchable = 1') ->andWhere($qb->expr()->orX( - $qb->expr()->like('LOWER(product_name) COLLATE utf8_bin',':searchName'), - $qb->expr()->like('LOWER(product_keywords) COLLATE utf8_bin', ':searchKeywords'), - $qb->expr()->like('LOWER(country_name) COLLATE utf8_bin',':searchKeywords'), - $qb->expr()->like('LOWER(country_keywords) COLLATE utf8_bin', ':searchKeywords'), - $qb->expr()->like('LOWER(region_name) COLLATE utf8_bin', ':searchKeywords'), - $qb->expr()->like('LOWER(region_keywords) COLLATE utf8_bin', ':searchKeywords'), - $qb->expr()->like('LOWER(city_name) COLLATE utf8_bin', ':searchKeywords'), - $qb->expr()->like('LOWER(city_keywords) COLLATE utf8_bin', ':searchKeywords') + $qb->expr()->like('product_name',':searchName'), + $qb->expr()->like('product_keywords', ':searchKeywords'), + $qb->expr()->like('country_name',':searchKeywords'), + $qb->expr()->like('country_keywords', ':searchKeywords'), + $qb->expr()->like('region_name', ':searchKeywords'), + $qb->expr()->like('region_keywords', ':searchKeywords'), + $qb->expr()->like('city_name', ':searchKeywords'), + $qb->expr()->like('city_keywords', ':searchKeywords') )) ->orderBy('product_name') ->groupBy('product_name') @@ -218,8 +218,8 @@ class DateRepository extends AbstractRepository ->from('tx_epproducts_domain_model_date', 'date') ->where('product_searchable = 1') ->andWhere($qb->expr()->orX( - $qb->expr()->like('LOWER(' . $type . '_name) COLLATE utf8_bin',':searchName'), - $qb->expr()->like('LOWER(' . $type . '_keywords) COLLATE utf8_bin', ':searchKeywords') + $qb->expr()->like($type . '_name',':searchName'), + $qb->expr()->like($type . '_keywords', ':searchKeywords') )) ->orderBy($type . '_name') ->groupBy($type . '_name') diff --git a/web/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php b/web/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php index 0e020575..289eb0c1 100644 --- a/web/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php +++ b/web/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php @@ -136,13 +136,13 @@ trait RequestArgumentTypeConversionTrait */ static protected function convertType($value) { - if (is_string($value) && (strtolower($value) === 'true' || strtolower($value) === 'false')) { + if (\is_string($value) && (strtolower($value) === 'true' || strtolower($value) === 'false')) { return strtolower($value) === 'true'; } - if (is_numeric($value)) { + if (\is_numeric($value)) { return (int) $value; } - if (is_array($value)) { + if (\is_array($value)) { return array_map(function($item) { return static::convertType($item); }, $value); diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js index ebc3e046..172604ab 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_app.js @@ -30,6 +30,8 @@ import EventPricetable from './components/EventPriceTable.vue' import ContactForm from './components/ContactForm.vue' import WatchlistToggle from './components/WatchlistToggle.vue' import Watchlist from './components/Watchlist.vue' +import HotelList from './components/HotelList.vue' +import ReferrerLink from './components/ReferrerLink.vue' // Define global constants const $window = $(window); @@ -59,7 +61,9 @@ new Vue({ EventPricetable, ContactForm, WatchlistToggle, - Watchlist + Watchlist, + HotelList, + ReferrerLink }, data () { return { diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_filtersettings.js b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_filtersettings.js index a188e98d..b6098ffb 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_filtersettings.js +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/_filtersettings.js @@ -10,6 +10,7 @@ export default { conceptUids: [], dateFrom: null, dateTo: null, + priceRange: 0, nights: 0, pax: 1, hotelTypes: [], diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/HotelList.vue b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/HotelList.vue new file mode 100644 index 00000000..5a2ddc71 --- /dev/null +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/HotelList.vue @@ -0,0 +1,35 @@ + diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/PriceRangeSelect.vue b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/PriceRangeSelect.vue index da7f4850..ceaa1460 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/PriceRangeSelect.vue +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/PriceRangeSelect.vue @@ -31,6 +31,7 @@ required: true }, range: { + type: Number, default: 0 }, showLabel: { @@ -40,7 +41,7 @@ }, computed: { rangeLabel () { - if (this.rangeSelected === 0) { + if (this.rangeSelected === 0 || $.isEmptyObject(this.rangeOptions)) { return 'beliebig'; } let range = this.rangeOptions[this.rangeSelected]; @@ -64,8 +65,8 @@ this.$emit('selected', 0); }, optionSelect (value) { - this.rangeSelected = value; - this.$emit('selected', value); + this.rangeSelected = parseInt(value); + this.$emit('selected', parseInt(value)); } }, watch: { diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue index 162bd090..425fd944 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue @@ -49,7 +49,8 @@ loading: true, activeSection: null, singleDate: false, - filterSettings: defaultFilterSettings + filterSettings: defaultFilterSettings, + referringPage: null } }, props: { @@ -190,6 +191,10 @@ if (this.$session.has('filterSettings')) { this.filterSettings = this.$session.get('filterSettings') } + if (this.$session.has('referringPage')) { + this.referringPage = this.$session.get('referringPage'); + this.$session.remove('referringPage'); + } EventBus.$on('loadDatesTable', () => { this.loadDatesView(); }); diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ReferrerLink.vue b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ReferrerLink.vue new file mode 100644 index 00000000..bb39305d --- /dev/null +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ReferrerLink.vue @@ -0,0 +1,28 @@ + + + diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchResult.vue b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchResult.vue index 6d7e5e3e..b4a618fb 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchResult.vue +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchResult.vue @@ -53,8 +53,9 @@ type: Object, default: null }, - referringPageUid: { - type: Number + referringPageUrl: { + type: String, + default: '' }, argumentPrefix: { type: String, diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchResultItem.vue b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchResultItem.vue index a3ff98f4..4e2e8750 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchResultItem.vue +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchResultItem.vue @@ -2,7 +2,8 @@
@@ -44,19 +45,21 @@
{{ item.dates.length > 1 ? 'Zeitraum' : 'Termin' }} {{ dateRange }} - + {{ item.dates.length }} Termin{{ item.dates.length > 1 ? 'e' : '' }} - +
{{ item.daytrip ? 'Tageweise buchbar' : nightsOptions }}
ab {{ item.minPrice }} € - + Details & Buchen - +
@@ -67,10 +70,12 @@ import dayjs from 'dayjs' import 'dayjs/locale/de' import WatchlistToggle from './WatchlistToggle.vue' + import ReferrerLink from './ReferrerLink.vue' export default { components: { - WatchlistToggle + WatchlistToggle, + ReferrerLink }, props: { item: { @@ -86,6 +91,10 @@ default () { return []; } + }, + referringPageUrl: { + type: String, + default: null } }, computed: { diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserWide.html b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserWide.html index 637104c9..46e19fb3 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserWide.html +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserWide.html @@ -80,48 +80,33 @@ {f:if(condition: '{item.dates -> f:count()} > 1', then: 'Zeitraum', else: 'Termin')} {ep:dateRange(dateFrom: item.minDateStart, dateTo: item.maxDateEnd, includeLabel: 0)} - + {item.dates -> f:count()} Termin{f:if(condition: '{item.dates -> f:count()} > 1', then: 'e')} - +
{ep:nightsOptions(options: item.nights)}
ab {item.minPrice} € - Details & Buchen + + Details & Buchen +
 
ausgebucht - Details + Details
diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/HeaderDetail.html b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/HeaderDetail.html index 5f60a3be..3ff8f2dd 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/HeaderDetail.html +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/HeaderDetail.html @@ -60,20 +60,8 @@ - - - + {v:render.template(file: 'EXT:ep_theme/Resources/Private/Partials/Breadcrumb.html')} diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html b/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html index 3c508cd8..ee034b8a 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html @@ -7,234 +7,236 @@ - -
- - ", - contingents: "{ep:uri.ajax(action: 'list', controller: 'AjaxContingent', format: 'json', noCacheHash: 1)}", - rooms: "{ep:uri.ajax(action: 'rooms', controller: 'AjaxContingent', format: 'json', noCacheHash: 1)}", - pricetable: "{ep:uri.ajax(action: 'pricetable', controller: 'AjaxTable', arguments: '{product: product, hotel: hotel}', format: 'json', noCacheHash: 1)}" - }' - argument-prefix='' - :hotel-first="{f:if(condition: settings.hotelOnTop, then: 'true', else: 'false')}" - :fb-pixel-data="{ productUid: {product.uid}, nameInternal: '{product.nameInternal}' }" - :watchlist="watchlist" - :daytrip="{product.daytrip -> v:variable.convert(type: 'int')}" - inline-template> -
-
-
- -
-
-
-
-
-
- - - - - - - - -
-
-
-
- - - - - - - - - -
-
- - - - -
-
-

- -

-
-
-
diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/HotelList.html b/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/HotelList.html index 0bde8d31..2626ccc3 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/HotelList.html +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/HotelList.html @@ -5,48 +5,55 @@ - -
-
-
- + +
+ +
+
+
+ +
+
+
+
+ {product.teaserLong -> f:format.html()} +
+
+
+
+
Wähle deine Unterkunft
+
+
-
-
-
- {product.teaserLong -> f:format.html()} +
+
+
+ + + + + + + +
+ Die von dir gewählte Reise ist aktuell nicht buchbar, aber wir helfen dir gerne dabei, + eine andere Reise zu finden. Ruf uns an unter {settings.phoneNumber} + oder schreibe an . +
+
+
+
+
-
-
-
-
Wähle deine Unterkunft
-
-
-
-
-
-
- - - - - - - -
- Die von dir gewählte Reise ist aktuell nicht buchbar, aber wir helfen dir gerne dabei, - eine andere Reise zu finden. Ruf uns an unter {settings.phoneNumber} - oder schreibe an . -
-
-
-
-
-
+ + diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Search/Searchresult.html b/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Search/Searchresult.html index 380ac5fe..0ef7b163 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Search/Searchresult.html +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Templates/Search/Searchresult.html @@ -10,7 +10,7 @@

@@ -149,12 +150,14 @@