/** * Get the order record * * Method will return the order record * * @access public * @param int $orderId The order ID * @return array The order array on success, NULL if no record could be found, FALSE on error */ public function get($orderId) { if (!isId($orderId)) { return false; } $entity = array(); $result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]orders WHERE orderid=" . (int) $orderId); if (!($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result))) { return null; } $entity = $row; $customer = new ISC_ENTITY_CUSTOMER(); $entity['customer'] = $customer->get($entity['ordcustid']); $product = new ISC_ENTITY_PRODUCT(); $entity['products'] = array(); $result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]order_products WHERE orderorderid=" . (int) $orderId); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $entity['products'][] = $product->get($row['ordprodid']); $key = count($entity['products']) - 1; $entity['products'][$key]['prodorderquantity'] = $row['ordprodqty']; $entity['products'][$key]['prodorderamount'] = $row['ordprodcost']; } return $entity; }