diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Product.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Product.php index 1cd0843f..8dfc59ee 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Product.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Product.php @@ -40,6 +40,11 @@ class Product extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements */ protected $bookable = true; + /** + * @var bool + */ + protected $hideBookingButton = false; + /** * @var bool */ @@ -302,6 +307,22 @@ class Product extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements $this->bookable = (bool) $bookable; } + /** + * @return bool + */ + public function getHideBookingButton() + { + return $this->hideBookingButton; + } + + /** + * @param bool $hideBookingButton + */ + public function setHideBookingButton($hideBookingButton) + { + $this->hideBookingButton = (bool) $hideBookingButton; + } + /** * @return bool */ diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php index 6ecc3ca8..b6adee38 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php @@ -100,7 +100,7 @@ class ProductRepository extends AbstractRepository 'date.board as board', 'date.product_fact as productFact', 'date.hotel_fact as hotelFact', 'date.region_fact as regionFact', 'date.services_included as servicesIncluded', 'date.min_price as minPrice', 'date.nights as nights', 'date.available as available', - 'date.pseudo_price as pseudoPrice' + 'date.pseudo_price as pseudoPrice', 'date.hide_booking_button as hideBookingButton' ) ->from('tx_epproducts_domain_model_date', 'date') ->leftJoin('date', 'tx_epproducts_domain_model_room', 'room', 'room.date = date.uid') @@ -154,8 +154,8 @@ class ProductRepository extends AbstractRepository 'date_start as dateStart', 'date_end as dateEnd', 'uid as dateUid', 'min_price as minPrice', 'pseudo_price as pseudoPrice', 'nights as nights', 'available as available', 'skipass_included as skipassIncluded', 'bus_included as busIncluded', - 'earlybird', 'new', 'daytrip', 'low_contingent as lowContingent', - 'concept_code as conceptCode', 'concept_name as conceptName', + 'earlybird', 'new', 'daytrip', 'hide_booking_button as hideBookingButton', + 'low_contingent as lowContingent', 'concept_code as conceptCode', 'concept_name as conceptName', 'board' ) ->from('tx_epproducts_domain_model_date', 'date') diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php index dccf047d..7e710c75 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php @@ -232,7 +232,7 @@ class DateImportService implements SingletonInterface $dateCount = 0; $sql = ' - SELECT p.uid uid, p.daytrip daytrip, p.important important, p.name product_name, + SELECT p.uid uid, p.daytrip daytrip, p.hide_booking_button, p.important important, p.name product_name, p.searchable product_searchable, p.detail_page product_detail_page, p.keywords product_keywords, p.teaser product_teaser, p.feature product_feature, p.subline product_subline, p.country country, p.region region, p.city city, p.path_segment slug, @@ -365,6 +365,7 @@ class DateImportService implements SingletonInterface 'bus_pro_id' => $busProId, 'code' => $code, 'daytrip' => $product['daytrip'], + 'hide_booking_button' => $product['hide_booking_button'], 'important' => $product['important'], ]; @@ -619,7 +620,7 @@ class DateImportService implements SingletonInterface foreach ($section as $service) { if ($service['price'] < 0) { - return $service['price']; + return (int) $service['price']; } } } @@ -724,8 +725,8 @@ class DateImportService implements SingletonInterface foreach ($services['BUS'] as $service) { $date['bus_available'] = 1; - $date['bus_price'] = $service['price']; - $date['bus_included'] = ((int) $service['price'] === 0); + $date['bus_price'] = (int) $service['price']; + $date['bus_included'] = (int) ((int) $service['price'] === 0); } } diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php index 44b0631c..2691e65f 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php @@ -107,6 +107,7 @@ class DateService implements SingletonInterface 'template' => $template, 'paCode' => $paCode, 'isDayTrip' => $product->isDaytrip(), + 'isHideBookingButton' => $product->getHideBookingButton(), ]); } @@ -148,6 +149,7 @@ class DateService implements SingletonInterface 'template' => $template, 'paCode' => $paCode, 'isDayTrip' => $product->isDaytrip(), + 'isHideBookingButton' => $product->getHideBookingButton(), ]); } @@ -259,9 +261,10 @@ class DateService implements SingletonInterface public function preprocessPriceTable(array $options) { $resolver = new OptionsResolver(); - $resolver->setDefined('paCode'); + $resolver->setDefined(['paCode', 'isDayTrip', 'isHideBookingButton']); $resolver->setRequired(['priceTableData', 'template']); $resolver->setDefault('isDayTrip', false); + $resolver->setDefault('isHideBookingButton', false); $resolvedOptions = $resolver->resolve($options); $priceTable = []; @@ -269,6 +272,7 @@ class DateService implements SingletonInterface $template = $resolvedOptions['template']; $paCode = $resolvedOptions['paCode']; $isDayTrip = $resolvedOptions['isDayTrip']; + $isHideBookingButton = $resolvedOptions['isHideBookingButton']; foreach ($priceTableData as $row) { @@ -299,6 +303,7 @@ class DateService implements SingletonInterface 'hotelBusProId' => $row['hotelBusProId'], 'roomBusProId' => $row['roomBusProId'], 'bookingUrl' => $bookingUrl, + 'isHideBookingButton' => $isHideBookingButton, ]; } @@ -312,9 +317,10 @@ class DateService implements SingletonInterface public function preprocessDateTable(array $options) { $resolver = new OptionsResolver(); - $resolver->setDefined('paCode'); + $resolver->setDefined(['paCode', 'isDayTrip', 'isHideBookingButton']); $resolver->setRequired(['dateTableData', 'template']); $resolver->setDefault('isDayTrip', false); + $resolver->setDefault('isHideBookingButton', false); $resolvedOptions = $resolver->resolve($options); $dateTable = []; @@ -323,6 +329,7 @@ class DateService implements SingletonInterface $template = $resolvedOptions['template']; $paCode = $resolvedOptions['paCode']; $isDayTrip = $resolvedOptions['isDayTrip']; + $isHideBookingButton = $resolvedOptions['isHideBookingButton']; foreach ($dateTableData as $row) { @@ -351,6 +358,7 @@ class DateService implements SingletonInterface 'dateServicesGeneral' => unserialize($row['dateServicesGeneral'], ['allowed_classes' => false]), 'available' => $row['available'], 'bookingUrl' => $bookingUrl, + 'isHideBookingButton' => $isHideBookingButton, ]; } diff --git a/public/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php b/public/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php index 83c6da30..184e0e53 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php @@ -197,6 +197,7 @@ class ProductDataService implements SingletonInterface 'earlybird' => $teaserData['earlybird'], 'new' => $teaserData['new'], 'daytrip' => $teaserData['daytrip'], + 'hideBookingButton' => $teaserData['hideBookingButton'], 'lowContingent' => $teaserData['lowContingent'], 'servicesIncluded' => unserialize($teaserData['servicesIncluded']), 'product' => [ diff --git a/public/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php b/public/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php index 95d16477..ea7703bf 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php @@ -107,8 +107,7 @@ class SearchResultService implements SingletonInterface // Use compound key, hotel is not unique $key = $row['hotelUid'] . ':' . $row['productUid']; - $hotelCategory = array_key_exists($row['hotelCategory'], Hotel::$categoryLabels) ? - Hotel::$categoryLabels[$row['hotelCategory']] : null; + $hotelCategory = Hotel::$categoryLabels[$row['hotelCategory']] ?? null; if (!array_key_exists($key, $items)) { $items[$key] = [ @@ -119,6 +118,7 @@ class SearchResultService implements SingletonInterface 'detailPageUri' => null, 'earlybird' => $row['earlybird'], 'daytrip' => $row['daytrip'], + 'hideBookingButton' => $row['hideBookingButton'], 'lowContingent' => $row['lowContingent'], 'servicesIncluded' => unserialize($row['servicesIncluded']), 'hotel' => [ diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_product.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_product.php index 3851f7a4..f3c4766d 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_product.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_product.php @@ -28,7 +28,8 @@ return [ concept_description, board_description, additional_services, programme_description, ski_pass_description, rating_average, rating_votes_count, teaser_images, header_images, images, concept, country, region, city, journey, facts, officetip, hotels, calendar_hotel, faqs,header_title,header_subtitle, alt_product, alt_label, - video, banner, additional_regions, badge, daytrip, testimonials, external_link, path_segment', + video, banner, additional_regions, badge, daytrip, testimonials, external_link, path_segment, + hide_booking_button', ], 'types' => [ '1' => [ @@ -44,8 +45,8 @@ return [ ], 'palettes' => [ 'destinations' => ['showitem' => 'country,region,city'], - 'top' => ['showitem' => 'searchable, bookable, daytrip, important, skipass_included, detail_page, - external_link, path_segment'], + 'top' => ['showitem' => 'searchable, bookable, hide_booking_button, daytrip, important, skipass_included, + detail_page, external_link, path_segment'], 'name' => ['showitem' => 'name,code'], 'alternative' => ['showitem' => 'alt_product, alt_label'], 'header' => ['showitem' => 'headline,subline,--linebreak--,header_title,header_subtitle'], @@ -155,6 +156,13 @@ return [ 'type' => 'check', ], ], + 'hide_booking_button' => [ + 'exclude' => 0, + 'label' => 'Buchungsbutton verstecken', + 'config' => [ + 'type' => 'check', + ], + ], 'daytrip' => [ 'exclude' => 0, 'label' => 'tageweise buchbar', diff --git a/public/typo3conf/ext/ep_products/ext_tables.sql b/public/typo3conf/ext/ep_products/ext_tables.sql index 807e71db..3be2bec4 100644 --- a/public/typo3conf/ext/ep_products/ext_tables.sql +++ b/public/typo3conf/ext/ep_products/ext_tables.sql @@ -10,6 +10,7 @@ CREATE TABLE tx_epproducts_domain_model_product searchable tinyint(4) unsigned DEFAULT '1' NOT NULL, bookable tinyint(4) unsigned DEFAULT '1' NOT NULL, + hide_booking_button tinyint(4) unsigned DEFAULT '0' NOT NULL, daytrip tinyint(4) unsigned DEFAULT '0' NOT NULL, important tinyint(4) unsigned DEFAULT '0' NOT NULL, skipass_included tinyint(4) unsigned DEFAULT '1' NOT NULL, @@ -119,6 +120,7 @@ CREATE TABLE tx_epproducts_domain_model_date available int(11) DEFAULT '0' NOT NULL, product int(11) unsigned DEFAULT '0', daytrip tinyint(1) unsigned DEFAULT '0' NOT NULL, + hide_booking_button tinyint(1) unsigned DEFAULT '0' NOT NULL, important tinyint(1) unsigned DEFAULT '0' NOT NULL, product_name varchar(255) DEFAULT '' NOT NULL, product_subline varchar(255) DEFAULT '' NOT NULL, diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/DatesTable.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/DatesTable.vue index d5b660e9..41f9f21e 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/DatesTable.vue +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/DatesTable.vue @@ -36,7 +36,7 @@