2

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?

2 Answers 2

3

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.

1
0

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(); 
} 
1
  • You have a Typo in your code: addFieldToFiter, should be addFieldToFilter
    – Myron
    Commented Apr 20, 2018 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.