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

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

$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";
echo $mycsv;    
  • 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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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