Subversion Repositories SmartDukaan

Rev

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

Rev 15015 Rev 15026
Line 143... Line 143...
143
				}
143
				}
144
			}
144
			}
145
		}
145
		}
146
		$this->loadModel('NotificationRule');
146
		$this->loadModel('NotificationRule');
147
		$notification = $this->NotificationRule->getNotification($this->Auth->User('id'));	
147
		$notification = $this->NotificationRule->getNotification($this->Auth->User('id'));	
-
 
148
	    $filterstr = '';
-
 
149
		if(isset($filter) && !empty($filter)){
-
 
150
		    $filterstr = '&filter='.$filter.'&brands='.$brands;
-
 
151
	  	} 
148
		$this->set(compact('deals','id','likedDeals','disLikedDeals','page','sort','direction','notification'));
152
		$this->set(compact('deals','id','likedDeals','disLikedDeals','page','sort','direction','notification','filter','brands','filterstr'));
149
	}
153
	}
150
 
154
 
151
	public function getdeals($id = null) {
155
	public function getdeals($id = null) {
152
		$this->log('getdeal id '.$id,'api');
156
		$this->log('getdeal id '.$id,'api');
153
		$likedDeals = $disLikedDeals = array();
157
		$likedDeals = $disLikedDeals = array();
Line 156... Line 160...
156
		if(!isset($page)){
160
		if(!isset($page)){
157
			$page = 1;
161
			$page = 1;
158
		}
162
		}
159
		$sort = $this->request->query('sort');
163
		$sort = $this->request->query('sort');
160
		$direction = $this->request->query('direction');
164
		$direction = $this->request->query('direction');
161
		$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction);
165
		$filter = $this->request->query('filter');
-
 
166
		$brands = $this->request->query('brands');
162
		// $url = $this->apihost.'deals/'.$this->Auth->User('id').'?categoryId='.$id;
167
		$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands);
163
		$deals = $this->make_request($url,null);
168
		$deals = $this->make_request($url,null);
164
		// if (!$this->Category->exists($id)) {
169
		// if (!$this->Category->exists($id)) {
165
			// throw new NotFoundException(__('Invalid category'));
170
			// throw new NotFoundException(__('Invalid category'));
166
		// }
171
		// }
167
		$this->loadModel('Api');
172
		$this->loadModel('Api');
Line 175... Line 180...
175
				}else{
180
				}else{
176
					$disLikedDeals[$value['UserAction']['store_product_id']] = $value['UserAction']['id'];
181
					$disLikedDeals[$value['UserAction']['store_product_id']] = $value['UserAction']['id'];
177
				}
182
				}
178
			}
183
			}
179
		}
184
		}
-
 
185
		$filterstr = '';
-
 
186
		if(isset($filter) && !empty($filter)){
-
 
187
		    $filterstr = '&filter='.$filter.'&brands='.$brands;
-
 
188
	  	} 
180
		$this->set(compact('deals','id','page','likedDeals','disLikedDeals','sort','direction'));
189
		$this->set(compact('deals','id','page','likedDeals','disLikedDeals','sort','direction','brands','filter','filterstr'));
-
 
190
		if(!empty($deals)){
181
		$this->render('/Elements/deals');
191
			$this->render('/Elements/deals');
-
 
192
		}else{
-
 
193
			$this->render('/Elements/nodeals');
-
 
194
		}
182
	}
195
	}
183
/**
196
/**
184
 * add method
197
 * add method
185
 *
198
 *
186
 * @return void
199
 * @return void