I am using Magento CE 1.9.2.2 what I am trying to do is I have category structure like the below
- Party
- Balloons
- Bags
- Streamers
Now if you click on the category "party" on the left side Magento shows the "browse by" category/sub category list. However if I click on Balloons I want the same browser by block to be displayed so that even when you are on a sub category page you will be able to see the links to the other sub categories in the left side column in a browser by box.
Hope this is clear what I want to achieve because I am not able to get anything to be displayed on the sub categories? So what I have done is in Magento manage categories I went to the "balloons" category and changed Display Mode to static block and products. I then changed the drop down CMS Block and selected the block I made called Sub Category Listing.
Then in my Sub category listing block I added the below in code view {{block type="catalog/navigation" template="catalog/navigation/subcategory_listing.phtml"}}
I then opened ftp and created the subcategory_listing.phtml and added the below code
$layer = Mage::getSingleton('catalog/layer');
$_category = $layer->getCurrentCategory();
$_categories = $_category->getCollection()->addAttributeToSelect(array('url_key','name','image','all_children','is_anchor','description'))
->addAttributeToFilter('is_active', 1)
->addIdFilter($_category->getChildren())
->setOrder('position', 'ASC')
->joinUrlRewrite();
?>
<div class="listing-type-list catalog-listing">
<ul id="subcats" class="clear">
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>
<?php Mage::log($_category->debug(), null, 'mylogfile.log'); ?>
<li>
<div class="subcat clearfix">
<a class="now-from-container" href="<?php echo $_category->getURL() ?>"></a>
<div class="subcat-image">
<a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
<img src="<?php echo $this->htmlEscape($_category->getImageUrl()) ?>" width="190" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />
</a>
</div>
<div class="subcat-title-container">
<h2><a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>"><?php echo $this->htmlEscape($_category->getName()) ?></a></h2>
</div>
</div>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>