/** * Stop the splash page attribute from dsplaying in the filter options * * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Attribute_Collection $collection * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Attribute_Collection */ protected function _prepareAttributeCollection($collection) { parent::_prepareAttributeCollection($collection); if ($splash = $this->getSplashPage()) { $collection->addFieldToFilter('attribute_code', array('neq' => $splash->getAttributeCode())); } return $collection; }
protected function _prepareAttributeCollection($collection) { $collection = parent::_prepareAttributeCollection($collection); $collection->addIsFilterableFilter(); $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; }
/** * Stop the splash page attribute from dsplaying in the filter options * * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Attribute_Collection $collection * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Attribute_Collection */ protected function _prepareAttributeCollection($collection) { parent::_prepareAttributeCollection($collection); if (($page = $this->getPage()) !== false) { $optionFilters = $page->getOptionFilters(); if ($optionFilters && is_array($optionFilters)) { foreach ($optionFilters as $attributeCode => $filter) { if (isset($filter['include_in_layered_nav']) && (int) $filter['include_in_layered_nav'] === 1) { unset($optionFilters[$attributeCode]); } } $attributeCodes = array_keys($optionFilters); if (count($attributeCodes) > 0) { $collection->addFieldToFilter('attribute_code', array('nin' => array_keys($optionFilters))); } } } return $collection; }
/** * Add advanced data to collection * * @param $collection * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Attribute_Collection */ protected function _prepareAttributeCollection($collection) { $dataTable = 'ecommerceteam_sln_data'; $collection = parent::_prepareAttributeCollection($collection); $collection->addIsFilterableFilter(); $collection->getSelect()->joinLeft(array($dataTable => Mage::getSingleton('core/resource')->getTableName('ecommerceteam_sln_attribute_data')), "`main_table`.`attribute_id` = `{$dataTable}`.`attribute_id`", array('frontend_type' => 'frontend_type', 'navigation_group' => 'group_id', 'comment' => 'comment', 'options_limit' => 'options_limit')); return $collection; }