Subversion Repositories SmartDukaan

Rev

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

Rev 14225 Rev 14517
Line 47... Line 47...
47
 *
47
 *
48
 * @throws NotFoundException
48
 * @throws NotFoundException
49
 * @param string $id
49
 * @param string $id
50
 * @return void
50
 * @return void
51
 */
51
 */
52
	public function admin_view($id = null) {
52
	public function admin_search() {
-
 
53
		$type = $this->request->query('type');
-
 
54
		$search = $this->request->query('search');				
-
 
55
		$url = $this->apihost."Catalog/searchProducts/?class=SkuSchemeDetails&$type=$search";
-
 
56
		$response = $this->make_request($url,null);
53
		if (!$this->Skuscheme->exists($id)) {
57
		$this->set('skuschemes', $response);
-
 
58
		$this->set('page',1);
54
			throw new NotFoundException(__('Invalid skuscheme'));
59
		$this->render('admin_index');
55
		}
60
	}
-
 
61
 
-
 
62
	public function admin_searchdp() {
-
 
63
		$type = $this->request->query('type');
-
 
64
		$search = $this->request->query('search');				
56
		$options = array('conditions' => array('Skuscheme.' . $this->Skuscheme->primaryKey => $id));
65
		$url = $this->apihost."Catalog/searchProducts/?class=SkuDealerPrices&$type=$search";
-
 
66
		$response = $this->make_request($url,null);
57
		$this->set('skuscheme', $this->Skuscheme->find('first', $options));
67
		$this->set('dealerprices', $response);
-
 
68
		$this->set('page',1);
-
 
69
		$this->render('admin_dp');
58
	}
70
	}
59
 
71
 
60
/**
72
/**
61
 * admin_add method
73
 * admin_add method
62
 *
74
 *
Line 108... Line 120...
108
 *
120
 *
109
 * @throws NotFoundException
121
 * @throws NotFoundException
110
 * @param string $id
122
 * @param string $id
111
 * @return void
123
 * @return void
112
 */
124
 */
113
	public function admin_delete($id = null) {
125
	public function admin_delete($id = null) {		
114
		$this->Skuscheme->id = $id;
-
 
115
		if (!$this->Skuscheme->exists()) {
126
		if ($this->remove($id,'SkuSchemeDetails')) {
116
			throw new NotFoundException(__('Invalid skuscheme'));
-
 
117
		}
-
 
118
		$this->request->onlyAllow('post', 'delete');
-
 
119
		if ($this->Skuscheme->delete()) {
-
 
120
			$this->Session->setFlash(__('The skuscheme has been deleted.'));
127
			$this->Session->setFlash(__('The sku scheme deal has been deleted.'));
121
		} else {
128
		} else {
122
			$this->Session->setFlash(__('The skuscheme could not be deleted. Please, try again.'));
129
			$this->Session->setFlash(__('The sku scheme could not be deleted. Please, try again.'));
123
		}
130
		}
124
		return $this->redirect(array('action' => 'index'));
131
		return $this->redirect(array('action' => 'index'));
125
	}
132
	}
126
 
133
 
-
 
134
	public function admin_deletedp($id = null) {		
-
 
135
		if ($this->remove($id,'SkuDealerPrices')) {
-
 
136
			$this->Session->setFlash(__('The sku scheme deal has been deleted.'));
-
 
137
		} else {
-
 
138
			// $this->Session->setFlash(__('The sku scheme could not be deleted. Please, try again.'));
-
 
139
		}
-
 
140
		return $this->redirect(array('action' => 'index'));
-
 
141
	}
-
 
142
	
127
	public function admin_dp(){		
143
	public function admin_dp(){		
128
		$page = $this->request->query('page');
144
		$page = $this->request->query('page');
129
		if(!isset($page)){
145
		if(!isset($page)){
130
			$page = 1;
146
			$page = 1;
131
		}
147
		}