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