Link hotel detail page in event price tables

This commit is contained in:
Björn Fromme
2019-06-06 17:41:19 +02:00
parent acafa32c05
commit 07504a9038
3 changed files with 24 additions and 4 deletions
@@ -359,10 +359,13 @@ class ProductRepository extends AbstractRepository
'date.bus_pro_id as dateBusProId', 'date.hotel_bus_pro_id as hotelBusProId', 'date.date_end as dateEnd',
'date.hotel as hotelUid', 'date.hotel_name as hotelName', 'date.hotel_header_title as hotelTitle',
'date.hotel_category as hotelCategory',
'room.pax as roomPax', 'room.price as roomPrice', 'room.available as available'
'room.pax as roomPax', 'room.price as roomPrice', 'room.available as available',
'room.pax as roomPax', 'room.price as roomPrice', 'room.available as available',
'hotel.detail_page as hotelDetailPageUid'
)
->from('tx_epproducts_domain_model_date', 'date')
->innerJoin('date', 'tx_epproducts_domain_model_room', 'room', 'room.date = date.uid')
->innerJoin('date', 'tx_epproducts_domain_model_hotel', 'hotel', 'hotel.uid = date.hotel')
->where('date.product = :productUid')
->setParameter('productUid', $product->getUid())
;
@@ -35,6 +35,7 @@ use EP\EpProducts\Domain\Repository\ProductRepository;
use EP\EpProducts\Utility\BookingUrlUtility;
use Symfony\Component\OptionsResolver\OptionsResolver;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
class DateService implements SingletonInterface
{
@@ -53,21 +54,29 @@ class DateService implements SingletonInterface
*/
protected $dateRepository;
/**
* @var UriBuilder
*/
protected $uriBuilder;
/**
* @param ProductRepository $productRepository
* @param DateRepository $dateRepository
* @param FilterService $filterService
* @param UriBuilder $uriBuilder
*/
public function __construct
(
ProductRepository $productRepository,
DateRepository $dateRepository,
FilterService $filterService
FilterService $filterService,
UriBuilder $uriBuilder
)
{
$this->productRepository = $productRepository;
$this->filterService = $filterService;
$this->dateRepository = $dateRepository;
$this->uriBuilder = $uriBuilder;
}
/**
@@ -378,11 +387,17 @@ class DateService implements SingletonInterface
{
$categoryUid = $row['hotelCategory'];
$hotelUid = $row['hotelUid'];
$hotelUri = $this->uriBuilder
->reset()
->setTargetPageUid($row['hotelDetailPageUid'])
->buildFrontendUri();
if (!array_key_exists($hotelUid, $priceTable[$categoryUid])) {
$priceTable[$categoryUid][$hotelUid] = [
'category' => $categoryUid,
'hotelName' => $row['hotelName'],
'hotelTitle' => $row['hotelTitle'],
'hotelUri' => $hotelUri,
'bookingUrl' => BookingUrlUtility::generateUrl([
'bookingId' => $row['dateBusProId'],
'hotelId' => $row['hotelBusProId'],
@@ -21,8 +21,10 @@
</tr>
<f:for each="{v:variable.get(name: 'pricetable.{categoryKey}', useRawKeys: 1)}" as="row">
<tr>
<td><a class="booking-link" href="{row.bookingUrl}"
title="Jetzt buchen" target="_blank">{row.hotelTitle -> v:or(alternative: row.hotelName)}</a></td>
<td><a class="booking-link" href="{row.hotelUri}"
title="Infos zu {row.hotelTitle -> v:or(alternative: row.hotelName)}">
{row.hotelTitle -> v:or(alternative: row.hotelName)}
</a></td>
<f:for each="{roomTypesPax}" as="type">
<td>
<f:if condition="{v:variable.get(name: 'row.rooms.{type}.available', useRawKeys: 1)}">