Implement guest buy now checkout
All checks were successful
Build and Push Docker Image / build (push) Successful in 26s
All checks were successful
Build and Push Docker Image / build (push) Successful in 26s
This commit is contained in:
@@ -106,7 +106,13 @@
|
||||
В корзину
|
||||
</a>
|
||||
{% endif %}
|
||||
<button class="product-summary__button product-summary__button--secondary" type="button">Купить</button>
|
||||
{% if item.is_available %}
|
||||
<a class="product-summary__button product-summary__button--secondary product-summary__button--link" href="{% url 'orders:buy_now' item.id %}">
|
||||
Купить
|
||||
</a>
|
||||
{% else %}
|
||||
<button class="product-summary__button product-summary__button--secondary" type="button" disabled>Купить</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "_layouts/base.html" %}
|
||||
{% load static l10n %}
|
||||
|
||||
{% block title %}Корзина{% endblock %}
|
||||
{% block title %}{% if direct_checkout %}Оформление заказа{% else %}Корзина{% endif %}{% endblock %}
|
||||
|
||||
{% block add_css %}
|
||||
<link rel="stylesheet" href="{% static "css/cart.css" %}">
|
||||
@@ -10,7 +10,11 @@
|
||||
{% block content %}
|
||||
{% include "_fragments/header.html" %}
|
||||
|
||||
{% include '_fragments/breadcrumbs.html' with url_1='/' text_1='Главная' url_2='/orders/cart/' text_2='Корзина' %}
|
||||
{% if direct_checkout %}
|
||||
{% include '_fragments/breadcrumbs.html' with url_1='/' text_1='Главная' url_2=request.path text_2='Оформление заказа' %}
|
||||
{% else %}
|
||||
{% include '_fragments/breadcrumbs.html' with url_1='/' text_1='Главная' url_2='/orders/cart/' text_2='Корзина' %}
|
||||
{% endif %}
|
||||
|
||||
<main class="container cart-page">
|
||||
{% if cart_items %}
|
||||
@@ -39,42 +43,50 @@
|
||||
{% endif %}
|
||||
<p class="cart-item__price">{{ item.price }} руб.</p>
|
||||
|
||||
<div class="cart-item__controls">
|
||||
<div class="cart-quantity" aria-label="Количество товара">
|
||||
<button
|
||||
class="cart-quantity__button"
|
||||
type="button"
|
||||
data-cart-decrement
|
||||
data-remove-form-id="cart-remove-{{ cart_item.id }}"
|
||||
data-update-form-id="cart-decrement-{{ cart_item.id }}"
|
||||
data-current-quantity="{{ cart_item.quantity }}"
|
||||
aria-label="Уменьшить количество"
|
||||
>
|
||||
-
|
||||
</button>
|
||||
<span class="cart-quantity__value">{{ cart_item.quantity }}</span>
|
||||
<form id="cart-increment-{{ cart_item.id }}" method="post" action="{% url 'orders:update_quantity' %}">
|
||||
{% if direct_checkout %}
|
||||
<div class="cart-item__controls">
|
||||
<div class="cart-quantity" aria-label="Количество товара">
|
||||
<span class="cart-quantity__value">{{ cart_item.quantity }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="cart-item__controls">
|
||||
<div class="cart-quantity" aria-label="Количество товара">
|
||||
<button
|
||||
class="cart-quantity__button"
|
||||
type="button"
|
||||
data-cart-decrement
|
||||
data-remove-form-id="cart-remove-{{ cart_item.id }}"
|
||||
data-update-form-id="cart-decrement-{{ cart_item.id }}"
|
||||
data-current-quantity="{{ cart_item.quantity }}"
|
||||
aria-label="Уменьшить количество"
|
||||
>
|
||||
-
|
||||
</button>
|
||||
<span class="cart-quantity__value">{{ cart_item.quantity }}</span>
|
||||
<form id="cart-increment-{{ cart_item.id }}" method="post" action="{% url 'orders:update_quantity' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="item_id" value="{{ item.id }}">
|
||||
<input type="hidden" name="quantity" value="{{ cart_item.quantity|add:1 }}">
|
||||
<input type="hidden" name="next" value="{% url 'orders:cart' %}">
|
||||
<button class="cart-quantity__button" type="submit" aria-label="Увеличить количество">+</button>
|
||||
</form>
|
||||
<form id="cart-decrement-{{ cart_item.id }}" method="post" action="{% url 'orders:update_quantity' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="item_id" value="{{ item.id }}">
|
||||
<input type="hidden" name="quantity" value="{{ cart_item.quantity|add:-1 }}">
|
||||
<input type="hidden" name="next" value="{% url 'orders:cart' %}">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<form id="cart-remove-{{ cart_item.id }}" method="post" action="{% url 'orders:remove' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="item_id" value="{{ item.id }}">
|
||||
<input type="hidden" name="quantity" value="{{ cart_item.quantity|add:1 }}">
|
||||
<input type="hidden" name="next" value="{% url 'orders:cart' %}">
|
||||
<button class="cart-quantity__button" type="submit" aria-label="Увеличить количество">+</button>
|
||||
</form>
|
||||
<form id="cart-decrement-{{ cart_item.id }}" method="post" action="{% url 'orders:update_quantity' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="item_id" value="{{ item.id }}">
|
||||
<input type="hidden" name="quantity" value="{{ cart_item.quantity|add:-1 }}">
|
||||
<input type="hidden" name="next" value="{% url 'orders:cart' %}">
|
||||
<button class="cart-item__remove" type="submit" aria-label="Удалить товар">Удалить</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<form id="cart-remove-{{ cart_item.id }}" method="post" action="{% url 'orders:remove' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="item_id" value="{{ item.id }}">
|
||||
<input type="hidden" name="next" value="{% url 'orders:cart' %}">
|
||||
<button class="cart-item__remove" type="submit" aria-label="Удалить товар">Удалить</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</article>
|
||||
{% endwith %}
|
||||
@@ -94,7 +106,7 @@
|
||||
<form
|
||||
class="checkout-form"
|
||||
method="post"
|
||||
action="{% url 'orders:checkout' %}"
|
||||
action="{% if direct_checkout %}{% url 'orders:buy_now' direct_item.id %}{% else %}{% url 'orders:checkout' %}{% endif %}"
|
||||
data-checkout-form
|
||||
data-products-total="{{ products_total_value|unlocalize }}"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user