Jump to content
Sign in to follow this  
kate1987

модуль XD Category Groups, вывести категории 3 уровня

Recommended Posts

Здравствуйте

На сайте стоит модуль XD Category Groups для вывода категорий с картинками Opencart 1.5.5

Хочу вывести категории 3 уровня, но не получается

добавила в контроллер

	//
					$children_data_level2 = array();
					$children_level2 = $this->model_catalog_category->getCategories($child['category_id']);				
					foreach ($children_level2 as $child_level2) {
							$data_level2 = array(
									'filter_category_id'  => $child_level2['category_id'],
									'filter_sub_category' => true
							);
						
						
						$children_data_level3 = array();
						$children_level3 = $this->model_catalog_category->getCategories($child_level2['category_id']);				
						foreach ($children_level3 as $child_level3) {
							$data_level3 = array(
									'filter_category_id'  => $child_level3['category_id'],
									'filter_sub_category' => true
							);

							$children_data_level3[] = array(
									'category_id' => $child_level3['category_id'],
									'name'  =>  $child_level3['name'],
									'href'  => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'] . '_' . $child_level2['category_id'] . '_' . $child_level3['category_id']),
									'id' => $category['category_id']. '_' . $child['category_id']. '_' . $child_level2['category_id'] . '_' . $child_level3['category_id']
							);
					}
						
						
							$children_data_level2[] = array(
									'category_id' => $child_level2['category_id'],
									'name'  =>  $child_level2['name'],
									'children3'    => $children_data_level3,
									'href'  => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'] . '_' . $child_level2['category_id']),
									'id' => $category['category_id']. '_' . $child['category_id']. '_' . $child_level2['category_id']
							);
					}
					//

после

 foreach($Children as $child){
                    $CategoryChildren[] = array(
                        'category_id' => $child['category_id'],
                        'name'        => $child['name'],
                        'url'         => $this->constructPath($category['category'], $child['category_id'])
                    );

ошибки не пишет но и не выводит ничего. Прошу помощи

	  <?php if ($child['children2']) { ?>
				<ul>
					<?php foreach ($child['children2'] as $child2) { ?>
						<li>
						<?php if ($child2['category_id'] == $child2_id) { ?>
						<a href="<?php echo $child2['href']; ?>" class="active"> - <?php echo $child2['name']; ?></a>
						<?php } else { ?>
						<a href="<?php echo $child2['href']; ?>"> - <?php echo $child2['name']; ?></a>
						<?php } ?>
					
						
						
						</li>
					<?php } ?>
				</ul>
				<?php } ?>

Share this post


Link to post
Share on other sites

ребят, никто не знает?

Share this post


Link to post
Share on other sites

немного не понял что за $child2_id вот здесь

<?php if ($child2['category_id'] == $child2_id) { ?>

откуда оно взялось?

 

при подобных заморочках var_dump помогает

Share this post


Link to post
Share on other sites

немного не понял что за $child2_id вот здесь

<?php if ($child2['category_id'] == $child2_id) { ?>

откуда оно взялось?

 

при подобных заморочках var_dump помогает

<?php if ($child2['category_id'] == $child2_id) { ?> это просто выделение активного пункта, можно опустить оно мне в принципе не нужно

 

Может быть посоветуете модуль которые бы выводил сразу все пункты меню?

Share this post


Link to post
Share on other sites

посмотрите такой, уточните у автора нужные моменты

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.