- forgot file for cart ;-)
authorpeter <peter@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sat, 3 Nov 2007 16:32:00 +0000 (16:32 +0000)
committerpeter <peter@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sat, 3 Nov 2007 16:32:00 +0000 (16:32 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@66 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

www/inc/cart_listing.php [new file with mode: 0644]

diff --git a/www/inc/cart_listing.php b/www/inc/cart_listing.php
new file mode 100644 (file)
index 0000000..c598e23
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+// +----------------------------------------------------------------------
+// | PHP Source                                                           
+// +----------------------------------------------------------------------
+// | Copyright (C) 2007 by Peter Keller <peter@silmor.de>
+// +----------------------------------------------------------------------
+// |
+// | Copyright: See COPYING file that comes with this distribution
+// +----------------------------------------------------------------------
+//
+
+function createCartOverview()
+{
+       global $parser;
+       global $error;
+       global $lang;
+       
+       $COOKIE_NAME = "ms_cartid";
+       
+       $cart = new Cart($_COOKIE[$COOKIE_NAME]);
+
+       $p = new Parser("cart.html");
+       
+       $details = "";
+       $totalsum = 0;
+       
+       // get tickets from cart
+       foreach ($cart->getTickets() as $ticket)
+       {
+               $cartRowTmpl = $p->getVar("ROW");
+               $event = $ticket->eventObject();
+               
+               // set event details
+               $p->setVars($event->getParserData());
+               $p->setVar("AMOUNT", $ticket->getAmount());
+               
+               $rowsum = $ticket->getAmount()*$event->getDefaultPrice();
+               $p->setVar("ROWSUM", $lang->getPrice($rowsum));
+               
+               $totalsum += $rowsum;
+               
+               $details .= $p->parse($cartRowTmpl);
+       }
+       
+       $p->setVar("TABLEROWS", $details);
+       $p->setVar("TOTALSUM", $lang->getPrice($totalsum));
+       
+       $p->setVar("fieldAMOUNT", "ms_amount[]");
+       $p->setVar("buttonSAVE", "ms_save");
+       $p->setVar("buttonORDER", "ms_order");
+       
+       // set error message
+       if ($error->exists()) {
+               $p->setVar("ERROR", "true");
+               $p->setVar("ERRORAREA", $error->getAllFormatted());
+       }
+
+       // create page
+       $parser->setVAR("PAGE", $p->parseFile("cart.html"));
+}
+
+
+?>