Show all category on magento sidebar

New Wave New Thinking

To work with Magento sometimes we need to show our categories on magento sidebar or create shop by category option on magento sidebar. Now, you can easily do this following the below step.

First step:

First you need to create a template file named “categorymenu.phtml” and locate it

app/design/frontend/your-instance-name/your-theme-name/template/catalog/navigation/categorymenu.phtml

puting the following code :

__(‘Shop by Category’) ?>

<div class=”block-content”>

<ul id=”left-nav”>

<?php foreach ($this->getStoreCategories() as $_category): ?>

<?php if ($_category->getIsActive()): ?>

<?php $isactive= $this->isCategoryActive($_category); ?>

<?php $hasChildren= $_category->hasChildren(); ?>

<li class=”category <?php if($isactive) echo ‘active’; ?>” lang=”<?php echo $_category->getId();?>”>

<a href=”<?php echo $this->getCategoryUrl($_category)?>” >

<span><?php echo $_category->getName();?> <?php echo “<a class=’full’ href=’javascript:void(0)’>   </a>”; ?></span>

</a>

<?php if($isactive) echo ” <a class=’empty’ href='”.$this->getCategoryUrl($_category).”‘></a>”; ?>

</li>

<?php if($hasChildren): ?>

<li>

<ul class=”subcategory_<?php echo $_category->getId();?> subcategory” style=”display:<?php echo $isactive? ‘block’ : ‘none’…

View original post 183 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s