From 072230219c4117479dbaa521fb322feeafeddd40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 22 Nov 2023 12:31:47 +0100 Subject: [PATCH] feat: add json data for local business rating to all pages This commit leaves room for improvements since most of the values are hardcoded and json data is injected in a data processor. --- .../DataProcessing/ProductRatingProcessor.php | 38 +++++++++++++++++++ .../Resources/Private/Partials/Footer.html | 3 ++ 2 files changed, 41 insertions(+) diff --git a/public/typo3conf/ext/ep_theme/Classes/DataProcessing/ProductRatingProcessor.php b/public/typo3conf/ext/ep_theme/Classes/DataProcessing/ProductRatingProcessor.php index b356e940..7880a0db 100644 --- a/public/typo3conf/ext/ep_theme/Classes/DataProcessing/ProductRatingProcessor.php +++ b/public/typo3conf/ext/ep_theme/Classes/DataProcessing/ProductRatingProcessor.php @@ -38,9 +38,47 @@ class ProductRatingProcessor implements DataProcessorInterface $ratedCount = $result['ratedCount']; + $jsonData = [ + '@context' => 'https://schema.org', + '@type' => 'LocalBusiness', + 'name' => 'E&P Reisen und Events GmbH', + 'address' => [ + '@type' => 'PostalAddress', + 'streetAddress' => 'Aachener Str. 326-328', + 'postalCode' => '50933', + 'addressLocality' => 'Köln,Deutschland' + ], + 'telephone' => '00492212722760', + 'url' => 'https://www.ep-reisen.de/', + 'contactPoint' => [ + '@type' => 'ContactPoint', + 'telephone' => '+492212722760', + 'email' => 'info@ep-reisen.de', + 'contactType' => 'customer service', + 'areaServed' => 'DE', + 'availableLanguage' => 'German' + ], + 'logo' => 'https://www.ep-reisen.de/typo3conf/ext/ep_theme/Resources/Public/images/logo_wide.svg', + 'priceRange' => '€', + 'image' => 'https://www.ep-reisen.de/typo3conf/ext/ep_theme/Resources/Public/images/logo_wide.svg', + 'aggregateRating' => [ + '@type' => 'AggregateRating', + 'ratingValue' => number_format($totalAverage/$ratedCount, 2), + 'bestRating' => '5', + 'worstRating' => '1', + 'ratingCount' => $totalCount + ], + 'sameAs' => [ + 'https://www.facebook.com/ep.reisen.events', + 'https://www.instagram.com/ep_reisen/', + 'https://www.youtube.com/user/epreisende' + ] + ]; + $processedData['totalRatings'] = [ 'totalCount' => $totalCount, 'totalAverage' => $totalAverage/$ratedCount, + 'jsonData' => $jsonData, ]; return $processedData; diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Footer.html b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Footer.html index 765eb32a..236d4439 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Footer.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Footer.html @@ -187,4 +187,7 @@ {ep:icon(icon: 'chevron-up', class: 'w-8 h-8 text-white')} +