-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingleProductView.php
More file actions
228 lines (160 loc) · 11.8 KB
/
singleProductView.php
File metadata and controls
228 lines (160 loc) · 11.8 KB
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
<?php
include "connection.php";
if (isset($_GET["id"])) {
$product_id = $_GET["id"];
$product_rs = Database::search("SELECT * FROM `product`
INNER JOIN `menu_has_menu_type` ON `product`.`menu_has_menu_type_menu_has_menu_type_id` = `menu_has_menu_type`.`menu_has_menu_type_id`
INNER JOIN `menu` ON `menu_has_menu_type`.`menu_menu_id` = `menu`.`menu_id`
INNER JOIN `shop` ON `product`.`shop_shop_email` = `shop`.`shop_email`
WHERE `product`.`id` = '" . $product_id . "'");
if ($product_rs->num_rows == 1){
$product_data = $product_rs->fetch_assoc();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Food Mart</title>
<link rel="stylesheet" href="css/bootstrap.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
<link rel="stylesheet" href="css/style.css" />
<link rel="shortcut icon" href="img/logo/FOOD MART.png">
</head>
<body>
<div class="container-fluid">
<div class="row">
<?php include "header.php"; ?>
<div class="col-12 mt-5 singleProduct mt-5">
<div class="row">
<div class="col-12" style="padding:30px;">
<div class="row">
<div class="col-4 bg-dark-subtle col-lg-6 order-lg-1 border border-3 rounded my-5">
<div class="row">
<?php
$img_rs = Database::search("SELECT * FROM `product_img` WHERE `product_id` = '".$product_id."' ");
$img_num = $img_rs->num_rows;
if($img_num != 0){
for($x = 0; $x < $img_num; $x++){
$img_data = $img_rs->fetch_assoc();
?>
<img src="<?php echo $img_data["img_path"]; ?>" alt="">
<?php
}
}else{
?>
<img src="img/banner/noodles.png" alt="">
<?php
}
?>
</div>
</div>
<div class="col-12 p-5 col-lg-6 order-3">
<div class="row p-5">
<div class="col-12">
<div class="row">
<strong><a href="home.php" class="text-decoration-none">Home </a> / Single Product View </strong>
</div>
<div class="row mt-3">
<strong class="fs-2"><?php echo $product_data["title"]; ?></strong>
</div>
<div class="row mt-2">
<div class="col-12 my-2">
<span class="badge">
<i class="bi bi-star-fill text-warning fs-5"></i>
<i class="bi bi-star-fill text-warning fs-5"></i>
<i class="bi bi-star-fill text-warning fs-5"></i>
<i class="bi bi-star-fill text-warning fs-5"></i>
<i class="bi bi-star-half text-warning fs-5"></i>
</span>
</div>
</div>
<?php
$price = $product_data["price"];
$adding_price = ($price/100)*75;
$new_price = $adding_price;
?>
<div class="row mt-2">
<div class="col-12 my-2">
<strong class="text-danger fw-bold text-decoration-line-through">Rs.<?php echo $price; ?>.00</strong>
|
<strong class="text-dark">Rs.<?php echo $new_price ?>.00</strong>
|
<span class="fw-bold text-black-50">Save Rs.150.00 (25%)</span>
</div>
</div>
<div class="row mt-2">
<div class="col-12 my-2">
<strong class="fs-5"><b>In Stock : <?php echo $product_data["qty"]; ?> Items Available</strong>
</div>
</div>
<div class="row mt-2">
<div class="col-12 my-2">
<div class="row">
<div class="col-10 col-lg-5">
<small class="fs-6"><b>Seller : <?php echo $product_data["shop_name"]; ?> </small>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="row">
<div class="col-12 my-2">
<div class="row g-2">
<div class="border border-1 border-secondary mt-1 position-relative product-qty">
<div class="col-12">
<span>Quantity : </span>
<input type="text" onkeyup="checkQty(<?php echo $product_data['qty']; ?>);" class="border-0 fs-5 fw-bold text-start" style="outline: none;" pattern="[0-9]" value="1" id="qty_input" />
<div class="position-absolute top-0 qty-buttons">
<div class="justify-content-center d-flex flex-column align-items-center qty-inc">
<i class='bx bi-caret-up-fill' onclick="qty_increase(<?php echo $product_data['qty']; ?>);"></i>
</div>
<div class="justify-content-center d-flex flex-column align-items-center qty-dec">
<i class="bx bi-caret-down-fill" onclick="qty_dicrease(<?php echo $product_data['qty']; ?>);"></i>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-12 mt-2">
<div class="row">
<div class="col-sm-5">
<button type="submit" class="buy-now" id="payhere-payment" onclick="buyNow(<?php echo $product_id;?>);">Buy Now</button>
</div>
<div class="col-sm-5">
<button class="add-to-cart text-decoration-none" onclick="addToCart('<?php echo $product_data['id']; ?>','<?php echo $product_data['qty']; ?>');"><i class='bx bxs-cart-alt text-dark'></i> Add To Cart</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- <script src="js/bootstrap.bundle.js"></script> -->
<script src="js/script.js"></script>
<script src="https://unpkg.com/boxicons@2.1.4/dist/boxicons.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script type="text/javascript" src="https://www.payhere.lk/lib/payhere.js"></script>
</body>
</html>
<?php
}else {
echo "<p>Sorry, this product is not available.</p>";
}
} else {
echo ("Please select a product first");
}
?>