-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallProducts.html
137 lines (130 loc) · 6.38 KB
/
allProducts.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
{% extends 'base.html' %}
<!-- Title Page -->
<!-- <section class="bg-title-page p-t-50 p-b-40 flex-col-c-m" style="background-image: url(images/heading-pages-02.jpg);">
<h2 class="l-text2 t-center">
Women
</h2>
<p class="m-text13 t-center">
New Arrivals Women Collection 2018
</p>
</section> -->
{% block title %}
Home
{% endblock %}
<!-- Content page -->
{% block section %}
<section class="bgwhite p-t-55 p-b-65">
<div class="container">
{% if 'No' in all_goods %}
<b>{{ all_goods }}</b>
{% else %}
<div class="row">
<div class="col-sm-6 col-md-4 col-lg-3 p-b-50">
<div class="leftbar p-r-20 p-r-0-sm">
<!-- <div class="search-product pos-relative bo4 of-hidden">
<form action="{{ url_for('search') }}" method="POST">
<input class="s-text7 size6 p-l-23 p-r-50" type="text" name="search-product"
placeholder="Search Products...">
<button class="flex-c-m size5 ab-r-m color2 color0-hov trans-0-4">
<i class="fs-12 fa fa-search" aria-hidden="true"></i>
</button>
</form>
</div> -->
</div>
</div>
<div class="col-sm-6 col-md-8 col-lg-9 p-b-50">
<!-- -->
<div class="flex-sb-m flex-w p-b-35">
<span class="s-text8 p-t-5 p-b-5">
Showing 1 –
{% if length > 6 %}
6
{% else %}
{{ length }}
{% endif %}
of
{{ length }} results
</span>
</div>
<!-- Product -->
<div class="row">
{% for goods in all_goods %}
<div class="col-sm-12 col-md-6 col-lg-4 p-b-50">
<!-- Block2 -->
<div class="block2">
<div class="block2-img wrap-pic-w of-hidden pos-relative block2-labelnew">
<img src="{{ url_for('static', filename='img/'+goods.image) }}" alt="IMG-PRODUCT">
<div class="block2-overlay trans-0-4">
<a href="#" class="block2-btn-addwishlist hov-pointer trans-0-4">
<i class="icon-wishlist icon_heart_alt" aria-hidden="true"></i>
<i class="icon-wishlist icon_heart dis-none" aria-hidden="true"></i>
</a>
<div class="block2-btn-addcart w-size1 trans-0-4" id="{{ goods.id }}">
<!-- Button -->
<button class="flex-c-m size1 bg4 bo-rad-23 hov1 s-text1 trans-0-4">
Add to Cart
</button>
</div>
</div>
</div>
<div class="block2-txt p-t-20">
<a href="#" class="block2-name dis-block s-text3 p-b-5">
{{ goods.name }}
</a>
<span class="block2-price m-text6 p-r-5">
{{ goods.quantity }} Items left
${{ goods.price }}.00
</span>
</div>
</div>
</div>
{% endfor %}
</div>
<!-- Pagination -->
<div class="pagination flex-m flex-w p-t-26">
<a href="#" class="item-pagination flex-c-m trans-0-4 active-pagination">1</a>
{% if length > 6 %}
<a href="#" class="item-pagination flex-c-m trans-0-4">2</a>
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
</section>
{% endblock %}
{% block js %}
<script type="text/javascript" src="{{ url_for('static', filename='vendor/daterangepicker/moment.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='vendor/daterangepicker/daterangepicker.js') }}"></script>
<!--===============================================================================================-->
<script type="text/javascript" src="{{ url_for('static', filename='vendor/slick/slick.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/slick-custom.js') }}"></script>
<!--===============================================================================================-->
<script type="text/javascript" src="{{ url_for('static', filename='vendor/sweetalert/sweetalert.min.js') }}"></script>
<script type="text/javascript">
var itemsArray = localStorage.getItem('items') ? JSON.parse(localStorage.getItem('items')) : [];
$('.block2-btn-addcart').each(function () {
var nameProduct = $(this).parent().parent().parent().find('.block2-name').html();
$(this).on('click', function () {
$.getJSON(window.location.protocol + '//' + document.domain + ':' + window.location.port +
'/add_to_cart', {
id: this.id
},
function (data) {
if (data.response === 'success') {
for (i = 0; i < itemsArray.length; i++) {
if (itemsArray[i].indexOf(data.id) !== -1) {
console.log('exits')
swal(nameProduct, "is already in cart !.");
return
}
}
itemsArray.push([data.id, data.name, data.quantity, data.price, data.image]);
localStorage.setItem('items', JSON.stringify(itemsArray));
swal(nameProduct, "is added to cart !", "success");
}
});
});
});
</script>
{% endblock %}