-
Notifications
You must be signed in to change notification settings - Fork 0
/
UID_Proj_Pet_Food_2.html
232 lines (211 loc) · 5.38 KB
/
UID_Proj_Pet_Food_2.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
<!DOCTYPE HTML>
<html>
<head>
<link rel="icon" href="logo.jpeg" >
<meta name="viewport" content="width=device-width">
<title>PawStop | Pet Food Shop </title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f2f2f2;
}
header {
background-color: #333;
color: #fff;
padding: 10px 0;
text-align: center;
}
nav {
background-color: #444;
color: #fff;
overflow: hidden;
}
nav a {
float: left;
display: block;
color: #fff;
text-align: center;
padding: 14px 20px;
text-decoration: none;
}
nav a:hover {
background-color: #ddd;
color: #000;
}
.menu a {
color: #fff;
text-decoration: none;
margin-right: 10px;
}
.container {
display: grid;
grid-template-columns: 3fr 1fr;
gap: 20px;
margin: 20px;
}
.products {
display: flex;
gap: 20px;
padding: 20px;
flex-wrap: wrap;
background-color: #fff;
border: 1px solid #ccc;
}
.product {
flex: 1;
border: 1px solid #ccc;
padding: 20px;
}
.product button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
.product button:hover {
background-color: #45a049;
}
.cart {
width: 400px;
padding: 20px;
background-color: #fff;
border: 1px solid #ccc;
}
.cart h2 {
margin-top: 0;
}
.cart-item {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
.cart-item button {
background-color: #f44336;
color: white;
padding: 5px 10px;
border: none;
border-radius: 4px;
cursor: pointer;
}
.cart-item button:hover {
background-color: #d32f2f;
}
.pay-now {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
width: 100%;
}
.pay-now:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<header>
<h1>Pet Foodstore</h1>
</header>
<nav>
<a href="main_page.html">Home</a>
<a href="joinus.html">About Us</a>
<a href="adopt.html">Adopt a Pet</a>
<a href="UID_Proj_GiveUpPet_2.html">Give Up a Pet</a>
<a href="Great.html">Training Programs</a>
<a href="Peteventandactivities.html">Events & Activities</a>
<a href="UID_Proj_Pet_Food_2.html">Buy Food</a>
<a href="UID_Proj_Pet_Accessories_2.html">Buy Accessories</a>
<a href="vet-entry.html">Call a Vet</a>
<a href="signin.html">Sign In</a>
<a href="signup.html">Sign Up</a>
</nav>
<h2 align="center">Food Store</h2>
<div class="container">
<div class="products">
<div class="product">
<img src="pedigreepetfood.jpeg" width="350" height="400" />
<h2>Pedigree:Steak & Vegetables</h2>
<p>Price: $25</p>
<button onclick="addToCart('Pedigree:Steak & Vegetables', 25)">Add to Cart</button>
</div>
<div class="product">
<img src="ruskdogfood.jpeg" width="350" height="300"/>
<h2>Rusk:Biscuits</h2>
<p>Price: $20</p>
<button onclick="addToCart('Rusk:Biscuits', 20)">Add to Cart</button>
</div>
<div class="product">
<img src="droolschickenliver.jpeg" width="350" height="250" />
<h2>Drools:Chicken Liver Chunks</h2>
<p>Price: $15</p>
<button onclick="addToCart('Drools:Chicken Liver Chunks', 15)">Add to Cart</button>
</div>
<div class="product">
<img src="petstarmilkwheat.jpeg" width="350" height="400" />
<h2>Petstar:Milk and Wheat</h2>
<p>Price: $20</p>
<button onclick="addToCart('Petstar:Milk and Wheat', 20)">Add to Cart</button>
</div>
<div class="product">
<img src="pedigreechickenjerky.jpeg" width="350" height="400" />
<h2>Pedigree:Barbecued Chicken Jerky </h2>
<p>Price: $25</p>
<button onclick="addToCart('Pedigree:Barbecued Chicken Jerky', 25)">Add to Cart</button>
</div>
<div class="product">
<img src="purepetvegbiscuits.jpeg" width="350" height="400" />
<h2>PurePet: 100% Vegetarian Biscuits</h2>
<p>Price: $35</p>
<button onclick="addToCart('PurePet:100% Veg Biscuits', 20)">Add to Cart</button>
</div>
<!-- Add more products as required -->
</div>
<div class="cart">
<h2>Shopping Cart</h2>
<div id="cartItems"></div>
<p id="totalPrice">Total: $0</p>
<button class="pay-now" onclick="payNow()">Pay Now</button>
</div>
</div>
<script>
let cart = [];
function addToCart(itemName, itemPrice) {
cart.push({ name: itemName, price: itemPrice });
updateCart();
}
function removeFromCart(index) {
cart.splice(index, 1);
updateCart();
}
function updateCart() {
const cartItems = document.getElementById('cartItems');
cartItems.innerHTML = '';
let total = 0;
cart.forEach((item, index) => {
total += item.price;
cartItems.innerHTML += `
<div class="cart-item">
<span>${item.name}: $${item.price}</span>
<button onclick="removeFromCart(${index})">Remove</button>
</div>
`;
});
document.getElementById('totalPrice').textContent = `Total: $${total}`;
}
function payNow() {
if (cart.length === 0) {
alert('Your cart is empty!');
} else {
alert('Proceeding to payment');
// Here you can add your payment logic
}
}
</script>
</body>
</html>