0

I have an issue similar to this question , and i checked the 'Already answered link' too. But my issue is bit different.

The error is similar in the above link but with my custom attribute :

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.product_store' in 'where clause',. .... ..

Im trying to filter collection by two attributes as shown below :

Mage_Catalog_Block_Product_List

$this->_productCollection = $layer->getProductCollection()
                    ->addAttributeToFilter(array(array('attribute' => 'hidden_countries', 'nlike' => '%'.$current_country.'%')))
                    ->addAttributeToFilter(array(array('attribute' => 'product_store', 'in' => $optionToFilter)))
                    ->setPageSize($limit)
                    ->setCurPage($currPage);

The first filter for : hidden_countries is working fine, and i have the issue with the second attribute.

The issue happens if i switch to flat product table. i checked the catalog_product_flat_x tables & i found the custom attribute ('product_store') and its values already there.

Did a complete re-index . But that doesn't solved the issue.

I can filter the product collection by getModel('catalog/product'):

$products = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToFilter(array(array('attribute' => 'hidden_countries', 'nlike' => '%'.$current_country.'%')))
            ->addFieldToFilter(array(array('attribute' => 'product_store', 'in' => $optionToFilter)))
            ->setCurPage($this->get_cur_page());

AS i can see the variable $layer is an instance of Mage_Catalog_Model_Layer and i can see that the getLayer returns Mage::getSingleton('catalog/layer').

Does any body knows why i can filter on 
Mage::getModel('catalog/product') but not on Mage::getSingleton('catalog/layer') ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.