Есть код, но не как не могу определить переменную $child_visible
<?php if($child_visible){ ?>
<?php if ($category['children']) { ?>
<ul class="list-unstyled">
<?php foreach (array_slice($category['children'], 0, $count_child) as $child) { ?>
<li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
<?php } ?>
<li><a style="color: red;" href="<?php echo $category['href']; ?>"><?php echo "-> смотреть все категории <-"; ?></a></li>
</ul>
<?php } ?>
<?php } ?>
сам PHP
<?php
class ControllerModuleCategoryWall extends Controller {
public function index($setting) {
$check=array();
$check = $setting['category_wall_cat'];
$this->load->language('module/category_wall');
$data['heading_title'] = $this->language->get('heading_title');
if (isset($this->request->get['path'])) {
$parts = explode('_', (string) $this->request->get['path']);
} else {
$parts = array();
}
if (isset($parts[0])) {
$data['category_id'] = $parts[0];
} else {
$data['category_id'] = 0;
}
if (isset($parts[1])) {
$data['child_id'] = $parts[1];
} else {
$data['child_id'] = 0;
}
$this->load->model('catalog/category');
$this->load->model('catalog/product');
$data['categories'] = array();
$categories = $this->model_catalog_category->getCategories(0);
$this->load->model('tool/image');
foreach ($categories as $category) {
$children_data = array();
$children = $this->model_catalog_category->getCategories($category['category_id']);
foreach ($children as $child) {
$filter_data = array(
'filter_category_id' => $child['category_id'],
'filter_sub_category' => true
);
if (isset($check) && (in_array($category['category_id'], $check ))) {
$children_data[] = array(
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}
}
if ($category['image']) {
$image = $this->model_tool_image->resize($category['image'], $setting['width'], $setting['height']);
} else {
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
}
$filter_data = array(
'filter_category_id' => $category['category_id'],
'filter_sub_category' => true
);
if (isset($check) && (in_array($category['category_id'], $check ))) {
$data['categories'][] = array(
'name' => $category['name']. ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'children' => $children_data,
'image' => $image,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
);
}
}
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/category_wall.tpl')) {
return $this->load->view($this->config->get('config_template') . '/template/module/category_wall.tpl', $data);
} else {
return $this->load->view('default/template/module/category_wall.tpl', $data);
}
}
}