$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'size');
$id = $attribute->getId();
$_productCollection->getSelect()->joinLeft(array('c_p_e_i'=>'catalog_product_entity_int'),'e.entity_id = c_p_e_i.entity_id and c_p_e_i.attribute_id='.$id,array('c_p_e_i.value'));
$_productCollection->getSelect()->joinLeft(array('attribute_option'=>'eav_attribute_option_value'),'c_p_e_i.value = attribute_option.option_id',array('eaov_val' => 'attribute_option.value'));
$_productCollection->getSelect()->order(new Zend_Db_Expr('eaov_val ASC'));
$_productCollection->getSelect()->group('e.entity_id');
$this->_productCollection = $_productCollection;
$id = $attribute->getId();
$_productCollection->getSelect()->joinLeft(array('c_p_e_i'=>'catalog_product_entity_int'),'e.entity_id = c_p_e_i.entity_id and c_p_e_i.attribute_id='.$id,array('c_p_e_i.value'));
$_productCollection->getSelect()->joinLeft(array('attribute_option'=>'eav_attribute_option_value'),'c_p_e_i.value = attribute_option.option_id',array('eaov_val' => 'attribute_option.value'));
$_productCollection->getSelect()->order(new Zend_Db_Expr('eaov_val ASC'));
$_productCollection->getSelect()->group('e.entity_id');
$this->_productCollection = $_productCollection;
Comments
Post a Comment
Feel Free To Ask...