D
D
Dmitry2016-04-21 11:54:17
opencart
Dmitry, 2016-04-21 11:54:17

How to make the menu of categories of the second level open?

The categories module on the
left shows the top-level menu,
I need it to be immediately expanded with second-level subcategories, the
code is like this

<div class="list-group">
  <?php foreach ($categories as $category) { ?>
  <?php if ($category['category_id'] == $category_id) { ?>
  <a href="<?php echo $category['href']; ?>" class="list-group-item active"><?php echo $category['name']; ?></a>
  <?php if ($category['children']) { ?>
  <?php foreach ($category['children'] as $child) { ?>
  <?php if ($child['category_id'] == $child_id) { ?>
  <a href="<?php echo $child['href']; ?>" class="list-group-item active">&nbsp;&nbsp;&nbsp;- <?php echo $child['name']; ?></a>
  <?php } else { ?>
  <a href="<?php echo $child['href']; ?>" class="list-group-item">&nbsp;&nbsp;&nbsp;- <?php echo $child['name']; ?></a>
  <?php } ?>
  <?php } ?>
  <?php } ?>
  <?php } else { ?>
  <a href="<?php echo $category['href']; ?>" class="list-group-item"><?php echo $category['name']; ?></a>
  <?php } ?>
  <?php } ?>
</div>

I can't figure out how to make it open right away?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
crazyivan_ru, 2016-04-21
@crazyivan_ru

If you want to do this by editing this code (and not by setting the appropriate styles), then try replacing line 8 with:
, and line 10 to:
If it doesn’t work, try adding the attribute to the added styles !important, if that doesn’t work either, then you have all these changes tracked and leveled by the js script responsible for the menu, you need to watch it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question