Magento Sidebar Categories
The following will display a list of categories in your store in your right sidebar.
Layout
Alter page.xml so that the default handle’s right block contains the following:
<block type="catalog/navigation" name="category.listing" template="catalog/navigation/categories.phtml" />
|
My final right block looks as follows
<block type="core/text_list" name="right" as="right"> <block type="catalog/navigation" name="featured" template="catalog/featured_random.phtml" /> <block type="catalog/navigation" name="category.listing" template="catalog/navigation/categories.phtml" /> </block> |
Template
Create the file template/catalog/navigation/categories.phtml and paste in the following
<div class="block block-layered-nav">
<div class="block-title">
<h2>Categories</h2>
</div>
<div class="block-content">
<ul id="nav_category" class="nav_category">
<?php foreach ($this->getStoreCategories(true) as $_category): ?>
<?php echo $this->drawItem($_category) ?>
<?php endforeach ?>
</ul>
</div>
</div>
|