diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php index e7417e00..3558839d 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxTableController.php @@ -194,6 +194,7 @@ class AjaxTableController extends ActionController } $hasSurchargeOrDiscount = $this->dateService->checkSurcharcheOrDiscount($allDates); + $hasIncludedServices = $this->dateService->hasIncludedServices($allDates); $noInfoConceptUids = GeneralUtility::trimExplode(',', $this->settings['noInfoConceptUids']); $isProductWithNoInfoConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(), $noInfoConceptUids, false); @@ -209,6 +210,7 @@ class AjaxTableController extends ActionController 'hotel' => $hotel, 'altProductLink' => $altProductLink, 'altLabel' => $altLabel, + 'hasIncludedServices' => $hasIncludedServices, 'hasSurcharge' => $hasSurchargeOrDiscount['surcharge'], 'hasDiscount' => $hasSurchargeOrDiscount['discount'], 'isProductWithNoInfoConcept' => $isProductWithNoInfoConcept, @@ -244,14 +246,14 @@ class AjaxTableController extends ActionController 'paCode' => GeneralUtility::_GET('pa'), ]); $hasSurchargeOrDiscount = $this->dateService->checkSurcharcheOrDiscount($priceTable); + $hasIncludedServices = $this->dateService->hasIncludedServices($priceTable); $dateStart = $date ? $date->getDateStart()->format('d.m.y') : ''; $dateEnd = $date ? $date->getDateEnd()->format('d.m.y') : ''; $dateRange = sprintf('%s - %s', $dateStart, $dateEnd); $noInfoConceptUids = GeneralUtility::trimExplode(',', $this->settings['noInfoConceptUids']); - $isProductWithNoInfoConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(), - $noInfoConceptUids, false); + $isProductWithNoInfoConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(), $noInfoConceptUids); $nonBookableInfo = $this->getNonBookableInfobox($product); @@ -262,6 +264,7 @@ class AjaxTableController extends ActionController 'servicesIncluded' => $date->getServicesIncluded(), 'prices' => $priceTable, 'unavailable' => count($priceTable) === 0, + 'hasIncludedServices' => $hasIncludedServices, 'hasSurcharge' => $hasSurchargeOrDiscount['surcharge'], 'hasDiscount' => $hasSurchargeOrDiscount['discount'], 'isProductWithNoInfoConcept' => $isProductWithNoInfoConcept, @@ -286,7 +289,7 @@ class AjaxTableController extends ActionController $nonBookableInfo = $this->getNonBookableInfobox($product); - $pricetable = $this->dateService->getPriceTable([ + $priceTable = $this->dateService->getPriceTable([ 'product' => $product, 'hotel' => $hotel, 'filterSettings' => $this->filterService->getNormalizedFilterSettings(), @@ -294,10 +297,14 @@ class AjaxTableController extends ActionController 'paCode' => $paCode, 'sortByRoom' => true, ]); + $hasIncludedServices = $this->dateService->hasIncludedServices($priceTable); - $this->view->assign('pricetable', $pricetable); - $this->view->assign('nonBookableInfo', $nonBookableInfo); - $this->view->assign('bpnBookingUrlTemplateCode', $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode']); + $this->view->assignMultiple([ + 'pricetable' => $priceTable, + 'hasIncludedServices' => $hasIncludedServices, + 'nonBookableInfo' => $nonBookableInfo, + 'bpnBookingUrlTemplateCode' => $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode'], + ]); } /** @@ -319,7 +326,8 @@ class AjaxTableController extends ActionController }, $roomTypes); $maxPax = max($roomTypesPax); $template = $this->settings['bpnBookingUrlTemplateCode']; - $pricetable = $this->dateService->getEventPriceTable($product, $maxPax, $template); + $priceTable = $this->dateService->getEventPriceTable($product, $maxPax, $template); + $hasIncludedServices = $this->dateService->hasIncludedServices($priceTable); $nonBookableInfo = $this->getNonBookableInfobox($product); $categories = [ Hotel::CATEGORY_STANDARD => 'Standard', @@ -330,7 +338,8 @@ class AjaxTableController extends ActionController $this->view->assignMultiple([ 'roomTypesPax' => $roomTypesPax, 'roomTypesLabels' => $roomTypesLabels, - 'pricetable' => $pricetable, + 'pricetable' => $priceTable, + 'hasIncludedServices' => $hasIncludedServices, 'categories' => $categories, 'themekey' => $this->settings['themekey'], 'nonBookableInfo' => $nonBookableInfo, diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php index c3ad5889..4dc288d6 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php @@ -410,6 +410,20 @@ class DateService implements SingletonInterface return $priceTable; } + public function hasIncludedServices(array $tableData): bool + { + $included = false; + + foreach ($tableData as $row) { + if ($row['busIncluded'] || $row['skipassIncluded']) { + $included = true; + break; + } + } + + return $included; + } + public function checkSurcharcheOrDiscount(array $tableData): array { $data = [ diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Pricetable.html b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Pricetable.html index 8076c1ed..67ca036a 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Pricetable.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Pricetable.html @@ -22,9 +22,11 @@