Customer Invitation in magento

Can we find email-id of them which are invited by specific customer of Magento say “xyz@abc.com”?

I know We can fetch the record for those who have accepted the invitation by table rewardpoints_referral,

My question is here Can we get the records which are not accepted yet and if yes, then by which table?

Thanks!

One thought on “Customer Invitation in magento”

  1. If you are using J2T’s Points and Reward module (1)

    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.

    /* Retrieve all referrals emails */
    $allReferrals = Mage::getModel('rewardpoints/referral')->getCollection();
    foreach($allReferrals as $referral) {
        $allReferralsEmails[] = $referral->getRewardpointsReferralEmail();
    }
    
    /* Retrieve all signed-up customers that are referrals */
    $allReferralsCustomers = Mage::getResourceModel('customer/customer_collection')->addFieldToFilter('email', array('in'=>$allReferralsEmails));
    foreach($allReferralsCustomers as $allReferralsCustomer) {
        $allReferralsCustomerData = $allReferralsCustomer->getData();
        $allReferralsCustomersEmails[] = $allReferralsCustomerData['email'];
    }
    
    /* Extract referrals that are not signed-up customers */
    $notSignedUpReferralsEmails = array_diff($allReferralsEmails, $allReferralsCustomersEmails);
    print_r($notSignedUpReferralsEmails);
    

    (1) the rewardpoints_referral table should have this structure :

    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                               
    

Leave a Reply

Your email address will not be published. Required fields are marked *