Sie sind auf Seite 1von 14

<?

php
include("conexion.php");
?>
<html lang="es">
<head>
<meta charset="utf-8"/>
<title>Carrito de Compras</title>

<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/jquery.ui.touch-punch.js"></script>

<script type="text/javascript" src="js/jquery.js"></script>


<meta http-equiv="Content-Type" content="text/html;charset=utf8"/>
<style>
h1 {
padding: .2em;
margin: 0;
font-size: 12px;
text-align: center;
}
#products {float:left; width:200px; margin-right: 2em;}
#cart {width: 300px; float:left; margin-left:20px;}
#cart ol {margin:0; padding: 1em 0 1em 3em;}
h3{background-color:#2075CA; color:#F8F8F8; height:
20px;padding:10px;}

img{

background-color: #D8D8D8;
color: #393939;
margin-bottom: 10px;
padding: 10px;
list-style: none;
text-align: center;
}
li{background-color: #D8D8D8; color:#393939; marginbottom:10px;padding:10px;list-style:none;}
.carrito{width: 100px;height:auto; backgroundcolor:#FFFAFA;border:solid 1px #FF6366; border-radius:5px; }
ol{width: 200px;height: auto;}
.zona{background-color:#A1ECB5;}
.activo{background-color:#29B34C;}
.articulonew{width: 100px;}
#product div ul table tr td {
font-family: Verdana, Geneva, sans-serif;
}
#product div ul table {
font-size: 10px;
text-align: center;
}
#apDiv1 {
position: absolute;
left: 694px;
top: 176px;
width: 328px;
height: 164px;
z-index: 1;

}
</style>

<script>
$(function()
{
var cedula = document.getElementById("txtcedula").value;
var factura= document.getElementById('txtfactura').value;
var nombre= document.getElementById('txtcoger').value;
var cantidad= document.getElementById('txtcant').value;
var precio= document.getElementById('txtprecio').value;

$("#catalog img").draggable({
appendTo: "body",
helper: "clone"
});
$("#cart ol").droppable({
activeClass: "zona",
hoverClass: "activo",
drop: function(event, ui){

$( this ).find( ".placeholder").remove();


var id=ui.draggable.attr('id');
//var cedula=ui.draggable.attr('cedula');
var ruta = "insertar.php";

$.ajax({
type: "POST",

url: "insertar.php",
data:
('cedula='+cedula+'&factura='+factura+'&nombre='+nombre+'&cantidad
='+cantidad+'&precio='+precio),

success: function (datos)


{
$("#respuesta").html(datos);

})
.done(function( msg ) {
alert ("Guardado: " + msg );
window.location.reload();
});

$('<li></li>').text(ui.draggable.text()).appendTo( this );
}
}).sortable({
items: "img:not(.placeholder)",
sort:function() {

}
});
});
</script>

<?php

$re=mysql_query("select * from compras_productos")or


die(mysql_error());
while ($f=mysql_fetch_array($re)) {
?>
<?php
}
?>
</head>
<body>
<form name="form1" method="post" action="insertar.php">
<div id="apDiv1">
<div id="cart">
<h1><img src="img/Shopping-Cart.png" width="105"
height="96">Compras</h1>
<ol>
<li class="placeholder">Aadir Compra</li>
<?php
$res = mysql_query("SELECT * FROM compras_productos");
while($r = mysql_fetch_array($res))
{
//echo '<li id="fila'.$r['id'].'">'.$productos[$r['id']].' <span
class="quitar" onclick="quitarprod('.$r['id'].')">quitar</span>';
}

?>

<?php
// $cedulaC=$_POST['usuario'];
//$cedulaC=123;
?>

</ol>
</div>
</div>
<div id="catalog">
<div id="product"><h3>
<label for="textfield3"></label>
Usuario

<input type="text" name="txtcedula" id="txtcedula" >


N. Factura
<input type="text" name="txtfactura" id="txtfactura">
Detalles (Artculo)
<label for="txtcoger"></label>
<input name="txtcoger" type="text" id="txtcoger" style="background:
transparent;" size="13" maxlength="13" readonly>
Cantidad
<input name="txtcant" type="text" id="txtcant" size="3" maxlength="3"
readonly style="background: transparent;">
Valor
<input name="txtprecio" type="text" id="txtprecio" size="3"
maxlength="3" readonly style="background: transparent;">
</h3>
</div>
</p>
<div id="product">
<h3>Ropa y Pelucas</h3>
<div>
<ul>

<table width="267" height="204" border="1">


<tr>
<td><div align="center"><img border="0" src="img/vestido.png"
alt="" width="87" height="117"
onMouseOver="document.getElementById('txtcoger').value=document.getE
lementById('ropa1').value"
onMouseOut="document.getElementById('txtcant').value=document.getEle
mentById('txtcant1').value"
onMouseDown="document.getElementById('txtprecio').value=document.ge
tElementById('txtprecio1').value"><?php echo $f['nombre'];?></div></td>
<td><div align="center"><a href="#"><img border="0"
src="img/pac_005.png" alt="" width="87" height="117"
onMouseOver="document.getElementById('txtcoger').value=document.getE
lementById('ropa2').value"
onMouseOut="document.getElementById('txtcant').value=document.getEle
mentById('txtcant2').value"
onMouseDown="document.getElementById('txtprecio').value=document.ge
tElementById('txtprecio2').value" ></a><?php echo $f['nombre'];?
></div></td>
<td><div align="center"><a href="#"><img border="0"
src="img/pac_002.png" alt="" width="87" height="117"
onMouseOver="document.getElementById('txtcoger').value=document.getE
lementById('ropa3').value"
onMouseOut="document.getElementById('txtcant').value=document.getEle
mentById('txtcant3').value"
onMouseDown="document.getElementById('txtprecio').value=document.ge
tElementById('txtprecio3').value"></a><?php echo $f['nombre'];?
></div></td>
<td><div align="center"><a href="#"><img border="0"
src="img/images.jpg" alt="" width="87" height="117"
onMouseOver="document.getElementById('txtcoger').value=document.getE
lementById('ropa4').value"
onMouseOut="document.getElementById('txtcant').value=document.getEle
mentById('txtcant4').value"
onMouseDown="document.getElementById('txtprecio').value=document.ge
tElementById('txtprecio4').value"></a><?php echo $f['nombre'];?
></div></td>
<td><div align="center"><a href="#"><img border="0"
src="img/sombrero.jpg" alt="" width="87" height="117"
onMouseOver="document.getElementById('txtcoger').value=document.getE
lementById('ropa5').value"
onMouseOut="document.getElementById('txtcant').value=document.getEle
mentById('txtcant5').value"

onMouseDown="document.getElementById('txtprecio').value=document.ge
tElementById('txtprecio5').value"></a><?php echo $f['nombre'];?
></div></td>
</tr>
<tr>
<td width="104"><div align="center">
<label for="ropa1"></label>
<input name="ropa1" type="text" id="ropa1" value="Vestido"
size="10" maxlength="10" readonly>
</div></td>
<td width="76"><div align="center">
<input name="ropa2" type="text" id="ropa2" value="Pantaloneta"
size="13" maxlength="13" readonly>
</div></td>
<td width="84"><div align="center">
<input name="ropa3" type="text" id="ropa3" value="Pantaln"
size="13" maxlength="13" readonly>
</div></td>
<td width="61"><div align="center">
<input name="ropa4" type="text" id="ropa4" value="Pelucas"
size="10" maxlength="10" readonly>
</div></td>
<td width="108"><div align="center">
<input name="ropa5" type="text" id="ropa5" value="Sombreros"
size="13" maxlength="13" readonly>
</div></td>
</tr>
<tr>
<td><div align="center">Precio:
$.
<label for="textfield"></label>

<input type="text" name="txtprecio1" id="txtprecio1" value="45"


size="4" maxlength="2" readonly>
</div></td>
<td><div align="center">Precio:
$.
<label for="textfield"></label>
<input type="text" name="txtprecio2" id="txtprecio2" value="35"
size="4" maxlength="2" readonly>
</div></td>
<td><div align="center">Precio:
$.
<label for="textfield"></label>
<input type="text" name="txtprecio3" id="txtprecio3" value="65"
size="4" maxlength="2" readonly>
</div></td>
<td><div align="center">Precio:
$.
<label for="textfield"></label>
<input type="text" name="txtprecio4" id="txtprecio4" value="28"
size="4" maxlength="2" readonly>
</div></td>
<td><div align="center">Precio:
$.
<label for="textfield"></label>
<input type="text" name="txtprecio5" id="txtprecio5" value="15"
size="4" maxlength="2" readonly>
</div></td>
</tr>
<tr>
<td height="26">Cant:

<label for="v3"></label>
<input name="txtcant1" type="text" id="txtcant1" value="1"
size="2" maxlength="2"></td>
<td>Cant:
<label for="v4"></label>
<input name="txtcant2" type="text" id="txtcant2" value="1"
size="2" maxlength="2"></td>
<td>Cant:
<label for="v5"></label>
<input name="txtcant3" type="text" id="txtcant3" value="1"
size="2" maxlength="2"></td>
<td>Cant:
<label for="textfield7"></label>
<input name="txtcant4" type="text" id="txtcant4" value="1"
size="2" maxlength="2"></td>
<td>Cant:
<label for="textfield8"></label>
<input name="txtcant5" type="text" id="txtcant5" value="1"
size="2" maxlength="2"></td>
</tr>
</table>
</ul>
</div>
</div>
<div id="catalog">
<h3>Calzado</h3>
<div>
<ul>
<table width="559" border="1">
<tr>

<td><div align="center"><a href="#"><img border="0"


src="img/pac_006.png" alt="" width="87" height="117"
onMouseOver="document.getElementById('txtcoger').value=document.getE
lementById('ropa6').value"
onMouseOut="document.getElementById('txtcant').value=document.getEle
mentById('txtcant6').value"
onMouseDown="document.getElementById('txtprecio').value=document.ge
tElementById('txtprecio6').value"></a><?php echo $f['nombre'];?
></div></td>
<td><div align="center"><a href="#"><img border="0"
src="img/pac_007.png" alt="" width="87" height="117"
onMouseOver="document.getElementById('txtcoger').value=document.getE
lementById('ropa7').value"
onMouseOut="document.getElementById('txtcant').value=document.getEle
mentById('txtcant7').value"
onMouseDown="document.getElementById('txtprecio').value=document.ge
tElementById('txtprecio7').value"></a><?php echo $f['nombre'];?
></div></td>
<td><div align="center"><a href="#"><img border="0"
src="img/sandalias1.png" alt="" width="87" height="117"
onMouseOver="document.getElementById('txtcoger').value=document.getE
lementById('ropa8').value"
onMouseOut="document.getElementById('txtcant').value=document.getEle
mentById('txtcant8').value"
onMouseDown="document.getElementById('txtprecio').value=document.ge
tElementById('txtprecio8').value"></a><?php echo $f['nombre'];?
></div></td>
<td><div align="center"><a href="#"><img border="0"
src="img/zapato.png" alt="" width="87" height="117"
onMouseOver="document.getElementById('txtcoger').value=document.getE
lementById('ropa9').value"
onMouseOut="document.getElementById('txtcant').value=document.getEle
mentById('txtcant9').value"
onMouseDown="document.getElementById('txtprecio').value=document.ge
tElementById('txtprecio9').value"></a><?php echo $f['nombre'];?
></div></td>
<td><div align="center"><a href="#"><img border="0"
src="img/camara.jpg" alt="" width="87" height="117"
onMouseOver="document.getElementById('txtcoger').value=document.getE
lementById('ropa10').value"
onMouseOut="document.getElementById('txtcant').value=document.getEle
mentById('txtcant10').value"
onMouseDown="document.getElementById('txtprecio').value=document.ge
tElementById('txtprecio10').value"></a><?php echo $f['nombre'];?
></div></td>

</tr>
<tr>
<td><div align="center">
<label for="ropa1"></label>
<input name="ropa6" type="text" id="ropa6" value="Botas"
size="10" maxlength="10" readonly>
</div></td>
<td><div align="center">
<input name="ropa7" type="text" id="ropa7" value="Zapatillas"
size="13" maxlength="13" readonly>
</div></td>
<td><div align="center">
<input name="ropa8" type="text" id="ropa8" value="Zandallas"
size="13" maxlength="13" readonly>
</div></td>
<td><div align="center">
<input name="ropa9" type="text" id="ropa9" value="Ballet"
size="10" maxlength="10" readonly>
</div></td>
<td><div align="center">
<input name="ropa10" type="text" id="ropa10" value="Cmaras"
size="13" maxlength="13" readonly>
</div></td>
</tr>
<tr>
<td><div align="center">Precio:
$.
<label for="textfield"></label>
<input type="text" name="txtprecio6" id="txtprecio6" value="75"
size="4" maxlength="2" readonly>
</div></td>

<td><div align="center">Precio:
$.
<label for="textfield"></label>
<input type="text" name="txtprecio7" id="txtprecio7" value="95"
size="4" maxlength="2" readonly>
</div></td>
<td><div align="center">Precio:
$.
<label for="textfield"></label>
<input type="text" name="txtprecio8" id="txtprecio8" value="18"
size="4" maxlength="2" readonly>
</div></td>
<td><div align="center">Precio:
$.
<label for="textfield"></label>
<input type="text" name="txtprecio9" id="txtprecio9" value="36"
size="4" maxlength="2" readonly>
</div></td>
<td><div align="center">Precio:
$.
<label for="textfield"></label>
<input type="text" name="txtprecio10" id="txtprecio10"
value="150" size="5" maxlength="3" readonly>
</div></td>
</tr>
<tr>
<td height="26">Cant:
<label for="v8"></label>
<input name="txtcant6" type="text" id="txtcant6" value="1"
size="2" maxlength="2"></td>

<td>Cant:
<label for="v9"></label>
<input name="txtcant7" type="text" id="txtcant7" value="1"
size="2" maxlength="2"></td>
<td>Cant:
<label for="v10"></label>
<input name="txtcant8" type="text" id="txtcant8" value="1"
size="2" maxlength="2"></td>
<td>Cant:
<label for="textfield5"></label>
<input name="txtcant9" type="text" id="txtcant9" value="1"
size="2" maxlength="2"></td>
<td>Cant:
<label for="textfield6"></label>
<input name="txtcant10" type="text" id="txtcant10" value="1"
size="2" maxlength="2"></td>
</tr>
</table>
</ul>
</div>
</div>
</form>
</body>
</html>

Das könnte Ihnen auch gefallen