I am creating a new module that create, read, update and delete a table in the database. Thus, I am creating a new ObjectModel for this module. Below is what I did, appreciate if someone can point out what I am doing wrong that the Controller not reading the classl: I created a classes folder in the module directory, and place the following 'Measurement.php' file in it:
<?php
class MeasurmentCore extends ObjectModel
{
public $id_customer = null;
public $alias;
public $weight;
public $height;
public $date_add;
public $date_upd;
public $deleted = 0;
public static $definition = array(
'table' => 'measure',
'primary' => 'id_measure',
'fields' => array(
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
'weight' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'height' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false),
),
);
}
Then in the ModuleFrontController 'measurements.php' located in the 'measure/controllers/front/'
<?php
Class MeasureMeasurementsModuleFrontController extends ModuleFrontController
{
protected $_measure;
public function init()
{
parent::init();
include_once(_PS_MODULE_DIR_.'measure/classes/measurement.php');
$this->_measure = new Measurement($id_measure);
}
public function initContent()
{
parent::initContent();
$this->setTemplate('measure.tpl');
}
}
When I load the '/index.php?fc=module&module=measure&controller=measurements' page, I get this error:
Fatal error: Class 'Measurement' not found in C:\wampn\.*.*\modules\measure\Controllers\front\Measurements.php on line 11
Thanks in advance,