| Line 38... |
Line 38... |
| 38 |
$this->loadModel('Store');
|
38 |
$this->loadModel('Store');
|
| 39 |
$this->set('sources',$this->Store->find('list'));
|
39 |
$this->set('sources',$this->Store->find('list'));
|
| 40 |
$this->set('page',$page);
|
40 |
$this->set('page',$page);
|
| 41 |
}
|
41 |
}
|
| 42 |
|
42 |
|
| 43 |
public function admin_dealpoints() {
|
43 |
public function admin_dealpoints($type=null) {
|
| 44 |
$page = $this->request->query('page');
|
44 |
$page = $this->request->query('page');
|
| 45 |
if(!isset($page)){
|
45 |
if(!isset($page)){
|
| 46 |
$page = 1;
|
46 |
$page = 1;
|
| 47 |
}
|
47 |
}
|
| 48 |
$limit = Configure::read('admindashboardlimit');
|
48 |
$limit = Configure::read('admindashboardlimit');
|
| 49 |
$offset = ($page - 1)*$limit;
|
49 |
$offset = ($page - 1)*$limit;
|
| - |
|
50 |
if($type=='search'){
|
| - |
|
51 |
$type = $this->request->query('type');
|
| - |
|
52 |
$search = $this->request->query('search');
|
| - |
|
53 |
$url = $this->apihost."Catalog/searchProducts/?class=DealPoints&$type=$search";
|
| - |
|
54 |
}else{
|
| 50 |
$url = $this->apihost."dealPoints/getDealPoints/?limit=$limit&offset=$offset";
|
55 |
$url = $this->apihost."dealPoints/getDealPoints/?limit=$limit&offset=$offset";
|
| - |
|
56 |
}
|
| 51 |
$response = $this->make_request($url,null);
|
57 |
$response = $this->make_request($url,null);
|
| 52 |
$this->set('negativedeals', $response);
|
58 |
$this->set('negativedeals', $response);
|
| 53 |
$this->loadModel('Store');
|
59 |
$this->loadModel('Store');
|
| 54 |
$this->set('sources',$this->Store->find('list'));
|
60 |
$this->set('sources',$this->Store->find('list'));
|
| 55 |
$this->set('page',$page);
|
61 |
$this->set('page',$page);
|
| Line 85... |
Line 91... |
| 85 |
$search = $this->request->query('search');
|
91 |
$search = $this->request->query('search');
|
| 86 |
$url = $this->apihost."Catalog/searchProducts/?class=".Inflector::pluralize($this->name)."&$type=$search";
|
92 |
$url = $this->apihost."Catalog/searchProducts/?class=".Inflector::pluralize($this->name)."&$type=$search";
|
| 87 |
$response = $this->make_request($url,null);
|
93 |
$response = $this->make_request($url,null);
|
| 88 |
$this->set('negativedeals', $response);
|
94 |
$this->set('negativedeals', $response);
|
| 89 |
$this->set('page',1);
|
95 |
$this->set('page',1);
|
| - |
|
96 |
$this->loadModel('Store');
|
| 90 |
$this->set('sources',$this->Store->find('list'));
|
97 |
$this->set('sources',$this->Store->find('list'));
|
| 91 |
$this->render('admin_index');
|
98 |
$this->render('admin_index');
|
| 92 |
}
|
99 |
}
|
| 93 |
/**
|
100 |
/**
|
| 94 |
* admin_add method
|
101 |
* admin_add method
|
| 95 |
*
|
102 |
*
|
| 96 |
* @return void
|
103 |
* @return void
|
| 97 |
*/
|
104 |
*/
|
| 98 |
public function admin_add() {
|
105 |
public function admin_add() {
|
| 99 |
if ($this->request->is('post')) {
|
106 |
if ($this->request->is('post')) {
|
| 100 |
$this->request->data['ManualDeal']['startDate'] = 1000*mktime($this->request->data['ManualDeal']['startDate']['hour'],$this->request->data['ManualDeal']['startDate']['min'],0,$this->request->data['ManualDeal']['startDate']['month'],$this->request->data['ManualDeal']['startDate']['day'],$this->request->data['ManualDeal']['startDate']['year']);
|
107 |
$this->request->data['ManualDeals']['startDate'] = 1000*mktime($this->request->data['ManualDeals']['startDate']['hour'],$this->request->data['ManualDeals']['startDate']['min'],0,$this->request->data['ManualDeals']['startDate']['month'],$this->request->data['ManualDeals']['startDate']['day'],$this->request->data['ManualDeals']['startDate']['year']);
|
| 101 |
$this->request->data['ManualDeal']['endDate'] = 1000*mktime($this->request->data['ManualDeal']['endDate']['hour'],$this->request->data['ManualDeal']['endDate']['min'],0,$this->request->data['ManualDeal']['endDate']['month'],$this->request->data['ManualDeal']['endDate']['day'],$this->request->data['ManualDeal']['endDate']['year']);
|
108 |
$this->request->data['ManualDeals']['endDate'] = 1000*mktime($this->request->data['ManualDeals']['endDate']['hour'],$this->request->data['ManualDeals']['endDate']['min'],0,$this->request->data['ManualDeals']['endDate']['month'],$this->request->data['ManualDeals']['endDate']['day'],$this->request->data['ManualDeals']['endDate']['year']);
|
| 102 |
$url = $this->apihost."manualDeals/addManualDeals";
|
109 |
$url = $this->apihost."manualDeals/addManualDeals";
|
| 103 |
$data = $this->request->data['ManualDeal'];
|
110 |
$data = $this->request->data['ManualDeals'];
|
| 104 |
$url = $this->generateMultiUrl($url,$data);
|
111 |
$url = $this->generateMultiUrl($url,$data);
|
| 105 |
$jsonVar = json_encode($data, JSON_NUMERIC_CHECK );
|
112 |
$jsonVar = json_encode($data, JSON_NUMERIC_CHECK );
|
| 106 |
$response = $this->make_request($url,$jsonVar);
|
113 |
$response = $this->make_request($url,$jsonVar);
|
| 107 |
if (key($response)) {
|
114 |
if (key($response)) {
|
| 108 |
$this->Session->setFlash(current($response));
|
115 |
$this->Session->setFlash(current($response));
|