| 11169 |
lgm |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
if (!defined('BASEPATH'))
|
|
|
4 |
exit('No direct script access allowed');
|
|
|
5 |
|
|
|
6 |
class Tracking {
|
|
|
7 |
|
|
|
8 |
public $CI;
|
|
|
9 |
|
|
|
10 |
public function tracking_info() {
|
|
|
11 |
$this->CI = & get_instance();
|
| 11184 |
lgm |
12 |
$method = $this->CI->router->method;
|
| 11188 |
lgm |
13 |
$notRequired = array('changeCaptcha','getSearchList','getProductList','getSpecialProductList','anonymous','add','delete','update','insure','cartCount','coupon','couponClear','returnProduct','cancelOd','deliveryPb','paymentStat','orderStat','contact','refund','showAddress','modifyAddress','saveAddress','getDeliveryDetails','operator','rechargeAmount','topupSpecial');
|
|
|
14 |
if(!in_array($method, $notRequired)){
|
| 11184 |
lgm |
15 |
$url = $this->CI->config->item('curl_base_url').'tracking';
|
|
|
16 |
$params = array();
|
|
|
17 |
if (isset($_SERVER['HTTP_REFERER'])){
|
|
|
18 |
$params['referer'] = $_SERVER['HTTP_REFERER'];
|
|
|
19 |
}else{
|
|
|
20 |
$params['referer'] = '';
|
|
|
21 |
}
|
|
|
22 |
if(isset($_GET['afid']) && !empty($_GET['afid'])){
|
|
|
23 |
$params['afid'] = $_GET['afid'];
|
|
|
24 |
}else{
|
|
|
25 |
$params['afid'] = '';
|
|
|
26 |
}
|
|
|
27 |
if(isset($_GET['utm_source']) && !empty($_GET['utm_source'])){
|
|
|
28 |
$params['utm_source'] = $_GET['utm_source'];
|
|
|
29 |
}else{
|
|
|
30 |
$params['utm_source'] = '';
|
|
|
31 |
}
|
|
|
32 |
$this->CI->mcurl->add_call('tracking','post',$url,$params);
|
|
|
33 |
$response = $this->CI->mcurl->execute($url);
|
|
|
34 |
$new['response'] = $response['tracking']['response'];
|
| 15783 |
amit.gupta |
35 |
//$response = $this->CI->magento_model->product_list($new);
|
| 15750 |
anikendra |
36 |
// error_log("response from tracking ".print_r($response,1));
|
| 11184 |
lgm |
37 |
if(isset($response[0]->response) && !empty($response[0]->response)){
|
|
|
38 |
foreach ($response[0]->response as $key => $value) {
|
|
|
39 |
if($value->maxAge != -1){
|
|
|
40 |
$expires = time()+$value->maxAge;
|
|
|
41 |
$newdata = (object) array( "name" => $value->name, "value" => $value->value, "expires"=>$expires,"path"=>$value->path,"secure"=>$value->secure);
|
|
|
42 |
$cookieData = (object) array( "data" => $newdata);
|
|
|
43 |
setcookie( "$value->name", json_encode( $cookieData ), $expires , "$value->path",'',$value->secure);
|
|
|
44 |
}else{
|
|
|
45 |
$newdata = (object) array( "name" => $value->name, "value" => $value->value, "expires"=>$value->maxAge,"path"=>$value->path,"secure"=>$value->secure);
|
|
|
46 |
$cookieData = (object) array( "data" => $newdata);
|
|
|
47 |
setcookie( "$value->name", json_encode( $cookieData ), $value->maxAge , "$value->path",'',$value->secure);
|
|
|
48 |
}
|
|
|
49 |
}
|
|
|
50 |
}
|
|
|
51 |
}
|
|
|
52 |
|
| 11169 |
lgm |
53 |
}
|
|
|
54 |
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
?>
|