upd checkout

This commit is contained in:
2025-04-14 11:25:26 +02:00
parent 00659ea805
commit 279bdd615e
5 changed files with 142 additions and 57 deletions
+12 -2
View File
@@ -6,7 +6,13 @@ $pdo = $dbHandler->getConnection();
// Recupera lo school_id e user_id dalla sessione
$school_id = session('school_id');
$user_id = session('iduserlogin'); // Cambiato da 'user_id' a 'iduserlogin'
$user_id = $iduserlogin;
// Controlla se l'utente è loggato
if (empty($user_id)) {
header('Location: login.php?error=not_logged_in');
exit;
}
// Recupera l'order_number dai parametri GET
$order_number = $_GET['order_number'] ?? 0;
@@ -27,7 +33,7 @@ $order_items = [];
$total_price = 0;
if ($order_number) {
$stmt = $pdo->prepare("
SELECT o.order_number, o.created_at, o.price, o.total_entries, o.available_entries, o.activation_date,
SELECT o.order_number, o.created_at, o.price, o.total_entries, o.available_entries, o.available_recoveries, o.expiration_date, o.activation_date,
p.name AS product_name, pv.name AS variation_name, c.name AS class_name, ct.level, ct.day_of_week, c.photo AS class_photo
FROM orders o
JOIN products p ON o.product_id = p.id
@@ -166,6 +172,10 @@ $order_date = $order_items[0]['created_at'];
<p><strong>Variazione:</strong> <?php echo htmlspecialchars($item['variation_name']); ?></p>
<p><strong>Classe:</strong> <?php echo htmlspecialchars($item['class_name'] . ' - ' . $item['level'] . ' (' . $item['day_of_week'] . ')'); ?></p>
<p><strong>Entrate Totali:</strong> <?php echo $item['total_entries']; ?></p>
<p><strong>Recuperi Disponibili:</strong> <?php echo $item['available_recoveries']; ?></p>
<?php if (!empty($item['expiration_date'])): ?>
<p><strong>Valido fino al:</strong> <?php echo date('d/m/Y', strtotime($item['expiration_date'])); ?></p>
<?php endif; ?>
<p class="price"><strong>Prezzo:</strong> <?php echo number_format($item['price'], 2); ?></p>
</div>
</div>