| Line 132... |
Line 132... |
| 132 |
$filter = 'brand';
|
132 |
$filter = 'brand';
|
| 133 |
}
|
133 |
}
|
| 134 |
$brands = str_replace(',', '^', $brandschosen);
|
134 |
$brands = str_replace(',', '^', $brandschosen);
|
| 135 |
$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);
|
| 136 |
// $url = $this->apihost.'deals/'.$this->Auth->User('id').'?categoryId='.$id;
|
136 |
// $url = $this->apihost.'deals/'.$this->Auth->User('id').'?categoryId='.$id;
|
| 137 |
$deals = $this->make_request($url,null);
|
137 |
$response = $this->make_request($url,null);
|
| - |
|
138 |
$deals = array();
|
| - |
|
139 |
if(!empty($response)){
|
| - |
|
140 |
foreach ($response as $key => $value) {
|
| - |
|
141 |
if(!empty($value)){
|
| - |
|
142 |
$deals[] = $value;
|
| - |
|
143 |
}
|
| - |
|
144 |
}
|
| - |
|
145 |
}
|
| 138 |
$this->loadModel('Api');
|
146 |
$this->loadModel('Api');
|
| 139 |
// $apideals = $this->Api->getDealsByCategory($this->Auth->User('id'),$id,$page);
|
147 |
// $apideals = $this->Api->getDealsByCategory($this->Auth->User('id'),$id,$page);
|
| 140 |
// $deals = $apideals['products'];
|
148 |
// $deals = $apideals['products'];
|
| 141 |
$myactions = $this->Api->getMyActions($this->Auth->User('id'));
|
149 |
$myactions = $this->Api->getMyActions($this->Auth->User('id'));
|
| 142 |
if(!empty($myactions)) {
|
150 |
if(!empty($myactions)) {
|
| Line 173... |
Line 181... |
| 173 |
if(!empty($brandschosen)){
|
181 |
if(!empty($brandschosen)){
|
| 174 |
$filter = 'brand';
|
182 |
$filter = 'brand';
|
| 175 |
}
|
183 |
}
|
| 176 |
$brands = str_replace(',', '^', $brandschosen);
|
184 |
$brands = str_replace(',', '^', $brandschosen);
|
| 177 |
$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands);
|
185 |
$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands);
|
| 178 |
$deals = $this->make_request($url,null);
|
186 |
$response = $this->make_request($url,null);
|
| - |
|
187 |
$deals = array();
|
| - |
|
188 |
if(!empty($response)){
|
| - |
|
189 |
foreach ($response as $key => $value) {
|
| - |
|
190 |
if(!empty($value)){
|
| - |
|
191 |
$deals[] = $value;
|
| - |
|
192 |
}
|
| - |
|
193 |
}
|
| - |
|
194 |
}
|
| 179 |
// if (!$this->Category->exists($id)) {
|
195 |
// if (!$this->Category->exists($id)) {
|
| 180 |
// throw new NotFoundException(__('Invalid category'));
|
196 |
// throw new NotFoundException(__('Invalid category'));
|
| 181 |
// }
|
197 |
// }
|
| 182 |
$this->loadModel('Api');
|
198 |
$this->loadModel('Api');
|
| 183 |
// $apideals = $this->Api->getDealsByCategory($this->Auth->User('id'),$id,$page);
|
199 |
// $apideals = $this->Api->getDealsByCategory($this->Auth->User('id'),$id,$page);
|
| Line 195... |
Line 211... |
| 195 |
$filterstr = '';
|
211 |
$filterstr = '';
|
| 196 |
if(isset($filter) && !empty($filter)){
|
212 |
if(isset($filter) && !empty($filter)){
|
| 197 |
$filterstr = '&filter='.$filter.'&brands='.$brands;
|
213 |
$filterstr = '&filter='.$filter.'&brands='.$brands;
|
| 198 |
}
|
214 |
}
|
| 199 |
$this->set(compact('deals','id','page','likedDeals','disLikedDeals','sort','direction','brands','filter','filterstr'));
|
215 |
$this->set(compact('deals','id','page','likedDeals','disLikedDeals','sort','direction','brands','filter','filterstr'));
|
| 200 |
if(!empty($deals)){
|
216 |
if(!empty($deals) && !empty($deals[0])){
|
| 201 |
$this->render('/Elements/deals');
|
217 |
$this->render('/Elements/deals');
|
| 202 |
}else{
|
218 |
}else{
|
| 203 |
$this->render('/Elements/nodeals');
|
219 |
$this->render('/Elements/nodeals');
|
| 204 |
}
|
220 |
}
|
| 205 |
}
|
221 |
}
|