-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct.php
135 lines (123 loc) · 6.43 KB
/
product.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
<?php
include 'main.php';
$currentProduct = $_GET['id'];
$stmt = $con->prepare('SELECT id, name, price, isOnSale, img, description, manufactur, type, saleValue, dateCreated FROM products WHERE id = ?');
$stmt->bind_param('s', $currentProduct);
$stmt->execute();
$stmt->bind_result($id, $name, $price, $isOnSale, $img, $description, $manufactur, $type, $saleValue, $dateCreated);
$stmt->fetch();
$stmt->close();
$stmt = $con->prepare('SELECT * FROM products WHERE type = ? ORDER BY RAND()
LIMIT 6');
$stmt->bind_param('s', $type);
$stmt->execute();
$result = $stmt->get_result();
$recommendedProducts = $result->fetch_all(MYSQLI_ASSOC);
$stmt->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<title>Document</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="//use.fontawesome.com/releases/v5.0.7/css/all.css">
</head>
<body>
<?php include 'nav.php';?>
<main class="d-flex justify-content-center">
<div class=" shadow col-7 pt-5 mt-5" style="background-color: ghostWhite; min-height: 100vh">
<div class="d-flex flex-wrap mt-4">
<div class="border-bottom w-100"></div>
<div class="w-100">
<div>
<h3 class="m-3"><?= $name?></h3>
<h5 class=" ml-3 text-secondary"><?= $manufactur?></h5>
<p class=" ml-3 text-secondary"><?= $manufactur . $id . $dateCreated?></p>
</div>
<div class="d-flex justify-content-between w-100">
<img class="ml-3" id="productImg" src="<?= $img?>">
<div id="productBuyMenu" class="col-4 rounded">
<h4 class="m-2"><?= $price ?>.00$</h4>
<p class="rounded">FREE SHIPPING</p>
<p><i class="fas fa-check"></i>30 day open purchase</p>
<p><i class="fas fa-check"></i>Free return</p>
<p><i class="fas fa-check"></i>Free shipping</p>
<button class="btn mt-5">ADD TO CART</button>
</div>
</div>
</div>
</div>
<div class="mx-3">
<h5 class="text-light p-1 mt-5" style="background-color: #007681">Description</h5>
<div class="w-100 border">
<p><?= $description?></p>
</div>
</div>
<div class="mx-3 mt-5">
<div id="multi-item-example" class="carousel slide carousel-multi-item" data-ride="carousel">
<!--Slides-->
<div class="carousel-inner" role="listbox">
<!--First slide-->
<div class="carousel-item active">
<div class="row">
<?php for ($i=0; $i < 3; $i++) { ?>
<div class="col-md-4">
<div class="card mb-2">
<a href="product.php?id=<?= $recommendedProducts[$i]['id'] ?>">
<img id="remommendedImg" src="<?= $recommendedProducts[$i]['img'] ?>" alt="Card image cap">
</a>
<div class="card-body">
<h4 class="card-title"><?= $recommendedProducts[$i]['name'] ?></h4>
<p class="card-text"><?= $recommendedProducts[$i]['price']?>.00$</p>
<a class="btn" id="addToCart" href="#">Add to cart</a>
</div>
</div>
</div>
<?php }?>
</div>
</div>
<!--/.First slide-->
<!--Second slide-->
<div class="carousel-item">
<div class="row">
<?php for ($i=3; $i < 6; $i++) { ?>
<div class="col-md-4">
<div class="card mb-2">
<a href="product.php?id=<?= $recommendedProducts[$i]['id'] ?>">
<img id="remommendedImg" src="<?= $recommendedProducts[$i]['img'] ?>" alt="Card image cap">
</a>
<div class="card-body">
<h4 class="card-title"><?= $recommendedProducts[$i]['name'] ?></h4>
<p class="card-text"><?= $recommendedProducts[$i]['price']?>.00$</p>
<a class="btn" id="addToCart" href="#">Add to cart</a>
</div>
</div>
</div>
<?php }?>
</div>
</div>
<!--/.Second slide-->
</div>
<!--/.Slides-->
<!--Indicators-->
<ol class="carousel-indicators my-3" id="bestSellersIndicator">
<li data-target="#multi-item-example" data-slide-to="0" class="active"></li>
<li data-target="#multi-item-example" data-slide-to="1"></li>
</ol>
<!--/.Indicators-->
</div>
<!--/.Carousel Wrapper-->
</div>
</div>
</main>
<footer>
</footer>
<script src="https://code.jquery.com/jquery-3.1.1.min.js">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>