Hello NogDog,
I've searched for json_encode() strings before, following this http://blog.ryanrampersad.com/2010/08/php-json-fatal-error-cannot-use-object-of-type-stdclass-as-array/, and could'n find any.
Here you have some code Before line 186:
$sql = mysql_query("
SELECT
articulos.articuloid,
articulos.articulo_titulo,
articulos.articulo_descuento,
articulos.articulo_precio,
articulos.articulo_precio_oferta,
articulos.articulo_imagen,
articulos.articulo_url,
articulos.articulo_estado,
categorias.categoria_url
FROM
articulos, categorias
WHERE
articulos.articuloid='$id' and
articulos.categoriaid=categorias.categoriaid"
,$this->con);
if (mysql_num_rows($sql))
{
$art = mysql_fetch_assoc($sql);
if ($art['articulo_estado'] == 1)
{
// obtener ultimo indice del array carrito
$i = 0;
if (count($_SESSION['carrito']))
{
foreach($_SESSION['carrito'] as $k => $v)
{
if (is_numeric($k))
{
$i = $k + 1;
}
}
if ($i == 0) $i = 1;
}else
{
$i = count($_SESSION['carrito']);
}
// imagen para mostrar en el carrito
if ($colores_sql_ok['color_imagen'])
{
$imagen = 'colores/'.$colores_sql_ok['color_imagen'];
}else
{
$imagen = $art['articulo_imagen'];
}
if ($art['articulo_precio_oferta'] > 0 and $art['articulo_precio_oferta'] != $art['articulo_precio'])
{
$precio = $art['articulo_precio_oferta'];
}else
{
$precio = $art['articulo_precio'];
}
// finalmente, despues de todo, añadimos el articulo
//line 186:
$_SESSION['carrito'][$i]['id'] = $art['articuloid'];
//After line 186:
$_SESSION['carrito'][$i]['titulo'] = $art['articulo_titulo'];
$_SESSION['carrito'][$i]['dto'] = $art['articulo_descuento'];
$_SESSION['carrito'][$i]['precio'] = $precio;
$_SESSION['carrito'][$i]['imagen'] = $imagen;
$_SESSION['carrito'][$i]['url'] = $art['categoria_url'].'/'.$art['articulo_url'];
$_SESSION['carrito'][$i]['cantidad'] = $cantidad;
$_SESSION['carrito'][$i]['talla']['id'] = $talla['id'];
$_SESSION['carrito'][$i]['talla']['titulo'] = $talla['titulo'];
$_SESSION['carrito'][$i]['color']['id'] = $color['id'];
$_SESSION['carrito'][$i]['color']['titulo'] = $color['titulo'];
if ($_SESSION['user']['dto'] > $art['articulo_descuento'])
{
$art['articulo_descuento'] = $_SESSION['user']['dto'];
$_SESSION['carrito'][$i]['dto'] = $art['articulo_descuento'];
}
// total?
$precio = $this->aplicar_dto($precio,$art['articulo_descuento']);
$total = $precio[1] * $cantidad;
$_SESSION['carrito'][$i]['total'] = $total;
$_SESSION['carrito'][$i]['ahorro'] = $precio[2];
$result = true;
$_SESSION['compra']['exito'] = false;
}else
{
// el articulo no está activo
$this->errors[] = 'Lo sentimos, este artículo no está disponible';
}
}else
{
$this->errors[] = 'Ups! parece que no hemos encontrado el artículo que buscas...';
}
if ($sql) mysql_free_result($sql);
}
return $result;
}
You have the entire file attached.
Thanks,
D. Duarte
The attachments of this post were removed during the platform migration in 2018