Guest User

Untitled

a guest
Mar 19th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. function gettax($order_id){
  2.  
  3. $order_query = $this->db->query("SELECT * FROM `oc_order_total` WHERE `order_id` = '" . (int)$order_id . "' AND code ='shipping'");
  4. return $order_query->row;
  5. }
  6.  
  7. function getOrderProduct($order_id){
  8.  
  9. $order_product = $this->db->query("SELECT * FROM `oc_order_product` WHERE `order_id` = '" . (int)$order_id . "'");
  10. return $order_product->row;
  11. }
  12.  
  13. $this->load->model('checkout/order');
  14. $data['orderDetails'] = $this->model_checkout_order->getOrder($this->session->data['order_id']);
  15.  
  16. $data['ordertax'] = $this->model_checkout_order->gettax($this->session->data['order_id']);
  17.  
  18. $data['orderProduct'] = $this->model_checkout_order->getOrderProduct($this->session->data['order_id']);
  19.  
  20. <script type="text/javascript">
  21. ga('require', 'ecommerce');
  22. ga('ecommerce:addTransaction', {
  23. 'id': "<?php $orderDetails['order_id'];?>", // Transaction ID. Required. dynamic variable of order id
  24. 'affiliation': "<?php $orderDetails['store_name'];?>", // Affiliation or store name. Kuberan Silks
  25. 'revenue': "<?php $orderDetails['total'];?>", // Grand Total. grand total dynamic variable of the price
  26. 'shipping':"<?php $ordertax['value'];?>" , // Shipping. dynamic variable of shipping
  27. 'tax': "<?php $orderProduct['tax'];?>" // Tax. dynamic tax variable
  28. });
  29.  
  30. ga('ecommerce:addItem', {
  31. 'id': "<?php $orderProduct['order_id'];?>", // Transaction ID. Required.
  32. 'name': "<?php $orderProduct['name'];?>", // Product name. Required.
  33. 'sku': "<?php $orderProduct['model'];?>", // SKU/code.
  34. //'category': 'Party Toys', // Category or variation.
  35. 'price': "<?php $orderProduct['price'];?>", // Unit price.
  36. 'quantity':"<?php $orderProduct['quantity'];?>" // Quantity.
  37. });
  38.  
  39. ga('ecommerce:send');
  40. </script>
Add Comment
Please, Sign In to add comment