Subversion Repositories SmartDukaan

Rev

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

Rev 14387 Rev 14509
Line 39... Line 39...
39
		if(!isset($page)){
39
		if(!isset($page)){
40
			$page = 1;
40
			$page = 1;
41
		}
41
		}
42
		$dealsperpage = Configure::read('dealsperpage');
42
		$dealsperpage = Configure::read('dealsperpage');
43
		$offset = ($page - 1)*$dealsperpage;
43
		$offset = ($page - 1)*$dealsperpage;
-
 
44
		$this->loadModel('Campaign');
-
 
45
		$campaigns = $this->Campaign->getActiveCampaigns();
44
		if(isset($q) && !empty($q)){
46
		if(isset($q) && !empty($q)){
45
			if (Configure::read('log_solr_queries') === true) {
47
			if (Configure::read('log_solr_queries') === true) {
46
				$this->loadModel('SearchTerm');
48
				$this->loadModel('SearchTerm');
47
				$data = array('user_id' => $this->Auth->User('id'),'search_term' => $q);
49
				$data = array('user_id' => $this->Auth->User('id'),'search_term' => $q);
48
				$this->SearchTerm->create();
50
				$this->SearchTerm->create();
49
				$this->SearchTerm->save($data);					
51
				$this->SearchTerm->save($data);					
50
			}
52
			}
51
			$result = $this->get_solr_result($q,$page);
53
			$result = $this->get_solr_result($q,$page);
52
			$this->set(compact('result','q','page'));
54
			$this->set(compact('result','q','page'));
-
 
55
		}else{
-
 
56
			$this->set(compact('campaigns'));
53
		}
57
		}
54
	}
58
	}
55
 
59
 
56
	public function getsearchresults() {
60
	public function getsearchresults() {
57
		$this->layout = 'ajax';
61
		$this->layout = 'ajax';