From de3bbbe2f5410707c686954ef9ccf40ada57c205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Mon, 26 Oct 2026 07:57:56 +0100 Subject: [PATCH] feat: bring back the newsletter subscription plugin The "Newsletter-/RA-Registrierung" plugin (epproducts_newsletter_subscription) subscribes to the Mailjet lists through the MyE&P API and is still in use on the newsletter, travel alert and travel for groups pages; retiring it in 49b96df was a mistake. Controller and templates come back from a46918d, ported to TYPO3 13 (actions return responses). The DTO and the API client calls were still in place. The "newsletter" result message plugin (index action) is not part of this. Co-Authored-By: Claude Opus 5.5 --- .../Controller/NewsletterController.php | 79 +++++++++++++ .../TCA/Overrides/tt_content.php | 6 + packages/ep_products/ext_localconf.php | 12 ++ .../ContentElements/retired.typoscript | 3 +- .../Newsletter/SubscriptionForm.html | 104 ++++++++++++++++++ .../Newsletter/SubscriptionFormSubmit.html | 23 ++++ 6 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 packages/ep_products/Classes/Controller/NewsletterController.php create mode 100644 packages/ep_theme/Resources/Private/Templates/Newsletter/SubscriptionForm.html create mode 100644 packages/ep_theme/Resources/Private/Templates/Newsletter/SubscriptionFormSubmit.html diff --git a/packages/ep_products/Classes/Controller/NewsletterController.php b/packages/ep_products/Classes/Controller/NewsletterController.php new file mode 100644 index 0000000..fe6c439 --- /dev/null +++ b/packages/ep_products/Classes/Controller/NewsletterController.php @@ -0,0 +1,79 @@ +, dreipunktnull + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use EP\EpProducts\Domain\Model\Dto\NewsletterSubscriptionRequest; +use EP\EpProducts\MyEP\ApiClient; +use EP\EpProducts\MyEP\ApiException; +use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; + +class NewsletterController extends ActionController +{ + private ApiClient $apiClient; + + public function __construct(ApiClient $apiClient) + { + $this->apiClient = $apiClient; + } + + public function subscriptionFormAction(?NewsletterSubscriptionRequest $subscriptionRequest = null): ResponseInterface + { + if (null === $subscriptionRequest) { + $subscriptionRequest = new NewsletterSubscriptionRequest(); + } + + try { + $lists = $this->apiClient->getNewsletterLists(); + } catch (ApiException $e) { + $lists = []; + } + + $this->view->assign('subscriptionRequest', $subscriptionRequest); + $this->view->assign('lists', $lists); + + return $this->htmlResponse(); + } + + public function subscriptionFormSubmitAction(NewsletterSubscriptionRequest $subscriptionRequest): ResponseInterface + { + try { + $result = $this->apiClient->subscribeToNewsletters($subscriptionRequest); + $result['success'] = true; + } catch (ApiException $e) { + $result = [ + 'success' => false, + 'message' => $e->getMessage(), + ]; + } + + $this->view->assign('result', $result); + + return $this->htmlResponse(); + } +} diff --git a/packages/ep_products/Configuration/TCA/Overrides/tt_content.php b/packages/ep_products/Configuration/TCA/Overrides/tt_content.php index 86f9804..abadbc4 100644 --- a/packages/ep_products/Configuration/TCA/Overrides/tt_content.php +++ b/packages/ep_products/Configuration/TCA/Overrides/tt_content.php @@ -127,6 +127,12 @@ call_user_func(function () { 'FAQ' ); + ExtensionUtility::registerPlugin( + 'EpProducts', + 'newsletter_subscription', + 'Newsletter-/RA-Registrierung' + ); + ExtensionUtility::registerPlugin( 'EpProducts', 'maps', diff --git a/packages/ep_products/ext_localconf.php b/packages/ep_products/ext_localconf.php index 8f0b72f..b82bb8e 100644 --- a/packages/ep_products/ext_localconf.php +++ b/packages/ep_products/ext_localconf.php @@ -7,6 +7,7 @@ use EP\EpProducts\Controller\CountryController; use EP\EpProducts\Controller\FaqController; use EP\EpProducts\Controller\HotelController; use EP\EpProducts\Controller\MapController; +use EP\EpProducts\Controller\NewsletterController; use EP\EpProducts\Controller\PricetableController; use EP\EpProducts\Controller\RegionController; use EP\EpProducts\Controller\TeamController; @@ -174,6 +175,17 @@ $boot = function () { ] ); + ExtensionUtility::configurePlugin( + 'EpProducts', + 'newsletter_subscription', + [ + NewsletterController::class => 'subscriptionForm,subscriptionFormSubmit', + ], + [ + NewsletterController::class => 'subscriptionForm,subscriptionFormSubmit', + ] + ); + ExtensionUtility::configurePlugin( 'EpProducts', 'maps', diff --git a/packages/ep_theme/Configuration/TypoScript/ContentElements/retired.typoscript b/packages/ep_theme/Configuration/TypoScript/ContentElements/retired.typoscript index 1b99599..c3cf38e 100644 --- a/packages/ep_theme/Configuration/TypoScript/ContentElements/retired.typoscript +++ b/packages/ep_theme/Configuration/TypoScript/ContentElements/retired.typoscript @@ -1,7 +1,6 @@ -# Retired 2026-10-24 (newsletter form and subscription, reseller export, group price calculator, which +# Retired 2026-10-24 (newsletter form, reseller export, group price calculator, which # MyE&P replaced): the elements stay in the database and render nothing; the old code is in a46918d # should they come back tt_content.nlform = TEXT -tt_content.list.20.epproducts_newsletter_subscription = TEXT tt_content.list.20.epproducts_reseller = TEXT tt_content.list.20.epproducts_hotel_groups_price = TEXT diff --git a/packages/ep_theme/Resources/Private/Templates/Newsletter/SubscriptionForm.html b/packages/ep_theme/Resources/Private/Templates/Newsletter/SubscriptionForm.html new file mode 100644 index 0000000..c66150f --- /dev/null +++ b/packages/ep_theme/Resources/Private/Templates/Newsletter/SubscriptionForm.html @@ -0,0 +1,104 @@ + + + + + + +
+ +
+
+ + + +
+ + + + + + +
+ +
+
+
+ + + + + +

+ News & Angebote per Mail +

+
+ + + + + +

+ Benachrichtige mich bei Verfügbarkeit +

+
+
+
+
+ +
+ + + +
+
+
+
+ +
+
+
+
+
+ + + + + + + + + diff --git a/packages/ep_theme/Resources/Private/Templates/Newsletter/SubscriptionFormSubmit.html b/packages/ep_theme/Resources/Private/Templates/Newsletter/SubscriptionFormSubmit.html new file mode 100644 index 0000000..3e55f69 --- /dev/null +++ b/packages/ep_theme/Resources/Private/Templates/Newsletter/SubscriptionFormSubmit.html @@ -0,0 +1,23 @@ + + + + + +
+
+

+ Vielen Dank für dein Interesse +

+

+ Deine Anmeldung muss noch bestätigt werden. Bitte nutze den Link aus der Bestätigungs-E-Mail, die in + Kürze bei dir eintreffen sollte. +

+

+ Sieh am besten auch im Spam-Ordner nach. +

+
+
+
+ +