1

When someone registers on a Magento Enterprise site (v 1.13), where is that information stored? It could be under "Newsletter Subscribers" or "Customers", but that list wouldn't necessarily include everyone, correct? I'm trying to create a list of people that have registered but have never made a purchase.

2 Answers 2

0

I've got a free module available that includes a similar report

The difference is it only lists the people who subscribed to the newsletter and never purchased.

I guess you can use it as a starting point.

To retrieve such collection I'm using the following code:

    // Get the customer emails
    $orderEmailsCollection = Mage::getModel('sales/order')->getCollection()->addAttributeToSelect('customer_email');

    // Call iterator walk method with collection query string and callback method as parameters
    // Has to be used to handle massive collection instead of foreach
    Mage::getSingleton('core/resource_iterator')->walk($orderEmailsCollection->getSelect(), array(array($this, 'fillArray')));

    $collection = Mage::getModel('newsletter/subscriber')->getCollection()
        ->addFieldToSelect(array('subscriber_id','subscriber_email','subscriber_status'))
        ->addFieldToFilter('subscriber_email',array('nin'=>$this->filterOrdersEmails));

Note that the fillArray callback method is simply a method to fill a protected array with the customer emails:

$this->filterOrdersEmails[] = $args['row']['customer_email'];
2
  • Thanks for the response! Will your module will work on Enterprise 1.13? Do you know if all people that use the registration form get added as a customer?
    – Realto619
    May 31, 2016 at 21:05
  • @Realto619 never tried to be honest. Give it a try and contact me if you face issues, I'll be willing to fix any issues on this version ;) May 31, 2016 at 21:06
0

If this is a one off process, it might be easiest to simply use a SQL query like this:

SELECT
    user.entity_id, user.email
FROM customer_entity AS user
LEFT JOIN sales_flat_order AS ord
    ON ord.customer_id = user.entity_id
WHERE ord.entity_id IS NULL
GROUP BY user.entity_id;

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.