From 686f50fe11414600d530add234e859e7c135cd65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 21 Aug 2018 15:26:32 +0200 Subject: [PATCH] Render search result client side, loads of cleanups --- composer.lock | 167 +++++++++-------- .../Controller/AjaxFilterpanelController.php | 20 -- .../Controller/AjaxSearchController.php | 53 ++++-- .../Classes/Controller/HotelController.php | 2 +- .../Classes/Service/FlagIconService.php | 67 +++++++ .../Classes/Service/HotelImageService.php | 63 +++++++ .../Classes/Service/HotelService.php | 35 +++- .../Classes/Service/ImageService.php | 89 --------- .../Classes/Service/ProductImageService.php | 71 +++++++ .../Classes/Service/ProductService.php | 31 +++- ...rchService.php => SearchResultService.php} | 42 +++-- .../Service/SearchResultUrlService.php | 93 ++++++++++ .../Classes/Traits/ImageServiceTrait.php | 105 +++++++++++ .../Configuration/TypoScript/setup.txt | 3 +- .../ext/ep_products/ext_localconf.php | 4 +- .../Assets/js/components/AjaxContent.vue | 6 +- .../Assets/js/components/ProductDetail.vue | 31 +--- .../Assets/js/components/SearchBar.vue | 1 - .../Assets/js/components/SearchResult.vue | 166 +++++------------ .../Assets/js/components/SearchResultItem.vue | 116 ++++++++++++ .../Private/Assets/js/filtersettings.js | 19 ++ .../Private/Partials/Hotel/Teaser.html | 4 +- .../Partials/Hotel/TeaserExtended.html | 6 +- .../Private/Partials/Hotel/TeaserSimple.html | 6 +- .../Private/Partials/Hotel/TeaserWide.html | 2 +- .../Resources/Private/Partials/Mainnav.html | 16 +- .../Private/Partials/Product/Teaser.html | 4 +- .../Private/Partials/Product/TeaserWide.html | 6 +- .../Templates/AjaxSearch/Searchresult.html | 175 ------------------ .../Private/Templates/Product/Detail.html | 7 +- .../Private/Templates/Product/HotelList.html | 1 - .../Templates/Search/Searchresult.html | 15 +- 32 files changed, 831 insertions(+), 595 deletions(-) create mode 100644 web/typo3conf/ext/ep_products/Classes/Service/FlagIconService.php create mode 100644 web/typo3conf/ext/ep_products/Classes/Service/HotelImageService.php delete mode 100644 web/typo3conf/ext/ep_products/Classes/Service/ImageService.php create mode 100644 web/typo3conf/ext/ep_products/Classes/Service/ProductImageService.php rename web/typo3conf/ext/ep_products/Classes/Service/{SearchService.php => SearchResultService.php} (83%) create mode 100644 web/typo3conf/ext/ep_products/Classes/Service/SearchResultUrlService.php create mode 100644 web/typo3conf/ext/ep_products/Classes/Traits/ImageServiceTrait.php create mode 100644 web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchResultItem.vue create mode 100644 web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/filtersettings.js delete mode 100644 web/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxSearch/Searchresult.html diff --git a/composer.lock b/composer.lock index f986c0f2..2c741187 100644 --- a/composer.lock +++ b/composer.lock @@ -1693,16 +1693,16 @@ }, { "name": "symfony/console", - "version": "v2.8.43", + "version": "v2.8.44", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "42a0adc7dd656ca2e360285eb6d822df9ce0b160" + "reference": "0c1fcbb9afb5cff992c982ff99c0434f0146dcfc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/42a0adc7dd656ca2e360285eb6d822df9ce0b160", - "reference": "42a0adc7dd656ca2e360285eb6d822df9ce0b160", + "url": "https://api.github.com/repos/symfony/console/zipball/0c1fcbb9afb5cff992c982ff99c0434f0146dcfc", + "reference": "0c1fcbb9afb5cff992c982ff99c0434f0146dcfc", "shasum": "" }, "require": { @@ -1750,20 +1750,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-07-09T12:58:09+00:00" + "time": "2018-07-26T11:13:39+00:00" }, { "name": "symfony/debug", - "version": "v2.8.43", + "version": "v2.8.44", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "a26ddce7fe4e884097d72435653bc7e703411f26" + "reference": "d985c8546da49c4727e27dae82bcf783ee2c5af0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/a26ddce7fe4e884097d72435653bc7e703411f26", - "reference": "a26ddce7fe4e884097d72435653bc7e703411f26", + "url": "https://api.github.com/repos/symfony/debug/zipball/d985c8546da49c4727e27dae82bcf783ee2c5af0", + "reference": "d985c8546da49c4727e27dae82bcf783ee2c5af0", "shasum": "" }, "require": { @@ -1807,20 +1807,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-06-22T15:01:26+00:00" + "time": "2018-07-26T11:13:39+00:00" }, { "name": "symfony/finder", - "version": "v2.8.43", + "version": "v2.8.44", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "995cd7c28a0778cece02e2133b4d813dc509dfc3" + "reference": "f0de0b51913eb2caab7dfed6413b87e14fca780e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/995cd7c28a0778cece02e2133b4d813dc509dfc3", - "reference": "995cd7c28a0778cece02e2133b4d813dc509dfc3", + "url": "https://api.github.com/repos/symfony/finder/zipball/f0de0b51913eb2caab7dfed6413b87e14fca780e", + "reference": "f0de0b51913eb2caab7dfed6413b87e14fca780e", "shasum": "" }, "require": { @@ -1856,20 +1856,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-06-19T11:07:17+00:00" + "time": "2018-07-26T11:13:39+00:00" }, { "name": "symfony/inflector", - "version": "v3.4.13", + "version": "v3.4.14", "source": { "type": "git", "url": "https://github.com/symfony/inflector.git", - "reference": "bc27e8f793a571313132923b5ad10fdf2843e26c" + "reference": "129ac0c59e516f5fe210efe51a44f79ab9925c16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/inflector/zipball/bc27e8f793a571313132923b5ad10fdf2843e26c", - "reference": "bc27e8f793a571313132923b5ad10fdf2843e26c", + "url": "https://api.github.com/repos/symfony/inflector/zipball/129ac0c59e516f5fe210efe51a44f79ab9925c16", + "reference": "129ac0c59e516f5fe210efe51a44f79ab9925c16", "shasum": "" }, "require": { @@ -1914,7 +1914,7 @@ "symfony", "words" ], - "time": "2018-05-01T22:53:27+00:00" + "time": "2018-07-26T08:45:46+00:00" }, { "name": "symfony/options-resolver", @@ -1972,25 +1972,28 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "suggest": { + "ext-ctype": "For best performance" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2023,20 +2026,20 @@ "polyfill", "portable" ], - "time": "2018-04-30T19:57:29+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", "shasum": "" }, "require": { @@ -2048,7 +2051,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2082,30 +2085,30 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6" + "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934", + "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0", + "paragonie/random_compat": "~1.0|~2.0|~9.99", "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2141,20 +2144,20 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/process", - "version": "v3.4.13", + "version": "v3.4.14", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "f741672edfcfe3a2ea77569d419006f23281d909" + "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/f741672edfcfe3a2ea77569d419006f23281d909", - "reference": "f741672edfcfe3a2ea77569d419006f23281d909", + "url": "https://api.github.com/repos/symfony/process/zipball/0414db29bd770ec5a4152683e655f55efd4fa60f", + "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f", "shasum": "" }, "require": { @@ -2190,20 +2193,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-07-09T09:01:07+00:00" + "time": "2018-07-26T11:19:56+00:00" }, { "name": "symfony/property-access", - "version": "v3.4.13", + "version": "v3.4.14", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "a6e8c778b220dfd5cd5f5dcb09f87ee232dd608a" + "reference": "28d3129c330f73d47fafa8239a2fa6ccd44136a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/a6e8c778b220dfd5cd5f5dcb09f87ee232dd608a", - "reference": "a6e8c778b220dfd5cd5f5dcb09f87ee232dd608a", + "url": "https://api.github.com/repos/symfony/property-access/zipball/28d3129c330f73d47fafa8239a2fa6ccd44136a6", + "reference": "28d3129c330f73d47fafa8239a2fa6ccd44136a6", "shasum": "" }, "require": { @@ -2258,7 +2261,7 @@ "property path", "reflection" ], - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-07-26T09:06:28+00:00" }, { "name": "symfony/serializer", @@ -2418,6 +2421,7 @@ } ], "description": "This extension integrates the grid layout concept also to regular content elements - the grid elements.\r\nIt offers a lot of new features like advanced drag & drop or real references, that improve the usability of the page and list module to speed up the daily work with the backend.", + "homepage": "https://extensions.typo3.org/extension/gridelements/", "time": "2017-12-23T18:15:17+00:00" }, { @@ -2451,28 +2455,29 @@ } ], "description": "Compress/minify your HTML output", + "homepage": "https://extensions.typo3.org/extension/html_compress/", "time": "2016-12-26T10:19:02+00:00" }, { "name": "typo3-ter/imageoptimizer", - "version": "1.0.4", + "version": "1.1.2", "dist": { "type": "zip", - "url": "https://extensions.typo3.org/extension/download/imageoptimizer/1.0.4/zip/", + "url": "https://extensions.typo3.org/extension/download/imageoptimizer/1.1.2/zip/", "reference": null, "shasum": null }, "require": { - "typo3/cms-core": ">= 6.2.0, <= 8.9.99" + "typo3/cms-core": ">= 7.6.0, <= 8.7.99" }, "replace": { "imageoptimizer": "self.version" }, "type": "typo3-cms-extension", "autoload": { - "classmap": [ - "Classes/" - ] + "psr-4": { + "Lemming\\Imageoptimizer\\": "Classes/" + } }, "authors": [ { @@ -2483,7 +2488,9 @@ } ], "description": "Optimize uploaded/processed images with binaries of your choice", - "time": "2017-03-11T11:37:47+00:00" + "homepage": "https://extensions.typo3.org/extension/imageoptimizer/", + "abandoned": "christophlehmann/imageoptimizer", + "time": "2018-08-20T23:03:56+00:00" }, { "name": "typo3-ter/loginlimit", @@ -2515,6 +2522,7 @@ } ], "description": "Protect backend and/or frontend login against brute-force attacks.", + "homepage": "https://extensions.typo3.org/extension/loginlimit/", "time": "2017-09-23T10:40:00+00:00" }, { @@ -2551,6 +2559,7 @@ } ], "description": "Media management system for TYPO3 CMS.", + "homepage": "https://extensions.typo3.org/extension/media/", "time": "2017-11-02T13:08:04+00:00" }, { @@ -2584,6 +2593,7 @@ } ], "description": "Search Engine Optimization (SEO), Indexed Google-Sitemap (TXT- and XML-Sitemap) for all Extensions (pibase, extbase), Metatags, Canonical-URL, Pagetitle manipulations, Crawler verification, Piwik and Google Analytics support and some more... multi-language- and multi-tree-support", + "homepage": "https://extensions.typo3.org/extension/metaseo/", "time": "2017-06-11T18:32:55+00:00" }, { @@ -2623,6 +2633,7 @@ } ], "description": "Simply manage (permanent 301) redirects in the list view. The extension supports multidomain sites, count the redirect usage and shows the last referer. UPDATE! imports the records from realurl.", + "homepage": "https://extensions.typo3.org/extension/ods_redirects/", "time": "2017-05-22T22:07:45+00:00" }, { @@ -2656,6 +2667,7 @@ } ], "description": "Provides API for Backend modules to get a proper path to the Frontend page (simulateStatic/RealURL/CoolURI-like)", + "homepage": "https://extensions.typo3.org/extension/pagepath/", "time": "2017-02-15T15:40:25+00:00" }, { @@ -2692,6 +2704,7 @@ "username": "plusb" } ], + "homepage": "https://extensions.typo3.org/extension/pb_social/", "time": "2018-02-14T11:05:37+00:00" }, { @@ -2725,14 +2738,15 @@ } ], "description": "Optimization of the final page: reformatting the (x)html output, removal of new lines, and quotes. Move development repository to https://github.com/lochmueller/sourceopt", + "homepage": "https://extensions.typo3.org/extension/sourceopt/", "time": "2017-06-15T17:25:53+00:00" }, { "name": "typo3-ter/vidi", - "version": "2.6.0", + "version": "2.7.0", "dist": { "type": "zip", - "url": "https://extensions.typo3.org/extension/download/vidi/2.6.0/zip/", + "url": "https://extensions.typo3.org/extension/download/vidi/2.7.0/zip/", "reference": null, "shasum": null }, @@ -2757,7 +2771,8 @@ } ], "description": "Generic listing of records with versatile ways of interacting with the data, e.g. advanced filter, inline editing, mass editing, ... Veni, vidi, vici!", - "time": "2017-11-02T13:05:47+00:00" + "homepage": "https://extensions.typo3.org/extension/vidi/", + "time": "2018-08-03T10:50:35+00:00" }, { "name": "typo3/class-alias-loader", @@ -4439,16 +4454,16 @@ }, { "name": "symfony/cache", - "version": "v3.4.13", + "version": "v3.4.14", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "ae6a68d17e5e2c41e9cca278add1feda0473bcfe" + "reference": "337408485de75c884e6ab1b2e8f055d31a7aa7b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/ae6a68d17e5e2c41e9cca278add1feda0473bcfe", - "reference": "ae6a68d17e5e2c41e9cca278add1feda0473bcfe", + "url": "https://api.github.com/repos/symfony/cache/zipball/337408485de75c884e6ab1b2e8f055d31a7aa7b6", + "reference": "337408485de75c884e6ab1b2e8f055d31a7aa7b6", "shasum": "" }, "require": { @@ -4505,20 +4520,20 @@ "caching", "psr6" ], - "time": "2018-07-01T06:47:44+00:00" + "time": "2018-07-26T11:19:56+00:00" }, { "name": "symfony/expression-language", - "version": "v3.4.13", + "version": "v3.4.14", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "555bf77002c6319eaf6311be7d6213dc3668e641" + "reference": "d60e37ab9838338d959f2cc177a66cf498293788" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/555bf77002c6319eaf6311be7d6213dc3668e641", - "reference": "555bf77002c6319eaf6311be7d6213dc3668e641", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/d60e37ab9838338d959f2cc177a66cf498293788", + "reference": "d60e37ab9838338d959f2cc177a66cf498293788", "shasum": "" }, "require": { @@ -4555,20 +4570,20 @@ ], "description": "Symfony ExpressionLanguage Component", "homepage": "https://symfony.com", - "time": "2018-06-21T11:10:19+00:00" + "time": "2018-07-26T09:06:28+00:00" }, { "name": "symfony/polyfill-apcu", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-apcu.git", - "reference": "9b83bd010112ec196410849e840d9b9fefcb15ad" + "reference": "19e1b73bf255265ad0b568f81766ae2a3266d8d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/9b83bd010112ec196410849e840d9b9fefcb15ad", - "reference": "9b83bd010112ec196410849e840d9b9fefcb15ad", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/19e1b73bf255265ad0b568f81766ae2a3266d8d2", + "reference": "19e1b73bf255265ad0b568f81766ae2a3266d8d2", "shasum": "" }, "require": { @@ -4577,7 +4592,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -4611,11 +4626,11 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/yaml", - "version": "v3.3.17", + "version": "v3.3.18", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", diff --git a/web/typo3conf/ext/ep_products/Classes/Controller/AjaxFilterpanelController.php b/web/typo3conf/ext/ep_products/Classes/Controller/AjaxFilterpanelController.php index b69ccc22..3e107dc6 100644 --- a/web/typo3conf/ext/ep_products/Classes/Controller/AjaxFilterpanelController.php +++ b/web/typo3conf/ext/ep_products/Classes/Controller/AjaxFilterpanelController.php @@ -65,26 +65,6 @@ class AjaxFilterpanelController extends ActionController $this->processFilterSettingsArgument($forcedConceptUid); } - /** - * @param FilterSettings $filterSettings - * - * @return string - */ - public function optionsAction(FilterSettings $filterSettings = null) - { - if ($filterSettings === null) { - $forcedConceptUid = (int) $this->settings['forcedConceptUid']; - $filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid); - } - $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); - $filterOptions = $this->filterService->getFilterOptions($filterSettings, $excludedConceptUids); - if ($filterOptions === null) { - $filterSettings = $this->filterService->getDefaultFilterSettings(); - $filterOptions = $this->filterService->getFilterOptions($filterSettings, $excludedConceptUids); - } - return json_encode($filterOptions); - } - /** * @param FilterSettings $filterSettings * @param string $search diff --git a/web/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php b/web/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php index 0bacbab5..6b8da39b 100644 --- a/web/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php +++ b/web/typo3conf/ext/ep_products/Classes/Controller/AjaxSearchController.php @@ -29,7 +29,8 @@ namespace EP\EpProducts\Controller; use EP\EpProducts\Domain\Model\FilterSettings; use EP\EpProducts\Service\FilterService; -use EP\EpProducts\Service\SearchService; +use EP\EpProducts\Service\SearchResultUrlService; +use EP\EpProducts\Service\SearchResultService; use EP\EpProducts\Traits\RequestArgumentTypeConversionTrait; use EP\EpProducts\Utility\DateUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -46,19 +47,32 @@ class AjaxSearchController extends ActionController protected $filterService; /** - * @var SearchService + * @var SearchResultService */ - protected $searchService; + protected $searchResultService; + + /** + * @var SearchResultUrlService + */ + protected $searchResultUrlService; /** * @param FilterService $filterService - * @param SearchService $searchService + * @param SearchResultService $searchResultService + * @param SearchResultUrlService $searchResultUrlService */ - public function __construct(FilterService $filterService, SearchService $searchService) + public function __construct + ( + FilterService $filterService, + SearchResultService $searchResultService, + SearchResultUrlService $searchResultUrlService + ) { parent::__construct(); + $this->filterService = $filterService; - $this->searchService = $searchService; + $this->searchResultService = $searchResultService; + $this->searchResultUrlService = $searchResultUrlService; } public function initializeAction() @@ -76,30 +90,35 @@ class AjaxSearchController extends ActionController public function searchresultAction(FilterSettings $filterSettings = null, $referringPageUid = null) { $dateSelected = false; + $organic = true; + if ($filterSettings === null) { $forcedConceptUid = (int) $this->settings['forcedConceptUid']; $filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid); - } else if ($filterSettings->getDateFrom() !== null || $filterSettings->getDateTo() !== null) { + } elseif ($filterSettings->getDateFrom() !== null || $filterSettings->getDateTo() !== null) { $dateSelected = true; } - $organic = true; $excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']); - $searchResult = $this->searchService->getSearchResult($filterSettings, $excludedConceptUids); + $filterOptions = $this->filterService->getFilterOptions($filterSettings, $excludedConceptUids); + if ($filterOptions === null) { + $filterSettings = $this->filterService->getDefaultFilterSettings(); + $filterOptions = $this->filterService->getFilterOptions($filterSettings, $excludedConceptUids); + } + $searchResult = $this->searchResultService->getResult($filterSettings, $excludedConceptUids); if ($searchResult->getTotal() === 0) { $filterSettings = $this->filterService->getDefaultFilterSettings(); - $searchResult = $this->searchService->getSearchResult($filterSettings, $excludedConceptUids); + $searchResult = $this->searchResultService->getResult($filterSettings, $excludedConceptUids); $organic = false; } - $this->view->assignMultiple([ - 'searchResult' => $searchResult, - 'detailPageUid' => $this->settings['defaultDetailPageUid'], + $options = [ + 'defaultDetailPageUid' => $this->settings['defaultDetailPageUid'], 'referringPageUid' => $referringPageUid, 'filterSettings' => $filterSettings, - 'dateSelected' => $dateSelected, - 'organic' => $organic, - ]); + ]; + $this->searchResultUrlService->process($searchResult, $options); return json_encode([ - 'html' => $this->view->render(), + 'data' => $searchResult->getData(), + 'filterOptions' => $filterOptions, 'meta' => [ 'organic' => $organic, 'total' => $searchResult->getTotal(), diff --git a/web/typo3conf/ext/ep_products/Classes/Controller/HotelController.php b/web/typo3conf/ext/ep_products/Classes/Controller/HotelController.php index 74dad4aa..3d6077d3 100644 --- a/web/typo3conf/ext/ep_products/Classes/Controller/HotelController.php +++ b/web/typo3conf/ext/ep_products/Classes/Controller/HotelController.php @@ -57,7 +57,7 @@ class HotelController extends ActionController /** * @var ProductService */ - private $productService; + protected $productService; /** * @param HotelService $hotelService diff --git a/web/typo3conf/ext/ep_products/Classes/Service/FlagIconService.php b/web/typo3conf/ext/ep_products/Classes/Service/FlagIconService.php new file mode 100644 index 00000000..b10f9250 --- /dev/null +++ b/web/typo3conf/ext/ep_products/Classes/Service/FlagIconService.php @@ -0,0 +1,67 @@ +, 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\SingletonInterface; +use TYPO3\CMS\Extbase\Service\ImageService; + +class FlagIconService implements SingletonInterface +{ + const FLAGICON_PATH = 'EXT:ep_theme/Resources/Public/images/%s.png'; + + /** + * @var ImageService + */ + protected $imageService; + + /** + * @var array + */ + protected static $cache = []; + + /** + * @param ImageService $imageService + */ + public function __construct(ImageService $imageService) + { + $this->imageService = $imageService; + } + + /** + * @param string $code + * @return string + */ + public function getImage($code) + { + if (!isset(self::$cache[$code])) { + $src = sprintf(self::FLAGICON_PATH, strtolower($code)); + $image = $this->imageService->getImage($src, null, false); + self::$cache[$code] = $this->imageService->getImageUri($image, true); + } + return self::$cache[$code]; + } +} diff --git a/web/typo3conf/ext/ep_products/Classes/Service/HotelImageService.php b/web/typo3conf/ext/ep_products/Classes/Service/HotelImageService.php new file mode 100644 index 00000000..c9718d5f --- /dev/null +++ b/web/typo3conf/ext/ep_products/Classes/Service/HotelImageService.php @@ -0,0 +1,63 @@ +, 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 EP\EpProducts\Traits\ImageServiceTrait; +use TYPO3\CMS\Core\SingletonInterface; + +class HotelImageService implements SingletonInterface +{ + use ImageServiceTrait; + + /** + * @var string + */ + protected $table = 'tx_epproducts_domain_model_hotel'; + + /** + * @var string + */ + protected $field = 'teaser_images'; + + /** + * @var array + */ + protected $imageSizes = [ + 's' => [ + 'width' => '220', + 'height' => '130c-100', + ], + 'm' => [ + 'width' => '260', + 'height' => '200c-100', + ], + 'l' => [ + 'width' => '280', + 'height' => '220c-100', + ] + ]; +} diff --git a/web/typo3conf/ext/ep_products/Classes/Service/HotelService.php b/web/typo3conf/ext/ep_products/Classes/Service/HotelService.php index 0c14c9b2..abdd1836 100644 --- a/web/typo3conf/ext/ep_products/Classes/Service/HotelService.php +++ b/web/typo3conf/ext/ep_products/Classes/Service/HotelService.php @@ -39,19 +39,32 @@ class HotelService implements SingletonInterface * @var \EP\EpProducts\Domain\Repository\HotelRepository */ protected $hotelRepository; + /** - * @var ImageService + * @var HotelImageService */ - protected $imageService; + protected $hotelImageService; + + /** + * @var FlagIconService + */ + protected $flagIconService; /** * @param HotelRepository $hotelRepository - * @param ImageService $imageService + * @param HotelImageService $hotelImageService + * @param FlagIconService $flagIconService */ - public function __construct(HotelRepository $hotelRepository, ImageService $imageService) + public function __construct + ( + HotelRepository $hotelRepository, + HotelImageService $hotelImageService, + FlagIconService $flagIconService + ) { $this->hotelRepository = $hotelRepository; - $this->imageService = $imageService; + $this->hotelImageService = $hotelImageService; + $this->flagIconService = $flagIconService; } /** @@ -94,10 +107,11 @@ class HotelService implements SingletonInterface 'name' => $hotelData['hotelName'], 'teaser' => $hotelData['hotelTeaser'], 'category' => $hotelCategory, - 'images' => $this->imageService->getHotelImages($hotelUid), + 'images' => $this->hotelImageService->getImages($hotelUid), 'country' => [ 'name' => $hotelData['country'], - 'code' => $hotelData['countryCode'] + 'code' => $hotelData['countryCode'], + 'flag' => $this->flagIconService->getImage($hotelData['countryCode']), ], 'region' => [ 'name' => $hotelData['regionName'], @@ -153,10 +167,11 @@ class HotelService implements SingletonInterface 'name' => $row['hotelName'], 'teaser' => $row['hotelTeaser'], 'category' => $hotelCategory, - 'images' => $this->imageService->getHotelImages($hotelUid), + 'images' => $this->hotelImageService->getImages($hotelUid), 'country' => [ 'name' => $row['country'], - 'code' => $row['countryCode'] + 'code' => $row['countryCode'], + 'flag' => $this->flagIconService->getImage($row['countryCode']), ], 'region' => [ 'name' => $row['regionName'], @@ -207,7 +222,7 @@ class HotelService implements SingletonInterface 'name' => $row['hotelName'], 'teaser' => $row['hotelTeaser'], 'category' => $hotelCategory, - 'images' => $this->imageService->getHotelImages($row['hotelUid']), + 'images' => $this->hotelImageService->getImages($row['hotelUid']), 'fact' => $row['hotelFact'], ], 'available' => 0, diff --git a/web/typo3conf/ext/ep_products/Classes/Service/ImageService.php b/web/typo3conf/ext/ep_products/Classes/Service/ImageService.php deleted file mode 100644 index cc6d6bc9..00000000 --- a/web/typo3conf/ext/ep_products/Classes/Service/ImageService.php +++ /dev/null @@ -1,89 +0,0 @@ -, 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\Resource\FileRepository; -use TYPO3\CMS\Core\SingletonInterface; - -class ImageService implements SingletonInterface -{ - /** - * @var \TYPO3\CMS\Core\Resource\FileRepository - */ - protected $fileRepository; - - /** - * @param FileRepository $fileRepository - */ - public function __construct(FileRepository $fileRepository) - { - $this->fileRepository = $fileRepository; - } - - /** - * @var array - */ - static protected $cache = [ - 'imagesProduct' => [], - 'imagesHotel' => [], - ]; - - /** - * @param int $productUid - * @return array - */ - public function getProductImages($productUid) - { - if (!isset(self::$cache['imagesProduct'][$productUid])) { - self::$cache['imagesProduct'][$productUid] = $this->fileRepository->findByRelation( - 'tx_epproducts_domain_model_product', - 'teaser_images', - $productUid - ); - } - - return self::$cache['imagesProduct'][$productUid]; - } - - /** - * @param int $hotelUid - * @return array - */ - public function getHotelImages($hotelUid) - { - if (!isset(self::$cache['imagesHotel'][$hotelUid])) { - self::$cache['imagesHotel'][$hotelUid] = $this->fileRepository->findByRelation( - 'tx_epproducts_domain_model_hotel', - 'teaser_images', - $hotelUid - ); - } - - return self::$cache['imagesHotel'][$hotelUid]; - } - -} \ No newline at end of file diff --git a/web/typo3conf/ext/ep_products/Classes/Service/ProductImageService.php b/web/typo3conf/ext/ep_products/Classes/Service/ProductImageService.php new file mode 100644 index 00000000..b5892345 --- /dev/null +++ b/web/typo3conf/ext/ep_products/Classes/Service/ProductImageService.php @@ -0,0 +1,71 @@ +, 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 EP\EpProducts\Traits\ImageServiceTrait; +use TYPO3\CMS\Core\SingletonInterface; + +class ProductImageService implements SingletonInterface +{ + use ImageServiceTrait; + + /** + * @var string + */ + protected $table = 'tx_epproducts_domain_model_product'; + + /** + * @var string + */ + protected $field = 'teaser_images'; + + /** + * @var array + */ + protected $imageSizes = [ + 'xs' => [ + 'width' => '320', + 'height' => '160c-100', + ], + 's' => [ + 'width' => '350', + 'height' => '175c-100', + ], + 'm' => [ + 'width' => '360', + 'height' => '200c-100', + ], + 'l' => [ + 'width' => '370', + 'height' => '220c-100', + ], + 'xl' => [ + 'width' => '500', + 'height' => '250c-100', + ], + ]; +} diff --git a/web/typo3conf/ext/ep_products/Classes/Service/ProductService.php b/web/typo3conf/ext/ep_products/Classes/Service/ProductService.php index 0f811e77..1d02417f 100644 --- a/web/typo3conf/ext/ep_products/Classes/Service/ProductService.php +++ b/web/typo3conf/ext/ep_products/Classes/Service/ProductService.php @@ -46,24 +46,40 @@ class ProductService implements SingletonInterface protected $hotelRepository; /** - * @var ImageService + * @var ProductImageService */ - protected $imageService; + protected $productImageService; + + /** + * @var HotelImageService + */ + protected $hotelImageService; + + /** + * @var FlagIconService + */ + protected $flagIconService; /** * @param ProductRepository $productRepository * @param HotelRepository $hotelRepository - * @param ImageService $imageService + * @param HotelImageService $hotelImageService + * @param ProductImageService $productImageService + * @param FlagIconService $flagIconService */ public function __construct( ProductRepository $productRepository, HotelRepository $hotelRepository, - ImageService $imageService + HotelImageService $hotelImageService, + ProductImageService $productImageService, + FlagIconService $flagIconService ) { $this->productRepository = $productRepository; $this->hotelRepository = $hotelRepository; - $this->imageService = $imageService; + $this->productImageService = $productImageService; + $this->hotelImageService = $hotelImageService; + $this->flagIconService = $flagIconService; } /** @@ -185,7 +201,7 @@ class ProductService implements SingletonInterface 'fact' => $teaserData['productFact'], 'feature' => $teaserData['productFeature'], 'teaser' => $teaserData['productTeaser'], - 'images' => $this->imageService->getProductImages($teaserData['productUid']), + 'images' => $this->productImageService->getImages($teaserData['productUid']), ], 'concept' => [ 'name' => $teaserData['conceptName'], @@ -196,11 +212,12 @@ class ProductService implements SingletonInterface 'category' => $hotelCategory, 'fact' => $teaserData['hotelFact'], 'uid' => $teaserData['hotelUid'], - 'images' => $this->imageService->getHotelImages($teaserData['hotelUid']), + 'images' => $this->hotelImageService->getImages($teaserData['hotelUid']), ], 'country' => [ 'name' => $teaserData['countryName'], 'code' => $teaserData['countryCode'], + 'flag' => $this->flagIconService->getImage($teaserData['countryCode']), ], 'region' => [ 'name' => $teaserData['regionName'], diff --git a/web/typo3conf/ext/ep_products/Classes/Service/SearchService.php b/web/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php similarity index 83% rename from web/typo3conf/ext/ep_products/Classes/Service/SearchService.php rename to web/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php index fd7b228e..392f765a 100644 --- a/web/typo3conf/ext/ep_products/Classes/Service/SearchService.php +++ b/web/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php @@ -32,7 +32,7 @@ use EP\EpProducts\Domain\Model\SearchResult; use EP\EpProducts\Domain\Repository\ProductRepository; use TYPO3\CMS\Core\SingletonInterface; -class SearchService implements SingletonInterface +class SearchResultService implements SingletonInterface { /** * @var ProductRepository @@ -40,18 +40,30 @@ class SearchService implements SingletonInterface protected $productRepository; /** - * @var ImageService + * @var HotelImageService */ - protected $imageService; + protected $hotelImageService; + + /** + * @var FlagIconService + */ + protected $flagIconService; /** * @param ProductRepository $productRepository - * @param ImageService $imageService + * @param HotelImageService $hotelImageService + * @param FlagIconService $flagIconService */ - public function __construct(ProductRepository $productRepository, ImageService $imageService) + public function __construct + ( + ProductRepository $productRepository, + HotelImageService $hotelImageService, + FlagIconService $flagIconService + ) { $this->productRepository = $productRepository; - $this->imageService = $imageService; + $this->hotelImageService = $hotelImageService; + $this->flagIconService = $flagIconService; } /** @@ -60,10 +72,10 @@ class SearchService implements SingletonInterface * * @return SearchResult */ - public function getSearchResult(FilterSettings $filterSettings, $excludedConceptUids = []) + public function getResult(FilterSettings $filterSettings, $excludedConceptUids = []) { $searchResultData = $this->productRepository->getSearchResult($filterSettings, $excludedConceptUids); - return $this->preprocessSearchresult($searchResultData); + return $this->preprocess($searchResultData); } /** @@ -71,7 +83,7 @@ class SearchService implements SingletonInterface * * @return SearchResult */ - public function preprocessSearchresult(array $searchResultData) + public function preprocess(array $searchResultData) { $data = []; $total = 0; @@ -100,9 +112,11 @@ class SearchService implements SingletonInterface if (!array_key_exists($key, $items)) { $items[$key] = [ + 'key' => $key, 'minDateStart' => null, 'maxDateEnd' => null, 'minPrice' => null, + 'detailPageUri' => null, 'earlybird' => $row['earlybird'], 'lowContingent' => $row['lowContingent'], 'servicesIncluded' => unserialize($row['servicesIncluded']), @@ -110,13 +124,14 @@ class SearchService implements SingletonInterface 'uid' => $row['hotelUid'], 'name' => $row['hotelName'], 'teaser' => $row['hotelTeaser'], - 'images' => $this->imageService->getHotelImages($row['hotelUid']), + 'images' => $this->hotelImageService->getImages($row['hotelUid']), 'fact' => $row['hotelFact'], 'category' => $hotelCategory, ], 'country' => [ 'code' => $row['countryCode'], 'name' => $row['countryName'], + 'flag' => $this->flagIconService->getImage($row['countryCode']), ], 'region' => [ 'name' => $row['regionName'], @@ -148,8 +163,8 @@ class SearchService implements SingletonInterface $item['dates'][] = $row['dateStart']; } - $dateStart = new \DateTime($row['dateStart']); - $dateEnd = new \DateTime($row['dateEnd']); + $dateStart = $row['dateStart']; + $dateEnd = $row['dateEnd']; if ($item['minDateStart'] === null || $item['minDateStart'] > $dateStart) { @@ -178,5 +193,4 @@ class SearchService implements SingletonInterface return new SearchResult($data, $total); } - -} \ No newline at end of file +} diff --git a/web/typo3conf/ext/ep_products/Classes/Service/SearchResultUrlService.php b/web/typo3conf/ext/ep_products/Classes/Service/SearchResultUrlService.php new file mode 100644 index 00000000..9a5ae270 --- /dev/null +++ b/web/typo3conf/ext/ep_products/Classes/Service/SearchResultUrlService.php @@ -0,0 +1,93 @@ +, 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 EP\EpProducts\Domain\Model\FilterSettings; +use EP\EpProducts\Domain\Model\SearchResult; +use Symfony\Component\OptionsResolver\OptionsResolver; +use TYPO3\CMS\Core\SingletonInterface; +use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder; + +class SearchResultUrlService implements SingletonInterface +{ + /** + * @var UriBuilder + */ + protected $uriBuilder; + + /** + * @param UriBuilder $uriBuilder + */ + public function __construct(UriBuilder $uriBuilder) + { + $this->uriBuilder = $uriBuilder; + } + + /** + * @param SearchResult $searchResult + * @param array $options + */ + public function process(SearchResult $searchResult, array $options) + { + $optionsResolver = new OptionsResolver(); + $optionsResolver->setRequired([ 'defaultDetailPageUid', 'referringPageUid', 'filterSettings' ]); + $optionsResolver->setAllowedTypes('filterSettings', FilterSettings::class); + $resolvedOptions = $optionsResolver->resolve($options); + + /** @var FilterSettings $filterSettings */ + $filterSettings = $resolvedOptions['filterSettings']; + $encodedFilterSettings = FilterSettingsEncoder::encode($filterSettings); + $defaultDetailPageUid = $resolvedOptions['defaultDetailPageUid']; + $referringPageUid = $resolvedOptions['referringPageUid']; + + $data = $searchResult->getData(); + + foreach ($data as $conceptUid => $conceptData) + { + foreach ($conceptData['items'] as $key => $item) + { + $detailPageUid = $item['product']['detailPage'] ?: $defaultDetailPageUid; + $arguments = [ + 'product' => $item['product']['uid'], + 'hotel' => $item['hotel']['uid'], + 'referringPageUid' => $referringPageUid, + 'filterSettings' => $encodedFilterSettings, + ]; + $uri = $this + ->uriBuilder + ->reset() + ->setTargetPageUid($detailPageUid) + ->setCreateAbsoluteUri(true) + ->uriFor('detail', $arguments, 'Product', 'epproducts', 'product_detail') + ; + $data[$conceptUid]['items'][$key]['detailPageUri'] = $uri; + } + } + + $searchResult->setData($data); + } +} diff --git a/web/typo3conf/ext/ep_products/Classes/Traits/ImageServiceTrait.php b/web/typo3conf/ext/ep_products/Classes/Traits/ImageServiceTrait.php new file mode 100644 index 00000000..16ff649b --- /dev/null +++ b/web/typo3conf/ext/ep_products/Classes/Traits/ImageServiceTrait.php @@ -0,0 +1,105 @@ +, 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\Resource\FileRepository; +use TYPO3\CMS\Extbase\Service\ImageService; + +trait ImageServiceTrait +{ + /** + * @var array + */ + protected static $cache = []; + + /** + * @var \TYPO3\CMS\Core\Resource\FileRepository + */ + protected $fileRepository; + + /** + * @var ImageService + */ + protected $imageService; + + /** + * @param FileRepository $fileRepository + * @param ImageService $imageService + */ + public function __construct(FileRepository $fileRepository, ImageService $imageService) + { + $this->fileRepository = $fileRepository; + $this->imageService = $imageService; + } + + /** + * @param int $uid + * @return array + */ + public function getImages($uid) + { + if (!isset(self::$cache[$uid])) { + $original = $this->fileRepository->findByRelation( + $this->table, + $this->field, + $uid + ); + $resized = $this->generateResizedImages($original); + self::$cache[$uid] = [ + 'original' => $original, + 'resized' => $resized, + ]; + } + + return self::$cache[$uid]; + } + + /** + * @param array $images + * @return array + */ + protected function generateResizedImages($images) + { + $resized = []; + foreach ($this->imageSizes as $version => $instructions) + { + foreach ($images as $image) + { + $intructions['crop'] = $image->getProperty('crop'); + $processedImage = $this->imageService->applyProcessingInstructions($image, $instructions); + $resized[$version][] = [ + 'url' => $this->imageService->getImageUri($processedImage, true), + 'alt' => $image->getProperty('alternative'), + 'title' => $image->getProperty('title'), + ]; + } + } + return $resized; + } + +} diff --git a/web/typo3conf/ext/ep_products/Configuration/TypoScript/setup.txt b/web/typo3conf/ext/ep_products/Configuration/TypoScript/setup.txt index 48259662..2b12e567 100644 --- a/web/typo3conf/ext/ep_products/Configuration/TypoScript/setup.txt +++ b/web/typo3conf/ext/ep_products/Configuration/TypoScript/setup.txt @@ -108,8 +108,7 @@ tx_epproducts_ajax_json { 2 = reset } AjaxFilterpanel { - 1 = options - 2 = autocomplete + 1 = autocomplete } AjaxContent { 1 = country diff --git a/web/typo3conf/ext/ep_products/ext_localconf.php b/web/typo3conf/ext/ep_products/ext_localconf.php index 5b221527..0b589847 100644 --- a/web/typo3conf/ext/ep_products/ext_localconf.php +++ b/web/typo3conf/ext/ep_products/ext_localconf.php @@ -314,7 +314,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\EP\EpProducts\T [ 'AjaxSearch' => 'searchresult', 'AjaxDate' => 'dates', - 'AjaxFilterpanel' => 'options,autocomplete', + 'AjaxFilterpanel' => 'autocomplete', 'AjaxSearchbar' => 'options,reset', 'AjaxContent' => 'country,region,city,hotel,product,journey,webcam', 'AjaxTable' => 'pricetable,pricetableHtml,eventPricetable', @@ -323,7 +323,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\EP\EpProducts\T [ 'AjaxSearch' => 'searchresult', 'AjaxDate' => 'dates', - 'AjaxFilterpanel' => 'options,autocomplete', + 'AjaxFilterpanel' => 'autocomplete', 'AjaxSearchbar' => 'options,reset', 'AjaxContent' => 'webcam', 'AjaxTable' => 'pricetable,pricetableHtml,eventPricetable', diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/AjaxContent.vue b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/AjaxContent.vue index 8c899be5..fd1b365f 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/AjaxContent.vue +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/AjaxContent.vue @@ -26,6 +26,7 @@ this.loading = false; this.html = html; $(this.$refs.trigger).remove(); + EventBus.$emit('ajaxContentLoaded'); }); }, isInViewport ($triggerElement) { @@ -42,11 +43,6 @@ } } }, - watch: { - html () { - EventBus.$emit('ajaxContentLoaded'); - } - }, mounted () { const $triggerElement = $(this.$refs.trigger); this.initContent($triggerElement); 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 35c8d827..33f573df 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 @@ -14,7 +14,6 @@ import 'dayjs/locale/de' export default { - template: '#productdetailtpl', components: { DatesTable, PriceTable, @@ -27,7 +26,6 @@ }, data () { return { - lock: false, datesRows: {}, altLabel: null, altProductLink: null, @@ -56,17 +54,13 @@ }, methods: { loadDates () { - if (this.lock) { - return; - } - this.lock = true; this.loading = true; this.datesShow = true; this.priceTableShow = false; this.detailShow = false; let query = {}; query[this.argumentPrefix + '[filterSettings]'] = this.filterSettings; - $.get(this.uris['dates'], query, (json) => { + $.post(this.uris['dates'], query, (json) => { if (json.dates.length === 1) { this.singleDate = true; let dateRow = json.dates[0]; @@ -79,7 +73,7 @@ this.altProductLink = json.altProductLink; this.loading = false; } - this.lock = false; + EventBus.$emit('tableLoaded'); }, 'json'); }, @@ -102,6 +96,7 @@ this.dateEnd = dayjs(json.dateEnd).format('DD.MM.YYYY'); this.servicesIncluded = json.servicesIncluded; this.loading = false; + EventBus.$emit('tableLoaded'); }, 'json'); }, loadPriceTableView (dateuid) { @@ -120,6 +115,7 @@ if (scroll) { this.scrollToMain(); } + EventBus.$emit('ajaxContentLoaded'); }); this.activeUri = uri; }, @@ -127,23 +123,7 @@ EventBus.$emit('scrollTo', '#main'); } }, - watch: { - detailHtml () { - EventBus.$emit('ajaxContentLoaded'); - }, - datesRows () { - EventBus.$emit('tableLoaded'); - }, - priceTableRows () { - EventBus.$emit('tableLoaded'); - } - }, created () { - EventBus.$on('dateRangeUpdate', (range) => { - this.filterSettings.dateFrom = (range.from !== null) ? dayjs(range.from).format('YYYY-MM-DD') : null; - this.filterSettings.dateTo = (range.to !== null) ? dayjs(range.to).format('YYYY-MM-DD') : null; - this.loadDates(); - }); EventBus.$on('loadDatesTable', () => { this.loadDatesView(); }); @@ -156,8 +136,7 @@ if (this.hotelFirst) { this.loadHtml('hotel', false); } else { - this.loadDates(); - this.activeUri = 'dates'; + this.loadDatesView(); } }); } diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchBar.vue b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchBar.vue index 2088305e..42a6e71d 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchBar.vue +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/SearchBar.vue @@ -1,5 +1,4 @@ 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 new file mode 100644 index 00000000..a188e98d --- /dev/null +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Assets/js/filtersettings.js @@ -0,0 +1,19 @@ +export default { + destinationName: '', + destinationUid: 0, + destinationType: '', + productUid: 0, + hotelUid: 0, + countryUids: [], + regionUids: [], + cityUids: [], + conceptUids: [], + dateFrom: null, + dateTo: null, + nights: 0, + pax: 1, + hotelTypes: [], + boardTypes: [], + roomTypes: [], + bus: false +}; diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/Teaser.html b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/Teaser.html index ecba018d..b348514d 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/Teaser.html +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/Teaser.html @@ -8,9 +8,9 @@
{country: hotel.country.name} - +
{hotel.name -> f:format.nl2br()} diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserExtended.html b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserExtended.html index e5bc830a..1d9958d7 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserExtended.html +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserExtended.html @@ -1,16 +1,14 @@
{country: hotel.country.name} - +
{hotel.name -> f:format.nl2br()} diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserSimple.html b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserSimple.html index c7a3e50c..e7fe3728 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserSimple.html +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/TeaserSimple.html @@ -1,16 +1,14 @@
{hotel.country.name} - +
{hotel.name -> f:format.nl2br()} 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 4dd7c687..6e06a81e 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 @@ -9,7 +9,7 @@
{product.country.name} - + - + + +
@@ -75,10 +79,14 @@
  • - {f:if(condition: '{subitem.tx_eptheme_context_country_code}', then: '{f:image(src: \'{ep:flagiconSource(countryCode: subitem.tx_eptheme_context_country_code)}\', alt: subitem.tx_eptheme_context_country_code)}')}{subitem.title} + + {f:if(condition: '{subitem.tx_eptheme_context_country_code}', then: '{f:image(src: \'{ep:flagiconSource(countryCode: subitem.tx_eptheme_context_country_code)}\', alt: subitem.tx_eptheme_context_country_code)}')}{subitem.title} + - {f:if(condition: '{subitem.tx_eptheme_context_country_code}', then: '{f:image(src: \'{ep:flagiconSource(countryCode: subitem.tx_eptheme_context_country_code)}\', alt: subitem.tx_eptheme_context_country_code)}')}{subitem.title} + + {f:if(condition: '{subitem.tx_eptheme_context_country_code}', then: '{f:image(src: \'{ep:flagiconSource(countryCode: subitem.tx_eptheme_context_country_code)}\', alt: subitem.tx_eptheme_context_country_code)}')}{subitem.title} +
  • diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/Teaser.html b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/Teaser.html index 8cdaf91f..3925f581 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/Teaser.html +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/Teaser.html @@ -36,9 +36,9 @@
    {teaser.country.name} - +
    {teaser.concept.name}
    diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/TeaserWide.html b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/TeaserWide.html index 3740a00c..32df4a4b 100644 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/TeaserWide.html +++ b/web/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/TeaserWide.html @@ -20,7 +20,7 @@
    {teaser.country.name} @@ -100,10 +100,10 @@ - + - + diff --git a/web/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxSearch/Searchresult.html b/web/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxSearch/Searchresult.html deleted file mode 100644 index d48eb372..00000000 --- a/web/typo3conf/ext/ep_theme/Resources/Private/Templates/AjaxSearch/Searchresult.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - -

    {section.concept.name}

    -
    - - - -
    -
    - - - -
    -
    - {item.country.name} - - - - -
    {section.concept.name}
    -
    -
    -
    -
    - - {item.region.name}
    {item.product.name}
    -
    - {item.hotel.name} - - Kategorie {item.hotel.category} - -
    -
      - -
    • {item.hotel.fact}
    • -
      - -
    • {item.product.fact}
    • -
      - - -
    • {item.region.feature}
    • -
      - - -
    • {item.region.fact}
    • -
      -
      -
      -
    -
      -
    • Skipass
    • - -
    • {item.board}
    • -
      - -
    • {item.product.feature}
    • -
      -
    -
    -
    -
    - {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 -
    -
    -
    -
    - - - - - - - - - - {image.alternative} - - - - - - - - - - - - - - - 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 795125a4..b314d5bf 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 @@ -9,6 +9,7 @@
    + ' :hotel-first="{f:if(condition: settings.hotelOnTop, then: 'true', else: 'false')}" :fb-pixel-data="{ productUid: {product.uid}, nameInternal: '{product.nameInternal}' }" - > - - +
    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 9a4c1628..139e431c 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 @@ -1,6 +1,5 @@ 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 10f4b8b8..573971c7 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 @@ -9,7 +9,6 @@