Guest User

Untitled

a guest
Oct 18th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.91 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4.  
  5. if(isset($_GET['p'])){
  6. $_SESSION['producto'][$_SESSION['contador']] = $_GET['p'];
  7. $_SESSION['contador']++;
  8.  
  9.  
  10. }
  11.  
  12. if (isset($_GET['c'])){
  13. $_SESSION['cantidad'][$_SESSION['contador']] = $_GET['c'];
  14. }
  15.  
  16. include '../conexion/server.php';
  17. $suma = 0;
  18. for ($i=0; $i < $_SESSION['contador']; ++$i){
  19. //echo "producto:".$_SESSION['producto'][$i]."-".$_GET['c'][$i]."
  20. <br>";
  21.  
  22. $query = mysqli_query($conect,'SELECT * FROM Productos WHERE
  23. id='.$_SESSION['producto'][$i].'');
  24.  
  25. if($query !==false){
  26.  
  27. while ($fila = mysqli_fetch_array($query)) {
  28.  
  29.  
  30. $cab = $_SESSION['cantidad'][$i+1];
  31. $total = $fila['Precio']*$cab;
  32. echo '<tr>';
  33. echo '<td>'.$fila['Nombre'].'</td>';
  34. echo'<td></td>';
  35. echo '<center><td>';
  36. echo '<center><input type=number name=ja class="las ma"
  37. value='.$cab.'></center>';
  38. echo '</td></center>';
  39. echo '<td>$'.$fila['Precio'].'</td>';
  40. echo '<td></td>';
  41. echo '<td>$'.number_format($total,2).'</td>';
  42. echo '<td>';
  43. echo '<input type=text value='.$i.' class=jk>';
  44. echo '<input type=text value='.$_SESSION['contador'].'
  45. class=jk>';
  46. echo '<input type=text value='.$_SESSION['producto'][$i].'
  47. class=jk>';
  48. echo '<a href=functions/checkout.php?a='.$i.'
  49. class=borrar>Borrar</a>';
  50.  
  51. echo '</td>';
  52. echo '</tr>';
  53.  
  54.  
  55.  
  56.  
  57.  
  58. $suma += $total;
  59.  
  60.  
  61.  
  62. }
  63.  
  64.  
  65.  
  66. }else{
  67. $_SESSION['contador']=0;
  68. }
  69.  
  70. if(isset($_GET['a'])){
  71.  
  72.  
  73. echo '<script> window.location="../carrito.php";
  74. </script>';
  75.  
  76. unset($_SESSION['producto'][$_GET['a']]);
  77.  
  78. $_SESSION["producto"] =
  79. array_values($_SESSION["producto"]);
  80.  
  81. $_SESSION['contador'] -=1;
  82.  
  83.  
  84.  
  85.  
  86.  
  87. }
  88.  
  89. }
  90.  
  91. echo '<tr><th colspan="5">Total</th><th
  92. colspan="2">$'.number_format($suma,2).'</th></tr>';
  93. mysqli_close($conect);
  94.  
  95. ?>
  96.  
  97. <?php
  98. session_start();
  99.  
  100. if(!isset($_SESSION['contador'])){
  101.  
  102. $_SESSION['contador'] = 0;
  103.  
  104. }
  105.  
  106. ?>
  107.  
  108.  
  109.  
  110. <?php
  111.  
  112. include 'conexion/server.php';
  113.  
  114. ?>
  115.  
  116.  
  117.  
  118.  
  119. <!DOCTYPE html>
  120. <html lang="en">
  121.  
  122. <head>
  123.  
  124. <meta charset="utf-8">
  125. <meta name="robots" content="all,follow">
  126. <meta name="googlebot" content="index,follow,snippet,archive">
  127. <meta name="viewport" content="width=device-width, initial-scale=1">
  128. <meta name="description" content="Obaju e-commerce template">
  129. <meta name="author" content="Ondrej Svestka | ondrejsvestka.cz">
  130. <meta name="keywords" content="">
  131.  
  132. <title>
  133. Tienda
  134. </title>
  135.  
  136. <meta name="keywords" content="">
  137.  
  138. <link href='http://fonts.googleapis.com/css?
  139. family=Roboto:400,500,700,300,100' rel='stylesheet' type='text/css'>
  140.  
  141. <!-- styles -->
  142. <link href="css/font-awesome.css" rel="stylesheet">
  143. <link href="css/bootstrap.min.css" rel="stylesheet">
  144. <link href="css/animate.min.css" rel="stylesheet">
  145. <link href="css/owl.carousel.css" rel="stylesheet">
  146. <link href="css/owl.theme.css" rel="stylesheet">
  147. <link rel="stylesheet" href="css/estilosumario.css">
  148.  
  149. <!-- theme stylesheet -->
  150. <link href="css/style.default.css" rel="stylesheet" id="theme-
  151. stylesheet">
  152.  
  153. <!-- your stylesheet with modifications -->
  154. <link href="css/custom.css" rel="stylesheet">
  155.  
  156. <script src="js/respond.min.js"></script>
  157.  
  158. <link rel="shortcut icon" href="favicon.png">
  159.  
  160.  
  161.  
  162. </head>
  163.  
  164. <body>
  165. <!-- *** TOPBAR ***
  166.  
  167. <!-- *** TOP BAR END *** -->
  168.  
  169. <!-- *** NAVBAR ***
  170.  
  171. <div class="navbar navbar-default yamm" role="navigation"
  172. id="navbar">
  173. <div class="container">
  174. <div class="navbar-header">
  175.  
  176. <a class="navbar-brand home" href="index.html" data-
  177. animate-hover="bounce">
  178. <img src="img/logo.png" alt="" class="hidden-xs
  179. tamaño">
  180. <img src="" alt="" class="visible-xs"><span class="sr-
  181. only"></span>
  182. </a>
  183. <div class="navbar-buttons">
  184. <button type="button" class="navbar-toggle" data-
  185. toggle="collapse" data-target="#navigation">
  186. <span class="sr-only">Toggle navigation</span>
  187. <i class="fa fa-align-justify"></i>
  188. </button>
  189. <button type="button" class="navbar-toggle" data-
  190. toggle="collapse" data-target="#search">
  191. <span class="sr-only">Toggle search</span>
  192. <i class="fa fa-search"></i>
  193. </button>
  194. <a class="btn btn-default navbar-toggle"
  195. href="basket.html">
  196. <i class="fa fa-shopping-cart"></i> <span
  197. class="hidden-xs"></span>
  198. </a>
  199. </div>
  200. </div>
  201. <!--/.navbar-header -->
  202.  
  203. <div class="navbar-collapse collapse" id="navigation">
  204.  
  205. <ul class="nav navbar-nav navbar-left">
  206. <li class=""><a href="index.php">Home</a>
  207. </li>
  208. <li class="dropdown yamm-fw active">
  209. <a href="#" class="dropdown-toggle" data-
  210. toggle="dropdown" data-hover="dropdown" data-delay="200">Tienda <b
  211. class=""></b></a>
  212.  
  213. </li>
  214.  
  215. <li class="dropdown yamm-fw">
  216. <a href="#" class="dropdown-toggle" data-
  217. toggle="dropdown" data-hover="dropdown" data-delay="200">Cursos<b
  218. class=""></b></a>
  219.  
  220. </li>
  221.  
  222. <li class="dropdown yamm-fw">
  223. <a href="#" class="dropdown-toggle" data-
  224. toggle="dropdown" data-hover="dropdown" data-
  225. delay="200">Contacto <b class=""></b></a>
  226.  
  227. </li>
  228. <li class="dropdown yamm-fw">
  229. <a href="#" class="dropdown-toggle" data-
  230. toggle="dropdown" data-hover="dropdown" data-
  231. delay="200">Inicio Sesión <b class=""></b></a>
  232.  
  233. </li>
  234. </ul>
  235.  
  236. </div>
  237. <!--/.nav-collapse -->
  238.  
  239. <div class="navbar-buttons">
  240.  
  241. <div class="navbar-collapse collapse right" id="basket-
  242. overview">
  243. <a href="basket.html" class="btn btn-primary navbar-
  244. btn"><i class="fa fa-shopping-cart"></i><span
  245. class="hidden-sm"><?echo $_SESSION['contador']?></span>
  246. </a>
  247. </div>
  248. <!--/.nav-collapse -->
  249.  
  250. <div class="navbar-collapse collapse right" id="search-not-mobile">
  251. <button type="button" class="btn navbar-btn btn-primary" data-toggle="collapse" data-target="#search">
  252. <span class="sr-only">Toggle search</span>
  253. <i class="fa fa-search"></i>
  254. </button>
  255. </div>
  256.  
  257. </div>
  258.  
  259. <div class="collapse clearfix" id="search">
  260.  
  261. <form class="navbar-form" role="search">
  262. <div class="input-group">
  263. <input type="text" class="form-control" placeholder="Search">
  264. <span class="input-group-btn">
  265.  
  266. <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i></button>
  267.  
  268. </span>
  269. </div>
  270. </form>
  271.  
  272. </div>
  273. <!--/.nav-collapse -->
  274.  
  275. </div>
  276. <!-- /.container -->
  277. </div>
  278. <!-- /#navbar -->
  279.  
  280. <!-- *** NAVBAR END *** -->
  281.  
  282. <div id="all">
  283.  
  284. <div id="content">
  285. <div class="container">
  286.  
  287. <div class="col-md-12">
  288. <ul class="breadcrumb">
  289. <li><a href="#">Home</a>
  290. </li>
  291. <li>tienda</li>
  292. </ul>
  293. </div>
  294.  
  295. <div class="col-md-2">
  296. <!-- *** MENUS AND FILTERS ***
  297.  
  298. <div class="panel-heading">
  299. <h3 class="panel-title">Categories</h3>
  300. </div>
  301.  
  302. <div class="panel-body">
  303. <ul class="nav nav-pills nav-stacked category-menu">
  304. <li>
  305. <a href="category.html">Equipos y Accesorios <span class="badge pull-right"></span></a>
  306. <ul>
  307. <li><a href="tienda.php?estaddo=1">Enbotellado</a>
  308. </li>
  309. <li><a href="tienda.php?estaddo=2">Cocción</a>
  310. </li>
  311. <li><a href="category.html">Fermentación</a>
  312. </li>
  313. <li><a href="tienda.php?estaddo=3">Instrumentos</a>
  314. </li>
  315. <li><a href="category.html">Enfriadores</a>
  316. </li>
  317. </ul>
  318. </li>
  319. <li class="">
  320. <a href="category.html">Materias Primas <span class="badge pull-right"></span></a>
  321. <ul>
  322. <li><a href="category.html">Desinfectantes</a>
  323. </li>
  324. <li><a href="category.html">Aditivos</a>
  325. </li>
  326. <li><a href="category.html">Extractos de maltas</a>
  327. </li>
  328. <li><a href="category.html">Levaduras</a>
  329. </li>
  330. <li><a href="category.html">Lúpulos</a>
  331. </li>
  332. </ul>
  333. </li>
  334. <li>
  335. <a href="category.html">Kits Cerveceros <span class="badge pull-right"></span></a>
  336.  
  337. </li>
  338. <li>
  339. <a href="category.html">Cervezas <span class="badge pull-right"></span></a>
  340.  
  341. </li>
  342.  
  343. </ul>
  344.  
  345. </div>
  346. </div>
  347.  
  348.  
  349.  
  350.  
  351.  
  352. <!-- *** MENUS AND FILTERS END *** -->
  353.  
  354.  
  355. </div>
  356.  
  357. <div class="col-md-7">
  358.  
  359.  
  360. <div class="box info-bar">
  361. <div class="row">
  362. <div class="col-sm-10 col-md-4 products-showing">
  363. Mostrar <strong>12</strong> of <strong>25</strong>
  364. </div>
  365.  
  366. <div class="col-sm-12 col-md-8 products-number-sort">
  367. <div class="row">
  368. <form class="form-inline">
  369. <div class="col-md-6 col-sm-6">
  370. <div class="products-number">
  371. <strong>Mostrar</strong> <a href="#" class="btn btn-default btn-sm btn-primary">12</a> <a href="tienda.php" class="btn btn-default btn-sm">24</a> <a href="tienda.php" class="btn btn-default btn-sm">All</a>
  372. </div>
  373. </div>
  374.  
  375. </form>
  376. </div>
  377. </div>
  378. </div>
  379. </div>
  380.  
  381. <div class="row products">
  382.  
  383. <?php
  384.  
  385.  
  386. if(isset($_GET['estaddo'])){
  387.  
  388. $yu = $_GET['estaddo'];
  389.  
  390. $consulta = mysqli_query($conect, 'SELECT * FROM Productos WHERE Estado='.$yu.'');
  391.  
  392. while ($row = mysqli_fetch_row($consulta)) {
  393. $imagen = $row[2];
  394. $nombre = $row[1];
  395. $precio = $row[3];
  396. $id = $row[0];
  397.  
  398.  
  399.  
  400. echo '<div class="col-md-4 col-sm-6">';
  401.  
  402. echo '<div class="product">';
  403.  
  404. echo '<div class="flip-container">';
  405.  
  406. echo '<div class="flipper">';
  407.  
  408. echo '<div class="front">';
  409.  
  410. echo '<a href="detail.html">';
  411. echo '<img src="upload/'.$imagen.'" alt="" class="img-responsive">';
  412. echo '</a>';
  413.  
  414. echo '</div>';
  415.  
  416. echo '<div class="back">';
  417.  
  418. echo '<a href="detail.html">';
  419. echo '<img src="upload/'.$imagen.'" alt="" class="img-responsive">';
  420. echo '</a>';
  421.  
  422. echo '</div>';
  423.  
  424.  
  425. echo '</div>';
  426.  
  427. echo '</div>';
  428.  
  429. echo '<a href="detail.html" class="invisible">';
  430. echo '<img src="upload/'.$imagen.'" alt="" class="img-responsive">';
  431. echo '</a>';
  432.  
  433. echo '<div class="text">';
  434.  
  435. echo ' <h3><a href="detail.html">'.$nombre.'</a></h3>';
  436. echo '<p class="price">$'.$precio.'</p>';
  437. echo '<p class="buttons">';
  438. echo '<a href="detail.html" class="btn btn-default">Ver Detalle</a>';
  439.  
  440. echo '<input type="number" name="ja" value="0" id="jaa" class="la ma">';
  441.  
  442. echo '<button value="'.$id.'" class="boton_compra">Añadir Carrito</button>';
  443.  
  444. echo '</p>';
  445.  
  446. echo '</div>';
  447.  
  448.  
  449. echo '</div>';
  450.  
  451.  
  452. echo '</div>';
  453.  
  454.  
  455. }
  456.  
  457. }else{
  458.  
  459. $consulta = mysqli_query($conect, 'SELECT * FROM Productos ORDER BY Id ASC');
  460.  
  461. while ($row = mysqli_fetch_row($consulta)) {
  462. $imagen = $row[2];
  463. $nombre = $row[1];
  464. $precio = $row[3];
  465. $id = $row[0];
  466.  
  467.  
  468.  
  469. echo '<div class="col-md-4 col-sm-6">';
  470.  
  471. echo '<div class="product">';
  472.  
  473. echo '<div class="flip-container">';
  474.  
  475. echo '<div class="flipper">';
  476.  
  477. echo '<div class="front">';
  478.  
  479. echo '<a href="detail.html">';
  480. echo '<img src="upload/'.$imagen.'" alt="" class="img-responsive">';
  481. echo '</a>';
  482.  
  483. echo '</div>';
  484.  
  485. echo '<div class="back">';
  486.  
  487. echo '<a href="detail.html">';
  488. echo '<img src="upload/'.$imagen.'" alt="" class="img-responsive">';
  489. echo '</a>';
  490.  
  491. echo '</div>';
  492.  
  493.  
  494. echo '</div>';
  495.  
  496. echo '</div>';
  497.  
  498. echo '<a href="detail.html" class="invisible">';
  499. echo '<img src="upload/'.$imagen.'" alt="" class="img-responsive">';
  500. echo '</a>';
  501.  
  502. echo '<div class="text">';
  503.  
  504. echo ' <h3><a href="detail.html">'.$nombre.'</a></h3>';
  505. echo '<p class="price">$'.$precio.'</p>';
  506. echo '<p class="buttons">';
  507. echo '<a href="detail.html" class="btn btn-default">Ver Detalle</a>';
  508.  
  509. echo '<input type="number" name="ja" value="0" id="jaa" class="la ma">';
  510.  
  511. echo '<button value="'.$id.'" class="boton_compra">Añadir Carrito</button>';
  512.  
  513. echo '</p>';
  514.  
  515. echo '</div>';
  516.  
  517.  
  518. echo '</div>';
  519.  
  520.  
  521. echo '</div>';
  522.  
  523.  
  524. }
  525. }
  526.  
  527. ?>
  528.  
  529. </div>
  530.  
  531. <form action="" ></form>
  532.  
  533. <div class="pages">
  534.  
  535. <p class="loadMore">
  536. <a href="#" class="btn btn-primary btn-lg"><i class="fa fa-chevron-down"></i> Load more</a>
  537. </p>
  538.  
  539. <ul class="pagination">
  540. <li><a href="#">&laquo;</a>
  541. </li>
  542. <li class="active"><a href="#">1</a>
  543. </li>
  544. <li><a href="#">2</a>
  545. </li>
  546. <li><a href="#">3</a>
  547. </li>
  548. <li><a href="#">4</a>
  549. </li>
  550. <li><a href="#">5</a>
  551. </li>
  552. <li><a href="#">&raquo;</a>
  553. </li>
  554. </ul>
  555. </div>
  556.  
  557.  
  558. </div>
  559. <!-- /.col-md-9 -->
  560.  
  561.  
  562. <div class="col-md-3">
  563. <div class="box">
  564. <div class="box-header">
  565. <h3>Sumario</h3>
  566. </div>
  567.  
  568. <div class="table-responsive">
  569. <div class="table">
  570. <table class="table">
  571. <thead>
  572. <tr>
  573. <th colspan="0">Producto</th>
  574.  
  575. <th>Cantidad</th>
  576. <th>Total</th>
  577. </tr>
  578. </thead>
  579. <tbody id="carrito">
  580.  
  581. </tbody>
  582.  
  583.  
  584. </table>
  585. <a href="functions/ha.php"> <button>Eliminar</button></a>
  586. <a href="carrito.php"> <button>Comprar</button></a>
  587. </div>
  588. </div>
  589.  
  590. </div>
  591. </div>
  592. </div>
  593. <!-- /.container -->
  594. </div>
  595. <!-- /#content -->
  596.  
  597.  
  598. <!-- *** FOOTER ***
  599.  
  600. <ul>
  601. <li><a href="text.html">Sobre Nosotros</a>
  602. </li>
  603. <li><a href="text.html">Cursos</a>
  604. </li>
  605. <li><a href="faq.html">Tienda</a>
  606. </li>
  607. <li><a href="contact.html">Contactanos</a>
  608. </li>
  609. </ul>
  610.  
  611. <hr>
  612.  
  613. <h4>Usuarios</h4>
  614.  
  615. <ul>
  616. <li><a href="#" data-toggle="modal" data-target="#login-modal">Mi sesion</a>
  617. </li>
  618. <li><a href="register.html">Rregistro</a>
  619. </li>
  620. </ul>
  621.  
  622. <hr class="hidden-md hidden-lg hidden-sm">
  623.  
  624. </div>
  625. <!-- /.col-md-3 -->
  626.  
  627. <div class="col-md-3 col-sm-6">
  628.  
  629. <h4>Top categories</h4>
  630.  
  631. <ul>
  632. <li><a href="text.html">Equipos y Accesorios</a>
  633. </li>
  634. <li><a href="text.html">Materias Primas</a>
  635. </li>
  636. <li><a href="faq.html">Kits Cerveceros</a>
  637. </li>
  638. <li><a href="contact.html">Cervezas</a>
  639. </li>
  640. </ul>
  641.  
  642.  
  643.  
  644.  
  645. <hr class="hidden-md hidden-lg">
  646.  
  647. </div>
  648. <!-- /.col-md-3 -->
  649.  
  650. <div class="col-md-3 col-sm-6">
  651.  
  652. <h4>Contactanos</h4>
  653.  
  654. <p><strong>Homocervecerus</strong>
  655. <br>Av. Ilalo
  656. <br>Calle el Sol
  657. <br>Valle de los Chillos
  658. <br>Ecuador
  659. <br>
  660. <strong>FONO</strong>
  661. </p>
  662.  
  663.  
  664. <hr class="hidden-md hidden-lg">
  665.  
  666. </div>
  667. <!-- /.col-md-3 -->
  668.  
  669.  
  670.  
  671. <div class="col-md-3 col-sm-6">
  672.  
  673.  
  674.  
  675.  
  676.  
  677. <h4>Redes Sociales</h4>
  678.  
  679. <p class="social">
  680. <a href="#" class="facebook external" data-animate-hover="shake"><i class="fa fa-facebook"></i></a>
  681. <a href="#" class="twitter external" data-animate-hover="shake"><i class="fa fa-twitter"></i></a>
  682. <a href="#" class="instagram external" data-animate-hover="shake"><i class="fa fa-instagram"></i></a>
  683. <a href="#" class="gplus external" data-animate-hover="shake"><i class="fa fa-google-plus"></i></a>
  684. <a href="#" class="email external" data-animate-hover="shake"><i class="fa fa-envelope"></i></a>
  685. </p>
  686.  
  687.  
  688. </div>
  689. <!-- /.col-md-3 -->
  690.  
  691. </div>
  692. <!-- /.row -->
  693.  
  694. </div>
  695. <!-- /.container -->
  696. </div>
  697. <!-- /#footer -->
  698.  
  699. <!-- *** FOOTER END *** -->
  700.  
  701.  
  702.  
  703.  
  704. <!-- *** COPYRIGHT ***
  705.  
  706. </div>
  707. <div class="col-md-6">
  708. <p class="pull-right"> Diseñado por: José Moya
  709. <!-- Not removing these links is part of the license conditions of the template. Thanks for understanding :) If you want to use the template without the attribution links, you can do so after supporting further themes development at https://bootstrapious.com/donate -->
  710. </p>
  711. </div>
  712. </div>
  713. </div>
  714. <!-- *** COPYRIGHT END *** -->
  715.  
  716.  
  717.  
  718. </div>
  719. <!-- /#all -->
  720.  
  721.  
  722.  
  723.  
  724. <!-- *** SCRIPTS TO INCLUDE ***
  725. _________________________________________________________ -->
  726. <script src="js/jquery-1.11.0.min.js"></script>
  727. <script src="js/bootstrap.min.js"></script>
  728. <script src="js/jquery.cookie.js"></script>
  729. <script src="js/waypoints.min.js"></script>
  730. <script src="js/modernizr.js"></script>
  731. <script src="js/bootstrap-hover-dropdown.js"></script>
  732. <script src="js/owl.carousel.min.js"></script>
  733. <script src="js/front.js"></script>
  734. <script src="js/carrito.js"></script>
  735.  
  736. </body>
  737.  
  738. </html>
  739.  
  740. $(document).ready(inicio)
  741.  
  742. function inicio(){
  743.  
  744. $(".boton_compra").click(anade);
  745. $("#carrito").load("functions/poncarrito.php");
  746. $("#carrito2").load("functions/checkout.php");
  747.  
  748.  
  749. }
  750.  
  751.  
  752. function anade(){
  753.  
  754. var fila = $(this).parents("p");
  755.  
  756. if(fila.find(".ma").val() >0){
  757.  
  758. $("#carrito").load("functions/poncarrito.php?p="+$(this).val());
  759. $("#carrito").load("functions/poncarrito.php?
  760. c="+fila.find(".ma").val());
  761.  
  762. $("#carrito2").load("functions/checkout.php?p="+$(this).val());
  763. $("#carrito2").load("functions/checkout.php?
  764. c="+fila.find(".ma").val());
  765.  
  766. }else{
  767. alert("Ingrese cantidad");
  768. }
  769.  
  770.  
  771. }
Add Comment
Please, Sign In to add comment