Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Style Filter List
 
mister
Member
 
Total Posts:  42
Joined:  2008-08-31
 

I am working on styling my filter list.  I have almost everything I need, but one aspect.

Under /template/catalog/navigation/left.phtml I am able to loop through each of the categories to display various information about those categories in unordered lists.  This works great because I can then style them the way I need to with CSS.  Here is my code for left.phtml.

<?php if (!Mage::registry('current_category')) return ?>
<?php $_categories 
$this->getCurrentChildCategories() ?>
<?php 
if($_categories->count()): ?>

  
<h1><?php echo $this->__('Shop By'?></h1>
  <
h2><?php echo $this->__('Category'?></h2>
  
  <
ul>
    
<?php foreach ($_categories as $_category): ?>
    <?php 
if($_category->getIsActive()): ?>
    
      
<li>
        <
a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?php echo $this->htmlEscape($_category->getName()) ?></a>
        <
div class="qty"><b>(<?php echo $_category->getProductCount() ?>)</b></div>
      </
li>
    
    
<?php endif; ?>
    <?php 
endforeach; ?>
  
</ul>

<?php endif; ?>

The problem is with /template/catalog/layer/view.phtml.  I want it to look very similar to the code above but am unable to.  See below for code.

<?php if($this->canShowBlock()): ?>
<h1>Shop by</h1>

<?php echo $this->getStateHtml() ?>

<?php 
if($this->canShowOptions()): ?>
  <?php $_filters 
$this->getFilters() ?>
  <?php 
foreach ($_filters as $_filter): ?>
    <?php 
if($_filter->getItemsCount()): ?>
      
<h2><?php echo $this->__($_filter->getName()) ?></h2>
      
<?php echo $_filter->getHtml() ?>
    <?php 
endif; ?>
  <?php 
endforeach; ?>
<?php 
endif; ?>
<?php 
endif; ?>

I can put the filter name in the H2 tag, but below that, I only have $_filter->getHtml().  Is there any way to loop through each of the filter options and display the various attributes in a list item like I can do in left.phtml like above?

Any help is greatly appreciated!  Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
mister
Member
 
Total Posts:  42
Joined:  2008-08-31
 

Does anyone have any suggestions for this?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top