1. 代码如下:
$storeId = Mage::app()->getStore()->getId(); $catalog = $this->getLayout()->createBlock('catalog/product_list')->setStoreId($storeId); // get all products that are marked as featured $collection = Mage::getModel('catalog/product')->getCollection(); $collection->addAttributeToSelect('featured_product'); $collection->addFieldToFilter(array( array('attribute' => 'featured_product', 'eq' => true), ));