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

get Option Id in filter.phtml
 
dboldschool
Jr. Member
 
Total Posts:  24
Joined:  2009-10-06
 

I would like to address each listpoint in filternavigation via css for customization. Does anyone know how to extract the optionID in

/template/catalog/layer/filter.phtml

I tried a dirty hack, but this ist really evil and just for a quick testing… maybe, there an easier way grin

<ol>
<?php foreach ($this->getItems() as $_item):

$itemID 0;
$itemClass "";

if(
$_item->getName() == "Gestellfarbe"){
    $itemID 
preg_replace('/.*(color=([0-9]+)).*/i''$2'$this->urlEscape($_item->getUrl()));
}elseif($_item->getName() == "Glasfarbe"){
    $itemID 
preg_replace('/.*(glascolor=([0-9]+)).*/i''$2'$this->urlEscape($_item->getUrl()));
}

if($itemID 0){
    $itemClass 
' class="item-' $itemID '"';
}

?>
    
<li<?php echo $itemClass?>>
        
<?php if ($_item->getCount() > 0): ?>
        
<a title="<?php echo strip_tags($_item->getLabel()) ?>" href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel() ?></a>
        
<?php else: echo $_item->getLabel() ?>
        <?php 
endif; ?>
        
<!--(<?php echo $_item->getCount() ?>)-->
    </
li>
<?php endforeach ?>
</ol>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Aftab Naveed
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-05-12
Sydney Australia
 

After digging into Mage_Catalog_Model_Layer_Filter_Item I found this

<?php echo $_item->getValueString() ?>

That seems to be working fine by me. I am using magento 1.4.0

 
Magento Community Magento Community
Magento Community
Magento Community
 
Aftab Naveed
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2009-05-12
Sydney Australia
 

After digging into Mage_Catalog_Model_Layer_Filter_Item I found this

<?php echo $_item->getValueString() ?>

That seems to be working fine by me. I am using magento 1.4.0

 
Magento Community Magento Community
Magento Community
Magento Community
 
q23media
Member
 
Avatar
Total Posts:  72
Joined:  2009-04-29
 

also works in 1.7.0.2

merci!

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