Доброй ночи всем.
Возникла проблема:
Был написан свой простенький модуль для вывода текста - привязанного к определенной странице.
Написал админскую и "клиентскую" часть ... захожу в Макеты - пытаюсь добавить к какому-либо макету модуль - он отсутствует в списке. Модуль активирован.
Код контроллера для админки:
<?php
class ControllerModuleSeoBlock extends Controller {
private $error = array();
public function index() {
$this->load->language('module/seo_block');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('extension/module');
$data['heading_title'] = $this->language->get('heading_title');
$data['text_edit'] = $this->language->get('text_edit');
$data['text_enabled'] = $this->language->get('text_enabled');
$data['text_disabled'] = $this->language->get('text_disabled');
$data['button_save'] = $this->language->get('button_save');
$data['button_cancel'] = $this->language->get('button_cancel');
$data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
$this->load->model('module/seo_block');
if($this->request->server['REQUEST_METHOD'] == 'GET' && isset($_GET['action']) && $_GET['action']=='delete_custom_text' && isset($_GET['rec_id']))
{
$this->model_module_seo_block->deleteCustomText((int)$_GET['rec_id']);
$this->response->redirect($this->url->link('module/seo_block', 'token=' . $this->session->data['token'], 'SSL'));
} else if (($this->request->server['REQUEST_METHOD'] == 'POST') && isset($_GET['action']) && $_GET['action']=='add_custom_text' ) {
$x = explode("__", $this->request->post['custom_category']);
if(sizeof($x) == 2 && trim($x[0]) != "") {
$data = array(
'title' =>$this->request->post['custom_text_title'],
'text' =>$this->request->post['custom_text_content'],
'cat_id'=>$x[1],
'module'=>$x[0]
);
$this->model_module_seo_block->addCustomText($data);
}
$this->response->redirect($this->url->link('module/seo_block', 'token=' . $this->session->data['token'], 'SSL'));
} else if (($this->request->server['REQUEST_METHOD'] == 'POST') && isset($_GET['action']) && $_GET['action']=='edit_custom_text' && isset($_GET['rec_id']) ) {
$x = explode("__", $this->request->post['custom_category']);
if(sizeof($x) == 2 && trim($x[0]) != "") {
$data = array(
'id' => (int)$_GET['rec_id'],
'title' =>$this->request->post['custom_text_title'],
'text' =>$this->request->post['custom_text_content'],
'cat_id'=>$x[1],
'module'=>$x[0]
);
$this->model_module_seo_block->editCustomText($data);
}
$this->response->redirect($this->url->link('module/seo_block', 'token=' . $this->session->data['token'], 'SSL'));
}
$this->load->model('catalog/category');
$this->load->model('catalog/product');
$categories_1 = $this->model_catalog_category->getCategories(0);
foreach ($categories_1 as $category_1) {
$data['categories'][] = array(
'name' => $category_1['name'],
'id' => $category_1['category_id'],
'module' => 'product/category'
);
$products = $this->model_catalog_product->getProductsByCategoryId($category_1['category_id']);
if(sizeof($products) > 0)
foreach ($products as $product) {
$data['categories'][] = array(
'name' => $category_1['name']." > ".$product['name'],
'id' => $product['product_id'],
//'cat_id' => $category_1['category_id'],
'module' => 'product/product'
);
}
}
$this->load->model('catalog/information');
foreach ($this->model_catalog_information->getInformations() as $result) {
$data['categories'][] = array(
'name' => $result['title'],
'id' => $result['information_id'],
'module' => 'information/information'
);
}
$arr = $this->model_module_seo_block->GetCustomTextItems();
$data['custom_texts'] = $arr;
$data['action'] = $this->url->link('module/seo_block', 'token=' . $this->session->data['token'], 'SSL');
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
);
$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_module'),
'href' => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL')
);
if (!isset($this->request->get['module_id'])) {
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('module/seo_block', 'token=' . $this->session->data['token'], 'SSL')
);
} else {
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('module/seo_block', 'token=' . $this->session->data['token'] . '&module_id=' . $this->request->get['module_id'], 'SSL')
);
}
$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
$this->response->setOutput($this->load->view('module/seo_block.tpl', $data));
}
protected function validate() {
if (!$this->user->hasPermission('modify', 'module/seo_block')) {
$this->error['warning'] = $this->language->get('error_permission');
}
return !$this->error;
}
}
Подскажите - что я не сделал, почему модуль не виден в макетах?
Тему https://opencartforum.com/topic/50410-%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%BE-%D0%BA%D0%B0%D0%BA-%D0%B4%D0%BE%D0%B1%D0%B0%D0%B2%D0%B8%D1%82%D1%8C-%D1%81%D0%B2%D0%BE%D0%B9-%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D1%8C-%D0%B2-layout/
уже видел стандартные модули просмотрел - не понял в чем загвоздка.
OpenCart 2.0.3.1
Заранее спасибо!