Link hotel detail page in event price tables

This commit is contained in:
Björn Fromme
2019-05-21 12:23:01 +02:00
parent e334081f1b
commit f94263bf5f
3 changed files with 23 additions and 4 deletions
@@ -359,10 +359,12 @@ 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',
'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)}">