Foros del Web » Programando para Internet » PHP »

Carro de la compra

Estas en el tema de Carro de la compra en el foro de PHP en Foros del Web. Hol a todos: Vereis estoy intenado hacer un carro de la compra a partir de una plantilla. Soy una novata y por eso necesitaba la ...
  #1 (permalink)  
Antiguo 03/07/2007, 18:51
 
Fecha de Ingreso: diciembre-2006
Mensajes: 111
Antigüedad: 17 años, 4 meses
Puntos: 1
Carro de la compra

Hol a todos:

Vereis estoy intenado hacer un carro de la compra a partir de una plantilla. Soy una novata y por eso necesitaba la plantilla, yo sola hubiera sido incapaz, por lo que en realidad estoy haciendo es modifidcarla para lo que yo necesito, voy paso a paso y me van surgiendo muchos problemas, así que me veris muy a menudo pidiendo ayuda para el dichoso carrito.
Aquí va la primera.

Solo me queda una cosa por hacer, que si estando en el carrito por ejmplo has comprado dos unidades del producto a pero en realidad querias 4 le pones en la casilla 4 y le das al boton actualizar, esto no se como hacerlo ¿me podeis ayudar?

Os pongo el único documento que creo que necesitais, lib_carrito.

Muchas gracias por toda la aqyuda que dais.

Un saludo

Alejandra

Código PHP:
<?
error_reporting
(0);
class 
carrito {
    
//atributos de la clase
       
var $num_productos;
       var 
$array_id_prod;
    var 
$array_talla_prod;
    var 
$array_nomtalla_prod;
    var 
$array_color_prod;
    var 
$array_nomcolor_prod;
    var 
$array_modelo_prod;
    var 
$array_nommodelo_prod;
    var 
$array_imagen_prod;
       var 
$array_nombre_prod;
    var 
$array_precio_prod;
    var 
$array_unidades_prod;

    function 
carrito () {
           
$this->num_productos=0;
    }
    
    function 
introduce_producto($id$talla$nomtalla$color$nomcolor$modelo$nommodelo$imagen$nombre$precio$unidades){
        for (
$a=0;$a<$this->num_productos;$a++){
            if(
$this->array_id_prod[$a] == $id){
                
$this->array_unidades_prod[$a] = $this->array_unidades_prod[$a] + $unidades;
                
$listo true;
            }
        }
        if (!
$listo){
            
$this->array_id_prod[$this->num_productos]=$id;
            
$this->array_nomtalla_prod[$this->num_productos]=$nomtalla;
            
$this->array_color_prod[$this->num_productos]=$color;
            
$this->array_nomcolor_prod[$this->num_productos]=$nomcolor;
            
$this->array_modelo_prod[$this->num_productos]=$modelo;
            
$this->array_nommodelo_prod[$this->num_productos]=$nommodelo;
            
$this->array_imagen_prod[$this->num_productos]=$imagen;
            
$this->array_nombre_prod[$this->num_productos]=$nombre;
            
$this->array_precio_prod[$this->num_productos]=$precio;
            
$this->array_unidades_prod[$this->num_productos]=$unidades;
        }
        
$this->num_productos++;
    }
  #2 (permalink)  
Antiguo 03/07/2007, 18:54
 
Fecha de Ingreso: diciembre-2006
Mensajes: 111
Antigüedad: 17 años, 4 meses
Puntos: 1
el codigo que falta 1

Como es un documento muy largo he tenido que dividirlo en tres, sigue asi:

Código PHP:
function imprime_carrito(){
        $suma = 0.00;
?>
        <table width="100%" border="0" cellpadding="0" cellspacing="0" id="productos">
              <tr>
                <td colspan="3" bgcolor="#F5F5FF" class="cabecera_productos"><table width="100%"  border="0" cellpadding="0" cellspacing="0" id="esquina">
                  <tr>
                    <td width="17"><img src="../imag/izq_azul.gif" width="17" height="20"></td>
                    <td bgcolor="#0000FF" class="cabecera_productos"><div align="center">Referencia</div></td>
                  </tr>
                </table></td>
                <td width="16" bgcolor="#0000FF" class="cabecera_productos">&nbsp;</td>
                <td bgcolor="#0000FF" class="cabecera_productos">Im&aacute;gen</td>
                <td width="16" bgcolor="#0000FF" class="cabecera_productos">&nbsp;</td>
                <td width="100%" bgcolor="#0000FF" class="cabecera_productos">Producto</td>
                <td width="16" bgcolor="#0000FF" class="cabecera_productos">&nbsp;</td>
                <td bgcolor="#0000FF" class="cabecera_productos">Cantidad</td>
                <td width="16" bgcolor="#0000FF" class="cabecera_productos">&nbsp;</td>
                <td bgcolor="#0000FF" class="cabecera_productos"><div align="center">Precio</div></td>
                <td colspan="3" align="right" bgcolor="#F5F5FF" class="cabecera_productos"><table width="100%"  border="0" align="right" cellpadding="0" cellspacing="0" id="comprar y esquina">
                  <tr>
                    <td align="right" valign="baseline" bgcolor="#0000FF" class="cabecera_productos"><div align="right"><img src="../imag/pix.gif" width="1" height="1"></div></td>
                    <td width="17"><img src="../imag/drcha_azul.gif" width="17" height="20"></td>
                  </tr>
                </table></td>
          </tr>
                        <?
        
for ($i=0;$i<$this->num_productos;$i++){
            if(
$this->array_id_prod[$i]!=0){
            
?>
<tr>
                <td width="5" rowspan="2" bgcolor="#0000FF"><img src="../imag/pix.gif" width="1" height="1"></td>
                <td width="16" height="100" align="center" valign="bottom" bgcolor="#F5F5FF">&nbsp;</td>
                <td width="100" height="100" align="center" valign="middle" bgcolor="#F5F5FF" class="precio"><? echo $this->array_id_prod[$i]; ?></td>
                <td width="16" align="center" valign="bottom" bgcolor="#F5F5FF">&nbsp;</td>
                <td width="125" height="100" align="right" valign="middle" bgcolor="#F5F5FF"><table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0" id="imagen">
                  <tr>
                    <td align="center" valign="middle"><a href="producto.php?id=<? echo $this->array_id_prod[$i]; ?>
                    onclick="window.open(this.href, this.target, 'width=530,height=530,top=115,left=200,resizable=0,scrollbars=1,menubar=0,toolbar=0,status=yes,location=0'); return false;" 
                    onMouseOut="window.status=' '" onMouseOver="window.status='<? echo $this->array_nombre_prod[$i]; ?>';return true">
                  <img src="<? echo $this->array_imagen_prod[$i]; ?>" alt="<? echo $this->array_nombre_prod[$i]; ?>" border="0"></a></td>
                    
                      
                  </tr>
                </table></td>
                <td width="16" align="center" valign="top" bgcolor="#F5F5FF">&nbsp;</td>
                <td width="100%" align="left" valign="middle" bgcolor="#F5F5FF"><a href="producto.php?id=<? echo $this->array_id_prod[$i]; ?>
                    onClick="window.open(this.href, this.target, 'width=530,height=530,top=115,left=200,resizable=0,scrollbars=1,menubar=0,toolbar=0,status=yes,location=0'); return false;" 
                    onMouseOut="window.status=' '" onMouseOver="window.status='<? echo $this->array_nombre_prod[$i]; ?>';return true" class="quinto">
                  <? echo $this->array_nombre_prod[$i]; ?></a></td>
                <td width="16" align="center" valign="top" bgcolor="#F5F5FF">&nbsp;</td>
                <td align="center" bgcolor="#F5F5FF">
                <input name="unidades" type="text" class="unidades" value="<? echo $this->array_unidades_prod[$i]; ?>" size="2" maxlength="3">
                </td>
                <td width="16" align="center" valign="top" bgcolor="#F5F5FF">&nbsp;</td>
                <td align="center" valign="middle" bgcolor="#F5F5FF" class="precio"><? echo $this->array_precio_prod[$i] * $this->array_unidades_prod[$i]; ?>&nbsp;&euro;</td>
                <td align="right" bgcolor="#F5F5FF"><a href="eliminar_producto.php?linea=<? echo $i?>" class="primero">Eliminar producto</a></td>
                <td width="16" align="right" bgcolor="#F5F5FF">&nbsp;</td>
                <td width="5" rowspan="2" bgcolor="#0000FF"><img src="../imag/pix.gif" width="1" height="1"></td>
      </tr>
              <tr>
                <td width="16" height="1" align="right" valign="bottom" bgcolor="#CC9933"><img src="../imag/pix.gif" width="16" height="1"></td>
                <td width="100" height="1" align="right" valign="bottom" bgcolor="#CC9933"><img src="../imag/pix.gif" width="100" height="1"></td>
                <td width="16" height="1" align="right" valign="bottom" bgcolor="#CC9933"><img src="../imag/pix.gif" width="16" height="1"></td>
                <td width="125" height="1" align="center" valign="middle" bgcolor="#CC9933"><img src="../imag/pix.gif" width="1" height="1"></td>
                <td width="16" height="1" align="right" valign="bottom" bgcolor="#CC9933"><img src="../imag/pix.gif" width="16" height="1"></td>
                <td width="100%" height="1" align="center" valign="middle" bgcolor="#CC9933"><img src="../imag/pix.gif" width="1" height="1"></td>
                <td width="16" height="1" align="right" valign="bottom" bgcolor="#CC9933"><img src="../imag/pix.gif" width="16" height="1"></td>
                <td height="1" align="center" valign="middle" bgcolor="#CC9933"><img src="../imag/pix.gif" width="1" height="1"></td>
                <td width="16" height="1" align="right" valign="bottom" bgcolor="#CC9933"><img src="../imag/pix.gif" width="16" height="1"></td>
                <td height="1" align="center" valign="bottom" bgcolor="#CC9933"><img src="../imag/pix.gif" width="100" height="1"></td>
                <td width="37" height="1" align="center" valign="bottom" bgcolor="#CC9933"><img src="../imag/pix.gif" width="120" height="1"></td>
                <td width="16" height="1" align="right" valign="bottom" bgcolor="#CC9933"><img src="../imag/pix.gif" width="16" height="1"></td>
              </tr>
                             <?
                $suma 
$suma $this->array_precio_prod[$i] * $this->array_unidades_prod[$i];
            }
        }
        
       
//muestro el total
        
?>
<tr>
                <td colspan="7" valign="top"><table width="100%"  border="0" cellpadding="0" cellspacing="0" id="culo_products">
                  <tr>
                    <td width="14"><img src="../imag/esq_izq_clara.gif" width="14" height="12"></td>
                    <td valign="bottom" bgcolor="#F5F5FF"><table width="100%"  border="0" cellpadding="0" cellspacing="0" id="centro_azul_culo">
                      <tr>
                        <td height="1" bgcolor="#0000FF"><img src="../imag/pix.gif" width="1" height="1"></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
                <td rowspan="4" valign="bottom" bgcolor="#F5F5FF"><table width="1" border="0" cellpadding="0" cellspacing="0" valign="bottom">
        <tr>
          <td width="1" bgcolor="#F5F5FF"><img src="../imag/pix.gif" width="1" height="11"></td>
        </tr>
        <tr>
          <td width="1" height="100%" bgcolor="#0000FF"><img src="../imag/pix.gif" width="1" height="103"></td>
        </tr>
                </table></td>
                <td colspan="5" bgcolor="#F5F5FF">&nbsp;</td>
                <td bgcolor="#0000FF"><img src="../imag/pix.gif" width="1" height="1"></td>
</tr>
<tr>
  <td colspan="7" rowspan="4"><table  border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="14"><img src="../imag/pix.gif" width="14" height="1"></td>
      <td width="30" align="right"><img src="../imag/huellita.gif" width="30" height="31"></td>
      <td width="135" align="center"><a href="tienda.php" target="contenido" class="noveno" onmouseout="window.status=' '" onmouseover="window.status='Seguir comprando';return true">Seguir comprando</a></td>
      <td align="center">&nbsp;</td>
      <td width="30" align="center"><img src="../imag/huellita.gif" width="30" height="31"> </td>
      <td width="135" align="center"><a href="#" target="contenido" class="noveno" onmouseout="window.status=' '" onmouseover="window.status='Actualizar';return true">Actualizar</a></td>
      <td align="center">&nbsp;</td>
      <td width="30" align="center"><img src="../imag/huellita.gif" width="30" height="31"></td>
      <td width="135" align="center"><a href="#" target="contenido" class="noveno" onmouseout="window.status=' '" onmouseover="window.status='Procesar pedido';return true">Procesar pedido</a></td>
      <td align="center">&nbsp;</td>
      <td width="30" align="left"><img src="../imag/huellita.gif" width="30" height="31"></td>
      <td width="14"><img src="../imag/pix.gif" width="14" height="1"></td>
    </tr>
  </table></td>
  #3 (permalink)  
Antiguo 03/07/2007, 18:54
 
Fecha de Ingreso: diciembre-2006
Mensajes: 111
Antigüedad: 17 años, 4 meses
Puntos: 1
la ultima parte del codigo

Código PHP:
  <td colspan="2" align="right" bgcolor="#F5F5FF" class="encabezado_webs">Subtotal:</td>
  <td align="center" bgcolor="#F5F5FF" class="precio"><? echo $suma?>&nbsp;&euro;</td>
  <td colspan="2" bgcolor="#F5F5FF">&nbsp;</td>
  <td rowspan="3" bgcolor="#0000FF"><img src="../imag/pix.gif" width="1" height="1"></td>
</tr>
<tr>
  <td colspan="2" align="right" bgcolor="#F5F5FF" class="encabezado_webs"><br>
    Env&iacute;o:</td>
  <td align="center" bgcolor="#F5F5FF" class="precio"><br>
  <?
  
if ($suma 500)
  {
  
$portes '8.00';
  }else{
  
$portes '0.00';
  }
  echo 
$portes;
  
?>
  &nbsp;&euro;
  </td>
  <td colspan="2" bgcolor="#F5F5FF">&nbsp;</td>
</tr>
<tr>
  <td colspan="2" align="right" bgcolor="#F5F5FF" class="encabezado_webs"><br>
    Total:</td>
  <td align="center" bgcolor="#F5F5FF" class="precio"><br>
  <?
  $total
$suma $portes;
  echo 
$total;
  
?>
  &nbsp;&euro;
  </td>
  <td colspan="2" bgcolor="#F5F5FF">&nbsp;</td>
</tr>
<tr>
  <td colspan="7" valign="top"><table width="100%"  border="0" cellpadding="0" cellspacing="0" id="culo_products">
                  <tr>
                    <td width="14"><img src="../imag/esq_izq_clara.gif" width="14" height="12"></td>
                    <td valign="bottom" bgcolor="#F5F5FF"><table width="100%"  border="0" cellpadding="0" cellspacing="0" id="centro_azul_culo">
                      <tr>
                        <td height="1" bgcolor="#0000FF"><img src="../imag/pix.gif" width="1" height="1"></td>
                      </tr>
                    </table></td>
                    <td width="14"><img src="../imag/esq_drcha_clara.gif" width="14" height="12"></td>
                  </tr>
    </table></td>
  </tr>
</table>
        <?
        
}
        
//para usar estas clases en otros documentos
//para sacar el importe
    
function importe(){
        
$suma 0.0;
        for (
$i=0;$i<$this->num_productos;$i++){
            if(
$this->array_id_prod[$i]!=0){
                
$suma $suma $this->array_precio_prod[$i] * $this->array_unidades_prod[$i];
            }
        }
        return 
$suma;
    }
    
//para sacar el numero de productos comprados
    
function numProductos(){
        
$num 0;
        for (
$a=0;$a<$this->num_productos;$a++){
            if(
$this->array_id_prod[$a]!=0){
                
$num $num $this->array_unidades_prod[$a];
            }
        }
        return 
$num;
    }


    
//elimina un producto del carrito. recibe la linea del carrito que debe eliminar
    //no lo elimina realmente, simplemente pone a cero el id, para saber que esta en estado retirado
    
function elimina_producto($linea){
        
$this->array_id_prod[$linea]=0;
        
$this->num_carrito--;
    }
    

//inicio la sesión
session_start();
//si no esta creado el objeto carrito en la sesion, lo creo
if (!isset($_SESSION["ocarrito"])){
    
$_SESSION["ocarrito"] = new carrito();
}
?>[/
  #4 (permalink)  
Antiguo 03/07/2007, 23:09
Avatar de _ssx  
Fecha de Ingreso: mayo-2003
Ubicación: mX
Mensajes: 683
Antigüedad: 20 años, 11 meses
Puntos: 60
Re: Carro de la compra

Hola :) Exactamente modifique ese script para hacer lo que tu deseas.. solo modifique la clase y lo pense de esta manera..

1.- tener dos variables principales.. una que llevara el control del numero de productos en el carro.. y otra que tendra el numero de items.. por ejemplo..

4 Pantalones Dx
5 Blusas Mx
9 Calzones SX

Si te das cuenta hay 18 productos pero solo 3 items distintos, entonces con esto deducimos que cuando agreguemos un producto al carro necesitamos ver si ya existe y si existe solo sumarle a la cantidad del producto uno mas.. y si no agregar otro al array..

Ojo.. cuando eliminamos un item del carro.. no lo eliminamos en realidad solo lo "marcamos" poniendolo en 0.. para que al mostrar los elementos no los imprimamos..

esto lo hice mas o menos asi..



Código PHP:
<?
class carrito {
    
//atributos de la clase
    
var $IndiceArray;
       var 
$num_productos;
       var 
$array_id_prod;
       var 
$array_borrado_prod;
    var 
$array_talla_prod;
    var 
$array_nomtalla_prod;
    var 
$array_color_prod;
    var 
$array_nomcolor_prod;
    var 
$array_modelo_prod;
    var 
$array_nommodelo_prod;
    var 
$array_imagen_prod;
       var 
$array_nombre_prod;
    var 
$array_precio_prod;
    var 
$array_unidades_prod;

    function 
carrito () {
        
//esta variable va a llevar el numero TOTAL de productos
           
$this->num_productos=0;
           
//esta va a llevar el indice de productos
           
$this->IndiceArray=0;
    }
//metodo modificado para agregar productos al carro
 
function introduce_producto($id$talla$nomtalla$color$nomcolor$modelo$nommodelo$imagen$nombre$precio$unidades){
        
//verificamos si no hay productos registrados..
        
if($this->num_productos<=0)
            {
            
//registramos el producto
            
$this->array_id_prod[$this->IndiceArray]=$id;
            
$this->array_nomtalla_prod[$this->IndiceArray]=$nomtalla;
            
$this->array_color_prod[$this->IndiceArray]=$color;
            
$this->array_nomcolor_prod[$this->IndiceArray]=$nomcolor;
            
$this->array_modelo_prod[$this->IndiceArray]=$modelo;
            
$this->array_nommodelo_prod[$this->IndiceArray]=$nommodelo;
            
$this->array_imagen_prod[$this->IndiceArray]=$imagen;
            
$this->array_nombre_prod[$this->IndiceArray]=$nombre;
            
$this->array_precio_prod[$this->IndiceArray]=$precio;
            
$this->array_unidades_prod[$this->IndiceArray]=$unidades;
$this->IndiceArray++;                            $this->num_productos++;
            }else
                
//ahora verificamos si el producto enviado ya existe
                //si es asi para solo aumentar sus unidades
                    
{
                    
//le enviamos el ID y cuantas unidades va a checar si existe
                    
if($this->existeProducto((int)$id,(int)$unidades)
                            {
                            
//aumentamos solo las unidades del producto enviado
                            
} else {
                                    
//registramos un nuevo item
                                    
$this->array_id_prod[$this->IndiceArray]=$id;
                                    
$this->array_nomtalla_prod[$this->IndiceArray]=$nomtalla;
                                    
$this->array_color_prod[$this->IndiceArray]=$color;
                                    
$this->array_nomcolor_prod[$this->IndiceArray]=$nomcolor;
                                    
$this->array_modelo_prod[$this->IndiceArray]=$modelo;
                                    
$this->array_nommodelo_prod[$this->IndiceArray]=$nommodelo;
                                    
$this->array_imagen_prod[$this->IndiceArray]=$imagen;
                                    
$this->array_nombre_prod[$this->IndiceArray]=$nombre;
                                    
$this->array_precio_prod[$this->IndiceArray]=$precio;
                                    
$this->array_unidades_prod[$this->IndiceArray]=$unidades;
                                    
$this->IndiceArray++;
                                    
$this->num_productos++;
                                    }
                    }
        
        }
//Este metodo verificara si ya agregaste el producto y si es asi solo le sumara a su cantidad..
function existeProducto($id,$uni)
    {
    for (
$j=0$j<$this->IndiceArray$j++){
        
//echo "Comparamos ->>".$this->array_id_prod[$j]." con ->>".$id." a ver donde hay coincidencia<br>";
        //buscamos coincidencia con el ID
        
if($this->array_id_prod[$j]==$id)
            {
            
//si encuentra el producto aumentamos unidades en su array
            
$this->array_unidades_prod[$j]+=$uni;
            
//tambien aumentamos el numero de productos
            
$this->num_productos+=$uni;
            
//lo reactivamos por si ya habia sido borrado
            
$this->array_borrado_producto[$j]=1;
            
$salida 1;
            break;
            } else 
                {
                
$salida 0;
                }
    }
    return 
$salida;
}


//este metodo quita el numero de unidades que quieras de el producto seleccionado
//lo usas asi...
// $_SESSION["ocarrito"]->removeItem(1,10);
//donde 1 = al id del producto
//donde 10 = a la cantidad que vas a quitarle de unidades
function removeItem()
    {
    
$argumentos func_get_args();
    if(
$argumentos[1]>=1)
        {
        
$this->array_unidades_prod[$argumentos[0]]-=$argumentos[1];
        
$this->num_productos-=$argumentos[1];
        }else {
    
$this->array_borrado_prod[$argumentos[0]] = 0;
    
$this->num_productos-=$this->getCantidad($argumentos[0]);
    
$this->array_unidades_prod[$argumentos[0]] = 0;
    }
    
//actualizamos el numero de productos
    
}
    
    
//este metodo devuelve cuantas unidades tiene un producto
function getCantidad($id)
    {
    return 
$this->array_unidades_prod[$id];
    }
?>
ahh una cosa más en el mètodo imprime_carrito.. necesitarias.. cambiar el for a algo asi..

Código PHP:
 for ($i=0;$i<$this->IndiceArray;$i++){
            if(
$this->array_borrado_prod[$i]!=0){ 
En fin si tienes más dudas ;) pss aki andamos.. o por msn o msg privado
__________________
Escribe tu código de forma que refleje, y saque a relucir,lo mejor de tu carácter personal
www.oscararzola.com/blog
Principios de un programador

Última edición por _ssx; 03/07/2007 a las 23:13 Razón: Error de dedo :D
  #5 (permalink)  
Antiguo 04/07/2007, 02:21
 
Fecha de Ingreso: junio-2007
Mensajes: 37
Antigüedad: 16 años, 10 meses
Puntos: 0
Re: Carro de la compra

Hola,

Yo tb stoy liado con un pekeño comercio, tb he usado una plantilla y modificandola, la verdad es q me esta qdando chulo :)

Nada solo pa darte animos y pa animarme yo a seguir trabajando duro!
  #6 (permalink)  
Antiguo 04/07/2007, 20:56
 
Fecha de Ingreso: diciembre-2006
Mensajes: 111
Antigüedad: 17 años, 4 meses
Puntos: 1
Re: Carro de la compra

Hola Alex:

A mi me está volviendo un poco loca pero también poco a poco va tomando forma y queda chulo, ánimo a ti tambien y yo a seguir trabajando y preguntando por aqui :)

Ahora voy a probar lo que me ha dicho ssx a ver si sé :)
  #7 (permalink)  
Antiguo 04/07/2007, 21:07
 
Fecha de Ingreso: diciembre-2006
Mensajes: 111
Antigüedad: 17 años, 4 meses
Puntos: 1
Re: Carro de la compra

Hola _SSX:

Más o menos entiendo lo que has hecho pero.... que le pongo al botón de actualizar?

Muchas gracias

Un saludo

Alejandra
  #8 (permalink)  
Antiguo 05/07/2007, 09:14
Avatar de _ssx  
Fecha de Ingreso: mayo-2003
Ubicación: mX
Mensajes: 683
Antigüedad: 20 años, 11 meses
Puntos: 60
Re: Carro de la compra

Bueno si me pusieras :) un link con todos tus archivos creo que podria darme una idea de como lo estas manejando tu ;) y asi te puedo ayudar mas facil, sin embargo solo debes de hacer por cada producto un campo de texto que diga.. cuantos mas van a agregar.. eso debe de estar en la funcion imprime carrito.. en cada uno de los items agregados.. y eso lo mandas a una pagina que reciba por get o por POST y mande a llamar el metodo de agregar producto

Código PHP:
//este archivo se llamaria por ejemplo.. agregar_producto.php
$producto$_GET['id_prod'];
$cuantos$_GET['unidades_prod'];
$SESSION["ocarrito"]->introduce_producto($producto,$cuantos);
header("Location: ver_carrito.php"); 
__________________
Escribe tu código de forma que refleje, y saque a relucir,lo mejor de tu carácter personal
www.oscararzola.com/blog
Principios de un programador
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 16:53.