我通过向Varien_Data_Collection集合对象添加项目来创建集合.
$collection = new Varien_Data_Collection();
foreach($array_of_products as $productId){
$collection->addItem(Mage::getModel('catalog/product')->load($productId));
}
Run Code Online (Sandbox Code Playgroud)
但是,当此对象传递给Magento寻呼机块时,如下所示,它会破坏我的自定义页面中的分页.
$pager = $this->getLayout()->createBlock('page/html_pager', 'retailerfe.analysis.pager')
->setCollection($collection);
Run Code Online (Sandbox Code Playgroud)
PS从Mage :: getModel('module/modelname') - > getCollection()等模型集合中获取的集合从未出现过问题.它只是通过向Varien_Data_Collection对象添加项而创建的集合.