Subversion Repositories SmartDukaan

Rev

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

Rev 13567 Rev 13579
Line 75... Line 75...
75
 */
75
 */
76
	public function view($id = null) {
76
	public function view($id = null) {
77
		if (!$this->Category->exists($id)) {
77
		if (!$this->Category->exists($id)) {
78
			throw new NotFoundException(__('Invalid category'));
78
			throw new NotFoundException(__('Invalid category'));
79
		}
79
		}
-
 
80
		$this->loadModel('Api');
80
		$options = array('conditions' => array('Category.' . $this->Category->primaryKey => $id));
81
		$apideals = $this->Api->getDealsByCategory($this->Auth->User('id'),$id,1);
-
 
82
		$deals = $apideals['products'];
81
		$this->set('category', $this->Category->find('first', $options));
83
		$this->set(compact('deals','id'));
82
	}
84
	}
83
 
85
 
-
 
86
	public function getdeals($id = null) {
-
 
87
		$this->layout = 'ajax';
-
 
88
		$page = $this->request->query('page');
-
 
89
		if(!isset($page)){
-
 
90
			$page = 1;
-
 
91
		}
-
 
92
		if (!$this->Category->exists($id)) {
-
 
93
			throw new NotFoundException(__('Invalid category'));
-
 
94
		}
-
 
95
		$this->loadModel('Api');
-
 
96
		$apideals = $this->Api->getDealsByCategory($this->Auth->User('id'),$id,$page);
-
 
97
		$deals = $apideals['products'];
-
 
98
		$this->set(compact('deals','id','page'));
-
 
99
		$this->render('/Elements/categorydeals');
-
 
100
	}
84
/**
101
/**
85
 * add method
102
 * add method
86
 *
103
 *
87
 * @return void
104
 * @return void
88
 */
105
 */