Last active
December 20, 2015 11:09
-
-
Save ceckoslab/6120823 to your computer and use it in GitHub Desktop.
Simple script, that shows / extract all email addresses of customers, who made orders in the Magento shop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @author Tsvetan Stoychev <ceckoslab@gmail.com> | |
| * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | |
| */ | |
| ini_set('max_execution_time', 0); | |
| define('MAGENTO_ROOT', getcwd()); | |
| $mageFilename = MAGENTO_ROOT . '/app/Mage.php'; | |
| require_once $mageFilename; | |
| ini_set('display_errors', 1); | |
| umask(0); | |
| Mage::app(); | |
| $ordersCollection = Mage::getModel('sales/order')->getCollection() | |
| ->addFieldToSelect('customer_email'); | |
| $ordersCollection->getSelect() | |
| ->columns(array('orders_count' => 'COUNT(customer_email)')) | |
| ->group('customer_email'); | |
| echo '<pre>'; | |
| foreach($ordersCollection as $order) { | |
| echo $order->getData('customer_email') . '<br />'; | |
| } | |
| echo '</pre>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment