Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/01/2015, 18:09
eslomao
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
pasar datos carritos de compra

hola chicoos, otra vez aqui, tengo el carrito terminado, instale phpmaile con gmail, pero no me manda los datos del carrito, solo el asunto y el mensaje, dejo aqui el codigo, llevo ya 3 dias intentandolo y no hay manera

aqui los datos de la compra

Código PHP:
Ver original
  1. <?php
  2. if (!function_exists("GetSQLValueString")) {
  3. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  4. {
  5.   if (PHP_VERSION < 6) {
  6.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  7.   }
  8.  
  9.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  10.  
  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.  
  38. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
  39.   $insertSQL = sprintf("INSERT INTO tblcompra (idCompra, idUsuario, fchFecha, intTipoPago, dblTotal, intEstado, strNombre) VALUES (%s, %s, %s, %s, %s, %s, %s)",
  40.                        GetSQLValueString($_POST['idCompra'], "int"),
  41.                        GetSQLValueString($_POST['idUsuario'], "int"),
  42.                        GetSQLValueString($_POST['fchFecha'], "date"),
  43.                        GetSQLValueString($_POST['intTipoPago'], "text"),
  44.                        GetSQLValueString($_POST['dblTotal'], "double"),
  45.                        GetSQLValueString($_POST['intEstado'], "int"),
  46.                        GetSQLValueString($_POST['strNombre'], "text"));
  47.  
  48.   mysql_select_db($database_conexionzapatos, $conexionzapatos);
  49.   $Result1 = mysql_query($insertSQL, $conexionzapatos) or die(mysql_error());
  50.  
  51.   $insertGoTo = "carrito_finalizacion.php";
  52.   if (isset($_SERVER['QUERY_STRING'])) {
  53.     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  54.     $insertGoTo .= $_SERVER['QUERY_STRING'];
  55.   }
  56.   header(sprintf("Location: %s", $insertGoTo));
  57. }
  58.  
  59. $maxRows_compra = 10;
  60. $pageNum_compra = 0;
  61. if (isset($_GET['pageNum_compra'])) {
  62.   $pageNum_compra = $_GET['pageNum_compra'];
  63. }
  64. $startRow_compra = $pageNum_compra * $maxRows_compra;
  65.  
  66. $varCompra_compra = "0";
  67. if (isset($_SESSION["MM_IdUsuario"])) {
  68.   $varCompra_compra = $_SESSION["MM_IdUsuario"];
  69. }
  70. mysql_select_db($database_conexionzapatos, $conexionzapatos);
  71. $query_compra = sprintf("SELECT * FROM tblcarrito WHERE tblcarrito.idUsuario = %s", GetSQLValueString($varCompra_compra, "int"));
  72. $query_limit_compra = sprintf("%s LIMIT %d, %d", $query_compra, $startRow_compra, $maxRows_compra);
  73. $compra = mysql_query($query_limit_compra, $conexionzapatos) or die(mysql_error());
  74. $row_compra = mysql_fetch_assoc($compra);
  75.  
  76. if (isset($_GET['totalRows_compra'])) {
  77.   $totalRows_compra = $_GET['totalRows_compra'];
  78. } else {
  79.   $all_compra = mysql_query($query_compra);
  80.   $totalRows_compra = mysql_num_rows($all_compra);
  81. }
  82. $totalPages_compra = ceil($totalRows_compra/$maxRows_compra)-1;
  83.  
  84. $preciototal="ObtenerIVA()/100";
  85. $multiplicador =  "ObtenerIVA()/100";
  86. $valordelIVA = "preciototal * $multiplicador";
  87. $valorconIVA = "preciototal * $multiplicador";
  88. $hoy = date("Y-m-d");
  89. $Transferencia="Transferencia";
  90. $asunto="Cachemira.com";
  91. $mensaje="Gracias por comprar en la cachemira.com, a continuacion se su compra, esperamos verle pronto ";
  92. $producto="idProducto";
  93.  
  94. ?>
  95.  <td width="316" align="center" bgcolor="#EEEEEE"><strong>Resumen de su compra</strong></td>
  96.   </tr>
  97. </table>
  98.  
  99.  
  100.               <form action="envio_realizado.php" method="post" name="form1" id="form1">  
  101.              <table width="618" height="124" align="center">
  102.                  
  103.                    <tr bgcolor="#00FFFF">
  104.                    <td align="center">Productos</td>
  105.                    <td align="center">Unidades</td>
  106.                    <td colspan="2" align="center">Total </td>
  107.                  
  108.                    </tr>
  109.                    <?php $preciototal = 0;?>
  110.                     <?php do { ?>
  111.                    
  112.                    <tr bgcolor="#FFECEC" align="center">
  113.                     <td width="186" align="right">
  114.                       <input name="idProducto" type="text" value="<?php echo ObtenerNombreProducto($row_compra['idProducto']); ?>" size="10" /> </td>
  115.                     <td width="102" align="right"><input type="text" name="idProducto" value="<?php echo $row_compra['intCantidad']; ?>" size="4" align="left"  /></td>
  116.                     <td colspan="2" align="center"><input name="idProducto" type="text" value="<?php echo ObtenerPrecioProducto($row_compra['idProducto']); ?>" size="5"  /></td>
  117.                     <?php   $preciototal = $preciototal + ObtenerPrecioProducto($row_compra['idProducto']);?>
  118.                    
  119.                     <?php } while ($row_compra = mysql_fetch_assoc($compra)); ?><tr>
  120.                <td height="25"  align="center">
  121.       </tr>            
  122.       <tr>  
  123.                    <td height="29"></td> <td></td>            
  124.                    
  125.                      <td width="208" align="right" class="comproducto">
  126.               <?php
  127.           $multiplicador =  (100 + ObtenerIVA())/100;
  128.           $valorconIVA = $preciototal * $multiplicador;
  129.           echo $valorconIVA;?>
  130.                      <strong>Euros IVA incluido</strong></td>
  131.  
  132.  
  133.                      
  134.                </table>
  135.  
  136.  
  137.  
  138.  <form id="formulario" method="post" action="recibido.php" enctype="multipart/form-data" name="formulario">
  139.                     <input type="email" name="email" required>
  140.                    
  141.                      <input type="hidden" name="idUsuario" value="<?php echo $_SESSION['MM_IdUsuario']; ?>" />
  142.                     <input type="hidden" name="mensaje" value="<?php echo $mensaje?>">        
  143.               <input type="hidden" name="fchFecha" value="<?php echo $hoy ?>" />
  144.                    <input type="hidden" name="asunto" value="<?php echo $asunto ?>">
  145. <input type="hidden" name="dblTotal" value="<?php
  146.           $multiplicador =  (100 + ObtenerIVA())/100;
  147.           $valorconIVA = $preciototal * $multiplicador;
  148.           echo $valorconIVA;?>" />  
  149.                       <input id="submit" type="submit" name="enviar" value="Enviar mail">
  150.                 </form>

aqui donde debe de recoger los datos y mandarlo al email

Código PHP:
Ver original
  1. <?php
  2. //Librerías para el envío de mail
  3. include_once('phpmailer/class.phpmailer.php');
  4. include_once('phpmailer/class.smtp.php');
  5.  
  6. //Recibir todos los parámetros del formulario
  7. $para = $_POST['email'];
  8. $asunto = $_POST['asunto'];
  9. $mensaje = $_POST['mensaje'];
  10. $fchFecha= $_POST['fchFecha'] ;
  11. $dblTotal= $_POST['dblTotal'] ;
  12.  
  13. //Este bloque es importante
  14. $mail = new PHPMailer();
  15. $mail->IsSMTP();
  16. $mail->SMTPAuth = true;
  17. $mail->SMTPSecure = "ssl";
  18. $mail->Host = "smtp.gmail.com";
  19. $mail->Port = 465;
  20.  
  21. //Nuestra cuenta
  22. $mail->Username ='[email protected]';
  23. $mail->Password = 'xxxxxx; //Su password
  24.  
  25. //Agregar destinatario
  26. $mail->AddAddress($para);
  27. $mail->Subject = $asunto;
  28. $mail->Body = $mensaje;
  29.  
  30. //Para adjuntar archivo
  31. //$mail->AddAttachment($archivo['tmp_name'], $archivo['name']);
  32. $mail->MsgHTML($mensaje,$fchFecha,$dblTotal);
  33.  
  34. //Avisar si fue enviado o no y dirigir al index
  35. if($mail->Send())
  36. {
  37.    echo'<script type="text/javascript">
  38.             alert("Enviado Correctamente");
  39.             window.location="final.php"
  40.          </script>';
  41. }
  42. else{
  43.    echo'<script type="text/javascript">
  44.             alert("NO ENVIADO, intentar de nuevo");
  45.             window.location="final.php"
  46.          </script>';
  47. }
  48. ?>

solo manda esto
$asunto = $_POST['asunto'];
$mensaje = $_POST['mensaje'];