| Line 186... |
Line 186... |
| 186 |
$response = $this->make_request($url,null);
|
186 |
$response = $this->make_request($url,null);
|
| 187 |
$storemapping = Configure::read('storemapping');
|
187 |
$storemapping = Configure::read('storemapping');
|
| 188 |
$this->set('masterdata', $response);
|
188 |
$this->set('masterdata', $response);
|
| 189 |
$this->set(compact('page','search','storemapping'));
|
189 |
$this->set(compact('page','search','storemapping'));
|
| 190 |
}
|
190 |
}
|
| - |
|
191 |
|
| - |
|
192 |
public function admin_autoupdates(){
|
| - |
|
193 |
$page = $this->request->query('page');
|
| - |
|
194 |
if(!isset($page)){
|
| - |
|
195 |
$page = 1;
|
| - |
|
196 |
}
|
| - |
|
197 |
$limit = Configure::read('admindashboardlimit');
|
| - |
|
198 |
$offset = ($page - 1)*$limit;
|
| - |
|
199 |
$search = urlencode($this->request->query('search'));
|
| - |
|
200 |
if(!empty($search)){
|
| - |
|
201 |
$type = $this->request->query('type');
|
| - |
|
202 |
$url = $this->apihost."Catalog/searchProducts/?class=Notifications&$type=$search";
|
| - |
|
203 |
}else{
|
| - |
|
204 |
$url = $this->apihost."Catalog/notification/?limit=$limit&offset=$offset";
|
| - |
|
205 |
}
|
| - |
|
206 |
$autoupdates = $this->make_request($url,null);
|
| - |
|
207 |
$this->set(compact('page','autoupdates'));
|
| - |
|
208 |
}
|
| - |
|
209 |
|
| - |
|
210 |
public function admin_scheduleupdate(){
|
| - |
|
211 |
if ($this->request->is('post')) {
|
| - |
|
212 |
$data = $this->request->data['MasterData'];
|
| - |
|
213 |
$this->log(print_r($data,1),'scheduleupdates');
|
| - |
|
214 |
$data['startDate'] = mktime($data['startDate']['hour'],$data['startDate']['min'],0,$data['startDate']['month'],$data['startDate']['day'],$data['startDate']['year'])*1000;
|
| - |
|
215 |
$data['endDate'] = mktime($data['endDate']['hour'],$data['endDate']['min'],0,$data['endDate']['month'],$data['endDate']['day'],$data['endDate']['year'])*1000;
|
| - |
|
216 |
$url = $this->apihost."Catalog/notification";
|
| - |
|
217 |
$url = $this->generateMultiUrl($url,$data);
|
| - |
|
218 |
$jsonVar = json_encode($data, JSON_NUMERIC_CHECK );
|
| - |
|
219 |
$response = $this->make_request($url,$jsonVar);
|
| - |
|
220 |
if (key($response)) {
|
| - |
|
221 |
$this->Session->setFlash(current($response));
|
| - |
|
222 |
return $this->redirect(array('action' => 'autoupdates'));
|
| - |
|
223 |
} else {
|
| - |
|
224 |
$this->Session->setFlash(current($response));
|
| - |
|
225 |
}
|
| - |
|
226 |
}
|
| - |
|
227 |
}
|
| - |
|
228 |
|
| - |
|
229 |
public function admin_editscheduledupdate($id,$skuBundleId,$model,$brand,$startDate,$endDate){
|
| - |
|
230 |
if ($this->request->is('post')) {
|
| - |
|
231 |
$data = $this->request->data['MasterData'];
|
| - |
|
232 |
$this->log(print_r($data,1),'scheduleupdates');
|
| - |
|
233 |
$data['startDate'] = mktime($data['startDate']['hour'],$data['startDate']['min'],0,$data['startDate']['month'],$data['startDate']['day'],$data['startDate']['year'])*1000;
|
| - |
|
234 |
$data['endDate'] = mktime($data['endDate']['hour'],$data['endDate']['min'],0,$data['endDate']['month'],$data['endDate']['day'],$data['endDate']['year'])*1000;
|
| - |
|
235 |
// debug($data);die;
|
| - |
|
236 |
$url = $this->apihost."Catalog/updateCollection";
|
| - |
|
237 |
$data1 = $data2 = $data;
|
| - |
|
238 |
$data1['class'] = 'Notifications';
|
| - |
|
239 |
unset($data1['endDate']);
|
| - |
|
240 |
$data2['class'] = 'Notifications';
|
| - |
|
241 |
unset($data2['startDate']);
|
| - |
|
242 |
$jsonVar = json_encode($data1, JSON_NUMERIC_CHECK );
|
| - |
|
243 |
$response = $this->make_request($url,$jsonVar);
|
| - |
|
244 |
$jsonVar = json_encode($data2, JSON_NUMERIC_CHECK );
|
| - |
|
245 |
$response = $this->make_request($url,$jsonVar);
|
| - |
|
246 |
if (key($response)) {
|
| - |
|
247 |
// $this->Session->setFlash(current($response));
|
| - |
|
248 |
return $this->redirect(array('action' => 'autoupdates'));
|
| - |
|
249 |
} else {
|
| - |
|
250 |
$this->Session->setFlash(current($response));
|
| - |
|
251 |
}
|
| - |
|
252 |
}
|
| - |
|
253 |
$this->set(compact('id','skuBundleId','brand','model','startDate','endDate'));
|
| - |
|
254 |
}
|
| - |
|
255 |
|
| - |
|
256 |
public function admin_deletescheduledupdate($id){
|
| - |
|
257 |
if ($this->remove($id,'Notifications')) {
|
| - |
|
258 |
$this->Session->setFlash(__('The sku scheme deal has been deleted.'));
|
| - |
|
259 |
} else {
|
| - |
|
260 |
$this->Session->setFlash(__('The sku scheme could not be deleted. Please, try again.'));
|
| - |
|
261 |
}
|
| - |
|
262 |
return $this->redirect(array('action' => 'autoupdates'));
|
| - |
|
263 |
}
|
| 191 |
}
|
264 |
}
|
| 192 |
|
265 |
|