/* Fetching the updated cart items */
$items = array();
$cart = Mage::getModel('sales/quote_item')->getCollection()
->setQuote(Mage::getModel('checkout/cart')->getQuote())
->addFieldToSelect('*')
->addOrder('updated_at', 'desc');
foreach ($cart as $item)
{
if (!$item->isDeleted() && !$item->getParentItemId()) {
$items[] = $item;
}
Now you are ready to use $items object.
If you want to use this $items object in cart then
Replace:
foreach($this->getItems() as $_item):
With:
foreach($items as $_item):
And you will get the sorted cart items by last modified date in descending order.
$items = array();
$cart = Mage::getModel('sales/quote_item')->getCollection()
->setQuote(Mage::getModel('checkout/cart')->getQuote())
->addFieldToSelect('*')
->addOrder('updated_at', 'desc');
foreach ($cart as $item)
{
if (!$item->isDeleted() && !$item->getParentItemId()) {
$items[] = $item;
}
Now you are ready to use $items object.
If you want to use this $items object in cart then
Replace:
foreach($this->getItems() as $_item):
With:
foreach($items as $_item):
And you will get the sorted cart items by last modified date in descending order.