0

カートに商品を入れた順に表示したい。しかし、見積もりアイテム コレクションを設定するコードが見つかりません。

私のカートの phtml ファイルでは、 $allItems = $session->getQuote()->getAllItems(); を使用しています。

すべてのアイテムを取得します。

アイテムを並べ替えるにはどうすればよいですか?

4

1 に答える 1

0

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;
    }
于 2012-10-30T13:44:35.717 に答える