Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

admin/orderview.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: orderview.php 8850 2002-01-02 21:42:12Z kaid $
5 //
6 // Created on: <30-Sep-2000 13:03:13 bf>
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 if ( isset( $Cancel ) )
28 {
29 eZHTTPTool::header( "Location: /trade/orderlist/" );
30 exit();
31 }
32
33 // include_once( "classes/INIFile.php" );
34 // include_once( "classes/eztemplate.php" );
35 // include_once( "classes/ezlocale.php" );
36 // include_once( "classes/ezcurrency.php" );
37 // include_once( "ezcontact/classes/ezperson.php" );
38 // include_once( "ezcontact/classes/ezcompany.php" );
39 // include_once( "ezuser/classes/ezuser.php" );
40
41
42 $ini =& eZINI::instance( 'site.ini' );
43 $Language = $ini->variable( "eZTradeMain", "Language" );
44 $ShowPriceGroups = $ini->variable( "eZTradeMain", "PriceGroupsEnabled" ) == "true";
45
46 $languageINI = new eZINI( "kernel/eztrade/user/intl/" . $Language . "/orderview.php.ini", false );
47
48
49 // include_once( "eztrade/classes/ezproductcategory.php" );
50 // include_once( "eztrade/classes/ezproduct.php" );
51 // include_once( "eztrade/classes/ezorder.php" );
52 // include_once( "eztrade/classes/ezcheckout.php" );
53 // include_once( "eztrade/classes/ezpricegroup.php" );
54
55 // include_once( "eztrade/classes/ezorderstatustype.php" );
56
57 $t = new eZTemplate( "kernel/eztrade/admin/" . $ini->variable( "eZTradeMain", "TemplateDir" ),
58 "kernel/eztrade/user/intl/", $Language, "orderview.php" );
59
60 $t->setAllStrings();
61
62 $t->set_file( "order_edit_tpl", "orderview.tpl" );
63
64 $t->set_block( "order_edit_tpl", "visa_tpl", "visa" );
65 $t->set_block( "order_edit_tpl", "mastercard_tpl", "mastercard" );
66 $t->set_block( "order_edit_tpl", "cod_tpl", "cod" );
67 $t->set_block( "order_edit_tpl", "invoice_tpl", "invoice" );
68
69 $t->set_block( "order_edit_tpl", "order_item_list_tpl", "order_item_list" );
70 $t->set_block( "order_item_list_tpl", "order_item_tpl", "order_item" );
71
72 $t->set_block( "order_item_tpl", "order_item_option_tpl", "order_item_option" );
73
74 $order = new eZOrder( $OrderID );
75
76 $user = eZUser::currentUser();
77
78 if ( !$user )
79 {
80 eZHTTPTool::header( "Location: /error/403/" );
81 exit();
82
83 }
84
85
86 // get the customer
87 /*
88 if ( !$order->isOwner( eZUser::currentUser() ) )
89 {
90 eZHTTPTool::header( "Location: /error/403" );
91 exit();
92 }
93 else
94 */
95
96 $localUser = $order->user();
97
98 if ( $localUser )
99 {
100 if ( $order->personID() == 0 && $order->companyID() == 0 )
101 {
102 $t->set_var( "customer_email", $localUser->email() );
103 $t->set_var( "customer_first_name", $localUser->firstName() );
104 $t->set_var( "customer_last_name", $localUser->lastName() );
105 }
106 else
107 {
108 if ( $order->personID() > 0 )
109 {
110 $customer = new eZPerson( $order->personID() );
111 $t->set_var( "customer_first_name", $customer->firstName() );
112 $t->set_var( "customer_last_name", $customer->lastName() );
113 }
114 else
115 {
116 $customer = new eZCompany( $order->companyID() );
117 $t->set_var( "customer_first_name", $customer->name() );
118 $t->set_var( "customer_last_name", "" );
119 }
120 $emailList = $customer->emailAddress();
121 $t->set_var( "customer_email", $emailList[0] );
122 }
123
124 // print out the addresses
125 $shippingAddress =& $order->shippingAddress();
126
127 $t->set_var( "shipping_street1", $shippingAddress->street1() );
128 $t->set_var( "shipping_street2", $shippingAddress->street2() );
129 $t->set_var( "shipping_zip", $shippingAddress->zip() );
130 $t->set_var( "shipping_place", $shippingAddress->place() );
131
132 if ( $order->personID() == 0 && $order->companyID() == 0 )
133 {
134 $shippingUser = $order->shippingUser();
135
136 if ( $shippingUser )
137 {
138 $t->set_var( "shipping_first_name", $shippingUser->firstName() );
139 $t->set_var( "shipping_last_name", $shippingUser->lastName() );
140 }
141 }
142 else
143 {
144 if ( $order->personID() > 0 )
145 {
146 $customer = new eZPerson( $order->personID() );
147 $t->set_var( "shipping_first_name", $customer->firstName() );
148 $t->set_var( "shipping_last_name", $customer->lastName() );
149 }
150 else
151 {
152 $customer = new eZCompany( $order->companyID() );
153 $t->set_var( "shipping_first_name", $customer->name() );
154 $t->set_var( "shipping_last_name", "" );
155 }
156 }
157
158 $region = $shippingAddress->region();
159 if ( is_object( $region ) )
160 {
161 $t->set_var( "shipping_region", $region->name() );
162 }
163 else
164 {
165 $t->set_var( "shipping_region", "" );
166 }
167
168 $country = $shippingAddress->country();
169 if ( is_object( $country ) )
170 {
171 $t->set_var( "shipping_country", $country->name() );
172 }
173 else
174 {
175 $t->set_var( "shipping_country", "" );
176 }
177 $billingAddress =& $order->billingAddress();
178
179 $t->set_var( "billing_street1", $billingAddress->street1() );
180 $t->set_var( "billing_street2", $billingAddress->street2() );
181 $t->set_var( "billing_zip", $billingAddress->zip() );
182 $t->set_var( "billing_place", $billingAddress->place() );
183
184 $PriceGroup = eZPriceGroup::correctPriceGroup( $localUser->groups( false ), true );
185
186 $region = $billingAddress->region();
187 if ( is_object( $region ) )
188 {
189 $t->set_var( "billing_region", $region->name() );
190 }
191 else
192 {
193 $t->set_var( "billing_region", "" );
194 }
195
196 $country = $billingAddress->country();
197 if ( is_object( $country ) )
198 {
199 $t->set_var( "billing_country", $country->name() );
200 }
201 else
202 {
203 $t->set_var( "billing_country", "" );
204 }
205 }
206
207 if( !isset( $OrderType ) )
208 $OrderType = false;
209
210 // fetch the order items
211 $items = $order->items( $OrderType );
212 $locale = new eZLocale( $Language );
213 $currency = new eZCurrency();
214
215 $i = 0;
216 $sum = 0.0;
217 $t->set_var( "product_image_caption", "" );
218
219
220 foreach ( $items as $item )
221 {
222 $product =& $item->product();
223
224 $image = $product->thumbnailImage();
225
226 if ( $image )
227 {
228 $thumbnail =& $image->requestImageVariation( 35, 35 );
229
230 $t->set_var( "product_image_path", "/" . $thumbnail->imagePath() );
231 $t->set_var( "product_image_width", $thumbnail->width() );
232 $t->set_var( "product_image_height", $thumbnail->height() );
233 $t->set_var( "product_image_caption", $image->caption() );
234 }
235
236 $price = $item->price() * $item->count();
237
238 $currency->setValue( $price );
239
240 $sum += $price;
241 $t->set_var( "product_name", $product->name() );
242 $t->set_var( "product_id", $product->id() );
243 $t->set_var( "product_number", $product->productNumber() );
244 $t->set_var( "product_price", $locale->format( $currency ) );
245
246 $t->set_var( "order_item_count", $item->count() );
247
248 if ( ( $i % 2 ) == 0 )
249 $t->set_var( "td_class", "bglight" );
250 else
251 $t->set_var( "td_class", "bgdark" );
252
253 $optionValues =& $item->optionValues();
254
255 $t->set_var( "order_item_option", "" );
256 foreach ( $optionValues as $optionValue )
257 {
258 $t->set_var( "option_name", $optionValue->optionName() );
259 $t->set_var( "option_value", $optionValue->valueName() );
260
261 $t->parse( "order_item_option", "order_item_option_tpl", true );
262 }
263 $t->parse( "order_item", "order_item_tpl", true );
264
265 $i++;
266 }
267 $shippingCost = $order->shippingCharge();
268
269 $currency->setValue( $shippingCost );
270 $t->set_var( "shipping_cost", $locale->format( $currency ) );
271
272 $totalVAT = $order->totalVAT();
273 $currency->setValue( $totalVAT );
274 $t->set_var( "vat_cost", $locale->format( $currency ) );
275 if ( $order->isVATInc() )
276 {
277 $sum = $order->totalPriceIncVAT() + $shippingCost;
278 $currency->setValue( $sum );
279 $t->set_var( "order_sum", $locale->format( $currency ) );
280 }
281 else
282 {
283 $sum += $shippingCost;
284 $currency->setValue( $sum );
285 $t->set_var( "order_sum", $locale->format( $currency ) );
286 }
287
288 $checkout = new eZCheckout();
289 $instance =& $checkout->instance();
290 $paymentMethod = $instance->paymentName( $order->paymentMethod() );
291
292 $t->set_var( "payment_method", $paymentMethod );
293
294 $shippingType = $order->shippingType();
295
296 $t->set_var( "shipping_method", "" );
297 if ( $shippingType )
298 {
299 $t->set_var( "shipping_method", $shippingType->name() );
300 }
301
302 $t->set_var( "order_id", $order->id() );
303
304 $t->parse( "order_item_list", "order_item_list_tpl" );
305
306 $t->pparse( "output", "order_edit_tpl" );
307
308 ?>
$shippingCost
foreach( $items as $item) $shippingCost
Definition: admin/orderview.php:267
$order
$order
Definition: admin/orderview.php:74
$shippingType
$shippingType
Definition: admin/orderview.php:294
$totalVAT
$totalVAT
Definition: admin/orderview.php:272
$currency
$currency
Definition: admin/orderview.php:213
$locale
$locale
Definition: admin/orderview.php:212
$t
$t
Definition: admin/orderview.php:57
$languageINI
$languageINI
Definition: admin/orderview.php:46
$user
$user
Definition: admin/orderview.php:76
$checkout
$checkout
Definition: admin/orderview.php:288
$items
$items
Definition: admin/orderview.php:211
$localUser
if(! $user) $localUser
Definition: admin/orderview.php:96
$i
$i
Definition: admin/orderview.php:215
$ini
if(isset( $Cancel)) $ini
Definition: admin/orderview.php:42
$Language
$Language
Definition: admin/orderview.php:43
$sum
$sum
Definition: admin/orderview.php:216
$paymentMethod
$paymentMethod
Definition: admin/orderview.php:290
$ShowPriceGroups
$ShowPriceGroups
Definition: admin/orderview.php:44
$instance
$instance
Definition: admin/orderview.php:289
$shippingAddress
$shippingAddress
Definition: checkout.php:615
eZCheckout
Definition: ezcheckout.php:48
eZCompany
Definition: ezcompany.php:54
eZCurrency
Definition: ezcurrency.php:46
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZINI
Reads and writes .ini style configuration files.
eZLocale
Definition: ezlocale.php:119
eZOrder
Definition: ezorder.php:52
eZPerson
Definition: ezperson.php:43
eZPriceGroup\correctPriceGroup
static correctPriceGroup( $group_id, $debug=false)
Definition: ezpricegroup.php:240
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$item
$item
Definition: classes/admin/linklist.php:228
$customer
$customer
Definition: customerview.php:72
$thumbnail
$thumbnail
Definition: ezarticle/admin/imagelist.php:59
exit
exit
Definition: folder.php:81
$product
$product
Definition: homepage.php:202
$country
$country
Definition: paypal.php:46
$billingAddress
$billingAddress
Definition: paypal.php:44
$region
$region
Definition: paypal.php:45
$price
$price
Definition: pricegroupedit.php:39
$PriceGroup
$PriceGroup
Definition: productedit.php:1073
$image
$image
Definition: user/articlelist.php:242
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.