Subversion Repositories SmartDukaan

Rev

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

Rev 14315 Rev 14354
Line 15... Line 15...
15
 */
15
 */
16
	public $components = array('Paginator');
16
	public $components = array('Paginator');
17
 
17
 
18
	public function beforeFilter() {		
18
	public function beforeFilter() {		
19
		parent::beforeFilter();
19
		parent::beforeFilter();
20
		$this->Auth->allow('add','mine','pendingcashbacks');
20
		$this->Auth->allow('add','mine','pendingcashbacks','all');
21
		$this->apihost = Configure::read('pythonapihost');
21
		$this->apihost = Configure::read('pythonapihost');
22
	}
22
	}
23
	
23
	
24
	public function mine() {
24
	public function mine() {
25
		$page = $this->request->query('page');
25
		$page = $this->request->query('page');
Line 360... Line 360...
360
			$this->Session->setFlash(__('The order has been deleted.'));
360
			$this->Session->setFlash(__('The order has been deleted.'));
361
		} else {
361
		} else {
362
			$this->Session->setFlash(__('The order could not be deleted. Please, try again.'));
362
			$this->Session->setFlash(__('The order could not be deleted. Please, try again.'));
363
		}
363
		}
364
		return $this->redirect(array('action' => 'index'));
364
		return $this->redirect(array('action' => 'index'));
-
 
365
	}
-
 
366
 
-
 
367
	public function all() {
-
 
368
		$page = $this->request->query('page');
-
 
369
		$page = isset($page)?$page:1;
-
 
370
		$userId = $this->request->query('user_id');
-
 
371
		if(isset($userId) && !empty($userId)){
-
 
372
			$this->loadModel('User');
-
 
373
			$dbuser = $this->User->findById($userId);
-
 
374
			$this->Auth->login($dbuser['User']);	
365
	}}
375
		}
-
 
376
		$this->layout = "innerpages";
-
 
377
		$url = $this->apihost."orders/?page=$page&window=10";
-
 
378
		$response = $this->make_request($url,null);
-
 
379
		$totalPages = $response['totalPages'];
-
 
380
		if(!empty($response['data'])){
-
 
381
			$this->set('orders',$response['data']);
-
 
382
		}
-
 
383
		$ignoredFields = array('imgUrl','status','productTitle','estimatedDeliveryDate','productCode','merchantSubOrderId','productUrl','closed','tracingkUrl','detailedStatus');
-
 
384
		$storemapping = Configure::read('storemapping');
-
 
385
		$activestores = Configure::read('activestores');
-
 
386
		$amazonorderurl = Configure::read('amazonorderurl');
-
 
387
		$allusers = $this->Order->User->find('all',array('fields'=>array('first_name','id'),'recursive'=>-1));
-
 
388
		foreach($allusers AS $user){
-
 
389
			$users[$user['User']['id']] = $user['User']['first_name'];
-
 
390
		}
-
 
391
		$this->set(compact('ignoredFields','page','totalPages','userId','activestores','storemapping','amazonorderurl','users'));
-
 
392
	}
-
 
393
}