/** * Add filters to attribute collection * * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Collection $collection * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Collection */ protected function _prepareAttributeCollection($collection) { $collection->addIsFilterableInSearchFilter(); $tableAlias = 'gomage_nav_attr'; $collection->getSelect()->joinLeft(array($tableAlias => Mage::getSingleton('core/resource')->getTableName('gomage_navigation_attribute')), "`main_table`.`attribute_id` = `{$tableAlias}`.`attribute_id`", array('filter_type', 'image_align', 'image_width', 'image_height', 'show_minimized', 'show_image_name', 'show_help', 'show_checkbox', 'popup_text', 'popup_width', 'popup_height', 'filter_reset', 'is_ajax', 'inblock_height', 'filter_button')); $connection = Mage::getSingleton('core/resource')->getConnection('read'); $table = Mage::getSingleton('core/resource')->getTableName('gomage_navigation_attribute_option'); foreach ($collection as $attribute) { $option_images = array(); $attribute_id = $attribute->getId(); $_option_images = $connection->fetchAll("SELECT `option_id`, `filename` FROM {$table} WHERE `attribute_id` = {$attribute_id};"); foreach ($_option_images as $imageInfo) { $option_images[$imageInfo['option_id']] = $imageInfo['filename']; } $attribute->setOptionImages($option_images); } return $collection; }
/** * Add filters to attribute collection * * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Collection $collection * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Collection */ protected function _prepareAttributeCollection($collection) { $collection->addIsFilterableInSearchFilter(); return $collection; }