Ver Mensaje Individual
  #5 (permalink)  
Antiguo 31/12/2014, 05:35
eslomao
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
Respuesta: varios parametros

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
  1. <?php require_once('Connections/conexionzapatos.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. $varProducto_DatosProducto = "0";
  35. if (isset($_GET["recordID"])) {
  36.   $varProducto_DatosProducto = $_GET["recordID"];
  37. }
  38. mysql_select_db($database_conexionzapatos, $conexionzapatos);
  39. $query_DatosProducto = sprintf("SELECT * FROM tblproducto WHERE tblproducto.idProducto = %s", GetSQLValueString($varProducto_DatosProducto, "int"));
  40. $DatosProducto = mysql_query($query_DatosProducto, $conexionzapatos) or die(mysql_error());
  41. $row_DatosProducto = mysql_fetch_assoc($DatosProducto);
  42. $totalRows_DatosProducto = mysql_num_rows($DatosProducto);
  43.  
  44.  
  45.  
  46. ?>
  47. <head>
  48. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  49. <!-- InstanceBeginEditable name="doctitle" -->
  50. <title>Documento sin título</title>
  51. <!-- InstanceEndEditable -->
  52. <!-- InstanceBeginEditable name="head" -->
  53. <!-- InstanceEndEditable -->
  54. <link href="estilo/principal.css" rel="stylesheet" type="text/css" />
  55. </head>
  56.  
  57. <body>
  58.  
  59. <div class="container">
  60.   <div class="header"><div class="headerinterior"><img src="images/logotrans.png" width="283" height="64" alt="Tienda Zapatos" /></div></div>
  61.   <div class="subcontenedor">
  62.               <div class="sidebar1">
  63.                <?php include("includes/catalogo.php"); ?>
  64. <!-- end .sidebar1 --></div>
  65.               <div class="content">
  66.                 <?php echo $row_DatosProducto['strNombre']; ?>
  67.                
  68.                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  69.                   <tr>
  70.                     <td><img src="documentos/productos/<?php echo $row_DatosProducto['strImagen']; ?>" width="450" height="450" /></td>
  71.                     <td valign="top"><p><?php echo $row_DatosProducto['strNombre']; ?></p>
  72.                     <p><?php echo $row_DatosProducto['dblPrecio']; ?></p>
  73.                     <?php if ((isset($_SESSION['MM_IdUsuario']))  && ($_SESSION['MM_IdUsuario']!=""))
  74.                     {?>
  75.                     <p><a href="carrito_add.php?recordID=<?php echo $row_DatosProducto['idProducto']; ?>">Comprar Producto</a></p>
  76.                     <?php }
  77.                     else
  78.                     {?>
  79.                     Necesitas <a href="alta_usuario.php">darte de alta</a> para comprar. Es gratuito.
  80. <?php }?></td>
  81.                   </tr>
  82.                   <tr>
  83.                   </tr>
  84.                 </table>
  85.                 </div>
  86.     <!-- end .subcontenedor -->
  87.     </div>
  88.   <div class="footer">
  89.     <p>Pie de pagina</p>
  90.     <!-- end .footer --></div>
  91.   <!-- end .container --></div>
  92. </body>
  93. </html>
  94. <?php
  95. mysql_free_result($DatosProducto);
  96. ?>

esta recibe los productos y los manda a otra de manera oculta
Código PHP:
Ver original
  1. <?php require_once('Connections/conexionzapatos.php'); ?>
  2.  
  3. <?php
  4. if (!function_exists("GetSQLValueString")) {
  5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  6. {
  7.   if (PHP_VERSION < 6) {
  8.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  9.   }
  10.  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11. switch ($theType) {
  12.     case "text":
  13.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  14.       break;    
  15.     case "long":
  16.     case "int":
  17.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  18.       break;
  19.     case "double":
  20.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  21.       break;
  22.     case "date":
  23.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  24.       break;
  25.     case "defined":
  26.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  27.       break;
  28.   }
  29.   return $theValue;
  30. }
  31. }
  32.  
  33. $editFormAction = $_SERVER['PHP_SELF'];
  34. if (isset($_SERVER['QUERY_STRING'])) {
  35.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  36. }
  37.  $insertSQL = sprintf("INSERT INTO tblcarrito (idUsuario, idProducto, strNombre ,intCantidad) VALUES (%s, %s,  %s, %s)",
  38.                        GetSQLValueString($_SESSION['MM_IdUsuario'], "int"),
  39.                        GetSQLValueString($_GET['strNombre'], "text"),
  40.                        GetSQLValueString($_GET['recordID'], "text"),1);
  41.  mysql_select_db($database_conexionzapatos, $conexionzapatos);
  42.   $Result1 = mysql_query($insertSQL, $conexionzapatos) or die(mysql_error());
  43.  $insertGoTo = "carrito_lista.php";
  44.   if (isset($_SERVER['QUERY_STRING'])) {
  45.     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  46.     $insertGoTo .= $_SERVER['QUERY_STRING'];
  47.   }
  48.   header(sprintf("Location: %s", $insertGoTo));
  49. ?>
y esta lo saca por pantalla
Código PHP:
Ver original
  1. <?php require_once('Connections/conexionzapatos.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. $varUsuario_DatosCarrito = "0";
  35. if (isset($_SESSION["MM_IdUsuario"])) {
  36.   $varUsuario_DatosCarrito = $_SESSION["MM_IdUsuario"];
  37. }
  38. mysql_select_db($database_conexionzapatos, $conexionzapatos);
  39. $query_DatosCarrito = sprintf("SELECT * FROM tblcarrito WHERE tblcarrito.idUsuario = %s AND tblcarrito.intTransaccionEfectuada = 0", GetSQLValueString($varUsuario_DatosCarrito, "int"));
  40. $DatosCarrito = mysql_query($query_DatosCarrito, $conexionzapatos) or die(mysql_error());
  41. $row_DatosCarrito = mysql_fetch_assoc($DatosCarrito);
  42. $totalRows_DatosCarrito = mysql_num_rows($DatosCarrito);
  43. ?>
  44. <table width="900" border="0" cellspacing="0" cellpadding="0">
  45.                   <tr>
  46.                     <td width="247">Producto</td>
  47.                     <td>nombre</td>
  48.                     <td>Unidades</td>
  49.                     <td width="265">Precio</td>
  50.                     <td width="84">Acciones</td>
  51.                   </tr>
  52.                   <?php $preciototal = 0;?>
  53.                   <?php do { ?>
  54.   <tr>
  55.     <td><?php echo ObtenerNombreProducto($row_DatosCarrito['idProducto']); ?></td>
  56.     <td width="39"><?php echo $row_DatosCarrito['strNombre']; ?></td>
  57.     <td width="265"><?php echo $row_DatosCarrito['intCantidad']; ?></td>
  58.     <td><?php echo ObtenerPrecioProducto($row_DatosCarrito['idProducto']); ?> Euros</td>
  59.     <td><a href="eliminar_producto.php?recordID=<?php echo $row_DatosCarrito['idProducto']; ?>">Eliminar</a></td>
  60.   </tr>
  61. <?php   $preciototal = $preciototal + ObtenerPrecioProducto($row_DatosCarrito['idProducto']);?>
  62.   <?php } while ($row_DatosCarrito = mysql_fetch_assoc($DatosCarrito)); ?>
  63.         <tr>
  64.     <td>&nbsp;</td>
  65.     <td align="right">&nbsp;</td>
  66.     <td align="right">Subtotal:</td>
  67.     <td><?php echo $preciototal; ?> Euros</td>
  68.     <td>&nbsp;</td>
  69.   </tr>
  70.         <tr>
  71.           <td>&nbsp;</td>
  72.           <td align="right">&nbsp;</td>
  73.           <td align="right">IVA:</td>
  74.           <td><?php echo ObtenerIVA(); ?>%</td>
  75.           <td>&nbsp;</td>
  76.         </tr>
  77.         <tr>
  78.           <td>&nbsp;</td>
  79.           <td align="right">&nbsp;</td>
  80.           <td align="right">Valor del IVA:</td>
  81.           <td><?php
  82.           $multiplicador =  ObtenerIVA()/100;
  83.           $valordelIVA = $preciototal * $multiplicador;
  84.           echo $valordelIVA;?> Euros</td>
  85.           <td>&nbsp;</td>
  86.         </tr>
  87.         <tr>
  88.           <td>&nbsp;</td>
  89.           <td align="right">&nbsp;</td>
  90.           <td align="right">Total con IVA:</td>
  91.           <td><?php
  92.           $multiplicador =  (100 + ObtenerIVA())/100;
  93.           $valorconIVA = $preciototal * $multiplicador;
  94.           echo $valorconIVA;?> Euros</td>
  95.           <td>&nbsp;</td>
  96.         </tr>
  97.  </table>
  98.                 <a href="carrito_forma_pago.php">Seleccionar Forma de Pago</a>
ahi esta todo, gracias