Question

Hello I am new in OpenCart and I am studying it now for my next project. And My first step in learning this framework? is to display my own page using a link from my navigation menu in admin area. But I am getting this error.

Notice: Error: Could not load template C:\wamp\www\myshop/admin/view/template/locations/countries_list.tpl! in C:\wamp\www\myshop\system\engine\controller.php on line 90

And I can't spot my error. Here's what I did.

Here's my controller /controller/locations/countries.php

<?php

class ControllerLocationsCountries extends Controller {

        private $error = array();

        public function index() {

            $this->language->load('locations/countries');
            $this->document->setTitle($this->language->get('heading_title'));
            $this->getList();
        }

        protected function getList() {

            $this->data['heading_title'] = $this->language->get('heading_title');

            $this->template = 'locations/countries_list.tpl';
            $this->response->setOutput($this->render());

        }
}

Here's my simple view /view/template/locations/countries_list.php

<h1>Hello</h1>

Then in my header I include this code for displaying a link in menu navigation /controller/common/header.php

$this->data['text_locations'] = $this->language->get('text_locations');
....
$this->data['locations'] = $this->url->link('locations/countries', 'token=' . $this->session->data['token'], 'SSL');

That's all. I don't know what part is wrong. Can you help me with this?

Was it helpful?

Solution

The error is pretty self explanatory. The template file doesn't exist. Make sure the template filename and path is exactly the same and that you're using .tpl as the extension and not .php. It's also possible there could be a permissions error, but on WAMP that's not likely

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top