Subversion Repositories SmartDukaan

Rev

Rev 14346 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
13633 anikendra 1
<?php
2
class OrderpushShell extends AppShell {
3
    public $uses = array('PythonApi','Order');
4
 
5
    public function main() {
6
	Configure::load('live');
7
	$options = array('conditions'=>array('status'=>'mapped'),'recursive'=>-1);
8
	$orders = $this->Order->find('all',$options);
9
	if(!empty($orders)) {
10
		foreach($orders AS $order) {
11
			$response = $this->PythonApi->postOrders($order);
12
			if(!empty($response) && $response['result']) {
13
				$sql = "UPDATE orders SET status = 'processed' WHERE id = ".$order['Order']['id'];
14
				$this->Order->query($sql);
15
			}
16
		}
17
	}
18
    }
19
}