客户邀请在magento

时间:2011-03-24 04:41:43

标签: magento magento-1.4

我们能否找到Magento特定客户邀请的电子邮件ID“xyz@abc.com”?

我知道我们可以通过表 rewardpoints_referral

获取已接受邀请的人的记录

我的问题在这里我们能否获得尚未被接受的记录,如果是,那么哪个表格?

谢谢!

1 个答案:

答案 0 :(得分:0)

如果您使用的是J2T的积分和奖励模块(1)

此代码段将列出尚未注册为客户的所有推荐电子邮件。 我已经在28000个客户群上进行了测试,速度非常快。

/* 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)rewardpoints_referral表应具有以下结构:

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