fix: be more easy on ep_trk cookie and resellers

This commit is contained in:
Björn Fromme
2024-08-22 16:58:37 +02:00
parent 4367dc6dc4
commit 98c4aa7c4f
5 changed files with 19 additions and 38 deletions
@@ -127,9 +127,10 @@ class AjaxDateController extends ActionController
$altLabel = $product->getAltLabel();
}
}
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode'];
}
// Disabled, not working anyways, reseller subdomains are not registered since TYPO3 10.*
// if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
// $paCode = $reseller['paCode'];
// }
$datesTable = $this->dateService->getDatesTable([
'product' => $product,
'hotel' => $hotel,
@@ -281,11 +281,12 @@ class AjaxTableController extends ActionController
*/
public function pricetableHtmlAction(Product $product, Hotel $hotel, string $bpnBookingUrlTemplateCode = null): void
{
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode'];
} else {
$paCode = null;
}
// Disabled, not working anyways, reseller subdomains are not registered since TYPO3 10.*
// if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
// $paCode = $reseller['paCode'];
// } else {
// $paCode = null;
// }
$nonBookableInfo = $this->getNonBookableInfobox($product);
@@ -294,7 +295,7 @@ class AjaxTableController extends ActionController
'hotel' => $hotel,
'filterSettings' => $this->filterService->getNormalizedFilterSettings(),
'template' => $this->settings['bpnBookingUrlTemplateCode'],
'paCode' => $paCode,
'paCode' => GeneralUtility::_GET('pa'),
'sortByRoom' => true,
]);
$hasIncludedServices = $this->dateService->hasIncludedServices($priceTable);
@@ -35,7 +35,6 @@ class BookingUrlUtility
{
const COOKIE_NAME = 'ep_trk';
const URL_BASE = 'https://www.ep-reisen.de/buchung/maske_buchung.php';
public static function generateUrl(array $options): string
{
@@ -138,5 +137,6 @@ class BookingUrlUtility
$site = $siteFinder->getSiteByIdentifier('ep-reisen');
}
return $site->getBase() . '/buchung/maske_buchung.php?' . http_build_query($query); }
return $site->getBase() . '/buchung/maske_buchung.php?' . http_build_query($query);
}
}
@@ -6,7 +6,6 @@ class CookieUtility
{
const COOKIENAME_TRK = 'ep_trk';
const COOKIETTL_TRK = 30;
const COOKIENAME_BPN = 'bpn_cookie';
const PATTERN = '/^PA\d{3,4}$/';
/**
@@ -30,18 +29,6 @@ class CookieUtility
return $cookieValue;
}
/**
* @return string|null
*/
public static function getBpnCookie()
{
if (!isset($_COOKIE[static::COOKIENAME_BPN])) {
return null;
}
return $_COOKIE[static::COOKIENAME_BPN];
}
/**
* @param string $code
* @return string
@@ -29,7 +29,6 @@ namespace EP\EpTheme\DataProcessing;
use EP\EpProducts\Service\ResellerDataService;
use EP\EpProducts\Traits\DbConnectionTrait;
use EP\EpProducts\Utility\CookieUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
@@ -65,15 +64,11 @@ class ContextProcessor implements DataProcessorInterface
}
if ($data['tx_eptheme_context_pacode']) {
$processedData['context']['paCode'] = $data['tx_eptheme_context_pacode'];
} else {
$resellerData = $this->getResellerData();
if ($resellerData) {
$processedData['context']['paCode'] = $resellerData['paCode'];
} elseif ($paCode = $this->getPaCodeFromRequest()) {
$processedData['context']['paCode'] = $paCode;
} elseif ($cookieData = CookieUtility::getPaCookie()) {
$processedData['context']['paCode'] = $cookieData;
}
// Disabled, not working anyways, reseller subdomains are not registered since TYPO3 10.*
// } elseif ($resellerData = $this->getResellerData()) {
// $processedData['context']['paCode'] = $resellerData['paCode'];
} elseif ($paCode = $this->getPaCodeFromRequest()) {
$processedData['context']['paCode'] = $paCode;
}
return $processedData;
@@ -107,10 +102,7 @@ class ContextProcessor implements DataProcessorInterface
parse_str($query, $items);
if (array_key_exists('pa', $items)) {
$paCode = $items['pa'];
CookieUtility::setPaCookie($paCode);
return $paCode;
return $items['pa'];
}
return '';