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:
50
backend/commerce/templates/email/order_created.html
Normal file
50
backend/commerce/templates/email/order_created.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<h3 style="color:#333; font-size:18px; margin-top:0;">Order Confirmation</h3>
|
||||
|
||||
<p>Dear {{ order.first_name }} {{ order.last_name }},</p>
|
||||
|
||||
<p>Thank you for your order! Your order has been successfully created and is being prepared for shipment.</p>
|
||||
|
||||
<h4 style="color:#333; margin-top:20px; margin-bottom:10px;">Order Details</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>
|
||||
|
||||
<h4 style="color:#333; margin-top:20px; margin-bottom:10px;">Order Summary</h4>
|
||||
<table width="100%" cellpadding="8" cellspacing="0" style="border-collapse:collapse;">
|
||||
<tr>
|
||||
<td style="text-align:right; padding:8px;">Subtotal:</td>
|
||||
<td style="text-align:right; padding:8px; font-weight:bold;">{{ order.total_price }} {{ order.get_currency }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4 style="color:#333; margin-top:20px; margin-bottom:10px;">Shipping Address</h4>
|
||||
<p style="margin:0;">
|
||||
{{ order.first_name }} {{ order.last_name }}<br>
|
||||
{{ order.address }}<br>
|
||||
{{ order.postal_code }} {{ order.city }}<br>
|
||||
{{ order.country }}
|
||||
</p>
|
||||
|
||||
{% if order.note %}
|
||||
<h4 style="color:#333; margin-top:20px; margin-bottom:10px;">Special Instructions</h4>
|
||||
<p style="margin:0;">{{ order.note }}</p>
|
||||
{% endif %}
|
||||
|
||||
<p style="margin-top:20px; color:#666;">
|
||||
We will notify you as soon as your order ships. If you have any questions, please contact us.
|
||||
</p>
|
||||
Reference in New Issue
Block a user