I created a custom template for the category view that displays all subcategories for current category. When i set the current category as is_anchor = yes in the admin, the layered navigation filters show up in the side bar. The Sub categories is one of the filters are there as well, but when i click on one them the page still displays all subcategories. I would like to some how test for active filters in my custom template, which i assume there has to be a way to get this info from Magento.
Below is my custom code. $_filters is how i am trying to access these filters, but it gives me nothing. Am i invoking this incorrectly, from the wrong place, in the wrong context?
<?php
$_helper = $this->helper('catalog/output');
$_filters = $this->getActiveFilters();
echo $_filters;
if (!Mage::registry('current_category')) return ?>
<?php $_categories=$this->getCurrentChildCategories() ?>
<?php $_count = is_array($_categories)?count($_categories):$_categories->count(); ?>
<?php if($_count): ?>
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>
<?php
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
$_imgHtml = '';
if ($_imgUrl = $this->getCurrentCategory()->getImageUrl()) {
$_imgHtml = '<img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" class="category-image" />';
$_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
}
echo $_category->getImageUrl();
?>
<div class="category-image-box">
<div class="category-description clearfix" >
<div class="category-description-textbox" >
<h2><span><?php echo $this->htmlEscape($_category->getName()) ?></span></h2>
<p><?php echo $this->getCurrentCategory()->getDescription() ?></p>
</div>
<a href="<?php echo $this->getCategoryUrl($_category) ?>" class="collection-link<?php if ($this->isCategoryActive($_category)): ?> active<?php endif ?>" >See Entire Collection</a>
<a href="<?php echo $this->getCategoryUrl($_category) ?>"><?php if($_imgUrl): ?><?php echo $_imgHtml ?><?php else: ?><img src="/store/skin/frontend/default/patio_theme/images/category-photo.jpg" class="category-image" alt="collection" /><?php endif; ?></a>
</div>
<?php echo '<pre>'.print_r($_category->getData()).'</pre>';?>
</div>
<?php endif; ?>
<?php endforeach ?>
<?php endif; ?>