Orders
Orders are your most important collection in the platform. It consists every detail necessary for fullfilling a delivery for purchased products.
Why are some orders semi transparent?
Order statuses without an order status are considered corrupt/incomplete/unprocessed. These are given the name Unprocessed and possesses the order status id 0. Some payment modules can save an order before the transaction is initiated, and upon a failed transaction verification the order is not completed.
In case the transaction was successful but something failed during verification, the order can easily be recovered by editing it manually.
Entity Object
$order = new ent_order();
$order->data['customer']['email'] = 'user@email.com';
$order->add_item($item);
$order->save();
Reference Model
Orders doesn't have a reference object. Instead, values from the entity will be returned.
echo reference::order($order_id)->customer['company'];
Database Query
Fetch a single order
$order = database::query(
"select * from ". DB_TABLE_PREFIX ."orders
where id = ". (int)$order_id ."
limit 1;"
)->fetch();
Fetch all orders flagged as sales
$orders = database::query(
"select * from ". DB_TABLE_PREFIX ."orders
where order_status_id in (
select id from ". DB_TABLE_PREFIX ."order_statuses
where is_sale
)
order by date_created asc;"
)->fetch_all();