コード例 #1
0
 public static function getProductsByOrderID($orderID)
 {
     if (!$orderID) {
         return array();
     }
     self::$_msql = SafeMySQL::getInstance();
     $sql = "\n\t\t\tSELECT\n\t\t\t\top.`order_product_id`,\n\t\t\t\top.`order_id`,\n\t\t\t\top.`product_id`,\n\t\t\t\top.`flags`,\n\t\t\t\top.`recurring_next`,\n\t\t\t\top.`discount_next`,\n\t\t\t\top.`shipping_id`,\n\t\t\t\top.`next_gateway_id`,\n\t\t\t\tp.`product_price`,\n\t\t\t\tp.`product_sku`,\n\t\t\t\tp.`product_name`\n\t\t\tFROM `orders_products` as op\n\t\t\tJOIN `products` as p on p.`product_id` = op.`product_id`\t\t\n\t\t\tWHERE `order_id`=?i";
     $result = self::$_msql->getAll($sql, $orderID);
     if (!$result) {
         return array();
     }
     $orderProductsArr = array();
     foreach ($result as $item) {
         $t = new OrderProduct();
         //$t->allFIelds = true;
         $t->fillFromEnterArray($item);
         $t->IsNewRecord = false;
         $orderProductsArr[] = $t;
         unset($t);
     }
     return $orderProductsArr;
 }