From 9fc490fabf4efce91aff00d7511bb5deda77ad77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 5 Aug 2026 15:00:27 +0200 Subject: [PATCH] fix: use currency value provided by api response for the calendar --- .../Classes/Controller/AjaxCalendarController.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxCalendarController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxCalendarController.php index 6d824308..fef00ac9 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxCalendarController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxCalendarController.php @@ -111,6 +111,7 @@ class AjaxCalendarController extends ActionController 'pricePerNight' => $item['pricePerNight'] ?? null, 'defaultPricePerNight' => $item['defaultPricePerNight'] ?? null, 'type' => $item['type'] ?? null, + 'currency' => $item['currency'] ?? null, 'includedPax' => $item['includedPax'] ?? null, 'minNights' => (int)($item['minNights'] ?? 0), ]; @@ -253,11 +254,12 @@ class AjaxCalendarController extends ActionController private function buildPriceTooltip(array $item): string { $price = $item['pricePerNight'] ?? null; + $currency = $this->getCurrencySymbol($item['currency'] ?? null); if ($price !== null) { $priceStr = (($item['type'] ?? null) === 'discount') - ? $price . ' € (Angebot)' - : 'ab ' . $price . ' €'; + ? $price . ' ' . $currency + : 'ab ' . $price . ' ' . $currency; } else { $priceStr = 'Anfrage'; } @@ -269,6 +271,15 @@ class AjaxCalendarController extends ActionController : $priceStr; } + private function getCurrencySymbol(?string $currency): string + { + if (null === $currency || '' === $currency) { + return '€'; + } + + return 'EUR' === $currency ? '€' : $currency; + } + /** * @return array> */