I’m working in showing some more information in my category view, in the left bar, so I manage to find the file that grabs all the sub categories of the main category and display them in the left bar, the file is the left.phtml. So the problem that I have it’s that I want to display a subcategory, brands, but this one needs to have its own block, like in this picture.
Right now I’m just duplicating the first block of the sub categories, but I need to show a category there with all its sub categories, in the second block of the left. Here’s the code I have
<?php if (!Mage::registry('current_category')) return ?>
<?php $_categories = $this->getCurrentChildCategories(); ?>
<?php print_r($_categories); ?>
<?php $_count = is_array($_categories)?count($_categories):$_categories->count(); ?>
<?php if($_count): ?>
<div class="block block-layered-nav">
<div class="block-title">
<strong><span><?php echo $this->__('Browse By') ?></span></strong>
</div>
<div class="block-content">
<dl id="narrow-by-list2">
<dt><?php echo $this->__('Category') ?></dt>
<dd>
<ol>
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive() && $_category->getProductCount()>0): ?>
<li>
<a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?php echo $this->htmlEscape($_category->getName()) ?></a> (<?php echo $_category->getProductCount() ?>)
</li>
<?php endif; ?>
<?php endforeach ?>
</ol>
</dd>
<dt>Marcas</dt>
<dd>
<ol>
//here it will display the brands of the category
</ol>
</dd>
</dl>
<script type="text/javascript">decorateDataList('narrow-by-list2')</script>
</div>
</div>
<?php endif; ?>
So what I’m trying to obtain it’s the category the user it’s looking when the page displays, so I printed all the array $_categories
, and have identify the [parent_id] => 139
, it’s the one that have the information of the category that the user it’s watching, so I need a way to save this in a variable so I can validate this and display the category I need in the second part of the left Block.
Hope you guys can help me.
Thanks!