Código:
<?php session_start(); if ($item){ if (!isset($itemsEnCesta)){ $itemsEnCesta[$item]=$cantidad; }else{ foreach($itemsEnCesta as $k => $v){ if ($item==$k){ $itemsEnCesta[$k]=$nuevacant; $encontrado=1; } } if (!$encontrado) $itemsEnCesta[$item]=$cantidad; } } ?> <html> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </script> <body><img src="images/shop.jpg"><br> <hr size="1" noshade> <table width="450" border="0" cellpadding="0" cellspacing="0"> <?php if (isset($itemsEnCesta)){ ?> <tr> <td bgcolor="#7F9DB8"><img src="images/producto.jpg" width="132" height="20"></td> <td width="60" bgcolor="#7F9DB8"><img src="images/cantidad.jpg" width="60" height="20"></td> <td width="60" bgcolor="#7F9DB8"><img src="images/precio.jpg" width="60" height="20"></td> <td width="71" bgcolor="#7F9DB8"> <div align="right"><img src="images/total.jpg" width="60" height="20"></div></td> </tr> <?php foreach($itemsEnCesta as $k => $v){ $colname_DADA = "1"; mysql_select_db($database_ai_db, $ai_db); $query_DADA = "SELECT * FROM productos WHERE Id = '$k'"; $DADA = mysql_query($query_DADA, $ai_db) or die(mysql_error()); $row_DADA = mysql_fetch_assoc($DADA); $totalRows_DADA = mysql_num_rows($DADA); $producto = $row_DADA['producto'];?> <?php if($vprecio=="" or $vprecio=="Contado"){ $precio = $row_DADA['precio']; $cuotas = "$"; $cuo = "1"; } else if($vprecio=="Plan1"){ $precio = $row_DADA['plan1']; $cuotas = "3 cuotas de $"; $cuo = "3";} else if($vprecio=="Plan2"){ $precio = $row_DADA['plan2']; $cuotas = "15 cuotas de $"; $cuo = "15";} ?> <tr> <td width="260" valign="middle" bgcolor="DFE6ED"> <p><font size="1" face="Verdana"><a href="bd/consultas/borrarprod.php?item=<?php echo $k ?>"><img src="images/borrar.jpg" width="54" height="24" border="0" align="absmiddle"></a> <font color="#000000" face="Arial"><a href="index.php?Center=/bd/consultas/xcadauno.php&Id=<?php echo $k;?>"><font color="#000000"><?php echo $row_DADA['producto']; ?><?php echo $row_DADA['marca']; ?><?php echo $row_DADA['modelo']; ?></font></a></font></font> </p></td> <td width="60" valign="middle" bgcolor="DFE6ED"> <form name="form1" method="post" action="index.php?Center=bd/consultas/shop.php&item=<?php echo $row_DADA['Id']; ?>&cantidad=<?php echo $nuevacant; ?>&vprecio=<?php $vprecio; ?>" style="word-spacing: 0; text-indent: 0; line-height: 100%; margin: 0"> <font size="1" face="Verdana"> <input name="nuevacant" type="text" value="<?php echo $v; ?>" size="3" style="border-style: solid; border-width: 1; font-family:Verdana; font-size:8pt"> </font> </form></td> <td width="60" valign="baseline" bgcolor="DFE6ED"><font size="1" face="Verdana"><?php echo $cuotas ?><?php echo $precio*$v; ?></font></td> <td width="71" valign="baseline" bgcolor="DFE6ED"><font size="1" face="Verdana"> $ <?php $Total = $precio*$v*$cuo; $totalfin = $totalfin+$Total; ?> <?php echo $Total; ?></font></td> </tr> <tr> <td colspan="4" valign="middle" bgcolor="#FFFFFF"><font size="1" face="Verdana"><img src="images/blank.gif" width="54" height="2" border="0" align="middle"></font></td> </tr> <?php } } ?> <tr> <td height="25" bgcolor="7F9DB8"><font size="1" face="Verdana"> <img src="images/formadepago.jpg" width="92" height="24" align="absmiddle"> <select name="menu1" onChange="MM_jumpMenu('parent',this,0)" style="border-style: solid; border-width: 1; font-family:Verdana; font-size:8pt"> <option value="index.php?Center=bd/consultas/shop.php&vprecio=" selected><?php echo $vprecio; ?></option> <option value="index.php?Center=bd/consultas/shop.php&vprecio=Contado">Contado</option> <option value="index.php?Center=bd/consultas/shop.php&vprecio=Plan1">Plan1</option> <option value="index.php?Center=bd/consultas/shop.php&vprecio=Plan2">Plan2</option> </select> </font></td> <td bgcolor="7F9DB8"> </td> <td bgcolor="7F9DB8"> <div align="right"><img src="images/totalf.jpg" width="49" height="24"></div></td> <td bgcolor="DFE6ED"><font size="1" face="Verdana"> $ <?php echo $totalfin; ?></font></td> </tr> <tr> <td colspan="4" valign="middle" bgcolor="#FFFFFF"><font size="1" face="Verdana"><img src="images/blank.gif" width="54" height="2" border="0" align="middle"></font></td> </tr> <tr> <td height="24" bgcolor="7F9DB8"><a href="index.php"><img src="images/seguircomprando.jpg" width="128" height="24" border="0"></a></td> <td height="24" colspan="3" bgcolor="7F9DB8"> <p align="right"><a href="index.php?Center=/bd/consultas/borrarshop.php"><img src="images/cancelar.jpg" width="76" height="24" border="0"></a><a href="index.php?Center=/bd/consultas/estaono.php"><img src="images/confirmar.jpg" width="76" height="24" border="0"></a></p></td> </tr> </table> <br> <?php echo 'Center=';echo $Center; ?></body> </html>