Subversion Repositories SmartDukaan

Rev

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

Rev 17695 Rev 17759
Line 129... Line 129...
129
		if($id != 2) {
129
		if($id != 2) {
130
			//Fetch deals
130
			//Fetch deals
131
			$likedDeals = $disLikedDeals = array();
131
			$likedDeals = $disLikedDeals = array();
132
			$brandschosen = $_COOKIE['brandschosen'];
132
			$brandschosen = $_COOKIE['brandschosen'];
133
			$subcategorieschosen = $_COOKIE['subcategorieschosen'];			
133
			$subcategorieschosen = $_COOKIE['subcategorieschosen'];			
134
		
134
			
-
 
135
			// echo "Cookie val", $_COOKIE['old_id'];
-
 
136
			// echo "id val", $id;
-
 
137
 
135
 
138
 
136
			if((isset($_COOKIE['old_id'])) && ($_COOKIE['old_id'] != $id)) {
139
			if((isset($_COOKIE['old_id'])) && ($_COOKIE['old_id'] != $id)) {
137
 
140
 
138
				
141
				
139
				unset($brandschosen);
142
				unset($brandschosen);
Line 207... Line 210...
207
			}
210
			}
208
			$this->loadModel('NotificationRule');
211
			$this->loadModel('NotificationRule');
209
			$notification = $this->NotificationRule->getNotification($this->Auth->User('id'));	
212
			$notification = $this->NotificationRule->getNotification($this->Auth->User('id'));	
210
		    $filterstr = '';
213
		    $filterstr = '';
211
			if(isset($filter) && !empty($filter)){
214
			if(isset($filter) && !empty($filter)){
-
 
215
				
212
			    $filterstr = '&filter='.$filter.'&brands='.$brands.'&subcategories='.$subcategories;
216
			    $filterstr = '&filter='.$filter.'&brands='.$brands.'&subcategories='.$subcategories;
213
		  	} 
217
		  	} 
214
 
218
 
-
 
219
 
215
		  	$get_url = "'".$_SERVER['REQUEST_URI']."'";
220
		  	$get_url = "'".$_SERVER['REQUEST_URI']."'";
216
		  	$urlArray = explode('=',$_SERVER['REQUEST_URI']);
221
		  	$urlArray = explode('=',$_SERVER['REQUEST_URI']);
217
		  	$last = $urlArray[sizeof($urlArray)-1];
222
		  	$last = $urlArray[sizeof($urlArray)-1];
218
		  	
223
		  	
-
 
224
		  	// <Code for url used after scrolling...>
219
		  	if(!isset($filter) && empty($filter)){
225
		  	if(!isset($filter) && empty($filter)){
220
		  		if (strpos($get_url,'filter=brand&brands') !== false)
226
		  		if (strpos($get_url,'filter=brand&brands') !== false)
221
		  		{
227
		  		{
222
		  			$filterstr= "&filter=brand&brands=".$last;
228
		  			$filterstr= "&filter=brand&brands=".$last;
223
		  		}
229
		  		}
224
		  		if (strpos($get_url,'filter=subcategory&subcategories') !== false)
230
		  		if (strpos($get_url,'filter=subcategory&subcategories') !== false)
225
		  		{
231
		  		{
226
		  			$filterstr= "&filter=subcategory&subcategories=".$last;
232
		  			$filterstr= "&filter=subcategory&subcategories=".$last;
227
    			// echo "url",$url;
-
 
228
 
-
 
229
		  		}
233
		  		}
230
 
234
 
231
		  	} 	  	
235
		  	}
-
 
236
 
-
 
237
		  
-
 
238
			if(!empty($subcategorieschosen) && isset($subcategorieschosen) && empty($brandschosen) && !isset($brandschosen)){	
-
 
239
					$filterstr= "&filter=subcategory&subcategories=".$subcategorieschosen;				
-
 
240
			}
-
 
241
 
232
			$this->set(compact('response_count','deals','id','likedDeals','disLikedDeals','page','sort','direction','notification','filter','brands','filterstr','brandschosen','subcategories','subcategorieschosen'));
242
			$this->set(compact('response_count','deals','id','likedDeals','disLikedDeals','page','sort','direction','notification','filter','brands','filterstr','brandschosen','subcategories','subcategorieschosen'));
233
		}else{
243
		}else{
234
			//Check for apk support of sharing
244
			//Check for apk support of sharing
235
			$sharable = 0;
245
			$sharable = 0;
236
			if(isset($_COOKIE['shareApps']) && !empty($_COOKIE['shareApps'])) {
246
			if(isset($_COOKIE['shareApps']) && !empty($_COOKIE['shareApps'])) {
Line 280... Line 290...
280
		}
290
		}
281
		$sort = $this->request->query('sort');
291
		$sort = $this->request->query('sort');
282
		$direction = $this->request->query('direction');
292
		$direction = $this->request->query('direction');
283
		// $filter = $this->request->query('filter');
293
		// $filter = $this->request->query('filter');
284
		// $brands = $this->request->query('brands');
294
		// $brands = $this->request->query('brands');
285
		$brandschosen = $_COOKIE['brandschosen'];	  	
295
		$brandschosen = $_COOKIE['brandschosen'];	 
-
 
296
		$subcategorieschosen = $_COOKIE['subcategorieschosen']; 	
-
 
297
		
-
 
298
		// Replace with the below content
286
		if(!empty($brandschosen)){
299
		// if(!empty($brandschosen)){
-
 
300
		// 	$filter = 'brand';
-
 
301
		// }
-
 
302
 
-
 
303
		//I have replaced the above content
-
 
304
		if(!empty($brandschosen) && !empty($subcategorieschosen)){
-
 
305
			$filter = 'brand|subcategory';
-
 
306
		}			
-
 
307
		else if(!empty($brandschosen) && empty($subcategorieschosen)){
287
			$filter = 'brand';
308
			$filter = 'brand';
288
		}
309
		}
-
 
310
		if(!empty($subcategorieschosen) && empty($brandschosen)){
-
 
311
			$filter = 'subcategory';
-
 
312
		}
-
 
313
		//Replaced end
-
 
314
 
289
		$brands = str_replace(',', '^', $brandschosen);
315
		$brands = str_replace(',', '^', $brandschosen);
-
 
316
		$subcategories = str_replace(',', '^', $subcategorieschosen);
290
		$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands);
317
		$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands,$subcategories);
291
		$response = $this->make_request($url,null);
318
		$response = $this->make_request($url,null);
292
		$deals = array();
319
		$deals = array();
293
		if(!empty($response)){
320
		if(!empty($response)){
294
			foreach ($response as $key => $value) {
321
			foreach ($response as $key => $value) {
295
				if(!empty($value)){
322
				if(!empty($value)){
Line 330... Line 357...
330
			}
357
			}
331
 
358
 
332
		} 	  	
359
		} 	  	
333
 
360
 
334
		if(isset($filter) && !empty($filter)){
361
		if(isset($filter) && !empty($filter)){
335
		    $filterstr = '&filter='.$filter.'&brands='.$brands;
362
		    // $filterstr = '&filter='.$filter.'&brands='.$brands;
-
 
363
		    $filterstr = '&filter='.$filter.'&brands='.$brands.'&subcategories='.$subcategories;
336
	  	} 
364
	  	} 
-
 
365
 
-
 
366
	  	if(!empty($subcategorieschosen) && isset($subcategorieschosen)&& empty($brandschosen) && !isset($brandschosen)){
-
 
367
 
-
 
368
	  			$filterstr= "&filter=subcategory&subcategories=".$subcategorieschosen;
-
 
369
	  	}
-
 
370
 
-
 
371
 
337
		$this->set(compact('deals','id','page','likedDeals','disLikedDeals','sort','direction','brands','filter','filterstr'));
372
		$this->set(compact('deals','id','page','likedDeals','disLikedDeals','sort','direction','brands','filter','filterstr'));
338
		if(!empty($deals) && !empty($deals[0])){
373
		if(!empty($deals) && !empty($deals[0])){
339
			$this->render('/Elements/deals');
374
			$this->render('/Elements/deals');
340
		}else{
375
		}else{
341
			$this->render('/Elements/nodeals');
376
			$this->render('/Elements/nodeals');