Hi, i am working through Christian Daries PHP and Mysql Ecommerce chapter 4 and am receiving a Fatal Error.
Fatal error: Class 'Catalog' not found in C:\xampp\htdocs\myshop\presentation\departments_list.php on line 23
Can anyone please help me with this error?
Many thanks in advance.
Here is the code from the files associated and i have attached my file structure also.
index:
<?php
// include utility files
require_once 'include/config.php';
// load the application page template
require_once PRESENTATION_DIR . 'application.php';
// load Smarty template file
$application = new Application();
// display the page
$application->display('store_front.tpl');
//load database handler script
require_once BUSINESS_DIR . 'database_handler.php';
//load business teir
require_once BUSINESS_DIR . 'catalog.php';
?>
department_list.php:
<?php
// Manages the departments list
class DepartmentsList
{
/* Public variables available in departments_list.tpl Smarty template */
public $mSelectedDepartment = 0;
public $mDepartments;
// Constructor reads query string parameter
public function __construct()
{
/* If DepartmentId exists in the query string, we're visiting a
department */
if (isset ($_GET['DepartmentId']))
$this->mSelectedDepartment = (int)$_GET['DepartmentId'];
}
/* Calls business tier method to read departments list and create
their links */
public function init()
{
// Get the list of departments from the business tier
$this->mDepartments = Catalog::GetDepartments();
// Create the department links
for ($i = 0; $i < count($this->mDepartments); $i++)
$this->mDepartments[$i]['link_to_department'] =
Link::ToDepartment($this->mDepartments[$i]['department_id']);
}
}
?>
Catalog:
<?php
// Business tier class for reading product catalog information
class Catalog
{
// Retrieves all departments
public static function GetDepartments()
{
// Build SQL query
$sql = 'CALL catalog_get_departments_list()';
// Execute the query and return the results
return DatabaseHandler::GetAll($sql);
}
}
?>