Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/12/2014, 13:29
eslomao
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
carrito de compras

hola chicos llevo varios dias liado, soy novato, estoy siguiendo tutoriales para hacer una web , y me quede frenado en el carrito, tengo una una pagina que recoge los datos comprados, que hace la suma con el IVA , pero no se como llevarme esos datos, es decir, que pueda pagar mediante transferencia, opte por el boton paypal, pero no me sirve , no deja ponerle el precio que yo necesito en cada momento, tendria que por ejemplo recoger el total de la suma en otro archivo, con la cantidad a pagar y la confirmacion de pago, dejo aqui unos archivos a ver si sirven,

aqui es donde sale la opcion comprar

Código PHP:
Ver original
  1. <?php require_once('Connections/conexioncolegio.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_conexioncolegio, $conexioncolegio);
  39. $query_DatosProducto = sprintf("SELECT * FROM tblproductos WHERE tblproductos.isProducto = %s", GetSQLValueString($varProducto_DatosProducto, "int"));
  40. $DatosProducto = mysql_query($query_DatosProducto, $conexioncolegio) or die(mysql_error());
  41. $row_DatosProducto = mysql_fetch_assoc($DatosProducto);
  42. $totalRows_DatosProducto = mysql_num_rows($DatosProducto);
  43. ?>
  44.  
  45. <head>
  46.  
  47. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  48. <!-- InstanceBeginEditable name="doctitle" -->
  49. <title>La Cachemira</title>
  50. <!-- InstanceEndEditable -->
  51. <!-- InstanceBeginEditable name="head" -->
  52. <!-- InstanceEndEditable -->
  53. <link href="estilo/principal.css" rel="stylesheet" type="text/css" />
  54. <?php include("includes/header.php"); ?>
  55. </head>
  56.  
  57. <body>
  58. <?php include("includes/afterbody.php"); ?>
  59.  
  60. <div class="container">
  61.   <div class="header"><?php include("includes/cabecera.php"); ?></div>
  62.   <div class="sidebar1"><?php include("includes/menuizquierda.php"); ?>
  63.   </div>
  64.   <div class="content"><!-- InstanceBeginEditable name="Contenido" -->
  65.    
  66.   <h1><?php echo $row_DatosProducto['srtNombre']; ?></h1>
  67.   <!-- InstanceEndEditable -->
  68.     <p></p>
  69.    
  70.   <!-- InstanceBeginEditable name="titulo" --> <table width="100%" border="0" cellspacing="0" cellpadding="0">
  71.                   <tr>
  72.                     <td><img src="documentos/productos/<?php echo $row_DatosProducto['strImagen']; ?>" width="450" height="450" /></td>
  73.                     <td valign="top"><p><?php echo $row_DatosProducto['srtNombre']; ?></p>
  74.                     <p><?php echo $row_DatosProducto['dblPrecio']; ?></p>
  75.                     <?php if ((isset($_SESSION['MM_isUsuario']))  && ($_SESSION['MM_isUsuario']!=""))
  76.                     {?>
  77.                     <p><a href="carrito_add.php?recordID=<?php echo $row_DatosProducto['isProducto']; ?>">Comprar Producto</a></p>
  78.                     <?php }
  79.                     else
  80.                     {?>
  81.                     Necesitas <a href="usuario.php"><strong>darte de alta</strong></a> para comprar. Es gratuito.
  82. <?php }?></td>
  83.                   </tr>
  84.                   <tr>
  85.                     <td>&nbsp;</td>
  86.                     <td>&nbsp;</td>
  87.                   </tr>
  88.                 </table><!-- InstanceEndEditable --></div>
  89.   <div class="footer">
  90.     <?php include("includes/pie.php"); ?>
  91.   <!-- end .footer --></div>
  92.   <!-- end .container --></div>
  93. </body>
  94. <!-- InstanceEnd --></html>
  95. <?php
  96. mysql_free_result($DatosProducto);
  97. ?>

aqui me recoge el pedido y me ajusta la compra

Código PHP:
Ver original
  1. <?php require_once('Connections/conexioncolegio.php'); ?>
  2. <?php
  3.  
  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.  
  11.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  12.  
  13.   switch ($theType) {
  14.     case "text":
  15.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  16.       break;    
  17.     case "long":
  18.     case "int":
  19.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  20.       break;
  21.     case "double":
  22.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  23.       break;
  24.     case "date":
  25.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  26.       break;
  27.     case "defined":
  28.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  29.       break;
  30.   }
  31.   return $theValue;
  32. }
  33. }
  34.  $varUsuario_DatosCarrito = "0";
  35. if (isset($_SESSION["MM_isUsuario"])) {
  36.   $varUsuario_DatosCarrito = $_SESSION["MM_isUsuario"];
  37. }
  38. mysql_select_db($database_conexioncolegio, $conexioncolegio);
  39. $query_DatosCarrito = sprintf("SELECT * FROM tblcarrito WHERE tblcarrito.isUsuario = %s AND tblcarrito.intTransaccionEfectuada = 0", GetSQLValueString($varUsuario_DatosCarrito, "int"));
  40. $DatosCarrito = mysql_query($query_DatosCarrito, $conexioncolegio) or die(mysql_error());
  41. $row_DatosCarrito = mysql_fetch_assoc($DatosCarrito);
  42. $totalRows_DatosCarrito = mysql_num_rows($DatosCarrito);
  43. ?>
  44. <head>
  45.  
  46. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  47. <!-- InstanceBeginEditable name="doctitle" -->
  48. <title>La Cachemira</title>
  49. <!-- InstanceEndEditable -->
  50. <!-- InstanceBeginEditable name="head" -->
  51. <!-- InstanceEndEditable -->
  52. <link href="estilo/principal.css" rel="stylesheet" type="text/css" />
  53. <?php include("includes/header.php"); ?>
  54. </head>
  55.  
  56. <body>
  57. <?php include("includes/afterbody.php"); ?>
  58.  
  59. <div class="container">
  60.   <div class="header"><?php include("includes/cabecera.php"); ?></div>
  61.   <div class="sidebar1"><?php include("includes/menuizquierda.php"); ?>
  62.   </div>
  63.   <div class="content"><!-- InstanceBeginEditable name="Contenido" -->
  64.     <h1>Carrito de la Compra</h1>
  65.   <!-- InstanceEndEditable -->
  66.     <p></p>
  67.    
  68.   <table width="630" cellpadding="0" cellspacing="0">
  69.     <tr align="center">
  70.       <td width="178">Producto:</td>
  71.       <td colspan="3">Unidades:</td>
  72.       <td colspan="3">Precio:</td>
  73.       <td width="82">Acciones:</td>
  74.     </tr>
  75.      <?php $preciototal = 0;?>
  76.                   <?php do { ?>
  77.       <tr>
  78.         <td align="center"><?php echo ObtenerNombreProducto($row_DatosCarrito['isProducto']); ?></td>
  79.         <td colspan="3" align="center"><?php echo $row_DatosCarrito['intCantidad']; ?></td>
  80.          <td colspan="3" align="center"><?php echo ObtenerPrecioProducto($row_DatosCarrito['isProducto']); ?> Euros</td>
  81.         <td>Eliminar</td>
  82.          </tr>
  83.        <?php   $preciototal = $preciototal + ObtenerPrecioProducto($row_DatosCarrito['isProducto'])?>
  84.         <?php } while ($row_DatosCarrito = mysql_fetch_assoc($DatosCarrito)); ?>
  85.   </tr>
  86.     <tr>
  87.       <td>&nbsp;</td>
  88.      <td width="99" align="right" bgcolor="#FFFFB3" >Subtotal:&nbsp;</td>
  89.     <td width="60"  bgcolor="#FFFFB3"></td>
  90.     <td width="73" bgcolor="#FFFFB3" align="rigth"><?php echo $preciototal; ?> Euros</td>
  91.     <td width="69">&nbsp;</td>
  92.    
  93.     <td></td>
  94.   </tr>
  95.         <tr>
  96.           <td align="right" bgcolor="#FFFFB3">IVA:&nbsp;</td>
  97.           <td bgcolor="#FFFFB3" ></td>
  98.           <td bgcolor="#BBFFBB" align="center"><strong><?php echo ObtenerIVA(); ?>%</strong></td>
  99.         </tr>
  100.         <tr>
  101.           <td></td>
  102.           <td align="right"></td>
  103.           <td align="right"></td>
  104.           <td align="right" bgcolor="#FFFFB3">Valor del IVA:&nbsp;</td>
  105.           <td bgcolor="#FFFFB3"></td>
  106.           <td bgcolor="#FFFFB3" ><?php $multiplicador =  ObtenerIVA()/100;
  107.           $valordelIVA = $preciototal * $multiplicador;
  108.           echo $valordelIVA ;?>Euros</td>
  109.           <td>&nbsp;</td>
  110.           <td>&nbsp;</td>
  111.         </tr>
  112.         <tr>
  113.           <td>&nbsp;</td>
  114.           <td colspan="2" align="right"></td>
  115.           <td align="right" bgcolor="#FFFFB3">Total con iva:</td>
  116.           <td bgcolor="#FFFFB3"></td>
  117.           <td bgcolor="#FFFFB3"><?php
  118.           $multiplicador =  (100 + ObtenerIVA())/100;
  119.           $valorconIVA = $preciototal * $multiplicador;
  120.           echo $valorconIVA;?> Euros</td>
  121.           <td>&nbsp;</td>
  122.           <td>&nbsp;</td>
  123.         </tr>
  124.                 </table>
  125.                 <p>&nbsp;</p>
  126.                 <table width="279" cellpadding="0" cellspacing="0">
  127.   <tr>
  128.     <td width="76">&nbsp;</td>
  129.     <td width="201" class="pago" align="center"><a href="carrito_forma_pago.php"><strong>Seleccionar Forma de Pago</strong></a></td>
  130.   </tr>
  131. </table>
  132.  
  133.  </div>
  134.   <div class="footer">
  135.     <?php include("includes/pie.php"); ?>
  136.   <!-- end .footer --></div>
  137.   <!-- end .container --></div>
  138. </body>
  139. </html>
  140. <?php
  141. mysql_free_result($DatosCarrito);
  142. ?>