Magento: Get Sales Quote & Order in both Frontend and Admin

Here is a code snippet to get sales quote and order data in both admin and frontend in Magento.

Get Sales Quote in Frontend


Mage::getSingleton('checkout/session')->getQuote();

Get Sales Quote in Admin


$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();

Get Latest Order in Frontend


$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);

Get Latest Order in Admin


$order = Mage::getModel('sales/order')->getCollection()
					 ->setOrder('created_at','DESC')
					 ->setPageSize(1)
					 ->setCurPage(1)
					 ->getFirstItem();	

Hope it helps. Thanks.