This repository has been archived by the owner on Nov 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
myorders.php
104 lines (92 loc) · 5.03 KB
/
myorders.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
<?php
if (isset($_SESSION["users"])) {
?>
<!-- Start All Title Box -->
<div class="all-title-box">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Siparişlerim</h2>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="./">Anasayfa</a></li>
<li class="breadcrumb-item active">Siparişlerim</li>
</ul>
</div>
</div>
</div>
</div>
<!-- End All Title Box -->
<!-- Start Wishlist -->
<div class="wishlist-box-main">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="table-main table-responsive">
<table class="table">
<thead>
<tr>
<th>Sipariş No</th>
<th>İsim Soyisim</th>
<th>Sipariş Tarihi</th>
<th>Toplam Fiyat</th>
<th>Sipariş Adresi</th>
<th>Kargo Durumu</th>
<th>Sipariş Sonucu</th>
</tr>
</thead>
<tbody>
<?php
$orderIdQuery = $db->prepare("SELECT DISTINCT orderid FROM orders WHERE userid = ? ORDER BY orderid DESC ");
$orderIdQuery->execute([$userid]);
$orderIdCount = $orderIdQuery->rowCount();
$orderIdRecords = $orderIdQuery->fetchAll(PDO::FETCH_ASSOC);
if ($orderIdCount > 0) {
foreach ($orderIdRecords as $orderRecord) {
$orderid = ($orderRecord["orderid"]);
$orderQuery = $db->prepare("SELECT * FROM orders WHERE userid = ? AND orderid = ? ORDER BY id ASC");
$orderQuery->execute([$userid, $orderid]);
$orderQueryRecords = $orderQuery->fetchAll(PDO::FETCH_ASSOC);
foreach ($orderQueryRecords as $row) {
$cargoStatus = ($row["cargoStatus"]);
if ($cargoStatus == 0) {
$cargoStatusPrint = "Beklemede";
} else {
$cargoStatusPrint = "Kargoya Verildi";
}
$orderStatus = ($row["status"]);
if ($orderStatus == 0) {
$orderStatusPrint = "İşlem Halinde";
} else {
$orderStatusPrint = "Teslim Edildi";
}
}
?>
<tr>
<td> <a href="#" class="font-weight-bold"><?php echo $row['orderid']; ?></a> </td>
<td class="quantity-box"><?php echo $row['adressName']; ?> <?php echo $row['adressSurname']; ?></td>
<td class="quantity-box font-weight-bold"><?php echo dateFormat($row['orderDate']); ?></td>
<td class="price-pr font-weight-bold">
<p><?php echo $row['totalPayPrice']; ?> TL</p>
</td>
<td class="quantity-box"><?php echo $row['addressDetails']; ?></td>
<td class="quantity-box font-weight-bold"><?php echo $cargoStatusPrint; ?></td>
<td class="quantity-box font-weight-bold"><?php echo $orderStatusPrint; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- End Wishlist -->
<?php
}
} else {
header("Location:./");
exit();
}
?>