Помогите с модулем opencart

Василич#
На сайте с 10.03.2009
Offline
111
1984

Здравствуйте. Возникла необходимость немного "пошаманить".

Суть вопроса:

Есть прекрасный модуль Категории на главной для Opencart, который выводит все родительские категории на главной странице с картинками.

Проблема в том, что он выводит все родительские категории. Мне в принципе так и нужно, но за исключением одной категории.

Как можно запретить именно данную категорию ?)

Вот сам код вывода модуля:

<?php
class ControllerModulecategoryhome extends Controller {
protected $category_id = 0;
protected $path = array();

protected function index() {
$this->language->load('module/categoryhome');

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

$this->load->model('catalog/category');

$this->load->model('tool/image');

if (isset($this->request->get['path'])) {
$this->path = explode('_', $this->request->get['path']);

$this->category_id = end($this->path);
}
$url = '';
$this->data['categoryhome'] = $this->getCategories($this->config->get('categoryhome_category'));

$this->id = 'categoryhome';

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/categoryhome.tpl')) {
$this->template = $this->config->get('config_template') . '/template/module/categoryhome.tpl';
} else {
$this->template = 'default/template/module/categoryhome.tpl';
}

$this->render();
}

protected function getCategories($parent_id, $current_path = '') {

$categoryhome = array();
$category_id = array_shift($this->path);

$results = $this->model_catalog_category->getCategories($parent_id);

$i=0;
foreach ($results as $result) {
if (!$current_path)
{
$new_path = $result['category_id'];
}
else
{
$new_path = $current_path . '_' . $result['category_id'];
}




if ($this->category_id == $result['category_id']) {
$categoryhome[$i]['href'] = $this->url->link('product/category', 'path=' . $new_path);

} else {
$categoryhome[$i]['href'] = $this->url->link('product/category', 'path=' . $new_path);
}
if ($result['image']) {
$image = $result['image'];
} else {
$image = 'no_image.jpg';
}
$categoryhome[$i]['thumb'] = $this->model_tool_image->resize($image, 110, 110);
$categoryhome[$i]['name'] = $result['name'];

$i++;

}


return $categoryhome;
}
}
?>

Заранее спасибо всем, кто откликнется.

bmw-power.com.ua (https://bmw-power.com.ua)
Милованов Ю.С
На сайте с 24.01.2008
Offline
196
#1

Попробуйте после форыча(42 строка) поставить

if ($result['category_id'] == 'АйДи категории, которую не надо выводить')

continue;

Тока в ПХПмайАдмин или еще гденить подсмотрите айди той категории, которую не надо выводить

P.S интересно, что автор модуля хотел сказать этим

if ($this->category_id == $result['category_id'])

{

$categoryhome[$i]['href'] = $this->url->link('product/category', 'path=' . $new_path);

}

else

{

$categoryhome[$i]['href'] = $this->url->link('product/category', 'path=' . $new_path);

}

Подпись))
Василич#
На сайте с 10.03.2009
Offline
111
#2

Большое спасибо за ответ ! Вроде помогло ;)

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий