-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
145 lines (143 loc) · 4.94 KB
/
index.php
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
<?php
session_start();
include("admin/confs/config.php");
$cart = 0;
if(isset($_SESSION['cart'])){
foreach($_SESSION['cart'] as $qty){
$cart += $qty;
}
}
if(isset($_GET['cat'])){
$cat_id = $_GET['cat'];
$plants = mysqli_query($conn, "SELECT * FROM plants WHERE category_id = $cat_id");
}else{
$plants = mysqli_query($conn, "SELECT * FROM plants");
}
$cats = mysqli_query($conn, "SELECT * FROM categories");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Plants Store</title>
<link href="https://fonts.googleapis.com/css2?family=EB+Garamond&family=Limelight&family=Playfair+Display&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<style>
.navbar-brand{
font-family: 'Limelight', cursive;
font-size: 30px;
}
a{
color: black;
text-decoration: none;
}
a:hover{
color: black;
text-decoration: none;
}
.sidebar {
float: left;
width: 240px;
}
.cats {
list-style: none;
padding: 10px;
}
.cats li a {
display: block;
font-size: 15px;
padding: 8px 15px;
border-bottom: 1px solid #ddd;
}
.cats li a:hover {
background: #efefef;
}
.card-price{
color: gray !important;
font-family: 'EB Garamond', serif;
}
.footer {
clear: both;
color: #fff;
font-size: 13px;
padding: 8px;
text-align: center;
border-top: 1px solid #7F8C8D;
left: 0;
bottom: 0;
width: 100%;
}
.card{
margin-top: 20px;
border: none;
}
.btn{
border-radius: 0;
}
i{
font-size: 25px !important;
margin-right: 10px;
}
.card-title{
font-family: 'EB Garamond', serif;
text-transform: uppercase;
}
.btn{
font-family: 'Playfair Display', serif; }
</style>
<body>
<nav class="navbar sticky-top navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">PLNTS</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a href="view-cart.php" class="nav-link"><i class="fa fa-shopping-cart"></i><span><?php echo $cart ?></span></a>
</li>
</ul>
</div>
</nav>
<div class="sidebar">
<ul class="cats">
<li>
<b><a href="index.php">All Categories</a></b>
</li>
<?php while($row = mysqli_fetch_assoc($cats)): ?>
<li>
<a href="index.php?cat=<?php echo $row['id'] ?>">
<?php echo $row['name'] ?>
</a>
</li>
<?php endwhile; ?>
</ul>
</div>
<div class="main row">
<?php while($row = mysqli_fetch_assoc($plants)): ?>
<div class="card col-md-3">
<img src="admin/plants/<?php echo $row['plant_img'] ?>" class="card-img-top" alt="..." style="margin-top: 5px">
<div class="card-body">
<h6 class="card-title dark" align="center"><?php echo $row['product_name'] ?></h6>
<h6 class="card-price" align="center">US $<?php echo $row['price'] ?></h6>
<div class="multi-button" align="center">
<a href="plant-detail.php?id=<?php echo $row['id'] ?>" class="btn btn-outline-dark">View Detail</a>
<a href="add-to-cart.php?id=<?php echo $row['id'] ?>" class="btn btn-outline-dark">Add to Cart</a>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
<div class="footer bg-dark">
© Copyright <?php echo date("Y") ?>. All right reserved.
</div>
</body>
</html>