summaryrefslogtreecommitdiff
path: root/classes/Cart.php
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 07:01:30 +0200
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 07:01:30 +0200
commit47cbb529f5723b246125ae083a193e11481b89ef (patch)
tree31ab20b2fbf12bee1cd994c3d6fb822fa52622e3 /classes/Cart.php
downloadclassroom-47cbb529f5723b246125ae083a193e11481b89ef.tar.gz
classroom-47cbb529f5723b246125ae083a193e11481b89ef.tar.bz2
classroom-47cbb529f5723b246125ae083a193e11481b89ef.zip
initializing classroom structure using anom framework
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