Asi llamo a la clase del carrito:
Código PHP:
<?php
session_start();
require("global/basketlib.php");
//Asi planeo colocar en las paginas la cantidad de elementos que tiene el carrito.
include("php/mostrarinfocarrito.php");
Código PHP:
<?php
require("comprobarcarrito.php");
?>
<div id = "carrito">
<?php
include("countitems.php");
?>
</div>
Código PHP:
<?php
if (!$_SESSION["basket"]) {
$_SESSION["basket"] = new Basket;
}
?>
Código PHP:
<?php
$num_items = $_SESSION["basket"]->Get_Basket_Count();
echo $num_items . " items";
?>
Código PHP:
function Get_Basket_Count() {
$num=0;
for ($i=0;$i<count($this->basket_items);$i++) {
if ($this->basket_items[$i]!=NULL) $num++;
}
return $num;
}
Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition basket of the object you are trying to operate on was loaded _before_ the session was started in /homez.13/redesmov/www/php/countitems.php on line 2
Espero que puedan ayudarme.