Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/02/2017, 16:39
fab2160225
 
Fecha de Ingreso: abril-2016
Mensajes: 90
Antigüedad: 8 años
Puntos: 1
Respuesta: Envio por php mailer

A ver si soy capaz de explicarme mejor, quiero decir esas variables no me dan ningún resultado.
Cuando
'.$shopCart [$i]["nombreP"]. esta debería dar el nombre del o los artículos
'.$shopCart [$i]["precio"]. esta debería dar el nombre del o los precios
'.$shopCart [$i]["cantidad"]. esta debería dar el nombre del o las cantidades

esta es la parte donde recojo las variables y realizo los cáculos ,

Cita:
<?php
$shopCart = $_SESSION['carrito'];
if(isset($shopCart)){
$total = 0;//añado esto a ver cual es el resultado
for($i=0; $i<count($shopCart); $i++){
//$compra = "*".$shopCart[$i]['nombreP'].",".$shopCart[$i]['precio']."-".$shopCart[$i]['cantidad']."_";//nombre pasa a nombreP , de momento lo dejo en standby
$carticulo = $shopCart[$i]['nombreP']; //prueba
$cprecio = $shopCart[$i]['precio'];
$ccantidad = $shopCart[$i]['cantidad'];

//$comprado =$compra;//comprado es igual a articulo lo borro para hacer pruebas

///// paso aqui todo lo de las variables
$fecha = date("d/m/Y H:i:s");
$name = $_SESSION['name'];
$nombreR = $_SESSION['nombreR'];
$direccion = $_SESSION['direccion'];
$ciudad = $_SESSION['ciudad'];
$estado = $_SESSION['estado'];
$cp = $_SESSION['cp'];
$telefono = $_SESSION['telefono'];
$email2=$_SESSION['email2'];
$metodoenvio = $_SESSION['metodoenvio'];
$pago="";

$nid=$fecha."_".$name;// este es el numero de pedido


$total = $_POST['total'];
//$total = $_SESSION['total']; //dejo solo el total recibido por post

$addPedido = new Pedido(); //la elimino de momento al tener inhabilitada la class
//$addPedido->ingresarPedido($fecha,$name,$nombreR,$direccion,$ ciudad,$estado,$cp,$telefono,$metodoenvio,$pago,$c omprado,$total,$nid);
// el de arriba es el original
$addPedido->ingresarPedido($fecha,$name,$nombreR,$direccion,$ ciudad,$estado,$cp,$telefono,$metodoenvio,$pago,$t otal,$nid,$carticulo,$cprecio,$ccantidad);



////////
}
for($i=0; $i<count($shopCart); $i++){
if($shopCart[$i]!=NULL){
$id = $shopCart[$i]['id'];
$cantidad = $shopCart[$i]['cantidad'];
$stockActualizado = new Producto();
$stockActualizado->actualizarStock($id, $cantidad);
}


////////

}


}
$nid=$fecha."_".$name;

?>
aquí donde visualizo las variables

Cita:
<header>
<center><article class="albaran" ><center>
<br><br>
<h3>Numero de pedido:&nbsp;<?php echo $nid; ?></h3>
<h3>Pedido para:&nbsp;<?php echo $name; ?></h3>
<h3>Pedido por:&nbsp;<?php echo $nombreR; ?></h3>

<h3>Dirección de destino:&nbsp;<?php echo $direccion; ?>,&nbsp;C.P.&nbsp;<?php echo $cp; ?>,&nbsp;<?php echo $ciudad; ?></h3>
<h3><?php echo $estado; ?></h3>
<h3>Teléfono:&nbsp;<?php echo $telefono; ?></h3>
<h3><font color="red"><?php echo $metodoenvio; ?></font></h4>


<center>
<table class="fondoBoton" >
<thead><center><tr><th>&nbsp; Descripción &nbsp;</th><th>&nbsp; &nbsp; Precio &nbsp; &nbsp;</th><th>&nbsp; &nbsp; Cantidad &nbsp; &nbsp;</th><th><center>Subtotal</th></tr></center></thead>
<tbody>
<tr>
<?php

$shopCart = $_SESSION['carrito'];
if(isset($shopCart)){
$total = 0;
for($i=0; $i<count($shopCart); $i++){
if($shopCart[$i] != NULL){
?>

<td><?php echo $shopCart [$i]['nombreP']; ?></td>
<td><center><?php echo $shopCart [$i]['precio'];echo ' €'; ?></center></td>
<td><center><?php echo $shopCart[$i]['cantidad']; ?></center></td>

<!--AQUÍ SE GUARDAN LOS CALCULOS DE LOS PRECIOS...-->
<td><?php $subtotal = $shopCart[$i]['precio']*$shopCart[$i]['cantidad'];
$total=$subtotal+$total;
echo $subtotal;echo ' €';
?>
</td>

</tr><?php }}}?>

<tr>
<td colspan="4" >&nbsp; </td>
<thead><center><tr><th></th><th></th>
<th valign="bottom">Total</th><th valign="middle"><br><?php echo $total; ?>€<br></th></tr></center></thead>
</tr>
</tbody>
</table>
<!--<table width="250" border="3">
<tr align="center">
<td colspan="2"><input type="submit" name="btn1" value="Añadir"/></td>
</tr>
</table>-->
<br><br>
</article>
<br><br>
</center>
<!--</article></center>-->


<p><br><p><br><p><br><p><center><a href='../indexr.php'><IMG SRC='../imagenes/salir.jpg' BORDER='0' ALT='CERRAR'></a></center><p></table>
<!--</center><br>-->
</header>
</html>
sin embargo al querer convertir esta última parte en HTML para phpmailer esas variables del principio no me dan ningún resultado

Graciasm a ver si me expliqué mejor