You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
3.1 KiB

  1. <?php
  2. session_start();
  3. header('Content-Type: text/html; charset=UTF-8');
  4. $db = include("config.php");
  5. ?>
  6. <html>
  7. <head>
  8. <meta charset="utf-8">
  9. <meta name="viewport" content="width=device-width, initial-scale=1">
  10. <title>FutureBuilding Shop - Обзор заказа</title>
  11. <script src="https://code.jquery.com/jquery-3.5.0.min.js"></script>
  12. <script src="js/bootstrap.js"></script>
  13. <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
  14. <link rel="stylesheet" type="text/css" href="css/style.css">
  15. </head>
  16. <body>
  17. <nav class="navbar fixed-top navbar-light bg-light navbar-expand border">
  18. <a class="navbar-brand" href="worker.php">Admin</a>
  19. <ul class="navbar-nav">
  20. <li class="nav-item dropdown">
  21. <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  22. Меню
  23. </a>
  24. <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
  25. <a class="nav-link" href="view.php">Просмотр заказов</a>
  26. <a class="nav-link" href="add-item.php">Добавить товар в базу данных</a>
  27. <a class="nav-link" href="cons.php">Заявки на перезвон</a>
  28. </div>
  29. </li>
  30. </ul>
  31. </nav>
  32. <div class="container">
  33. <h1>ID заказа: <?php echo $_GET["id"] ?></h1>
  34. <table class="table table-bordered">
  35. <tr>
  36. <th>ID</th>
  37. <th>Товар</th>
  38. <th>Кол.</th>
  39. <th>Цена</th>
  40. <th>Итого</th>
  41. </tr>
  42. <?php
  43. $result = mysqli_query($db, "SELECT * FROM req WHERE id=" . $_GET["id"] . "");
  44. $myrow = mysqli_fetch_array($result);
  45. $cart = json_decode($myrow["cart"], true);
  46. //echo $cart[0][0];
  47. if (!empty($cart)) {
  48. $total = 0;
  49. foreach ($cart as $keys => $values) {
  50. ?>
  51. <tr>
  52. <td><?php echo $values["item_id"] ?></td>
  53. <td><?php echo $values["item_name"] ?></td>
  54. <td><?php echo $values["item_quantity"] ?></td>
  55. <td><?php echo $values["item_price"] ?> ₸</td>
  56. <td><?php echo $values["item_price"] * $values["item_quantity"] ?> ₸</td>
  57. </tr>
  58. <?php
  59. $total = $total + ($values["item_price"] * $values["item_quantity"]);
  60. }
  61. ?>
  62. <tr>
  63. <td colspan="4" style="text-align:right">Итого</td>
  64. <td style="text-align:right"><?php echo $total ?> ₸</td>
  65. </tr>
  66. <?php
  67. }
  68. ?>
  69. </table>
  70. </div>
  71. <footer class="page-footer font-small blue border">
  72. <div class="footer-copyright text-center py-3">
  73. ©FutureBuilding
  74. </div>
  75. </footer>
  76. </body>