0

I need to export email adresses and phone numbers, in all my 65000 orders. Is this possible?

  • Can´t you just export all customers? – Klettseb Feb 11 '16 at 10:04
  • I did but it didnt contain any of the needed information – Chris Gudn Feb 11 '16 at 10:05
  • @Klettseb, yes its possible to do so create new custom export script and export order data through custom script. – Jayesh Patel Feb 11 '16 at 10:29
  • Under System -> import/Export -> Profiles, I can create a customer export with phone numbers as well – Klettseb Feb 11 '16 at 10:46
  • Thanks but, I need to do it from the orders, not everyone with a order is a customer. – Chris Gudn Feb 11 '16 at 11:27
2

Here is the answer guys! Thanks to my tech who did this!

<?php
require_once('app/Mage.php');
Mage::app('default');        
$orders = Mage::getModel('sales/mysql4_order_collection');
$allIds = $orders->getAllIds();   
$mycsv = 'Name,Email,Telephone'."\n";
foreach($allIds as $thisId) {
    $myOrder = Mage::getModel('sales/order')->load($thisId);
    $mycsv .= '"'.$myOrder->getShippingAddress()->getName().'","'.$myOrder->getShippingAddress()->getEmail().'","'.$myOrder->getShippingAddress()->getTelephone().'"'."\n";
}
header('Content-Disposition:attachment;filename=customers.csv');
header('Content-Type:application/force-download');
echo $mycsv;    
exit; 
?>
  • Please flag this as the correct answer. I just tried it :) – Chris Gudn Feb 11 '16 at 13:25

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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