From 182b21a5d6309b741df32a41a02945688e56ace9 Mon Sep 17 00:00:00 2001 From: konrad Date: Tue, 16 Oct 2007 06:53:38 +0000 Subject: [PATCH] second draft of cart class git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@55 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- www/inc/cart.php | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/www/inc/cart.php b/www/inc/cart.php index 41c8143..9b741e3 100644 --- a/www/inc/cart.php +++ b/www/inc/cart.php @@ -30,10 +30,12 @@ class CartTicket public function changeAmount($amt) { global $db; - if($amd<=0){ + if($amt<=0){ $db->deleteRows("cart_ticket","cartid='".addslashes($this->cartid)."' and eventid=".$this->eventid); + $this->amount=0; }else{ $db->update("cart_ticket",array("amount"=>($amt+0)),"cartid='".addslashes($this->cartid)."' and eventid=".$this->eventid); + $this->amount=$amt; } } @@ -42,6 +44,18 @@ class CartTicket { return new Event($this->eventid); } + + /**return the eventID*/ + public function getEventId() + { + return $this->eventid; + } + + /**return the current amount*/ + public function getAmount() + { + return $this->amount; + } }; /**this class represents a shopping cart*/ @@ -82,6 +96,12 @@ class Cart return $this->cartid!==false; } + /**returns the ID of this cart, returns false if the cart is not valid*/ + public function getCartId() + { + return $this->cartid; + } + /**use this to get all existing tickets in this cart, then manipulate the tickets directly*/ public function getTickets() { -- 1.7.2.5