1 archivo carrito.htm
1 archivo estado.htm
1 archivo formulario
1 archivo enviar.pl
el archivo carrito.htm
en el cual se encuentran los sig. items
modelo/articulo/Precio/unidades
en donde el cliente pone las unidades que quiere del modelo y apretando el boton "agregar"
me manda los resultados a estado.htm donde se suma el costo total..
hasta ahi todo barbaro el tema es que tengo que agregar como item TALLES MEDIANTE UN CHECKBOX se me ocurre o si alguin me puede dar alguna otra solucion bienvenida sea.
quiero agregarlos siguientes talles 2/4/6/8/10/12/curva..
como puedo hacer para que ademas de las unidades me tome los datos que marco de los talles en el checkbox y me los pase al archivo estado.htm???
este es el archivo carrito.htm
<html>
<head>
<title>Carrito de Compra</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content="">
<meta name="title" content="">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="distribution" content="">
<meta name="resource-type" content="">
<meta name="revisit" content="">
<meta name="robots" content="">
<style type="text/css">
.body {
font-family: Times New Roman;
font-size: 10pt;
font-style: normal;
font-weight: normal;
font-variant: normal;
color: #000000;
}
.td {
font-family: Times New Roman;
font-size: 10pt;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
color: #000000;
}
.Estilo8 {font-family: "Courier New", Courier, monospace; font-weight: bold; }
</style>
<script LANGUAGE="JavaScript">
<!--
function CargarFoto(img, ancho, alto){
derecha=(screen.width-ancho)/2;
arriba=(screen.height-alto)/2;
string="toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+ancho+",height="+alto+",left="+derecha+",top="+arriba+"";
fin=window.open(img,"",string);
}
// -->
</script>
</head>
<body bgcolor="#FFFFFF" link="#32468D" vlink="#800080" class="body">
<SCRIPT LANGUAGE="JavaScript">
function buyItem(newItem, newPrice, newQuantity) {
if (newQuantity <= 0) {
rc = alert('La cantidad ingresada es incorrecta');
return false;
}
if (confirm('¿Agregar '+newQuantity+' '+newItem+' al carrito?')) {
index = document.cookie.indexOf("TheBasket");
countbegin = (document.cookie.indexOf("=", index) + 1);
countend = document.cookie.indexOf(";", index);
if (countend == -1) {
countend = document.cookie.length;
}
document.cookie="TheBasket="+document.cookie.substring(countbegin, countend)+"["+newItem+","+newPrice+"#"+newQuantity+"]";
}
return true;
}
function resetShoppingBasket() {
index = document.cookie.indexOf("TheBasket");
document.cookie="TheBasket=.";
}
</SCRIPT>
<center>
<p> </p>
<table border="0" cellpadding="0" cellspacing="0" width="640" class="body">
<tr>
<td width="50%"><big><big>Pedido de Compra</big></big></td>
<td width="50%" align="right">[Pedido de Compra | <a href="estado.htm">Estado</a> | <a href="formulario.htm">Formulario</a> ]</td>
</tr>
<tr>
<td width="100%" colspan="2">
<hr size="1" color="#000000">
</td>
</tr>
<tr>
<td width="100%" colspan="2"> </td>
</tr>
</table>
<form NAME="itemsform">
<table width="662" height="318" border="0">
<tr>
<td width="426"><table border="1" cellspacing="0" width="402" bgcolor="#E0E0E0" bordercolor="#FFFFFF" class="td"> <tr>
<td valign="top" align="center"><div align="center">Modelo</div></td>
<td valign="top"><div align="center">Articulo</div></td>
<td align="center" valign="top"><div align="center">$</div></td>
<td valign="top" align="center"><div align="center">Unid</div></td>
<td valign="top" align="center">talle</td>
</tr>
<tr>
<td width="127" valign="top" align="center"><a href="javascript:CargarFoto('imagenes/casiangeles.JPG','452','572')"><img src="thumbnails/casiangeles.jpg" alt="d" width="89" height="100" border="0"></a></td>
<td width="151" valign="top"><div align="center">
<p><a href="javascript:CargarFoto('imagenes/casiangeles.JPG','452','572')"><strong>saa</strong></a><br>
<small>dasdas</small> </p>
<p>
<input type="button" name="cbtadd3" value="Agregar"
onClick="buyItem('saa','1', document.itemsform.agregar1.value)">
</p>
</div></td>
<td width="21" align="center" valign="top">1</td>
<td width="26" valign="top" align="center"><input TYPE="value" NAME="agregar1" VALUE="1"
SIZE="3"> </td>
<td width="55" valign="top" align="center"> </td>
</tr>
<tr>
<td width="127" valign="top" align="center"><a href="javascript:CargarFoto('imagenes/hex2.jpg','294','171')"><img src="thumbnails/hex2.jpg" alt="s" width="101" height="80" border="0"></a></td>
<td width="151" valign="top"><div align="center">
<p><a href="javascript:CargarFoto('imagenes/hex2.jpg','294','171')"><strong>0774</strong></a><br>
<small>Pucca</small> </p>
<p>
<input type="button" name="cbtadd2" value="Agregar"
onClick="buyItem('0774','26', document.itemsform.agregar2.value)">
</p>
</div></td>
<td width="21" align="center" valign="top"><div align="center">26</div></td>
<td width="26" valign="top" align="center"><input TYPE="value" NAME="agregar2" VALUE="1"
SIZE="3"> </td>
<td width="55" valign="top" align="center"> </td>
</tr>
<tr>
<td width="127" valign="top" align="center"><a href="javascript:CargarFoto('imagenes/hex4.jpg','294','171')"><img src="thumbnails/hex4.jpg" alt="d" width="113" height="85" border="0"></a></td>
<td width="151" valign="top"><div align="center">
<p><a href="javascript:CargarFoto('imagenes/hex4.jpg','294','171')"><strong>0286</strong></a><br>
<small>Sumo</small> </p>
<p>
<input type="button" name="cbtadd" value="Agregar"
onClick="buyItem('0286','28', document.itemsform.agregar3.value)">
</p>
</div></td>
<td width="21" align="center" valign="top">28</td>
<td width="26" valign="top" align="center"><input TYPE="value" NAME="agregar3" VALUE="1"
SIZE="3"> </td>
<td width="55" valign="top" align="center"> </td>
</tr>
</table>
<p> </p></td>
<td width="226"><p> </p></td>
</tr>
</table>
<script language="JavaScript">
var NS4 = (document.layers);
var IE4 = (document.all);
var win = window; // Con frames usar top.nombre.window;
var n = 0;
function BuscarPalabras(str)
{
var txt, i, found;
if (str == "")
return false;
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
// No se encuentra en ninguna parte y envia un mensaje.
if (n == 0)
alert("No se encuentra.");
}
if (IE4) {
txt = win.document.body.createTextRange();
// Encuentra la coinsidencia desde el inicio de pagina.
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart("character", 1);
txt.moveEnd("textedit");
}
// Si lo encuentra, marca el resultado y mueve la barra de desplazamiento
// para mostrarlo.
if (found) {
txt.moveStart("character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
// De otra manera regresa al inicio de la página para buscar otra coinsidencia
else {
if (n > 0) {
n = 0;
BuscarPalabras(str);
}
// No se encuentra en ninguna parte envia un mensaje.
else
alert("No se encontró.");
}
}
return false;
}
</script>
<Br>
<script language=JavaScript>document.write(window.screen.width+ " x "+window.screen.height)
</script>
<table border="0" cellpadding="0" cellspacing="0" width="640" class="body">
<tr>
<td width="100%" colspan="2">
<hr size="1" color="#000000">
</td>
</tr>
<tr>
<tr>
<td width="50%"></td>
<td width="50%" align="right">Página [<a href="carrito.htm">1</a>]</td>
</tr>
</table>
</center>
</body>
</html>
este es el archivo estado.htm
<html>
<head>
<title>Estado del Carrito</title>
<style type="text/css">
.body {
font-family: Times New Roman;
font-size: 10pt;
font-style: normal;
font-weight: normal;
font-variant: normal;
color: #000000;
}
.td {
font-family: Times New Roman;
font-size: 10pt;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
color: #000000;
}
</style>
</head>
<SCRIPT LANGUAGE="JavaScript">
function alterError(value) {
if (value<=0.99) {
newPounds = '0';
} else {
newPounds = parseInt(value);
}
newPence = parseInt((value+.0008 - newPounds)* 100);
if (eval(newPence) <= 9) newPence='0'+newPence;
newString = newPounds + '.' + newPence;
return (newString);
}
function showItems() {
index = document.cookie.indexOf("TheBasket");
countbegin = (document.cookie.indexOf("=", index) + 1);
countend = document.cookie.indexOf(";", index);
if (countend == -1) {
countend = document.cookie.length;
}
fulllist = document.cookie.substring(countbegin, countend);
totprice = 0;
document.writeln('<form><table border="1" cellspacing="0" width="640" bgcolor="#E0E0E0" bordercolor="#FFFFFF" class="td">');
document.writeln('<TR><TD width="250"><b>Producto</b></TD><TD width="80" align="right"><b>Cantidad</b></TD><TD width="120" align="right"><b>Costo x unidad</b></TD><td width="100" align="right"><b>Costo total</b><TD width="90"> </TD></TR>');
itemlist = 0;
for (var i = 0; i <= fulllist.length; i++) {
if (fulllist.substring(i,i+1) == '[') {
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == ']') {
itemend = i;
thequantity = fulllist.substring(itemstart, itemend);
itemtotal = 0;
itemtotal = (eval(theprice*thequantity));
temptotal = itemtotal * 100;
var tax = itemtotal / 100 * (0 - 0);
tax = Math.floor(tax * 100)/100
totprice = totprice + itemtotal + tax;
itemlist=itemlist+1;
document.writeln('<tr><td>'+theitem+'</td><td align=right>'+thequantity+'</td><td align=right>'+theprice+'</td><td align=right>'+alterError(itemtotal)+'</td><td align=center><input TYPE="button" NAME="remove" VALUE="Quitar" onclick="javascript:removeItem('+itemlist+')"></td></tr>');
} else if (fulllist.substring(i,i+1) == ',') {
theitem = fulllist.substring(itemstart, i);
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == '#') {
theprice = fulllist.substring(itemstart, i);
itemstart = i+1;
}
}
document.writeln('<tr><td colspan=3><b>Total</b></td><td align=right>'+alterError(totprice)+'</td><td> </td></tr>');
document.writeln('</TABLE>');
}
function removeItem(itemno) {
newItemList = null;
itemlist = 0;
for (var i = 0; i <= fulllist.length; i++) {
if (fulllist.substring(i,i+1) == '[') {
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == ']') {
itemend = i;
theitem = fulllist.substring(itemstart, itemend);
itemlist=itemlist+1;
if (itemlist != itemno) {
newItemList = newItemList+'['+fulllist.substring(itemstart, itemend)+']';
}
}
}
index = document.cookie.indexOf("TheBasket");
document.cookie="TheBasket="+newItemList;
top.location = "estado.htm";
}
function clearBasket() {
if (confirm('¿Confirma que desea reestablecer el carrito?')) {
index = document.cookie.indexOf("TheBasket");
document.cookie="TheBasket=.";
top.location = "estado.htm";
}
}
</SCRIPT>
<body bgcolor="#FFFFFF" link="#32468D" vlink="#800080" class="body">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="640" class="body">
<tr>
<td width="50%"><big><big>Estado del Carrito</big></big></td>
<td width="50%" align="right">[ <a href="carrito.htm">Carrito de Compra</a> | Estado | <a href="formulario.htm">Formulario</a> ]</td>
</tr>
<tr>
<td width="100%" colspan="2">
<hr size="1" color="#000000">
</td>
</tr>
<tr>
<td width="100%" colspan="2"></td>
</tr>
</table>
<br>
<SCRIPT LANGUAGE="JavaScript">
showItems();
</SCRIPT>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="640" class="body">
<tr>
<td width="100%" colspan="2">
<hr size="1" color="#000000">
</td>
</tr>
<tr>
<td width="50%"></td>
<td width="50%" align="right">[ <a href="javascript:clearBasket()">Reestablecer
Carrito</a> ]</td>
</tr>
</table>
<SCRIPT LANGUAGE="JavaScript">
if (window.print) {
document.write('<form>No olvides de '
+ '<input type=button name=print value="imprimir" '
+ 'onClick="javascript:window.print()"> esta pagina!</form>');
}
</script>
</center>
</body>
</html>
y por ultimo el archivo formulario.htm
<html>
<head>
<title>Formulario</title>
<style type="text/css">
.body {
font-family: Times New Roman;
font-size: 10pt;
font-style: normal;
font-weight: normal;
font-variant: normal;
color: #000000;
}
.td {
font-family: Times New Roman;
font-size: 10pt;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
color: #000000;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function Enviar(form) {
for (i = 0; i < form.elements.length; i++) {
if (form.elements[i].type == "text" && form.elements[i].value == "") {
alert("Por favor complete todos los campos del formulario"); form.elements[i].focus();
return false; }
}
form.submit();
}
// -->
</SCRIPT>
</head>
<body bgcolor="#FFFFFF" link="#32468D" vlink="#800080" class="body">
<SCRIPT LANGUAGE="JavaScript">
function alterError(value) {
if (value<=0.99) {
newPounds = '0';
} else {
newPounds = parseInt(value);
}
newPence = parseInt((value+.0008 - newPounds)* 100);
if (eval(newPence) <= 9) newPence='0'+newPence;
newString = newPounds + '.' + newPence;
return (newString);
}
function showItems() {
index = document.cookie.indexOf("TheBasket");
countbegin = (document.cookie.indexOf("=", index) + 1);
countend = document.cookie.indexOf(";", index);
if (countend == -1) {
countend = document.cookie.length;
}
fulllist = document.cookie.substring(countbegin, countend);
totprice = 0;
itemlist = 0;
for (var i = 0; i <= fulllist.length; i++) {
if (fulllist.substring(i,i+1) == '[') {
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == ']') {
itemend = i;
thequantity = fulllist.substring(itemstart, itemend);
itemtotal = 0;
itemtotal = (eval(theprice*thequantity));
temptotal = itemtotal * 100;
var tax = itemtotal / 100 * (0 - 0);
tax = Math.floor(tax * 100)/100
totprice = totprice + itemtotal + tax;
itemlist=itemlist+1;
document.writeln('<INPUT TYPE="hidden" NAME="Producto'+itemlist+'" VALUE="'+theitem+'" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="Cantidad'+itemlist+'" VALUE="'+thequantity+'" SIZE="40">')
document.writeln('<INPUT TYPE="hidden" NAME="ProductoTotal'+itemlist+'" VALUE="'+alterError(itemtotal)+'" SIZE="40">');
} else if (fulllist.substring(i,i+1) == ',') {
theitem = fulllist.substring(itemstart, i);
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == '#') {
theprice = fulllist.substring(itemstart, i);
itemstart = i+1;
}
}
document.writeln('<INPUT TYPE="hidden" NAME="Total" VALUE="'+alterError(totprice)+'" SIZE="40">');
}
function Total() {
document.writeln(alterError(totprice));
}
</SCRIPT>
<center>
<table border="0" cellpadding="0" cellspacing="0" width="640" class="body">
<tr>
<td width="50%"><big><big>Formulario</big></big></td>
<td width="50%" align="right">[ <a href="carrito.htm">Carrito de Compra</a> | <a href="estado.htm">Estado</a> | Formulario ]</td>
</tr>
<tr>
<td width="100%" colspan="2">
<hr size="1" color="#000000">
</td>
</tr>
<tr>
<td width="100%" colspan="2"></td>
</tr>
</table>
<FORM method="post" action="/cgi-bin/enviar.pl" target="_top">
<input type=hidden name="recipient" value="[email protected]">
<input type=hidden name="subject" value="Cibertienda - Orden de Compra">
<input type=hidden name="redirect" value="http://www.huevofritoargentina.com.ar">
<input type=hidden name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT">
<table cols="2" width="370" class="body">
<td width="130"></td>
<td width="270">
</td>
</tr>
<tr><td>Nombre</td><td><input type="text" name="nombre" size=34></td></tr>
<tr><td>Apellido</td><td><input type="text" name="apellido" size=34></td></tr>
<tr><td>Domicilio</td><td><input type="text" name="domicilio" size=34></td></tr>
<tr><td>Ciudad</td><td><input type="text" name="ciudad" size=34></td></tr>
<tr><td>Provincia</td><td><input type="text" name="provincia" size=34></td></tr>
<tr><td>Código Postal</td><td><input type="text" name="cp" size=34></td></tr>
<tr><td>País</td><td><input type="text" name="pais" size=34></td></tr>
<tr><td>E-mail</td><td><input type="text" name="email" size=34></td></tr>
<tr><td>Teléfono</td><td><input type="text" name="telefono" size=34></td></tr>
<tr><td>Fax</td><td><input type="text" name="fax" size=34></td></tr>
<SCRIPT LANGUAGE="JavaScript">
showItems();
</SCRIPT>
<tr>
<td>Total:</td>
<td>$
<SCRIPT LANGUAGE="JavaScript">Total()</SCRIPT>
</td>
</tr>
<tr>
<td><br><br></td>
<td>
<input type="button" value="Enviar" onClick="return Enviar(this.form)">
<input type="reset" value="Restablecer">
</td>
</tr>
</table>
</form>
</center>
</body>
</html>