| Line 123... |
Line 123... |
| 123 |
if(!isset($page)){
|
123 |
if(!isset($page)){
|
| 124 |
$page = 1;
|
124 |
$page = 1;
|
| 125 |
}
|
125 |
}
|
| 126 |
$sort = $this->request->query('sort');
|
126 |
$sort = $this->request->query('sort');
|
| 127 |
$direction = $this->request->query('direction');
|
127 |
$direction = $this->request->query('direction');
|
| 128 |
$filter = $this->request->query('filter');
|
128 |
// $filter = $this->request->query('filter');
|
| 129 |
$brands = $this->request->query('brands');
|
129 |
// $brands = $this->request->query('brands');
|
| - |
|
130 |
$brandschosen = $_COOKIE['brandschosen'];
|
| - |
|
131 |
if(!empty($brandschosen)){
|
| - |
|
132 |
$filter = 'brand';
|
| - |
|
133 |
}
|
| - |
|
134 |
$brands = str_replace(',', '^', $brandschosen);
|
| 130 |
$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands);
|
135 |
$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands);
|
| 131 |
// $url = $this->apihost.'deals/'.$this->Auth->User('id').'?categoryId='.$id;
|
136 |
// $url = $this->apihost.'deals/'.$this->Auth->User('id').'?categoryId='.$id;
|
| 132 |
$deals = $this->make_request($url,null);
|
137 |
$deals = $this->make_request($url,null);
|
| 133 |
$this->loadModel('Api');
|
138 |
$this->loadModel('Api');
|
| 134 |
// $apideals = $this->Api->getDealsByCategory($this->Auth->User('id'),$id,$page);
|
139 |
// $apideals = $this->Api->getDealsByCategory($this->Auth->User('id'),$id,$page);
|
| Line 146... |
Line 151... |
| 146 |
$this->loadModel('NotificationRule');
|
151 |
$this->loadModel('NotificationRule');
|
| 147 |
$notification = $this->NotificationRule->getNotification($this->Auth->User('id'));
|
152 |
$notification = $this->NotificationRule->getNotification($this->Auth->User('id'));
|
| 148 |
$filterstr = '';
|
153 |
$filterstr = '';
|
| 149 |
if(isset($filter) && !empty($filter)){
|
154 |
if(isset($filter) && !empty($filter)){
|
| 150 |
$filterstr = '&filter='.$filter.'&brands='.$brands;
|
155 |
$filterstr = '&filter='.$filter.'&brands='.$brands;
|
| 151 |
}
|
156 |
}
|
| 152 |
$brandschosen = $_COOKIE['brandschosen'];
|
- |
|
| 153 |
$this->set(compact('deals','id','likedDeals','disLikedDeals','page','sort','direction','notification','filter','brands','filterstr','brandschosen'));
|
157 |
$this->set(compact('deals','id','likedDeals','disLikedDeals','page','sort','direction','notification','filter','brands','filterstr','brandschosen'));
|
| 154 |
}
|
158 |
}
|
| 155 |
|
159 |
|
| 156 |
public function getdeals($id = null) {
|
160 |
public function getdeals($id = null) {
|
| 157 |
$this->log('getdeal id '.$id,'api');
|
161 |
$this->log('getdeal id '.$id,'api');
|
| Line 161... |
Line 165... |
| 161 |
if(!isset($page)){
|
165 |
if(!isset($page)){
|
| 162 |
$page = 1;
|
166 |
$page = 1;
|
| 163 |
}
|
167 |
}
|
| 164 |
$sort = $this->request->query('sort');
|
168 |
$sort = $this->request->query('sort');
|
| 165 |
$direction = $this->request->query('direction');
|
169 |
$direction = $this->request->query('direction');
|
| 166 |
$filter = $this->request->query('filter');
|
170 |
// $filter = $this->request->query('filter');
|
| 167 |
$brands = $this->request->query('brands');
|
171 |
// $brands = $this->request->query('brands');
|
| - |
|
172 |
$brandschosen = $_COOKIE['brandschosen'];
|
| - |
|
173 |
if(!empty($brandschosen)){
|
| - |
|
174 |
$filter = 'brand';
|
| - |
|
175 |
}
|
| - |
|
176 |
$brands = str_replace(',', '^', $brandschosen);
|
| 168 |
$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands);
|
177 |
$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands);
|
| 169 |
$deals = $this->make_request($url,null);
|
178 |
$deals = $this->make_request($url,null);
|
| 170 |
// if (!$this->Category->exists($id)) {
|
179 |
// if (!$this->Category->exists($id)) {
|
| 171 |
// throw new NotFoundException(__('Invalid category'));
|
180 |
// throw new NotFoundException(__('Invalid category'));
|
| 172 |
// }
|
181 |
// }
|