fix: missing email on order creation

This commit is contained in:
Pablo Moreno
2025-01-13 00:39:15 +01:00
parent 8a1243023f
commit 475b53a7e3
3 changed files with 18 additions and 35 deletions
@@ -12,30 +12,12 @@
{% translate 'Mis pedidos' %}
</a>
</li>
<li>
<a href="#" title=""
class="inline-flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-600">
{% translate 'Ajustes' %}
</a>
</li>
<li>
<a href="{% url 'web:wishlist' %}" title=""
class="inline-flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-600">
{% translate 'Lista de deseados' %}
</a>
</li>
<li>
<a href="#" title=""
class="inline-flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-600">
{% translate 'Direcciones de envío' %}
</a>
</li>
<li>
<a href="#" title=""
class="inline-flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-600">
{% translate 'Métodos de pago' %}
</a>
</li>
</ul>
<div class="p-2 text-sm font-medium text-gray-900 dark:text-white">
+15 -17
View File
@@ -13,6 +13,7 @@
<span class="bg-green-100 text-green-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded dark:bg-green-900 dark:text-green-300 ml-3">{% trans 'Pagado' %}</span>
{% endif %}
</h2>
<div class="mt-4 sm:mt-6 md:gap-6 lg:flex lg:items-start xl:gap-8">
<div class="mx-auto w-full flex-none lg:max-w-2xl xl:max-w-4xl">
<div class="space-y-6">
@@ -32,7 +33,7 @@
<div class="flex items-center">
<span
class="w-10 shrink-0 border-0 bg-transparent text-center text-sm font-medium text-gray-900 focus:outline-none focus:ring-0 dark:text-white">
{{ item.quantity }}x
{{ item.quantity|floatformat }}x
</span>
</div>
<div class="text-end md:order-4 md:w-32">
@@ -53,6 +54,7 @@
</div>
</div>
</div>
{% endfor %}
{% if items.count == 0 %}
@@ -73,11 +75,12 @@
</h2>
<div>
<p>{{ order.shipping_address }}</p>
<p>{{ order.shipping_city }}</p>
<p>{{ order.shipping_state }}</p>
<p>{{ order.shipping_country }}</p>
<p>{{ order.shipping_zip }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.email }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.shipping_address }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.shipping_city }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.shipping_state }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.shipping_country }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.shipping_zip }}</p>
</div>
</section>
@@ -87,11 +90,11 @@
</h2>
<div>
<p>{{ order.billing_address }}</p>
<p>{{ order.billing_city }}</p>
<p>{{ order.billing_state }}</p>
<p>{{ order.billing_country }}</p>
<p>{{ order.billing_zip }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.billing_address }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.billing_city }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.billing_state }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.billing_country }}</p>
<p class="text-m text-gray-900 dark:text-white">{{ order.billing_zip }}</p>
</div>
</section>
@@ -101,9 +104,7 @@
{% translate 'Método de envío' %}
</h2>
<section>
{{ order.shipping_method.name }}
</section>
<p class="text-m text-gray-900 dark:text-white">{{ order.shipping_method.name }}</p>
</section>
</div>
@@ -180,12 +181,9 @@
</a>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</section>
{% endblock %}
+3
View File
@@ -110,6 +110,8 @@ class CartDetail(TemplateView, CreateView):
shipping_address_zip = form.cleaned_data.get("shipping_address_zip")
shipping_address_phone = form.cleaned_data.get("shipping_address_phone")
email = form.cleaned_data.get("email")
shipping_method = get_object_or_404(ShippingMethod, pk=shipping_method_id)
order = create_order_from_cart(
@@ -128,6 +130,7 @@ class CartDetail(TemplateView, CreateView):
shipping_address_country=shipping_address_country,
shipping_address_zip=shipping_address_zip,
shipping_address_phone=shipping_address_phone,
email=email,
)
return redirect(reverse("web:order", kwargs={"uuid": order.uuid}))