Subversion Repositories SmartDukaan

Rev

Rev 14346 | Details | Compare with Previous | 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');
17392 amit.gupta 7
	$options = array('conditions'=>array('status'=>array('ORDER_NOT_CREATED', 'new')),'recursive'=>-1);
13633 anikendra 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']) {
14346 anikendra 13
				$sql = "UPDATE orders SET status = '". $response['result']."' WHERE id = ".$order['Order']['id'];
13633 anikendra 14
				$this->Order->query($sql);
15
			}
16
		}
17
	}
18
    }
19
}