Subversion Repositories SmartDukaan

Rev

Rev 15697 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15697 Rev 15767
Line 1... Line 1...
1
<?php
1
<?php
-
 
2
ini_set('display_errors', '0');     # don't show any errors...
-
 
3
error_reporting(E_ALL ^ E_STRICT);  # ...but do log them
-
 
4
 
2
class ClickInfoShell extends AppShell {
5
class ClickInfoShell extends AppShell {
3
	public $uses = array('MasterData','Click');
6
	public $uses = array('MasterData','Click');
4
	var $map = array();
7
	var $map = array();
5
 
8
 
6
	public function main() {
9
	public function main() {
Line 17... Line 20...
17
		}
20
		}
18
		$this->updateclicks($map);
21
		$this->updateclicks($map);
19
	}
22
	}
20
 
23
 
21
	public function updateclicks($map) {
24
	public function updateclicks($map) {
22
		$limit = 1000;
25
		$limit = 500;
23
		$params = array(
26
		$params = array(
24
			'fields' => array('id','store_product_id'),
27
			'fields' => array('id','store_product_id'),
25
			'conditions' => array('extras NOT LIKE' => 'notification','brand'=>null),
28
			'conditions' => array('extras NOT LIKE' => '%notification%','brand'=>null,'store_product_id !='=>0),
26
			'order' => array('id' => 'desc'),
29
			'order' => array('id' => 'desc'),
27
			'limit' => $limit,
30
			'limit' => $limit,
28
		);
31
		);
29
		$clicks = $this->Click->find('all', $params);
32
		$clicks = $this->Click->find('all', $params);
-
 
33
		//$this->out(print_r($clicks,1));
30
		if(!empty($clicks)) {
34
		if(!empty($clicks)) {
31
			foreach ($clicks as $key => $value) {
35
			foreach ($clicks as $key => $value) {
32
				$sql = "UPDATE clicks SET brand = '".$map[$value['Click']['store_product_id']]['brand']."' , product_name = '".$map[$value['Click']['store_product_id']]['name']."' WHERE id = ".$value['Click']['id'];
36
				$sql = "UPDATE clicks SET brand = '".$map[$value['Click']['store_product_id']]['brand']."' , product_name = '".addslashes($map[$value['Click']['store_product_id']]['name'])."' WHERE id = ".$value['Click']['id'];
33
				// $this->out($sql);
37
				//$this->out(print_r($sql,1));
34
				$this->Click->query($sql);
38
				$this->Click->query($sql);
35
			}
39
			}
36
		}			
40
		}			
37
	}
41
	}
38
}
42
}