public function getFilterValues() { $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $this->getFilterAttribute()); $options = $attribute->getSource()->getAllOptions(true, true); $values = array(); $category_id = Mage::getStoreConfig('grep_bracelet/settings/pendant_category'); foreach ($options as $option) { if (isset($option['value']) && $option['value']) { $value = new Varien_Object(); $value->setName($option['label']); $value->setValue($option['value']); $value->setChecked($this->getChecked($option['value'])); $category = Mage::getModel('catalog/category')->load($category_id); $c = $category->getProductCollection(); $count = $c->addAttributeToFilter($this->getFilterAttribute(), array('finset' => $option['value']))->count(); $value->setCount($count); $values[$option['value']] = $value; } } return $values; }