I am trying to get the last order id for an order so that I can create an invoice and shipment automatically but I can't seems to load the correct orderId to perform the action...
Here is how I am trying to load the orderId Observer.php
$order = Mage::getModel('sales/order')->load($orderid);
$orderIncrementId = $order->getIncrementId();
If the orderId is not present throw exception
$order = Mage::getModel('sales/order')
->loadByIncrementId($orderIncrementId);
if (!$order->getId()) {
Mage::throwException("Order does not exist, for the Shipment process to complete");
}
The problem is if I pass in a static orderId no exception is thrown
$orderIncrementId = '1100000023-4';
But when I try to load it through the Model I can't
Can anyone show me how to get the orderId for an order please?
sales_order_invoice_register
for the Observer