product.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <?php session_start(); ?>
  2. <html lang="en">
  3. <head id="top">
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <link rel="stylesheet" href="styles/product_style.css">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>Shop</title>
  9. </head>
  10. <header>
  11. <div class="logo_content">
  12. <div class="logo">SITE-SHOP</div>
  13. </div>
  14. <div class="hd">
  15. <div class = "login1">
  16. <button type="submit" class = "login"><a href="index.html">
  17. <p class="log" id="openModalBtn3">Выйти</p></a>
  18. </button>
  19. </div>
  20. </div>
  21. </header>
  22. <body>
  23. <script src="k.js"></script>
  24. <script src="bloki.js"></script>
  25. <div id="modal" class="modal">
  26. <div class="modal-content">
  27. <span class="close" id="close" ondblclick="closeb()">X</span>
  28. <h2>Заявка на регистрацию</h2>
  29. <form id="myForm" action="registration.php" method="POST" class="forma">
  30. <input class="inp" type="text" id="FIO" name="FIO" placeholder="ФИО" required>
  31. <input class="inp" type="text" id="region" name="region" placeholder="регион" required>
  32. <input class="inp" type="text" id="login" name="login" placeholder="логин" required>
  33. <input class="inp" type="email" id="Email" name="Email" placeholder="Email" required>
  34. <input class="inp" type="password" id="password" name="password" placeholder="пароль" required>
  35. <p class="ft">внимательно заполните каждое поле, когда администратор одобрит регистрацию, вам придет уведомление на почту.</p>
  36. <button type="submit" class="but_otprav">Отправить</button>
  37. </form>
  38. </div>
  39. </div>
  40. <div id="Basket" class="Basket">
  41. <div class="modal-content">
  42. <span class="close" id="close" ondblclick="CloseBasket()">X</span>
  43. <h2>Оформление заказа</h2>
  44. <input class="inp" type="text" id="product_id" name="product_id" placeholder="Артикул" required>
  45. <input class="inp" type="number" id="count_prod" name="count_prod" placeholder="количество" required>
  46. <input class="inp" type="hidden" id="summ" name="summ" required>
  47. <div class="but_otprav1" onclick="count_sum()">Рассчитать </div>
  48. <div id="productPrice"></div>
  49. <p class="t" id="sum"></p>
  50. <p class="ft">внимательно заполните каждое поле, когда заказ будет проведен, он отобразиться у вас во вкладке профиля</p>
  51. <script>
  52. function count_sum(){
  53. var product_id = document.getElementById("product_id").value;
  54. var count_prod = document.getElementById("count_prod").value;
  55. var xhr = new XMLHttpRequest();
  56. var sum =0;
  57. xhr.open("GET", "inp_price.php?product_id=" + product_id, true);
  58. xhr.onreadystatechange = function() {
  59. if (xhr.readyState === 4 && xhr.status === 200) {
  60. var price = xhr.responseText;
  61. sum = price*count_prod;
  62. document.getElementById("productPrice").innerText = sum;
  63. document.getElementById('su').value =sum;
  64. }
  65. };
  66. xhr.send();
  67. document.getElementById('productid').value =product_id;
  68. document.getElementById('countprod').value =count_prod;
  69. }
  70. </script>
  71. <!-- </form> -->
  72. <form id="myForm" action="add_orders.php" method="POST" class="forma">
  73. <input type="hidden" name="productid" id="productid">
  74. <input type="hidden" name="countprod" id="countprod">
  75. <input type="text" name="id_login" id="id_login" placeholder="повторите логин">
  76. <input type="hidden" name="su" id="su">
  77. <button class="but_otprav1" type="submit" >Заказать</button>
  78. </form>
  79. </div>
  80. </div>
  81. <div class="orders" id="orders">
  82. <?php include 'connect.php';
  83. session_start();
  84. $login=$_SESSION['login'];
  85. $result = mysqli_query($mysql, "SELECT * FROM `Orders` WHERE `login` = '$login' ");
  86. ?>
  87. <div class="product_card_conteiner1" id="b">
  88. <?php
  89. While($Orders= mysqli_fetch_assoc($result)){
  90. ?>
  91. <div class="product_card1">
  92. <div class="text_card">
  93. <div class="ouput_text" id="login">Пользователь:
  94. <?php echo $Orders['login'];?></div>
  95. <div class="ouput_text" id="summ_order">Сумма:
  96. <?php echo $Orders['summ_order'];?></div>
  97. <div class="ouput_text" id="count_order"> Количество:
  98. <?php echo $Orders['count_order'];?></div>
  99. <div class="ouput_text">Артикул:
  100. <?php echo $Orders['id_product'];?></div>
  101. </div>
  102. <div class="knopkii">
  103. <div class="yes">оплачено</div>
  104. </div>
  105. </div>
  106. <?php
  107. }
  108. ?>
  109. </div>
  110. </div>
  111. <div id="nav-bar">
  112. <input id="nav-toggle" type="checkbox"/>
  113. <div id="nav-header"><a id="nav-title" target="_blank"><i class="fab fa-codepen"></i><div></div><div id="userrr">Пользователь: <?php echo $_SESSION['login'];?></div></a>
  114. <label for="nav-toggle"><span id="nav-toggle-burger"></span></label>
  115. <hr/>
  116. </div>
  117. <div id="nav-content">
  118. <div class="nav-button" id="open" onclick="openBasket()"><i class="fas fa-gem"></i><span>Корзина</span></div>
  119. <div class="nav-button" onclick="togglePanel6()"><i class="fas fa-gem"></i><span>Покупки</span></div>
  120. <div id="nav-content-highlight"></div>
  121. </div>
  122. <input id="nav-footer-toggle" type="checkbox"/>
  123. </div>
  124. <div id="modal1" class="modal1">
  125. <div class="modal-content1">
  126. <span class="close1" ondblclick="closebb()">X</span>
  127. <h2>Анонимный комментарий</h2>
  128. <form id="myForm1" action="review.php" method="post" class="forma1">
  129. <div class="rating-area">
  130. <input type="radio" id="star-5" name="rating" value="5">
  131. <label for="star-5" title="Оценка «5»"></label>
  132. <input type="radio" id="star-4" name="rating" value="4">
  133. <label for="star-4" title="Оценка «4»"></label>
  134. <input type="radio" id="star-3" name="rating" value="3">
  135. <label for="star-3" title="Оценка «3»"></label>
  136. <input type="radio" id="star-2" name="rating" value="2">
  137. <label for="star-2" title="Оценка «2»"></label>
  138. <input type="radio" id="star-1" name="rating" value="1">
  139. <label for="star-1" title="Оценка «1»"></label>
  140. </div>
  141. <label for="review"></label>
  142. <input type="text" name="review" id="review" required placeholder="Введите текст комментария">
  143. <button type="submit" class="but_otprav">Отправить</button>
  144. </form>
  145. </div><div id="successMessage1" class="success-messege1">
  146. <span class="close1">&times;</span>
  147. <p>Заявка отправлена</p>
  148. </div>
  149. </div>
  150. <div class="info_block" id="block2">
  151. <div id="overlay1" class="overlay1" >
  152. </div>
  153. </div>
  154. <div class="navigation">
  155. <div ><a href="index_a.php" class ="navigationItemRL">главная</a></div>
  156. <div> <a href="product.php" class ="navigationItem">продукция</a></div>
  157. </div>
  158. <div class="product_card_conteiner">
  159. <?php include 'connect.php';
  160. $result = mysqli_query($mysql, "SELECT * FROM `Products`");
  161. ?>
  162. <div class="product_card_conteiner">
  163. <?php
  164. While($Products= mysqli_fetch_assoc($result)){
  165. ?>
  166. <div class="product_card">
  167. <div class="img_cont">
  168. <div class="im"><?php echo $Products['img'];?></div>
  169. </div>
  170. <div class="name_star">
  171. <p class="t" id="title"><?php echo $Products['title'];?></p>
  172. <!-- <p class="t">★★★★★ : </p> -->
  173. <p class="t" id="price1">Стоимость: <?php echo $Products['price'];?></p>
  174. <p class="t">остаток на складе: <?php echo $Products['count_p'];?></p>
  175. <p class="t" id="article">Артикул: <?php echo $Products['id'];?></p>
  176. <div class="discription"><?php echo $Products['discription'];?></div>
  177. </div>
  178. <!-- <button class="but_otprav1" id="open" onclick="imputArticle(); openBasket()">Заказать</button> -->
  179. </div>
  180. <?php
  181. }
  182. ?>
  183. </div>
  184. </div>
  185. </body>
  186. <footer>
  187. </footer>
  188. </html>