Hi i have this code:
//shop the look product code
$products = Mage::getResourceModel('catalog/product_collection');
// Select which fields to load into the product
// * will load all fields but it is possible to pass an array of
// select fields to load
$products->addCategoryFilter(Mage::getModel('catalog/category')->load($this->getCatId()));
$products->addAttributeToSelect('*');
$products->addAttributeToFilter('type_id', array('eq' => 'configurable'));
// Ensure the product is visible
$products->addAttributeToFilter('visibility', array('neq' => 1));
// Ensure the product is enabled
$products->addAttributeToFilter('status', 1);
$products->addAttributeToFilter('featured_products', 'si');
$products->getSelect()->limit(1);
// Load the collection
$products->load();
it will take all products from the passed catedory id with a filter on featured_products. it works fine but only with simple products, it don’t load configurable products from the category!!
it’s a magento bug i think, there is a solution to retrive configurable products too?
featured_products
as well? On a side note: please don't useaddAttributeToSelect('*')
, it's a performance killer