How to get the order id from $observer in magento -


i developing magneto component. need order id observer. using magneto 1.7.0.2. have tried several methods found google. non of them helped me. can order number description, name, price, etc..

the code testing this,

    $order = $observer -> getevent()-> getorder();      $id = $order -> getname(); 

thank much....

this config of observer : placed under globel

<events>    <sales_order_invoice_save_after>              <observers>                  <modulename>                      <class>companyname_modulename_model_observer</class>                      <method>aftersalesordersavecommitafter</method>                  </modulename>              </observers>   </sales_order_invoice_save_after>   </events> 

try

$invoice = $observer->getevent()->getinvoice(); $order = $invoice->getorder(); $id = $order -> getid();

this work. worked me. passing invoice event , checking order. :)


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -