Magento – Is it possible to get the QuoteId that was used once an OrderId has been created

dataflowmagento-1.7ordersquote

I'm tracking customer movements through the order process by using their QuoteId
Mage::helper('checkout/cart')->getQuote() – which is created as soon as a customer ads a product to the cart, however once an order is placed (eg on the sucess page) the QuoteId is no longer available (because the cart doesn't exist anymore) and an OrderId becomes available. Is it possible to get the QuoteId that was used to create the OrderId from the OrderId?

Best Answer

For the purpose of my question I was wanting to get the quoteId on the success page, with that in mind the quoteId is stored in the order object and can be accessed via the following

$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
$quoteId = $order['quote_id'];
Related Topic