Subversion Repositories SmartDukaan

Rev

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

Rev 14098 Rev 14517
Line 45... Line 45...
45
 *
45
 *
46
 * @throws NotFoundException
46
 * @throws NotFoundException
47
 * @param string $id
47
 * @param string $id
48
 * @return void
48
 * @return void
49
 */
49
 */
50
	public function admin_view($id = null) {
50
	public function admin_search() {
51
		if (!$this->Exceptionalskudiscount->exists($id)) {
51
		$type = $this->request->query('type');
52
			throw new NotFoundException(__('Invalid exceptionalskudiscount'));
52
		$search = $this->request->query('search');				
53
		}
-
 
54
		$options = array('conditions' => array('Exceptionalskudiscount.' . $this->Exceptionalskudiscount->primaryKey => $id));
53
		$url = $this->apihost."Catalog/searchProducts/?class=SkuDiscountInfo&$type=$search";
-
 
54
		$response = $this->make_request($url,null);
55
		$this->set('exceptionalskudiscount', $this->Exceptionalskudiscount->find('first', $options));
55
		$this->set('exceptionalskudiscounts', $response);
-
 
56
		$this->set('page',1);
-
 
57
		$this->render('admin_index');
56
	}
58
	}
57
 
59
 
58
/**
60
/**
59
 * admin_add method
61
 * admin_add method
60
 *
62
 *
Line 103... Line 105...
103
 *
105
 *
104
 * @throws NotFoundException
106
 * @throws NotFoundException
105
 * @param string $id
107
 * @param string $id
106
 * @return void
108
 * @return void
107
 */
109
 */
108
	public function admin_delete($id = null) {
110
	public function admin_delete($id = null) {		
109
		$this->Exceptionalskudiscount->id = $id;
-
 
110
		if (!$this->Exceptionalskudiscount->exists()) {
-
 
111
			throw new NotFoundException(__('Invalid exceptionalskudiscount'));
-
 
112
		}
-
 
113
		$this->request->onlyAllow('post', 'delete');
111
		// $this->request->onlyAllow('post', 'delete');
114
		if ($this->Exceptionalskudiscount->delete()) {
112
		if ($this->remove($id,'SkuDiscountInfo')) {
115
			$this->Session->setFlash(__('The exceptionalskudiscount has been deleted.'));
113
			$this->Session->setFlash(__('The negative deal has been deleted.'));
116
		} else {
114
		} else {
117
			$this->Session->setFlash(__('The exceptionalskudiscount could not be deleted. Please, try again.'));
115
			$this->Session->setFlash(__('The negative could not be deleted. Please, try again.'));
118
		}
116
		}
119
		return $this->redirect(array('action' => 'index'));
117
		return $this->redirect(array('action' => 'index'));
120
	}}
118
	}
-
 
119
}