I have added one filter in Method _getProductCollection()
of the class Mage_Catalog_Block_Product_List
as follows.
protected function _getProductCollection()
{
...
$this->_productCollection = $layer->getProductCollection();
$this->_productCollection->getSelect()->joinInner(
array('cpe' => 'catalog_product_entity'),
'e.entity_id = cpe.entity_id'
)
->where("cpe.type_id = 'simple'");
...
}
The above code is working fine as of Magento Version 1.7. But whenever I write the following code, it gives
Column not found: 1054 Unknown column 'e.type_id' in 'where clause'
error.
The code (which is not working).
protected function _getProductCollection()
{
...
$this->_productCollection = $layer->getProductCollection();
$this->_productCollection
->addAttributeToSelect('type_id')
->addAttributeToFilter('type_id','simple');
...
}
Now the Questions.
- Will there be any performance impact if I use the first working code?
- is there any other way to get around to having a proper product filter?
UPDATE:
Whenever I apply the following code and use rwd
theme, I am not getting any error. But whenever I use the default
theme, I get the below error,
Code
protected function _getProductCollection()
{
...
$this->_productCollection = $layer->getProductCollection();
$this->_productCollection
->addAttributeToSelect('type_id')
->addAttributeToFilter('type_id','simple');
...
}
Error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.type_id' in 'where clause', query was: SELECT FLOOR((ROUND((e.min_price) * 1, 2)) / 10) + 1 AS
range
, COUNT(*) AScount
FROMcatalog_product_index_price
ASe
INNER JOINcatalog_category_product_index
AScat_index
ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '3' WHERE (e
.type_id
IN('simple')) AND ( e.website_id = '1' ) AND ( e.customer_group_id = 0) AND (e.min_price IS NOT NULL) GROUP BY FLOOR((ROUND((e.min_price) * 1, 2)) / 10) + 1 ORDER BY FLOOR((ROUND((e.min_price) * 1, 2)) / 10) + 1 ASC