/
complete.html
74 lines (62 loc) · 2.3 KB
/
complete.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{% extends "shop/base.html" %}
{% load i18n %}
{% block body_id %}complete{% endblock %}
{% block meta_title %}{% trans "Order Complete" %}{% endblock %}
{% block footer_js %}
{{ block.super }}
{% if settings.GOOGLE_ANALYTICS_ID and not request.user.is_staff %}
<script>
var decimal = function(amount) {
if (amount.toString().indexOf('.') == -1) {
amount += '.00';
}
return String(amount);
};
ga('require', 'ecommerce'); // Load the ecommerce plug-in.
// Add transaction data.
ga('ecommerce:addTransaction', {
'id': '{{ order.id }}',
'affiliation': '',
'revenue': decimal({{ order.item_total }}{% if order.discount_total %} - {{ order.discount_total }}{% endif %}),
'shipping': decimal({{ order.shipping_total }}),
'tax': decimal({% if order.tax_total %}{{ order.tax_total }}{% else %}0{% endif %})
});
// Add item data for each item.
{% for item in items %}
ga('ecommerce:addItem', {
// order ID (not item)
'id': '{{ order.id }}',
'name': '{{ item.name|escapejs }}',
'sku': '{{ item.sku }}',
'category': '{{ item.description|escapejs }}',
// unit price (not total)
'price': decimal({{ item.unit_price }}),
'quantity': '{{ item.quantity }}'
});
{% endfor %}
// submits transaction to the Analytics servers
ga('ecommerce:send');
</script>
{% endif %}
{% endblock %}
{% block title %}{% trans "Order Complete" %}{% endblock %}
{% block breadcrumb_menu %}
{% for step in steps %}
<li>{{ step.title }}</li>
{% endfor %}
<li><strong>{% trans "Complete" %}</strong></li>
{% endblock %}
{% block main %}
<p>{% trans "Thank you for shopping with us! Your order is complete." %}</p>
<p>{% trans "We've sent you a receipt via email." %}</p>
<p>{% trans "You can also view your invoice using one of the links below." %}</p>
<br>
<form class="order-complete-form" method="post" action="{% url "shop_invoice_resend" order.id %}?next={{ request.path }}">
{% csrf_token %}
{% if has_pdf %}
<a class="btn btn-primary" href="{% url "shop_invoice" order.id %}?format=pdf">{% trans "Download PDF invoice" %}</a>
{% endif %}
<a class="btn btn-default" target="_blank" href="{% url "shop_invoice" order.id %}">{% trans "View invoice in your browser" %}</a>
<input type="submit" class="btn btn-default" value="{% trans "Re-send order email" %}">
</form>
{% endblock %}