Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezcartvoucheritem.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezcartvoucheritem.php 7368 2001-09-21 09:59:05Z ce $
5 //
6 // Definition of eZCartItem class
7 //
8 // Created on: <27-Sep-2000 15:19:05 bf>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
31
47 // include_once( "classes/ezdb.php" );
48 // include_once( "eztrade/classes/ezcartitem.php" );
49 // include_once( "ezaddress/classes/ezonline.php" );
50 // include_once( "ezaddress/classes/ezaddress.php" );
51
52
53 class eZCartVoucherItem
54 {
61 function __construct( $id="" )
62 {
63 if ( $id != "" )
64 {
65 $this->ID = $id;
66 $this->get( $this->ID );
67 }
68 else
69 {
70 $this->Count = 1;
71 }
72 }
73
77 function store()
78 {
79 $db =& eZDB::globalDatabase();
80 $db->begin();
81
82 if ( !isset( $this->ID ) )
83 {
84 $db->lock( "eZTrade_CartVoucherItem" );
85 $nextID = $db->nextID( "eZTrade_CartVoucherItem", "ID" );
86
87 $res = $db->query( "INSERT INTO eZTrade_CartVoucherItem
88 ( ID, CartItemID, PriceRange, Description, MailMethod, MailID )
89 VALUES
90 ( '$nextID',
91 '$this->CartItemID',
92 '$this->PriceRange',
93 '$this->Description',
94 '$this->MailMethod',
95 '$this->MailID'
96 " );
97
98 $db->unlock();
99
100 $this->ID = $nextID;
101 }
102 else
103 {
104 $res = $db->query( "UPDATE eZTrade_CartVoucherItem SET
105 CartItemID='$this->CartItemID',
106 PriceRange='$this->PriceRange',
107 Description='$this->Description',
108 MailMethod='$this->MailMethod',
109 MailID='$this->MailID'
110 WHERE ID='$this->ID'
111 " );
112 }
113
114 if ( $res == false )
115 $db->rollback( );
116 else
117 $db->commit();
118
119 return true;
120 }
121
125 function get( $id="" )
126 {
127 $db =& eZDB::globalDatabase();
128 $ret = false;
129
130 if ( $id != "" )
131 {
132 $db->array_query( $cart_array, "SELECT * FROM eZTrade_CartVoucherItem WHERE ID='$id'" );
133 if ( count( $cart_array ) > 1 )
134 {
135 die( "Error: Cart's with the same ID was found in the database. This shouldent happen." );
136 }
137 else if( count( $cart_array ) == 1 )
138 {
139 $this->ID = $cart_array[0][$db->fieldName( "ID" )];
140 $this->CartItemID = $cart_array[0][$db->fieldName( "CartItemID" )];
141 $this->PriceRange = $cart_array[0][$db->fieldName( "PriceRange" )];
142 $this->Description = $cart_array[0][$db->fieldName( "Description" )];
143 $this->MailMethod = $cart_array[0][$db->fieldName( "MailMethod" )];
144 $this->MailID = $cart_array[0][$db->fieldName( "MailID" )];
145 $ret = true;
146 }
147 }
148 return $ret;
149 }
150
155 function delete()
156 {
157 $db =& eZDB::globalDatabase();
158 $db->begin();
159
160 $res[] = $db->query( "DELETE FROM eZTrade_CartVoucherItem WHERE ID='$this->ID'" );
161
162 if ( in_array( false, $res ) )
163 $db->rollback( );
164 else
165 $db->commit();
166
167 return true;
168 }
169
173 function id()
174 {
175 return $this->ID;
176 }
177
183 function mailMethod( )
184 {
185 return $this->MailMethod;
186 }
187
191 function setMailMethod( $value )
192 {
193 $this->MailMethod = $value;
194 }
195
199 function online( $asObject=true )
200 {
201 if ( $asObject )
202 $ret = new eZOnline( $this->MailID );
203 else
204 $ret = $this->MailID;
205
206 return $ret;
207 }
208
212 function address( $asObject=true )
213 {
214 if ( $asObject )
215 $ret = new eZAddress( $this->MailID );
216 else
217 $ret = $this->MailID;
218
219 return $ret;
220 }
221
222
223
227 function setMailMethod( $value )
228 {
229 $this->MailMethod = $value;
230 }
231
235 function setPriceRange( $value )
236 {
237 $this->PriceRange = $value;
238 }
239
243 function priceRange( )
244 {
245 return $this->PriceRange;
246 }
247
248 var $ID;
249 var $CartItemID;
250 var $PriceRange;
251 var $Description;
252 var $MailMethod=0;
253 var $MailID=false;
254
256 var $WishListItemID;
257 }
258
259 ?>
eZAddress
Definition: ezaddress.php:42
eZCartVoucherItem
Definition: ezcartvoucheritem.php:54
eZCartVoucherItem\online
online( $asObject=true)
Definition: ezcartvoucheritem.php:199
eZCartVoucherItem\$WishListItemID
$WishListItemID
ID to a wishlist item. Indicates which wishlistitem the cart item comes from. 0 if added from product...
Definition: ezcartvoucheritem.php:256
eZCartVoucherItem\$PriceRange
$PriceRange
Definition: ezcartvoucheritem.php:250
eZCartVoucherItem\mailMethod
mailMethod()
Definition: ezcartvoucheritem.php:183
eZCartVoucherItem\setPriceRange
setPriceRange( $value)
Definition: ezcartvoucheritem.php:235
eZCartVoucherItem\address
address( $asObject=true)
Definition: ezcartvoucheritem.php:212
eZCartVoucherItem\$ID
$ID
Definition: ezcartvoucheritem.php:248
eZCartVoucherItem\$Description
$Description
Definition: ezcartvoucheritem.php:251
eZCartVoucherItem\$CartItemID
$CartItemID
Definition: ezcartvoucheritem.php:249
eZCartVoucherItem\store
store()
Definition: ezcartvoucheritem.php:77
eZCartVoucherItem\setMailMethod
setMailMethod( $value)
Definition: ezcartvoucheritem.php:191
eZCartVoucherItem\$MailMethod
$MailMethod
Definition: ezcartvoucheritem.php:252
eZCartVoucherItem\$MailID
$MailID
Definition: ezcartvoucheritem.php:253
eZCartVoucherItem\id
id()
Definition: ezcartvoucheritem.php:173
eZCartVoucherItem\priceRange
priceRange()
Definition: ezcartvoucheritem.php:243
eZCartVoucherItem\__construct
__construct( $id="")
Definition: ezcartvoucheritem.php:61
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
$id
$id
Definition: companytypelist.php:193
$db
$db
Definition: ezarticle/user/authorlist.php:53
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
$res
$res
Definition: ezstats/admin/cron.php:45
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.