Magento: is the checkout a registration

When a order is placed through the one page checkout, it saves the order information in sales_flat_order and sales_flat_quote tables.From the sales_flat_quote, there is a column called checkout_method which will tell you if the checkout method is a register. Programmatically, we can:

  1. Get the last order id from the checkout session
  2. Create the last order object
  3. Create the last order quote object
  4. Get the checkout method
  5. Check if it is a registration
public function isNewRegistration()
{
	// Get the last order
    $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
    $lastOrder = Mage::getModel('sales/order')->load($lastOrderId);

    // Get the last order quote and its checkout method
    $quote = Mage::getModel('sales/quote')->load($lastOrder->getQuoteId());
    $checkoutMethod = $quote->getCheckoutMethod(true);
    
    if ($checkoutMethod === Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER)
    {
        return true;
    }
    else
    { 
        return false;
	}
}

Search within Codexpedia

Custom Search

Search the entire web

Custom Search