Magento: How to Move Categories to Left Column

I for one dislike the way Magento have their “modern” template with the hideous navigation at the top, so I will show you how to move it to the left hand side.

Advertisements

First of all, you will need to create the file which outputs all of the active categories, which can be done by creating a file called left-nav.phtml in the directory;

app/design/frontend/default/YOURTHEME/template/catalog/navigation/

Inside left-nav.phtml add the following code;

<div class="category-nav">
<div class="block-content">
<p class="block-subtitle"><?php echo $this->__('Categories') ?></p>
<ul id="nav_category" class="nav_category">
<?php foreach ($this->getStoreCategories(true) as $_category): ?>
<?php echo $this->drawItem($_category) ?>
<?php endforeach ?>
</ul>
</div>
</div>

After you have finished the above step you will need to define the code in your layout, to do this open this file;

Search for the block which defines 2columns-left, you should have a line of code that looks like this;

<block type="core/text_list" name="left" as="left" translate="label">

Inside this block add this line of code;

<block type="catalog/navigation" name="category.listing" as="left_nav" before="-" template="catalog/navigation/left_nav.phtml" />

I have added before=”-”, this will output your categories before anything else in ‘left_nav’. Most people will want this when adding a left navigation, however if you don’t just remove it.

The Final step to outputting this is to open

/public_html/app/design/frontend/default/YOURTHEME/template/page/2columns-left.phtml 

and add this line of code;

<?php echo $this->getChildHtml('left_nav') ?>

Note:

After doing anything in XML you will need to clear the cache, so if your navigation is not outputting try clearing your cache.

Tags:

Comments are closed

Latest Comments

No comments to show.