Implement day trip option for products

This commit is contained in:
Björn Fromme
2018-08-07 17:42:04 +02:00
parent 464111b5e0
commit 07b0ad3102
13 changed files with 288 additions and 118 deletions
+3 -1
View File
@@ -8,6 +8,7 @@
"type": "project", "type": "project",
"require": { "require": {
"php": "^5.6", "php": "^5.6",
"ext-json": "*",
"typo3/cms": "^7.6", "typo3/cms": "^7.6",
"georgringer/news": "^6.1", "georgringer/news": "^6.1",
"dmitryd/typo3-realurl": "^2.3", "dmitryd/typo3-realurl": "^2.3",
@@ -65,7 +66,8 @@
"yohang/calendr": "^2.1", "yohang/calendr": "^2.1",
"wyrihaximus/html-compress": "^1.4", "wyrihaximus/html-compress": "^1.4",
"symfony/serializer": "3.3.*", "symfony/serializer": "3.3.*",
"symfony/property-access": "^3.4" "symfony/property-access": "^3.4",
"symfony/options-resolver": "^3.4"
}, },
"scripts": { "scripts": {
"typo3-cms-scripts": [ "typo3-cms-scripts": [
Generated
+6 -6
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "218f290216c085ca0d43c4cb1fde6c13", "content-hash": "24a1dae8a5e81d4d36f7e5988eaace7a",
"packages": [ "packages": [
{ {
"name": "cogpowered/finediff", "name": "cogpowered/finediff",
@@ -1918,16 +1918,16 @@
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v3.4.13", "version": "v3.4.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
"reference": "638f5ad40a6400d78568187522731e5643eed60a" "reference": "6debc476953a45969ab39afe8dee0b825f356dc7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/638f5ad40a6400d78568187522731e5643eed60a", "url": "https://api.github.com/repos/symfony/options-resolver/zipball/6debc476953a45969ab39afe8dee0b825f356dc7",
"reference": "638f5ad40a6400d78568187522731e5643eed60a", "reference": "6debc476953a45969ab39afe8dee0b825f356dc7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1968,7 +1968,7 @@
"configuration", "configuration",
"options" "options"
], ],
"time": "2018-07-07T15:09:44+00:00" "time": "2018-07-26T08:45:46+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
@@ -108,12 +108,18 @@ class AjaxDateController extends ActionController
; ;
$altLabel = $product->getAltLabel(); $altLabel = $product->getAltLabel();
} }
$template = $this->settings['bpnBookingUrlTemplateCode'];
$paCode = null;
if ($reseller = $this->resellerService->getResellerForCurrentDomain()) { if ($reseller = $this->resellerService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode']; $paCode = $reseller['paCode'];
} else {
$paCode = null;
} }
$datesTable = $this->dateService->getDatesTable($product, $hotel, $filterSettings, $template, $paCode); $datesTable = $this->dateService->getDatesTable([
'product' => $product,
'hotel' => $hotel,
'filterSettings' => $filterSettings,
'template' => $this->settings['bpnBookingUrlTemplateCode'],
'paCode' => $paCode,
]);
return json_encode([ return json_encode([
'dates' => $datesTable, 'dates' => $datesTable,
'bookable' => $product->getBookable(), 'bookable' => $product->getBookable(),
@@ -91,12 +91,19 @@ class AjaxTableController extends ActionController
$forcedConceptUid = (int) $this->settings['forcedConceptUid']; $forcedConceptUid = (int) $this->settings['forcedConceptUid'];
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid, false); $filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid, false);
} }
$paCode = null;
if ($reseller = $this->resellerService->getResellerForCurrentDomain()) { if ($reseller = $this->resellerService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode']; $paCode = $reseller['paCode'];
} else {
$paCode = null;
} }
$template = $this->settings['bpnBookingUrlTemplateCode']; $priceTable = $this->dateService->getPriceTable([
$priceTable = $this->dateService->getPriceTable($product, $hotel, $filterSettings, $date, $template, $paCode); 'product' => $product,
'hotel' => $hotel,
'filterSettings' => $filterSettings,
'date' => $date,
'template' => $this->settings['bpnBookingUrlTemplateCode'],
'paCode' => $paCode,
]);
return json_encode([ return json_encode([
'dateStart' => $date ? $date->getDateStart()->format('Y-m-d') : '', 'dateStart' => $date ? $date->getDateStart()->format('Y-m-d') : '',
'dateEnd' => $date ? $date->getDateEnd()->format('Y-m-d') : '', 'dateEnd' => $date ? $date->getDateEnd()->format('Y-m-d') : '',
@@ -111,13 +118,18 @@ class AjaxTableController extends ActionController
*/ */
public function pricetableHtmlAction(Product $product, Hotel $hotel) public function pricetableHtmlAction(Product $product, Hotel $hotel)
{ {
$filterSettings = $this->filterService->getDefaultFilterSettings();
$paCode = null;
if ($reseller = $this->resellerService->getResellerForCurrentDomain()) { if ($reseller = $this->resellerService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode']; $paCode = $reseller['paCode'];
} else {
$paCode = null;
} }
$template = $this->settings['bpnBookingUrlTemplateCode']; $pricetable = $this->dateService->getPriceTable([
$pricetable = $this->dateService->getPriceTable($product, $hotel, $filterSettings, null, $template, $paCode); 'product' => $product,
'hotel' => $hotel,
'filterSettings' => $this->filterService->getDefaultFilterSettings(),
'template' => $this->settings['bpnBookingUrlTemplateCode'],
'paCode' => $paCode,
]);
$this->view->assign('pricetable', $pricetable); $this->view->assign('pricetable', $pricetable);
} }
@@ -175,8 +175,11 @@ class ProductController extends ActionController
$hotelUid = $this->settings['hotelUid']; $hotelUid = $this->settings['hotelUid'];
/** @var \EP\EpProducts\Domain\Model\Hotel $hotel */ /** @var \EP\EpProducts\Domain\Model\Hotel $hotel */
$hotel = $this->hotelRepository->findByIdentifier($hotelUid); $hotel = $this->hotelRepository->findByIdentifier($hotelUid);
$filterSettings = $this->filterService->getDefaultFilterSettings(); $pricetable = $this->dateService->getPriceTable([
$pricetable = $this->dateService->getPriceTable($product, $hotel, $filterSettings); 'product' => $product,
'hotel' => $hotel,
'filterSettings' => $this->filterService->getDefaultFilterSettings(),
]);
$this->view->assign('pricetable', $pricetable); $this->view->assign('pricetable', $pricetable);
} }
@@ -40,6 +40,11 @@ class Product extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements
*/ */
protected $bookable = true; protected $bookable = true;
/**
* @var bool
*/
protected $daytrip = false;
/** /**
* @var int * @var int
*/ */
@@ -286,6 +291,22 @@ class Product extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements
$this->bookable = (bool) $bookable; $this->bookable = (bool) $bookable;
} }
/**
* @return bool
*/
public function isDaytrip()
{
return $this->daytrip;
}
/**
* @param bool $daytrip
*/
public function setDaytrip($daytrip)
{
$this->daytrip = $daytrip;
}
/** /**
* @return int * @return int
*/ */
@@ -33,6 +33,7 @@ use EP\EpProducts\Domain\Model\Product;
use EP\EpProducts\Domain\Repository\DateRepository; use EP\EpProducts\Domain\Repository\DateRepository;
use EP\EpProducts\Domain\Repository\ProductRepository; use EP\EpProducts\Domain\Repository\ProductRepository;
use EP\EpProducts\Utility\BookingUrlUtility; use EP\EpProducts\Utility\BookingUrlUtility;
use Symfony\Component\OptionsResolver\OptionsResolver;
use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\SingletonInterface;
class DateService implements SingletonInterface class DateService implements SingletonInterface
@@ -57,7 +58,12 @@ class DateService implements SingletonInterface
* @param DateRepository $dateRepository * @param DateRepository $dateRepository
* @param FilterService $filterService * @param FilterService $filterService
*/ */
public function __construct(ProductRepository $productRepository, DateRepository $dateRepository, FilterService $filterService) public function __construct
(
ProductRepository $productRepository,
DateRepository $dateRepository,
FilterService $filterService
)
{ {
$this->productRepository = $productRepository; $this->productRepository = $productRepository;
$this->filterService = $filterService; $this->filterService = $filterService;
@@ -65,55 +71,93 @@ class DateService implements SingletonInterface
} }
/** /**
* @param Product $product * @param array $options
* @param Hotel $hotel
* @param FilterSettings|null $filterSettings
* @param Date|null $date
* @param string $template
* @param string $paCode
*
* @return array * @return array
*/ */
public function getPriceTable public function getPriceTable(array $options)
(
Product $product,
Hotel $hotel,
FilterSettings $filterSettings = null,
Date $date = null,
$template = 'base',
$paCode = null
)
{ {
$resolver = new OptionsResolver();
$this->configurePriceTableOptions($resolver);
$resolvedOptions = $resolver->resolve($options);
/** @var Product $product */
$product = $resolvedOptions['product'];
$hotel = $resolvedOptions['hotel'];
$filterSettings = $resolvedOptions['filterSettings'];
$date = $resolvedOptions['date'];
$template = $resolvedOptions['template'];
$paCode = $resolvedOptions['paCode'];
if ($filterSettings === null) { if ($filterSettings === null) {
$filterSettings = $this->filterService->getDefaultFilterSettings(); $filterSettings = $this->filterService->getDefaultFilterSettings();
} }
$priceTableData = $this->productRepository->getPricetable($product, $hotel, $filterSettings, $date);
return $this->preprocessPriceTable($priceTableData, $template, $paCode); return $this->preprocessPriceTable([
'priceTableData' => $this->productRepository->getPricetable($product, $hotel, $filterSettings, $date),
'template' => $template,
'paCode' => $paCode,
'isDayTrip' => $product->isDaytrip(),
]);
} }
/** /**
* @param Product $product * @param OptionsResolver $resolver
* @param Hotel $hotel */
* @param FilterSettings|null $filterSettings protected function configurePriceTableOptions(OptionsResolver $resolver)
* @param string $template {
* @param string $paCode $resolver->setRequired(['product', 'hotel']);
* $resolver->setDefaults([
'filterSettings' => null,
'date' => null,
'template' => 'base',
'paCode' => null,
]);
$resolver->setAllowedTypes('product', Product::class);
$resolver->setAllowedTypes('hotel', Hotel::class);
$resolver->setAllowedTypes('date', Date::class);
}
/**
* @param array $options
* @return array * @return array
*/ */
public function getDatesTable public function getDatesTable(array $options)
(
Product $product,
Hotel $hotel,
FilterSettings $filterSettings = null,
$template = 'base',
$paCode = null
)
{ {
$resolver = new OptionsResolver();
$this->configureDatesTableOptions($resolver);
$resolvedOptions = $resolver->resolve($options);
/** @var Product $product */
$product = $resolvedOptions['product'];
$hotel = $resolvedOptions['hotel'];
$filterSettings = $resolvedOptions['filterSettings'];
$template = $resolvedOptions['template'];
$paCode = $resolvedOptions['paCode'];
if ($filterSettings === null) { if ($filterSettings === null) {
$filterSettings = $this->filterService->getDefaultFilterSettings(); $filterSettings = $this->filterService->getDefaultFilterSettings();
} }
$dateTableData = $this->productRepository->getAvailableDates($product, $hotel, $filterSettings); return $this->preprocessDateTable([
return $this->preprocessDateTable($dateTableData, $template, $paCode); 'dateTableData' => $this->productRepository->getAvailableDates($product, $hotel, $filterSettings),
'template' => $template,
'paCode' => $paCode,
'isDayTrip' => $product->isDaytrip(),
]);
}
/**
* @param OptionsResolver $resolver
*/
protected function configureDatesTableOptions(OptionsResolver $resolver)
{
$resolver->setRequired(['product', 'hotel']);
$resolver->setDefaults([
'filterSettings' => null,
'template' => 'base',
'paCode' => null,
]);
$resolver->setAllowedTypes('product', Product::class);
$resolver->setAllowedTypes('hotel', Hotel::class);
} }
/** /**
@@ -124,8 +168,13 @@ class DateService implements SingletonInterface
*/ */
public function getEventPriceTable(Product $product, $maxPax = 99, $template = 'base') public function getEventPriceTable(Product $product, $maxPax = 99, $template = 'base')
{ {
$priceTableData = $this->productRepository->getEventPriceTable($product); $priceTableData = $this->productRepository->getEventPriceTable($product);
return $this->preprocessEventPriceTable($priceTableData, $maxPax, $template); return $this->preprocessEventPriceTable([
'priceTableData' => $priceTableData,
'maxPax' => $maxPax,
'template' => $template,
]);
} }
/** /**
@@ -189,27 +238,37 @@ class DateService implements SingletonInterface
} }
/** /**
* @param array $priceTableData * @param array $options
* @param string $template
* @param string $paCode
*
* @return array * @return array
*/ */
public function preprocessPriceTable(array $priceTableData, $template, $paCode = null) public function preprocessPriceTable(array $options)
{ {
$resolver = new OptionsResolver();
$resolver->setRequired(['priceTableData', 'template']);
$resolver->setDefaults([
'paCode' => null,
'isDayTrip' => false,
]);
$resolvedOptions = $resolver->resolve($options);
$priceTable = []; $priceTable = [];
$priceTableData = $resolvedOptions['priceTableData'];
$template = $resolvedOptions['template'];
$paCode = $resolvedOptions['paCode'];
$isDayTrip = $resolvedOptions['isDayTrip'];
foreach ($priceTableData as $row) foreach ($priceTableData as $row)
{ {
$dateStart = new \DateTime($row['dateStart']); $dateStart = new \DateTime($row['dateStart']);
$dateEnd = new \DateTime($row['dateEnd']); $dateEnd = new \DateTime($row['dateEnd']);
$bookingUrl = BookingUrlUtility::generateUrl( $bookingUrl = BookingUrlUtility::generateUrl([
$row['dateBusProId'], 'bookingId' => $row['dateBusProId'],
$row['hotelBusProId'], 'hotelId' => $row['hotelBusProId'],
$row['dateEnd'], 'dateEnd' => $row['dateEnd'],
$template, 'template' => $template,
$paCode 'paCode' => $paCode,
); 'isDayTrip' => $isDayTrip,
]);
$priceTable[] = [ $priceTable[] = [
'dateStart' => $dateStart->format('d.m.Y'), 'dateStart' => $dateStart->format('d.m.Y'),
'dateEnd' => $dateEnd->format('d.m.Y'), 'dateEnd' => $dateEnd->format('d.m.Y'),
@@ -234,26 +293,38 @@ class DateService implements SingletonInterface
} }
/** /**
* @param array $dateTableData * @param array $options
* @param string $template
* @param string $paCode
*
* @return array * @return array
*/ */
public function preprocessDateTable(array $dateTableData, $template, $paCode = null) public function preprocessDateTable(array $options)
{ {
$resolver = new OptionsResolver();
$resolver->setRequired(['dateTableData', 'template']);
$resolver->setDefaults([
'paCode' => null,
'isDayTrip' => false,
]);
$resolvedOptions = $resolver->resolve($options);
$dateTable = []; $dateTable = [];
$dateTableData = $resolvedOptions['dateTableData'];
$template = $resolvedOptions['template'];
$paCode = $resolvedOptions['paCode'];
$isDayTrip = $resolvedOptions['isDayTrip'];
foreach ($dateTableData as $row) foreach ($dateTableData as $row)
{ {
$dateStart = new \DateTime($row['dateStart']); $dateStart = new \DateTime($row['dateStart']);
$dateEnd = new \DateTime($row['dateEnd']); $dateEnd = new \DateTime($row['dateEnd']);
$bookingUrl = BookingUrlUtility::generateUrl( $bookingUrl = BookingUrlUtility::generateUrl([
$row['dateBusProId'], 'bookingId' => $row['dateBusProId'],
$row['hotelBusProId'], 'hotelId' =>$row['hotelBusProId'],
$row['dateEnd'], 'dateEnd' => $row['dateEnd'],
$template, 'template' => $template,
$paCode 'paCode' => $paCode,
); 'isDayTrip' => $isDayTrip,
]);
$dateTable[] = [ $dateTable[] = [
'dateUid' => $row['dateUid'], 'dateUid' => $row['dateUid'],
'dateStart' => $dateStart->format('d.m.y'), 'dateStart' => $dateStart->format('d.m.y'),
@@ -275,15 +346,25 @@ class DateService implements SingletonInterface
} }
/** /**
* @param array $priceTableData * @param array $options
* @param int $maxPax
* @param string $template
* @param string $paCode
*
* @return array * @return array
*/ */
public function preprocessEventPriceTable(array $priceTableData, $maxPax = 99, $template = 'base', $paCode = null) public function preprocessEventPriceTable(array $options)
{ {
$resolver = new OptionsResolver();
$resolver->setRequired(['priceTableData']);
$resolver->setDefaults([
'maxPax' => 99,
'template' => 'base',
'paCode' => null,
]);
$resolvedOptions = $resolver->resolve($options);
$priceTableData = $resolvedOptions['priceTableData'];
$maxPax = $resolvedOptions['maxPax'];
$template = $resolvedOptions['template'];
$paCode = $resolvedOptions['paCode'];
$priceTable = [ $priceTable = [
Hotel::CATEGORY_STANDARD => [], Hotel::CATEGORY_STANDARD => [],
Hotel::CATEGORY_COMFORT => [], Hotel::CATEGORY_COMFORT => [],
@@ -300,13 +381,13 @@ class DateService implements SingletonInterface
'category' => $categoryUid, 'category' => $categoryUid,
'hotelName' => $row['hotelName'], 'hotelName' => $row['hotelName'],
'hotelTitle' => $row['hotelTitle'], 'hotelTitle' => $row['hotelTitle'],
'bookingUrl' => BookingUrlUtility::generateUrl( 'bookingUrl' => BookingUrlUtility::generateUrl([
$row['dateBusProId'], 'bookingId' => $row['dateBusProId'],
$row['hotelBusProId'], 'hotelId' => $row['hotelBusProId'],
$row['dateEnd'], 'dateEnd' => $row['dateEnd'],
$template, 'template' => $template,
$paCode 'paCode' => $paCode,
), ]),
'rooms' => [], 'rooms' => [],
]; ];
} }
@@ -111,12 +111,12 @@ class ResellerService implements SingletonInterface
$data[$row['dateStart']] = $date; $data[$row['dateStart']] = $date;
} }
$date->bookingurl = BookingUrlUtility::generateResellerUrl( $date->bookingurl = BookingUrlUtility::generateResellerUrl([
$row['dateBusProId'], 'bookingId' => $row['dateBusProId'],
$row['hotelBusProId'], 'hotelId' => $row['hotelBusProId'],
$row['dateEnd'], 'dateEnd' => $row['dateEnd'],
$paCode 'paCode' => $paCode,
); ]);
$date->rooms['room'][] = Room::fromArray($row); $date->rooms['room'][] = Room::fromArray($row);
} }
@@ -2,8 +2,6 @@
namespace EP\EpProducts\Utility; namespace EP\EpProducts\Utility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/*************************************************************** /***************************************************************
* *
* Copyright notice * Copyright notice
@@ -29,6 +27,9 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
use Symfony\Component\OptionsResolver\OptionsResolver;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class BookingUrlUtility class BookingUrlUtility
{ {
@@ -37,16 +38,29 @@ class BookingUrlUtility
const URL_BASE = 'https://bpn.ep-reisen.de/buspronet/maske_buchung.php'; const URL_BASE = 'https://bpn.ep-reisen.de/buspronet/maske_buchung.php';
/** /**
* @param int $bookingId * @param array $options
* @param int $hotelId
* @param string $dateEnd
* @param string $template
* @param string $paCode
* @return string * @return string
*/ */
public static function generateUrl($bookingId, $hotelId, $dateEnd, $template = 'base', $paCode = null) public static function generateUrl(array $options)
{ {
$query = static::buildQuery($bookingId, $hotelId, $dateEnd, $template); $resolver = new OptionsResolver();
$resolver->setRequired(['bookingId', 'hotelId', 'dateEnd']);
$resolver->setDefaults([
'template' => 'base',
'paCode' => null,
'isDayTrip' => false,
]);
$resolvedOptions = $resolver->resolve($options);
$bookingId = $resolvedOptions['bookingId'];
$hotelId = $resolvedOptions['hotelId'];
$dateEnd = $resolvedOptions['dateEnd'];
$template = $resolvedOptions['template'];
$paCode = $resolvedOptions['paCode'];
$isDayTrip = $resolvedOptions['isDayTrip'];
$query = static::buildQuery($bookingId, $hotelId, $dateEnd, $template, $isDayTrip);
$cookie = $_COOKIE[static::COOKIE_NAME]; $cookie = $_COOKIE[static::COOKIE_NAME];
if (strpos($cookie, '?') !== false) { if (strpos($cookie, '?') !== false) {
@@ -71,15 +85,29 @@ class BookingUrlUtility
} }
/** /**
* @param string $bookingId * @param array $options
* @param string $hotelId
* @param string $dateEnd
* @param string $paCode
* @return string * @return string
*/ */
public static function generateResellerUrl($bookingId, $hotelId, $dateEnd, $paCode = null) public static function generateResellerUrl(array $options)
{ {
$query = static::buildQuery($bookingId, $hotelId, $dateEnd); $resolver = new OptionsResolver();
$resolver->setRequired(['bookingId', 'hotelId', 'dateEnd']);
$resolver->setDefaults([
'template' => 'base',
'paCode' => null,
'isDayTrip' => false,
]);
$resolvedOptions = $resolver->resolve($options);
$bookingId = $resolvedOptions['bookingId'];
$hotelId = $resolvedOptions['hotelId'];
$dateEnd = $resolvedOptions['dateEnd'];
$template = $resolvedOptions['template'];
$paCode = $resolvedOptions['paCode'];
$isDayTrip = $resolvedOptions['isDayTrip'];
$query = static::buildQuery($bookingId, $hotelId, $dateEnd, $template, $isDayTrip);
if ($paCode !== null) { if ($paCode !== null) {
$query['agenturcode'] = $paCode; $query['agenturcode'] = $paCode;
@@ -93,16 +121,17 @@ class BookingUrlUtility
* @param string $hotelId * @param string $hotelId
* @param string $dateEnd * @param string $dateEnd
* @param string $template * @param string $template
* @param bool $isDayTrip
* @return array * @return array
*/ */
protected static function buildQuery($bookingId, $hotelId, $dateEnd, $template = 'base') protected static function buildQuery($bookingId, $hotelId, $dateEnd, $template = 'base', $isDayTrip = false)
{ {
$query = [ $query = [
'id' => $bookingId, 'id' => $bookingId,
'hotelid' => $hotelId, 'hotelid' => $hotelId,
]; ];
if ($dateEnd) { if ($dateEnd && !$isDayTrip) {
$query['ruecktermin'] = date('d.m.Y', strtotime($dateEnd)); $query['ruecktermin'] = date('d.m.Y', strtotime($dateEnd));
} }
@@ -30,7 +30,7 @@ return [
concept_description, board_description, additional_services, programme_description, ski_pass_description, 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, 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, journey, facts, officetip, hotels, calendar_hotel, faqs,header_title,header_subtitle, alt_product, alt_label,
video, banner, additional_regions,badge', video, banner, additional_regions, badge, daytrip',
], ],
'types' => [ 'types' => [
'1' => [ '1' => [
@@ -69,7 +69,7 @@ return [
], ],
'palettes' => [ 'palettes' => [
'destinations' => ['showitem' => 'country,region,city'], 'destinations' => ['showitem' => 'country,region,city'],
'top' => ['showitem' => 'searchable, bookable, detail_page'], 'top' => ['showitem' => 'searchable, bookable, daytrip, detail_page'],
'name' => ['showitem' => 'name,code'], 'name' => ['showitem' => 'name,code'],
'alternative' => ['showitem' => 'alt_product, alt_label'], 'alternative' => ['showitem' => 'alt_product, alt_label'],
'header' => ['showitem' => 'headline,subline,--linebreak--,header_title,header_subtitle'], 'header' => ['showitem' => 'headline,subline,--linebreak--,header_title,header_subtitle'],
@@ -175,6 +175,13 @@ return [
'type' => 'check', 'type' => 'check',
], ],
], ],
'daytrip' => [
'exclude' => 0,
'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_product.daytrip',
'config' => [
'type' => 'check',
],
],
'detail_page' => [ 'detail_page' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_product.detail_page', 'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_product.detail_page',
@@ -18,6 +18,9 @@
<trans-unit id="tx_epproducts_domain_model_product.bookable"> <trans-unit id="tx_epproducts_domain_model_product.bookable">
<source>Online buchbar</source> <source>Online buchbar</source>
</trans-unit> </trans-unit>
<trans-unit id="tx_epproducts_domain_model_product.daytrip">
<source>Tagesreise</source>
</trans-unit>
<trans-unit id="tx_epproducts_domain_model_product.name"> <trans-unit id="tx_epproducts_domain_model_product.name">
<source>Name</source> <source>Name</source>
</trans-unit> </trans-unit>
@@ -9,6 +9,7 @@ CREATE TABLE tx_epproducts_domain_model_product (
searchable tinyint(4) unsigned DEFAULT '1' NOT NULL, searchable tinyint(4) unsigned DEFAULT '1' NOT NULL,
bookable tinyint(4) unsigned DEFAULT '1' NOT NULL, bookable tinyint(4) unsigned DEFAULT '1' NOT NULL,
daytrip tinyint(4) unsigned DEFAULT '0' NOT NULL,
name varchar(255) DEFAULT '' NOT NULL, name varchar(255) DEFAULT '' NOT NULL,
name_internal varchar(255) DEFAULT '' NOT NULL, name_internal varchar(255) DEFAULT '' NOT NULL,
subline varchar(255) DEFAULT '' NOT NULL, subline varchar(255) DEFAULT '' NOT NULL,
@@ -67,6 +67,11 @@ class BookingViewHelper extends AbstractViewHelper
if ($template === null) { if ($template === null) {
$template = $this->settings['bpnBookingUrlTemplateCode']; $template = $this->settings['bpnBookingUrlTemplateCode'];
} }
return BookingUrlUtility::generateUrl($bookingId, $hotelId, $template); $options = [
'bookingId' => $bookingId,
'hotelId' => $hotelId,
'template' => $template,
];
return BookingUrlUtility::generateUrl($options);
} }
} }