Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Add schema.org EventReservation to ticket email

Dave Earley13d39ae291cf
diff --git a/backend/app/DomainObjects/EventSettingDomainObject.php b/backend/app/DomainObjects/EventSettingDomainObject.php
index 46dc2fefd..d92eb69b6 100644
--- a/backend/app/DomainObjects/EventSettingDomainObject.php
+++ b/backend/app/DomainObjects/EventSettingDomainObject.php
@@ -2,6 +2,8 @@
namespace HiEvents\DomainObjects;
+use HiEvents\DataTransferObjects\AddressDTO;
+
class EventSettingDomainObject extends Generated\EventSettingDomainObjectAbstract
{
/**
@@ -43,4 +45,17 @@ HTML;
return implode(', ', $filteredAddressParts);
}
+
+ public function getAddress(): AddressDTO
+ {
+ return new AddressDTO(
+ venue_name: $this->getLocationDetails()['venue_name'] ?? null,
+ address_line_1: $this->getLocationDetails()['address_line_1'] ?? null,
+ address_line_2: $this->getLocationDetails()['address_line_2'] ?? null,
+ city: $this->getLocationDetails()['city'] ?? null,
+ state_or_region: $this->getLocationDetails()['state_or_region'] ?? null,
+ zip_or_postal_code: $this->getLocationDetails()['zip_or_postal_code'] ?? null,
+ country: $this->getLocationDetails()['country'] ?? null,
+ );
+ }
}
diff --git a/backend/app/Mail/Attendee/AttendeeTicketMail.php b/backend/app/Mail/Attendee/AttendeeTicketMail.php
index 03e357569..722d91ac8 100644
--- a/backend/app/Mail/Attendee/AttendeeTicketMail.php
+++ b/backend/app/Mail/Attendee/AttendeeTicketMail.php
@@ -50,6 +50,7 @@ class AttendeeTicketMail extends BaseMail
'event' => $this->event,
'attendee' => $this->attendee,
'eventSettings' => $this->eventSettings,
+ 'organizer' => $this->organizer,
'ticketUrl' => sprintf(
Url::getFrontEndUrlFromConfig(Url::ATTENDEE_TICKET),
$this->event->getId(),
diff --git a/backend/resources/views/emails/orders/attendee-ticket.blade.php b/backend/resources/views/emails/orders/attendee-ticket.blade.php
index 1579bf827..0006dcdb2 100644
--- a/backend/resources/views/emails/orders/attendee-ticket.blade.php
+++ b/backend/resources/views/emails/orders/attendee-ticket.blade.php
@@ -1,7 +1,9 @@
+@php use HiEvents\Helper\DateHelper; @endphp
@php /** @uses /backend/app/Mail/OrderSummary.php */ @endphp
-@php /** @var \HiEvents\DomainObjects\OrderDomainObject $order */ @endphp
@php /** @var \HiEvents\DomainObjects\EventDomainObject $event */ @endphp
@php /** @var \HiEvents\DomainObjects\EventSettingDomainObject $eventSettings */ @endphp
+@php /** @var \HiEvents\DomainObjects\OrganizerDomainObject $organizer */ @endphp
+@php /** @var \HiEvents\DomainObjects\AttendeeDomainObject $attendee */ @endphp
@php /** @var string $ticketUrl */ @endphp
@php /** @see \HiEvents\Mail\Attendee\AttendeeTicketMail */ @endphp
@@ -22,4 +24,49 @@ at <a href="mailto:{{$eventSettings->getSupportEmail()}}">{{$eventSettings->getS
Best regards,
<br>
{{config('app.name')}}
+
+<script type="application/ld+json">
+ {
+ "@context": "http://schema.org",
+ "@type": "EventReservation",
+ "reservationNumber": "{{ $attendee->getPublicId() }}",
+ "reservationStatus": "http://schema.org/Confirmed",
+ "underName": {
+ "@type": "Person",
+ "name": "{{ $attendee->getFirstName() }} {{ $attendee->getLastName() }}"
+ },
+ "reservationFor": {
+ "@type": "Event",
+ "name": "{{ $event->getTitle() }}",
+ "performer": {
+ "@type": "Organization",
+ "name": "{{ $organizer->getName() }}",
+ },
+ "startDate": "{{ DateHelper::convertFromUTC($event->getStartDate(), $event->getTimezone()) }}",
+
+ @if($event->getEndDate())
+ "endDate": "{{ DateHelper::convertFromUTC($event->getEndDate(), $event->getTimezone()) }}",
+ @endif
+
+ @if ($eventSettings->getLocationDetails())
+ "location": {
+ "@type": "Place",
+ "name": "{{ $eventSettings->getAddress()->venue_name }}",
+ "address": {
+ "@type": "PostalAddress",
+ "streetAddress": "{{ $eventSettings->getAddress()->address_line_1 . ' ' . $eventSettings->getAddress()->address_line_2 }}",
+ "addressLocality": "{{ $eventSettings->getAddress()->city }}",
+ "addressRegion": "{{ $eventSettings->getAddress()->state_or_region }}",
+ "postalCode": "{{ $eventSettings->getAddress()->zip_or_postal_code }}",
+ "addressCountry": "{{ $eventSettings->getAddress()->country }}"
+ }
+ }
+ },
+ @endif
+
+ "ticketToken": "qrCode:{{ $attendee->getPublicId() }}",
+ "ticketNumber": "{{ $attendee->getPublicId() }}",
+ "ticketPrintUrl": "{{ $ticketUrl }}",
+}
+</script>
</x-mail::message>