I have created a module that hooks into the
sales_order_shipment_save_after
event. I have tested the hook is working with Mage::log, My question is, how do I get the order id for the shipment that was just created?
Edit: I tried the following, but $orderId is returning blank in the log…
public function invoice_and_complete($observer)
{
$event = $observer->getEvent();
$orderId = $event->getOrderIds();
Mage::log($orderId);
}
Best Answer
For
sales_order_shipment_save_after
it looks as if it only passes the shipment to you in thegetEvent
method. From there you should be able to get to the order object - An example:Source:
https://stackoverflow.com/questions/3164800/my-magento-observer-is-getting-in-endless-loop