summaryrefslogtreecommitdiff
path: root/core/classes/Cart.php
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-04-27 03:47:30 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-04-27 03:47:30 +0300
commit059e0d95d0c28bc5060e87e146eaf7411f51bf90 (patch)
tree7c21ac432f16dde2329a0d5954d70711eceb48e6 /core/classes/Cart.php
parent26cd8ee99659ef1926c96a049c93645ffc9b169d (diff)
downloadgyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.tar.gz
gyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.tar.bz2
gyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.zip
skeleton commit; based on an anom project
Diffstat (limited to 'core/classes/Cart.php')
-rw-r--r--core/classes/Cart.php71
1 files changed, 71 insertions, 0 deletions
diff --git a/core/classes/Cart.php b/core/classes/Cart.php
new file mode 100644
index 0000000..4e6f585
--- /dev/null
+++ b/core/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