I am trying to display the categories menu on the rubric page using the code:
<?php var_dump($categories); ?> <?php foreach ($categories as $category): ?> <?php if ($category['children']): ?> <li class="nav-item <?php if ($category['category_id'] == $category_id) echo 'active'; ?>"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="<?= $category['href'] ?>"><?= $category['name'] ?></a> <div class="dropdown-menu"> <?php foreach ($category['children'] as $child): ?> <a class="dropdown-item <?php if ($child['category_id'] == $child_id) echo 'active'; ?>" href="<?= $child['href'] ?>"><?= $child['name'] ?></a> <?php endforeach; ?> </div> </li> <?php else: ?> <li class="nav-item"> <a class="nav-link" href="<?= $category['href'] ?>"> <?= $category['name'] ?></a> </li> <?php endif; ?> <?php endforeach; ?> And I get:
<b>Notice</b>: Undefined variable: categories in <b>/home/m/matrixyc/site.com/public_html/catalog/view/theme/SnowWhite/template/common/column_left.tpl</b> on line <b>4</b>NULL <b>Notice</b>: Undefined variable: categories in <b>/home/m/matrixyc/site.com/public_html/catalog/view/theme/SnowWhite/template/common/column_left.tpl</b> on line <b>5</b><b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/m/matrixyc/site.com/public_html/catalog/view/theme/SnowWhite/template/common/column_left.tpl</b> on line <b>5</b> In the same code, the code executes correctly.
Version ocStore 2.3.0.2.3.