Foros del Web » Programando para Internet » PHP »

Problema con tienda

Estas en el tema de Problema con tienda en el foro de PHP en Foros del Web. Hola Amigos tengo un problema que no e podido decifrar el por que. el punto es que estoy diseñando una tienda en php.... pero cuando ...
  #1 (permalink)  
Antiguo 02/02/2012, 19:16
 
Fecha de Ingreso: agosto-2010
Ubicación: mexico
Mensajes: 125
Antigüedad: 13 años, 8 meses
Puntos: 0
Pregunta Problema con tienda

Hola

Amigos tengo un problema que no e podido decifrar el por que. el punto es que estoy diseñando una tienda en php.... pero cuando le doy agregar al boton de el item que quiero y va y lo guarda en la variable de sesion lo que quiero es que una ves guardada me regrese otra ves a mi tienda para comprar mas.

Segun yo lo puedo hacer con esta funcion
Código PHP:
header("location:  ../Cart.php"); 
pero no me regresa a mi tienda y me marca error y ya le hice de mil formas. Espero su valiosa ayuda

Código PHP:
<?php
    
// INCLUDE JCART BEFORE SESSION START
include 'jcart/jcart.php';

// START SESSION
 
session_start();

// INITIALIZE JCART AFTER SESSION START
 
$Cart=$_SESSION['Cart']; 

        
//seguridad
    
include_once '../security.php';

    
//Nombre de la pagina
    
define("PAGE","Tienda ");

    
//configuracion e includes
    
include_once '../includes/config.php';
    include_once 
'../includes/productos.php';
    

    
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>
<?= PAGE .' | 'SITENAME ?>
</title>
<? require_once '../metatags.php';?>
        <style type="text/css">
            * { margin:0; padding:0; }
            html { background:#fff; font-family:trebuchet ms, candara, sans-serif; font-size:62.5%; }
            body { font-size:1.5em; }
            #wrapper { margin:30px auto 250px auto; width:590px; border:solid 1px #ccc; padding:30px; background:#efefef; }
            h2 { margin-bottom:1em; }
            .sidebar { width:35%; float:right; }
            #content  { width:60%; }
            .jcart { margin:0 20px 20px 0; padding-top:20px; border:dashed 2px #66cc66; float:left; background:#fff; text-align:center; }
            .jcart ul { margin:0; list-style:none; padding:0 20px; text-align:left; }
            .jcart fieldset { border:0; }
            .jcart strong { color:#000066; }
            .jcart .button { margin:20px; padding:5px; }
            fieldset { border:0; }
            #paypal-button { display:block; padding:10px; margin:20px auto; }
            .clear { clear:both; }
        </style>
        <script language="javascript" type="text/javascript">
  

</head>
<body>    
<? require_once '../encabezado.php';?>
<div id="Mensajes"></div>
            <div id="wrapper">
            <h2>Tienda en linea</h2>
            <div class="sidebar">
                <?php display_cart($Cart);?>
            </div>
        
            <div id="content">
            <? 
             
            $RProductos 
RegresaProductos();
            while (
$Producto mysql_fetch_array($RProductos)){
                
// print_r($Producto); ?>
                                <form method="post" action="jcart/jcart.php" class="jcart">
                                <fieldset>
                                    <input type="hidden" name="id" value="<?= $Producto[IdProducto]; ?>" />
                                    <input type="hidden" name="nombre" value="<?= $Producto[producto]; ?>" />
                                    <input type="hidden" name="precio" value="<?= $Producto[Precio]; ?>" />
                                    <input type="hidden" name="tipo" value="<?= $Producto[Tipo]; ?>" />
                                    <ul>
                                        <li><img src="images/<?= $Producto[Imagen]; ?>" border="0" /></li>
                                        <li><strong><?= $Producto[producto]; ?></strong></li>
                                        <li>Precio: <?= $Producto[Precio]; ?></li>
                                        <li>
                                            <label>Cantidad: <input type="text" name="cantidad" value="1" size="3" /></label>
                                        </li>                                </ul>                                <input type="submit" name="add-button" value="Agregar" class="button" />
                                </fieldset>                            </form>    <?     }    ?>
                <div class="clear"></div>
            </div>
        </div>
        
<? require_once '../footer.php';?>
</body>
</html>
este es el que resive los Post
Código PHP:
<?php

session_start
(); 
/*************************************************************************************
        Notas:
 *************************************************************************************/
//Nombre de la pagina

define "PAGE""Carrito de Compra" );

//seguridad
include_once '../security.php';

//Consultas
include_once '../includes/config.php';

        

//print_r($_SESSION); 
$Cargo $_SESSION ['SESS_Cargo'];
$IdUsuario $_SESSION ['SESS_MEMBER_ID'];


 if (isset ( 
$_POST ['id'] )) { 
 
 
 
$id=$_POST['id']; 
 
$nombre=$_POST['nombre']; 
 
$precio=$_POST['precio']; 
 
$tipo=$_POST['tipo']; 
 
$cantidad=$_POST['cantidad']; 
  
   
//echo''.$cantidad.'';     
  
 
$Cart=$_SESSION['Cart'];
 
 
 if (empty(
$Cart)){ 
  
//Aquí guardamos el item, pero en vez de indicar como valor la cantidad indicamos un array.   
   //echo''.$Membresia.'';  
   
  
$Cart[$id]=array( 
  
 
'IdUsuario' => $_SESSION ['SESS_MEMBER_ID'],
 
'id'=> $id
 
'nombre'=> $nombre
 
'precio'=> $precio
 
'tipo'=> $tipo
 
'cantidad'=> $cantidad
 

 
 ); 
    }else{ 
  
//obtenemos el item.  
  
$searchItem $Cart[$id]; 
  
//verificamos si existe o no el item en el carrito 
  
if (empty($searchItem)) { 
  
//si no existe agregamos el item con la cantidad y su precio.     
  
$Cart[$id] = array( 
   
 
'IdUsuario' => $_SESSION ['SESS_MEMBER_ID'],
 
'id'=> $id
 
'nombre'=> $nombre
 
'precio'=> $precio
 
'tipo'=> $tipo
 
'cantidad'=> $cantidad
 
 ); 
  }else { 
  
//si existe el item solo aumentamos la cantidad .    
   
$Cart[$id]['cantidad'] += $cantidad;
   
$Cart[$id]['precio'] += $precio $cantidad;
   
   
    
    
  } 
  } 
    
//guardamos los cambios en la sesión 
    
$_SESSION['Cart']=$Cart
    
    
    } 
     
?>
<?
 
function display_cart($Cart){


$itemsumcount ($Cart);

if (
$itemsum <= 1){
$itemcount ($Cart);
$texto1 Articulo;
}

if (
$itemsum >= 2){
$itemcount ($Cart);
$texto1 Articulos;
}


echo 
"<!-- BEGIN JCART -->\n<div id='jcart'>\n";
    
        echo 
"\t<form method='post' action='$form_action'>\n";
        echo 
"\t\t<fieldset>\n";
        echo 
"\t\t\t<table border='0'>\n";
        echo 
"\t\t\t\t<tr>\n";
        echo 
"\t\t\t\t\t<th id='jcart-header' colspan='3'>\n";
        echo 
"\t\t\t\t\t\t<strong id='jcart-title'>Carrito de compras</strong> ( ".$item."&nbsp; ".$texto1." )\n";
        echo 
"\t\t\t\t\t</th>\n";
        echo 
"\t\t\t\t</tr>""\n";

//echo ''.$id.'';    

    
foreach($Cart as $id => $info){      
  
$subtotal += ($info['precio'] );
    
                echo 
"\t\t\t<td class='cantidad'>\n";
                echo 
"\t\t\t<input type='text' name='cantidad' value='" $info['cantidad'] . "' size='1' />\n ";
                echo 
"\t\t\t\t\t</td>\n";
                echo 
"\t\t\t\t\t<td class='nombre'>\n";
                echo 
"\t\t\t" $info['nombre'] . "<input type='hidden' name='nombre' value='" $info['nombre'] . "' />\n";
                echo 
"\t\t\t\t\t</td>\n";
                echo 
"\t\t\t\t\t<td class='precio'>\n";
                echo 
"\t\t\t" $info['precio'] . "<input type='hidden' name='precio' value='" $info['precio'] . "' />\n";
                
?>
                
        
                <td> <a href="quitar.php?id=<?echo $id?>">Quitar </a></td>
                <?
                
                
echo "\t\t\t\t\t</td>\n";                
                echo 
"\t\t\t\t</tr>\n";                        
}

        echo 
"\t\t\t\t\t<td class='Subtotal'>\n";
        echo 
"\t\t\t\t\t<th>\n";
        echo 
"\t\t\t\t\t\t<span id='Subtotal'>SubTotal&nbsp;<strong>$" $subtotal "</strong></span>\n";
        echo 
"\t\t\t\t\t</th>\n";
        echo 
"\t\t\t\t</tr>\n";
        echo 
"\t\t\t</table>\n\n";

        
//echo "\t\t\t<div class='jcart-hide'>\n";
        //if ($button['update']) { $input_type = 'image'; $src = ' src="' . $button['update'] . '" alt="' . $text['update_button'] . '" title="" ';    }
        //echo "\t\t\t\t<input type='" . $input_type . "' " . $src ."name='jcart_update_cart' value='" . $text['update_button'] . "' class='jcart-button' />\n";
        //if ($button['empty']) { $input_type = 'image'; $src = ' src="' . $button['empty'] . '" alt="' . $text['empty_button'] . '" title="" ';    }
        //echo "\t\t\t\t<input type='" . $input_type . "' " . $src ."name='jcart_empty' value='" . $text['empty_button'] . "' class='jcart-button' />\n";
        //echo "\t\t\t</div>\n";
                
        
echo "\t\t</fieldset>\n";
        echo 
"\t</form>\n";
        echo 
"</div>\n<!-- END JCART -->\n";    
         

}
                
?>
  #2 (permalink)  
Antiguo 02/02/2012, 19:20
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Problema con tienda

¿Existe la posibilidad de que nos digas que mensaje de error recibes?
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 02/02/2012, 22:05
 
Fecha de Ingreso: agosto-2010
Ubicación: mexico
Mensajes: 125
Antigüedad: 13 años, 8 meses
Puntos: 0
Pregunta Respuesta: Problema con tienda

ESte mensjae es uno de los que me manda si solo pongo:
header("location: ../Cart.php");
Código PHP:
The requested URL /dev/Cart.php was not found on this server
si pongo..

header("location: ../tienda/Cart.php");
me dice el explorer que tenog un error de programacion

y si no lo pongo al algregar el item rocoje los datos y la pajina jcart.php se queda en blanco y ya no me regresa a cart.php
  #4 (permalink)  
Antiguo 02/02/2012, 22:24
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Problema con tienda

Si encuentras un mensaje de error no dudes jamás en compartirlo, ahí está la clave para ayudar a resolverlo.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.

Etiquetas: html, mysql, variables, usuarios, tiendas
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 14:21.