0

I have response collection $customerData, i have to add referral code of selected customers in the same array,

model and field of referral code is :

 $referCustomer = Mage::getModel('rewardpointsreferfriends/rewardpointsrefercustomer')->load($TotalCustomerId, 'customer_id'); 

here is part of my code

  $TotalCustomerId = array_unique($customerDi);

                $HighPriCollection = Mage::getModel("customer/customer")->getCollection()
                                                                        ->addAttributeToSelect('*')
                                                                        ->addFieldToFilter('entity_id', array('in' =>$TotalCustomerId))
                                                                        ->setPage($page,$size);





               $referCustomer = Mage::getModel('rewardpointsreferfriends/rewardpointsrefercustomer')->load($TotalCustomerId, 'customer_id');   // model of referral code

                $customerData = array();
                foreach ($HighPriCollection as $campusval)
                { 
                    $customerData[$i] = array('entity_id'=>$campusval->getId(),
                                           'student_name'=>$campusval->getName(),
                                           'coll_grad_year'=>$campusval->getCollGradYear(),
                                           'student_pic'=> $customer->getCustomertabSelfee(),
                                           'college_name'=>$campusval->getCollegeName()   // here i want to add referral code of selected students(customers)
                                           );            
                              $i++;

                    $college_detail = Mage::getModel("manager/campus")->load($campusval->getGriskCollegeNewId());
                    array_push($CollegeNames, $campusval->getGriskCollegeNewId());

                }
                $HighPriCollection = $HighPriCollection->addNameToSelect()
                                                       ->addAttributeToSelect('customertab_studentpic')
                                                       ->addAttributeToSelect('group_id')
                                                       ->setPage($page, $size);
                $data = array_count_values($CollegeNames);
                if($collegeid!=null)
                {
                        $res['status']  = true;
                        $res['message'] = "High Priority Students";
                        $res['hpstu']   =  $customerData ;                   
                }else
                {
                    $collegeData = array();
                    $i = 0;
                    foreach ($data as $key => $value)
                    {
                        $college =Mage::getModel("manager/campus")->load($key);
                        $collegeData[$i]['id'] =$college->getId();
                        $collegeData[$i]['college'] = $college->getName();
                        $collegeData[$i]['hpstudents'] = $value;
                        $i++;
                    }
                }

, i am getting all data from $customerData, need to add referral code in the same customer collection.

  • try to join both collection – Piyush Mar 25 '17 at 5:55
  • join is not working , it is filtering required data. – supriya mishra Mar 25 '17 at 5:57
  • I am not able to understand you want $res['hpstu'] = $customerData ; in form of array so you can use it from your response or you want to setdata in $customerData ? – Priyank Mar 25 '17 at 6:14
  • i want to set in $customerData – supriya mishra Mar 25 '17 at 6:31
  • try to create new field in customer entity then save in that attribute refer magento.stackexchange.com/a/14165/45103 – Gopal Patel Mar 25 '17 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.