Ver Mensaje Individual
  #10 (permalink)  
Antiguo 21/09/2008, 19:13
ghesent
 
Fecha de Ingreso: septiembre-2008
Mensajes: 21
Antigüedad: 16 años, 5 meses
Puntos: 1
Respuesta: Problema con $_SESSION y firefox

No no utilizo firebug, pero aqui esta el codigo final de como quedo el rollo este..
Código PHP:
if($art != "none" && $delete=="" && isset($art)){  //si si hay articulo y no se esta borrando        
        
if($_POST['opcion']!=""){
            if(
$_SESSION['opciones'][$art] == ""){  //si las opciones estan limpias (primer articulo del tipo)
                
$_SESSION['opciones'][$art] = $_POST['opcion'];
                if(
$_POST['cantidad'] == ""){
                    
$_SESSION['cart'][$art] = 1;
                } else if(isset(
$_POST['cantidad'])){
                    
$_SESSION['cart'][$art] = $_POST['cantidad'];
                }
            } else {
                
$strpos strpos($_SESSION['opciones'][$art],$_POST['opcion']);
                if(
$strpos !== false){
                    echo 
"Ya existe opcion";
                    
$op explode(",",$_SESSION['opciones'][$art]);
                    
$key array_search($_POST['opcion'],$op);
                    echo 
$key;
                    
$cart explode(",",$_SESSION['cart'][$art]);
                    
$cart[$key] = $_POST['cantidad'];
                    
$_SESSION['cart'][$art] = implode(",",$cart);
                } else {
                    
$_SESSION['opciones'][$art] .= ",".$_POST['opcion'];
                    if(
$_POST['cantidad'] == ""){
                        
$_SESSION['cart'][$art] .= ",1";
                    } else {
                        
$_SESSION['cart'][$art] .= ",".$_POST['cantidad'];
                    }
                }
            }            
        } else {
            if(
$_POST['cantidad'] == ""){
                
$_SESSION['cart'][$art] = 1;
            } else if(isset(
$_POST['cantidad'])){
                
$_SESSION['cart'][$art] = $_POST['cantidad'];
            }
        }
    } else if(
$delete != ""){
        if(
$_GET['opciones'] == ""){ //producto normal
            
unset($_SESSION['cart'][$delete]);
            unset(
$_SESSION['opciones'][$delete]);
        } else { 
//producto con opciones
            
$delopciones explode(",",$_SESSION['opciones'][$delete]);
            
$delart explode(",",$_SESSION['cart'][$delete]);
            
$keyop array_search($_GET['opciones'],$delopciones);
            unset(
$delopciones[$keyop]);
            unset(
$delart[$keyop]);
            
$_SESSION['opciones'][$delete] = implode(",",$delopciones);
            
$_SESSION['cart'][$delete] = implode(",",$delart);
        }        
    }
    
    if(
$_GET['update']==1){
        foreach(
$_POST as $index => $value){
            
$_SESSION['cart'][$index] = $value;
        }
    }