Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function gettax($order_id){
- $order_query = $this->db->query("SELECT * FROM `oc_order_total` WHERE `order_id` = '" . (int)$order_id . "' AND code ='shipping'");
- return $order_query->row;
- }
- function getOrderProduct($order_id){
- $order_product = $this->db->query("SELECT * FROM `oc_order_product` WHERE `order_id` = '" . (int)$order_id . "'");
- return $order_product->row;
- }
- $this->load->model('checkout/order');
- $data['orderDetails'] = $this->model_checkout_order->getOrder($this->session->data['order_id']);
- $data['ordertax'] = $this->model_checkout_order->gettax($this->session->data['order_id']);
- $data['orderProduct'] = $this->model_checkout_order->getOrderProduct($this->session->data['order_id']);
- <script type="text/javascript">
- ga('require', 'ecommerce');
- ga('ecommerce:addTransaction', {
- 'id': "<?php $orderDetails['order_id'];?>", // Transaction ID. Required. dynamic variable of order id
- 'affiliation': "<?php $orderDetails['store_name'];?>", // Affiliation or store name. Kuberan Silks
- 'revenue': "<?php $orderDetails['total'];?>", // Grand Total. grand total dynamic variable of the price
- 'shipping':"<?php $ordertax['value'];?>" , // Shipping. dynamic variable of shipping
- 'tax': "<?php $orderProduct['tax'];?>" // Tax. dynamic tax variable
- });
- ga('ecommerce:addItem', {
- 'id': "<?php $orderProduct['order_id'];?>", // Transaction ID. Required.
- 'name': "<?php $orderProduct['name'];?>", // Product name. Required.
- 'sku': "<?php $orderProduct['model'];?>", // SKU/code.
- //'category': 'Party Toys', // Category or variation.
- 'price': "<?php $orderProduct['price'];?>", // Unit price.
- 'quantity':"<?php $orderProduct['quantity'];?>" // Quantity.
- });
- ga('ecommerce:send');
- </script>
Add Comment
Please, Sign In to add comment