Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you are using J2T's Points and Reward module (1)</p> <p>This snippet will list all emails of referrals that have not signed up as customer yet. I've tested it on a 28000 customer base and it is very fast.</p> <pre><code>/* Retrieve all referrals emails */ $allReferrals = Mage::getModel('rewardpoints/referral')-&gt;getCollection(); foreach($allReferrals as $referral) { $allReferralsEmails[] = $referral-&gt;getRewardpointsReferralEmail(); } /* Retrieve all signed-up customers that are referrals */ $allReferralsCustomers = Mage::getResourceModel('customer/customer_collection')-&gt;addFieldToFilter('email', array('in'=&gt;$allReferralsEmails)); foreach($allReferralsCustomers as $allReferralsCustomer) { $allReferralsCustomerData = $allReferralsCustomer-&gt;getData(); $allReferralsCustomersEmails[] = $allReferralsCustomerData['email']; } /* Extract referrals that are not signed-up customers */ $notSignedUpReferralsEmails = array_diff($allReferralsEmails, $allReferralsCustomersEmails); print_r($notSignedUpReferralsEmails); </code></pre> <p>(1) the rewardpoints_referral table should have this structure : </p> <pre><code>rewardpoints_referral_id int(11) UNSIGNED No auto_increment rewardpoints_referral_parent_id int(11) UNSIGNED No rewardpoints_referral_child_id int(11) UNSIGNED Yes NULL rewardpoints_referral_email varchar(255) utf8_general_ci No rewardpoints_referral_name varchar(255) utf8_general_ci Yes NULL rewardpoints_referral_status tinyint(1) Yes 0 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload