Search code examples
magento

Get quote by reserved order id


I want to create a new payment method. On checkout process payment method redirects to 3-rd party service. I pass reservedOrderId to 3-rd party service and it returns this id back on payment success. How can I get quote by reservedOrderId? Or need I convert quote to order before redirecting to 3-rd party service?


Solution

  • Since the reserved order should be unique, you can try this:

    $quote = Mage::getModel('sales/quote')->getCollection()
        ->addFieldToFilter('reserved_order_id', 'Your Order id')
        ->getFirstItem();
    
    if ($quote->getId()) {
       //quote was found - $quote
    }
    else {
       //the quote does not exist.
    }