Duda con carro de compra, cuando envio el mail con el reporte de compras, el detalle del pedido muestra solamente el ultimo registro ingresado al carrito, es decir, que si el usuario tiene mas de un producto añadido en el mismo, solamente muestra el ultimo producto que añadio, como puedo corregir esto?
mail.php
Código PHP:
$sfrom="<[email protected]>"; //cuenta que envia
$sdestinatario=$_GET['CEMAIL']; //cuenta destino
$ssubject="Reporte de Compra"; //subject
$shtml="
<html>
<head>
<title>Reporte de Compra</title>
<style>
.txt{
font-family: arial;
font-size: 9px;
color: '#444444';
}
.tit{
font-family: arial;
font-size: 11px;
color: '#444444';
font-weight: bold;
padding-left: 5px;
padding-right: 5px;
}
</style>
<link rel='stylesheet' href='http://www.buraltec.com/estilos.css' type='text/css'>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><style type='text/css'>
<!--
body {
background-image: url(/fondocuadros.jpg);
background-repeat: repeat;
}
.Estilo4 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: xx-small;
color: #000066;
}
.Estilo13 {color: #444444; font-size: 12px; }
.Estilo19 {color: #FFFFFF; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; font-weight: bold; }
.Estilo20 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: x-small;
}
.Estilo21 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #000066;
font-size: x-small;
}
.Estilo28 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000066;
font-size: x-small;
}
</style></head>
<body bgcolor='#E0E4EC' marginwidth='0' marginheight='0' topmargin='40' leftmargin='0'>
<table align='center' bgcolor='ffffff' width='606' border='0' cellspacing='0' cellpadding='0'>
<!--DWLayoutTable-->
<tr>
<td width='606' height='105' valign='top'><p><span class='Estilo21'><br>
Un gran saludo $CNOMBRE, en nombre de Aeromusica.com agradecemos por preferir nuestros servicios.<br>
Te presentamos el reporte de Compra.</span><br>
</p> </td>
</tr>
<tr>
<td height='19' valign='top' bgcolor='#000066' class='a11gr'><center>
<p align='left' class='Estilo19'>Datos de compra</p>
</center></td>
</tr>
<tr>
<td height='158' valign='top' class='tit'>
<table cellspacing='0' cellpadding='0' border='0'>
<tr>
<td height='18' colspan='3' valign='top'><span class='Estilo28'>Orden Num: </span></td>
<td width='22' valign='top'>$id</td>
<td width='64'></td>
<tr>
<tr>
<td height='18' valign='top' class='Estilo28'>Cantidad:</td>
<td></td>
<td colspan='7' valign='top' class='Estilo28'>Artista:</td>
<td></td>
<td valign='top' class='Estilo28'>Titulo:</td>
<td></td>
<td valign='top' class='Estilo28'>Precio:</td>
<tr>
<td height='6'></td>
<tr>
<td height='18' valign='top'>$cantidad</td>
<td></td>
<td colspan='7' valign='top'>$Artista</td>
<td></td>
<td valign='top'>$Titulo</td>
<td></td>
<td valign='top'>$Precio</td>
<tr>
<td height='60'></td>
<tr>
<td height='18' colspan='6' valign='top' class='Estilo28'>Subtotal (inc IVA):</td>
<td></td>
<td valign='top'><div align='right'>$suma</div></td>
<tr>
<td height='3'></td>
<td rowspan='2' valign='top'><div align='right'>7500</div></td>
<tr>
<td colspan='6' rowspan='2' valign='top' class='Estilo28'>Envío:</td>
<td height='15'></td>
<tr>
<td height='3'></td>
<tr>
<td height='3'></td>
<tr>
<td height='18' colspan='6' valign='top' class='Estilo28'>Total:</td>
<td></td>
<td valign='top'><div align='right'>$grantotal</div></td>
<tr>
<td height='22'> </td>
</table></td>
</tr>
<tr>
<td height='40'> </td>
</tr>
<tr>
<td height='19' valign='top' bgcolor='#000066'><span class='Estilo19'>Dirección de Facturación </span></td>
</tr><tr>
<td height='233' valign='top' class='tit'><div align='left'><span class='Estilo4'><span class='txt'><b><strong><br>
<br>
</strong></b></span><span class='Estilo4'><b><strong>Nombre:</strong></b></span> <span class='Estilo13'>$CNOMBRE</span><span class='Estilo4'><br>
<br>
<b><strong>Dirección:</strong></b> </span><span class='Estilo13'>$CDIRECCION</span><span class='Estilo4'><br>
<br>
<b><strong>Ciudad:</strong></b> </span><span class='Estilo13'>$CCIUDAD</span><span class='Estilo4'><br>
<br>
<b><strong>Estado:</strong></b> </span><span class='Estilo13'>$CESTADO</span>
</div> <p> <span class='Estilo4'><b><strong>País:</strong></b> </span><span class='Estilo13'>$CPAIS</span><span class='Estilo4'> <br>
<br>
<b><strong>Código Postal:</strong></b> </span><span class='Estilo13'>$CCODIGOP</span><span class='Estilo4'><b><br>
<br>
<strong>Teléfono:</strong></b> </span><span class='Estilo13'>$CTELEFONO</span><span class='Estilo4'><br>
<br>
<b><strong>Email:</strong></b> </span><span class='Estilo13'>$CEMAIL</span><br>
<br> </p></td>
</tr><tr>
<td height='19' valign='top' bgcolor='#000066'><span class='Estilo19'>Dirección de Entrega</span></td>
</tr><tr>
<td height='236' valign='top'><div align='left'><span class='txt'><b><strong><br>
</strong></b></span><span class='Estilo4'><b><strong>Nombre:</strong></b></span> <span class='Estilo13'>$CNOMBRE</span><span class='Estilo4'><br>
<br>
<b><strong>Dirección:</strong></b> </span><span class='Estilo13'>$CDIRECCION</span><span class='Estilo4'><br>
<br>
<b><strong>Ciudad:</strong></b> </span><span class='Estilo13'>$CCIUDAD</span><span class='Estilo4'><br>
<br>
<b><strong>Estado:</strong></b> </span><span class='Estilo13'>$CESTADO</span> </div> <p> <span class='Estilo4'><b><strong>País:</strong></b> </span><span class='Estilo13'>$CPAIS</span><span class='Estilo4'> <br>
<br>
<b><strong>Código Postal:</strong></b> </span><span class='Estilo13'>$CCODIGOP</span><span class='Estilo4'><b><br>
<br>
<strong>Teléfono:</strong></b> </span><span class='Estilo13'>$CTELEFONO</span><span class='Estilo4'><br>
<br>
</p></td></tr><tr><tr>
<td height='19' valign='top' bgcolor='#000066'><span class='Estilo19'>Forma de Pago </span></td>
</tr>
<tr>
<td height='15'></td>
</tr>
<tr>
<td height='80' valign='top'><span class='Estilo20'>Depósito Bancario<br>
Banco:<br>
Tipo de Cuenta:<br>
Número de Cuenta:<br>
A nombre de: </span></td>
</tr>
<tr>
<td height='189'> </td>
</tr>
</table>
</body>
</html>
";//mensaje
$sheader="From:".$sfrom."\nReply-To:".$sfrom."\n";
$sheader=$sheader."Bcc: [email protected]\r\n";
$sheader=$sheader."X-Mailer:PHP/".phpversion()."\n";
$sheader=$sheader."Mime-Version: 1.0\n";
$sheader=$sheader."Content-Type: text/html";
mail($sdestinatario,$ssubject,$shtml,$sheader);
?>
y este es el codigo dnd toma el los productos del carrito
carrito.php
Código PHP:
<style type="text/css">
<!--
.Estilo3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; font-weight: bold; color: #000066; }
.Estilo4 {color: #000066}
-->
</style>
<table width="800" border="0" bgcolor="#FFFFFF" cellspacing="1" align="center">
<td height="12" colspan="5" valign="top"><div align="left" class="h1 Estilo6 Estilo9">Detalles de su Pedido: </div></td>
</tr>
<tr>
<tr bgcolor="#000066" class="tit">
<td width="2" align="center">Orden</td>
<td width="2" align="center">Cantidades</td>
<td width="2" align="center">Artista</td>
<td width="2" align="center">Titulo</td>
<td width="2" align="center">Precio</td>
</tr>
<?php
$id = 000002;
$id++;
$color=array("#FFFFFF","#F0F0F0");
$contador=0;
$suma=0;
variable $suma,
foreach($carro as $k => $v){
subtotal y el total
$cantidad=$v['cantidad'];
$Artista=$v['Artista'];
$Titulo=$v['Titulo'];
$Precio=$v['Precio'];
$total=$v['cantidad']*$v['Precio'];
$suma=$suma+$total;
$grantotal=$suma+7500;
$contador++;?>
<tr bgcolor="<?php echo $color[$contador%2]; ?>" class='prod'>
<td><?php echo $id; ?></td>
<td><?php echo $cantidad ?></td>
<td><?php echo $Artista ?></td>
<td><?php echo $Titulo ?></td>
<td><?php echo $Precio ?></td>
</td>
</tr></form>
<?php
}?>
</table>
<table align="center" width="800" border="0" bgcolor="#FFFFFF">
<td width="577" height="21"></td>
<td colspan="2" valign="top"><div align="right"><span class="Estilo3">SubTotal (IVA inc.): </span></div></td>
<td width="73" valign="top"><div align="right"><?php echo number_format($suma,2);?></div></td>
<tr bgcolor="#FFFFFF">
<td height="21"></td>
<td width="55"> </td>
<td width="77" valign="top"><div align="right"><span class="Estilo3">Envio: </span></div></td>
<td valign="top" ><div align="right"> 7,500.00</div></td>
<tr bgcolor="#FFFFFF">
<td height="21"></td>
<td></td>
<td valign="top"><div align="right"><span class="Estilo3">Total: </span></div></td>
<td valign="top"><div align="right"><?php echo number_format($grantotal,2); ?></div></td>
</table>
el email llega en formato html
Gracias de antemano