_getProductCollection() previously to return 6 random products to display on the home page. This code was working fine.
$this->setCategoryId(40); $category = new Mage_Catalog_Model_Category(); $category->load($this->getCategoryId()); $collection = $category->getProductCollection(); $collection->getSelect()->order('rand()'); $collection->getSelect()->limit(6); $collection->addStoreFilter(); Mage::getModel('catalog/layer')->prepareProductCollection($collection); $collection->load();
I added a custom product attribute and updated the code to:
$collection = Mage::getModel('catalog/category')->load(4) ->getProductCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('cc_featured', array('eq' => true)); $collection->getSelect()->limit(6); $collection->addStoreFilter();
4 is my root category. However this returns no results. I debugged the SQL and the problem appears to be this condition
I am not sure if I am going about this right and need some guidance. I have tried answers to similar questions, at best it will find 6 products, but it is missing all the product detail (price, image, etc)