I would like to get the last order Number saved in the database of the store and increment it to get what the current order number would be before it is saved as I would like to pass the order number in my API as a reference when posting.
I currently try to get the order number this way
$quote = Mage::getModel('checkout/session')->getQuote(); $quoteData= $quote->getData(); $orders = Mage::getSingleton('checkout/session')->getLastRealOrderId(); Mage::log($orders,true); $test = substr($orders,0,7); $test2 = substr($orders,7); $number = $test2++;
But the minute I clear the cache or restart my pc and attempt to create a new order there is no order number - I am currently testing on my local machine and using the Magento demo store to build my module.
How would I get the order number stored in the database?