protected function _loadMagentoItems() { $this->_totalCount = $this->_result->getNumFound(); $ids = array(); foreach ($this->_result->getHits() as $prod) { $ids[] = $this->getMagentoParentId($prod); } $collection = Mage::getResourceModel('catalog/product_collection'); $collection->addFieldToFilter('entity_id', array('in' => $ids)); if (count($ids)) { $collection->getSelect()->order(new Zend_Db_Expr('FIELD(e.entity_id, ' . implode(',', $ids) . ')')); } $collection->addAttributeToSelect('*'); $this->_select = $collection->getSelect(); }
protected function _setEnumCounts() { $enumCounts = array(); foreach ($this->_result->getHits() as $productInfo) { foreach ($this->_facetableEnumAttributes as $attribute) { if (isset($productInfo->parent_id) && isset($productInfo->{$attribute})) { $values = $productInfo->{$attribute}; if (!is_array($values)) { $values = array($values); } foreach ($values as $value) { $enumCounts[$attribute][$value][$productInfo->parent_id] = 1; } } } } foreach ($enumCounts as $attributeCode => $values) { foreach ($values as $value => $counts) { $value = strtolower($value); $this->_enumCounts[$attributeCode][$value] = count($counts); } } }