Subversion Repositories SmartDukaan

Rev

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

Rev 13637 Rev 13646
Line 55... Line 55...
55
 *
55
 *
56
 * @return void
56
 * @return void
57
 */
57
 */
58
	public function admin_add() {
58
	public function admin_add() {
59
		if ($this->request->is('post')) {
59
		if ($this->request->is('post')) {
-
 
60
			$data = $this->request->data['Skuscheme'];
-
 
61
			$data['startDate'] = 1000*strtotime($data['startDate']);
-
 
62
			$data['endDate'] = 1000*strtotime($data['endDate']);
60
			$url = $this->apihost."discountInfo/addSkuSchemeDetails";
63
			$url = $this->apihost."discountInfo/addSkuSchemeDetails";
61
			$jsonVar = json_encode($this->request->data['Skuscheme'], JSON_NUMERIC_CHECK );
64
			$jsonVar = json_encode($data, JSON_NUMERIC_CHECK );
62
			$response = $this->make_request($url,$jsonVar);
65
			$response = $this->make_request($url,$jsonVar);
63
			if (key($response)) {
66
			if (key($response)) {
64
				$this->Session->setFlash(current($response));
67
				$this->Session->setFlash(current($response));
65
				return $this->redirect(array('action' => 'index'));
68
				return $this->redirect(array('action' => 'index'));
66
			} else {
69
			} else {
67
				$this->Session->setFlash(current($response));
70
				$this->Session->setFlash(current($response));
68
			}
-
 
69
			/*$this->Skuscheme->create();
-
 
70
			if ($this->Skuscheme->save($this->request->data)) {
-
 
71
				$this->Session->setFlash(__('The skuscheme has been saved.'));
-
 
72
				return $this->redirect(array('action' => 'index'));
-
 
73
			} else {
-
 
74
				$this->Session->setFlash(__('The skuscheme could not be saved. Please, try again.'));
-
 
75
			}*/
71
			}			
76
		}
72
		}
77
	}
73
	}
78
 
74
 
79
/**
75
/**
80
 * admin_edit method
76
 * admin_edit method