The helper you can use to create, delete, get and update Customer details.
function add_customer($customer) {.....}
Supported hooks
Filter name: before_add_customerDescription: This filter would be executed before add customer into the database in add_customer helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘before_add_customer’, ‘before_add_customer_callback_fun’,10,1);functionbefore_add_customer_callback_fun($customer) {// code}
Filter name: should_add_customerDescription: This filter would be executed before add customer into database in add_customer helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_add_customer’, ‘should_add_customer_callback_fun’,10,1);functionshould_add_customer_callback_fun($customer) {// code}
hook name: pre.add.customer
Description: This hook would be executed before add customer into the database in add_customer helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.add.customer','pre_add_customer_callback_fun',10,1);functionpre_add_customer_callback_fun($customer) {// code}
hook name: post.add.customer
Description: This hook would be executed after add customer into the database in add_customer helper.
Usage:
// The filter callback function is based on the filter.add_action('post.add.customer','post_add_customer_callback_fun',10,1);functionpost_add_customer_callback_fun($customer) {// code}
Usage
// for use customer helper you need to add this helper on controller or// you can autoload this helper.$this->load->helper('includes/customer');// add a new customer in customer table. And add customer's primary card details. $customer_id =add_customer($customer);
Request Parameters
Parameters in array format includes following attributes:
Response
Response includes the following attributes:
if data have been added successfully it would return the key of specific customer id.
return $customer_id;
if data does not add it will return null.
function get_customer($customer_id) {....}
Supported hooks
Filter name: before_get_customer Description: This filter would be executed before retrieving customer details from database in get_customer helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘before_get_customer’, ‘before_get_customer_callback_fun’,10,1);functionbefore_get_customer_callback_fun($customer_id) {// code}
Filter name: should_get_customerDescription: This filter would be executed before retrieving customer details from database in get_customer helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_get_customer’, ‘should_get_customer_callback_fun’,10,1);functionshould_get_customer_callback_fun($customer_id) {// code}
hook name: pre.get.customer
Description: This hook would be executed before retrieving customer details from database in get_customer helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.get.customer','pre_get_customer_callback_fun',10,1);functionpre_get_customer_callback_fun($customer_id) {// code}
hook name: post.get.customer
Description: This hook would be executed after retrieving customer details from database in get_customer helper.
Usage:
// The filter callback function is based on the filter.add_action('post.get.customer','post_get_customer_callback_fun',10,1);functionpost_get_customer_callback_fun($customer_id) {// code}
Usage
// Retrieves customer data based on a customer_id.$customer_data =get_customer($customer_id);
Request Parameters
Response
// Successfully response giving you array of customer data.Array( [customer_id] =>21 [customer_name] => vishal solanki [address] =>162 banganga [city] => indore [region] => [country] => india [postal_code] =>452007 [phone] =>45435656657 [fax] => [email] => [company_id] =>1 [customer_notes] => [is_deleted] =>0 [customer_type] => [cc_number] => [cc_expiry_month] => [cc_expiry_year] => [stripe_customer_id] => [customer_type_id] =>1 [address2] => [phone2] =>36546667667 [cc_tokenex_token] => [cc_cvc_encrypted] => [customer_fields] =>Array ( ))//if there is no customer data for any customer id provided in input or any error will return null.
function get_customers($filter) {.....}
Supported hooks
Filter name: before_get_customersDescription: This filter would be executed before retrieving customer details from database in get_customers helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘before_get_customers’, ‘before_get_customers_callback_fun’,10,1);functionbefore_get_customers_callback_fun($filter) {// code}
Filter name: should_get_customersDescription: This filter would be executed before retrieving customer details from database in get_customers helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_get_customers’, ‘should_get_customers_callback_fun’,10,1);functionshould_get_customers_callback_fun($filter) {// code}
hook name: pre.get.customers
Description: This hook would be executed before retrieving customer details from database in get_customers helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.get.customers','pre_get_customers_callback_fun',10,1);functionpre_get_customers_callback_fun($filter) {// code}
hook name: post.get.customers
Description: This hook would be executed after retrieving customer details from database in get_customers helper.
Usage:
// The filter callback function is based on the filter.add_action('post.get.customers','post_get_customers_callback_fun',10,1);functionpost_get_customers_callback_fun($filter) {// code}
Usage
// Retrieves customer data based on a filter array.$customer_data =get_customers($filter);
Request Parameters
parameter array filter required for payment details.
Response
// $response array includes following attributes:// $response['customer_name'] : the customer_name of specific customer.// $response['address'] : the address for specific customer .// $response['city'] : the is_percentage for specific customer.// $response['region'] : the region for specific customer.// $response['country'] : the country for specific customer.// $response['postal_code'] : the postal_code for specific customer.// $response['phone'] : the phone for specific customer.// $response['fax'] : the fax for specific customer.// $response['email'] : the email for specific customer.// $response['customer_notes'] : the customer_notes for specific customer.// $response['customer_type'] : the customer_type for specific customer.// $response['address2'] : the customer_notes for specific customer.// $response['phone2'] : the customer_notes for specific customer.// $response['is_primary'] : the is_primary for specific customer card details.// $response['card_name'] : the card_name for specific customer card details.// $response['cc_number'] : the cc_number for specific customer card details.// $response['cvc'] : the cvc for specific customer card details.// $response['cc_expiry_month'] : the cc_expiry_month for specific customer card details.// $response['cc_expiry_year'] : the cc_expiry_year for specific customer card details.// and many more attributes for table customer and join with customer card details .// Successfully response giving you array of customer data.Array( [0] =>Array ( [customer_id] =>21 [customer_name] => vishal solanki [address] =>162 banganga [city] => indore [region] => [country] => india [postal_code] =>452007 [phone] =>45435656657 [fax] => [email] => [company_id] =>1 [customer_notes] => [is_deleted] =>0 [customer_type] => [cc_number] => [cc_expiry_month] => [cc_expiry_year] => [stripe_customer_id] => [customer_type_id] =>1 [address2] => [phone2] =>36546667667 [cc_tokenex_token] => [cc_cvc_encrypted] => [id] =>6 [is_primary] =>1 [evc_card_status] => [card_name] => [is_card_deleted] =>0 [customer_meta_data] => ))//If there is no customer data for filter provided in input or any error will return null.
function update_customers($customer, $customer_id) {....}
Usage
//update customer data based on a update data and customer id.update_customer($customer, $customer_id);
Supported hooks
Filter name: before_update_customerDescription: This filter would be executed before updatecustomer into the database in update_customer helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘before_update_customer’, ‘before_update_customer_callback_fun’,10,1);functionbefore_update_customer_callback_fun($customer, $customer_id) {// code}
Filter name: should_update_customerDescription: This filter would be executed before update rate into database in update_rates helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_update_customer’, ‘should_update_customer_callback_fun’,10,1);functionshould_update_customer_callback_fun($customer, $customer_id) {// code}
hook name: pre.update.customer
Description: This hook would be executed before update customer into the database in update_customer helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.update.customer','pre_update_customer_callback_fun',10,1);functionpre_update_customer_callback_fun($customer, $customer_id) {//code}
hook name: post.update.customer
Description: This hook would be executed after update customer into the database in update_customer helper.
Usage:
// The filter callback function is based on the filter.add_action('post.update.customer','post_update_customer_callback_fun',10,1);functionpost_update_customer_callback_fun($customer, $customer_id) {// code}
Request Parameters
Request required customer_id and array format data includes following attributes:
Response
Response return mixed Either true or null if customer data is updated then true else null.
function delete_customer($customer_id) {.....}
Usage
// delete a customer data from the customer table. it's a soft delete process only status will change data still existing in the backend database.
delete_customer($customer_id);
Request Parameters
Response
Response return mixed Either true or null if customer data is deleted then true
else null.