I have created the one custom Module in Opencart.
The details of that:
Controller: file named block.php in admin/controller/custom/block.php
View : file named block.tpl in admin/view/template/custom/block.tpl
Model : file named block.php in admin/model/custom/block.php
I have successfully configured permissions.
When I load this model in Controller means, I got the following error..
Fatal error: Call to a member function load() on a non-object in F:\xampp\htdocs\shirtrecipe\admin\controller\custom\block.php on line 11
Controller Code:
<?php
class ControllerCustomBlock extends Controller
{
public function index() {
$this->language->load('custom/block');
$this->model->load('custom/block'); /* doesnt load this model */
$this->data['breadcrumbs'] = array();
...
...
Model Code:
<?php
class ModelCustomBlock extends Model
{
public function get_demo_block() {
$sql = "select demo_block_img from oc_block where id=1";
$query = $this->db->query($sql);
return $query->row;
}
}
Change :
$this->model->load('custom/block');
To:
$this->load->model('custom/block');
Have a nice day !!