Advertisement
krot

MODX msOrder

May 24th, 2019
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. /*miniShop2 заказы*/
  2. $date=date("Y-m-d",time()-(3600*24*31*2));
  3.         $pdo = $this->modx->getService('pdoFetch');
  4.        
  5.        
  6.         $q = $this->modx->newQuery('msOrder');
  7.         $q->where(array(
  8.             'createdon:>' => $date
  9.             ));
  10.         $orders = $this->modx->getIterator('msOrder',$q);
  11.         foreach($orders as $msOrder){
  12.                 $order = $msOrder->toArray();
  13.                 $order['address'] = $pdo->getArray('msOrderAddress', array('id' => $order['address']), array('sortby' => 'id'));
  14.                 $order['delivery'] = $pdo->getArray('msDelivery', array('id' => $order['delivery']), array('sortby' => 'id'));
  15.                 $order['payment'] = $pdo->getArray('msPayment', array('id' => $order['payment']), array('sortby' => 'id'));
  16.                 $order['profile'] = $pdo->getArray('modUserProfile', array('internalKey' => $order['user_id']), array('sortby' => 'id'));
  17.                 $order['products'] = $pdo->getCollection('msOrderProduct', array('order_id' => $order['id']), array('sortby' => 'id'));
  18.                 print_r($order);   
  19.        
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement