Korekra maili - mail potwierdzający wysyłkę
This commit is contained in:
parent
0162193526
commit
9f667f62ba
@ -89,6 +89,35 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['status']) && get_user
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($new_status === 'shipped' && $old_status !== 'shipped') {
|
||||||
|
require_once __DIR__ . '/../mail/MailService.php';
|
||||||
|
|
||||||
|
// Fetch order and client details for email
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
SELECT o.*, c.name as client_company_name, u.email as client_email
|
||||||
|
FROM orders o
|
||||||
|
JOIN clients c ON o.client_id = c.id
|
||||||
|
JOIN users u ON c.id = u.client_id
|
||||||
|
WHERE o.id = ? AND u.id = (SELECT MIN(id) FROM users WHERE client_id = o.client_id)
|
||||||
|
");
|
||||||
|
$stmt->execute([$order_id]);
|
||||||
|
$order_details_for_email = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($order_details_for_email && !empty($order_details_for_email['client_email'])) {
|
||||||
|
$client_email = $order_details_for_email['client_email'];
|
||||||
|
$order_details_link = get_site_url() . '/order_details.php?id=' . $order_id;
|
||||||
|
|
||||||
|
$subject_client = "Your Order #{$order_id} has been shipped!";
|
||||||
|
$body_html_client = "<p>Great news! Your order #{$order_id} has been shipped.</p>"
|
||||||
|
. "<p>You can track your order and view details here: <a href='{$order_details_link}'>{$order_details_link}</a></p>";
|
||||||
|
$body_text_client = "Great news! Your order #{$order_id} has been shipped.\n"
|
||||||
|
. "You can track your order and view details here: {$order_details_link}";
|
||||||
|
|
||||||
|
MailService::sendMail($client_email, $subject_client, $body_html_client, $body_text_client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
header("Location: order_details.php?id=$order_id");
|
header("Location: order_details.php?id=$order_id");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -125,7 +154,7 @@ $page_title = 'Szczegóły zamówienia #' . htmlspecialchars($order['id']);
|
|||||||
<main class="container mt-4">
|
<main class="container mt-4">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
<h1><?php echo $pageTitle; ?></h1>
|
<h1>Szczegóły zamówienia #<?php echo htmlspecialchars($order['id']); ?></h1>
|
||||||
<a href="orders.php" class="btn btn-secondary">
|
<a href="orders.php" class="btn btn-secondary">
|
||||||
<i class="bi bi-arrow-left"></i> Powrót do listy
|
<i class="bi bi-arrow-left"></i> Powrót do listy
|
||||||
</a>
|
</a>
|
||||||
@ -172,6 +201,7 @@ $page_title = 'Szczegóły zamówienia #' . htmlspecialchars($order['id']);
|
|||||||
<div class="card mb-4">
|
<div class="card mb-4">
|
||||||
<div class="card-header">Podsumowanie</div>
|
<div class="card-header">Podsumowanie</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<p><strong>Numer zamówienia:</strong> <?php echo htmlspecialchars($order['id']); ?></p>
|
||||||
<p><strong>Klient:</strong> <?php echo htmlspecialchars($order['client_company_name'] ?? 'Brak'); ?></p>
|
<p><strong>Klient:</strong> <?php echo htmlspecialchars($order['client_company_name'] ?? 'Brak'); ?></p>
|
||||||
<p><strong>Data:</strong> <?php echo date('d.m.Y H:i', strtotime($order['created_at'])); ?></p>
|
<p><strong>Data:</strong> <?php echo date('d.m.Y H:i', strtotime($order['created_at'])); ?></p>
|
||||||
<p><strong>Metoda płatności:</strong> <span class="badge bg-secondary"><?php echo htmlspecialchars(get_payment_method_translation_local($order['payment_method'], $i18n)); ?></span></p>
|
<p><strong>Metoda płatności:</strong> <span class="badge bg-secondary"><?php echo htmlspecialchars(get_payment_method_translation_local($order['payment_method'], $i18n)); ?></span></p>
|
||||||
|
|||||||
@ -14619,3 +14619,101 @@ Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84
|
|||||||
Found product price. Net: 233.2, Gross: 286.84
|
Found product price. Net: 233.2, Gross: 286.84
|
||||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||||
---
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 1, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"}
|
||||||
|
Found product price. Net: 1111, Gross: 1366.53
|
||||||
|
FINAL: Returning Net: 1111, Gross: 1366.53
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 2, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"}
|
||||||
|
Found product price. Net: 1318.05, Gross: 1621.2
|
||||||
|
FINAL: Returning Net: 1318.05, Gross: 1621.2
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 3, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||||
|
Found product price. Net: 9.95, Gross: 12.24
|
||||||
|
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 4, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||||
|
Found product price. Net: 9.95, Gross: 12.24
|
||||||
|
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 5, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||||
|
Found product price. Net: 68, Gross: 83.64
|
||||||
|
FINAL: Returning Net: 68, Gross: 83.64
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 6, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||||
|
Found product price. Net: 171.6, Gross: 211.07
|
||||||
|
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 7, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||||
|
Found product price. Net: 233.2, Gross: 286.84
|
||||||
|
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 1, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"}
|
||||||
|
Found product price. Net: 1111, Gross: 1366.53
|
||||||
|
FINAL: Returning Net: 1111, Gross: 1366.53
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 2, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"}
|
||||||
|
Found product price. Net: 1318.05, Gross: 1621.2
|
||||||
|
FINAL: Returning Net: 1318.05, Gross: 1621.2
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 3, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||||
|
Found product price. Net: 9.95, Gross: 12.24
|
||||||
|
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 4, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||||
|
Found product price. Net: 9.95, Gross: 12.24
|
||||||
|
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 5, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||||
|
Found product price. Net: 68, Gross: 83.64
|
||||||
|
FINAL: Returning Net: 68, Gross: 83.64
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 6, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||||
|
Found product price. Net: 171.6, Gross: 211.07
|
||||||
|
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||||
|
---
|
||||||
|
---
|
||||||
|
START getEffectivePrice for product 7, client
|
||||||
|
Client price not found or not set, falling back to product price.
|
||||||
|
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||||
|
Found product price. Net: 233.2, Gross: 286.84
|
||||||
|
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||||
|
---
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user