Retroceder   Foros del Web > Miembros

hoberwilly ha deshabilitado el karma

hoberwilly hoberwilly está desconectado

Mensajes de Visita

Mostrando Mensajes de Visita 1 al 1 de 1
  1. hoberwilly
    02-jul-2008 11:11
    hoberwilly
    Saludos,
    Logre implementar un carrito de compras por medio de sesiones, a travez de un manual que consegui en internet (funciona correctamente), y ahora estoy en la necesidad de que todos los productos seleccionados se graben en una base de datos, para luego despues poder extraerlos los datos guardados de la compra.

    agradesco de antemano su desinteresada colaboracion que me puedan ofrecer,


    Aqui envio el codigo:
    TABLA: catalogo; CAMPOS: id int not null auto_increment primary key,producto varchar(100),precio decimal(9,2)

    VERCARRITO.PHP
    <?php
    session_start();
    error_reporting(E_ALL);
    @ini_set('display_errors', '1');
    if(isset($_SESSION['carro']))
    $carro=$_SESSION['carro'];else $carro=false;
    ?>
    <html>
    <head>
    <title>PRODUCTOS AGREGADOS AL CARRITO</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    </style>
    </head>

    <body>

    <h1 align="center">Carrito</h1>
    <?php
    if($carro){
    ?>
    <table width="720" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr bgcolor="#333333">
    <td width="105">Producto</td>
    <td width="207">Precio</td>
    <td colspan="2" align="center">Cantidad de Unidades</td>
    <td width="15" align="center">Ver detalle</td>
    <td width="15" align="center">Subtotal</td>
    <td width="85" align="center">Borrar</td>
    <td width="159" align="center">Actualizar</td>
    </tr>
    <?php
    $color=array("#ffffff","#F0F0F0");
    $contador=0;
    $suma=0;
    foreach($carro as $k => $v){
    $subto=$v['cantidad']*$v['precio'];
    $suma=$suma+$subto;
    $contador++;
    ?>
    <form name="a<?php echo $v['identificador'] ?>" method="post" action="agregacar.php?<?php echo SID ?>" id="a<?php echo $v['identificador'] ?>">
    <tr bgcolor="<?php echo $color[$contador%2]; ?>">
    <td><?php echo $v['producto'] ?></td>
    <td><?php echo $v['precio'] ?></td>
    <td width="43" align="center"><?php echo $v['cantidad'] ?></td>
    <td width="136" align="center">
    <input name="cantidad" type="text" id="cantidad" value="<?php echo $v['cantidad'] ?>" size="8">
    <input name="id" type="hidden" id="id" value="<?php echo $v['id'] ?>"> </td>
    <td width="11%" class="texto"><div align="right"><? echo "$" .number_format($subto, 2, '.', ','); ?></div></td>
    <td align="center"><a href="borracar.php?<?php echo SID ?>&id=<?php echo $v['id'] ?>"><img src="trash.gif"></a></td>
    <td align="center">
    <input name="imageField" type="image" src="actualizar.gif"></td>
    </tr></form>
    <?php }?>
    </table>
    <div align="center"><span class="prod">Total de Artículos: <?php echo count($carro); ?></span>
    </div><br>
    <div align="center"><span class="prod">Total: $<?php echo number_format($suma,2); ?></span>
    </div><br>
    <div align="center"><span class="prod">Continuar la selección de productos</span>
    <a href="catalogo.php?<?php echo SID;?>"><img src="continuar.gif"></a>
    </div>

    <?php }else{ ?>
    <p align="center"> <span class="prod">No hay productos seleccionados</span> <a href="catalogo.php?<?php echo SID;?>"><img src="continuar.gif"></a>
    <?php }?>
    </p>
    </body>
    </html>

Acerca de Mi

  • Sobre hoberwilly
    Nombre
    Hober Willy Siccha Vega
    País
    PERU

Estadísticas

Total de Mensajes
Mensajes de Visita
Información General
  • Última Actividad: Ayer 18:08
  • Fecha de Ingreso: 02-jul-2008
  • Referidos: 0

La Zona horaria es GMT -6. Ahora son las 01:12.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96