ok, te paso el codigo de las 3 paginas, uno donde se compra, otra que lo añade de forma oculta y la que lo recibe,
aki se compra
Código PHP:
Ver original<?php require_once('Connections/conexionzapatos.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
doubleval($theValue) : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$varProducto_DatosProducto = "0";
if (isset($_GET["recordID"])) { $varProducto_DatosProducto = $_GET["recordID"];
}
$query_DatosProducto = sprintf("SELECT * FROM tblproducto WHERE tblproducto.idProducto = %s", GetSQLValueString
($varProducto_DatosProducto, "int"));
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Documento sin título</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="estilo/principal.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">
<div class="header"><div class="headerinterior"><img src="images/logotrans.png" width="283" height="64" alt="Tienda Zapatos" /></div></div>
<div class="subcontenedor">
<div class="sidebar1">
<?php include("includes/catalogo.php"); ?>
<!-- end .sidebar1 --></div>
<div class="content">
<?php echo $row_DatosProducto['strNombre']; ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="documentos/productos/<?php echo $row_DatosProducto['strImagen']; ?>" width="450" height="450" /></td>
<td valign="top"><p><?php echo $row_DatosProducto['strNombre']; ?></p>
<p><?php echo $row_DatosProducto['dblPrecio']; ?></p>
<?php if ((isset($_SESSION['MM_IdUsuario'])) && ($_SESSION['MM_IdUsuario']!="")) {?>
<p><a href="carrito_add.php?recordID=<?php echo $row_DatosProducto['idProducto']; ?>">Comprar Producto</a></p>
<?php }
else
{?>
Necesitas <a href="alta_usuario.php">darte de alta</a> para comprar. Es gratuito.
<?php }?></td>
</tr>
<tr>
</tr>
</table>
</div>
<!-- end .subcontenedor -->
</div>
<div class="footer">
<p>Pie de pagina</p>
<!-- end .footer --></div>
<!-- end .container --></div>
</body>
</html>
<?php
?>
esta recibe los productos y los manda a otra de manera oculta
Código PHP:
Ver original<?php require_once('Connections/conexionzapatos.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
doubleval($theValue) : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); }
$insertSQL = sprintf("INSERT INTO tblcarrito (idUsuario, idProducto, strNombre ,intCantidad) VALUES (%s, %s, %s, %s)", GetSQLValueString($_SESSION['MM_IdUsuario'], "int"),
GetSQLValueString($_GET['strNombre'], "text"),
GetSQLValueString($_GET['recordID'], "text"),1);
$insertGoTo = "carrito_lista.php";
if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ?
"&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING'];
}
?>
y esta lo saca por pantalla
Código PHP:
Ver original<?php require_once('Connections/conexionzapatos.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
doubleval($theValue) : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$varUsuario_DatosCarrito = "0";
if (isset($_SESSION["MM_IdUsuario"])) { $varUsuario_DatosCarrito = $_SESSION["MM_IdUsuario"];
}
$query_DatosCarrito = sprintf("SELECT * FROM tblcarrito WHERE tblcarrito.idUsuario = %s AND tblcarrito.intTransaccionEfectuada = 0", GetSQLValueString
($varUsuario_DatosCarrito, "int")); ?>
<table width="900" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="247">Producto</td>
<td>nombre</td>
<td>Unidades</td>
<td width="265">Precio</td>
<td width="84">Acciones</td>
</tr>
<?php $preciototal = 0;?>
<?php do { ?>
<tr>
<td><?php echo ObtenerNombreProducto($row_DatosCarrito['idProducto']); ?></td>
<td width="39"><?php echo $row_DatosCarrito['strNombre']; ?></td>
<td width="265"><?php echo $row_DatosCarrito['intCantidad']; ?></td>
<td><?php echo ObtenerPrecioProducto($row_DatosCarrito['idProducto']); ?> Euros</td>
<td><a href="eliminar_producto.php?recordID=<?php echo $row_DatosCarrito['idProducto']; ?>">Eliminar</a></td>
</tr>
<?php $preciototal = $preciototal + ObtenerPrecioProducto($row_DatosCarrito['idProducto']);?>
<tr>
<td> </td>
<td align="right"> </td>
<td align="right">Subtotal:</td>
<td><?php echo $preciototal; ?> Euros</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="right"> </td>
<td align="right">IVA:</td>
<td><?php echo ObtenerIVA(); ?>%</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="right"> </td>
<td align="right">Valor del IVA:</td>
<td><?php
$multiplicador = ObtenerIVA()/100;
$valordelIVA = $preciototal * $multiplicador;
echo $valordelIVA;?> Euros</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="right"> </td>
<td align="right">Total con IVA:</td>
<td><?php
$multiplicador = (100 + ObtenerIVA())/100;
$valorconIVA = $preciototal * $multiplicador;
echo $valorconIVA;?> Euros</td>
<td> </td>
</tr>
</table>
<a href="carrito_forma_pago.php">Seleccionar Forma de Pago</a>
ahi esta todo, gracias