Add order status email notifications and templates
Introduces email notifications for order status changes (created, cancelled, completed, paid, missing payment, refund events) and adds corresponding HTML email templates. Refactors notification tasks to use only the order object and updates model logic to trigger notifications on relevant status changes.
This commit is contained in:
45
backend/commerce/templates/email/order_paid.html
Normal file
45
backend/commerce/templates/email/order_paid.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<h3 style="color:#333; font-size:18px; margin-top:0;">✓ Payment Received</h3>
|
||||
|
||||
<p>Dear {{ order.first_name }} {{ order.last_name }},</p>
|
||||
|
||||
<p>Thank you! Your payment has been successfully received and processed. Your order is now confirmed and will be prepared for shipment.</p>
|
||||
|
||||
<h4 style="color:#333; margin-top:20px; margin-bottom:10px;">Order Information</h4>
|
||||
<table width="100%" cellpadding="8" cellspacing="0" style="border-collapse:collapse;">
|
||||
<tr style="border-bottom:1px solid #ddd;">
|
||||
<td style="padding:8px; font-weight:bold;">Order ID:</td>
|
||||
<td style="padding:8px;">{{ order.id }}</td>
|
||||
</tr>
|
||||
<tr style="border-bottom:1px solid #ddd;">
|
||||
<td style="padding:8px; font-weight:bold;">Amount Paid:</td>
|
||||
<td style="padding:8px;">{{ order.total_price }} {{ order.get_currency }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:8px; font-weight:bold;">Payment Date:</td>
|
||||
<td style="padding:8px;">{{ order.payment.created_at|date:"d.m.Y H:i" }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4 style="color:#333; margin-top:20px; margin-bottom:10px;">Order Items</h4>
|
||||
<table width="100%" cellpadding="10" cellspacing="0" border="1" style="border-collapse:collapse; border-color:#ddd;">
|
||||
<thead>
|
||||
<tr style="background-color:#f9f9f9;">
|
||||
<th style="text-align:left; padding:10px; border:1px solid #ddd;">Product</th>
|
||||
<th style="text-align:center; padding:10px; border:1px solid #ddd;">Qty</th>
|
||||
<th style="text-align:right; padding:10px; border:1px solid #ddd;">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in order.items.all %}
|
||||
<tr>
|
||||
<td style="padding:10px; border:1px solid #ddd;">{{ item.product.name }}</td>
|
||||
<td style="text-align:center; padding:10px; border:1px solid #ddd;">{{ item.quantity }}</td>
|
||||
<td style="text-align:right; padding:10px; border:1px solid #ddd;">{{ item.get_total_price }} {{ order.get_currency }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p style="margin-top:20px; color:#666;">
|
||||
Your order will be prepared and shipped as soon as possible. You will receive a shipping notification with tracking details.
|
||||
</p>
|
||||
Reference in New Issue
Block a user