-
Notifications
You must be signed in to change notification settings - Fork 0
/
cart.html
413 lines (406 loc) · 14.8 KB
/
cart.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
<!--A Design by W3layouts
Author: W3layout
Author URL: http://w3layouts.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title>Surfhouse Cart</title>
<link href="assets/css/bootstrap.css" rel='stylesheet' type='text/css' />
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<!-- Custom Theme files -->
<link href="assets/css/style.css" rel='stylesheet' type='text/css' />
<link href="assets/css/header.css" rel='stylesheet' type='text/css' />
<link href="assets/css/nav-bar.css" rel='stylesheet' type='text/css' />
<link href="assets/css/footer.css" rel='stylesheet' type='text/css' />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--webfont-->
<link href='//fonts.googleapis.com/css?family=Roboto:100,200,300,400,500,600,700,800,900' rel='stylesheet'
type='text/css'>
<script>
$(document).ready(function () {
localStorage.clear();
$.ajax({
url: 'http://localhost:3000/products',
success: function (data) {
var dataProducts = JSON.parse(JSON.stringify(data));
$.ajax({
url: 'http://localhost:3000/cart',
success: function (data) {
var dataCart = JSON.parse(JSON.stringify(data));
dataCart.forEach(function (item) {
var detail = dataProducts.find(temp => temp.id == item.productId);
$("#tdata").append('<tr>'
+ '<td><div class="product-detail">'
+ '<div class="cart-image">'
+ '<img id="cart-image" class="img-responsive" alt="cart image"'
+ 'src="' + detail.imageUrl
+ '"></div><div class="product-desc"><h3 id="title">' + detail.title
+ '</h3><p>The sleek, simple design of this sneaker is elevated by refined detailing</p></div>'
+ '</div></td><td><div class="price_single"><span class="actual" id="unitPrice' + item.id + '">$.' + detail.price
+ '</span></div></td><td><div class="cont1 span_2_of_a1"><div class="buttons_added">'
+ '<input class="minus is-form" onclick="decrease(' + item.id + ');" type="button" value="-">'
+ '<input aria-label="quantity" class="input-qty" max="100" min="0"'
+ 'id="' + item.id + '" name="quantity" type="number" value="' + item.quantity
+ '"><input onclick="increase(' + item.id + ');" class="plus is-form" type="button" value="+">'
+ '</div></div></td><td>'
+ '<div class="price_single"><span class="actual" id="subPrice' + item.id + '">$.' + item.quantity * detail.price
+ '</span><a href="#"><img src="assets/images/close.png" alt="button" onclick="deleteProduct('
+ item.id +')" /></a></div></td></tr>')
})
}
});
for (let i = 0; i < 3; i++) {
$("#alsoLike").append('<div class="col_1_of_3 span_1_of_3">' +
'<div class="view view-first">' +
'<a href="product-page.html?id=' +
data[i].id +
'"><div class="inner_content clearfix">' +
'<div class="product_image">' +
'<img src="' +
data[i].imageUrl +
'" class="img-responsive" alt="description" />' +
'<div class="mask">' +
'<div class="info">Quick View</div>' +
"</div>" +
'<div class="product_container">' +
'<div class="cart-left">' +
'<p class="title">' + data[i].title + '</p></div>' +
'<div class="price">$.' + data[i].price + '</div>' +
'<div class="clearfix"></div>' +
'</div></div></div></a></div>'
);
$("#recentView").append(
'<div class="col_1_of_3 span_1_of_3">' +
'<div class="view view-first">' +
'<a href="product-page.html?id=' +
data[i].id +
'"><div class="inner_content clearfix">' +
'<div class="product_image">' +
'<img src="' +
data[i].imageUrl +
'" class="img-responsive" alt="description" />' +
'<div class="mask">' +
'<div class="info">Quick View</div>' +
"</div>" +
'<div class="product_container">' +
'<div class="cart-left">' +
'<p class="title">' + data[i].title + '</p></div>' +
'<div class="price">$.' + data[i].price + '</div>' +
'<div class="clearfix"></div>' +
'</div></div></div></a></div>'
);
}
}
});
});
var decrease = function (id) {
var result = document.getElementById(id);
var qty = result.value;
if (!isNaN(qty) && qty > 1) result.value--;
return false;
}
var increase = function (id) {
var result = document.getElementById(id);
var qty = result.value;
if (!isNaN(qty)) result.value++;
return false;
}
var deleteProduct = function (id) {
$.ajax({
url: "http://localhost:3000/cart/" + id,
type: "DELETE",
dataType: "json",
success: function (d) {
location.href = "cart.html";
},
error: function () {
alert("Error please try again");
},
});
}
</script>
</head>
<body>
<div class="header" style="background: url(assets/images/surfing4.jpg) no-repeat center top; height: 25rem;">
<div class="container">
<div class="header-top">
<div class="logo">
<a href="index.html"><img src="assets/images/logo.png" alt="" /></a>
</div>
<div class="header_right">
<ul class="social">
<li><a href=""> <i class="fb"> </i> </a></li>
<li><a href=""><i class="tw"> </i> </a></li>
<li><a href=""><i class="utube"> </i> </a></li>
<li><a href=""><i class="pin"> </i> </a></li>
<li><a href=""><i class="instagram"> </i> </a></li>
</ul>
<div class="lang_list">
<select tabindex="4" class="dropdown">
<option value="1" class="label" value="">En</option>
<option value="2">Vi</option>
</select>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="main">
<div class="content_box">
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="menu_box">
<h3 class="menu_head">Menu</h3>
<ul class="nav">
<li><a href="shop-cat-grid.html">About</a></li>
<li><a href="shop-cat-grid.html">Apparel</a></li>
<li><a href="shop-cat-grid.html">Surf Apparel</a></li>
<li><a href="shop-cat-grid.html">Windsurf</a></li>
<li><a href="shop-cat-grid.html">Kitesurf</a></li>
<li><a href="shop-cat-grid.html">Accessories</a></li>
<li><a href="shop-cat-grid.html">Sale</a></li>
<li><a href="shop-cat-grid.html">Brands</a></li>
<li><a href="shop-cat-grid.html">Blog</a></li>
<li><a href="shop-cat-grid.html">Gadgets</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
<div class="category">
<h3 class="menu_head">Category Options</h3>
<ul class="category_nav">
<li><a href="shop-cat-grid.html">Men</a></li>
<li><a href="shop-cat-grid.html">Women</a></li>
<li><a href="shop-cat-grid.html">Kids</a></li>
<li><a href="shop-cat-grid.html">Wetsuits</a></li>
<li><a href="shop-cat-grid.html">Outerwear</a></li>
</ul>
</div>
<div class="category">
<h3 class="menu_head">Brand Options</h3>
<ul class="category_nav">
<li><a href="shop-cat-grid.html">Billabong</a></li>
<li><a href="shop-cat-grid.html">Element</a></li>
<li><a href="shop-cat-grid.html">o'neill</a></li>
<li><a href="shop-cat-grid.html">Oakley</a></li>
<li><a href="shop-cat-grid.html">Reef</a></li>
<li><a href="shop-cat-grid.html">Quiksilver</a></li>
<li><a href="shop-cat-grid.html">Ripcurl</a></li>
<li><a href="shop-cat-grid.html">Jackss</a></li>
</ul>
</div>
<div class="tags">
<h4 class="tag_head">Tags Widget</h4>
<ul class="tags_links">
<li><a href="shop-cat-grid.html">Kitesurf</a></li>
<li><a href="shop-cat-grid.html">Super</a></li>
<li><a href="shop-cat-grid.html">Duper</a></li>
<li><a href="shop-cat-grid.html">Theme</a></li>
<li><a href="shop-cat-grid.html">Men</a></li>
<li><a href="shop-cat-grid.html">Women</a></li>
<li><a href="shop-cat-grid.html">Equipment</a></li>
<li><a href="shop-cat-grid.html">Best</a></li>
<li><a href="shop-cat-grid.html">Accessories</a></li>
<li><a href="shop-cat-grid.html">Men</a></li>
<li><a href="shop-cat-grid.html">Apparel</a></li>
<li><a href="shop-cat-grid.html">Super</a></li>
<li><a href="shop-cat-grid.html">Duper</a></li>
<li><a href="shop-cat-grid.html">Theme</a></li>
<li><a href="shop-cat-grid.html">Responsiv</a></li>
<li><a href="shop-cat-grid.html">Women</a></li>
<li><a href="shop-cat-grid.html">Equipment</a></li>
</ul>
<a href="#" class="link1">View all tags</a>
</div>
<div class="side_banner">
<div class="banner_img"><img src="assets/images/pic9.jpg" class="img-responsive" alt="" />
</div>
<div class="banner_holder">
<h3>Now <br> is <br> Open!</h3>
</div>
</div>
</div>
<div class="col-md-9">
<div class="dreamcrub">
<ul class="breadcrumbs">
<li class="home">
<a href="index.html" title="Go to Home Page">Home</a>
<span>></span>
</li>
<li class="women">
Shopping cart
</li>
</ul>
<ul class="previous">
<li><a href="index.html">Back to Previous Page</a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="sap_tabs" style="margin-bottom: 1.5rem;">
<div id="horizontalTab" style="display: block; width: 100%; margin: 0px;">
<ul class="resp-tabs-list">
<li class="resp-tab-item process-tab-item process-active"><span
class="process-sub-item">1</span><span>SHOPPING CART</span></li>
<li class="resp-tab-item process-tab-item"><span
class="process-sub-item">2</span><span>CHECKOUT</span></li>
<li class="resp-tab-item process-tab-item"><span
class="process-sub-item">3</span><span>ORDER CONFIRMATION</span>
</li>
<div class="clear"></div>
</ul>
</div>
</div>
</div>
<div class="col-md-9">
<div class="col-md-9">
<table class="table" style="font-size: 0.8rem;">
<thead>
<tr">
<th scope="col" style="font-style: italic;">PRODUCT NAME</th>
<th scope="col" style="white-space: nowrap;">UNIT PRICE</th>
<th scope="col">QTY</th>
<th scope="col">SUBTOTAL</th>
</tr>
</thead>
<tbody id="tdata">
</tbody>
</table>
<div class="search-tag">
<div class="search-desc">HAVE YOU GOT A COUPON CODE</div>
<div>
<input type="text" value="INSERT CODE" onFocus="this.value='';"
onblur="if (this.value == '') {this.value = 'INSERT CODE';}">
<button type="button" class="btn btn-primary">UPDATE SHOPPING CART</button>
<a href="index.html">
<p class="search-option">or continue shopping</p>
</a>
</div>
</div>
</div>
<div class="col-md-3 right-bar">
<div class='title-sub'>
<p>Review Your Cart</p>
</div>
<table>
<tbody>
<tr>
<td>YOUR CART</td>
<td>$.1,399.50</td>
</tr>
<tr>
<td>SHIPPING</td>
<td>FREE</td>
</tr>
<tr>
<td>vat</td>
<td>$.112.20</td>
</tr>
<tr>
<td>ORDER TOTAL</td>
<td>$.1,511.70</td>
</tr>
</tbody>
</table>
<button type="button" class="btn btn-primary"
onClick="window.location.href='checkout.html';">CHECKOUT</button>
</div>
</div>
<div class="col-md-9" style="margin-top: 2rem;">
<h3 class="like">You Might Also Like</h3>
<ul id="alsoLike">
</ul>
<h3 class="recent">Recently Viewed</h3>
<ul id="recentView">
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<ul class="footer_social">
<li><a href="#"> <i class="fb"> </i> </a></li>
<li><a href="#"><i class="tw"> </i> </a></li>
<li><a href="#"><i class="pin"> </i> </a></li>
<div class="clearfix"></div>
</ul>
</div>
</div>
<div class="footer">
<div class="container">
<div class="footer-grid">
<h3>Category</h3>
<ul class="list1">
<li><a href="index.html">Home</a></li>
<li><a href="#">About us</a></li>
<li><a href="#">Eshop</a></li>
<li><a href="#">Features</a></li>
<li><a href="#">New Collections</a></li>
<li><a href="#">Blog</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
<div class="footer-grid">
<h3>Our Account</h3>
<ul class="list1">
<li><a href="#">Your Account</a></li>
<li><a href="#">Personal information</a></li>
<li><a href="#">Addresses</a></li>
<li><a href="#">Discount</a></li>
<li><a href="#">Orders history</a></li>
<li><a href="#">Addresses</a></li>
<li><a href="#">Search Terms</a></li>
</ul>
</div>
<div class="footer-grid">
<h3>Our Support</h3>
<ul class="list1">
<li><a href="#">Site Map</a></li>
<li><a href="#">Search Terms</a></li>
<li><a href="#">Advanced Search</a></li>
<li><a href="#">Mobile</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Mobile</a></li>
<li><a href="#">Addresses</a></li>
</ul>
</div>
<div class="footer-grid">
<h3>Newsletter</h3>
<p class="footer_desc">Join thousands of other subscribe to our news</p>
<div class="search_footer">
<form>
<input type="text" class="text" value="Insert Email" onfocus="this.value = '';"
onblur="if (this.value == '') {this.value = 'Insert Email';}">
<input type="submit" value="Submit">
</form>
</div>
<img src="assets/images/payment.png" class="img-responsive" alt="" />
</div>
<div class="footer-grid footer-grid_last">
<h3>About Us</h3>
<p class="footer_desc">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo
liqula
eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. Donec quam felis, ultricies nec, pelientesque eu, pretium quis, sem.</p>
<p class="f_text">Phone: 1-999-342-9876</p>
<p class="email">Email: <span><a
href="mailto@example.com">info@Surfhouse.com</a></span></p>
</div>
<div class="clearfix"> </div>
</div>
</div>
<div class="footer_bottom">
<div class="container">
<div class="copy">
<p>Copyright © 2014 Surfhouse . All Rights Reserved</p>
</div>
</div>
</div>
</body>
</html>