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
Post a Comment