-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorderInfo.php
More file actions
133 lines (120 loc) · 4.84 KB
/
orderInfo.php
File metadata and controls
133 lines (120 loc) · 4.84 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
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
<?php
include_once "Autentication/Auth.php";
include_once "Tools/User.php";
include_once "DataBase.php";
include_once 'Tools/Item.php';
$auth = AuthFabric::GetAuth();
if ($auth->isAuth()) {
$user = $auth->getCurrentUser();
$userInfo = $user->getUserInfo();
} else {
header('Refresh: 3; URL=../index.php');
echo 'Пользователь не зарегистрирован.';
exit;
}
$dataBase = DBWorkerFabric::GetDataBaseWorker();
// Номер заказа для отображения.
$orderNum = htmlspecialchars($_GET['orderNum']);
$orderDelete = htmlspecialchars($_GET['$orderDelete']);
if ($orderDelete != "" && $user->isAdmin()) {
header('Refresh: 3; URL=../admin.php');
$order = $dataBase->removeOrder($user->getLogin(), $orderDelete);
echo 'Заказ ' + $orderDelete + " удален!";
exit;
}
// Если 0 - корзина.
if ($orderNum == "" || $orderNum == 0) {
$pageName = "Корзина";
// Проверим добавление нового товара.
$id = htmlspecialchars($_POST['id']);
if ($id != "") {
if (htmlspecialchars($_POST['remove'] == "true") ) {
$dataBase->removeItemFromCart($user->getLogin(), $id);
//header('Refresh: 3; URL=index.php');
//echo 'Удалено';
//exit();
} else {
$dataBase->addItemToCart($user->getLogin(), $id);
}
}
$items = $dataBase->getCart($user->getLogin());
} else {
$pageName = "Заказ №" . $orderNum;
$order = $dataBase->getOrder($orderNum);
if (!is_null($order)) {
$items = $order->ItemList;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title><?php printf($pageName) ?></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/Styles.css">
<link rel="stylesheet" type="text/css" href="css/Styles_Items.css">
<script src="script/jquery-1.10.2.min.js"></script>
<script src="script/script.js"></script>
</head>
<body class="body">
<!-- Ўапка -->
<div class="header">
<!--¬ерхн€€ панель ссылок:-->
<?php include 'Elements/headerMenu.php'; ?>
<!-- онец ¬ерхней панели ссылок-->
<div class="headerSearchPanel">
<div class="container">
<div class="Search">
<form>
<input class="SearchInput" type="text" hidden="true" placeholder="Поиск">
<input class="ButtonSubmit" type="submit" hidden="true" value="Найти">
</form>
</div>
<div class="closer"></div>
</div>
</div>
<!--Кнопка для оформления заказа-->
<?php
if ($orderNum == 0 && count($items) > 0) {
echo <<< EOL
<div>
<form action="orders.php" method="POST">
<input type="text" hidden="true" name="act" value="checkout" />
<input type="submit" value="Оформить" />
</form>
</div>
EOL;
}
?>
<!-- Какие-то товары. -->
<div class="containerItem">
<div class="container">
<div class="ItemsMenu">
<ul>
<?php
if (is_null($items)) {
echo 'Такой заказ не существует!';
} else {
foreach ($items as $item) {
echo '<li class="ItemList">';
if ($orderNum == "" || $orderNum == 0) {
$itemStyle = ItemElements::getCartItemInfo();
} else {
$itemStyle = ItemElements::getFullItemInfo(true);
}
$item->show($itemStyle);
echo '</li>';
}
}
?>
</ul>
</div>
<div class="closer"></div>
</div>
</div>
</div>
<?php include 'Elements/footerMenu.php'; ?>
<?php include 'Elements/ImgZoomModal.php'; ?>
</body>
</html>