Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

orderedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: orderedit.php 9167 2002-02-07 08:39:29Z jhe $
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 // include_once( "classes/ezhttptool.php" );
30 eZHTTPTool::header( "Location: /trade/orderlist/" );
31 exit();
32 }
33
34 // include_once( "classes/INIFile.php" );
35 // include_once( "classes/eztemplate.php" );
36 // include_once( "classes/ezlocale.php" );
37 // include_once( "classes/ezcurrency.php" );
38 // include_once( "ezcontact/classes/ezperson.php" );
39 // include_once( "ezcontact/classes/ezcompany.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/admin/intl/" . $Language . "/orderedit.php.ini", false );
47
48 $PricesIncludeVAT = $ini->variable( "eZTradeMain", "PricesIncludeVAT" );
49 // Unclear: $PricesIncludeVAT = $ini->variable( "eZTradeMain", "PricesIncludeVAT" ) == "enabled" && $total["shiptax"] ? true : false;
50
51 $ShowExTaxColumn = $ini->variable( "eZTradeMain", "AdminShowExTaxColumn" ) == "enabled" ? true : false;
52 //$ShowIncTaxColumn = $ini->variable( "eZTradeMain", "AdminShowIncTaxColumn" ) == "enabled" && $total["shiptax"] ? true : false;
53 // Unclear:$ShowIncTaxColumn = $total["shiptax"] ? true : false;
54 $ShowExTaxTotal = $ini->variable( "eZTradeMain", "ShowExTaxTotal" ) == "enabled" ? true : false;
55 $ColSpanSizeTotals = $ini->variable( "eZTradeMain", "ColSpanSizeTotals" );
56 $wwwDir = $ini->variable( "site", "UserSiteURL" );
57 $adminEmail = $ini->variable( "eZTradeMain", "mailToAdmin" );
58 $upscheck = $ini->variable( "eZTradeMain", "UPSXMLShipping" )=="enabled"?1:0;
59 $uspscheck = $ini->variable( "eZTradeMain", "USPSXMLShipping" )=="enabled"?1:0;
60 if(($upscheck==0)&&($uspscheck==0))
61 $checkups=0;
62 else
63 $checkups=1;
64
65 $tester = 0;
66 if ( $Action == "newstatus" )
67 {
68 $status = new eZOrderStatus();
69
70 // store the status
71 $statusType = new eZOrderStatusType( $StatusID );
72
73 $status = new eZOrderStatus();
74 $status->setType( $statusType );
75 $status->setComment( $StatusComment );
76 $status->setOrderID( $OrderID );
77
78 $user =& eZUser::currentUser();
79
80 $status->setAdmin( $user );
81
82 $status->store();
83
84 //send customer email notice of status change
85 if ( $MailNotice == "on" )
86 {
87 $mailTemplate = new eZTemplate( "eztrade/admin/" . $ini->variable( "eZTradeMain", "AdminTemplateDir" ),
88 "eztrade/admin/intl/", $Language, "orderedit.php" );
89
90 $mailTemplate->setAllStrings();
91
92 $subjectLine = $mailTemplate->Ini->variable( "strings", "subject" );
93 $subjectLine = $subjectLine . " #" . $OrderID;
94
95 $statusName = preg_replace( "#intl-#", "", $statusType->Name() );
96 $statusName = $mailTemplate->Ini->variable( "strings", "reason" ).": ".$statusName;
97 $StatusComment = $mailTemplate->Ini->variable( "strings", "comment" ).": ".$StatusComment;
98
99 $MailBody = "$MailBody\n";
100 $MailBody .= "========================================\n";
101 $MailBody .= "$statusName\n";
102 $MailBody .= "$StatusComment";
103
104 // send a notice mail
105 $noticeMail = new eZMail();
106
107 $noticeMail->setFrom( $adminEmail );
108 // $noticeMail->setCc( $adminEmail );
109
110 $noticeMail->setTo( $CustomerEmail );
111
112 $noticeMail->setSubject( $subjectLine );
113 $noticeMail->setBodyText( $MailBody );
114
115 $noticeMail->send();
116 }
117
118
119 include_once( "classes/ezhttptool.php" );
120 eZHTTPTool::header( "Location: /trade/orderedit/$OrderID" );
121 exit();
122 }
123
124
125 if ( $Action == "delete" )
126 {
127 $order = new eZOrder( $OrderID );
128 $order->delete();
129
130 // include_once( "classes/ezhttptool.php" );
131 eZHTTPTool::header( "Location: /trade/orderlist/" );
132 exit();
133 }
134
135 $t = new eZTemplate( "kernel/eztrade/admin/" . $ini->variable( "eZTradeMain", "AdminTemplateDir" ),
136 "kernel/eztrade/admin/intl/", $Language, "orderedit.php" );
137
138 $t->setAllStrings();
139
140 $t->set_file( "order_edit_tpl", "orderedit.tpl" );
141
142 $t->set_block( "order_edit_tpl", "visa_tpl", "visa" );
143 $t->set_block( "order_edit_tpl", "mastercard_tpl", "mastercard" );
144 $t->set_block( "order_edit_tpl", "cod_tpl", "cod" );
145 $t->set_block( "order_edit_tpl", "invoice_tpl", "invoice" );
146 $t->set_block( "order_edit_tpl", "email_followup_tpl", "email_followup" );
147
148 $t->set_block( "order_edit_tpl", "order_status_option_tpl", "order_status_option" );
149 $t->set_block( "order_edit_tpl", "order_status_history_tpl", "order_status_history" );
150
151 $t->set_block( "order_edit_tpl", "full_cart_tpl", "full_cart" );
152 $t->set_block( "full_cart_tpl", "cart_item_list_tpl", "cart_item_list" );
153 $t->set_block( "cart_item_list_tpl", "header_savings_item_tpl", "header_savings_item" );
154 $t->set_block( "cart_item_list_tpl", "header_inc_tax_item_tpl", "header_inc_tax_item" );
155 $t->set_block( "cart_item_list_tpl", "header_ex_tax_item_tpl", "header_ex_tax_item" );
156
157 $t->set_block( "full_cart_tpl", "voucher_item_list_tpl", "voucher_item_list" );
158 $t->set_block( "voucher_item_list_tpl", "voucher_used_header_inc_tax_item_tpl", "voucher_used_header_inc_tax_item" );
159 $t->set_block( "voucher_item_list_tpl", "voucher_used_header_ex_tax_item_tpl", "voucher_used_header_ex_tax_item" );
160 $t->set_block( "voucher_item_list_tpl", "voucher_left_header_inc_tax_item_tpl", "voucher_left_header_inc_tax_item" );
161 $t->set_block( "voucher_item_list_tpl", "voucher_left_header_ex_tax_item_tpl", "voucher_left_header_ex_tax_item" );
162 $t->set_block( "voucher_item_list_tpl", "voucher_item_tpl", "voucher_item" );
163 $t->set_block( "voucher_item_tpl", "voucher_used_inc_tax_item_tpl", "voucher_used_inc_tax_item" );
164 $t->set_block( "voucher_item_tpl", "voucher_used_ex_tax_item_tpl", "voucher_used_ex_tax_item" );
165 $t->set_block( "voucher_item_tpl", "voucher_left_inc_tax_item_tpl", "voucher_left_inc_tax_item" );
166 $t->set_block( "voucher_item_tpl", "voucher_left_ex_tax_item_tpl", "voucher_left_ex_tax_item" );
167
168 $t->set_block( "full_cart_tpl", "total_ex_tax_item_tpl", "total_ex_tax_item" );
169 $t->set_block( "full_cart_tpl", "total_inc_tax_item_tpl", "total_inc_tax_item" );
170 $t->set_block( "full_cart_tpl", "subtotal_ex_tax_item_tpl", "subtotal_ex_tax_item" );
171 $t->set_block( "full_cart_tpl", "subtotal_inc_tax_item_tpl", "subtotal_inc_tax_item" );
172 $t->set_block( "full_cart_tpl", "shipping_ex_tax_item_tpl", "shipping_ex_tax_item" );
173 $t->set_block( "full_cart_tpl", "shipping_inc_tax_item_tpl", "shipping_inc_tax_item" );
174
175 $t->set_block( "cart_item_list_tpl", "cart_item_tpl", "cart_item" );
176 $t->set_block( "cart_item_tpl", "cart_savings_item_tpl", "cart_savings_item" );
177 $t->set_block( "cart_item_tpl", "cart_inc_tax_item_tpl", "cart_inc_tax_item" );
178 $t->set_block( "cart_item_tpl", "cart_ex_tax_item_tpl", "cart_ex_tax_item" );
179
180 $t->set_block( "cart_item_tpl", "cart_item_option_tpl", "cart_item_option" );
181 $t->set_block( "cart_item_option_tpl", "option_savings_item_tpl", "option_savings_item" );
182 $t->set_block( "cart_item_option_tpl", "option_inc_tax_item_tpl", "option_inc_tax_item" );
183 $t->set_block( "cart_item_option_tpl", "option_ex_tax_item_tpl", "option_ex_tax_item" );
184
185 $t->set_block( "cart_item_tpl", "cart_item_basis_tpl", "cart_item_basis" );
186 $t->set_block( "cart_item_basis_tpl", "basis_savings_item_tpl", "basis_savings_item" );
187 $t->set_block( "cart_item_basis_tpl", "basis_inc_tax_item_tpl", "basis_inc_tax_item" );
188 $t->set_block( "cart_item_basis_tpl", "basis_ex_tax_item_tpl", "basis_ex_tax_item" );
189
190 $t->set_block( "full_cart_tpl", "tax_specification_tpl", "tax_specification" );
191 $t->set_block( "tax_specification_tpl", "tax_item_tpl", "tax_item" );
192
193 $order = new eZOrder( $OrderID );
194
195 // get the customer
196
197 $user = $order->user();
198
199 if ( $user )
200 {
201
202 if ( $order->personID() == 0 && $order->companyID() == 0 )
203 {
204 $t->set_var( "customer_email", $user->email() );
205 $t->set_var( "customer_id", $user->id() );
206 $t->set_var( "customer_first_name", $user->firstName() );
207 $t->set_var( "customer_last_name", $user->lastName() );
208 }
209 else
210 {
211 if ( $order->personID() > 0 )
212 {
213 $customer = new eZPerson( $order->personID() );
214 $t->set_var( "customer_first_name", $customer->firstName() );
215 $t->set_var( "customer_last_name", $customer->lastName() );
216 }
217 else
218 {
219 $customer = new eZCompany( $order->companyID() );
220 $t->set_var( "customer_first_name", $customer->name() );
221 $t->set_var( "customer_last_name", "" );
222 }
223 $emailList = $customer->emailAddress();
224 $t->set_var( "customer_email", $emailList[0] );
225 }
226
227 // print preorder id
228 $preOrderId = new eZPreOrder();
229 $preOrderId->getByOrderId( $OrderID );
230 if ( $preOrderId->id() )
231 {
232 $t->set_var( "preorder_id", $preOrderId->id() );
233 }
234 else
235 {
236 $t->set_var( "preorder_id", "" );
237 }
238
239 // print out the addresses
240 $shippingAddress =& $order->shippingAddress();
241
242 $t->set_var( "shipping_street1", $shippingAddress->street1() );
243 $t->set_var( "shipping_street2", $shippingAddress->street2() );
244 $t->set_var( "shipping_zip", $shippingAddress->zip() );
245 $t->set_var( "shipping_place", $shippingAddress->place() );
246 $t->set_var( "shipping_phone", $shippingAddress->phone() );
247
248 if ( $order->personID() == 0 && $order->companyID() == 0 )
249 {
250 $shippingUser = $order->shippingUser();
251
252 if ( $shippingUser )
253 {
254 $t->set_var( "shipping_first_name", $shippingUser->firstName() );
255 $t->set_var( "shipping_last_name", $shippingUser->lastName() );
256 }
257 }
258 else
259 {
260
261 if ( $order->personID() > 0 )
262 {
263 $customer = new eZPerson( $order->personID() );
264 $t->set_var( "shipping_first_name", $customer->firstName() );
265 $t->set_var( "shipping_last_name", $customer->lastName() );
266 }
267 else
268 {
269 $customer = new eZCompany( $order->companyID() );
270 $t->set_var( "shipping_first_name", $customer->name() );
271 $t->set_var( "shipping_last_name", "" );
272 }
273 }
274 $country = $shippingAddress->country();
275 if ( is_object( $country ) )
276 {
277 $t->set_var( "shipping_country", $country->name() );
278 }
279 else
280 {
281 $t->set_var( "shipping_country", "" );
282 }
283
284 $region = $shippingAddress->region();
285
286 if ( is_object( $region ) )
287 {
288 $t->set_var( "shipping_region", $region->name() );
289 }
290 else
291 {
292 $t->set_var( "shipping_region", "" );
293 }
294
295 $billingAddress =& $order->billingAddress();
296
297 $t->set_var( "billing_street1", $billingAddress->street1() );
298 $t->set_var( "billing_street2", $billingAddress->street2() );
299 $t->set_var( "billing_zip", $billingAddress->zip() );
300 $t->set_var( "billing_place", $billingAddress->place() );
301 $t->set_var( "billing_phone", $billingAddress->phone() );
302
303 $PriceGroup = eZPriceGroup::correctPriceGroup( $user->groups( false ) );
304
305 $country = $billingAddress->country();
306 if ( is_object( $country ) )
307 {
308 $t->set_var( "billing_country", $country->name() );
309 }
310 else
311 {
312 $t->set_var( "billing_country", "" );
313 }
314
315 $region = $billingAddress->region();
316
317 if ( is_object( $region ) )
318 {
319 $t->set_var( "billing_region", $region->name() );
320 // $t->set_var( "billing_region", $region->Abbreviation() );
321 }
322 else
323 {
324 $t->set_var( "billing_region", "" );
325 }
326 }
327
328 // fetch the order items
329 if ( $Action == "edit" )
330 {
331 // fetch the order items
332 $items = $order->items( $OrderType );
333 }
334 else
335 {
336 $items = $order->items();
337 }
338
339 $locale = new eZLocale( $Language );
340 $currency = new eZCurrency();
341
342 $i = 0;
343 $sum = 0.0;
344 $totalVAT = 0.0;
345
346 function turnColumnsOnOff( $rowName, $t = false, $ShowSavingsColumn = false, $ShowExTaxColumn = false, $ShowIncTaxColumn = false )
347 {
348 if ( $ShowSavingsColumn == true )
349 {
350 $t->parse( $rowName . "_savings_item", $rowName . "_savings_item_tpl" );
351 }
352 else
353 {
354 $t->set_var( $rowName . "_savings_item", "" );
355 }
356
357 if ( $ShowExTaxColumn == true )
358 {
359 $t->parse( $rowName . "_ex_tax_item", $rowName . "_ex_tax_item_tpl" );
360 }
361 else
362 {
363 $t->set_var( $rowName . "_ex_tax_item", "" );
364 }
365
366 $t->parse( $rowName . "_inc_tax_item", $rowName . "_inc_tax_item_tpl" );
367 /*
368 if ($total["shiptax"] or $ShowIncTaxColumn == true )
369 {
370 $t->parse( $rowName . "_inc_tax_item", $rowName . "_inc_tax_item_tpl" );
371 }
372 else
373 {
374 $t->set_var( $rowName . "_inc_tax_item", "" );
375 }
376 */
377 }
378
379 $locale = new eZLocale( $Language );
380 $currency = new eZCurrency();
381
382 $numberOfItems = 0;
383 $j = 0;
384
385 foreach ( $items as $item )
386 {
387 $t->set_var( "td_class", ( $j % 2 ) == 0 ? "bglight" : "bgdark" );
388 $j++;
389 $t->set_var( "cart_item_id", $item->id() );
390 $product =& $item->product();
391 $vatPercentage = $product->vatPercentage();
392 $productHasVAT = $product->priceIncVAT();
393
394 $t->set_var( "product_id", $product->id() );
395 $t->set_var( "product_name", $product->name() );
396 $t->set_var( "product_number", $product->productNumber() );
397 $t->set_var( "product_price", $item->localePrice( false, true, $PricesIncludeVAT ) );
398 $t->set_var( "product_count", $item->count() );
399 $t->set_var( "product_total_ex_tax", $item->localePrice( true, true, false ) );
400 $t->set_var( "product_total_inc_tax", $item->localePrice( true, true, true ) );
401
402 $numberOfItems++;
403
404 $numberOfOptions = 0;
405
406 $optionValues =& $item->optionValues();
407
408 $t->set_var( "cart_item_option", "" );
409 $t->set_var( "cart_item_basis", "" );
410
411 foreach ( $optionValues as $optionValue )
412 {
413 turnColumnsOnOff( "option", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
414
415 $t->set_var( "option_id", "" );
416 $t->set_var( "option_name", $optionValue->valueName() );
417 $t->set_var( "option_value", $optionValue->optionName() );
418 $t->set_var( "option_price", "" );
419 $t->parse( "cart_item_option", "cart_item_option_tpl", true );
420
421 $numberOfOptions++;
422 }
423 turnColumnsOnOff( "cart", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
424 turnColumnsOnOff( "basis", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
425
426 if ( $numberOfOptions == 0 )
427 {
428 $t->set_var( "cart_item_option", "" );
429 $t->set_var( "cart_item_basis", "" );
430 }
431 else
432 {
433 if ( false )
434 {
435 $t->set_var( "basis_price", $item->localePrice( false, false, $PricesIncludeVAT ) );
436 $t->parse( "cart_item_basis", "cart_item_basis_tpl", true );
437 }
438 else
439 {
440 $t->set_var( "cart_item_basis", "" );
441 }
442 }
443
444 $t->parse( "cart_item", "cart_item_tpl", true );
445 }
446
447 if ( $numberOfItems > 0 )
448 {
449 $ShowCart = true;
450 }
451
452 $t->setAllStrings();
453
454 turnColumnsOnOff( "header", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
455
456 if ( $ShowCart == true )
457 {
458
459 $order->orderTotals( $tax, $total );
460 if($total["shiptax"]){
461 $ShowIncTaxColumn = true;
462 }
463
464 $t->set_var( "empty_cart", "" );
465
466 $currency->setValue( $total["subinctax"] );
467 $t->set_var( "subtotal_inc_tax", $locale->format( $currency ) );
468
469 $currency->setValue( $total["subextax"] );
470 $t->set_var( "subtotal_ex_tax", $locale->format( $currency ) );
471
472 $currency->setValue( $total["inctax"] );
473 $t->set_var( "total_inc_tax", $locale->format( $currency ) );
474
475 $currency->setValue( $total["extax"] );
476 $t->set_var( "total_ex_tax", $locale->format( $currency ) );
477
478 $currency->setValue( $total["shipinctax"] );
479 $t->set_var( "shipping_inc_tax", $locale->format( $currency ) );
480
481 $currency->setValue( $total["shipextax"] );
482 $t->set_var( "shipping_ex_tax", $locale->format( $currency ) );
483
484 if ( $ShowSavingsColumn == false )
485 {
486 $ColSpanSizeTotals--;
487 }
488
489 $SubTotalsColumns = $ColSpanSizeTotals;
490
491 if ( $ShowExTaxColumn == true )
492 {
493 if ( $ShowExTaxTotal == true or $ShowIncTaxColumn == false )
494 {
495 $t->parse( "total_ex_tax_item", "total_ex_tax_item_tpl" );
496 $t->parse( "subtotal_ex_tax_item", "subtotal_ex_tax_item_tpl" );
497 $t->parse( "shipping_ex_tax_item", "shipping_ex_tax_item_tpl" );
498 }
499 else
500 {
501 $t->set_var( "total_ex_tax_item", "" );
502 $t->set_var( "subtotal_ex_tax_item", "" );
503 $t->set_var( "shipping_ex_tax_item", "" );
504 }
505 }
506 else
507 {
508 $ColSpanSizeTotals--;
509 $t->set_var( "total_ex_tax_item", "" );
510 $t->set_var( "subtotal_ex_tax_item", "" );
511 $t->set_var( "shipping_ex_tax_item", "" );
512 }
513
514 if ( $ShowIncTaxColumn == true )
515 {
516 $t->parse( "total_inc_tax_item", "total_inc_tax_item_tpl" );
517 $t->parse( "subtotal_inc_tax_item", "subtotal_inc_tax_item_tpl" );
518 $t->parse( "shipping_inc_tax_item", "shipping_inc_tax_item_tpl" );
519 }
520 else
521 {
522 $ColSpanSizeTotals--;
523 $t->set_var( "total_inc_tax_item", "" );
524 $t->set_var( "subtotal_inc_tax_item", "" );
525 $t->set_var( "shipping_inc_tax_item", "" );
526 }
527
528 if ( $ShowIncTaxColumn and $ShowExTaxColumn and $ShowExTaxTotal )
529 {
530 $t->set_var( "subtotals_span_size", $SubTotalsColumns - 1 );
531 }
532 else
533 {
534 $t->set_var( "subtotals_span_size", $ColSpanSizeTotals );
535 }
536
537 $t->set_var( "totals_span_size", $ColSpanSizeTotals );
538 $t->parse( "cart_item_list", "cart_item_list_tpl" );
539 $t->parse( "full_cart", "full_cart_tpl" );
540
541 $currency->setValue( $total["tax"] );
542 $t->set_var( "tax", $locale->format( $currency ) );
543
544 $j = 0;
545
546 $salestax= 0;
547 if($total["shiptax"]){
548 foreach ( $tax as $taxGroup )
549 {
550 $t->set_var( "td_class", ( $j % 2 ) == 0 ? "bglight" : "bgdark" );
551 $j++;
552 if($taxGroup["basis"] == $total["subextax"]){
553 $currency->setValue( $taxGroup["basis"] );
554 $t->set_var( "sub_tax_basis", $locale->format( $currency ) );
555
556 $currency->setValue( $taxGroup["tax"] );
557 $t->set_var( "sub_tax", $locale->format( $currency ) );
558
559 $t->set_var( "sub_tax_percentage", $taxGroup["percentage"] );
560 $t->parse( "tax_item", "tax_item_tpl", true );
561 $salestax = $taxGroup["percentage"];
562 }else{
563 $currency->setValue( $total["shipextax"] );
564 $t->set_var( "sub_tax_basis", $locale->format( $currency ) );
565
566 $currency->setValue( $total["shiptax"] );
567 $t->set_var( "sub_tax", $locale->format( $currency ) );
568
569 $t->set_var( "sub_tax_percentage", $salestax);
570 $t->parse( "tax_item", "tax_item_tpl", true );
571
572 }
573 }
574
575
576 $t->parse( "tax_specification", "tax_specification_tpl" );
577 }else{
578 $t->set_var("tax_specification", "");
579 }
580 }
581
582 $usedVouchers =& $order->usedVouchers();
583 $t->set_var("user-comment-str", "Comment:");
584 $t->set_var("user-comment", $order->comment());
585 $t->set_var( "voucher_item_list", "" );
586
587 if ( count ( $usedVouchers ) > 0 )
588 {
589 turnColumnsOnOff( "voucher_used_header", $t , $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
590 turnColumnsOnOff( "voucher_left_header", $t , $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
591 $j = 0;
592 foreach ( $usedVouchers as $voucherUsed )
593 {
594 $t->set_var( "td_class", ( $j % 2 ) == 0 ? "bglight" : "bgdark" );
595 $j++;
596
597 $voucher =& $voucherUsed->voucher();
598 $t->set_var( "voucher_number", $voucher->keyNumber() );
599
600 eZOrder::voucherTotal( $tax, $total, $voucherUsed );
601 $currency->setValue( $total["extax"] );
602 $t->set_var( "voucher_used_ex_tax", $locale->format( $currency ) );
603 $currency->setValue( $total["inctax"] );
604 $t->set_var( "voucher_used_inc_tax", $locale->format( $currency ) );
605
606 eZOrder::voucherTotal( $tax, $total, $voucher );
607 $currency->setValue( $total["extax"] );
608 $t->set_var( "voucher_left_ex_tax", $locale->format( $currency ) );
609 $currency->setValue( $total["inctax"] );
610 $t->set_var( "voucher_left_inc_tax", $locale->format( $currency ) );
611
612 turnColumnsOnOff( "voucher_used", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
613 turnColumnsOnOff( "voucher_left", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
614 $t->parse( "voucher_item", "voucher_item_tpl", true );
615
616 }
617 $t->parse( "voucher_item_list", "voucher_item_list_tpl" );
618 }
619
620 $statusType = new eZOrderStatusType();
621 $statusTypeArray = $statusType->getAll();
622 foreach ( $statusTypeArray as $status )
623 {
624 $statusName = preg_replace( "#intl-#", "", $status->name() );
625 // $statusName = $languageINI->variable( "strings", $statusName );
626
627 $t->set_var( "option_name", $statusName );
628 $t->set_var( "option_id", $status->id() );
629 $t->parse( "order_status_option", "order_status_option_tpl", true );
630 }
631
632
633 $historyArray = $order->statusHistory();
634 $i=0;
635 foreach ( $historyArray as $status )
636 {
637 if ( ( $i % 2 ) == 0 )
638 $t->set_var( "td_class", "bglight" );
639 else
640 $t->set_var( "td_class", "bgdark" );
641
642 $admin = $status->admin();
643
644 $statusType = $status->type();
645
646 if ( is_object( $statusType ) && $statusType->name() != "" )
647 {
648 $statusName = preg_replace( "#intl-#", "", $statusType->name() );
649 // $statusName = $languageINI->variable( "strings", $statusName );
650 }
651 else
652 {
653 $statusName = preg_replace( "#intl-#", "", "Pending" );
654 // $statusName = $languageINI->variable( "strings", $statusName );
655 }
656
657
658 $t->set_var( "status_date", $locale->format( $status->altered() ) );
659 $t->set_var( "status_name", $statusName );
660 $t->set_var( "status_comment", $status->comment() );
661 $t->set_var( "admin_login", $admin->login() );
662 $t->parse( "order_status_history", "order_status_history_tpl", true );
663 $i++;
664 }
665
666 $checkout = new eZCheckout();
667 $instance =& $checkout->instance();
668 $paymentMethod = $instance->paymentName( $order->paymentMethod() );
669
670 $t->set_var( "payment_method", $paymentMethod );
671
672 $shippingType = $order->shippingType();
673
674 $t->set_var( "shipping_method", "" );
675
676 if ( ( is_object( $shippingType ) ) && ( $checkups != 1 ) )
677 {
678 $t->set_var( "shipping_method", $shippingType->name() );
679 }
680 else
681 {
682 $t->set_var( "shipping_method", $shippingType );
683 }
684
685 if (($shippingType )&&($checkups==1))
686 {
687 $getnames =array (
688
689 '01' => 'UPS Next Day Air',
690
691 '02' => 'UPS 2nd Day Air',
692
693 '03' => 'UPS Ground',
694
695 '07' => 'UPS Worldwide Express',
696
697 '08' => 'UPS Worldwide Expedited',
698
699 '11' => 'UPS Standard',
700
701 '12' => 'UPS 3 Day Select',
702
703 '13' => 'UPS Next Day Air Saver',
704
705 '14' => 'UPS Next Day Air Early A.M.',
706
707 '54' => 'UPS Worldwide Express Plus',
708
709 '59' => 'UPS 2nd Day Air A.M.',
710
711 '64' => '',
712
713 '65' => 'UPS Express Saver',
714
715 );
716 if (!$getnames["$shippingType"])
717 {
718 $service_name=$shippingType;
719 }
720 else
721 {
722 $service_name=$getnames["$shippingType"];
723 }
724
725
726
727 $t->set_var( "shipping_method", $service_name);
728 }
729
730
731
732
733
734 $t->set_var( "order_id", $order->id() );
735 $t->set_var( "www_site", $wwwDir );
736
737 $status = $order->lastStatus();
738 $lastDateTime = $status->altered();
739 $t->set_var( "altered_date", $locale->format( $lastDateTime ) );
740 $lastDateTime = $status->rawAltered();
741 $statusAge = ( round( (( time()-$lastDateTime )/86400),0 ) );
742 if ($statusAge > 42)
743 $t->parse( "email_followup", "email_followup_tpl" );
744 else
745 $t->set_var( "email_followup", "" );
746
747 $t->set_var( "admin_email", $adminEmail );
748 $t->pparse( "output", "order_edit_tpl" );
749
750
751 //print_r($tax);
752 //print "<br><br>";
753
754 //print_r($total);
755 //print_r($ok);
756 //print_r($test);
757 //print $order->comment();
758 //print_r($instance);
759 ?>
$items
$items
Definition: admin/orderview.php:211
$ShowIncTaxColumn
$ShowIncTaxColumn
Definition: cart.php:47
$ShowCart
$ShowCart
Definition: cart.php:72
$ShowSavingsColumn
$ShowSavingsColumn
Definition: cart.php:73
$total
else $total["inctax"]
Definition: checkout.php:1359
$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
eZMail
Definition: ezmail.php:57
eZOrderStatusType
Definition: ezorderstatustype.php:44
eZOrderStatus
Definition: ezorderstatus.php:44
eZOrder
Definition: ezorder.php:52
eZOrder\voucherTotal
voucherTotal(&$tax, &$total, $voucherItem=false)
Definition: ezorder.php:1235
eZPerson
Definition: ezperson.php:43
eZPreOrder
Definition: ezpreorder.php:44
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
$Action
$Action
Definition: companysearch.php:80
$customer
$customer
Definition: customerview.php:72
exit
exit
Definition: folder.php:81
$product
$product
Definition: homepage.php:202
$ColSpanSizeTotals
$ColSpanSizeTotals
Definition: orderedit.php:55
$t
if( $Action=="newstatus") if( $Action=="delete") $t
Definition: orderedit.php:135
$wwwDir
$wwwDir
Definition: orderedit.php:56
$order
$order
Definition: orderedit.php:193
$numberOfItems
$numberOfItems
Definition: orderedit.php:382
$ShowExTaxColumn
$ShowExTaxColumn
Definition: orderedit.php:51
$checkups
else $checkups
Definition: orderedit.php:63
$shippingType
$shippingType
Definition: orderedit.php:672
turnColumnsOnOff
turnColumnsOnOff( $rowName, $t=false, $ShowSavingsColumn=false, $ShowExTaxColumn=false, $ShowIncTaxColumn=false)
Definition: orderedit.php:346
$totalVAT
$totalVAT
Definition: orderedit.php:344
$currency
$currency
Definition: orderedit.php:340
$locale
$locale
Definition: orderedit.php:339
$languageINI
$languageINI
Definition: orderedit.php:46
$statusType
if(count( $usedVouchers) > 0) $statusType
Definition: orderedit.php:620
$status
$status
Definition: orderedit.php:737
$user
$user
Definition: orderedit.php:197
$PricesIncludeVAT
$PricesIncludeVAT
Definition: orderedit.php:48
$j
$j
Definition: orderedit.php:383
$statusAge
$statusAge
Definition: orderedit.php:741
$lastDateTime
$lastDateTime
Definition: orderedit.php:738
$historyArray
foreach( $statusTypeArray as $status) $historyArray
Definition: orderedit.php:633
$i
$i
Definition: orderedit.php:342
$ini
if(isset( $Cancel)) $ini
Definition: orderedit.php:42
$adminEmail
$adminEmail
Definition: orderedit.php:57
$Language
$Language
Definition: orderedit.php:43
$sum
$sum
Definition: orderedit.php:343
$usedVouchers
if( $ShowCart==true) $usedVouchers
Definition: orderedit.php:582
$paymentMethod
$paymentMethod
Definition: orderedit.php:668
$ShowPriceGroups
$ShowPriceGroups
Definition: orderedit.php:44
$tester
$tester
Definition: orderedit.php:65
$upscheck
$upscheck
Definition: orderedit.php:58
$instance
$instance
Definition: orderedit.php:667
$ShowExTaxTotal
$ShowExTaxTotal
Definition: orderedit.php:54
$uspscheck
$uspscheck
Definition: orderedit.php:59
$checkout
foreach( $historyArray as $status) $checkout
Definition: orderedit.php:666
$statusTypeArray
$statusTypeArray
Definition: orderedit.php:621
$country
$country
Definition: paypal.php:46
$billingAddress
$billingAddress
Definition: paypal.php:44
$region
$region
Definition: paypal.php:45
$PriceGroup
$PriceGroup
Definition: productedit.php:1073
$StatusID
$StatusID
Definition: todoedit.php:125
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.