Subversion Repositories SmartDukaan

Rev

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

Rev 19834 Rev 19904
Line 393... Line 393...
393
		}
393
		}
394
 
394
 
395
 
395
 
396
 
396
 
397
	}
397
	}
-
 
398
	
-
 
399
	public function linkdeal($id = null) {
-
 
400
		$filtertype = $this->request->query('filtertype');
-
 
401
		$page = $this->request->query('page');
-
 
402
		if(!isset($page)){
-
 
403
			$page = 1;
-
 
404
		}
-
 
405
		$url = $this->apihost."getDealsByType?categoryId=".$id."&offset=0&limit=20&type=".$filtertype;
-
 
406
		$response = $this->make_request($url,null);
-
 
407
		$deals = array();
-
 
408
		
-
 
409
		$response_count =1;
-
 
410
		if($response == '')
-
 
411
		{
-
 
412
			$response_count = 0;
-
 
413
		}
-
 
414
 
-
 
415
		if(!empty($response)){
-
 
416
			foreach ($response as $key => $value) {
-
 
417
				if(!empty($value)){
-
 
418
					$deals[] = $value;
-
 
419
				}
-
 
420
			}
-
 
421
		}
-
 
422
 
-
 
423
		$this->loadModel('Api');
-
 
424
		$myactions = $this->Api->getMyActions($this->Auth->User('id'));
-
 
425
		if(!empty($myactions)) {
-
 
426
			foreach ($myactions['actions'] as $key => $value) {
-
 
427
				if($value['UserAction']['action'] == 'like'){
-
 
428
					$likedDeals[$value['UserAction']['store_product_id']] = $value['UserAction']['id'];
-
 
429
				}else{
-
 
430
					$disLikedDeals[$value['UserAction']['store_product_id']] = $value['UserAction']['id'];
-
 
431
				}
-
 
432
			}
-
 
433
		}
-
 
434
	    
-
 
435
		
-
 
436
		$nexturl = "/categories/getlinkdeals/".$id."?page=".($page+1)."&filtertype=".$filtertype;			
-
 
437
		$offerresponse = $this->getuseroffer();
-
 
438
		
-
 
439
		$this->set(compact('offerresponse','response_count','deals','id','likedDeals','disLikedDeals','page','nexturl'));
-
 
440
	}
-
 
441
	
-
 
442
	
-
 
443
	public function getlinkdeals($id = null) {
-
 
444
	
-
 
445
		$likedDeals = $disLikedDeals = array();
-
 
446
		$this->layout = 'ajax';
-
 
447
		$page = $this->request->query('page');
-
 
448
		$filtertype = $this->request->query('filtertype');
-
 
449
		if(!isset($page)){
-
 
450
			$page = 1;
-
 
451
		}
-
 
452
		$limit = 20;
-
 
453
		$offset = ($page - 1)*$limit;
-
 
454
		
-
 
455
		$likedDeals = $disLikedDeals = array();
-
 
456
		$url = $this->apihost."getDealsByType?categoryId=".$id."&type=".$filtertype."&limit=".$limit."&offset=".$offset;
-
 
457
		$response = $this->make_request($url,null);
-
 
458
		$deals = array();
-
 
459
		if(!empty($response)){
-
 
460
			foreach ($response as $key => $value) {
-
 
461
				if(!empty($value)){
-
 
462
					$deals[] = $value;
-
 
463
				}
-
 
464
			}
-
 
465
		}
-
 
466
		
-
 
467
		$this->loadModel('Api');
-
 
468
		
-
 
469
		$myactions = $this->Api->getMyActions($this->Auth->User('id'));
-
 
470
		if(!empty($myactions)) {
-
 
471
			foreach ($myactions['actions'] as $key => $value) {
-
 
472
				if($value['UserAction']['action'] == 'like'){
-
 
473
					$likedDeals[$value['UserAction']['store_product_id']] = $value['UserAction']['id'];
-
 
474
				}else{
-
 
475
					$disLikedDeals[$value['UserAction']['store_product_id']] = $value['UserAction']['id'];
-
 
476
				}
-
 
477
			}
-
 
478
		}
-
 
479
	
-
 
480
		$nexturl = "/categories/getlinkdeals/".$id."/?page=".($page+1)."&filtertype=".$filtertype;
-
 
481
	
-
 
482
		$offerresponse = $this->getuseroffer();
-
 
483
	
-
 
484
		$this->set(compact('offerresponse','nexturl','deals','id','page','likedDeals','disLikedDeals'));
-
 
485
		if(!empty($deals) && !empty($deals[0])){
-
 
486
			$this->render('/Elements/deals');
-
 
487
		}else{
-
 
488
			$this->render('/Elements/nodeals');
-
 
489
		}
-
 
490
	}
-
 
491
	
398
 
492
 
399
	public function dealdetail($item_id = null){
493
	public function dealdetail($item_id = null){
400
		setcookie("fresh", '0', null, '/');
494
		setcookie("fresh", '0', null, '/');
401
		$this->layout = "innerpages";
495
		$this->layout = "innerpages";
402
		$dealinfo = $deal = array();
496
		$dealinfo = $deal = array();