|
Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/mesinpolesshinemate.com/application/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Payment extends Customer_Controller {
function __construct() {
parent::__construct();
$this->load->model('order_m');
$this->load->model('order_detail_m');
$this->load->model('product_m');
$this->load->model('configuration_m');
$this->load->library('cart');
}
public function process_payment() {
if (!isset($_POST['process_payment'])) {
redirect('summary');
}
//manual bank transfer
if ($this->session->userdata('chosen_payment_type') == 'bank_transfer') {
$payment_type = 'bank transfer';
$this->insert_new_order($payment_type);
//----SEND EMAIL TO CUSTOMER
//get customer name
$customer_id = (int) $this->session->userdata('customer')['customer_id'];
$this->db->select('name')->from('customers')->where('id_customers', $customer_id);
$data['customer_name'] = $this->db->get()->row()->name;
//get website data
$this->db->select('logo, from_email, website_name, email_smtp_host, email_smtp_port, email_smtp_password, email_smtp')->from('configuration')->where('id_configuration', 1);
$website_data = $this->db->get()->row();
$data['logo'] = $website_data->logo;
$data['website_name'] = $website_data->website_name;
$data['emails'] = $this->configuration_m->get_emails();
$data['bank'] = $this->configuration_m->get_bank();
$data['title'] = 'Bank Transfer';
//get order detail and customer detail
$data['order'] = $this->order_m->get_order($this->session->userdata('order_id'));
$data['order_details'] = $this->order_detail_m->get_orders_detail($this->session->userdata('order_id'));
//get vouchers detail
if ($this->session->userdata('chosen_voucher_code')) {
$data['chosen_voucher_code'] = $this->session->userdata('chosen_voucher_code');
$data['chosen_voucher_type'] = $this->session->userdata('chosen_voucher_type');
$data['chosen_voucher_discount'] = $this->session->userdata('chosen_voucher_discount');
$data['redeemed_voucher_amount'] = $this->session->userdata('redeemed_voucher_amount');
}
//get shipping fee total
$data['carrier_name'] = $this->session->userdata('carrier_name');
$data['total_shipping_fee'] = $this->session->userdata('total_shipping_fee');
//add tax to email, if exist..
if($this->session->userdata('tax')) {
$data['tax'] = $this->session->userdata('tax');
}
//add point reward to email, if exist..
if($this->session->userdata('chosen_point')) {
$data['chosen_point'] = $this->session->userdata('chosen_point');
$data['chosen_point_discount'] = $this->session->userdata('chosen_point_discount');
}
$this->load->library('email');
//get email setting
$config['protocol'] = 'smtp';
$config['smtp_host'] = $website_data->email_smtp_host;
$config['smtp_port'] = $website_data->email_smtp_port;
$config['smtp_user'] = $website_data->email_smtp;
$config['smtp_pass'] = $website_data->email_smtp_password;
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes to comply with RFC 822 standard
$this->email->initialize($config);
$this->email->from($data['emails']->from_email, $data['emails']->website_name);
$this->email->to($this->session->userdata('customer')['customer_email']);
$this->email->cc($data['emails']->from_email);
$this->email->subject('Order Confirmation');
$email = $this->load->view('email/bank_transfer', $data, TRUE);
$this->email->message($email);
$this->email->send();
//----end send email
//LOAD PAYMENT RETURN PAGE
$data['bank'] = $this->configuration_m->get_bank();
$data['email'] = $this->session->userdata('customer')['customer_email'];
$data['order'] = $this->order_m->get_order($this->session->userdata('order_id'));
//get SEO
$this->db->select('website_name, meta_keywords')->from('configuration')->where('id_configuration', 1);
$website_name = $this->db->get()->row();
$this->data_header['browser_title'] = ucwords($website_name->website_name) . ' - Payment';
$this->data_header['meta_description'] = ucwords($website_name->website_name) . ' - Payment';
$this->data_header['meta_keywords'] = $website_name->meta_keywords;
$this->load->view('template/header', $this->data_header);
$this->load->view('banktransfer', $data);
$this->load->view('template/footer', $this->data_footer);
$this->destroy_session_data();
}
//cod
if ($this->session->userdata('chosen_payment_type') == 'cod') {
$payment_type = 'cod';
$this->insert_new_order($payment_type);
//----SEND EMAIL TO CUSTOMER
//get customer name
$customer_id = (int) $this->session->userdata('customer')['customer_id'];
$this->db->select('name')->from('customers')->where('id_customers', $customer_id);
$data['customer_name'] = $this->db->get()->row()->name;
//get website data
$this->db->select('logo, from_email, website_name, email_smtp_host, email_smtp_port, email_smtp_password, email_smtp')->from('configuration')->where('id_configuration', 1);
$website_data = $this->db->get()->row();
$data['logo'] = $website_data->logo;
$data['website_name'] = $website_data->website_name;
$data['emails'] = $this->configuration_m->get_emails();
$data['bank'] = $this->configuration_m->get_bank();
$data['title'] = 'COD';
//get order detail and customer detail
$data['order'] = $this->order_m->get_order($this->session->userdata('order_id'));
$data['order_details'] = $this->order_detail_m->get_orders_detail($this->session->userdata('order_id'));
//get vouchers detail
if ($this->session->userdata('chosen_voucher_code')) {
$data['chosen_voucher_code'] = $this->session->userdata('chosen_voucher_code');
$data['chosen_voucher_type'] = $this->session->userdata('chosen_voucher_type');
$data['chosen_voucher_discount'] = $this->session->userdata('chosen_voucher_discount');
$data['redeemed_voucher_amount'] = $this->session->userdata('redeemed_voucher_amount');
}
//get shipping fee total
$data['carrier_name'] = $this->session->userdata('carrier_name');
$data['total_shipping_fee'] = $this->session->userdata('total_shipping_fee');
//add tax to email, if exist..
if($this->session->userdata('tax')) {
$data['tax'] = $this->session->userdata('tax');
}
//add point reward to email, if exist..
if($this->session->userdata('chosen_point')) {
$data['chosen_point'] = $this->session->userdata('chosen_point');
$data['chosen_point_discount'] = $this->session->userdata('chosen_point_discount');
}
$this->load->library('email');
//get email setting
$config['protocol'] = 'smtp';
$config['smtp_host'] = $website_data->email_smtp_host;
$config['smtp_port'] = $website_data->email_smtp_port;
$config['smtp_user'] = $website_data->email_smtp;
$config['smtp_pass'] = $website_data->email_smtp_password;
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes to comply with RFC 822 standard
$this->email->initialize($config);
$this->email->from($data['emails']->from_email, $data['emails']->website_name);
$this->email->to($this->session->userdata('customer')['customer_email']);
$this->email->cc($data['emails']->from_email);
$this->email->subject('Order Confirmation');
$email = $this->load->view('email/cod', $data, TRUE);
$this->email->message($email);
$this->email->send();
//----end send email
//LOAD PAYMENT RETURN PAGE
$data['email'] = $this->session->userdata('customer')['customer_email'];
$data['order'] = $this->order_m->get_order($this->session->userdata('order_id'));
//get SEO
$this->db->select('website_name, meta_keywords')->from('configuration')->where('id_configuration', 1);
$website_name = $this->db->get()->row();
$this->data_header['browser_title'] = ucwords($website_name->website_name) . ' - COD Payment';
$this->data_header['meta_description'] = ucwords($website_name->website_name) . ' - COD Payment';
$this->data_header['meta_keywords'] = $website_name->meta_keywords;
$this->load->view('template/header', $this->data_header);
$this->load->view('cod', $data);
$this->load->view('template/footer', $this->data_footer);
$this->destroy_session_data();
}
//MITRANS CREDIT CARD & VIRTUAL ACCOUNT BANK TRANSFER
if ($this->session->userdata('chosen_payment_type') == 'veritrans' || $this->session->userdata('chosen_payment_type') == 'virtualaccount') {
$payment_type = $this->session->userdata('chosen_payment_type');
$this->insert_new_order($payment_type);
//----SEND EMAIL TO CUSTOMER
//get customer name
$customer_id = (int) $this->session->userdata('customer')['customer_id'];
$this->db->select('name')->from('customers')->where('id_customers', $customer_id);
$data['customer_name'] = $this->db->get()->row()->name;
//get website data
$this->db->select('logo, from_email, website_name, email_smtp_host, email_smtp_port, email_smtp_password, email_smtp')->from('configuration')->where('id_configuration', 1);
$website_data = $this->db->get()->row();
$data['logo'] = $website_data->logo;
$data['website_name'] = $website_data->website_name;
$data['emails'] = $this->configuration_m->get_emails();
$data['bank'] = $this->configuration_m->get_bank();
$data['title'] = 'Midtrans Payment';
//get order detail and customer detail
$data['order'] = $this->order_m->get_order($this->session->userdata('order_id'));
$data['order_details'] = $this->order_detail_m->get_orders_detail($this->session->userdata('order_id'));
//get vouchers detail
if ($this->session->userdata('chosen_voucher_code')) {
$data['chosen_voucher_code'] = $this->session->userdata('chosen_voucher_code');
$data['chosen_voucher_type'] = $this->session->userdata('chosen_voucher_type');
$data['chosen_voucher_discount'] = $this->session->userdata('chosen_voucher_discount');
$data['redeemed_voucher_amount'] = $this->session->userdata('redeemed_voucher_amount');
}
//get shipping fee total
$data['carrier_name'] = $this->session->userdata('carrier_name');
$data['total_shipping_fee'] = $this->session->userdata('total_shipping_fee');
//add tax to email, if exist..
if($this->session->userdata('tax')) {
$data['tax'] = $this->session->userdata('tax');
}
//add point reward to email, if exist..
if($this->session->userdata('chosen_point')) {
$data['chosen_point'] = $this->session->userdata('chosen_point');
$data['chosen_point_discount'] = $this->session->userdata('chosen_point_discount');
}
//add credit card fee costing, if exist..
if($this->session->userdata('veritrans_total_fee')) {
$data['creditcard_fee'] = $this->session->userdata('veritrans_total_fee');
}
//add virtual account fee costing, if exist..
if($this->session->userdata('virtualaccount_total_fee')) {
$data['virtualaccount_fee'] = $this->session->userdata('virtualaccount_total_fee');
}
$this->load->library('email');
//get email setting
$config['protocol'] = 'smtp';
$config['smtp_host'] = $website_data->email_smtp_host;
$config['smtp_port'] = $website_data->email_smtp_port;
$config['smtp_user'] = $website_data->email_smtp;
$config['smtp_pass'] = $website_data->email_smtp_password;
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes to comply with RFC 822 standard
$this->email->initialize($config);
$this->email->from($data['emails']->from_email, $data['emails']->website_name);
$this->email->to($this->session->userdata('customer')['customer_email']);
$this->email->cc($data['emails']->from_email);
$this->email->subject('Order Confirmation');
if($payment_type == 'veritrans') {
$email = $this->load->view('email/creditcard', $data, TRUE);
} elseif($payment_type == 'virtualaccount') {
$email = $this->load->view('email/virtualaccount', $data, TRUE);
}
$this->email->message($email);
$this->email->send();
//----end send email
//VERITRANS IN ACTION
require_once APPPATH . 'third_party/Veritrans.php';
//get key
$this->db->select('veritrans_server_key, veritrans_client_key, veritrans_production_mode')->from('configuration')->where('id_configuration', 1);
$veritrans = $this->db->get()->row();
$production_mode = $veritrans->veritrans_production_mode;
//Set Your server key
Veritrans_Config::$serverKey = $veritrans->veritrans_server_key;
if ($production_mode == 'true') {
Veritrans_Config::$isProduction = true;
} else {
Veritrans_Config::$isProduction = false;
}
// Enable sanitization
Veritrans_Config::$isSanitized = true;
// Enable 3D-Secure
Veritrans_Config::$is3ds = true;
$transaction_details = array(
'order_id' => (int) $this->session->userdata('order_id'),
'gross_amount' => (int) $this->session->userdata('grand_total')
);
// Populate items
// define a two-dimensional array
$cart = $this->cart->contents();
foreach($cart as $cart_item) {
$items[] = array(
'id' => $cart_item['id'],
'price' => $cart_item['price'],
'quantity' => $cart_item['qty'],
'name' => strip_tags(substr($cart_item['name'], 0, 48)) . '..',
);
}
//add voucher fee into the item
if ($this->session->userdata('chosen_voucher_code')) {
if ($this->session->userdata('chosen_voucher_type') == 'amount') {
//by amount
//deduct voucher into item, so gross == total items
$items[] = array(
'id' => 'voucher',
'price' => -$this->session->userdata('chosen_voucher_discount'),
'quantity' => 1,
'name' => 'Voucher: ' . $this->session->userdata('chosen_voucher_code'),
);
} else {
//by percentage
//deduct voucher into item, so gross == total items
$items[] = array(
'id' => 'voucher',
'price' =>
-($this->session->userdata('chosen_voucher_discount') * $this->session->userdata('product_grand_total') / 100),
'quantity' => 1,
'name' => 'Voucher: ' . $this->session->userdata('chosen_voucher_code'),
);
}
}
//add point rewards redeem discount
if($this->session->userdata('chosen_point')) {
$items[] = array(
'id' => 'pointrewards',
'price' => -$this->session->userdata('chosen_point_discount'),
'quantity' => 1,
'name' => 'Point Rewards',
);
}
//add shipping fee into the item, so gross == total items
$items[] = array(
'id' => 'shipping',
'price' => $this->session->userdata('total_shipping_fee'),
'quantity' => 1,
'name' => 'Shipping ' . $this->session->userdata('carrier_name'),
);
//add creditcard total fee (transaction fee + admin fee)
if ($this->session->userdata('chosen_payment_type') == 'veritrans') {
$items[] = array(
'id' => 'veritrans_fee',
'price' => (int) $this->session->userdata('veritrans_total_fee'),
'quantity' => 1,
'name' => 'Credit Card Admin',
);
}
//add virtualaccount total fee (admin fee)
if ($this->session->userdata('chosen_payment_type') == 'virtualaccount') {
$items[] = array(
'id' => 'virtualaccount_fee',
'price' => (int) $this->session->userdata('virtualaccount_total_fee'),
'quantity' => 1,
'name' => 'Virtual Account Admin',
);
}
//add tax
if($this->session->userdata('tax')) {
$items[] = array(
'id' => 'tax',
'price' => (int) $this->session->userdata('tax'),
'quantity' => 1,
'name' => 'Tax',
);
}
//get customer district / city name
$this->db->select('name, email, address, shipping_name, subdistrict, district, province, postcode, phone, shipping_name, shipping_address, shipping_district, shipping_subdistrict, shipping_province, shipping_postcode, shipping_phone')->from('customers')->where('id_customers', (int) $this->session->userdata('customer')['customer_id']);
$customer_data = $this->db->get()->row();
// Populate customer's billing address
$billing_address = array(
'first_name' => $customer_data->name,
'last_name' => '',
'address' => $customer_data->address,
'city' => $customer_data->subdistrict . '. ' . $customer_data->district . '. ' . $customer_data->province,
'postal_code' => $customer_data->postcode,
'phone' => $customer_data->phone,
'country_code' => 'IDN'
);
// Populate customer's shipping address
$shipping_address = array(
'first_name' => $customer_data->shipping_name,
'last_name' => '',
'address' => $customer_data->shipping_address,
'city' => $customer_data->shipping_subdistrict . '. ' . $customer_data->shipping_district . '. ' . $customer_data->shipping_province,
'postal_code' => $customer_data->shipping_postcode,
'phone' => $customer_data->shipping_phone,
'country_code' => 'IDN'
);
// Populate customer's Info
$customer_details = array(
'first_name' => $customer_data->name,
'last_name' => '',
'email' => $customer_data->email,
'phone' => $customer_data->phone,
'billing_address' => $billing_address,
'shipping_address'=> $shipping_address
);
// Optional, remove this to display all available payment methods
//$enable_payments = array('credit_card','cimb_clicks','mandiri_clickpay','echannel');
//$enable_payments = array('credit_card','bank_transfer');
// Fill transaction details
$transaction = array(
/* 'enabled_payments' => $enable_payments, */
'transaction_details' => $transaction_details,
'customer_details' => $customer_details,
'item_details' => $items,
);
$data['snapToken'] = Veritrans_Snap::getSnapToken($transaction);
$data['client_key'] = $veritrans->veritrans_client_key;
//LOAD PAYMENT RETURN PAGE
$data['bank'] = $this->configuration_m->get_bank();
$data['email'] = $this->session->userdata('customer')['customer_email'];
$data['order'] = $this->order_m->get_order($this->session->userdata('order_id'));
//get SEO
$this->db->select('website_name, meta_keywords')->from('configuration')->where('id_configuration', 1);
$website_name = $this->db->get()->row();
$this->data_header['browser_title'] = ucwords($website_name->website_name) . ' - Veritrans Payment';
$this->data_header['meta_description'] = ucwords($website_name->website_name) . ' - Veritans Payment';
$this->data_header['meta_keywords'] = $website_name->meta_keywords;
$this->load->view('template/header', $this->data_header);
$this->load->view('veritrans', $data);
$this->load->view('template/footer', $this->data_footer);
$this->destroy_session_data();
}
}
private function insert_new_order($payment_type) {
if($payment_type == 'veritrans') {
$payment_type = 'creditcard';
}
//insert new order to orders table
$data = array(
'customer_id' => (int) $this->session->userdata('customer')['customer_id'],
'total_amount' => (int) $this->session->userdata('grand_total'),
'payment_type' => $payment_type,
'recipient_name' => $this->session->userdata('recipient_name'),
'address' => $this->session->userdata('address'),
'country' => $this->session->userdata('country'),
'postcode' => $this->session->userdata('postcode'),
'phone' => $this->session->userdata('phone'),
'order_date' => date('Y-m-d H:i:s'),
'shipping_type' => $this->session->userdata('carrier_name'),
'shipping_fee' => $this->session->userdata('total_shipping_fee'),
'customer_note' => $this->security->xss_clean($this->input->post('customer_note'))
);
//add dropship status
if($this->session->userdata('choose_dropship_status')) {
$data['dropship'] = $this->session->userdata('choose_dropship_status');
}
//add voucher
if ($this->session->userdata('chosen_voucher_code')) {
$data['redeemed_voucher_code'] = $this->session->userdata('chosen_voucher_code');
$data['redeemed_voucher_amount'] = $this->session->userdata('redeemed_voucher_amount');
}
//add tax
if($this->session->userdata('tax')) {
$data['ppn'] = $this->session->userdata('tax');
}
//add point rewards
if($this->session->userdata('add_point_reward')) {
$data['plus_reward'] = $this->session->userdata('add_point_reward');
}
//minus point rewards
if($this->session->userdata('minus_point_reward')) {
$data['minus_reward'] = $this->session->userdata('minus_point_reward');
$data['minus_reward_amount'] = $this->session->userdata('chosen_point_discount');
}
//get district & province
$this->db->select('province, district, subdistrict')->from('customers')->where('id_customers', (int) $this->session->userdata('customer')['customer_id']);
$region = $this->db->get()->row();
$data['district'] = $region->district;
$data['subdistrict'] = $region->subdistrict;
$data['province'] = $region->province;
//insert to orders table
$data['order_id'] = $this->order_m->save($data, $id = NULL);
//put order_id into session, to use for email or payment return page
$this->session->set_userdata('order_id', $data['order_id']);
if($this->session->userdata('minus_point_reward')) {
//deduct minus_rewards to customer current point rewards..
//get customer current point reward
$this->db->select('current_pointreward')->from('customers')->where('id_customers', (int) $this->session->userdata('customer')['customer_id']);
$current_point_reward = (int) $this->db->get()->row()->current_pointreward;
$new_point_reward = $current_point_reward - (int) $data['minus_reward'];
//add new point back to customers table
$data = array(
'current_pointreward' => $new_point_reward
);
$this->db->where('id_customers', (int) $this->session->userdata('customer')['customer_id']);
$this->db->update('customers', $data);
}
//insert new order details to order details table
$cart_items = $this->cart->contents();
foreach ($cart_items as $cart_item) {
$item_data = array(
'orders_id' => (int) $this->session->userdata('order_id'),
'item_id' => (int) $cart_item['id'],
'item_name' => $cart_item['name'],
'item_price' => (int) $cart_item['price'],
'quantity' => (int) $cart_item['qty'],
'subtotal' => (int) $cart_item['price'] * (int) $cart_item['qty'],
'sku' => $cart_item['options']['sku'],
'attributes' => $cart_item['options']['size']
);
$this->order_detail_m->save($item_data, $id = NULL);
//DEDUCT VOUCHERS FROM VOUCHER TABLE
if ($this->session->userdata('chosen_voucher_code')) {
$this->db->select('qty_ready')->from('vouchers')->where('voucher_code', $this->session->userdata('chosen_voucher_code'));
$qty_ready = $this->db->get()->row()->qty_ready;
if ($qty_ready != NULL) {
$new_qty_ready = $qty_ready - 1;
$data = array(
'qty_ready' => $new_qty_ready,
);
$this->db->where('voucher_code', $this->session->userdata('chosen_voucher_code'));
$this->db->update('vouchers', $data);
}
}
//UPDATE VOUCHER USER TABLE
//get voucher id
if ($this->session->userdata('chosen_voucher_code')) {
$this->db->select('id_vouchers')->from('vouchers')->where('voucher_code', $this->session->userdata('chosen_voucher_code'));
$voucher_id = (int) $this->db->get()->row()->id_vouchers;
//check if this voucher already been used before in voucher user table
$this->db->select('id_voucher_users')->from('voucher_users')->where('voucher_id', $voucher_id)->where('customer_id', (int) $this->session->userdata('customer')['customer_id']);
$count_voucher = $this->db->get()->num_rows();
if ($count_voucher == 0) {
//voucher not exist yet, insert new voucher
$data = array(
'voucher_id' => $voucher_id,
'customer_id' => (int) $this->session->userdata('customer')['customer_id'],
'voucher_used' => 1,
);
$this->db->insert('voucher_users', $data);
} else {
//voucher already exist
//get current used voucher quantity, and add 1
$this->db->select('id_voucher_users, voucher_used')->from('voucher_users')->where('voucher_id', (int) $voucher_id)->where('customer_id', (int) $this->session->userdata('customer')['customer_id']);
$voucher_user = $this->db->get()->row();
$new_voucher_used = $voucher_user->voucher_used + 1;
$data = array(
'voucher_used' => (int) $new_voucher_used,
);
$this->db->where('id_voucher_users', $voucher_user->id_voucher_users);
$this->db->update('voucher_users', $data);
}
}
//DEDUCT CURRENT STOCK WITH PURCHASE QUANTITY
//get current stock froms stocks table
$this->db->select('stock');
$this->db->from('product_details');
$this->db->where('product_id', (int) $cart_item['id']);
$this->db->where('sku', $cart_item['options']['sku']);
$query = $this->db->get();
$stock = $query->row();
$current_stock = (int) $stock->stock;
$new_item_stock = $current_stock - (int) $cart_item['qty'];
$stock_data = array(
'stock' => $new_item_stock,
);
//update the product item stock in database
$this->db->where('product_id', (int) $cart_item['id']);
$this->db->where('sku', $cart_item['options']['sku']);
$this->db->update('product_details', $stock_data);
}
}
private function destroy_session_data() {
//DESTROY CART AND UNSET SOME SESSION, BUT NOT CUSTOMER SESSION
$this->cart->destroy();
$this->session->unset_userdata('grand_total');
$this->session->unset_userdata('recipient_name');
$this->session->unset_userdata('address');
$this->session->unset_userdata('id_district');
$this->session->unset_userdata('id_subdistrict');
$this->session->unset_userdata('id_province');
$this->session->unset_userdata('district');
$this->session->unset_userdata('subdistrict');
$this->session->unset_userdata('province');
$this->session->unset_userdata('country');
$this->session->unset_userdata('postcode');
$this->session->unset_userdata('phone');
$this->session->unset_userdata('order_id');
$this->session->unset_userdata('is_from_cart');
$this->session->unset_userdata('chosen_voucher_type');
$this->session->unset_userdata('chosen_voucher_discount');
$this->session->unset_userdata('chosen_voucher_code');
$this->session->unset_userdata('total_categoryproduct_promo');
$this->session->unset_userdata('redeemed_voucher_amount');
$this->session->unset_userdata('total_shipping_fee');
$this->session->unset_userdata('carrier');
$this->session->unset_userdata('carrier_name');
$this->session->unset_userdata('summary_message');
$this->session->unset_userdata('add_point_reward');
$this->session->unset_userdata('minus_point_reward');
$this->session->unset_userdata('chosen_point');
$this->session->unset_userdata('chosen_point_discount');
$this->session->unset_userdata('chosen_payment_type');
$this->session->unset_userdata('tax');
$this->session->unset_userdata('productpage_to_cart');
$this->session->unset_userdata('choose_dropship_status');
$this->session->unset_userdata('destination_latitude');
$this->session->unset_userdata('destination_longitude');
$this->session->unset_userdata('current_viewed_category_id');
}
}