Improve Eboutic basket

This commit is contained in:
Skia
2016-07-26 19:39:19 +02:00
parent c099f1c5d7
commit 45f5a58b4a
6 changed files with 101 additions and 67 deletions

View File

@ -22,13 +22,12 @@
<div id="basket">
<p>{% trans %}Basket: {% endtrans %}</p>
<ul>
{% for id,infos in request.session['basket']|dictsort %}
{% set product = eboutic.products.filter(id=id).first() %}
{% set s = infos['qty'] * infos['price'] / 100 %}
<li>{{ del_product(id, '-') }} {{ infos['qty'] }} {{ add_product(id, '+') }} {{ product.name }}: {{ "%0.2f"|format(s) }} €</li>
{% for i in basket.items.all()|sort(attribute='id') %}
<li>{{ del_product(i.product_id, '-') }} {{ i.quantity }}
{{ add_product(i.product_id, '+') }} {{ i.product_name }}: {{ "%0.2f"|format(i.product_unit_price*i.quantity) }} €</li>
{% endfor %}
</ul>
<p><strong>{% trans %}Total: {% endtrans %}{{ "%0.2f"|format(basket_total) }} €</strong></p>
<p><strong>{% trans %}Total: {% endtrans %}{{ "%0.2f"|format(basket.get_total()) }} €</strong></p>
<form method="post" action="{{ url('eboutic:command') }}">
{% csrf_token %}
<input type="submit" value="{% trans %}Proceed to command{% endtrans %}" />

View File

@ -23,17 +23,22 @@
{% endfor %}
<tbody>
</table>
<p><strong>Total: </strong>{{ basket.get_total() }} €</p>
<form method="post" action="{{ settings.SITH_EBOUTIC_ET_URL }}">
{% for (field_name,field_value) in et_request.items() -%}
<input type="hidden" name="{{ field_name }}" value="{{ field_value }}">
{% endfor %}
<input type="submit" value="{% trans %}Pay with credit card{% endtrans %}" />
</form>
{% if basket.items.filter(type="REFILLING").exists() %}
<p>{% trans %}AE account payment disabled because your basket contains refilling items.{% endtrans %}</p>
{% else %}
<form method="post" action="{{ url('eboutic:pay_with_sith') }}">
{% csrf_token %}
<input type="hidden" name="action" value="pay_with_sith_account">
<input type="submit" value="{% trans %}Pay with Sith account{% endtrans %}" />
</form>
{% endif %}
</div>
{% endblock %}

View File

@ -9,6 +9,7 @@
{% else %}
{% trans %}Payment successful{% endtrans %}
{% endif %}
<p><a href="{{ url('eboutic:main') }}">{% trans %}Return to eboutic{% endtrans %}</a></p>
</div>
{% endblock %}