我正在寫一個插件,並向magento數據庫中添加了一個自己的數據庫表。Magento Collection - setOrder和getFirstItem
現在我想從表中排序的順序獲取一些數據,我添加了代碼波紋管。
但每次我轉儲最後一行的結果我得到的數據按照他們在表中不按給定的參數排序的順序。誰能幫我這個?
$collection = $this->getCollection();
$collection->setOrder(array('fieldname' => 'asc', 'fieldname' => 'desc'));
$collection->getFirstItem()->getData();
$ collection-> setOrder('fieldname'=>'asc'); – 2014-09-05 11:32:49