|
21
|
Programación / PHP / Disminuir inventario en php
|
en: 30 Julio 2014, 14:57 pm
|
hola buen dia horario venezuela :-D
tengo una pequeña duda y no se como resolverla, como vengo diciendo desde hace tiempo aqui estoy armando un carrito de compras a mi propio estilo el cual ando puliendo mi problema es el siguiente:
tengo un row que me indica cuantas piezas me quedan de x producto, lo que quiero hacer es que cuando x usuario entre al carrito de compras y le de click a agregar a carrito se elimine una pieza del producto escogido alguien me podria dar un apoyo por favor.
|
|
|
22
|
Programación / PHP / Re: ayuda no me guarda los datos
|
en: 30 Julio 2014, 14:30 pm
|
mysql_query("INSERT INTO `servicio`(Vendedor,Semana,QuienPago,Proveedor,Fecha,Control,Adelanto,Cotizacion,Año,Tipo,Cliente,Descripcion,Factura,MontoTotal,MontoTotal2,Factura2) VALUES ('$Vendedor','$Semana','$QuienPago','$Proveedor''$Fecha','$Control','$Adelanto','$Cotizacion','$Año','$Tipo','$Cliente','$Descripcion','$Factura','$MontoTotal','$MontoTotal2','$Factura2')");
amigo me manda error `servicio` quitales las comillas que apartes creo que estan mal
|
|
|
24
|
Programación / PHP / Re: mostrar datos
|
en: 29 Julio 2014, 15:56 pm
|
listo ya lo hice por si alguien le interesa se coloca asi <div class="span4"><br><br><br><br> <strong>Existencia: </strong> <?php echo number_format($row['existencia']); ?> </div>
|
|
|
25
|
Programación / PHP / mostrar datos
|
en: 29 Julio 2014, 15:21 pm
|
hola buenos dias horario venezuela, estoy modificando mi carrito de compras que tengo en php y quiero agregar una linea en mi base de datos que me diga existencia, la cual ire cargando con los productos que me quedan, bien el problema o la duda seria como mostrarlo lo puedo hacer mediante un echo, <?php include('php_conexion.php'); $act="0"; include_once("php_conexion.php"); if(!empty($_GET['del'])){ $id=$_GET['del']; } ?> <!DOCTYPE html> <html lang="es"> <head> <meta charset="utf-8"> <title>Carrito de Compras</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <!-- Le styles --> <link href="css/bootstrap.css" rel="stylesheet"> <style type="text/css"> body { padding-top: 60px; padding-bottom: 40px; } </style> <link href="css/bootstrap-responsive.css" rel="stylesheet"> <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="../assets/js/html5shiv.js"></script> <![endif]--> <!-- Fav and touch icons --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png"> <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png"> <link rel="shortcut icon" href="ico/favicon.png"> </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="brand" href="#">Tienda Venezuela Computer</a> <div class="nav-collapse collapse"> <ul class="nav"> <li class="active"><a href="index.php">Principal</a></li> <li><a href="mis_pedidos.php">Mis Pedidos</a></li> </ul> </li> <table width="200" border="2" align="right"> <tr> <td bgcolor="#FFFFFF"><a href="#" target="_blank" class="dropdown-toggle" id="drop3" role="button" data-toggle="dropdown"><i class="icon-user"></i> Hola! <?php echo $_SESSION['username']; ?> <b class="caret"></b></td> </tr> </table> </div><!--/.nav-collapse --> </a> </div> </div> </div> <div class="container"> <!-- Main hero unit for a primary marketing message or call to action --> <div class="hero-unit" align="center"> <p><img src="file:///C|/Users/Secretaria/Desktop/Nueva carpeta/images/slogan-bg.jpg" class="img-polaroid"></p> </div> <!-- Example row of columns --> <div class="row"> </div> <div align="center"> <div class="row-fluid"> <div class="span8"> <?php $pa=mysql_query("SELECT * FROM producto where estado='s'"); ?> <table class="table table-bordered"> <tr><td> <div class="row-fluid"> <div class="span4"> <center><strong><?php echo $row['nombre']; ?></strong></center><br> <img src="img/producto/<?php echo $row['codigo']; ?>.jpg" class="img-polaroid"> </div> <div class="span4"><br><br><br><br> <strong><?php echo $row['nota']; ?></strong><br><br> <strong>Valor: </strong>$ <?php echo number_format($row['valor'],2,",","."); ?> LO QUERIA HACER AQUI MAS O MENOS ABAJO DE EL VALOR <strong>Existencia: </strong>$ <?php echo existencia($row['exis']; ?> </div> <div class="span4"><br><br><br><br><br> <form name="form<?php $row['codigo']; ?>" method="post" action=""> <input type="hidden" name="codigo" value="<?php echo $row['codigo']; ?>"> <button type="submit" name="boton" class="btn btn-primary"> <i class="icon-shopping-cart"></i> <strong>Agregar al Carrito</strong> </button> </form> </div> </div> </td></tr> </table> <?php } ?> </div> <div class="span4"> <?php if(!empty($_POST['codigo'])){ $codigo=$_POST['codigo']; $pa=mysql_query("SELECT * FROM carrito WHERE codigo='$codigo'"); $new_cant=$row['cantidad']+1; mysql_query("UPDATE carrito SET cantidad='$new_cant' WHERE codigo='$codigo'"); }else{ mysql_query("INSERT INTO carrito (codigo, cantidad) VALUES ('$codigo','1')"); } } ?> <div id="sidebar"><br><br><br> <h2 align="center">Mis Pedidos</h2> <table class="table table-bordered"> <tr> <td height="153"> <table class="table table-bordered table table-hover"> <?php $neto=0;$tneto=0; $oProducto=new Consultar_Producto($row['codigo']); $neto=$oProducto->consultar('valor')*$row['cantidad']; $tneto=$tneto+$neto; ?> <tr style="font-size:9px"> <td><?php echo $oProducto->consultar('nombre'); ?></td> <td><?php echo $row['cantidad']; ?></td> <td> <a href="index.php?del=<?php echo $row['codigo']; ?>" title="Eliminar de la Lista"> <i class="icon-remove"></i> </a> </td> </tr> <?php } ?> <td colspan="4" style="font-size:9px"><div align="right">$ <?php echo number_format($tneto,2,",","."); ?></div></td> <?php ?> <tr><div class="alert alert-success" align="center"><strong>No hay Productos Registrados</strong></div></tr> <?php } ?> </table></td> </tr> </table> </div> </div> </div> </div> <hr> <footer> <p>© Venezuela Computer 2014</p> <p> </p> </footer> </div> <!-- /container --> <!-- Le javascript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="js/jquery.js"></script> <script src="js/bootstrap-transition.js"></script> <script src="js/bootstrap-alert.js"></script> <script src="js/bootstrap-modal.js"></script> <script src="js/bootstrap-dropdown.js"></script> <script src="js/bootstrap-scrollspy.js"></script> <script src="js/bootstrap-tab.js"></script> <script src="js/bootstrap-tooltip.js"></script> <script src="js/bootstrap-popover.js"></script> <script src="js/bootstrap-button.js"></script> <script src="js/bootstrap-collapse.js"></script> <script src="js/bootstrap-carousel.js"></script> <script src="js/bootstrap-typeahead.js"></script> <script> $(function() { var offset = $("#sidebar").offset(); var topPadding = 15; $(window).scroll(function() { if ($("#sidebar").height() < $(window).height() && $(window).scrollTop() > offset.top) { /* LINEA MODIFICADA POR ALEX PARA NO ANIMAR SI EL SIDEBAR ES MAYOR AL TAMAÑO DE PANTALLA */ $("#sidebar").stop().animate({ marginTop: $(window).scrollTop() - offset.top + topPadding }); } else { $("#sidebar").stop().animate({ marginTop: 0 }); }; }); }); </script> </body> </html>
|
|
|
28
|
Programación / PHP / Re: ocultar botones en php
|
en: 22 Julio 2014, 19:14 pm
|
inde.php <?php include('php_conexion.php'); $act="0"; include_once("php_conexion.php"); if(!empty($_GET['del'])){ $id=$_GET['del']; } ?> <!DOCTYPE html> <html lang="es"> <head> <meta charset="utf-8"> <title>Carrito de Compras</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <!-- Le styles --> <link href="css/bootstrap.css" rel="stylesheet"> <style type="text/css"> body { padding-top: 60px; padding-bottom: 40px; } </style> <link href="css/bootstrap-responsive.css" rel="stylesheet"> <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="../assets/js/html5shiv.js"></script> <![endif]--> <!-- Fav and touch icons --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png"> <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png"> <link rel="shortcut icon" href="ico/favicon.png"> </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="brand" href="#">Tienda Venezuela Computer</a> <div class="nav-collapse collapse"> <ul class="nav"> <li class="active"><a href="index.php">Principal</a></li> <li><a href="mis_pedidos.php">Mis Pedidos</a></li> </ul> </li> <table width="200" border="2" align="right"> <tr> <td bgcolor="#FFFFFF"><a href="#" target="_blank" class="dropdown-toggle" id="drop3" role="button" data-toggle="dropdown"><i class="icon-user"></i> Hola! <?php echo $_SESSION['username']; ?> <b class="caret"></b></td> </tr> </table> </div><!--/.nav-collapse --> </a> </div> </div> </div> <div class="container"> <!-- Main hero unit for a primary marketing message or call to action --> <div class="hero-unit" align="center"> <p><img src="file:///C|/Users/Secretaria/Desktop/Nueva carpeta/images/slogan-bg.jpg" class="img-polaroid"></p> </div> <!-- Example row of columns --> <div class="row"> </div> <div align="center"> <div class="row-fluid"> <div class="span8"> <?php $pa=mysql_query("SELECT * FROM producto where estado='s'"); ?> <table class="table table-bordered"> <tr><td> <div class="row-fluid"> <div class="span4"> <center><strong><?php echo $row['nombre']; ?></strong></center><br> <img src="img/producto/<?php echo $row['codigo']; ?>.jpg" class="img-polaroid"> </div> <div class="span4"><br><br><br><br> <strong><?php echo $row['nota']; ?></strong><br><br> <strong>Valor: </strong>$ <?php echo number_format($row['valor'],2,",","."); ?> </div> <div class="span4"><br><br><br><br><br> <form name="form<?php $row['codigo']; ?>" method="post" action=""> <input type="hidden" name="codigo" value="<?php echo $row['codigo']; ?>"> <button type="submit" name="boton" class="btn btn-primary"> <i class="icon-shopping-cart"></i> <strong>Agregar al Carrito</strong> </button> </form> </div> </div> </td></tr> </table> <?php } ?> </div> <div class="span4"> <?php if(!empty($_POST['codigo'])){ $codigo=$_POST['codigo']; $pa=mysql_query("SELECT * FROM carrito WHERE codigo='$codigo'"); $new_cant=$row['cantidad']+1; mysql_query("UPDATE carrito SET cantidad='$new_cant' WHERE codigo='$codigo'"); }else{ mysql_query("INSERT INTO carrito (codigo, cantidad) VALUES ('$codigo','1')"); } } ?> <div id="sidebar"><br><br><br> <h2 align="center">Mis Pedidos</h2> <table class="table table-bordered"> <tr> <td height="153"> <table class="table table-bordered table table-hover"> <?php $neto=0;$tneto=0; $oProducto=new Consultar_Producto($row['codigo']); $neto=$oProducto->consultar('valor')*$row['cantidad']; $tneto=$tneto+$neto; ?> <tr style="font-size:9px"> <td><?php echo $oProducto->consultar('nombre'); ?></td> <td><?php echo $row['cantidad']; ?></td> <td> <a href="index.php?del=<?php echo $row['codigo']; ?>" title="Eliminar de la Lista"> <i class="icon-remove"></i> </a> </td> </tr> <?php } ?> <td colspan="4" style="font-size:9px"><div align="right">$ <?php echo number_format($tneto,2,",","."); ?></div></td> <?php ?> <tr><div class="alert alert-success" align="center"><strong>No hay Productos Registrados</strong></div></tr> <?php } ?> </table></td> </tr> </table> </div> </div> </div> </div> <hr> <footer> <p>© Venezuela Computer 2014</p> <p> </p> </footer> </div> <!-- /container --> <!-- Le javascript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="js/jquery.js"></script> <script src="js/bootstrap-transition.js"></script> <script src="js/bootstrap-alert.js"></script> <script src="js/bootstrap-modal.js"></script> <script src="js/bootstrap-dropdown.js"></script> <script src="js/bootstrap-scrollspy.js"></script> <script src="js/bootstrap-tab.js"></script> <script src="js/bootstrap-tooltip.js"></script> <script src="js/bootstrap-popover.js"></script> <script src="js/bootstrap-button.js"></script> <script src="js/bootstrap-collapse.js"></script> <script src="js/bootstrap-carousel.js"></script> <script src="js/bootstrap-typeahead.js"></script> <script> $(function() { var offset = $("#sidebar").offset(); var topPadding = 15; $(window).scroll(function() { if ($("#sidebar").height() < $(window).height() && $(window).scrollTop() > offset.top) { /* LINEA MODIFICADA POR ALEX PARA NO ANIMAR SI EL SIDEBAR ES MAYOR AL TAMAÑO DE PANTALLA */ $("#sidebar").stop().animate({ marginTop: $(window).scrollTop() - offset.top + topPadding }); } else { $("#sidebar").stop().animate({ marginTop: 0 }); }; }); }); </script> </body> </html>
index1.php <?php include('php_conexion.php'); $act="0"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Entrar</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <!-- Le styles --> <link href="css/bootstrap.css" rel="stylesheet"> <style type="text/css"> body { padding-top: 40px; padding-bottom: 40px; background-color: #f5f5f5; background-image: url(img/fondoP.png); } .form-signin { max-width: 300px; padding: 19px 29px 29px; margin: 0 auto 20px; background-color: #fff; border: 1px solid #e5e5e5; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05); box-shadow: 0 1px 2px rgba(0,0,0,.05); } .form-signin .form-signin-heading, .form-signin .checkbox { margin-bottom: 10px; } .form-signin input[type="text"], .form-signin input[type="password"] { font-size: 16px; height: auto; margin-bottom: 15px; padding: 7px 9px; } </style> <link href="css/bootstrap-responsive.css" rel="stylesheet"> <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="../assets/js/html5shiv.js"></script> <![endif]--> <!-- Fav and touch icons --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png"> <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png"> <link rel="shortcut icon" href="ico/favicon.png"> </head> <body> <div class="container"> <form name="form1" method="post" action="" class="form-signin"> <h2 class="form-signin-heading"> <?php $act="1"; $changeLocation = true; if(isset($_POST['usuario']) || isset($_POST['contra'])){ if(!empty($_POST['usuario']) and !empty($_POST['contra'])){ $usuario=trim($_POST['usuario']); $contra=trim($_POST['contra']); $can=mysql_query("SELECT * FROM usuarios WHERE (usu='".$usuario."' or ced='".$usuario."') and con='".$contra."'"); $_SESSION['username']=$dato['usu']; $_SESSION['tipo_usu']=$dato['tipo']; }else{ $changeLocation = false; if($act=="1"){echo '<div class="alert alert-error" align="center">Usuario y Contraseña Incorrecta</div>';}else{$act="0";} } } if($changeLocation) { header('location:index.php'); die();} } ?> Bienvenid@s</h2> <input type="text" name="usuario" class="input-block-level" placeholder="Usuario"> <input type="password" name="contra" class="input-block-level" placeholder="Contraseña"> <button class="btn btn-large btn-primary" type="submit">Iniciar</button> <p> </p> </form> </div> <!-- /container --> <!-- Le javascript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="js\jquery.js"></script> <script src="js\bootstrap-transition.js"></script> <script src="js\bootstrap-alert.js"></script> <script src="js\bootstrap-modal.js"></script> <script src="js\bootstrap-dropdown.js"></script> <script src="js\bootstrap-scrollspy.js"></script> <script src="js\bootstrap-tab.js"></script> <script src="js\bootstrap-tooltip.js"></script> <script src="js\bootstrap-popover.js"></script> <script src="js\bootstrap-button.js"></script> <script src="js\bootstrap-collapse.js"></script> <script src="js\bootstrap-carousel.js"></script> <script src="js\bootstrap-typeahead.js"></script> </body> </html>
|
|
|
30
|
Programación / PHP / Re: ocultar botones en php
|
en: 22 Julio 2014, 17:04 pm
|
una pregunta que la hago aqui mismo, yo puedo hacer que cuando el usuario entre sin llenar los campos de usuario y contraseña pase a la pagina del carrito de compras??? es decir tengo la pagina index1.php la cual tiene un formulario de llanar nombre de usuario y contraseña la cual si son correctos los redirije a la pagina index.php la cual es un carrito de compras bien ya me explique esto es posible que si el usuario no esta registrado igual lo lleve a la pagina index.php?? <?php include('php_conexion.php'); $act="0"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Entrar</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <!-- Le styles --> <link href="css/bootstrap.css" rel="stylesheet"> <style type="text/css"> body { padding-top: 40px; padding-bottom: 40px; background-color: #f5f5f5; background-image: url(img/fondoP.png); } .form-signin { max-width: 300px; padding: 19px 29px 29px; margin: 0 auto 20px; background-color: #fff; border: 1px solid #e5e5e5; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05); box-shadow: 0 1px 2px rgba(0,0,0,.05); } .form-signin .form-signin-heading, .form-signin .checkbox { margin-bottom: 10px; } .form-signin input[type="text"], .form-signin input[type="password"] { font-size: 16px; height: auto; margin-bottom: 15px; padding: 7px 9px; } </style> <link href="css/bootstrap-responsive.css" rel="stylesheet"> <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="../assets/js/html5shiv.js"></script> <![endif]--> <!-- Fav and touch icons --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png"> <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png"> <link rel="shortcut icon" href="ico/favicon.png"> </head> <body> <div class="container"> <form name="form1" method="post" action="" class="form-signin"> <h2 class="form-signin-heading"> <?php $act="1"; if(!empty($_POST['usuario']) and !empty($_POST['contra'])){ $usuario=trim($_POST['usuario']); $contra=trim($_POST['contra']); $can=mysql_query("SELECT * FROM usuarios WHERE (usu='".$usuario."' or ced='".$usuario."') and con='".$contra."'"); $_SESSION['username']=$dato['usu']; $_SESSION['tipo_usu']=$dato['tipo']; /////////////////////////////// if($_SESSION['tipo_usu']=='a' or $_SESSION['tipo_usu']=='ca'){ } }else{ if($act=="1"){echo '<div class="alert alert-error" align="center">Usuario y Contraseña Incorrecta</div>';}else{$act="0";} } }else{ } ?> Bienvenid@s</h2> <input type="text" name="usuario" class="input-block-level" placeholder="Usuario"> <input type="password" name="contra" class="input-block-level" placeholder="Contraseña"> <button class="btn btn-large btn-primary" type="submit">Iniciar</button> <p> </p> </form> </div> <!-- /container --> <!-- Le javascript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="js\jquery.js"></script> <script src="js\bootstrap-transition.js"></script> <script src="js\bootstrap-alert.js"></script> <script src="js\bootstrap-modal.js"></script> <script src="js\bootstrap-dropdown.js"></script> <script src="js\bootstrap-scrollspy.js"></script> <script src="js\bootstrap-tab.js"></script> <script src="js\bootstrap-tooltip.js"></script> <script src="js\bootstrap-popover.js"></script> <script src="js\bootstrap-button.js"></script> <script src="js\bootstrap-collapse.js"></script> <script src="js\bootstrap-carousel.js"></script> <script src="js\bootstrap-typeahead.js"></script> </body> </html>
este es mi codigo
|
|
|
|
|
|
|