문제

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.

enter image description here

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 !!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top