Subversion Repositories SmartDukaan

Rev

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

Rev 19991 Rev 20010
Line 121... Line 121...
121
 * @return void
121
 * @return void
122
 */
122
 */
123
	public function view($id = null) {
123
	public function view($id = null) {
124
		$arrSubCategory = Configure::read('arrSubCategory');
124
		$arrSubCategory = Configure::read('arrSubCategory');
125
		$userId = $this->request->query('user_id');
125
		$userId = $this->request->query('user_id');
126
		$dealpin = $this->getpin();
126
// 		$dealpin = $this->getpin();
127
// 		$this->set(compact('dealpin'));
127
// 		$this->set(compact('dealpin'));
128
	
128
	
129
		if(isset($userId) && !empty($userId)) {
129
		if(isset($userId) && !empty($userId)) {
130
			$this->loadModel('User');
130
			$this->loadModel('User');
131
			$dbuser = $this->User->findById($userId);
131
			$dbuser = $this->User->findById($userId);
Line 243... Line 243...
243
			else if ($sort=='available_price' && $direction==1){
243
			else if ($sort=='available_price' && $direction==1){
244
				$sortlabel  = 'pricelow';
244
				$sortlabel  = 'pricelow';
245
			}
245
			}
246
			
246
			
247
			$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands,$subcategories);
247
			$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands,$subcategories);
248
			$url = $url."&pin=".$dealpin;
248
// 			$url = $url."&pin=".$dealpin;
249
			$response = $this->make_request($url,null);
249
			$response = $this->make_request($url,null);
250
			$deals = array();
250
			$deals = array();
251
			
251
			
252
			$response_count =1;
252
			$response_count =1;
253
			if($response == '')
253
			if($response == '')
Line 343... Line 343...
343
		$this->layout = 'ajax';
343
		$this->layout = 'ajax';
344
		$page = $this->request->query('page');
344
		$page = $this->request->query('page');
345
		if(!isset($page)){
345
		if(!isset($page)){
346
			$page = 1;
346
			$page = 1;
347
		}
347
		}
348
		$dealpin = $this->getpin();
348
// 		$dealpin = $this->getpin();
349
		$sort = $this->request->query('sort');
349
		$sort = $this->request->query('sort');
350
		$direction = $this->request->query('direction');
350
		$direction = $this->request->query('direction');
351
		// $filter = $this->request->query('filter');
351
		// $filter = $this->request->query('filter');
352
		// $brands = $this->request->query('brands');
352
		// $brands = $this->request->query('brands');
353
		$brands = $this->request->query('brands');
353
		$brands = $this->request->query('brands');
Line 363... Line 363...
363
		else if(!empty($subcategories)){
363
		else if(!empty($subcategories)){
364
			$filter = 'subcategory';
364
			$filter = 'subcategory';
365
		}
365
		}
366
		
366
		
367
		$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands,$subcategories);
367
		$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands,$subcategories);
368
		$url = $url."&pin=".$dealpin;
368
// 		$url = $url."&pin=".$dealpin;
369
		$response = $this->make_request($url,null);
369
		$response = $this->make_request($url,null);
370
		$deals = array();
370
		$deals = array();
371
		if(!empty($response)){
371
		if(!empty($response)){
372
			foreach ($response as $key => $value) {
372
			foreach ($response as $key => $value) {
373
				if(!empty($value)){
373
				if(!empty($value)){
Line 408... Line 408...
408
 
408
 
409
	}
409
	}
410
	
410
	
411
	public function linkdeal($id = null) {
411
	public function linkdeal($id = null) {
412
		$filtertype = $this->request->query('filtertype');
412
		$filtertype = $this->request->query('filtertype');
-
 
413
		$user_id = $this->Auth->User('id');
413
		$page = $this->request->query('page');
414
		$page = $this->request->query('page');
414
		if(!isset($page)){
415
		if(!isset($page)){
415
			$page = 1;
416
			$page = 1;
416
		}
417
		}
-
 
418
		if($filtertype == 'below1000'){
-
 
419
			$url = $this->apihost."deals/".$user_id."?categoryId=".$id."&limit=20&offset=0&filterData=priceFilter:0^1000";
-
 
420
		}elseif($filtertype == 'exclusive'){
417
		$url = $this->apihost."getDealsByType?categoryId=".$id."&offset=0&limit=20&type=".$filtertype;
421
			$url = $this->apihost."getDealsByType?categoryId=".$id."&offset=0&limit=20&type=".$filtertype;
-
 
422
		}
-
 
423
		
418
		$response = $this->make_request($url,null);
424
		$response = $this->make_request($url,null);
419
		$deals = array();
425
		$deals = array();
420
		
426
		
421
		$response_count =1;
427
		$response_count =1;
422
		if($response == '')
428
		if($response == '')
Line 456... Line 462...
456
	
462
	
457
		$likedDeals = $disLikedDeals = array();
463
		$likedDeals = $disLikedDeals = array();
458
		$this->layout = 'ajax';
464
		$this->layout = 'ajax';
459
		$page = $this->request->query('page');
465
		$page = $this->request->query('page');
460
		$filtertype = $this->request->query('filtertype');
466
		$filtertype = $this->request->query('filtertype');
-
 
467
		$user_id = $this->Auth->User('id');
461
		if(!isset($page)){
468
		if(!isset($page)){
462
			$page = 1;
469
			$page = 1;
463
		}
470
		}
464
		$limit = 20;
471
		$limit = 20;
465
		$offset = ($page - 1)*$limit;
472
		$offset = ($page - 1)*$limit;
466
		
473
		
467
		$likedDeals = $disLikedDeals = array();
474
		$likedDeals = $disLikedDeals = array();
-
 
475
		if($filtertype == 'below1000'){
-
 
476
			$url = $this->apihost."deals/".$user_id."?categoryId=".$id."&limit=".$limit."&offset=".$offset."&filterData=priceFilter:0^1000";
-
 
477
		}elseif($filtertype == 'exclusive'){
468
		$url = $this->apihost."getDealsByType?categoryId=".$id."&type=".$filtertype."&limit=".$limit."&offset=".$offset;
478
			$url = $this->apihost."getDealsByType?categoryId=".$id."&type=".$filtertype."&limit=".$limit."&offset=".$offset;
-
 
479
		}
-
 
480
// 		$url = $this->apihost."getDealsByType?categoryId=".$id."&type=".$filtertype."&limit=".$limit."&offset=".$offset;
469
		$response = $this->make_request($url,null);
481
		$response = $this->make_request($url,null);
470
		$deals = array();
482
		$deals = array();
471
		if(!empty($response)){
483
		if(!empty($response)){
472
			foreach ($response as $key => $value) {
484
			foreach ($response as $key => $value) {
473
				if(!empty($value)){
485
				if(!empty($value)){