3

I'm working on a problem at the moment in the layered navigation. I need to change how the filters are working. Currently they are called like so;

 $_filters = $this->getFilters(); foreach ($_filters as $_filter): //various mark up and calls are made here 

Then to output the individual options the following is used.

 $_filter->getHtml() 

I need to find another way of getting this data, preferably unformatted. I am able to get each filters attribute code like so;

 $_filter->getFilterOptions()->getCode() 

But I can't figure out how to use this to get the options belonging to each filter attribute.

The two most important pieces of information that I need are the option name and id. After this I can work everything out.

2 Answers 2

2

The output of $_filter->getHtml() can be found in app/design/frontend/base/default/template/catalog/layer/filter.phtml (filter items).

1

I have an array called $data which contains the filter code. Using this I was able to get what I needed. Here is the code.

 foreach ($data as $key => $value) { $attribute_details = Mage::getSingleton("eav/config")->getAttribute('catalog_product', $key); foreach ($attribute_details->getSource()->getAllOptions(false) as $key2 => $value) { $datam[$key][0] .= '<span class="filter" id="'. $value['value'] . ' ' . $key .'">'.$value['label'].'</span>'; } } 

$Datam is the new array and $key is the filter code.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.