Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

voucherinformation.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: voucherinformation.php 8119 2001-10-31 11:19:09Z ce $
5 //
6 // Created on: <06-Aug-2001 13:02:18 ce>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/INIFile.php" );
28 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezlocale.php" );
30 // include_once( "classes/ezcurrency.php" );
31 // include_once( "classes/ezhttptool.php" );
32
33 $ini =& eZINI::instance( 'site.ini' );
34
35 $Language = $ini->variable( "eZTradeMain", "Language" );
36 $locale = new eZLocale( $Language );
37
38 // include_once( "ezuser/classes/ezuser.php" );
39 // include_once( "ezuser/classes/ezuser.php" );
40
41 // include_once( "eztrade/classes/ezproduct.php" );
42 // include_once( "eztrade/classes/ezvoucherinformation.php" );
43 // include_once( "eztrade/classes/ezproduct.php" );
44 // include_once( "eztrade/classes/ezproductpricerange.php" );
45 // include_once( "ezsession/classes/ezsession.php" );
46
47 $t = new eZTemplate( "kernel/eztrade/user/" . $ini->variable( "eZTradeMain", "TemplateDir" ),
48 "kernel/eztrade/user/intl/", $Language, "voucherinformation.php" );
49
50 $t->setAllStrings();
51
52 $t->set_file( "voucher_tpl", "voucherinformation.tpl" );
53
54 $t->set_block( "voucher_tpl", "email_tpl", "email" );
55 $t->set_block( "voucher_tpl", "smail_tpl", "smail" );
56
57 setType( $PriceRange, "integer" );
58
59 $t->set_var( "email_var", "" );
60 $t->set_var( "to_name", "" );
61 $t->set_var( "from_name", "" );
62 $t->set_var( "smail_var", "" );
63 $t->set_var( "email_text", "" );
64 $t->set_var( "smail_text", "" );
65 $t->set_var( "next", "" );
66 $t->set_var( "name_value", "" );
67 $t->set_var( "street1_value", "" );
68 $t->set_var( "street2_value", "" );
69 $t->set_var( "zip_value", "" );
70 $t->set_var( "place_value", "" );
71 $t->set_var( "country_name", "" );
72 $t->set_var( "smail", "" );
73 $t->set_var( "email", "" );
74 $t->set_var( "from_email", "" );
75
76 $user =& eZUser::currentUser();
77
78 $product = new eZProduct( $ProductID );
79
80 if ( $product && isset( $OK ) )
81 {
82 $voucherInfo = new eZVoucherInformation();
83
84 if ( $Mail == 1 )
85 {
86 $online = new eZOnline();
87 $online->setUrl( $Email );
88 $online->store();
89 $voucherInfo->setEmail( $online );
90 }
91 else if ( $Mail == 2 )
92 {
93 $toAddress = new eZAddress();
94 $toAddress->setName( $ToName );
95 $toAddress->setStreet1( $ToStreet1 );
96 $toAddress->setStreet2( $ToStreet2 );
97 $toAddress->setZip( $ToZip );
98 $toAddress->setPlace( $ToPlace );
99 $toAddress->store();
100 $voucherInfo->setToAddress( $toAddress );
101
102 $fromAddress = new eZAddress();
103 $fromAddress->setName( $FromName );
104 $fromAddress->setStreet1( $FromStreet1 );
105 $fromAddress->setStreet2( $FromStreet2 );
106 $fromAddress->setZip( $FromZip );
107 $fromAddress->setPlace( $FromPlace );
108 $fromAddress->sfromre();
109 $voucherInfo->setFromAddress( $fromAddress );
110 }
111
112 $online = new eZOnline();
113 $online->setUrl( $FromEmail );
114 $online->store();
115 $voucherInfo->setFromEmail( $online );
116 $voucherInfo->setMailMethod( $Mail );
117 $voucherInfo->setFromName( $FromName );
118 $voucherInfo->setFromName( $FromName );
119 $voucherInfo->setToName( $ToName );
120 $voucherInfo->setProduct( $product );
121
122 $voucherInfo->setDescription( $Description );
123
124 if ( $Price == 0 )
125 {
126 $priceRange =& $product->priceRange();
127 $voucherInfo->setPrice( $priceRange->min() );
128 }
129 else
130 $voucherInfo->setPrice( $Price );
131
132
133 $voucherInfo->store();
134
135 $voucherInformationID = $voucherInfo->id();
136
137 $session->setVariable( "VoucherInformationID", $voucherInformationID );
138
139 if ( isset ( $OK ) && $voucherInformationID )
140 {
141 eZHTTPTool::header( "Location: /trade/cart/add/$ProductID/" );
142 exit();
143 }
144 }
145 else if ( $product )
146 {
147 $range = $product->priceRange();
148 $error = false;
149 if ( ( $range->min() != 0 ) && ( $range->min() > $PriceRange ) )
150 {
151 $error = true;
152 }
153 if ( ( $range->max() != 0 ) && ( $range->max() < $PriceRange ) )
154 {
155 $error = true;
156 }
157
158 if ( $error )
159 {
160 eZHTTPTool::header( "Location: /trade/productview/$ProductID/" );
161 exit();
162 }
163
164 if ( $MailMethod == 1 )
165 {
166 $t->set_var( "smail", "" );
167 $t->parse( "email", "email_tpl" );
168 }
169 else if ( $MailMethod == 2 )
170 {
171 $t->set_var( "email", "" );
172 $t->parse( "smail", "smail_tpl" );
173 }
174
175 $t->set_var( "mail_method", $MailMethod );
176 $t->set_var( "product_name", $product->name() );
177 $t->set_var( "product_id", $product->id() );
178
179 $currency = new eZCurrency();
180
181 if ( $PriceRange == 0 )
182 {
183 $priceRange =& $product->priceRange();
184 $currency->setValue( $priceRange->min() );
185 $t->set_var( "product_price", $locale->format( $currency ) );
186 $t->set_var( "price_range", $priceRange->min() );
187 }
188 else
189 {
190 $currency->setValue( $PriceRange );
191 $t->set_var( "price_range", $PriceRange );
192 $t->set_var( "product_price", $locale->format( $currency ) );
193 }
194 }
195
196
197 $t->pparse( "output", "voucher_tpl" );
198
199 ?>
$session
$session
Definition: admin/articlelist.php:44
$Email
$Email
Definition: admin/useredit.php:414
$Description
$Description
Definition: articlelistrss.php:38
eZAddress
Definition: ezaddress.php:42
eZCurrency
Definition: ezcurrency.php:46
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZLocale
Definition: ezlocale.php:119
eZProduct
Definition: ezproduct.php:71
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
eZVoucherInformation
Definition: ezvoucherinformation.php:55
$currency
$currency
Definition: companyview.php:529
$error
$error
Definition: ezarticle/admin/categoryedit.php:51
$priceRange
$priceRange
Definition: eztrade/user/extendedsearch.php:85
exit
exit
Definition: folder.php:81
$MailMethod
$MailMethod
Definition: productview.php:260
$locale
$locale
Definition: voucherinformation.php:36
$t
$t
Definition: voucherinformation.php:47
$user
$user
Definition: voucherinformation.php:76
$product
$product
Definition: voucherinformation.php:78
$Language
$Language
Definition: voucherinformation.php:35
$ini
$ini
Definition: voucherinformation.php:33
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.