Magento – How to get name and email address of all the customer from beginning of the store

customermagento-1.7orders

I am working on magento1.7.
Every single order has a customer name and email address saved within it.
However I guess, Magento only shows these details in the Customers > Manage Customers section if that person has created an account.

If the customer checked out as a guest then their name and email address are only saved within the order in the database.

so I am unable to find the list of all customer.

Is it possible to have a query that will scan every single order within the back end and get the customer's full name, their email address and order date ?

I want to find all the customer who has made orders (both as a registered user or guest) from the beginning of the store..

Could any one suggest some query ?

Best Answer

You can write the below query for guest customer..

    $orderCollection = Mage::getModel("sales/order")->getCollection()
                      ->addFieldToSelect('*')
                      ->addFieldToFilter('customer_is_guest',1) ;
    foreach( $orderCollection  as $order){

             echo $order->getCustomerFirstname()." ";
             echo $order->getCustomerLastname()."<br>";

    }  

if you put "customer_is_guest" to 0 then you can get the registered customers..

This comes directly from the "sales_flat_order" table .

Hope this helps..