diff --git a/web/typo3conf/ext/ep_products/Classes/Domain/Repository/HotelRepository.php b/web/typo3conf/ext/ep_products/Classes/Domain/Repository/HotelRepository.php index c3c141da..77d60c38 100644 --- a/web/typo3conf/ext/ep_products/Classes/Domain/Repository/HotelRepository.php +++ b/web/typo3conf/ext/ep_products/Classes/Domain/Repository/HotelRepository.php @@ -50,6 +50,33 @@ class HotelRepository extends AbstractRepository return $qb->execute()->fetch(); } + /** + * @param int $hotelUid + * @return array + */ + public function getDateIndependentSingleByUid($hotelUid) + { + $qb = DbUtility::getDbConnection()->createQueryBuilder(); + $qb + ->select( + 'hotel.uid hotelUid', 'hotel.name hotelName', 'hotel.teaser hotelTeaser', + 'hotel.category hotelCategory', 'hotel.detail_page hotelDetailPage', + 'country.code countryCode', 'country.name country', + 'region.name region' + ) + ->from('tx_epproducts_domain_model_hotel', 'hotel') + ->leftJoin('hotel', 'tx_epproducts_domain_model_country', 'country', 'hotel.country = country.uid') + ->leftJoin('hotel', 'tx_epproducts_domain_model_region', 'region', 'hotel.region = region.uid') + ->where('hotel.uid = :hotelUid') + ->andWhere('hotel.hidden = 0') + ->andWhere('hotel.show_as_teaser = 1') + ->andWhere('hotel.deleted = 0') + ->setParameter('hotelUid', $hotelUid) + ; + + return $qb->execute()->fetch(); + } + /** * @param int $productUid * @return array diff --git a/web/typo3conf/ext/ep_products/Classes/Service/HotelService.php b/web/typo3conf/ext/ep_products/Classes/Service/HotelService.php index 0848ead8..0c14c9b2 100644 --- a/web/typo3conf/ext/ep_products/Classes/Service/HotelService.php +++ b/web/typo3conf/ext/ep_products/Classes/Service/HotelService.php @@ -73,6 +73,11 @@ class HotelService implements SingletonInterface { $hotelData = $this->hotelRepository->getSingleByUid($hotelUid); + if ($hotelData === false) { + $hotelData = $this->hotelRepository->getDateIndependentSingleByUid($hotelUid); + $hotelData['available'] = -1; // TODO: Needs improvement. '-1' actually means: no price/date info available + } + $hotelCategory = array_key_exists($hotelData['hotelCategory'], Hotel::$categoryLabels) ? Hotel::$categoryLabels[$hotelData['hotelCategory']] : null; @@ -265,4 +270,4 @@ class HotelService implements SingletonInterface return $hotels; } -} \ No newline at end of file +} 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 e5bc830a..ecba018d 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 @@ -19,8 +19,10 @@
{hotel.teaser -> f:format.crop(maxCharacters: settings.teaserTextMaxChars) -> f:format.html()} -
- {f:if(condition: '{hotel.available} > 0', then: 'ab {hotel.minPrice} €', else: 'ausgebucht')} + +
+ {f:if(condition: '{hotel.available} > 0', then: 'ab {hotel.minPrice} €', else: 'ausgebucht')} +
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 cbd4d5e3..c7a3e50c 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 @@ -9,7 +9,7 @@
{country: hotel.country.name} + alt="{hotel.country.name}"/>