I want to get Incremented id or order id from Mage::registry i am doing like this but it does not work.
class My_Module_Block_Order_Totals extends Mage_Sales_Block_Order_Totals {
protected function _initTotals() {
parent::_initTotals();
$order = new Mage_Sales_Model_Order();
$order1 = $this->getOrder();
$order_id = Mage::registry('order_id');
}
}
My Observer.php
public function myFunction(Varien_Event_Observer $observer) {
$mydata=$observer->getEvent()->getOrder();
Mage::register('order_id' , $mydata->getIncrementId());
//Mage::log(Mage::registry('order_id'));
}
If you are on success page then you can easily get the ID like this -
$orderID = $this->getOrderId();
On other pages you can do like as follows but the above code would't work on other pages.
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();