Repository navigation
Expand file tree
/
Copy pathhome.php
More file actions
58 lines (57 loc) · 2.76 KB
/
Copy pathhome.php
File metadata and controls
58 lines (57 loc) · 2.76 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
<!-- Header-->
<header class="bg-dark py-5" id="main-header">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Your Pets Deserve The Best</h1>
<p class="lead fw-normal text-white-50 mb-0">Looking for your pet's needs? Shop Now!</p>
</div>
</div>
</header>
<!-- Section-->
<section class="py-5">
<div class="container px-4 px-lg-5 mt-5">
<div class="row gx-4 gx-lg-5 row-cols-md-3 row-cols-xl-4 justify-content-center">
<?php
$products = $conn->query("SELECT * FROM `products` where status = 1 order by rand() limit 8 ");
while($row = $products->fetch_assoc()):
$upload_path = base_app.'/uploads/product_'.$row['id'];
$img = "";
if(is_dir($upload_path)){
$fileO = scandir($upload_path);
if(isset($fileO[2]))
$img = "uploads/product_".$row['id']."/".$fileO[2];
// var_dump($fileO);
}
$inventory = $conn->query("SELECT * FROM inventory where product_id = ".$row['id']);
$inv = array();
while($ir = $inventory->fetch_assoc()){
$inv[$ir['size']] = number_format($ir['price']);
}
?>
<div class="col mb-5">
<div class="card h-100 product-item">
<!-- Product image-->
<img class="card-img-top w-100" src="<?php echo validate_image($img) ?>" alt="..." />
<!-- Product details-->
<div class="card-body p-4">
<div class="text-center">
<!-- Product name-->
<h5 class="fw-bolder"><?php echo $row['product_name'] ?></h5>
<!-- Product price-->
<?php foreach($inv as $k=> $v): ?>
<span><b><?php echo $k ?>: </b><?php echo $v ?></span>
<?php endforeach; ?>
</div>
</div>
<!-- Product actions-->
<div class="card-footer p-4 pt-0 border-top-0 bg-transparent">
<div class="text-center">
<a class="btn btn-flat btn-primary " href=".?p=view_product&id=<?php echo md5($row['id']) ?>">View</a>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</section>