-
Notifications
You must be signed in to change notification settings - Fork 0
/
detail_product.php
67 lines (58 loc) · 2.05 KB
/
detail_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
<?php
include 'koneksi.php';
include 'function.php';
$menu = 'beranda';
?>
<!DOCTYPE html>
<html lang="id">
<?php include 'head.php' ?>
<body>
<?php include 'navbar.php' ?>
<div class="jumbotron">
<div class="jumbotron jumbotron-fluid">
<div class="container">
<?php
$id = $_GET['id_product'];
$query = mysqli_query($koneksi, "SELECT * FROM tb_barang where id_barang = '$id'");
$data = mysqli_fetch_array($query)
?>
<div class="row">
<div class="col-md-6">
<img src="assets/produk/<?php echo $data['foto_barang']; ?>" height="500px" width="100%">
</div>
<div class="col-md-6">
<h3 class="font-weight-bold">
<?php echo $data['nama_barang']; ?>
</h3>
<p class="text-justify display-5">
<?php echo $data['deskripsi_barang']; ?>
</p>
<br>
<h5>Rp.
<?php echo number_format($data['harga_barang']); ?>
</h5><br>
<?php if ($data['stok_barang'] > 1) { ?>
<h4 class="text-success">Stok Tersedia: <?php echo $data['stok_barang']; ?> barang</h4>
<br>
<?php } ?>
<form role="form" id="form-tambah" action="cart.php" method="post">
<input type="hidden" name="id_barang" value="<?php echo $data['id_barang']; ?>">
<div class="form-group">
<label>Jumlah pesan</label>
<input type="number" class="form-control" id="qty" name="jumlah_pesan" required value="1" min="1"
max="<?php echo $data['stok_barang']; ?>">
</div>
<?php if ($data['stok_barang'] < 1) { ?>
<h4 class="text-danger">Stok Habis</h4>
<?php } else { ?>
<button type="submit" name="addcart" class="btn btn-primary">Tambah ke keranjang</button>
<?php } ?>
</form>
</div>
</div>
</div>
</div>
</div>
<?php include 'foot.php' ?>
</body>
</html>