Beispiel #1
0
 /**
  *  This method is used to fetch all subsribed users from the default customer table to list
  * them in the SendinBlue PS plugin.
  */
 public function geSubstMobileNumber()
 {
     $customer_data = $this->getAllCustomers();
     $address_mobilephone = array();
     foreach ($customer_data as $customer_detail) {
         $temp = 0;
         if (count($customer_detail) > 0 && !empty($customer_detail['id_customer']) && $customer_detail['newsletter_date_add'] > 0) {
             $id_customer = $customer_detail['id_customer'];
             $customer = new CustomerCore((int) $id_customer);
             $customer_address = $customer->getAddresses((int) $this->context->language->id);
             // Check if user have address data
             if ($customer_address && count($customer_address) > 0) {
                 // Code to get latest phone number of logged in user
                 $count_address = count($customer_address);
                 for ($i = $count_address; $i >= 0; $i--) {
                     foreach ($customer_address as $select_address) {
                         if ($temp < $select_address['date_upd'] && !empty($select_address['phone_mobile'])) {
                             $temp = $select_address['date_upd'];
                             $address_mobilephone[$select_address['id_customer']] = $select_address;
                         }
                     }
                 }
             }
         }
     }
     return $address_mobilephone;
 }