//NOC get Order-id
$order_id = $this->session->data['order_id'];
//NOC get Order-details
if(isset($order_id))
{
//LOAD MODEL
$this->load->model('checkout/order');
//GET ORDER DETAILS
$order_info = $this->model_checkout_order->getOrder($order_id);
//NEW MODEL TO COLLECT TAX
$get_order_tax = $this->model_checkout_order->getOrderTax($order_id);
if($get_order_tax){
//ASSIGN TAX TO NEW VARIABLE
$order_tax = $get_order_tax['value'];
} else {
//THERE WAS NO TAX COLLECTED
$order_tax = 0;
}
//NEW MODEL TO COLLECT SHIPPING
$get_order_shipping = $this->model_checkout_order->getOrderShipping($order_id);
if($get_order_shipping){
//ASSIGN SHIPPING TO NEW VARIABLE
$order_shipping = $get_order_shipping['value'];
} else {
//THERE WAS NO SHIPPING COLLECTED
$order_shipping = 0;
}
//NEW MODEL TO COLLECT ALL PRODUCTS ASSOCIATED WITH ORDER
$get_order_products = $this->model_checkout_order->getOrderProducts($order_id);
//CREATE ARRAY TO HOLD PRODUCTS
$order_products = array();
foreach($get_order_products as $prod){
$order_products[] = array(
'order_id' => $order_id,
'model' => $prod['model'],
'name' => $prod['name'],
'category' => '',
'price' => number_format($prod['price'], 2, '.', ','),
'quantity' => $prod['quantity']
);
}
//NEW ORDER ARRAY
$order_tracker = array(
'order_id' => $order_id,
'store_name' => $order_info['store_name'],
'total' => $order_info['total'],
'tax' => $order_tax,
'shipping' => $order_shipping,
'city' => $order_info['payment_city'],
'state' => $order_info['payment_zone'],
'country' => $order_info['payment_country'],
'currency' => $order_info['currency_code'],
'products' => $order_products
);
$data['order_tracker'] = $order_tracker;
}