Adopt product teasers on city detail page
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -24,6 +24,15 @@
|
||||
</config>
|
||||
</TCEforms>
|
||||
</settings.cityUid>
|
||||
<settings.showMoreLink>
|
||||
<TCEforms>
|
||||
<exclude>0</exclude>
|
||||
<label>Link zum Suchergebnis anzeigen:</label>
|
||||
<config>
|
||||
<type>check</type>
|
||||
</config>
|
||||
</TCEforms>
|
||||
</settings.showMoreLink>
|
||||
</el>
|
||||
</ROOT>
|
||||
</sDEF>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<f:render partial="SubpageHeader" arguments="{images: city.headerImages, topline: city.headerSubtitle, headline: city.headerTitle, settings: settings}"/>
|
||||
<f:cObject typoscriptObjectPath="lib.breadcrumb"/>
|
||||
<div class="container">
|
||||
<f:if condition="{v:content.get(column: 1) -> f:count()} > 0">
|
||||
<f:if condition="{teasers}">
|
||||
<div class="mb-8 lg:hidden">
|
||||
<button type="button"
|
||||
class="button w-full mb-8"
|
||||
@@ -25,9 +25,41 @@
|
||||
<div class="grid grid-cols-3 gap-8">
|
||||
<div class="col-span-3 lg:col-span-2">
|
||||
<f:render partial="City/Details" arguments="{city: city}"/>
|
||||
<f:if condition="{teasers}">
|
||||
<div class="flex flex-col space-y-4 md:space-y-8">
|
||||
<f:for each="{teasers}" as="teaser" iteration="iteration">
|
||||
<f:render partial="Product/Teaser" section="Teaser" arguments="{
|
||||
concept: teaser.concept,
|
||||
hotel: teaser.hotel,
|
||||
product: teaser.product,
|
||||
country: teaser.country,
|
||||
region: teaser.region,
|
||||
productImage: teaser.product.images.original.0,
|
||||
nights: teaser.nights,
|
||||
board: teaser.board,
|
||||
minPrice: teaser.minPrice,
|
||||
daytrip: teaser.daytrip,
|
||||
season: teaser.season,
|
||||
forceHotelUid: teaser.forceHotelUid,
|
||||
dateFrom: dateFrom,
|
||||
dateTo: dateTo,
|
||||
landscape: 1,
|
||||
index: iteration.index
|
||||
}"/>
|
||||
</f:for>
|
||||
</div>
|
||||
<f:if condition="{settings.showMoreLink}">
|
||||
<f:link.action pageUid="{settings.defaultStaticSearchPageUid}" class="button my-8"
|
||||
action="staticresult" controller="Search"
|
||||
arguments="{encodedFilterSettings: '{filterSettings -> ep:filterSettingsEncoder()}'}"
|
||||
additionalAttributes="{rel: 'nofollow'}">
|
||||
Alle anzeigen
|
||||
</f:link.action>
|
||||
</f:if>
|
||||
</f:if>
|
||||
</div>
|
||||
<div class="col-span-3 lg:col-span-1">
|
||||
<f:if condition="{v:content.get(column: 1) -> f:count()} > 0">
|
||||
<f:if condition="{teasers}">
|
||||
<p class="hidden lg:block">
|
||||
<button type="button"
|
||||
class="button w-full mb-8"
|
||||
|
||||
Reference in New Issue
Block a user