D
D
Dmitry2017-01-10 15:27:09
PHP
Dmitry, 2017-01-10 15:27:09

OpenCart how to add subcategories?

Hello, there was such a question with opencart:
I display on the pages of product categories - categories with the following code:

<?php if ($categories) { ?>
   <?php foreach (array_chunk($categories, ceil(count($categories) / 4)) as $categories) { ?>
   <?php foreach ($categories as $category) { ?>
    <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a> </li>
  <?php } ?>
  <?php } ?>
<?php } ?>

I need to display subcategories below each category, please tell me how to implement

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
web-mechanic, 2017-01-10
@amfetamine

get subsections in controller with getCategories() and display in template with child foreach

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question