1

Here is the code which displays all the categories and sub categories.

I would like to display only categories and subcategories of root category with id 7.

<?php $store_categories = $this->toLinearArray($this->getStoreCategories()) ?>
<?php if ($count = count($store_categories)): ?>
        <ul id="vertnav">
<?php endif; ?>
<?php foreach ($store_categories as $i => $_category): ?><?php $class = array() ?>
<?php if ($count == 1): ?>
<?php $class[] = 'only' ?>
<?php elseif (! $i): ?>
<?php $class[] = 'first' ?>
<?php elseif ($i == $count-1): ?>
<?php $class[] = 'last' ?>
<?php endif; ?>
<?php if (isset($store_categories[$i+1]) && $this->isCategoryActive($store_categories[$i+1])) $class[] = 'prev'; ?>
<?php if (isset($store_categories[$i-1]) && $this->isCategoryActive($store_categories[$i-1])) $class[] = 'next'; ?>
<?php echo $this->drawOpenCategoryItem($_category, 0, $class) ?>
<?php endforeach ?>
<?php if ($count): ?>
        </ul>
<?php endif; ?>
3

Code looks like it's from https://github.com/riconeitzel/VertNav, so please try to add this to:

app/design/frontend/THEME/PACKAGE/layout/local.xml:

<reference name="catalog.vertnav">
    <action method="setCategoryId"><category_id>7</category_id></action>
</reference>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.