Как создать новую страницу в Opencart

я использую Opencart версия 2.0.3.1.

Я должен создать новую страницу в Opencart. Но я не знаю с чего начать. Поэтому я перешел по данной ссылке http://forum.opencart.com/viewtopic.php?t=6253 создать пользовательскую страницу.

Но я получил ошибку

Неустранимая ошибка: невозможно получить доступ к частной собственности Document :: $ title in
C: \ wamp \ www \ opencart \ catalog \ controller \ custom \ service.php в строке 6

Как упоминалось в ссылке, я создал три файла:

каталог / контроллер / пользовательские / service.php

class ControllerCustomService extends Controller {
public function index() {
$this->language->load('custom/service');

$this->document->title          = $this->language->get('heading_title');


$this->document->breadcrumbs = array();

$this->document->breadcrumbs[] = array(
'href'      => $this->url->http('common/home'),
'text'      => $this->language->get('text_home'),
'separator' => FALSE
);

$url = '';

if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}

$this->document->breadcrumbs[] = array(
'href'      => $this->url->http('custom/service' . $url),
'text'      => $this->language->get('heading_title'),
'separator' => $this->language->get('text_separator')
);

$this->data['heading_title']    = $this->language->get('heading_title');
$this->data['heading_text']      = $this->language->get('heading_text');
$this->id                   = 'content';
$this->template             = $this->config->get('config_template') . 'custom/service.tpl';
$this->layout               = 'common/layout';

$this->render();
}
}

Каталог / просмотр / тема / по умолчанию / шаблон / пользовательский / service.tpl

<div class="top">
<h1><?php echo $heading_title; ?></h1>
</div>
<div class="middle">
<div><?php echo $heading_text; ?></div>

</div>
<div class="bottom">&nbsp;</div>

Каталог / язык / заказ / service.php

// Heading
$_['heading_title'] = 'Our Services';

//Content
$_['heading_text'] = 'Welcome to our services';

Также я попробовал исправления, упомянутые в этой ссылке, но не повезло.

Так что кто-то, пожалуйста, помогите мне решить проблемы … Любая помощь действительно заметна ..

2

Решение

Так должно быть $this->document->setTitle($this->language->get('heading_title'));,

А реферальная ссылка предназначена для версии 1.5.x (для более старых версий). Вы должны ссылаться на файлы новой версии, а затем создавать новые файлы, ссылаясь на них.

редактировать

Процедура та же, но вы должны проверить синтаксические изменения. Как в opencart
2.x
и выше версии они изменили много вещей и синтаксиса.

редактировать

Для загрузки общих контроллеров, таких как header,footer etc сделать это (для версии 2.x)

$data['column_left'] = $this->load->controller('common/column_left');
$data['column_right'] = $this->load->controller('common/column_right');
$data['content_top'] = $this->load->controller('common/content_top');
$data['content_bottom'] = $this->load->controller('common/content_bottom');
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');

Чтобы загрузить вид

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/directory/viewfile.tpl')) {
$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/directory/viewfile.tpl', $data));
} else {
$this->response->setOutput($this->load->view('default/template/directory/viewfile.tpl', $data));
}
2

Другие решения

Других решений пока нет …