diff --git a/app/Controllers/ApiIntegration.php b/app/Controllers/ApiIntegration.php index da8d6b84..d0993d7e 100644 --- a/app/Controllers/ApiIntegration.php +++ b/app/Controllers/ApiIntegration.php @@ -500,16 +500,18 @@ class ApiIntegration extends ResourceController $countAll = $api_model->countAll('customers', $where); $this->logger->info(($countAll) ? "Api SaveCustomerDetails : in wordpress customer ref ID = ".$wordpress_customer_id." is available on customer table and its PrimaryKey = ".$customer_id : "Api SaveBookDetails : in wordpress Customer ref ID = ".$wordpress_customer_id." Not available on Customer table"); + $billing = $records['billing']; + if(isset($billing) && gettype($billing) === 'object') {$billing = [$billing];} $customer_data['first_name'] = $records['first_name']; $customer_data['last_name'] = $records['last_name']; $customer_data['type'] = $records['role']; $customer_data['email'] = $records['email']; $customer_data['profile_picture'] = $records['avatar_url']; + $customer_data['mobile_no'] = !empty($billing) ? $billing[0]->phone : ''; $customer_data['wp_api_customer_id'] = $wordpress_customer_id; $customer_data['mode'] = $this->global_variable_role; $customer_data['business_id'] = $this->global_variable_business_id; - $billing = $records['billing']; $shipping = $records['shipping']; @@ -537,7 +539,6 @@ class ApiIntegration extends ResourceController $i = 0; $customer_billing_address_data = []; $j = 0; $customer_shipping_address_data = []; - if(isset($billing) && gettype($billing) === 'object') {$billing = [$billing];} if(isset($shipping) && gettype($shipping) === 'object') {$shipping = [$shipping];} $this->logger->info("Api SaveCustomerDetails : billing count : " .count($billing)); $this->logger->info("Api SaveCustomerDetails : shipping count : " .count($shipping));