feat: implement order management and checkout functionality
All checks were successful
Build and Push Docker Image / build (push) Successful in 50s
All checks were successful
Build and Push Docker Image / build (push) Successful in 50s
- Added `Order` and `OrderItem` models with migrations for managing orders and their details - Created `CheckoutForm` for validating order data and customer information - Built templates for order confirmation, checkout success, and emails (HTML and plain text) - Added logic for email notifications upon successful order placement - Enhanced shopping cart template with checkout panel integration - Updated styles and JavaScript for streamlined checkout UX - Refactored cart view to support item summaries and final totals during checkout
This commit is contained in:
38
templates/orders/emails/order_confirmation_email.html
Normal file
38
templates/orders/emails/order_confirmation_email.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<div style="max-width:640px;margin:0 auto;background:#ffffff;border:1px solid #d6dde6;padding:32px;font-family:Arial,sans-serif;color:#36213e;">
|
||||
<h1 style="margin:0 0 16px;font-size:28px;">Заказ №{{ order.id }} оплачен</h1>
|
||||
<p>Здравствуйте, {{ order.customer_name }}!</p>
|
||||
<p>Ваш заказ успешно оформлен и оплачен.</p>
|
||||
|
||||
<table style="width:100%;border-collapse:collapse;margin:24px 0;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align:left;border-bottom:1px solid #d6dde6;padding:8px;">Товар</th>
|
||||
<th style="text-align:right;border-bottom:1px solid #d6dde6;padding:8px;">Кол-во</th>
|
||||
<th style="text-align:right;border-bottom:1px solid #d6dde6;padding:8px;">Сумма</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in order.items.all %}
|
||||
<tr>
|
||||
<td style="padding:8px;border-bottom:1px solid #eef2f6;">{{ item.item_name }}</td>
|
||||
<td style="padding:8px;border-bottom:1px solid #eef2f6;text-align:right;">{{ item.quantity }}</td>
|
||||
<td style="padding:8px;border-bottom:1px solid #eef2f6;text-align:right;">{{ item.line_total }} руб.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><strong>Товары:</strong> {{ order.products_total }} руб.</p>
|
||||
<p><strong>Скидка:</strong> {{ order.discount_total }} руб.</p>
|
||||
<p><strong>Доставка:</strong> {{ order.delivery_total }} руб.</p>
|
||||
<p><strong>Подъём на этаж:</strong> {{ order.floor_lift_total }} руб.</p>
|
||||
<p style="font-size:18px;"><strong>Итого к оплате:</strong> {{ order.total }} руб.</p>
|
||||
|
||||
<p><strong>Доставка:</strong> {{ order.get_delivery_method_display }}</p>
|
||||
{% if order.region or order.address %}
|
||||
<p><strong>Адрес:</strong> {{ order.region }}{% if order.address %}, {{ order.address }}{% endif %}</p>
|
||||
{% endif %}
|
||||
<p><strong>Оплата:</strong> {{ order.get_payment_method_display }}</p>
|
||||
|
||||
<p style="margin-top:24px;color:#554971;">Спасибо за покупку в {{ site_name }}.</p>
|
||||
</div>
|
||||
25
templates/orders/emails/order_confirmation_email.txt
Normal file
25
templates/orders/emails/order_confirmation_email.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
Здравствуйте, {{ order.customer_name }}!
|
||||
|
||||
Ваш заказ №{{ order.id }} успешно оплачен.
|
||||
|
||||
Состав заказа:
|
||||
{% for item in order.items.all %}
|
||||
- {{ item.item_name }} — {{ item.quantity }} шт. × {{ item.item_price }} руб. = {{ item.line_total }} руб.
|
||||
{% endfor %}
|
||||
|
||||
Товары: {{ order.products_total }} руб.
|
||||
Скидка: {{ order.discount_total }} руб.
|
||||
Доставка: {{ order.delivery_total }} руб.
|
||||
Подъём на этаж: {{ order.floor_lift_total }} руб.
|
||||
Итого к оплате: {{ order.total }} руб.
|
||||
|
||||
Доставка: {{ order.get_delivery_method_display }}
|
||||
{% if order.region or order.address %}Адрес: {{ order.region }}{% if order.address %}, {{ order.address }}{% endif %}
|
||||
{% endif %}Оплата: {{ order.get_payment_method_display }}
|
||||
|
||||
Контакты:
|
||||
ФИО: {{ order.customer_name }}
|
||||
Телефон: {{ order.phone }}
|
||||
E-mail: {{ order.email }}
|
||||
|
||||
Спасибо за покупку в {{ site_name }}.
|
||||
1
templates/orders/emails/order_confirmation_subject.txt
Normal file
1
templates/orders/emails/order_confirmation_subject.txt
Normal file
@@ -0,0 +1 @@
|
||||
{{ site_name }}: заказ №{{ order.id }} оплачен
|
||||
Reference in New Issue
Block a user