Foros del Web » Programando para Internet » PHP »

Importe de un carrito

Estas en el tema de Importe de un carrito en el foro de PHP en Foros del Web. Hola chicos soy nueva y por fin he descubierto como poner un tema sin enviar mensajes privados. Veréis he programado el típico carrito de la ...
  #1 (permalink)  
Antiguo 09/09/2007, 10:10
 
Fecha de Ingreso: septiembre-2007
Mensajes: 7
Antigüedad: 16 años, 7 meses
Puntos: 0
Importe de un carrito

Hola chicos soy nueva y por fin he descubierto como poner un tema sin enviar mensajes privados. Veréis he programado el típico carrito de la compra , pero mi problema es a la hora de calcular el importe, imagino que tendré que multiplicar la cantidad por el importe de cada una y que lo tendré que guardar en una variable $resul por ejemplo, pero realmente no se como acabar de implementarlo, porqu además he de añdir el IVA y una tarifa de envío. Bueno espero que me puedana yudar gracias de verdad.
  #2 (permalink)  
Antiguo 09/09/2007, 12:17
AlvaroG
Invitado
 
Mensajes: n/a
Puntos:
Re: Importe de un carrito

Todo dependerá de cómo sea la implementación del carrito, en cuanto a la idea que tenés, vas perfectamente.

Pegá un poco de código para que podamos ver dónde ayudarte

Saludos.
  #3 (permalink)  
Antiguo 09/09/2007, 12:55
 
Fecha de Ingreso: septiembre-2007
Mensajes: 7
Antigüedad: 16 años, 7 meses
Puntos: 0
Re: Importe de un carrito

<?php
include ( "php/includes/Constants.php" ) ;
include ( "php/includes/Function.php" ) ;
include ( "php/classes/class.DB.php" ) ;
include ( "php/classes/class.productes.php") ;
include ( "php/classes/class.cistella.php") ;
include ( "php/classes/class.comandes.php");
include ( "php/classes/class.clients.php");
include ( "php/classes/class.visitants.php");
$Productes = new Productes(DB_USER, DB_PASS, DB_NAME, DB_HOST) ;
$Cistella = new Cistella(DB_USER, DB_PASS, DB_NAME, DB_HOST) ;
$Comandes = new Comandes(DB_USER, DB_PASS, DB_NAME, DB_HOST) ;
$DB = new DB(DB_USER, DB_PASS, DB_NAME, DB_HOST) ;
$Clients= new Clients(DB_USER, DB_PASS, DB_NAME, DB_HOST) ;
$Visitants = new Visitants (DB_USER, DB_PASS, DB_NAME, DB_HOST) ;
?>





<html>
<head>
<title>Moss Productos Plasticos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="estilo.css" type="text/css">
</head>
<body text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#FFFFFF">
<form name="form1" method="post" action="">
</form>
<table border="0" cellspacing="0" cellpadding="0" height="475">
<tr>
<td rowspan="17" width="20" height="475">
<img src="img/usuari.jpg" width="24" height="24" vspace="0" hspace="0"></td>
<td colspan="5" height="12"></td>
</tr>
<tr>
<td colspan="5" class="texto" height="20" valign="top"><b>Carrito de la
compra |</b> Tu Pedido</td>
</tr>
<tr>
<td class="texto" colspan="5" height="35" valign="top">&nbsp;<p>
<font color="#0000FF">Si no eres cliente haz click <a href="visitant.php?Add=<?php echo($_SESSION["sPedidoId"])?>" target="mainFrame" class="textoenl">aqu&iacute;</a>
para registrarte</font></td>
</tr>
<tr>
<td colspan="5" height="35" valign="top">&nbsp;<p><u><font color="#0000FF">
Si eres cliente:</font></u></p>
<p>Login <font color="#0000FF">&nbsp;&nbsp; </font>
<input type="text" name="clave" class="c50" size="10">
</td>
</tr>
<td colspan="3" width="15" height="23"></td>
</tr>
<tr>
<td colspan="5" height="182" valign="top">
<table border="0" cellspacing="4" cellpadding="0">
<tr>
<td class="texto" height="20" valign="top" width="45"><b>&nbsp;Ref.</b></td>
<td class="texto" height="20" valign="top" width="295"><b>Producto</b></td>
<td class="texto" width="35" height="20" valign="top" align="center"><b>Bolsa</b></td>
<td class="texto" width="80" align="center" valign="top"><b>Precio|Euros</b></td>
</tr>
<?php
$WHERE = " WHERE cis_com_codi = '".$_SESSION["sPedidoId"]."'" ;
$Cistella->Select($WHERE);
while($Cistella->fetchRow()){
?>
<tr>
<td bgcolor="#F3F3F3" class="texto" align="center" height="20"><?php echo($Cistella->record["cis_pro_codi"]); ?></td>
<td bgcolor="#F3F3F3" class="texto"><?php echo($Cistella->record["cis_pro_nom"]);?></td>
<td bgcolor="#F3F3F3" class="texto" align="center"><?php echo($Cistella->record["cis_pro_quantitat"]); ?></td>
<td bgcolor="#F3F3F3" class="texto" align="center"><?php echo($Cistella->record["cis_pro_preu"]); ?></td>
</td>
</tr>
<?php } ?>
<tr>
<td colspan="5" height="5"></td>
</tr>
<tr>
<td class="texto" height="16" colspan="3">&nbsp;Total cesta</td>
<td align="center">
<table width="76" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="texto" align="right" width="46">225698,38</td>
</tr>
</table>
</td>
<td class="texto">&euro;</td>
</tr>
<tr>
<td class="texto" height="16" colspan="3">&nbsp;Total envio</td>
<td align="center">
<table width="76" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="texto" align="right" width="46">2258,16</td>
</tr>
</table>
</td>
<td class="texto">&euro;</td>
</tr>
<tr>
<td class="texto" height="16" colspan="3"><b>&nbsp;Total pedido</b></td>
<td align="center">
<table width="76" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="texto" align="right" width="46"><b>243258,16</b></td>
</tr>
</table>
</td>
<td class="texto">&euro;</td>
</tr>
<tr>
<td colspan="5" align="left">
<table width="112" border="0" cellspacing="0" cellpadding="1" bgcolor="#666666">
<tr>
<td>
<table cellspacing="0" cellpadding="0" width="100%" border="0" height="14">
<tr>
<td align="center" bgcolor="#E1E1E1" valign="middle"><a href="mensok.html" target="mainframe">
<input type="image" border="0" src="img/enviar.gif" width="34" height="9"></a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
</form>
</body>
</html>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:07.