-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeranjang.php
More file actions
65 lines (65 loc) · 1.77 KB
/
keranjang.php
File metadata and controls
65 lines (65 loc) · 1.77 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
<?php
session_start();
include 'koneksi.php';
?>
<?php include 'header.php'; ?>
<div class="kontainer">
<div class="row mb-3 mt-5 pb-3">
<div class="kolom-md-12 judulsection animasikontainer">
<h3 class="mb-4 text-tengah">Keranjang</h3>
</div>
</div>
</div>
<div class="kontainer">
<div class="row">
<div class="kolom-md-12 animasikontainer">
<div class="cart-list">
<table class="tabel">
<thead class="thead-white">
<tr class="text-tengah">
<th>No</th>
<th>Produk</th>
<th>Harga</th>
<th>Jumlah Beli</th>
<th>Total Harga</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php $nomor = 1; ?>
<?php if (!empty($_SESSION["keranjang"])) { ?>
<?php foreach ($_SESSION["keranjang"] as $idproduk => $jumlah) : ?>
<?php
$ambil = $koneksi->query("SELECT * FROM produk
WHERE idproduk='$idproduk'");
$pecah = $ambil->fetch_assoc();
$totalharga = $pecah["hargaproduk"] * $jumlah;
?>
<tr class="text-tengah">
<td><?php echo $nomor; ?></td>
<td><?php echo $pecah['namaproduk']; ?></td>
<td>Rp <?php echo number_format($pecah['hargaproduk']); ?></td>
<td><?php echo $jumlah; ?></td>
<td>Rp <?php echo number_format($totalharga); ?></td>
<td>
<a href="hapuskeranjang.php?id=<?php echo $idproduk ?>" class="tombolkecil">Hapus</a>
</td>
</tr>
<?php $nomor++; ?>
<?php endforeach;
} ?>
</tbody>
</table>
</div>
</div>
</div>
<br><br>
<div class="row">
<a href="produk.php" class="tombol">Lanjutkan Belanja</a>
<a href="checkout.php" class="tombol">Checkout</a>
</div>
</div>
<div style="padding-top:150px"></div>
<?php
include 'footer.php';
?>