Lelik999
Постоялец
- Регистрация
- 23 Апр 2016
- Сообщения
- 56
- Реакции
- 12
- Автор темы
- #1
Opencart 2.1.0.1, шаблон color, делаю на локальном сервере opensrver
установил iblog, и после этого при заходе в sitemap получаю следующее:
Fatal error: Uncaught Error: Call to a member function getPosts() on null in C:\OpenServer\domains\localhost\system\storage\modification\catalog\controller\information\sitemap.php:91 Stack trace: #0 C:\OpenServer\domains\localhost\system\storage\modification\system\engine\action.php(46 ControllerInformationSitemap->index(Array) #1 C:\OpenServer\domains\localhost\system\engine\front.php(34 Action->execute(Object(Registry)) #2 C:\OpenServer\domains\localhost\system\engine\front.php(29 Front->execute(Object(Action)) #3 C:\OpenServer\domains\localhost\index.php(271 Front->dispatch(Object(Action), Object(Action)) #4 {main} thrown in C:\OpenServer\domains\localhost\system\storage\modification\catalog\controller\information\sitemap.php on line 91
содержимое sitemap.php: (91 строка выделена красным)
<?php
class ControllerInformationSitemap extends Controller {
public function index() {
$this->load->language('information/sitemap');
$this->document->setTitle($this->language->get('heading_title'));
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home')
);
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('information/sitemap')
);
$data['heading_title'] = $this->language->get('heading_title');
$data['text_special'] = $this->language->get('text_special');
$data['text_account'] = $this->language->get('text_account');
$data['text_edit'] = $this->language->get('text_edit');
$data['text_password'] = $this->language->get('text_password');
$data['text_address'] = $this->language->get('text_address');
$data['text_history'] = $this->language->get('text_history');
$data['text_download'] = $this->language->get('text_download');
$data['text_cart'] = $this->language->get('text_cart');
$data['text_checkout'] = $this->language->get('text_checkout');
$data['text_search'] = $this->language->get('text_search');
$data['text_information'] = $this->language->get('text_information');
$data['text_contact'] = $this->language->get('text_contact');
$this->load->model('catalog/category');
$this->load->model('catalog/product');
$data['categories'] = array();
$categories_1 = $this->model_catalog_category->getCategories(0);
foreach ($categories_1 as $category_1) {
$level_2_data = array();
$categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']);
foreach ($categories_2 as $category_2) {
$level_3_data = array();
$categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']);
foreach ($categories_3 as $category_3) {
$level_3_data[] = array(
'name' => $category_3['name'],
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'])
);
}
$level_2_data[] = array(
'name' => $category_2['name'],
'children' => $level_3_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'])
);
}
$data['categories'][] = array(
'name' => $category_1['name'],
'children' => $level_2_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'])
);
}
$data['special'] = $this->url->link('product/special');
$data['account'] = $this->url->link('account/account', '', 'SSL');
$data['edit'] = $this->url->link('account/edit', '', 'SSL');
$data['password'] = $this->url->link('account/password', '', 'SSL');
$data['address'] = $this->url->link('account/address', '', 'SSL');
$data['history'] = $this->url->link('account/order', '', 'SSL');
$data['download'] = $this->url->link('account/download', '', 'SSL');
$data['cart'] = $this->url->link('checkout/cart');
$data['checkout'] = $this->url->link('checkout/checkout', '', 'SSL');
$data['search'] = $this->url->link('product/search');
$data['contact'] = $this->url->link('information/contact');
$this->load->model('catalog/information');
$this->load->model('setting/setting');
$iBlogSetting = $this->model_setting_setting->getSetting('iBlog',$this->config->get('config_store_id'));
$data['iblog'] = $iBlogSetting['iBlog']['LinkTitle'][$this->config->get('config_language_id')];
$iBlog = $this->model_module_iblog->getPosts();
$data['blogs'] = array();
foreach ($iBlog as $post) {
$data['blogs'][] = array(
'title' => $post['title'],
'href' => $this->url->link('module/iblog/post', 'post_id=' . $post['iblog_post_id'])
);
}
$data['informations'] = array();
foreach ($this->model_catalog_information->getInformations() as $result) {
$data['informations'][] = array(
'title' => $result['title'],
'href' => $this->url->link('information/information', 'information_id=' . $result['information_id'])
);
}
$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/information/sitemap.tpl')) {
$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/information/sitemap.tpl', $data));
} else {
$this->response->setOutput($this->load->view('default/template/information/sitemap.tpl', $data));
}
}
}
установил iblog, и после этого при заходе в sitemap получаю следующее:
Fatal error: Uncaught Error: Call to a member function getPosts() on null in C:\OpenServer\domains\localhost\system\storage\modification\catalog\controller\information\sitemap.php:91 Stack trace: #0 C:\OpenServer\domains\localhost\system\storage\modification\system\engine\action.php(46 ControllerInformationSitemap->index(Array) #1 C:\OpenServer\domains\localhost\system\engine\front.php(34 Action->execute(Object(Registry)) #2 C:\OpenServer\domains\localhost\system\engine\front.php(29 Front->execute(Object(Action)) #3 C:\OpenServer\domains\localhost\index.php(271 Front->dispatch(Object(Action), Object(Action)) #4 {main} thrown in C:\OpenServer\domains\localhost\system\storage\modification\catalog\controller\information\sitemap.php on line 91
содержимое sitemap.php: (91 строка выделена красным)
<?php
class ControllerInformationSitemap extends Controller {
public function index() {
$this->load->language('information/sitemap');
$this->document->setTitle($this->language->get('heading_title'));
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home')
);
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('information/sitemap')
);
$data['heading_title'] = $this->language->get('heading_title');
$data['text_special'] = $this->language->get('text_special');
$data['text_account'] = $this->language->get('text_account');
$data['text_edit'] = $this->language->get('text_edit');
$data['text_password'] = $this->language->get('text_password');
$data['text_address'] = $this->language->get('text_address');
$data['text_history'] = $this->language->get('text_history');
$data['text_download'] = $this->language->get('text_download');
$data['text_cart'] = $this->language->get('text_cart');
$data['text_checkout'] = $this->language->get('text_checkout');
$data['text_search'] = $this->language->get('text_search');
$data['text_information'] = $this->language->get('text_information');
$data['text_contact'] = $this->language->get('text_contact');
$this->load->model('catalog/category');
$this->load->model('catalog/product');
$data['categories'] = array();
$categories_1 = $this->model_catalog_category->getCategories(0);
foreach ($categories_1 as $category_1) {
$level_2_data = array();
$categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']);
foreach ($categories_2 as $category_2) {
$level_3_data = array();
$categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']);
foreach ($categories_3 as $category_3) {
$level_3_data[] = array(
'name' => $category_3['name'],
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'])
);
}
$level_2_data[] = array(
'name' => $category_2['name'],
'children' => $level_3_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'])
);
}
$data['categories'][] = array(
'name' => $category_1['name'],
'children' => $level_2_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'])
);
}
$data['special'] = $this->url->link('product/special');
$data['account'] = $this->url->link('account/account', '', 'SSL');
$data['edit'] = $this->url->link('account/edit', '', 'SSL');
$data['password'] = $this->url->link('account/password', '', 'SSL');
$data['address'] = $this->url->link('account/address', '', 'SSL');
$data['history'] = $this->url->link('account/order', '', 'SSL');
$data['download'] = $this->url->link('account/download', '', 'SSL');
$data['cart'] = $this->url->link('checkout/cart');
$data['checkout'] = $this->url->link('checkout/checkout', '', 'SSL');
$data['search'] = $this->url->link('product/search');
$data['contact'] = $this->url->link('information/contact');
$this->load->model('catalog/information');
$this->load->model('setting/setting');
$iBlogSetting = $this->model_setting_setting->getSetting('iBlog',$this->config->get('config_store_id'));
$data['iblog'] = $iBlogSetting['iBlog']['LinkTitle'][$this->config->get('config_language_id')];
$iBlog = $this->model_module_iblog->getPosts();
$data['blogs'] = array();
foreach ($iBlog as $post) {
$data['blogs'][] = array(
'title' => $post['title'],
'href' => $this->url->link('module/iblog/post', 'post_id=' . $post['iblog_post_id'])
);
}
$data['informations'] = array();
foreach ($this->model_catalog_information->getInformations() as $result) {
$data['informations'][] = array(
'title' => $result['title'],
'href' => $this->url->link('information/information', 'information_id=' . $result['information_id'])
);
}
$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/information/sitemap.tpl')) {
$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/information/sitemap.tpl', $data));
} else {
$this->response->setOutput($this->load->view('default/template/information/sitemap.tpl', $data));
}
}
}