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
<?php
include 'koneksi.php';
include 'common/header.php';
?>
<h2> <span class="glyphicon glyphicon-shopping-cart"></span>Cart </h2>
<br/> <hr/>
<div class="col-md-12" align="center">
<table class="table table-hover table-condensed">
<tr>
<th> No </th>
<th> Nama </th>
<th> Harga Satuan </th>
<th> Jumlah </th>
<th> Subtotal </th>
<th> Opsi</th>
</tr>
<?php
$id_member = $_GET['id_member'];
$query = mysqli_query($koneksi, "SELECT menu.nama AS nama_menu, menu.harga, pemesanan.id_pemesanan ,pemesanan.jumlah FROM menu
INNER JOIN (pemesanan INNER JOIN member ON member_id = id_member) ON menu_id= id_menu WHERE member_id= '$id_member'");
$no = 1;
while($row = mysqli_fetch_assoc($query)){
$subtotal = $row['jumlah'] * $row['harga'];
?>
<tr>
<td> <?= $no?> </td>
<td> <?php echo $row['nama_menu'] ?> </td>
<td> Rp. <?= number_format($row['harga'])?>,- </td>
<td> <?= $row['jumlah']?> </td>
<td> Rp. <?= number_format($subtotal)?>,- </td>
<td> <a onclick="if(confirm('Apakah anda yakin ingin membatalkan pesanan ini?')){
location.href='batal.php?id=<?= $row['id_pemesanan'] ?>&id_member=<?= $id_member?>';
}" class="btn btn-danger"> <span class="glyphicon glyphicon-remove"></span> Batalkan </a> </td>
</tr>
<?php
global $total;
$total = $total += $subtotal;
$no++;
}
?>
</table>
<div align="right">
<font face="arial" size="5"> Total : Rp. <?php if(mysqli_num_rows($query)){
echo number_format($total);
}else{
echo '0';
}
?>,- </font>
</div>
<div align="center">
<?php
if(!mysqli_num_rows($query)){
echo '<br><br> <h2> Cart anda masih kosong! </h2><h3> Silahkan pesan terlebih dahulu. </h3>';
echo '<a href="member_menu.php" class="btn btn-info"><span class="glyphicon glyphicon-chevron-left"></span> Pesan</a> ';
}
else{
echo '<a href="member_menu.php" class="btn btn-info"><span class="glyphicon glyphicon-chevron-left"></span> Pesan Lagi</a> ';
echo '<a href="bayar.php?id_member='. $id_member .'" class="btn btn-success"> Checkout<span class="glyphicon glyphicon-chevron-right"></span> </a>';
}
?>
</div>
<br>
</div>
<?php
include 'common/footer.php';
?>