Subversion Repositories SmartDukaan

Rev

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

Rev 20268 Rev 20269
Line 25... Line 25...
25
// 		$this->Auth->allow('bycategory','category','mine','getdeals','getliveprice','search','filter','skus');
25
// 		$this->Auth->allow('bycategory','category','mine','getdeals','getliveprice','search','filter','skus');
26
		$this->Auth->allow('bycategory','category','getdeals','getliveprice');
26
		$this->Auth->allow('bycategory','category','getdeals','getliveprice');
27
		$callback = $this->request->query('callback');	
27
		$callback = $this->request->query('callback');	
28
		$this->livepriceurl = Configure::read('livepriceurl');	
28
		$this->livepriceurl = Configure::read('livepriceurl');	
29
		$this->pythonapihost = Configure::read('pythonapihost');
29
		$this->pythonapihost = Configure::read('pythonapihost');
-
 
30
		$this->solrapihost = Configure::read('solrapihost');
30
	}
31
	}
31
 
32
 
32
	public function filter($type='brand',$categoryId=3){
33
	public function filter($type='brand',$categoryId=3){
33
		$url = $this->apihost.'deals/brands/?category_id='.$categoryId;
34
		$url = $this->apihost.'deals/brands/?category_id='.$categoryId;
34
		$brands = $this->make_request($url,null);
35
		$brands = $this->make_request($url,null);
Line 542... Line 543...
542
		
543
		
543
// 		$res= '[{ "value": "Afghan afghani", "id" : "hello"},{ "value": "Albanian lek","id" : "hello" },{ "value": "Algerian dinar" ,"id" : "hello"}]';
544
// 		$res= '[{ "value": "Afghan afghani", "id" : "hello"},{ "value": "Albanian lek","id" : "hello" },{ "value": "Algerian dinar" ,"id" : "hello"}]';
544
		$this->autoRender = false;
545
		$this->autoRender = false;
545
		$this->request->onlyAllow('ajax');
546
		$this->request->onlyAllow('ajax');
546
		
547
		
547
		$url ="http://shop2020.in:8080/dtr/solr-search!getSuggestions?search_text=".urlencode($ser);
548
		$url =$this->solrapihost."dtr/solr-search!getSuggestions?search_text=".urlencode($ser);
548
		$res = $this->make_request($url, null);
549
		$res = $this->make_request($url, null);
549
		return json_encode($res);
550
		return json_encode($res);
550
		
551
		
551
	}
552
	}
552
	
553
	
Line 558... Line 559...
558
			$page=	(int)($this->request->query('page'));
559
			$page=	(int)($this->request->query('page'));
559
		}else {
560
		}else {
560
			$page=1;
561
			$page=1;
561
		}
562
		}
562
		$offset = ($page-1)*20;
563
		$offset = ($page-1)*20;
563
		$url = $this->pythonapihost."dtr/solr-search!getSearchResults?search_text=".urlencode($q)."&offset=".$offset;
564
		$url = $this->solrapihost."dtr/solr-search!getSearchResults?search_text=".urlencode($q)."&offset=".$offset;
564
		$result = $this->make_request($url, null);
565
		$result = $this->make_request($url, null);
-
 
566
		$nextPage = $page + 1;
565
		$nexturl = "/store_products/nextsearch?page=".$page."&search_text=".urlencode($q);
567
		$nexturl = "/store_products/nextsearch?page=".$nextPage."&search_text=".urlencode($q);
566
		$this->set(compact('result','nexturl','q'));
568
		$this->set(compact('result','nexturl','q'));
567
	}
569
	}
568
	
570
	
569
	public function nextsearch(){
571
	public function nextsearch(){
570
		$this->layout = 'ajax';
572
		$this->layout = 'ajax';