summaryrefslogtreecommitdiff
path: root/classes/Cart.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Cart.php')
-rw-r--r--classes/Cart.php71
1 files changed, 71 insertions, 0 deletions
diff --git a/classes/Cart.php b/classes/Cart.php
new file mode 100644
index 0000000..4e6f585
--- /dev/null
+++ b/classes/Cart.php
@@ -0,0 +1,71 @@
+<?php
+
+class Cart
+{
+
+ public function checkout()
+ {
+
+ }
+
+ public function addOrder()
+ {
+ // get cart from cookie
+ // VITAL: validate + sanitize
+ //
+ // then
+ //
+ // get address and contact details from post
+ }
+
+
+ /** history
+ * get the last $limit cart-orders
+ * @param $limit (int)
+ */
+ public function history($limit)
+ {
+ // SELECT O.* , OP.* , P.*
+ // FROM orders O
+ // lEFT JOIN order_products OP ON OP.oid = O.id
+ // LEFT JOIN products P ON P.id = OP.pid
+ // WHERE uid = :uid
+ // AND O.id IN (
+ // SELECT id FROM orders WHERE uid = :uid
+ // ORDER BY id DESC
+ // )
+ //
+ // $items = runLimitQuery(sql, [uid = $this->uid], 10)
+ //
+ // oranize in results = [
+ // {
+ // oid,
+ // prods: [
+ // {
+ // pid,
+ // prodlabel,
+ // count
+ // },
+ // ...
+ // ]
+ // },
+ // ...,
+ // ]
+ //
+ // return $results
+
+ }
+}
+
+
+
+/* ---
+orders:
+ : id
+ : uid (user id)
+
+order_products
+ : id
+ : oid (order id)
+ : pid (product id)
+ -- */ \ No newline at end of file