-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfavorite.html
165 lines (160 loc) · 6.81 KB
/
favorite.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
<!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">
<script src="https://www.w3schools.com/lib/w3.js"></script>
<link rel="stylesheet" href="./css/favorite.css">
<link rel="stylesheet" href="./css/header.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Tangerine">
<link rel="icon" type="image/x-icon" href="./library/logoko-01.png">
<link rel="stylesheet" href="./css/style.css">
<script src="https://kit.fontawesome.com/09f1ff1e12.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons+Outlined">
<script src="https://www.w3schools.com/lib/w3.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript" ></script>
<title>Shopping Cart</title>
<style>
.btn_add-to-cart {
padding: 15px;
background-color: palevioletred;
color: white;
font-weight: 700;
font-size: 18px;
position: relative;
cursor: pointer;
line-height: 1;
text-align: center;
white-space: nowrap;
box-sizing: border-box;
touch-action: manipulation;
user-select: none;
border: 0;
/* border-radius: 40px; */
margin-top: 20px;
width: 250px;
display: block;
}
.btn_add-to-cart:hover {
background-color: white;
color: palevioletred;
outline: 1px solid palevioletred;
outline-offset: -1px;
}
.scenter {
display: block;
justify-content: center;
align-items: center;
height: 120px;
}
.module-header {
display: block;
justify-content: center;
text-align: center;
}
</style>
</head>
<body>
<!-- <header>
<div class="overlay"></div>
<nav>
<h2>SHOP</h2>
<ul>
<li><a href="demotrangsanpham.html">Home</a></li>
<li class="cart">
<a href="demotranggiohang.html">
<ion-icon name="basket"></ion-icon>Cart<span>0</span>
</a>
</li>
</ul>
</nav>
</header> -->
<!-- <div w3-include-html="demotrangheader.html"></div> -->
<div id="header"></div>
<script>
load("header.html");
function load(url)
{
req = new XMLHttpRequest();
req.open("GET", url, false);
req.send(null);
document.getElementById("header").innerHTML = req.responseText;
}
</script>
<div class="favorite-container">
<div class="favorite-header">
<h5 class="favorite-title">SẢN PHẨM YÊU THÍCH</h5>
<!-- <h5 class="favorite-attribute">THUỘC TÍNH</h5> -->
<!-- <h5 class="price">ĐƠN GIÁ</h5> -->
<!-- <h5 class="quantity">SỐ LƯỢNG</h5> -->
<!-- <h5 class="total">TÍNH TIỀN</h5> -->
</div>
<div class="favorite-items">
</div>
</div>
<div style="height:300px" class="favoriteTrong">
<div style="text-align: center;" class="module-header scenter">
<br>
<h1 style="margin-top:20px">SẢN PHẨM YÊU THÍCH</h1>
<br>
<hr style="width:50%; margin:auto; background-color:black; height:2px; border: 1px solid white; border-radius: 5px;"/>
<br>
<p>Bạn chưa có sản phẩm yêu thích</p>
</div>
<a style="margin-left:auto;margin-right:auto;display:block; margin-top:50px" class="btn_add-to-cart" href="Dog-Product.html">QUAY LẠI MUA HÀNG</a>
</div>
<div id="footer"></div>
<script>
load("footer.html");
function load(url)
{
req = new XMLHttpRequest();
req.open("GET", url, false);
req.send(null);
document.getElementById("footer").innerHTML = req.responseText;
}
</script>
<script src="./js/demogiohang.js"></script>
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script>
<script>
let cartItemsx = localStorage.getItem("favoriteProducts");
cartItemsx = JSON.parse(cartItemsx);
let productContainerx = document.querySelector(".favorite-items");
// let productContainerInPayment = document.querySelector(".cart");
// let productContainer=document.querySelectorAll(".products");
// let cartCost = localStorage.getItem('totalCost');
// console.log(cartItems);
if (cartItemsx && productContainerx) {
let productContainer2x = document.querySelector(".favoriteTrong");
productContainer2x.style.display="none";
productContainerx.innerHTML = '';
// productContainerInPayment.innerHTML = '';
Object.values(cartItemsx).map(item => {
productContainerx.innerHTML += '<div class="favorite-item"><ion-icon name="close-circle-outline"></ion-icon><img src="'+item.image+'" onclick="gotoChiTiet(' + item.productid + ')" onmouseover="" style="cursor: pointer;"><span>'+item.name+'</span></div>';
});
// productContainer.innerHTML += '<div class="basketTotalContainer"><h4 class="basketTotalTitle">TỔNG CỘNG</h4><h4 class="basketTotal">'+formatNumber(cartCost)+'đ</h4></div><a style="margin-left:auto;margin-right:auto;display:block" class="btn_add-to-cart" href="Dog-Product.html">TIẾP TỤC MUA SẮM</a><a style="margin-left:auto;margin-right:auto;display:block" class="btn_add-to-cart" href="payment.html">THANH TOÁN</a>';
// Object.values(cartItems).map(item => {
// productContainerInPayment.innerHTML += '<div class="cart_row"><span class="quantity">'+item.quantity+' x</span><img src="'+item.image+'" alt=""><div class="cart_row-name"><span class="product">'+item.name+'</span><span class="modifier">Size 15 lb</span></div><span class="price">'+item.price+' VND</span></div>';
// });
}
else{
let productContainer2x = document.querySelector(".favorite-container");
productContainer2x.style.display="none";
}
w3.includeHTML();
</script>
<!-- js mở chatbox và quay về đầu trang -->
<script src="./js/chatBox&returnTop-btn.js"></script>
<!-- js khi kéo xuống thì hiện 1 thanh nav cố định ở đầu trang web -->
<script src="./js/flat-menu.js"></script>
<!-- js xổ ra các mục nhỏ của footer khi trình duyệt thu nhỏ -->
<script src="./js/footer.js"></script>
<script src="./js/searchHeader.js"></script>
<script src="./js/searchdetails.js"></script>
<script src="./js/products_detail.js"></script>
<script src="./js/searchMobile.js"></script>
</body>
</html>