plws2018op
-
Публікації
2 -
З нами
-
Відвідування
Тип публікації
Профілі
Форум
Маркетплейс
Статті
FAQ
Наші новини
Магазин
Блоги
module__dplus_manager
Повідомлення, опубліковані користувачем plws2018op
-
-
версия модуля 20170204
версия магазина 2.3.0.2
проблема состоит в том что категории и их child-элементы не отображаются в основное меню сайта, только корректно отображаются parent и child категории магазина.
код моего меню:Спойлер<div class="flex navigation-menu"> <ul class="nav navbar-nav"> <ul class="flex dropdown-navbar flex-column"> <?php foreach ($categories as $category) { ?> <?php if ($category['children']) { ?> <li class="flex flex-column"> <a href="#" class="flex"><?php echo $category['name']; ?></a> <ul class="flex flex-column"> <?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?> <?php foreach ($children as $child) { ?> <li> <a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a> </li> <?php } ?> <?php } ?> </ul> </li> <?php } else { ?> <li class="flex flex-column"> <a href="#" class="flex isActive"><?php echo $category['name']; ?></a> <ul class="flex flex-column"> <li> <a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a> <li> </ul> </li> <?php }?> <?php } ?> </ul> </ul> </div>
пробовал добавить код в контроллер и шаблон header-а следующее
template/common/header.tpl
Спойлер<?php foreach ($blogcategories as $categoryb) { ?> <?php if ($categoryb['children']) { ?> <li class="flex flex-column"> <a href="#" class="flex isActive"><?php echo $categoryb['name']; ?></a> <ul class="flex flex-column"> <?php foreach (array_chunk($categoryb['children'], ceil(count($categoryb['children']) / $categoryb['column'])) as $children) { ?> <?php foreach ($children as $child) { ?> <li> <a href="<?php echo $categoryb['href']; ?>"><?php echo $categoryb['name']; ?></a> <li> <?php } ?> <?php } ?> </ul> </li> <?php } ?> <?php } ?>
controller/common/header.php
Спойлер$this->load->model('newsblog/category'); $this->load->model('newsblog/article'); $data['blogcategories'] = array(); //$categories_b = $this->model_newsblog_category->getCategories($category_id); $blogcategories = $this->model_newsblog_category->getCategories(0); foreach ($blogcategories as $category) { if ($category['top']) { // Level 2 $children_data = array(); $children = $this->model_newsblog_category->getCategories($category['category_id']); foreach ($children as $child) { $filter_data = array( 'filter_category_id' => $child['category_id'], 'filter_sub_category' => true ); $children_data[] = array( 'name' => $child['name'], //'total' => $articles_total, //'original' => $original, //'thumb' => $thumb, 'href' => $this->url->link('newsblog/category', 'newsblog_path=' . $this->request->get['newsblog_path'] . '_' . $category['category_id']) ); } // Level 1 $data['categories'][] = array( 'name' => $category['name'], 'children' => $children_data, 'column' => $category['column'] ? $category['column'] : 1, //'total' => $articles_total, //'original' => $original, //'thumb' => $thumb, 'href' => $this->url->link('newsblog/category', 'newsblog_path=' . $category['category_id']) //'href' => $this->url->link('newsblog/category', 'newsblog_path=' . $this->request->get['newsblog_path'] . '_' . $category['category_id']) ); } }
в чем проблема? что я делаю не так?
заранее благодарен за ответ.
Тема - КАК СОЗДАТЬ СВОЙ ШАБЛОН
в Opencart 2.x: Загальні питання
Опубліковано:
@Gera пусть "view/theme//" -> "view/theme/"