| Line 29... |
Line 29... |
| 29 |
$configdata =array();
|
29 |
$configdata =array();
|
| 30 |
$configdata = $this->config->item('searchlist');
|
30 |
$configdata = $this->config->item('searchlist');
|
| 31 |
$cachemodule = array('header','footer');
|
31 |
$cachemodule = array('header','footer');
|
| 32 |
$configdata = getCache($configdata,$cachemodule);
|
32 |
$configdata = getCache($configdata,$cachemodule);
|
| 33 |
$authorized = $this->session->userdata('authorized');
|
33 |
$authorized = $this->session->userdata('authorized');
|
| 34 |
if($authorized['Id'] > 0){
|
34 |
// if($authorized['Id'] > 0){
|
| 35 |
$_SERVER['QUERY_STRING'] .= '&userId='.$authorized['Id'].'&isLoggedIn=true';
|
35 |
// $_SERVER['QUERY_STRING'] .= '&userId='.$authorized['Id'].'&isLoggedIn=true';
|
| 36 |
}
|
36 |
// }
|
| 37 |
if(isset($authorized['isPrivateDealUser']) && !empty($authorized['isPrivateDealUser'])) {
|
37 |
// if(isset($authorized['isPrivateDealUser']) && !empty($authorized['isPrivateDealUser'])) {
|
| 38 |
$_SERVER['QUERY_STRING'] .= '&privateDealUser=true';
|
38 |
// $_SERVER['QUERY_STRING'] .= '&privateDealUser=true';
|
| 39 |
}
|
39 |
// }
|
| 40 |
//end of get cache
|
40 |
//end of get cache
|
| 41 |
if(array_key_exists('fq', $_GET) || array_key_exists('sortedBy', $_GET) || array_key_exists('minPrice', $_GET)){
|
41 |
if(array_key_exists('fq', $_GET) || array_key_exists('sortedBy', $_GET) || array_key_exists('minPrice', $_GET)){
|
| 42 |
$data['response']=$this->search_model->getProducts($this->input->get(),$this->input->post(),$configdata['module'],$_SERVER['QUERY_STRING']);
|
42 |
$data['response']=$this->search_model->getProducts($this->input->get(),$this->input->post(),$configdata['module'],$_SERVER['QUERY_STRING']);
|
| 43 |
}else{
|
43 |
}else{
|
| 44 |
$searchName = 'seacrh'.$this->input->get('q');
|
44 |
$searchName = 'search'.$this->input->get('q');
|
| 45 |
//Anikendra: default search page should display all products
|
45 |
//Anikendra: default search page should display all products
|
| 46 |
if($this->input->get('q')==''){
|
46 |
if($this->input->get('q')==''){
|
| 47 |
redirect(base_url().'search/?q=*');
|
47 |
redirect(base_url().'search/?q=*');
|
| 48 |
}
|
48 |
}
|
| 49 |
if(!isset($authorized['isPrivateDealUser'])) {
|
49 |
if(!isset($authorized['isPrivateDealUser'])) {
|
| 50 |
$cache = getFileCache($searchName);
|
50 |
$cache = getFileCache($searchName);
|
| 51 |
}
|
51 |
}
|
| 52 |
if(isset($cache) && !empty($cache)){
|
52 |
if(isset($cache) && !empty($cache)){
|
| 53 |
$data['response'] = $cache;
|
53 |
$data['response'] = $cache;
|
| 54 |
}else{
|
54 |
}else{
|
| 55 |
$data['response']=$this->search_model->getProducts($this->input->get(),$this->input->post(),$configdata['module'],$_SERVER['QUERY_STRING']);
|
55 |
$data['response']=$this->search_model->getProducts($this->input->get(),$this->input->post(),$configdata['module']);
|
| 56 |
if(!isset($authorized['isPrivateDealUser'])) {
|
56 |
if(!isset($authorized['isPrivateDealUser'])) {
|
| 57 |
setFileCache($data['response'], $searchName,300);
|
57 |
setFileCache($data['response'], $searchName,300);
|
| 58 |
}
|
58 |
}
|
| 59 |
}
|
59 |
}
|
| 60 |
}
|
60 |
}
|