-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcart.html
394 lines (337 loc) · 8.84 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Healthmug | Your Gateway to Health</title>
<meta name="theme-color" content="#51c9a6">
<meta name="msapplication-navbutton-color" content="#51c9a6">
<meta name="application-name" content="Healthmug LT">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Healthmug LT">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="apple-touch-icon" sizes="192x192"
href="https://static.oxinis.com/healthmug/image/healthmug/healthmuglogo-192.png">
<link rel="shortcut icon" href="https://static.oxinis.com/healthmug/image/healthmug/healthmuglogo-32.png"
type="image/x-icon">
<link rel="stylesheet" href="https://static.oxinis.com/healthmug/css/healthmug-combined-6a75d3cd87.min.css" />
<style>
.btn, article, body, button, div, form, h1, h2, h3, h4, h5, h6, html, input, label, li, ol, p, span, ul {
font-family: Roboto,sans-serif;
}
.spriteHealthmug {
background-image: url(https://static.oxinis.com/healthmug/css/image/sprite-healthmug.png);
background-repeat: no-repeat;
}
.tooltip {
position: relative;
display: inline-block;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
top: 100%;
left: 50%;
margin-left: -60px;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
.body1{
background-color: #F4F4F4;
}
nav {
background-color: #51C9A6;
height: 24px;
margin-top: 4%;
}
.noLink{
color: #FBFBFB;
padding: 0.84%;
font-size:14px;
}
nav {
display: block;
}
.sideLeft {
width: 15%;
height: 470px;
margin-left: 1%;
background-color: #FFFFFF;
border: 1px solid #FFFFFF;
position: fixed;
}
.tbl {
font-size: 14px;
margin-left: 10%;
margin-top: 1%;
padding: 1%;
}
.tex1{
font-weight: initial;
margin-top: 3%;
margin-left: 3%;
}
hr {
opacity: 0.3;
}
.tx2{
font-weight:600;
font-size: 17px;
margin: 1% 3% 1%;
}
.ul2{
margin: 3% 6%;
font-size: 15px;
}
.ulMain{
margin-left: 9%;
}
.rightBox {
margin-left: 1%;
width: 98%;
height: 72px;
border: 1px solid #FFFFFF;
}
.imgRight {
height: 70px;
width: 33%;
display: inline-block;
margin-left: 0.1%;
/* grid-template-columns: 2% 2% 2%;
grid-gap: 5%;
justify-content: center; */
}
.productSort{
font-size: 15px;
margin: 1% 19%;
}
.productSort1{
font-size: 15px;
margin-left: 1%;
}
.mainBox {
margin-left: 17%;
width: 82%;
height: 200%;
margin-top: 1%;
background-color: #FFFFFF;
background-repeat:unset;
}
#medicine{
margin: 5% 5% 10% 5%;
display: grid;
grid-template-columns: 20% 20% 20% 20%;
grid-gap: 5%;
justify-content: center;
}
.body2{
background-color: #FFFFFF;
}
.cartBox{
width: 80%;
margin: 3% auto;
background-color:#FFFFFF;
}
.smallDiv{
width: 100%;
background-color: #F4F4F4;
}
.small1{
display: inline-block;
width: 40%;
margin-left:3%;
font-size: 15px;
}
.small2 {
display: inline-block;
width: 50%;
margin-left: 2%;
vertical-align: top;
}
.cont1 {
width: 40%;
height: 40px;
background-color: #FFFFFF;
color: #2d2a3e;
border: 1px solid #666666;
cursor: pointer;
opacity: 0.8;
margin-top: 3%;
display: inline-block;
}
.cont2 {
width: 30%;
height: 40px;
background-color: #51C9A6;
font-size: 20px;
color: #fff;
border: none;
cursor: pointer;
opacity: 0.9;
margin-top: 1%;
margin-left: 2%;
display: inline-block;
}
.cont3 {
width: 15%;
height: 20px;
background-color: #51C9A6;
font-size: 12px;
color: #fff;
border: none;
cursor: pointer;
opacity: 0.9;
margin-top: 1%;
margin-left: 2%;
display: inline-block;
}
input {
border: none;
outline: 0;
border-radius: 0;
border-bottom: 1px solid #b7b7b7;
transition: .6s;
}
.a {
background-color: #F4F4F4;
}
</style>
</head>
<body class="body1">
<div>
<div class="wrapper">
<div class="brandName"><a href="Header.html"><img src="https://static.oxinis.com/healthmug/image/healthmug/healthmug-logo.png" alt="Healthmug Logo"></a></div>
<div class="topSearch">
<form action="/search" method="get"><div class="searchBox">
<input type="text" placeholder="Search Products" name="keywords" maxlength="100" autocomplete="off" required />
<button class="btn size-lg btn-healthmug"><i class="fa fa-search"></i></button>
</div>
</form>
</div>
<div class="headerTopRight">
<a href=""><i class="spriteHealthmug contact"></i><span>Contact Us</span></a>
<a href=""><i class="spriteHealthmug sell"></i><span>Sell with us</span></a>
<div class="tooltip">
<div>
<a href="Signup.html"><i class="spriteHealthmug account"></i>
<span>Sign In</span></a>
</div>
<a href="Login.html"><span class="tooltiptext">Log In</span></a>
<div>
</div>
</div><a href="cart.html" id="cartbigbutton" class="cartbutton openCart"><i class="spriteHealthmug" ></i></a>
</div>
</div>
</div>
</div>
<br>
<nav >
<div class="container">
<a href="" class="noLink">Disease</a>
<a class="noLink">Allopathy</a>
<a class="noLink">Homeopathy</a>
<a class="noLink">Ayurveda</a>
<a class="noLink">Unani</a>
<a class="noLink">Nutrition</a>
<a class="noLink">Personal Care</a>
<a class="noLink">Baby Care</a>
<a class="noLink">Sexual wellness</a>
<a class="noLink">Fitness</a>
<a class="noLink">Consultation</a>
</div>
</div>
</nav>
<br>
<div class="rightBox">
<img class="imgRight" src="https://static.oxinis.com/healthmug/image/asset/19-bh-480.png"/>
<img class="imgRight" src="https://static.oxinis.com/healthmug/image/asset/356-ts-480.png"/>
<img class="imgRight" src="https://static.oxinis.com/healthmug/image/asset/655-ec.jpg"/>
</div>
<div class="cartBox">
<h1 style="font-weight:initial;margin: 1% 4%;">Shopping Cart</h1>
<hr>
<div class="product" id="medicine"></div>
<div class="smallDiv">
<div class="small1" >
<p>Safe Buy:100% Money Back Guarantee</p>
<p>Live Easy:15 Days Easy Return Policy</p>
<p>Top Notch:Genuine Products Guarantee</p>
</div>
<div class="small2">
<div >
<div style="margin-top: 1%;">
<span id="add"> <p style="font-size: 14px; margin-top: 2%;">Total</p></span>
</div>
</div>
<p>Delivery Charge<span style="color:#51C9A6;margin-left: 2%;font-weight: bold;">Free</span></p>
<hr>
<div><h2>Grand Total</h2></div><div style="font-size: 20px; font-weight: bolder;" id="add_qunt">₹</div>
<button type="submit" class="cont1"><a href="Product.html" style="font-size: 18px;">Continue Shopping</a></button>
<button type="submit" class="cont2"><a href="Checkout.html"><span style="font-size: 20px;color: #fff;">Place Order</span><i style="color: #fff;" class="fa fa-chevron-right cartbuttonanimate"></i></a></button>
</div>
</div>
</div>
</body>
</html>
<script>
let parent = document.getElementById('medicine');
let cart = JSON.parse(localStorage.getItem("cart"))
console.log(cart);
function showProducts() {
cart.forEach(function (product){
let div = document.createElement("div");
let img = document.createElement("img");
img.src = product.img;
let product_prize = document.createElement("p");
product_prize.textContent = product.price;
product_prize.style.fontSize="20px"
product_prize.style.textAlign="center"
let product_name = document.createElement("p")
product_name.textContent = product.name;
product_name.style.fontSize="15px"
product_name.style.textAlign="center"
let addtocart_btn = document.createElement("button");
addtocart_btn.innerText = "Add to cart";
addtocart_btn.onclick = function () {
addtoCart(product);
};
div.append(img, product_name, product_prize )
parent.append(div);
});
var num = document.createElement("h1");
num.textContent = cart.length;
let added = document.getElementById("add");
added.append(num);
let pr = document.getElementById("pr");
var total = 0;
let total_pr =JSON.parse(localStorage.getItem("cart"));
total_pr.forEach(function(total_pr){
total=total + +total_pr.price;
});
add_qunt.append(total);
console.log(total);
}
function check(e) {
e.preventDefault();
let inp = document.getElementById("input");
let code = inp.promo.value;
let mon = document.getElementById("add_qunt");
if(code==="masai30"){
mon.textContent=mon.textContent * 0.7;
} else {
alert("Please Enter Valid Promo Code")
}
let pro = document.getElementById("promo");
inp.promo.value="";
}
showProducts();
</script>