I would like to give my client, who is running a Magento Store, the possibility, in the backend, to export the list of all guest customers who made orders.
Is there a simple way to achieve this?
You need to create a module that adds the customer_is_guest
column to the sales_flat_order_grid
table. Once this is done the value from sales_flat_order
will automatically copy over when orders are created (you'll have to update all the old ones though).
Next you need to add a Customer Is Guest
column to the grid in Sales > Orders. This can be done by extending Mage_Adminhtml_Block_Sales_Order_Grid::_prepareColumns()
and adding
$this->addColumn('customer_is_guest', array(
'header' => Mage::helper('sales')->__('Customer Is Guest'),
'index' => 'customer_is_guest',
'type' => 'options',
'options' => array(
0 => Mage::helper('sales')->__('No'),
1 => Mage::helper('sales')->__('Yes')
),
));
Now you'll be able to filter the grid by guest checkouts. Then simply use the built in Export button at the top of the page to get the results in CSV or XML format.
You should create a module with something like this:
$orderCollection = Mage::getModel("sales/order")->getCollection()->addFieldToFiter('customer_is_guest',1);
foreach($orderCollection as $order){
//info if guest is here, export it anyway you want
$order->getBillingAddress()->getFirstname();
}