-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.html
190 lines (172 loc) · 6.29 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
href="https://cdn.jsdelivr.net/npm/remixicon@4.3.0/fonts/remixicon.css"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"
/>
<link rel="stylesheet" href="styles.css" />
<title>Cart | furni.shop</title>
</head>
<body>
<nav>
<div class="nav__header">
<div class="nav__logo">
<a href="index.html" class="logo">furni.shop</a>
</div>
<div class="nav__menu__btn" id="menu-btn">
<i class="ri-menu-line"></i>
</div>
</div>
<ul class="nav__links" id="nav-links">
<li><a href="index.html#home">Home</a></li>
<li><a href="index.html#about">About</a></li>
<li><a href="index.html#product">Products</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="cart.html">Cart</a></li>
</ul>
<div class="nav__search" id="nav-search">
<input type="text" placeholder="Search" />
<span><i class="ri-search-2-line"></i></span>
</div>
</nav>
<section class="cart-container">
<h1>Your Cart</h1>
<div id="cart-items"></div>
<div class="cart-total" id="cart-total"></div>
</section>
<div class="check">
<div id="checkout-container" class="container">
<div class="left-side">
<div class="card">
<div class="card-line"></div>
<div class="buttons"></div>
</div>
<div class="post">
<div class="post-line"></div>
<div class="screen">
<div class="dollar">$</div>
</div>
<div class="numbers"></div>
<div class="numbers-line2"></div>
</div>
</div>
<div class="right-side">
<div class="new">CheckOut</div>
</div>
</div>
</div>
<footer class="footer">
<div class="section__container footer__container">
<div class="footer__col">
<div class="footer__logo">
<a href="index.html" class="logo">furni.shop</a>
</div>
<p>
Join us in transforming your living spaces with furniture that
blends elegance and practicality seamlessly.
</p>
<ul class="footer__socials">
<li>
<a href="#"><i class="ri-facebook-fill"></i></a>
</li>
<li>
<a href="#"><i class="ri-twitter-fill"></i></a>
</li>
<li>
<a href="#"><i class="ri-linkedin-fill"></i></a>
</li>
<li>
<a href="#"><i class="ri-pinterest-fill"></i></a>
</li>
</ul>
</div>
<div class="footer__col">
<h4>Services</h4>
<ul class="footer__links">
<li><a href="contact.html">Contact Us</a></li>
<li><a href="#">Press</a></li>
<li><a href="#">Payrol</a></li>
<li><a href="#">Library</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Help Center</a></li>
</ul>
</div>
<div class="footer__col">
<h4>Resources</h4>
<ul class="footer__links">
<li><a href="#">Pricing</a></li>
<li><a href="#">FAQs</a></li>
<li><a href="#">Contact Support</a></li>
<li><a href="#">Privacy Policy</a></li>
<li><a href="#">Terms</a></li>
</ul>
</div>
<div class="footer__col">
<h4>Support</h4>
<ul class="footer__links">
<li><a href="#">Contact</a></li>
<li><a href="#">Affiliates</a></li>
<li><a href="#">Sitemap</a></li>
<li><a href="#">Cancelation Policy</a></li>
<li><a href="#">Security</a></li>
</ul>
</div>
</div>
</footer>
<script>
// Function to display items in the cart
function displayCartItems() {
const cartItemsContainer = document.getElementById('cart-items');
const cartTotalContainer = document.getElementById('cart-total');
const cartItems = JSON.parse(localStorage.getItem('cartItems')) || [];
cartItemsContainer.innerHTML = '';
let total = 0;
cartItems.forEach(item => {
total += item.price;
const cartItemDiv = document.createElement('div');
cartItemDiv.className = 'cart-item';
cartItemDiv.innerHTML = `
<div class="cart-item-image">
<img src="${item.image}" alt="${item.name}">
</div>
<div class="cart-item-details">
<h3>${item.name}</h3>
<p>Price: $${item.price.toFixed(2)}</p>
</div>
<div class="cart-item-actions">
<button class="btn" onclick="removeItem('${item.name}')">
<p class="paragraph">delete</p>
<span class="icon-wrapper">
<svg class="icon" width="30px" height="30px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6 7V18C6 19.1046 6.89543 20 8 20H16C17.1046 20 18 19.1046 18 18V7M6 7H5M6 7H8M18 7H19M18 7H16M10 11V16M14 11V16M8 7V5C8 3.89543 8.89543 3 10 3H14C15.1046 3 16 3.89543 16 5V7M8 7H16" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</span>
</button>
</div>
`;
cartItemsContainer.appendChild(cartItemDiv);
});
cartTotalContainer.textContent = `Total: $${total.toFixed(2)}`;
}
// Function to remove an item from the cart
function removeItem(name) {
let cartItems = JSON.parse(localStorage.getItem('cartItems')) || [];
cartItems = cartItems.filter(item => item.name !== name);
localStorage.setItem('cartItems', JSON.stringify(cartItems));
displayCartItems();
}
document.getElementById('checkout-container').addEventListener('click', function() {
window.location.href = 'payment.html';
});
// Display cart items on page load
window.onload = displayCartItems;
</script>
</body>
</html>