-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterimakasih.php
174 lines (161 loc) · 5.77 KB
/
terimakasih.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
session_start();
include "lib/koneksi.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Home | E-Shopper</title>
<link href="asset/css/bootstrap.min.css" rel="stylesheet">
<link href="asset/css/font-awesome.min.css" rel="stylesheet">
<link href="asset/css/prettyPhoto.css" rel="stylesheet">
<link href="asset/css/price-range.css" rel="stylesheet">
<link href="asset/css/animate.css" rel="stylesheet">
<link href="asset/css/main.css" rel="stylesheet">
<link href="asset/css/responsive.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
<link rel="shortcut icon" href="images/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="images/ico/apple-touch-icon-57-precomposed.png">
</head><!--/head-->
<body>
<?php
$sid = session_id();
//fungsi untuk mendapatkan isi keranjang belanja
function isi_keranjang(){
include 'lib/koneksi.php';
$isikeranjang = array();
$sid = session_id();
$sql = mysqli_query($koneksi, "SELECT * FROM tbl_order WHERE id_session='$sid'");
while ($r = mysqli_fetch_array($sql)){
$isikeranjang[] = $r;
}
return $isikeranjang;
}
$tgl_skrg = date("Y-m-d");
//simpan data pemesanan
mysqli_query($koneksi, "INSERT INTO tbl_pembelian(tanggal_beli,status_order) VALUES ('$tgl_skrg','P')");
//mendapatkan nomor orders dari tabel pembelian
$id_orders = mysqli_insert_id($koneksi);
//panggil fungsi isikeranjang dan hitung jumlah produk yang dipesan
$isikeranjang = isi_keranjang();
$jml = count($isikeranjang);
//simpan data detail pemesanan
for ($i = 0; $i < $jml; $i++) {
mysqli_query($koneksi, "INSERT INTO tbl_detail_order(id_order, id_produk, jumlah, harga)
VALUES('$id_orders',{$isikeranjang[$i]['id_produk']},{$isikeranjang[$i]['jumlah']},{$isikeranjang[$i]['harga']})");
}
for ($i = 0; $i < $jml; $i++) {mysqli_query($koneksi, "DELETE FROM tbl_order WHERE id_order = {$isikeranjang[$i]['id_order']}");
} ?>
<section id="cart_items">
<div class="container">
<div class="shopper-informations">
<div class="row">
<div class="col-sm-8">
<div class="shopper-info">
<p>Terimakasih Atas Kepercayaan Anda Belanja Di Toko Online Kami, Berikut Detail Pembayaran Yang Harus dibayarkan.</p>
<form id="main-contact-form" class="contact-form row" name="contact-form" method="post">
<div class="form-group col-md-12">
Id order : <?php echo $_POST['idorder']; ?>
</div>
<div class="form-group col-md-12">
Nama : <?php echo $_POST['nama']; ?>
</div>
<div class="form-group col-md-12">
Email : <?php echo $_POST['email']; ?>
</div>
<div class="form-group col-md-12">
No Telpon : <?php echo $_POST['telpon']; ?>
</div>
<div class="form-group col-md-12">
Alamat : <?php echo $_POST['alamat']; ?>
</div>
</form>
<?php
$querySimpan = mysqli_query($koneksi, "INSERT INTO tbl_member (id_order,nama,alamat,email,no_hp)
VALUES ('$_POST[idorder]','$_POST[nama]','$_POST[alamat]','$_POST[email]','$_POST[telpon]')");
?>
</div>
</div>
</div>
</div>
<div class="review-payment">
<h2>Review & Payment</h2>
</div>
<div class="table-responsive cart_info">
<table class="table table-condensed">
<thead>
<tr class="cart_menu">
<td class="image">Item</td>
<td class="description"></td>
<td class="price">Price</td>
<td class="quantity">Quantity</td>
<td class="total">Total</td>
</tr>
</thead>
<tbody>
<?php
$idor=$_POST['idorder'];
$r = mysqli_query($koneksi, "SELECT * FROM tbl_detail_order,tbl_produk
WHERE tbl_detail_order.id_produk=tbl_produk.id_produk AND id_order='$idor'");
$total=0;
while ($d = mysqli_fetch_array($r)) {
$subtotal = $d['harga'] * $d['jumlah'];
$total = $total + $subtotal;
?>
<tr>
<td class="cart_product">
<a href=""><img src="admin/upload/<?php echo $d['gambar'];?>" alt=""></a>
</td>
<td class="cart_description">
<h4><a href=""><?php echo $d['nama_produk'];?></a></h4>
</td>
<td class="cart_price">
<p><?php echo $d['harga'];?></p>
</td>
<td class="cart_quantity">
<?php echo $d['jumlah'];?>
</td>
<td class="cart_total">
<p class="cart_total_price"><?php echo $subtotal;?></p>
</td>
</tr>
<?php } ?>
<tr>
<td colspan="4"> </td>
<td colspan="2">
<table class="table table-condensed total-result">
<tr>
<td>Biaya Kirim</td>
<td><span>Rp. <?php echo $_POST['kota']; ?></span></td>
</tr>
<tr>
<td>Total</td>
<td><span>Rp. <?php echo $total+$_POST['kota']; ?></span></td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<a href="index.php"><button class="btn btn-default get">Kembali</button></a>
</div>
</div>
</section> <!--/#cart_items-->
<script src="asset/js/jquery.js"></script>
<script src="asset/js/bootstrap.min.js"></script>
<script src="asset/js/jquery.scrollUp.min.js"></script>
<script src="asset/js/price-range.js"></script>
<script src="asset/js/jquery.prettyPhoto.js"></script>
<script src="asset/js/main.js"></script>
</body>
</html>