Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ordersendt.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ordersendt.php 9407 2002-04-10 11:49:02Z br $
5 //
6 // Created on: <06-Oct-2000 14:04:17 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 // include_once( "classes/eztemplate.php" );
28 // include_once( "classes/ezlocale.php" );
29 // include_once( "classes/ezcurrency.php" );
30 // include_once( "classes/ezhttptool.php" );
31
32 // include_once( "ezcontact/classes/ezperson.php" );
33 // include_once( "ezcontact/classes/ezcompany.php" );
34
35 // include_once( "eztrade/classes/ezorder.php" );
36 // include_once( "eztrade/classes/ezproduct.php" );
37 // include_once( "eztrade/classes/ezcheckout.php" );
38
39
40 $Language = $ini->variable( "eZTradeMain", "Language" );
41 $ShowPriceGroups = $ini->variable( "eZTradeMain", "PriceGroupsEnabled" ) == "true";
42 $PricesIncludeVAT = $ini->variable( "eZTradeMain", "PricesIncludeVAT" );
43 $PricesIncludeVAT = $ini->variable( "eZTradeMain", "PricesIncludeVAT" ) == "enabled" ? true : false;
44 $ShowExTaxColumn = $ini->variable( "eZTradeMain", "ShowExTaxColumn" ) == "enabled" ? true : false;
45 $ShowIncTaxColumn = $ini->variable( "eZTradeMain", "ShowIncTaxColumn" ) == "enabled" ? true : false;
46 $ShowExTaxTotal = $ini->variable( "eZTradeMain", "ShowExTaxTotal" ) == "enabled" ? true : false;
47 $ColSpanSizeTotals = $ini->variable( "eZTradeMain", "ColSpanSizeTotals" );
48 $checkups = $ini->variable( "eZTradeMain", "UPSOFF" );
49 $ShowTaxBasis = $ini->variable( "eZTradeMain", "ShowTaxBasis" ) == "enabled" ? true : false;
50
51 $locale = new eZLocale( $Language );
52 $currency = new eZCurrency();
53
54
55 // Set some variables to defaults.
56 $ShowCart = false;
57 $ShowSavingsColumn = false;
58
59 $t = new eZTemplate( "kernel/eztrade/user/" . $ini->variable( "eZTradeMain", "TemplateDir" ),
60 "kernel/eztrade/user/intl/", $Language, "ordersendt.php" );
61
62 $translation = new eZINI( "kernel/eztrade/user/intl/" . $Language . "/ordersendt.php.ini", false );
63
64 $t->setAllStrings();
65
66 $t->set_file( "order_sendt_tpl", "ordersendt.tpl" );
67
68 $t->set_block( "order_sendt_tpl", "billing_address_tpl", "billing_address" );
69 $t->set_block( "order_sendt_tpl", "shipping_address_tpl", "shipping_address" );
70 $t->set_block( "order_sendt_tpl", "order_item_list_tpl", "order_item_list" );
71 $t->set_block( "order_sendt_tpl", "printable_reciept_tpl", "printable_reciept" );
72
73
74 $t->set_block( "order_sendt_tpl", "full_cart_tpl", "full_cart" );
75 $t->set_block( "full_cart_tpl", "cart_item_list_tpl", "cart_item_list" );
76 $t->set_block( "cart_item_list_tpl", "header_savings_item_tpl", "header_savings_item" );
77 $t->set_block( "cart_item_list_tpl", "header_inc_tax_item_tpl", "header_inc_tax_item" );
78 $t->set_block( "cart_item_list_tpl", "header_ex_tax_item_tpl", "header_ex_tax_item" );
79
80 $t->set_block( "full_cart_tpl", "voucher_item_list_tpl", "voucher_item_list" );
81 $t->set_block( "voucher_item_list_tpl", "voucher_used_header_inc_tax_item_tpl", "voucher_used_header_inc_tax_item" );
82 $t->set_block( "voucher_item_list_tpl", "voucher_used_header_ex_tax_item_tpl", "voucher_used_header_ex_tax_item" );
83 $t->set_block( "voucher_item_list_tpl", "voucher_left_header_inc_tax_item_tpl", "voucher_left_header_inc_tax_item" );
84 $t->set_block( "voucher_item_list_tpl", "voucher_left_header_ex_tax_item_tpl", "voucher_left_header_ex_tax_item" );
85 $t->set_block( "voucher_item_list_tpl", "voucher_item_tpl", "voucher_item" );
86 $t->set_block( "voucher_item_tpl", "voucher_used_inc_tax_item_tpl", "voucher_used_inc_tax_item" );
87 $t->set_block( "voucher_item_tpl", "voucher_used_ex_tax_item_tpl", "voucher_used_ex_tax_item" );
88 $t->set_block( "voucher_item_tpl", "voucher_left_inc_tax_item_tpl", "voucher_left_inc_tax_item" );
89 $t->set_block( "voucher_item_tpl", "voucher_left_ex_tax_item_tpl", "voucher_left_ex_tax_item" );
90
91 $t->set_block( "full_cart_tpl", "total_ex_tax_item_tpl", "total_ex_tax_item" );
92 $t->set_block( "full_cart_tpl", "total_inc_tax_item_tpl", "total_inc_tax_item" );
93 $t->set_block( "full_cart_tpl", "subtotal_ex_tax_item_tpl", "subtotal_ex_tax_item" );
94 $t->set_block( "full_cart_tpl", "subtotal_inc_tax_item_tpl", "subtotal_inc_tax_item" );
95 $t->set_block( "full_cart_tpl", "shipping_ex_tax_item_tpl", "shipping_ex_tax_item" );
96 $t->set_block( "full_cart_tpl", "shipping_inc_tax_item_tpl", "shipping_inc_tax_item" );
97
98 $t->set_block( "cart_item_list_tpl", "cart_item_tpl", "cart_item" );
99 $t->set_block( "cart_item_tpl", "cart_savings_item_tpl", "cart_savings_item" );
100 $t->set_block( "cart_item_tpl", "cart_inc_tax_item_tpl", "cart_inc_tax_item" );
101 $t->set_block( "cart_item_tpl", "cart_ex_tax_item_tpl", "cart_ex_tax_item" );
102
103 $t->set_block( "cart_item_tpl", "cart_item_option_tpl", "cart_item_option" );
104 $t->set_block( "cart_item_option_tpl", "option_savings_item_tpl", "option_savings_item" );
105 $t->set_block( "cart_item_option_tpl", "option_inc_tax_item_tpl", "option_inc_tax_item" );
106 $t->set_block( "cart_item_option_tpl", "option_ex_tax_item_tpl", "option_ex_tax_item" );
107
108 $t->set_block( "cart_item_tpl", "cart_item_basis_tpl", "cart_item_basis" );
109 $t->set_block( "cart_item_basis_tpl", "basis_savings_item_tpl", "basis_savings_item" );
110 $t->set_block( "cart_item_basis_tpl", "basis_inc_tax_item_tpl", "basis_inc_tax_item" );
111 $t->set_block( "cart_item_basis_tpl", "basis_ex_tax_item_tpl", "basis_ex_tax_item" );
112
113 $t->set_block( "full_cart_tpl", "tax_specification_tpl", "tax_specification" );
114 $t->set_block( "full_cart_tpl", "tax_total_tpl", "tax_total" );
115 $t->set_block( "tax_specification_tpl", "tax_item_tpl", "tax_item" );
116
117
118 $order = new eZOrder( $OrderID );
119 unset( $user );
120
121 // get the customer
122 $user = $order->user();
123
124 $currentUser =& eZUser::currentUser();
125
126 // check if the user is logged i
127 if ( !( $currentUser && $user ) )
128 {
129 eZHTTPTool::header( "Location: /trade/cart/" );
130 exit();
131 }
132
133
134 // check if the user owns the order
135 if ( $currentUser->id() != $user->id() )
136 {
137 eZHTTPTool::header( "Location: /trade/cart/" );
138 exit();
139 }
140
141 $vat=false;
142 $tester = 1;
143 if ( $user )
144 {
145 // print out the addresses
146 $billingAddress = $order->billingAddress();
147
148 if ( $order->personID() == 0 && $order->companyID() == 0 )
149 {
150 $t->set_var( "customer_first_name", $user->firstName() );
151 $t->set_var( "customer_last_name", $user->lastName() );
152 }
153 else
154 {
155 if ( $order->personID() > 0 )
156 {
157 $customer = new eZPerson( $order->personID() );
158 $t->set_var( "customer_first_name", $customer->firstName() );
159 $t->set_var( "customer_last_name", $customer->lastName() );
160 }
161 else
162 {
163 $customer = new eZCompany( $order->companyID() );
164 $t->set_var( "customer_first_name", $customer->name() );
165 $t->set_var( "customer_last_name", "" );
166 }
167 }
168
169 $t->set_var( "billing_street1", $billingAddress->street1() );
170 $t->set_var( "billing_street2", $billingAddress->street2() );
171 $t->set_var( "billing_phone", $billingAddress->phone() );
172 $t->set_var( "billing_zip", $billingAddress->zip() );
173 $t->set_var( "billing_place", $billingAddress->place() );
174 $t->set_var( "billing_region", $billingAddress->region() );
175 $country = $billingAddress->country();
176
177 if ( $country )
178 {
179 if ( $ini->variable( "eZUserMain", "SelectCountry" ) == "enabled" )
180 $t->set_var( "billing_country", $country->name() );
181 else
182 $t->set_var( "billing_country", "" );
183 }
184 else
185 {
186 $t->set_var( "billing_country", "" );
187 }
188
189 $region = $billingAddress->region();
190
191 if ( $region )
192 {
193 if ( $ini->variable( "eZUserMain", "SelectRegion" ) == "enabled" )
194 $t->set_var( "billing_region", $region->name() );
195 else
196 $t->set_var( "billing_region", "" );
197 }
198 else
199 {
200 $t->set_var( "billing_region", "" );
201 }
202
203 if ( $ini->variable( "eZTradeMain", "ShowBillingAddress" ) == "enabled" )
204 $t->parse( "billing_address", "billing_address_tpl" );
205 else
206 $t->set_var( "billing_address", "" );
207
208 if ( $order->personID() == 0 && $order->companyID() == 0 )
209 {
210 $shippingUser = $order->shippingUser();
211
212 if ( $shippingUser )
213 {
214 $t->set_var( "shipping_first_name", $shippingUser->firstName() );
215 $t->set_var( "shipping_last_name", $shippingUser->lastName() );
216 }
217 }
218 else
219 {
220 if ( $order->personID() > 0 )
221 {
222 $customer = new eZPerson( $order->personID() );
223 $t->set_var( "shipping_first_name", $customer->firstName() );
224 $t->set_var( "shipping_last_name", $customer->lastName() );
225 }
226 else
227 {
228 $customer = new eZCompany( $order->companyID() );
229 $t->set_var( "shipping_first_name", $customer->name() );
230 $t->set_var( "shipping_last_name", "" );
231 }
232 }
233
234 $shippingAddress = $order->shippingAddress();
235
236 $t->set_var( "shipping_street1", $shippingAddress->street1() );
237 $t->set_var( "shipping_street2", $shippingAddress->street2() );
238 $t->set_var( "shipping_phone", $shippingAddress->phone() );
239 $t->set_var( "shipping_zip", $shippingAddress->zip() );
240 $t->set_var( "shipping_place", $shippingAddress->place() );
241 $t->set_var( "shipping_region", $shippingAddress->region() );
242 $country = $shippingAddress->country();
243
244 if ( $country )
245 {
246 if ( $ini->variable( "eZUserMain", "SelectCountry" ) == "enabled" )
247 $t->set_var( "shipping_country", $country->name() );
248 else
249 $t->set_var( "shipping_country", "" );
250 }
251 else
252 {
253 $t->set_var( "shipping_country", "" );
254 }
255
256 $region = $shippingAddress->region();
257
258 if ( $shippingRegion )
259 {
260 if ( $region->hasVAT() )
261 $vat = true;
262 }
263
264 if ( $region )
265 {
266 if ( $ini->variable( "eZUserMain", "SelectRegion" ) == "enabled" )
267 $t->set_var( "shipping_region", $region->name() );
268 else
269 $t->set_var( "shipping_region", "" );
270 }
271 else
272 {
273 $t->set_var( "shipping_region", "" );
274 }
275
276 $t->parse( "shipping_address", "shipping_address_tpl" );
277 }
278
279 if ( !isset( $OrderType ) )
280 $OrderType = false;
281
282 // fetch the order items
283 $items = $order->items( $OrderType );
284
285
286 #$locale = new eZLocale( $Language );
287 #$currency = new eZCurrency();
288
289 $i = 0;
290 $sum = 0.0;
291 $totalVAT = 0.0;
292
293
294 // foreach ( $items as $item )
295 // {
296 // $product = $item->product();
297 //
298 // $image = $product->thumbnailImage();
299 //
300 // if ( $image )
301 // {
302 // $thumbnail =& $image->requestImageVariation( 35, 35 );
303 //
304 // $t->set_var( "product_image_path", "/" . $thumbnail->imagePath() );
305 // $t->set_var( "product_image_width", $thumbnail->width() );
306 // $t->set_var( "product_image_height", $thumbnail->height() );
307 // $t->set_var( "product_image_caption", $image->caption() );
308 //
309 // $t->parse( "order_image", "order_image_tpl" );
310 // }
311 // else
312 // {
313 // $t->set_var( "order_image", "" );
314 // }
315 //
316 // $priceobj = new eZCurrency();
317 //
318 // if ( ( !$RequireUserLogin or get_class( $user ) == "ezuser" ) and
319 // $ShowPrice and $product->showPrice() == true and $product->hasPrice() )
320 // {
321 // $found_price = false;
322 //
323 // if ( $ShowPriceGroups and $PriceGroup > 0 )
324 // {
325 // $price = eZPriceGroup::correctPrice( $product->id(), $PriceGroup );
326 // if ( $price )
327 // {
328 // if ( $PricesIncludeVAT == "enabled" )
329 // {
330 // $totalVAT = $product->addVAT( $price );
331 // $price += $totalVAT;
332 // }
333 // else
334 // {
335 // $totalVAT = $product->extractVAT( $price );
336 // }
337 //
338 // $found_price = true;
339 // $price = $price * $item->count();
340 // }
341 // }
342 //
343 // if ( !$found_price )
344 // {
345 // if ( $PricesIncludeVAT == "enabled" )
346 // {
347 // $totalVAT = $product->addVAT( $item->price( true, true ) );
348 // $price = $item->price( true, true ) + $totalVAT;
349 // }
350 // else
351 // {
352 // $totalVAT = $product->extractVAT( $item->price( true, true ) );
353 // $price = $item->price( true, true );
354 // }
355 // }
356 // $currency->setValue( $price );
357 // $t->set_var( "product_price", $locale->format( $currency ) );
358 // }
359 // else
360 // {
361 // if ( $PricesIncludeVAT == "enabled" )
362 // {
363 // $totalVAT = $product->addVAT( $item->price( true, true ) );
364 // $price = $item->price( true, true ) + $totalVAT;
365 // }
366 // else
367 // {
368 // $totalVAT = $product->extractVAT( $item->price( true, true ) );
369 // $price = $item->price( true, true );
370 // }
371 // }
372 //
373 // $currency->setValue( $price );
374 //
375 // $sum += $price;
376 //
377 // $t->set_var( "product_name", $product->name() );
378 // $t->set_var( "product_price", $locale->format( $currency ) );
379 //
380 // $t->set_var( "order_item_count", $item->count() );
381 //
382 // if ( ( $i % 2 ) == 0 )
383 // $t->set_var( "td_class", "bglight" );
384 // else
385 // $t->set_var( "td_class", "bgdark" );
386 //
387 // $optionValues =& $item->optionValues();
388 //
389 // $t->set_var( "order_item_option", "" );
390 // foreach ( $optionValues as $optionValue )
391 // {
392 // $t->set_var( "option_name", $optionValue->optionName() );
393 // $t->set_var( "option_value", $optionValue->valueName() );
394 //
395 // $t->parse( "order_item_option", "order_item_option_tpl", true );
396 // }
397 //
398 // $t->parse( "order_item", "order_item_tpl", true );
399 //
400 // $i++;
401 // }
402 //
403 //
404 // $t->parse( "order_item_list", "order_item_list_tpl" );
405
406 function turnColumnsOnOff( $rowName, $t, $ShowSavingsColumn = false, $ShowExTaxColumn = false, $ShowIncTaxColumn = false )
407 {
408 // global $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn;
409 if ( $ShowSavingsColumn == true )
410 {
411 $t->parse( $rowName . "_savings_item", $rowName . "_savings_item_tpl" );
412 }
413 else
414 {
415 $t->set_var( $rowName . "_savings_item", "" );
416 }
417
418 if ( $ShowExTaxColumn == true )
419 {
420 $t->parse( $rowName . "_ex_tax_item", $rowName . "_ex_tax_item_tpl" );
421 }
422 else
423 {
424 $t->set_var( $rowName . "_ex_tax_item", "" );
425 }
426
427 if ( $ShowIncTaxColumn == true )
428 {
429 $t->parse( $rowName . "_inc_tax_item", $rowName . "_inc_tax_item_tpl" );
430 }
431 else
432 {
433 $t->set_var( $rowName . "_inc_tax_item", "" );
434 }
435 }
436
437 $locale = new eZLocale( $Language );
438 $currency = new eZCurrency();
439
440 $numberOfItems = 0;
441 $j = 0;
442
443 foreach ( $items as $item )
444 {
445 $t->set_var( "td_class", ( $j % 2 ) == 0 ? "bglight" : "bgdark" );
446 $j++;
447 $t->set_var( "cart_item_id", $item->id() );
448 $product =& $item->product();
449 $vatPercentage = $product->vatPercentage();
450 $productHasVAT = $product->priceIncVAT();
451
452 $t->set_var( "product_id", $product->id() );
453 $t->set_var( "product_name", $product->name() );
454 $t->set_var( "product_number", $product->productNumber() );
455 $t->set_var( "product_price", $item->localePrice( false, true, $PricesIncludeVAT ) );
456 $t->set_var( "product_count", $item->count() );
457 $t->set_var( "product_total_ex_tax", $item->localePrice( true, true, false ) );
458 $t->set_var( "product_total_inc_tax", $item->localePrice( true, true, true ) );
459
460 $numberOfItems++;
461
462 $numberOfOptions = 0;
463
464 $optionValues =& $item->optionValues();
465
466 $t->set_var( "cart_item_option", "" );
467 $t->set_var( "cart_item_basis", "" );
468
469 foreach ( $optionValues as $optionValue )
470 {
471 turnColumnsOnOff( "option", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
472
473 $t->set_var( "option_id", "" );
474 $t->set_var( "option_name", $optionValue->valueName() );
475 $t->set_var( "option_value", $optionValue->optionName() );
476 $t->set_var( "option_price", "" );
477 $t->parse( "cart_item_option", "cart_item_option_tpl", true );
478
479 $numberOfOptions++;
480 }
481 turnColumnsOnOff( "cart", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
482 turnColumnsOnOff( "basis", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
483
484 if ( $numberOfOptions == 0 )
485 {
486 $t->set_var( "cart_item_option", "" );
487 $t->set_var( "cart_item_basis", "" );
488 }
489 else
490 {
491 if( false )
492 {
493 $t->set_var( "basis_price", $item->localePrice( false, false, $PricesIncludeVAT ) );
494 $t->parse( "cart_item_basis", "cart_item_basis_tpl", true );
495 }
496 else
497 {
498 $t->set_var( "cart_item_basis", "" );
499 }
500 }
501
502 $t->parse( "cart_item", "cart_item_tpl", true );
503 }
504
505 if ( $numberOfItems > 0 )
506 {
507 $ShowCart = true;
508 }
509
510 $t->setAllStrings();
511
512 turnColumnsOnOff( "header", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
513
514 if ( $ShowCart == true )
515 {
516
517 $order->orderTotals( $tax, $total );
518
519 $t->set_var( "empty_cart", "" );
520
521 $t->set_var( "tax_total", "" );
522
523 if ( !$ShowIncTaxColumn && $order->isVATInc() )
524 {
525 $currency->setValue( $total["inctax"] );
526 $t->set_var( "total_ex_tax", $locale->format( $currency ) );
527 $currency->setValue( $total["tax"] );
528 $t->set_var( "total_cart_tax", $locale->format( $currency ) );
529
530 if ( $total["tax"]>0 )
531 $t->parse( "tax_total", "tax_total_tpl" );
532 else
533 $t->set_var( "tax_total", "" );
534 }
535 else
536 {
537
538 $currency->setValue( $total["extax"] );
539 $t->set_var( "total_ex_tax", $locale->format( $currency ) );
540 $t->set_var( "total_cart_tax", "" );
541 $t->set_var( "tax_total", "" );
542 }
543
544 $currency->setValue( $total["subinctax"] );
545 $t->set_var( "subtotal_inc_tax", $locale->format( $currency ) );
546
547 $currency->setValue( $total["subextax"] );
548 $t->set_var( "subtotal_ex_tax", $locale->format( $currency ) );
549
550 $currency->setValue( $total["inctax"] );
551 $t->set_var( "total_inc_tax", $locale->format( $currency ) );
552
553 // $currency->setValue( $total["extax"] );
554 // $t->set_var( "total_ex_tax", $locale->format( $currency ) );
555
556 $currency->setValue( $total["shipinctax"] );
557 $t->set_var( "shipping_inc_tax", $locale->format( $currency ) );
558
559 $currency->setValue( $total["subextax"] );
560 $t->set_var( "subtotal_ex_tax", $locale->format( $currency ) );
561
562 $currency->setValue( $total["shipextax"] );
563 $t->set_var( "shipping_ex_tax", $locale->format( $currency ) );
564
565 $currency->setValue( $total["tax"] );
566 $t->set_var( "tax", $locale->format( $currency ) );
567
568 if ( $ShowSavingsColumn == false )
569 {
570 $ColSpanSizeTotals--;
571 }
572
573 $SubTotalsColumns = $ColSpanSizeTotals;
574
575 if ( $ShowExTaxColumn == true )
576 {
577 if ( $ShowExTaxTotal == true or $ShowIncTaxColumn == false )
578 {
579 $t->parse( "total_ex_tax_item", "total_ex_tax_item_tpl" );
580 $t->parse( "subtotal_ex_tax_item", "subtotal_ex_tax_item_tpl" );
581 $t->parse( "shipping_ex_tax_item", "shipping_ex_tax_item_tpl" );
582 }
583 else
584 {
585 $t->set_var( "total_ex_tax_item", "" );
586 $t->set_var( "subtotal_ex_tax_item", "" );
587 $t->set_var( "shipping_ex_tax_item", "" );
588 }
589 }
590 else
591 {
592 $ColSpanSizeTotals--;
593 $t->set_var( "total_ex_tax_item", "" );
594 $t->set_var( "subtotal_ex_tax_item", "" );
595 $t->set_var( "shipping_ex_tax_item", "" );
596 }
597
598 if ( $ShowIncTaxColumn == true )
599 {
600 $t->parse( "total_inc_tax_item", "total_inc_tax_item_tpl" );
601 $t->parse( "subtotal_inc_tax_item", "subtotal_inc_tax_item_tpl" );
602 $t->parse( "shipping_inc_tax_item", "shipping_inc_tax_item_tpl" );
603 }
604 else
605 {
606 $ColSpanSizeTotals--;
607 $t->set_var( "total_inc_tax_item", "" );
608 $t->set_var( "subtotal_inc_tax_item", "" );
609 $t->set_var( "shipping_inc_tax_item", "" );
610 }
611
612 if ( $ShowIncTaxColumn and $ShowExTaxColumn and $ShowExTaxTotal )
613 {
614 $t->set_var( "subtotals_span_size", $SubTotalsColumns - 1 );
615 }
616 else
617 {
618 $t->set_var( "subtotals_span_size", $ColSpanSizeTotals );
619 }
620
621 $t->set_var( "totals_span_size", $ColSpanSizeTotals );
622 $t->parse( "cart_item_list", "cart_item_list_tpl" );
623 $t->parse( "full_cart", "full_cart_tpl" );
624
625 $currency->setValue( $total["tax"] );
626 $t->set_var( "tax", $locale->format( $currency ) );
627
628 $j = 0;
629
630 if ($ShowTaxBasis)
631 {
632 foreach( $tax as $taxGroup )
633 {
634 $t->set_var( "td_class", ( $j % 2 ) == 0 ? "bglight" : "bgdark" );
635 $j++;
636 $currency->setValue( $taxGroup["basis"] );
637 $t->set_var( "sub_tax_basis", $locale->format( $currency ) );
638
639 $currency->setValue( $taxGroup["tax"] );
640 $t->set_var( "sub_tax", $locale->format( $currency ) );
641
642 $t->set_var( "sub_tax_percentage", $taxGroup["percentage"] );
643 $t->parse( "tax_item", "tax_item_tpl", true );
644 }
645 $t->parse( "tax_specification", "tax_specification_tpl" );
646 }
647 else
648 // replace with a tax overview site.ini in eZTrade variable = enabled/dissabled
649 // $t->parse( "tax_specification", "tax_specification_tpl" );
650 $t->set_var( "tax_specification", "" );
651 $t->set_var( "tax_item", "" );
652 }
653
654 $usedVouchers =& $order->usedVouchers();
655
656 $t->set_var( "voucher_item_list", "" );
657
658 if ( count ( $usedVouchers ) > 0 )
659 {
660 turnColumnsOnOff( "voucher_used_header", $t , $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
661 turnColumnsOnOff( "voucher_left_header", $t , $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
662 $j = 0;
663 foreach ( $usedVouchers as $voucherUsed )
664 {
665 $t->set_var( "td_class", ( $j % 2 ) == 0 ? "bglight" : "bgdark" );
666 $j++;
667
668 $voucher =& $voucherUsed->voucher();
669 $t->set_var( "voucher_number", $voucher->keyNumber() );
670
671 eZOrder::voucherTotal( $tax, $total, $voucherUsed );
672 $currency->setValue( $total["extax"] );
673 $t->set_var( "voucher_used_ex_tax", $locale->format( $currency ) );
674 $currency->setValue( $total["inctax"] );
675 $t->set_var( "voucher_used_inc_tax", $locale->format( $currency ) );
676
677 eZOrder::voucherTotal( $tax, $total, $voucher );
678 $currency->setValue( $total["extax"] );
679 $t->set_var( "voucher_left_ex_tax", $locale->format( $currency ) );
680 $currency->setValue( $total["inctax"] );
681 $t->set_var( "voucher_left_inc_tax", $locale->format( $currency ) );
682
683 turnColumnsOnOff( "voucher_used", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
684 turnColumnsOnOff( "voucher_left", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
685 $t->parse( "voucher_item", "voucher_item_tpl", true );
686
687 }
688 $t->parse( "voucher_item_list", "voucher_item_list_tpl" );
689 }
690
691
692
693 $checkout = new eZCheckout();
694 $instance =& $checkout->instance();
695 $paymentMethod = $instance->paymentName( $order->paymentMethod() );
696
697 $t->set_var( "payment_method", $paymentMethod );
698
699 $t->set_var( "comment", $order->comment() );
700
701 $shippingType = $order->shippingType();
702
703 // print_r( $shippingType );
704
705 if (($shippingType )&&($checkups!=1))
706 {
707 $t->set_var( "shipping_type", $shippingType->name() );
708 }
709 if (($shippingType )&&($checkups==1))
710 {
711 $getnames =array (
712
713 '01' => 'UPS Next Day Air',
714
715 '02' => 'UPS 2nd Day Air',
716
717 '03' => 'UPS Ground',
718
719 '07' => 'UPS Worldwide Express',
720
721 '08' => 'UPS Worldwide Expedited',
722
723 '11' => 'UPS Standard',
724
725 '12' => 'UPS 3 Day Select',
726
727 '13' => 'UPS Next Day Air Saver',
728
729 '14' => 'UPS Next Day Air Early A.M.',
730
731 '54' => 'UPS Worldwide Express Plus',
732
733 '59' => 'UPS 2nd Day Air A.M.',
734
735 '64' => '',
736
737 '65' => 'UPS Express Saver',
738
739 );
740
741 if (!$getnames["$shippingType"])
742 {
743 $service_name=$shippingType;
744 }
745 else
746 {
747 $service_name=$getnames["$shippingType"];
748 }
749
750 $t->set_var( "shipping_type", $service_name);
751 }
752
753 $shippingCost = $order->shippingCharge();
754
755 $shippingVAT = $order->shippingVAT();
756
757 $currency->setValue( $shippingCost );
758
759 $t->set_var( "shipping_cost", $locale->format( $currency ) );
760
761 $sum += $shippingCost;
762 $currency->setValue( $sum );
763 $t->set_var( "order_sum", $locale->format( $currency ) );
764
765 $currency->setValue( $totalVAT + $shippingVAT );
766 $t->set_var( "order_vat_sum", $locale->format( $currency ) );
767
768 $t->set_var( "order_id", $OrderID );
769
770
771 // graham@brookinsconsulting.com - 12-19-2001:11:45
772 // idea to turn off feature . . .
773
774 // if ( $ini->variable( "eZTradeMain", "ShowPrintableRecieptLink" ) == "enabled" )
775 // printable_reciept_enabled_tpl printable_reciept_disabled_tpl
776 // else
777 // $t->set_var( "billing_address", "" );
778
779
780 // graham@brookinsconsulting.com - 12-19-2001:11:45
781 // dynamic internal printable reciept link
782
783 if ( $PrintableVersion = $ini->variable( "eZTradeMain", "ShowPrintableRecieptLink" ) )
784 {
785 switch ($PrintableVersion) {
786 case "enabled":
787 $printable_reciept_link = "http://$HTTP_HOST/trade/ordersendt/$OrderID/?PrintableVersion=disabled";
788 $printable_reciept_text = $translation->variable( "Strings", "web_reciept" );
789 break;
790 case "disabled":
791 $printable_reciept_link = "http://$HTTP_HOST/trade/ordersendt/$OrderID/?PrintableVersion=enabled";
792 $printable_reciept_text = $translation->variable( "Strings", "printable_reciept" );
793 break;
794 case "":
795 $printable_reciept_link = "http://$HTTP_HOST/trade/ordersendt/$OrderID/?PrintableVersion=enabled";
796 $printable_reciept_text = $translation->variable( "Strings", "printable_reciept" );
797 break;
798 }
799
800 $t->set_var( "printable_reciept_text", $printable_reciept_text );
801 $t->set_var( "printable_reciept_link", $printable_reciept_link );
802 //$t->parse( "printable_reciept" , "printable_reciept_tpl", true);
803 $t->parse( "printable_reciept" , "printable_reciept_tpl" );
804 }
805 else
806 {
807 $t->set_var( "printable_reciept", "" );
808 }
809
810 $t->pparse( "output", "order_sendt_tpl" );
811
812 ?>
$shippingRegion
$shippingRegion
Definition: checkout.php:616
$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
eZOrder
Definition: ezorder.php:52
eZOrder\voucherTotal
voucherTotal(&$tax, &$total, $voucherItem=false)
Definition: ezorder.php:1235
eZPerson
Definition: ezperson.php:43
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$ini
$ini
Definition: classes/admin/linklist.php:64
$item
$item
Definition: classes/admin/linklist.php:228
$customer
$customer
Definition: customerview.php:72
exit
exit
Definition: folder.php:81
$product
$product
Definition: homepage.php:202
$shippingVAT
$shippingVAT
Definition: ordersendt.php:755
$ColSpanSizeTotals
$ColSpanSizeTotals
Definition: ordersendt.php:47
turnColumnsOnOff
turnColumnsOnOff( $rowName, $t, $ShowSavingsColumn=false, $ShowExTaxColumn=false, $ShowIncTaxColumn=false)
Definition: ordersendt.php:406
$translation
$translation
Definition: ordersendt.php:62
$order
$order
Definition: ordersendt.php:118
$ShowExTaxColumn
$ShowExTaxColumn
Definition: ordersendt.php:44
$numberOfItems
$numberOfItems
Definition: ordersendt.php:440
$shippingType
$shippingType
Definition: ordersendt.php:701
$totalVAT
$totalVAT
Definition: ordersendt.php:291
$currency
$currency
Definition: ordersendt.php:52
$locale
$locale
Definition: ordersendt.php:51
$t
$t
Definition: ordersendt.php:59
$ShowTaxBasis
$ShowTaxBasis
Definition: ordersendt.php:49
$currentUser
$currentUser
Definition: ordersendt.php:124
$user
$user
Definition: ordersendt.php:122
$PricesIncludeVAT
$PricesIncludeVAT
Definition: ordersendt.php:42
$j
$j
Definition: ordersendt.php:441
$items
$items
Definition: ordersendt.php:283
$shippingCost
if(($shippingType)&&($checkups!=1)) if(($shippingType)&&($checkups==1)) $shippingCost
Definition: ordersendt.php:753
$i
$i
Definition: ordersendt.php:289
$Language
$Language
Definition: ordersendt.php:40
$vat
if(!( $currentUser && $user)) if( $currentUser->id() !=$user->id()) $vat
Definition: ordersendt.php:141
$ShowSavingsColumn
$ShowSavingsColumn
Definition: ordersendt.php:57
$sum
$sum
Definition: ordersendt.php:290
$usedVouchers
if( $ShowCart==true) $usedVouchers
Definition: ordersendt.php:654
$paymentMethod
$paymentMethod
Definition: ordersendt.php:695
$ShowPriceGroups
$ShowPriceGroups
Definition: ordersendt.php:41
$tester
$tester
Definition: ordersendt.php:142
$ShowCart
$ShowCart
Definition: ordersendt.php:56
$checkups
$checkups
Definition: ordersendt.php:48
$instance
$instance
Definition: ordersendt.php:694
$ShowExTaxTotal
$ShowExTaxTotal
Definition: ordersendt.php:46
$ShowIncTaxColumn
$ShowIncTaxColumn
Definition: ordersendt.php:45
$checkout
if(count( $usedVouchers) > 0) $checkout
Definition: ordersendt.php:693
$country
$country
Definition: paypal.php:46
$billingAddress
$billingAddress
Definition: paypal.php:44
$region
$region
Definition: paypal.php:45
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.