カートに商品を入れた順に表示したい。しかし、見積もりアイテム コレクションを設定するコードが見つかりません。
私のカートの phtml ファイルでは、 $allItems = $session->getQuote()->getAllItems(); を使用しています。
すべてのアイテムを取得します。
アイテムを並べ替えるにはどうすればよいですか?
カートに商品を入れた順に表示したい。しかし、見積もりアイテム コレクションを設定するコードが見つかりません。
私のカートの phtml ファイルでは、 $allItems = $session->getQuote()->getAllItems(); を使用しています。
すべてのアイテムを取得します。
アイテムを並べ替えるにはどうすればよいですか?
setOrder('updated_at','desc')
コレクションをソートするために、app/code/core/Mage/Sales/Model/Quote.phpファイルのgetItemsCollection関数にソリューションを配置することがわかりました。
public function getItemsCollection($useCache = true)
{
if (is_null($this->_items)) {
$this->_items = Mage::getModel('sales/quote_item')->getCollection()**->setOrder('updated_at','desc');**
$this->_items->setQuote($this);
}
return $this->_items;
}