From c1da7dde8b072ac066d60cac4f773d643c845636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 2 Nov 2021 17:27:54 +0100 Subject: [PATCH] Adopt product teasers on city detail page --- .../Classes/Controller/CityController.php | 31 +++++++++++++--- .../FlexForms/flexform_city_detail.xml | 9 +++++ .../Private/Templates/City/Detail.html | 36 +++++++++++++++++-- 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/CityController.php b/public/typo3conf/ext/ep_products/Classes/Controller/CityController.php index 5d5e4b80..79087863 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/CityController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/CityController.php @@ -29,22 +29,30 @@ namespace EP\EpProducts\Controller; use EP\EpProducts\Domain\Model\City; use EP\EpProducts\Domain\Repository\CityRepository; +use EP\EpProducts\Service\ProductDataService; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class CityController extends ActionController { /** - * @var \EP\EpProducts\Domain\Repository\CityRepository + * @var CityRepository */ protected $cityRepository; /** - * @param CityRepository $cityRepository + * @var ProductDataService */ - public function __construct(CityRepository $cityRepository) + private $productDataService; + + /** + * @param CityRepository $cityRepository + * @param ProductDataService $productDataService + */ + public function __construct(CityRepository $cityRepository, ProductDataService $productDataService) { $this->cityRepository = $cityRepository; + $this->productDataService = $productDataService; } /** @@ -52,12 +60,25 @@ class CityController extends ActionController */ public function detailAction(City $city = null) { - if ($city === null) { + if (null === $city) { $cityUid = $this->settings['cityUid']; $city = $this->cityRepository->findByIdentifier($cityUid); } - $this->view->assign('city', $city); + $teasers = []; + + if (null !== $city) { + $filterSettings = [ + 'cityUids' => [$cityUid] + ]; + $teasers = $this->productDataService->getTeasergroup($filterSettings); + } + + $this->view->assignMultiple([ + 'city' => $city, + 'teasers' => $teasers, + 'filterSettings' => $filterSettings, + ]); } public function teasergroupAction() diff --git a/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_city_detail.xml b/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_city_detail.xml index 6f790110..cdb2dcbf 100644 --- a/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_city_detail.xml +++ b/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_city_detail.xml @@ -24,6 +24,15 @@ + + + 0 + + + check + + + diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/City/Detail.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/City/Detail.html index ba12432f..79edc5d9 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/City/Detail.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/City/Detail.html @@ -10,7 +10,7 @@
- +