我需要在主页上随机显示推荐信
$collection = Mage::getModel('turnkeye_testimonial/testimonial')->getCollection();
foreach($collection as $testimonial)
{
/My Div
}
我该怎么办?
答案 0 :(得分:1)
$collection=Mage::getModel('turnkeye_testimonial/testimonial')->getCollection();
$collection->getSelect()->order('rand()');
$collection->setPage(1, $numProducts);
foreach($collection as $testimonial)
{
/My Div
}