| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676 |
- <?php
- require_once __DIR__ . '/../config.php';
- /**
- * Read JSON file and return decoded data
- */
- function readJsonFile($file) {
- if (!file_exists($file)) {
- return [];
- }
- $content = file_get_contents($file);
- if (empty($content)) {
- return [];
- }
- $data = json_decode($content, true);
- return $data ? $data : [];
- }
- /**
- * Write data to JSON file
- */
- function writeJsonFile($file, $data) {
- $dir = dirname($file);
- if (!is_dir($dir)) {
- mkdir($dir, 0755, true);
- }
- file_put_contents($file, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
- }
- /**
- * Get all products
- */
- function getProducts() {
- $data = readJsonFile(PRODUCTS_FILE);
- return isset($data['products']) ? $data['products'] : [];
- }
- /**
- * Get product by ID
- */
- function getProductById($id) {
- $products = getProducts();
- foreach ($products as $product) {
- if ($product['id'] == $id) {
- return $product;
- }
- }
- return null;
- }
- /**
- * Save products
- */
- function saveProducts($products) {
- $data = ['products' => $products];
- writeJsonFile(PRODUCTS_FILE, $data);
- }
- /**
- * Get all reservations
- */
- function getReservations() {
- $data = readJsonFile(RESERVATIONS_FILE);
- return isset($data['reservations']) ? $data['reservations'] : [];
- }
- /**
- * Get reservation by order number
- */
- function getReservationByOrderNumber($orderNumber) {
- $reservations = getReservations();
- foreach ($reservations as $reservation) {
- if (isset($reservation['id']) && $reservation['id'] === $orderNumber) {
- return $reservation;
- }
- }
- return null;
- }
- /**
- * Save reservations
- */
- function saveReservations($reservations) {
- $data = ['reservations' => $reservations];
- writeJsonFile(RESERVATIONS_FILE, $data);
- }
- /**
- * Generate order number
- * Pattern: PREFIX-YEAR-SEQ
- */
- function generateReservationId() {
- $reservations = getReservations();
- $year = date('Y');
- $prefix = defined('ORDER_PREFIX') ? ORDER_PREFIX : 'ORD';
- $max = 0;
- $pattern = '/^' . preg_quote($prefix, '/') . '-\\d{4}-(\\d+)$/';
- foreach ($reservations as $reservation) {
- if (!isset($reservation['id'])) {
- continue;
- }
- if (preg_match($pattern, $reservation['id'], $matches)) {
- $num = (int)$matches[1];
- if ($num > $max) {
- $max = $num;
- }
- }
- }
- $next = $max + 1;
- return sprintf('%s-%s-%03d', $prefix, $year, $next);
- }
- /**
- * Check if product has enough stock
- * For apparel: checks stock for specific size
- * For merch: checks general stock
- */
- function checkStock($productId, $quantity, $size = null) {
- $product = getProductById($productId);
- if (!$product) {
- return false;
- }
-
- // For apparel with sizes, check stock per size
- if ($product['category'] === 'apparel' && !empty($product['sizes']) && $size !== null) {
- if (!isset($product['stock_by_size']) || !is_array($product['stock_by_size'])) {
- return false;
- }
- $sizeStock = isset($product['stock_by_size'][$size]) ? (int)$product['stock_by_size'][$size] : 0;
- return $sizeStock >= $quantity;
- }
-
- // For merch or apparel without size-specific stock, use general stock
- $stock = isset($product['stock']) ? (int)$product['stock'] : 0;
- return $stock >= $quantity;
- }
- /**
- * Get stock for a product (per size for apparel, general for merch)
- */
- function getStock($product, $size = null) {
- if ($product['category'] === 'apparel' && !empty($product['sizes']) && $size !== null) {
- if (isset($product['stock_by_size']) && is_array($product['stock_by_size'])) {
- return isset($product['stock_by_size'][$size]) ? (int)$product['stock_by_size'][$size] : 0;
- }
- }
- return isset($product['stock']) ? (int)$product['stock'] : 0;
- }
- /**
- * Get total stock for a product (sum of all sizes for apparel)
- */
- function getTotalStock($product) {
- if ($product['category'] === 'apparel' && isset($product['stock_by_size']) && is_array($product['stock_by_size'])) {
- return array_sum($product['stock_by_size']);
- }
- return isset($product['stock']) ? (int)$product['stock'] : 0;
- }
- /**
- * Allocate stock for reservation
- */
- function allocateStock($productId, $quantity, $size = null) {
- $products = getProducts();
- foreach ($products as &$product) {
- if ($product['id'] == $productId) {
- // For apparel with sizes, allocate per size
- if ($product['category'] === 'apparel' && !empty($product['sizes']) && $size !== null) {
- if (!isset($product['stock_by_size']) || !is_array($product['stock_by_size'])) {
- $product['stock_by_size'] = [];
- }
- if (!isset($product['stock_by_size'][$size])) {
- $product['stock_by_size'][$size] = 0;
- }
- $product['stock_by_size'][$size] -= $quantity;
- if ($product['stock_by_size'][$size] < 0) {
- $product['stock_by_size'][$size] = 0;
- }
- } else {
- // For merch or general stock
- if (!isset($product['stock'])) {
- $product['stock'] = 0;
- }
- $product['stock'] -= $quantity;
- if ($product['stock'] < 0) {
- $product['stock'] = 0;
- }
- }
- break;
- }
- }
- saveProducts($products);
- }
- /**
- * Release stock from reservation
- */
- function releaseStock($productId, $quantity, $size = null) {
- $products = getProducts();
- foreach ($products as &$product) {
- if ($product['id'] == $productId) {
- // For apparel with sizes, release per size
- if ($product['category'] === 'apparel' && !empty($product['sizes']) && $size !== null) {
- if (!isset($product['stock_by_size']) || !is_array($product['stock_by_size'])) {
- $product['stock_by_size'] = [];
- }
- if (!isset($product['stock_by_size'][$size])) {
- $product['stock_by_size'][$size] = 0;
- }
- $product['stock_by_size'][$size] += $quantity;
- } else {
- // For merch or general stock
- if (!isset($product['stock'])) {
- $product['stock'] = 0;
- }
- $product['stock'] += $quantity;
- }
- break;
- }
- }
- saveProducts($products);
- }
- /**
- * Create new reservation
- */
- function createReservation($customerName, $customerEmail, $items) {
- $reservations = getReservations();
-
- // Validate stock for all items
- foreach ($items as $item) {
- $size = isset($item['size']) ? $item['size'] : null;
- if (!checkStock($item['product_id'], $item['quantity'], $size)) {
- $product = getProductById($item['product_id']);
- $productName = $product ? $product['name'] : 'Produkt';
- $sizeInfo = $size ? " (Größe: $size)" : '';
- return ['success' => false, 'message' => "Nicht genügend Lagerbestand für: $productName$sizeInfo"];
- }
- }
-
- // Allocate stock
- foreach ($items as $item) {
- $size = isset($item['size']) ? $item['size'] : null;
- allocateStock($item['product_id'], $item['quantity'], $size);
- }
-
- // Create reservation
- $now = new DateTime();
- $expires = clone $now;
- $expires->modify('+' . RESERVATION_EXPIRY_DAYS . ' days');
-
- $reservation = [
- 'id' => generateReservationId(),
- 'customer_name' => $customerName,
- 'customer_email' => $customerEmail,
- 'items' => $items,
- 'created' => $now->format('Y-m-d H:i:s'),
- 'expires' => $expires->format('Y-m-d H:i:s'),
- 'status' => 'open',
- 'picked_up' => false,
- 'type' => 'regular'
- ];
-
- $reservations[] = $reservation;
- saveReservations($reservations);
-
- // Send confirmation emails
- sendReservationEmails($reservation);
-
- return ['success' => true, 'reservation' => $reservation];
- }
- /**
- * Create new backorder reservation
- */
- function createBackorderReservation($customerName, $customerEmail, $items) {
- $reservations = getReservations();
-
- $now = new DateTime();
-
- $reservation = [
- 'id' => generateReservationId(),
- 'customer_name' => $customerName,
- 'customer_email' => $customerEmail,
- 'items' => $items,
- 'created' => $now->format('Y-m-d H:i:s'),
- 'expires' => '',
- 'status' => 'open',
- 'picked_up' => false,
- 'type' => 'backorder',
- 'backorder_status' => 'pending'
- ];
-
- $reservations[] = $reservation;
- saveReservations($reservations);
-
- // Send confirmation emails
- sendBackorderEmails($reservation);
-
- return ['success' => true, 'reservation' => $reservation];
- }
- /**
- * Mark reservation as picked up
- */
- function markReservationPickedUp($reservationId) {
- $reservations = getReservations();
- foreach ($reservations as &$reservation) {
- if ($reservation['id'] === $reservationId) {
- $reservation['picked_up'] = true;
- $reservation['status'] = 'picked_up';
- break;
- }
- }
- saveReservations($reservations);
- }
- /**
- * Check and expire old reservations
- */
- function expireOldReservations() {
- $reservations = getReservations();
- $now = new DateTime();
- $changed = false;
-
- foreach ($reservations as &$reservation) {
- if ($reservation['status'] === 'open' && !$reservation['picked_up']) {
- if (isset($reservation['type']) && $reservation['type'] === 'backorder') {
- continue;
- }
- if (empty($reservation['expires'])) {
- continue;
- }
- $expires = new DateTime($reservation['expires']);
- if ($now > $expires) {
- $reservation['status'] = 'expired';
- // Release stock
- foreach ($reservation['items'] as $item) {
- $size = isset($item['size']) ? $item['size'] : null;
- releaseStock($item['product_id'], $item['quantity'], $size);
- }
- $changed = true;
- }
- }
- }
-
- if ($changed) {
- saveReservations($reservations);
- }
- }
- /**
- * Check if all items are in stock
- */
- function canFulfillReservationItems($items) {
- foreach ($items as $item) {
- $size = isset($item['size']) ? $item['size'] : null;
- if (!checkStock($item['product_id'], $item['quantity'], $size)) {
- return false;
- }
- }
- return true;
- }
- /**
- * Mark backorder as available
- */
- function markBackorderAvailable($reservationId) {
- $reservations = getReservations();
- foreach ($reservations as &$reservation) {
- if ($reservation['id'] === $reservationId) {
- if (!isset($reservation['type']) || $reservation['type'] !== 'backorder') {
- return ['success' => false, 'message' => 'Diese Nachbestellung wurde bereits in eine Bestellung umgewandelt.'];
- }
- if (isset($reservation['backorder_status']) && $reservation['backorder_status'] === 'notified') {
- return ['success' => false, 'message' => 'Diese Nachbestellung wurde bereits informiert.'];
- }
- if (!canFulfillReservationItems($reservation['items'])) {
- return ['success' => false, 'message' => 'Nicht alle Artikel sind verfügbar.'];
- }
-
- foreach ($reservation['items'] as $item) {
- $size = isset($item['size']) ? $item['size'] : null;
- allocateStock($item['product_id'], $item['quantity'], $size);
- }
- $now = new DateTime();
- $expires = clone $now;
- $expires->modify('+' . RESERVATION_EXPIRY_DAYS . ' days');
- $reservation['type'] = 'regular';
- $reservation['status'] = 'open';
- $reservation['picked_up'] = false;
- $reservation['expires'] = $expires->format('Y-m-d H:i:s');
- if (isset($reservation['backorder_status'])) {
- unset($reservation['backorder_status']);
- }
- saveReservations($reservations);
-
- sendBackorderAvailableEmail($reservation);
-
- return ['success' => true, 'reservation' => $reservation];
- }
- }
- return ['success' => false, 'message' => 'Nachbestellung nicht gefunden.'];
- }
- /**
- * Sanitize input
- */
- function sanitize($input) {
- return htmlspecialchars(strip_tags(trim($input)), ENT_QUOTES, 'UTF-8');
- }
- /**
- * Format price
- */
- function formatPrice($price) {
- return number_format($price, 2, ',', '.') . ' €';
- }
- /**
- * Format date
- */
- function formatDate($dateString) {
- $date = new DateTime($dateString);
- return $date->format('d.m.Y H:i');
- }
- /**
- * Send email
- */
- function sendEmail($to, $subject, $message, $isHtml = true) {
- $headers = [];
- $headers[] = 'From: ' . FROM_NAME . ' <' . FROM_EMAIL . '>';
- $headers[] = 'Reply-To: ' . FROM_EMAIL;
- $headers[] = 'X-Mailer: PHP/' . phpversion();
-
- if ($isHtml) {
- $headers[] = 'MIME-Version: 1.0';
- $headers[] = 'Content-type: text/html; charset=UTF-8';
- }
-
- return mail($to, $subject, $message, implode("\r\n", $headers));
- }
- /**
- * Send reservation confirmation emails
- */
- function sendReservationEmails($reservation) {
- $products = getProducts();
-
- // Build items list
- $itemsHtml = '<ul>';
- foreach ($reservation['items'] as $item) {
- $product = getProductById($item['product_id']);
- if ($product) {
- $sizeInfo = '';
- if (isset($item['size']) && !empty($item['size'])) {
- $sizeInfo = ' - Größe: ' . htmlspecialchars($item['size']);
- }
- $itemsHtml .= '<li>' . htmlspecialchars($product['name']) . $sizeInfo . ' - Menge: ' . $item['quantity'] . '</li>';
- }
- }
- $itemsHtml .= '</ul>';
-
- // Customer email
- $customerSubject = 'Ihre Reservierung bei ' . SITE_NAME;
- $customerMessage = '
- <html>
- <head>
- <meta charset="UTF-8">
- </head>
- <body style="font-family: Arial, sans-serif; line-height: 1.6; color: #f5f7fb; background: #28292a; padding: 1.5rem;">
- <div style="max-width: 640px; margin: 0 auto; background: #2f3541; padding: 1.5rem 2rem; border-radius: 10px; border: 1px solid #3b4252;">
- <h2 style="color: #cac300; margin-top: 0;">Reservierung bestätigt</h2>
- <p>Sehr geehrte/r ' . htmlspecialchars($reservation['customer_name']) . ',</p>
- <p>vielen Dank für Ihre Reservierung bei ' . SITE_NAME . '.</p>
-
- <div style="background: #28292a; border: 2px solid #cac300; padding: 1.5rem; margin: 1.5rem 0; border-radius: 8px; text-align: center;">
- <h3 style="margin-top: 0; color: #f5f7fb;">Ihre Bestellnummer:</h3>
- <h2 style="font-size: 2rem; letter-spacing: 0.2rem; color: #cac300; font-family: monospace;">' . htmlspecialchars($reservation['id']) . '</h2>
- </div>
-
- <h3>Reservierungsdetails:</h3>
- <p><strong>Bestellnummer:</strong> ' . htmlspecialchars($reservation['id']) . '</p>
- <p><strong>Erstellt am:</strong> ' . formatDate($reservation['created']) . '</p>
- <p><strong>Gültig bis:</strong> ' . formatDate($reservation['expires']) . '</p>
-
- <h3>Reservierte Artikel:</h3>
- ' . $itemsHtml . '
-
- <p><strong>Wichtig:</strong> Bitte nennen Sie diese Bestellnummer bei der Abholung. Die Reservierung ist bis zum ' . formatDate($reservation['expires']) . ' gültig.</p>
-
- <p>Mit freundlichen Grüßen<br>' . SITE_NAME . '</p>
- </div>
- </body>
- </html>';
-
- sendEmail($reservation['customer_email'], $customerSubject, $customerMessage);
-
- // Admin email
- $adminSubject = 'Neue Reservierung: ' . $reservation['id'];
- $adminMessage = '
- <html>
- <head>
- <meta charset="UTF-8">
- </head>
- <body style="font-family: Arial, sans-serif; line-height: 1.6; color: #f5f7fb; background: #28292a; padding: 1.5rem;">
- <div style="max-width: 640px; margin: 0 auto; background: #2f3541; padding: 1.5rem 2rem; border-radius: 10px; border: 1px solid #3b4252;">
- <h2 style="color: #cac300; margin-top: 0;">Neue Reservierung</h2>
- <p>Eine neue Reservierung wurde erstellt:</p>
-
- <div style="background: #28292a; border: 2px solid #cac300; padding: 1.5rem; margin: 1.5rem 0; border-radius: 8px;">
- <h3 style="margin-top: 0;">Bestellnummer:</h3>
- <h2 style="font-size: 2rem; letter-spacing: 0.2rem; color: #cac300; font-family: monospace;">' . htmlspecialchars($reservation['id']) . '</h2>
- </div>
-
- <h3>Kundendaten:</h3>
- <p><strong>Name:</strong> ' . htmlspecialchars($reservation['customer_name']) . '</p>
- <p><strong>E-Mail:</strong> ' . htmlspecialchars($reservation['customer_email']) . '</p>
-
- <h3>Reservierungsdetails:</h3>
- <p><strong>Bestellnummer:</strong> ' . htmlspecialchars($reservation['id']) . '</p>
- <p><strong>Erstellt am:</strong> ' . formatDate($reservation['created']) . '</p>
- <p><strong>Gültig bis:</strong> ' . formatDate($reservation['expires']) . '</p>
-
- <h3>Reservierte Artikel:</h3>
- ' . $itemsHtml . '
- </div>
- </body>
- </html>';
-
- sendEmail(ADMIN_EMAIL, $adminSubject, $adminMessage);
- }
- /**
- * Send backorder confirmation emails
- */
- function sendBackorderEmails($reservation) {
- // Build items list
- $itemsHtml = '<ul>';
- foreach ($reservation['items'] as $item) {
- $product = getProductById($item['product_id']);
- if ($product) {
- $sizeInfo = '';
- if (isset($item['size']) && !empty($item['size'])) {
- $sizeInfo = ' - Größe: ' . htmlspecialchars($item['size']);
- }
- $itemsHtml .= '<li>' . htmlspecialchars($product['name']) . $sizeInfo . ' - Menge: ' . $item['quantity'] . '</li>';
- }
- }
- $itemsHtml .= '</ul>';
-
- // Customer email
- $customerSubject = 'Nachbestellung bei ' . SITE_NAME;
- $customerMessage = '
- <html>
- <head>
- <meta charset="UTF-8">
- </head>
- <body style="font-family: Arial, sans-serif; line-height: 1.6; color: #f5f7fb; background: #28292a; padding: 1.5rem;">
- <div style="max-width: 640px; margin: 0 auto; background: #2f3541; padding: 1.5rem 2rem; border-radius: 10px; border: 1px solid #3b4252;">
- <h2 style="color: #cac300; margin-top: 0;">Nachbestellung bestätigt</h2>
- <p>Sehr geehrte/r ' . htmlspecialchars($reservation['customer_name']) . ',</p>
- <p>vielen Dank für Ihre Nachbestellung bei ' . SITE_NAME . '.</p>
-
- <div style="background: #28292a; border: 2px solid #cac300; padding: 1.5rem; margin: 1.5rem 0; border-radius: 8px; text-align: center;">
- <h3 style="margin-top: 0; color: #f5f7fb;">Ihre Bestellnummer:</h3>
- <h2 style="font-size: 2rem; letter-spacing: 0.2rem; color: #cac300; font-family: monospace;">' . htmlspecialchars($reservation['id']) . '</h2>
- </div>
-
- <h3>Nachbestellungsdetails:</h3>
- <p><strong>Bestellnummer:</strong> ' . htmlspecialchars($reservation['id']) . '</p>
- <p><strong>Erstellt am:</strong> ' . formatDate($reservation['created']) . '</p>
-
- <h3>Nachbestellte Artikel:</h3>
- ' . $itemsHtml . '
-
- <div style="background: #28292a; border: 2px solid #cf2e2e; padding: 1.5rem; margin: 1.5rem 0; border-radius: 8px;">
- <strong>Hinweis:</strong> Die Lieferzeiten sind nicht bekannt, da die Bestellung in Chargen erfolgt.
- </div>
-
- <p>Wir informieren Sie, sobald die komplette Nachbestellung zur Abholung bereit ist.</p>
-
- <p>Mit freundlichen Grüßen<br>' . SITE_NAME . '</p>
- </div>
- </body>
- </html>';
-
- sendEmail($reservation['customer_email'], $customerSubject, $customerMessage);
-
- // Admin email
- $adminSubject = 'Neue Nachbestellung: ' . $reservation['id'];
- $adminMessage = '
- <html>
- <head>
- <meta charset="UTF-8">
- </head>
- <body style="font-family: Arial, sans-serif; line-height: 1.6; color: #f5f7fb; background: #28292a; padding: 1.5rem;">
- <div style="max-width: 640px; margin: 0 auto; background: #2f3541; padding: 1.5rem 2rem; border-radius: 10px; border: 1px solid #3b4252;">
- <h2 style="color: #cac300; margin-top: 0;">Neue Nachbestellung</h2>
- <p>Eine neue Nachbestellung wurde erstellt:</p>
-
- <div style="background: #28292a; border: 2px solid #cac300; padding: 1.5rem; margin: 1.5rem 0; border-radius: 8px;">
- <h3 style="margin-top: 0;">Bestellnummer:</h3>
- <h2 style="font-size: 2rem; letter-spacing: 0.2rem; color: #cac300; font-family: monospace;">' . htmlspecialchars($reservation['id']) . '</h2>
- </div>
-
- <h3>Kundendaten:</h3>
- <p><strong>Name:</strong> ' . htmlspecialchars($reservation['customer_name']) . '</p>
- <p><strong>E-Mail:</strong> ' . htmlspecialchars($reservation['customer_email']) . '</p>
-
- <h3>Nachbestellungsdetails:</h3>
- <p><strong>Bestellnummer:</strong> ' . htmlspecialchars($reservation['id']) . '</p>
- <p><strong>Erstellt am:</strong> ' . formatDate($reservation['created']) . '</p>
-
- <h3>Nachbestellte Artikel:</h3>
- ' . $itemsHtml . '
-
- <p><strong>Hinweis:</strong> Lieferzeiten sind nicht bekannt, Bestellung in Chargen.</p>
- </div>
- </body>
- </html>';
-
- sendEmail(ADMIN_EMAIL, $adminSubject, $adminMessage);
- }
- /**
- * Send backorder availability email
- */
- function sendBackorderAvailableEmail($reservation) {
- $itemsHtml = '<ul>';
- foreach ($reservation['items'] as $item) {
- $product = getProductById($item['product_id']);
- if ($product) {
- $sizeInfo = '';
- if (isset($item['size']) && !empty($item['size'])) {
- $sizeInfo = ' - Größe: ' . htmlspecialchars($item['size']);
- }
- $itemsHtml .= '<li>' . htmlspecialchars($product['name']) . $sizeInfo . ' - Menge: ' . $item['quantity'] . '</li>';
- }
- }
- $itemsHtml .= '</ul>';
-
- $subject = 'Ihre Nachbestellung ist zur Abholung bereit';
- $message = '
- <html>
- <head>
- <meta charset="UTF-8">
- </head>
- <body style="font-family: Arial, sans-serif; line-height: 1.6; color: #f5f7fb; background: #28292a; padding: 1.5rem;">
- <div style="max-width: 640px; margin: 0 auto; background: #2f3541; padding: 1.5rem 2rem; border-radius: 10px; border: 1px solid #3b4252;">
- <h2 style="color: #cac300; margin-top: 0;">Nachbestellung zur Abholung bereit</h2>
- <p>Sehr geehrte/r ' . htmlspecialchars($reservation['customer_name']) . ',</p>
- <p>Ihre komplette Nachbestellung ist jetzt zur Abholung bereit.</p>
-
- <div style="background: #28292a; border: 2px solid #cac300; padding: 1.5rem; margin: 1.5rem 0; border-radius: 8px; text-align: center;">
- <h3 style="margin-top: 0; color: #f5f7fb;">Ihre Bestellnummer:</h3>
- <h2 style="font-size: 2rem; letter-spacing: 0.2rem; color: #cac300; font-family: monospace;">' . htmlspecialchars($reservation['id']) . '</h2>
- </div>
-
- <h3>Bereitliegende Artikel:</h3>
- ' . $itemsHtml . '
-
- <p>Bitte nennen Sie die Bestellnummer bei der Abholung.</p>
-
- <p>Mit freundlichen Grüßen<br>' . SITE_NAME . '</p>
- </div>
- </body>
- </html>';
-
- sendEmail($reservation['customer_email'], $subject, $message);
- }
|