Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

checkout.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: checkout.php 9904 2004-07-09 11:44:47Z br $
5 //
6 // Created on: <28-Sep-2000 15:52:08 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 //$_GET = array_map('stripslashes', $_GET);
28 //$_POST = array_map('stripslashes', $_POST);
29
30 // // include_once( "classes/INIFile.php" );
31 // include_once( "classes/eztemplate.php" );
32 // include_once( "classes/ezlocale.php" );
33 // include_once( "classes/ezcurrency.php" );
34 // include_once( "classes/ezhttptool.php" );
35
36 $ini =& eZINI::instance( 'site.ini' );
37
38 $shippingname = eZHTTPTool::getVar( "shippname" );
39
40 $Language = $ini->variable( "eZTradeMain", "Language" );
41 $OrderSenderEmail = $ini->variable( "eZTradeMain", "OrderSenderEmail" );
42 $OrderReceiverEmail = $ini->variable( "eZTradeMain", "OrderReceiverEmail" );
43 $ForceSSL = $ini->variable( "eZTradeMain", "ForceSSL" );
44 $ShowQuantity = $ini->variable( "eZTradeMain", "ShowQuantity" ) == "true";
45 $ShowPriceGroups = $ini->variable( "eZTradeMain", "PriceGroupsEnabled" ) == "true";
46 $ShowNamedQuantity = $ini->variable( "eZTradeMain", "ShowNamedQuantity" ) == "true";
47 $RequireQuantity = $ini->variable( "eZTradeMain", "RequireQuantity" ) == "true";
48 $ShowOptionQuantity = $ini->variable( "eZTradeMain", "ShowOptionQuantity" ) == "true";
49 $PricesIncludeVAT = $ini->variable( "eZTradeMain", "PricesIncludeVAT" ) == "enabled" ? true : false;
50 $ShowExTaxColumn = $ini->variable( "eZTradeMain", "ShowExTaxColumn" ) == "enabled" ? true : false;
51 $ShowIncTaxColumn = $ini->variable( "eZTradeMain", "ShowIncTaxColumn" ) == "enabled" ? true : false;
52 $ShowExTaxTotal = $ini->variable( "eZTradeMain", "ShowExTaxTotal" ) == "enabled" ? true : false;
53 $ShowTaxBasis = $ini->variable( "eZTradeMain", "ShowTaxBasis" ) == "enabled" ? true : false;
54 $ColSpanSizeTotals = $ini->variable( "eZTradeMain", "ColSpanSizeTotals" );
55 $StateTaxBilling = $ini->variable( "eZTradeMain", "StateTaxBilling" ) == "enabled" ? true : false;
56 $StateTaxShipping = $ini->variable( "eZTradeMain", "StateTaxShipping" ) == "enabled" ? true : false;
57 $CountryVATDiscrimination = $ini->variable( "eZTradeMain", "CountryVATDiscrimination" ) == "enabled" ? true : false;
58
59 $OrderDisclaimer = $ini->variable( "eZTradeMain", "OrderDisclaimer" ) == "enabled" ? true : false;
60 $OrderDisclaimerText = $ini->variable( "eZTradeMain", "OrderDisclaimerText" );
61 $ShippingDisclaimerText = $ini->variable( "eZTradeMain", "ShippingDisclaimerText" );
62
63 //Depricated ? $checkups = $ini->variable( "eZTradeMain", "UPSOFF" );
64 $upscheck = $ini->variable( "eZTradeMain", "UPSXMLShipping" )=="enabled"?1:0;
65 $uspscheck = $ini->variable( "eZTradeMain", "USPSXMLShipping" )=="enabled"?1:0;
66
67 if(($upscheck==0)&&($uspscheck==0))
68 $checkups=0;
69 else
70 $checkups=1;
71
72 // Set some variables to defaults.
73 $ShowCart = false;
74 $ShowSavingsColumn = false;
75
76 // include_once( "ezuser/classes/ezuser.php" );
77 // include_once( "ezuser/classes/ezuser.php" );
78
79 // include_once( "eztrade/classes/ezproduct.php" );
80 // include_once( "eztrade/classes/ezoption.php" );
81 // include_once( "eztrade/classes/ezoptionvalue.php" );
82 // include_once( "eztrade/classes/ezcart.php" );
83 // include_once( "eztrade/classes/ezcartitem.php" );
84 // include_once( "eztrade/classes/ezcartoptionvalue.php" );
85 // include_once( "eztrade/classes/ezpreorder.php" );
86 // include_once( "eztrade/classes/ezorder.php" );
87 // include_once( "eztrade/classes/ezwishlist.php" );
88 // include_once( "eztrade/classes/ezvoucher.php" );
89
90 // shipping
91 // include_once( "eztrade/classes/ezshippingtype.php" );
92 // include_once( "eztrade/classes/ezshippinggroup.php" );
93 // include_once( "eztrade/classes/ezcheckout.php" );
94
95 // include_once( "ezcontact/classes/ezperson.php" );
96 // include_once( "ezcontact/classes/ezcompany.php" );
97
98 // include_once( "ezsession/classes/ezsession.php" );
99
100 // include_once( "ezmail/classes/ezmail.php" );
101
102 //$currentTypeID = array();
103
104 if(eZHTTPTool::getVar( "ShippingTypeID" )){
105 $currentTypeID = eZHTTPTool::getVar( "ShippingTypeID", true );
106 $test = $currentTypeID[0];
107 }else{
108 $currentTypeID[0] = "03";
109 $test = $currentTypeID[0];
110 }
111
112 $cart = new eZCart();
113
114 // there are way to manny calls to get the current user in
115 // this particular file, i've commented out the duplicates as needed.
116 // $user = eZUser::currentUser();
117
118 $session =& eZSession::globalSession();
119
120 $user = eZUser::currentUser();
121
122 if ( !is_a( $user, "eZUser" ) )
123 eZHTTPTool::header( "Location: /user/login/" );
124
125 // if no session exist create one.
126 if ( !$session->fetch() )
127 {
128 $session->store();
129 }
130
131 // get the cart or create it
132 $cart = $cart->getBySession( $session, "Cart" );
133 if ( !$cart || !$cart->items() )
134 {
135 eZHTTPTool::header( "Location: /trade/cart/" );
136 }
137
138 $t = new eZTemplate( "kernel/eztrade/user/" . $ini->variable( "eZTradeMain", "TemplateDir" ),
139 "kernel/eztrade/user/intl/", $Language , "checkout.php" );
140
141 $t->setAllStrings();
142
143 $t->set_file( "checkout_page_tpl", "checkout.tpl" );
144
145 $t->set_block( "checkout_page_tpl", "empty_cart_tpl", "empty_cart" );
146
147 $t->set_block( "checkout_page_tpl", "full_cart_tpl", "full_cart" );
148 $t->set_block( "full_cart_tpl", "cart_item_list_tpl", "cart_item_list" );
149 $t->set_block( "cart_item_list_tpl", "header_savings_item_tpl", "header_savings_item" );
150 $t->set_block( "cart_item_list_tpl", "header_inc_tax_item_tpl", "header_inc_tax_item" );
151 $t->set_block( "cart_item_list_tpl", "header_ex_tax_item_tpl", "header_ex_tax_item" );
152
153 $t->set_block( "cart_item_list_tpl", "cart_item_tpl", "cart_item" );
154 $t->set_block( "cart_item_tpl", "cart_savings_item_tpl", "cart_savings_item" );
155 $t->set_block( "cart_item_tpl", "cart_inc_tax_item_tpl", "cart_inc_tax_item" );
156 $t->set_block( "cart_item_tpl", "cart_ex_tax_item_tpl", "cart_ex_tax_item" );
157
158 $t->set_block( "cart_item_tpl", "cart_item_basis_tpl", "cart_item_basis" );
159 $t->set_block( "cart_item_basis_tpl", "basis_savings_item_tpl", "basis_savings_item" );
160 $t->set_block( "cart_item_basis_tpl", "basis_inc_tax_item_tpl", "basis_inc_tax_item" );
161 $t->set_block( "cart_item_basis_tpl", "basis_ex_tax_item_tpl", "basis_ex_tax_item" );
162
163 $t->set_block( "cart_item_tpl", "cart_item_option_tpl", "cart_item_option" );
164 $t->set_block( "cart_item_option_tpl", "option_savings_item_tpl", "option_savings_item" );
165 $t->set_block( "cart_item_option_tpl", "option_inc_tax_item_tpl", "option_inc_tax_item" );
166 $t->set_block( "cart_item_option_tpl", "option_ex_tax_item_tpl", "option_ex_tax_item" );
167
168 $t->set_block( "full_cart_tpl", "subtotal_ex_tax_item_tpl", "subtotal_ex_tax_item" );
169 $t->set_block( "full_cart_tpl", "subtotal_inc_tax_item_tpl", "subtotal_inc_tax_item" );
170
171 $t->set_block( "full_cart_tpl", "shipping_ex_tax_item_tpl", "shipping_ex_tax_item" );
172 $t->set_block( "full_cart_tpl", "shipping_inc_tax_item_tpl", "shipping_inc_tax_item" );
173
174 $t->set_block( "full_cart_tpl", "vouchers_tpl", "vouchers_tpl" );
175 $t->set_block( "vouchers_tpl", "voucher_item_tpl", "voucher_item" );
176 $t->set_block( "checkout_page_tpl", "remove_voucher_tpl", "remove_voucher" );
177
178 $t->set_block( "full_cart_tpl", "total_ex_tax_item_tpl", "total_ex_tax_item" );
179 $t->set_block( "full_cart_tpl", "total_inc_tax_item_tpl", "total_inc_tax_item" );
180 $t->set_block( "full_cart_tpl", "tax_total_tpl", "tax_total" );
181
182
183 $t->set_block( "full_cart_tpl", "tax_specification_tpl", "tax_specification" );
184 $t->set_block( "tax_specification_tpl", "tax_item_tpl", "tax_item" );
185
186 $t->set_block( "full_cart_tpl", "shipping_type_tpl", "shipping_type" );
187
188
189
190 $t->set_block( "checkout_page_tpl", "shipping_select_tpl", "shipping_select" );
191
192 $t->set_block( "checkout_page_tpl", "shipping_address_tpl", "shipping_address" );
193 $t->set_block( "checkout_page_tpl", "billing_address_tpl", "billing_address" );
194 $t->set_block( "billing_address_tpl", "billing_option_tpl", "billing_option" );
195 $t->set_block( "checkout_page_tpl", "wish_user_tpl", "wish_user" );
196
197 $t->set_block( "checkout_page_tpl", "sendorder_item_tpl", "sendorder_item" );
198
199 $t->set_block( "checkout_page_tpl", "show_payment_tpl", "show_payment" );
200 $t->set_block( "show_payment_tpl", "payment_method_tpl", "payment_method" );
201
202
203 $t->set_var( "show_payment", "" );
204
205 $t->set_var( "show_payment", "" );
206 $t->set_var( "price_ex_vat", "" );
207 $t->set_var( "price_inc_vat", "" );
208 $t->set_var( "cart_item", "" );
209 $t->set_var( "wish_user", "" );
210 $t->set_var( "pay_with_voucher", "false" );
211
212
213 $t->set_block( "order_disclaimer_tpl", "order_disclaimer" );
214 $t->set_block( "shipping_disclaimer_tpl", "shipping_disclaimer" );
215
216 /*
217 $t->set_var( "order_disclaimer_text", "$OrderDisclaimerText" );
218 $t->set_var( "shipping_disclaimer_text", "$ShippingDisclaimerText" );
219 */
220
221 $t->set_var( "order_disclaimer_text", "By submitting this order, I hereby agree to FullThrottle.com's <a href=\"/policy/return\">Return Policy</a> and <a href=\"/policy/shipping\">Shipping Policy</a>" );
222
223 $t->set_var( "shipping_disclaimer_text", "Please call us before ordering to confirm availability if you need the items delivered by a specific date!" );
224
225 $t->parse( "order_disclaimer", "order_disclaimer_tpl" );
226 $t->parse( "shipping_disclaimer", "shipping_disclaimer_tpl" );
227
228
229 if ( isset ( $RemoveVoucher ) )
230
231 {
232 if ( count ( $RemoveVoucherArray ) > 0 )
233 {
234 $newArray = array();
235 $payWithVoucher = $session->arrayValue( "PayWithVoucher" );
236
237 while( list($key,$voucherID) = each( $payWithVoucher ) )
238 {
239 if ( !in_array ( $voucherID, $RemoveVoucherArray ) )
240 $newArray[$voucherID] = $price;
241 }
242
243 $session->setVariable( "PayWithVoucher", "" );
244 }
245 }
246
247 //wha?
248 $test = "test";
249
250 if ( isset( $SendOrder ) )
251 {
252
253 // die ( eZHTTPTool::getVar( "ShippingTypeID", true ) );
254
255 if( eZHTTPTool::getVar( "ShippingTypeID" ) ){
256 // print( "totaly ");
257 // which shipping type?
258 $currentTypeID = eZHTTPTool::getVar( "ShippingTypeID" );
259 // $currentTypeID = $currentTypeID['0'];
260 // $currentTypeID[0] = $currentTypeID['0'];
261
262 // $ShippingTypeID = $currentTypeID['0'];
263 // echo '<br /> CurrentTypeID:: ' . $ShippingTypeID;
264
265 // echo "REQUEST: <br><br>";
266 // print_r($_REQUEST);
267
268 /*
269 echo "<br><br>";
270 $ShippingTypeID = $_REQUEST[ShippingTypeID];
271 echo 'ShippingType: ' . $ShippingTypeID['0'];
272 */
273
274 }else{
275 // default to ... shipping type
276 // print( "totaly not");
277 $currentTypeID[0] = "03";
278 }
279
280 /*
281 echo $currentTypeID;
282 phpinfo();
283 die();
284
285 */
286
287 // set the variables as session variables and make sure that it is not read by
288 // the HTTP GET variables for security.
289 if(empty($currentTypeID[0]))
290 {
291 $uuid = $user->id();
292 echo "<h3>Error:Your Shipping Address may be wrong.</h3>";
293 // eZHTTPTool::header( "Location:/user/userwithaddress/edit/$uuid/" );
294 eZHTTPTool::header( "Location: /trade/checkout/" );
295 exit;
296 }
297
298 $preOrder = new eZPreOrder();
299 $preOrder->store();
300
302 // User Info Swap ....
303
304 $session->setVariable( "PreOrderID", $preOrder->id() );
305 /*
306
307 $session->setVariable( "ShippingAddressID", $_POST["ShippingAddressID"] );
308 $session->setVariable( "BillingAddressID", $_POST["BillingAddressID"] );
309
310 $session->setVariable( "ShippingAddressID", eZHTTPTool::getVar( "ShippingAddressID", true ) );
311 $session->setVariable( "BillingAddressID", eZHTTPTool::getVar( "BillingAddressID", true ) );
312
313 $session->setVariable( "ShippingAddressID", eZHTTPTool::getVar( "ShippingAddressID" );
314 $session->setVariable( "BillingAddressID", eZHTTPTool::getVar( "BillingAddressID" );
315
316 */
317
318 $session->setVariable( "ShippingAddressID", eZHTTPTool::getVar( "ShippingAddressID", true ) );
319 $session->setVariable( "BillingAddressID", eZHTTPTool::getVar( "BillingAddressID", true ) );
320
322
323 $session->setVariable( "TotalCost", eZHTTPTool::getVar( "TotalCost", true ) );
324 $session->setVariable( "TotalVAT", eZHTTPTool::getVar( "TotalVAT", true ) );
325
326 if ( eZHTTPTool::getVar( "PayWithVoucher", true ) == "true" )
327 {
328 if ( eZHTTPTool::getVar( "PaymentMethod", true ) )
329 $session->setArray( "PaymentMethod", array( eZHTTPTool::getVar( "PaymentMethod", true ), "voucher_done" ) );
330 else
331 $session->setArray( "PaymentMethod", array( "voucher_done" ) );
332 }
333 else
334 $session->setArray( "PaymentMethod", array( eZHTTPTool::getVar( "PaymentMethod", true ) ) );
335
336 // $session->setVariable( "AuthCode", eZHTTPTool::getVar( "AuthCode", true ) );
337
338 $session->setVariable( "Comment", eZHTTPTool::getVar( "Comment", true ), eZHTTPTool::getVar( "Comment", true ) );
339
340 $session->setVariable( "ShippingCost", $cart->shippingCost( new eZShippingType( $currentTypeID ) ) );
341 $session->setVariable( "ShippingVAT", $cart->shippingVAT( new eZShippingType( $currentTypeID ) ) );
342
343 $session->setVariable( "ShippingCost",eZHTTPTool::getVar("shippcost"),true);
344 $session->setVariable( "ShippingVAT", eZHTTPTool::getVar("ShippingVAT"),true);
345 $session->setVariable( "ShippingTypeID", $currentTypeID[0], true);
346
347 // create a new order
348 $order = new eZOrder();
349 $user =& eZUser::currentUser();
350
351 if ( !is_a( $user, "eZUser" ) )
352 {
353 eZPBLog::writeWarning( "user/payment.php: Got paymentSuccess without user logged in" );
354 eZHTTPTool::header( "Location: /trade/cart/" );
355 exit();
356 }
357
358
360 // very important step .... possible breakdown for "user info swap"
361
362 $order->setUser( $user );
363
364 if ( $ini->variable( "eZTradeMain", "ShowBillingAddress" ) != "enabled" )
365 {
366 $billingAddressID = $shippingAddressID;
367 }
368
369 $addressList = $user->addresses();
370
371 $shippingAddress = new eZAddress( $session->variable( "ShippingAddressID" ) );
372 $billingAddress = new eZAddress( $session->variable( "BillingAddressID" ) );
373
375 // assumsions here are fairly safe, but not completely (user could switch order of usage here)
376 /*
377 if( $addressList[1] ){
378 $shippingAddress = $addressList[1];
379 $billingAddress = $addressList[0];
380 }else{
381 $shippingAddress = $addressList[0];
382 $billingAddress = $addressList[0];
383 }
384 */
385
386 // kracker (2005.05.20)
387 /*
388 print_r( $shippingAddress );
389 echo "<br>";
390 print_r( $billingAddress );
391 die();
392 */
393
394 //
396
397 $order->setShippingCharge( $session->variable( "ShippingCost" ) );
398 $order->setShippingVAT( $session->variable( "ShippingVAT" ) );
399
401 // very important step .... possible breakdown for "user info swap"
402
403 $order->setShippingAddress( $shippingAddress, $user );
404 $order->setBillingAddress( $billingAddress, $user );
405
406 //
408
409 $order->setPaymentMethod( $session->arrayValue( "PaymentMethod" ) );
410
411 // $order->setAuthCode( $session->variable( "AuthCode" ) );
412
413 // $order->setShippingTypeID( $session->variable( "ShippingTypeID" ) );
414
415 $order->setShippingTypeID($currentTypeID[0]);
416
417 $order->setComment( stripslashes($Comment) );
418
419 $order->setPersonID( $cart->personID() );
420 $order->setCompanyID( $cart->companyID() );
421
422 if($_POST['ShippingVAT'] > 0 || $_POST['TotalVAT'] > 0 )
423 $order->setIsVATInc( true );
424 else
425 $order->setIsVATInc( false );
426
427
428 // fetch the cart items
429 $items = $cart->items();
430
431 // exit if no items exist
432 if ( count ( $items ) == 0 )
433 {
434 eZHTTPTool::header( "Location: /trade/cart/" );
435 exit();
436 }
437
438 $order->store();
439
440
441 $order_id = $order->id();
442
443 $session->setVariable( "OrderID", $order_id );
444 $session->setVariable( "OrderConfirmation", $order_id );
445
446 foreach ( $items as $item )
447 {
448 $totalVAT=0.0;
449 $price=0.0;
450 $totalPrice=0.0;
451 $product = $item->product();
452
453 // create a new order item.
454 $orderItem = new eZOrderItem();
455 $orderItem->setOrder( $order );
456 $orderItem->setProduct( $product );
457 $orderItem->setCount( $item->count() );
458
459 // Set the product price.
460 $price = $item->correctPrice( false, true, false );
461 $orderItem->setPrice( $price );
462
463 // Set the VAT for this product.
464 $totalVAT = $item->vat( false, true );
465 $orderItem->setVAT( $totalVAT );
466
467 $expiryTime = $product->expiryTime();
468 if ( $expiryTime > 0 )
469 $orderItem->setExpiryDate( (new eZDateTime())->timeStamp( true ) + ( $expiryTime * 86400 ) );
470 else
471 $orderItem->setExpiryDate( 0 );
472
473 $orderItem->store();
474
475 // Store the optionvalues.
476 $optionValues =& $item->optionValues();
477 if ( count( $optionValues ) > 0 )
478 {
479 foreach ( $optionValues as $optionValue )
480 {
481 $option =& $optionValue->option();
482 $value =& $optionValue->optionValue();
483
484 $orderOptionValue = new eZOrderOptionValue();
485 $orderOptionValue->setOrderItem( $orderItem );
486
487 $orderOptionValue->setRemoteID( $optionValue->remoteID() );
488
489 $descriptions =& $value->descriptions();
490
491 $orderOptionValue->setOptionName( $option->name() );
492 $orderOptionValue->setValueName( $descriptions[0] );
493 // fix
494
495 $orderOptionValue->store();
496 }
497 }
498 }
499
500
501 eZHTTPTool::header( "Location: /trade/payment/" );
502 exit();
503 }
504
505 // show the shipping types
506 $type = new eZShippingType();
507 $types = $type->getAll();
508
509 // print_r($types);
510
511
512 //qcomp AMin.
513 if ($cart->ShipServiceCode && (! eZHTTPTool::getVar( "ShippingTypeID" )))
514 {
515 $currentTypeID[0] = $cart->ShipServiceCode;
516 }
517
518 if ($cart->AddressID)
519 {
520 $shipaddID = $cart->AddressID;
521 }
522
523
524 if (true || eZHTTPTool::getVar( "ShippingTypeID" ) || eZHTTPTool::getVar( "ShippingAddressID" ))
525 {
526 //$currentTypeID = eZHTTPTool::getVar( "ShippingTypeID" );
527 $shipaddID = eZHTTPTool::getVar( "ShippingAddressID" );
528 if ( is_numeric( $shipaddID ) )
529 {
530 $cart->AddressID=$shipaddID;
531 $cart->ShipServiceCode=$currentTypeID[0];
532 $cart->storeshipoptions($currentTypeID[0],$shipaddID);
533 }
534 }
535
536 //End qcomp AMin.
537
538
539 $markup =0;
540
541 $currentShippingType = false;
542
543 $thisuser =& eZUser::currentUser();
544
545 $id = $thisuser->id();
546
547 $t->set_var( "shipping_type_error","");
548
549 if( $checkups == 1 )
550 {
551
552 }
553 else
554 {
555
556 foreach ( $types as $type )
557 {
558 $t->set_var( "shipping_type_id", $type->id() );
559 $t->set_var( "shipping_type_name", $type->name() );
560 $t->set_var( "shipping_type_cost", "" );
561 }
562
563 if ( is_numeric( $currentTypeID ) )
564 {
565 if ( $currentTypeID == $type->id() )
566 {
567 $currentShippingType = $type;
568 $t->set_var( "type_selected", "selected" );
569 }
570 else
571 $t->set_var( "type_selected", "" );
572 }
573 else
574 {
575 if ( $type->isDefault() )
576 {
577 $currentShippingType = $type;
578 $t->set_var( "type_selected", "selected" );
579 }
580 else
581 $t->set_var( "type_selected", "" );
582 }
583
584 $t->parse( "shipping_type", "shipping_type_tpl", true );
585 }
586
587 $vat = true;
588 $address = new eZAddress();
589
590 if ($cart->AddressID){
591 $taxaddressID = $cart->AddressID;
592 }elseif( eZHTTPTool::getVar( "ShippingAddressID" ) ){
593 $taxaddressID = eZHTTPTool::getVar( "ShippingAddressID" );
594 }else {
595 $addressList = $thisuser->addresses();
596
597 if( isset($addressList[1]) ){
598 $taxaddressObj = $addressList[1];
599 }else{
600 $taxaddressObj = $addressList[0];
601 }
602
603 //$taxaddressObj = $address->mainAddress($thisuser);
604 // print_r($addressList);
605
606 $taxaddressID = $taxaddressObj->ID();
607 }
608
610 // possible bug? "User Info Swap"
611
612 //if ( eZHTTPTool::getVar( "ShippingAddressID" ) )
613 //{
614
615 $shippingAddress = new eZAddress( $taxaddressID );
616 $shippingRegion =& $shippingAddress->region();
617
618 // $billingAddress = new eZAddress( $BillingAddressID );
619 // $billingRegion =& $billingAddress->region();
620 // $country =& $address->country();
621
622
624 // Open Ended Comment : Re : Shipping Vats .... ?
625 /*
626 if ( !$shippingRegion->hasVAT() || !$StateTaxShipping
627 || ( $shippingRegion->hasVAT() && !$billingRegion->hasVAT() )
628 )
629 $vat = false;
630 */
631
632 if ( !$shippingRegion )
633 $vat = false;
634 else
635 {
636 if ( !$shippingRegion->hasVAT() )
637 $vat = false;
638 }
639 /*
640 else if ( $CountryVATDiscrimination == true )
641 {
642 $address = new eZAddress();
643 $mainAddress = $address->mainAddress( $user );
644
645 $country =& $mainAddress->country();
646 if ( !$country && !$country->hasVAT() )
647 {
648 $vat = false;
649 $totalVAT = 0;
650 }
651 else
652 {
653 $vat = false;
654 $totalVAT = 0;
655 }
656 }
657 */
658 if ( $vat == false )
659 {
660 $ShowExTaxColumn = true;
661 $PricesIncludeVAT = false;
662 $ShowExTaxTotal = true;
663 $ShowIncTaxColumn = false;
664 }
665
666 function turnColumnsOnOff( $rowName, $t, $ShowSavingsColumn = false, $ShowExTaxColumn = false, $ShowIncTaxColumn = false )
667 {
668 if ( $ShowSavingsColumn == true )
669 {
670 $t->parse( $rowName . "_savings_item", $rowName . "_savings_item_tpl" );
671 }
672 else
673 {
674 $t->set_var( $rowName . "_savings_item", "" );
675 }
676
677 if ( $ShowExTaxColumn == true )
678 {
679 $t->parse( $rowName . "_ex_tax_item", $rowName . "_ex_tax_item_tpl" );
680 }
681 else
682 {
683 $t->set_var( $rowName . "_ex_tax_item", "" );
684 }
685
686 if ( $ShowIncTaxColumn == true )
687 {
688 $t->parse( $rowName . "_inc_tax_item", $rowName . "_inc_tax_item_tpl" );
689 }
690 else
691 {
692 $t->set_var( $rowName . "_inc_tax_item", "" );
693 }
694 }
695
696 $items = $cart->items( );
697
698 foreach ( $items as $item )
699 {
700 if ( $item->correctSavings( false, true, $PricesIncludeVAT ) > 0 )
701 {
702 $ShowSavingsColumn = true;
703 }
704 }
705
706 foreach ( $items as $item )
707 {
708 $t->set_var( "td_class", ( $i % 2 ) == 0 ? "bglight" : "bgdark" );
709 $i++;
710 $t->set_var( "cart_item_id", $item->id() );
711 $product =& $item->product();
712
713 $t->set_var( "product_id", $product->id() );
714 $t->set_var( "product_name", $product->name() );
715 $t->set_var( "product_number", $product->productNumber() );
716 $t->set_var( "product_price", $item->localePrice( false, true, $PricesIncludeVAT, false ) );
717 $t->set_var( "product_count", $item->count() );
718 $t->set_var( "product_total_ex_tax", $item->localePrice( true, true, false ) );
719 $t->set_var( "product_total_inc_tax", $item->localePrice( true, true, true ) );
720
721 if( !isset( $numberOfItems ) )
722 $numberOfItems = 1;
723 else
724 $numberOfItems++;
725
726 $numberOfOptions = 0;
727
728 $optionValues =& $item->optionValues();
729
730 $t->set_var( "cart_item_option", "" );
731 $t->set_var( "cart_item_basis", "" );
732
733 if ( $product->productType() == 2 )
734 $useVoucher = true;
735 else
736 $useVoucher = false;
737
738 foreach ( $optionValues as $optionValue )
739 {
740 turnColumnsOnOff( "option", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
741
742 $option =& $optionValue->option();
743 $value =& $optionValue->optionValue();
744 $value_quantity = $value->totalQuantity();
745 $descriptions = $value->descriptions();
746
747 $t->set_var( "option_id", $option->id() );
748 $t->set_var( "option_name", $option->name() );
749
750 if ( count( $descriptions ) > 0 )
751 {
752 $t->set_var( "option_value", $descriptions[0] );
753 }
754 else
755 {
756 $t->set_var( "option_value", $value->option()->name() );
757 }
758
759 if ( $value->localePrice( $PricesIncludeVAT, $product ) == 0 )
760 $t->set_var( "option_price", "" );
761 else
762 $t->set_var( "option_price", $value->localePrice( $PricesIncludeVAT, $product ) );
763 $t->parse( "cart_item_option", "cart_item_option_tpl", true );
764
765 $numberOfOptions++;
766 }
767 turnColumnsOnOff( "cart", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
768 turnColumnsOnOff( "basis", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
769
770 if ( $ShowSavingsColumn == true )
771 {
772 if ( $item->correctSavings( true, true, $PricesIncludeVAT ) > 0 )
773 {
774 $t->set_var( "product_savings", $item->localeSavings( true, true, $PricesIncludeVAT ) );
775 }
776 else
777 {
778 $t->set_var( "product_savings", "&nbsp;" );
779 }
780 $t->parse( "cart_savings_item", "cart_savings_item_tpl" );
781 }
782 else
783 {
784 $t->set_var( "cart_savings_item", "" );
785 }
786
787 if ( $numberOfOptions == 0 )
788 {
789 $t->set_var( "cart_item_option", "" );
790 $t->set_var( "cart_item_basis", "" );
791 }
792 else
793 {
794 if( $product->price() > 0 )
795 {
796 $t->set_var( "basis_price", $item->localePrice( false, false, $PricesIncludeVAT ) );
797 $t->parse( "cart_item_basis", "cart_item_basis_tpl", true );
798 }
799 else
800 {
801 $t->set_var( "cart_item_basis", "" );
802 }
803 }
804 $t->parse( "cart_item", "cart_item_tpl", true );
805 }
806
807
808 if ( $numberOfItems > 0 )
809 {
810 $ShowCart = true;
811 }
812
813 $t->setAllStrings();
814
815 turnColumnsOnOff( "header", $t, $ShowSavingsColumn, $ShowExTaxColumn, $ShowIncTaxColumn );
816
817 $locale = new eZLocale( $Language );
818 $currency = new eZCurrency();
819
820 if ( $ShowCart == true )
821 {
822 // Vouchers
823 // qcomp Amin
824
826 // graham : 2005-05-24 : this gets the shipping types
827 $upsresults = $cart->cartTotals( $tax, $total, false, true, $vat );
828
829 //print_r($total); exit();
830
831
832 // This is the real shipping name code
833
834 if($checkups==1)
835 {
836 if($thisuser)
837 {
838 $getnames =array(
839 '01' => 'UPS Next Day Air',
840 '02' => 'UPS 2nd Day Air',
841 '03' => 'UPS Ground',
842 '07' => 'UPS Worldwide Express',
843 '08' => 'UPS Worldwide Expedited',
844 '11' => 'UPS Standard',
845 '12' => 'UPS 3 Day Select',
846 '13' => 'UPS Next Day Air Saver',
847 '14' => 'UPS Next Day Air Early A.M.',
848 '54' => 'UPS Worldwide Express Plus',
849 '59' => 'UPS 2nd Day Air A.M.',
850 '64' => '',
851 '65' => 'UPS Express Saver',
852 );
853
854 $codearr = array();
855 $codarr = array();
856
857 if(empty($upsresults) || $upsresults[0] == '||')
858 {
859 // Depricated Oneline?
860 // echo "<h3><font color=\"#ff0000\">Error:Your Shipping address may be wrong.</font></h3>";
861
862 $t->set_var( "shipping_type_error","<font color=\"#ff0000\">Error: Your Shipping address may be wrong. Please re-check your post code.</font>");
863 }
864 else
865 {
866 $t->set_var( "shipping_type_error","");
867 }
868
869 foreach($upsresults as $upsr)
870 {
871 $splups=explode("\|\|",$upsr);
872 if( isset( $splups[1] ) && $splups[1] != "" )
873 $codearr[] = array($splups[0],$splups[1]);
874 }
875
876 $codesort = asort($codearr);
877
878 foreach($codearr as $cod)
879 {
880 $codarr[] = $cod;
881 }
882
883 $ii=0;
884 foreach($codarr as $co)
885 {
886 if( isset( $co[1] ) && $co[1] != "" )
887 $ser_code = $co[1];
888 else
889 $ser_code = false;
890
891 // $splups=explode("\|\|",$upsr);
892
893 //for USPS
894 if (isset($getnames["$ser_code"]))
895 {
896 $service_name= $getnames["$ser_code"];
897 }
898 else
899 {
900 $service_name=$ser_code;
901 }
902
903 // Shippment Type
904 $concade = $service_name ." $ " .sprintf("%01.2f", $co[0]);
905 // print($concade . "<br />");
906 // print($co[1] . "<br />");
907
908 $t->set_var( "shipping_type_id",$co[1]);
909 $t->set_var( "shipping_type_name",$concade);
910 $t->set_var( "shipping_type_cost",sprintf("%01.2f", $co[0]));
911
912 if ( $currentTypeID[0] == $co[1])
913 {
914 $test = "$currentTypeID[0], $co[1], $concade";
915 $currentShippingType = $type;
916
917 $t->set_var( "ship_get_name",$concade);
918 $t->set_var( "type_selected", "selected" );
919 $markup = 1;
920 }
921 elseif((isset($cc[0]) && ($ii==0)&&($cc[0])))
922 {
923 $t->set_var( "type_selected", "selected" );
924 $markup = 1;
925 }
926 else
927 {
928 $t->set_var( "type_selected", "" );
929 }
930
931 $t->parse( "shipping_type", "shipping_type_tpl", true );
932
933 $ii +=1;
934 }
935 }
936 else
937 {
938 foreach ( $types as $type )
939 {
940 $t->set_var( "shipping_type_id","");
941 $t->set_var( "shipping_type_name","");
942 $t->set_var( "shipping_type_cost", "" );
943
944 $t->parse( "shipping_type", "shipping_type_tpl", true );
945 }
946 }
947 }
948
949 // End qcomp Amin
950
951 $t->set_var( "empty_cart", "" );
952 $t->set_var( "voucher_item", "" );
953
954 $vouchers = $session->arrayValue( "PayWithVoucher" );
955 if ( count ( $vouchers ) > 0 )
956 {
957 $t->set_var( "vouchers", "" );
958 $t->set_var( "voucher_item", "" );
959 $i=1;
960 $continue = true;
961
962 foreach( $vouchers as $voucherID )
963 {
964 if ( $continue )
965 {
966 $voucher = new eZVoucher( $voucherID );
967
968 $voucherID = $voucher->id();
969
970 $voucherPrice = $voucher->price();
971
972 $cart->cartTotals( $tax, $voucherPrice, $voucher );
973
974 if ( $voucherPrice["inctax"] > $total["inctax"] )
975 {
976 $subtractIncVAT["inctax"] = $total["inctax"];
977 $currency->setValue( $total["inctax"] );
978 $t->set_var( "voucher_price_inc_vat", $locale->format( $currency ) );
979
980 $subtractExTax["extax"] = $total["extax"];
981 $currency->setValue( $total["extax"] );
982 $t->set_var( "voucher_price_ex_vat", $locale->format( $currency ) );
983 $continue = false;
984 }
985 else
986 {
987 $subtractIncVAT["inctax"] = $voucherPrice["inctax"];
988 $currency->setValue( $voucherPrice["inctax"] );
989 $t->set_var( "voucher_price_inc_vat", $locale->format( $currency ) );
990
991 $subtractExTax["extax"] = $voucherPrice["extax"];
992 $currency->setValue( $voucherPrice["extax"] );
993 $t->set_var( "voucher_price_ex_vat", $locale->format( $currency ) );
994 }
995
996 $voucherSession[$voucherID] = $subtractIncVAT["inctax"];
997 $t->set_var( "number", $i );
998
999 $t->set_var( "voucher_key", $voucher->keyNumber() );
1000 $t->set_var( "pay_with_voucher", "true" );
1001
1002 $t->parse( "voucher_item", "voucher_item_tpl", true );
1003
1004 $total["extax"] -= $subtractExTax["extax"];
1005 $total["inctax"] -= $subtractIncVAT["inctax"];
1006
1007 $i++;
1008 }
1009 }
1010 $t->parse( "remove_voucher", "remove_voucher_tpl" );
1011 }
1012 else
1013 $t->set_var( "remove_voucher", "" );
1014
1015 if ( isset( $voucherSession ) && is_array ( $voucherSession ) )
1016 {
1017 $t->parse( "vouchers", "vouchers_tpl" );
1018 $session->setArray( "PayedWith", $voucherSession );
1019 }
1020
1021 $currency->setValue( $total["subinctax"] );
1022 $t->set_var( "subtotal_inc_tax", $locale->format( $currency ) );
1023
1024 $currency->setValue( $total["subextax"] );
1025 $t->set_var( "subtotal_ex_tax", $locale->format( $currency ) );
1026
1027 $currency->setValue( $total["inctax"] );
1028 $t->set_var( "total_inc_tax", $locale->format( $currency ) );
1029
1030
1032 // kracker(2005-20-05): tax_percentage : first change
1033 // orig
1034 // $t->set_var( "tax_percentage", round( (($total["tax"])/$total["subextax"])*100 , 2) );
1035
1036 // static display only fix (that's what this wrong .... no)
1037 // $t->set_var( "tax_percentage", round(7.00, 2) );
1038
1039 // the dynamic user : ez region : vat fix ....
1040 // $t->set_var( "tax_percentage", round(7.00, 2) );
1041
1042 // Description:
1043 // take user,
1044 // get it's main address ( how do you tell if its the shipping address? can't untill after this view currently )
1045 // consider an option to add to user registration to specify shipping address preference durring userwithaddress edit
1046 // that option used to exist! client asked for it's removal ... grrr
1047 // this would screw upp everything, andcould provide free shipping based on first address in system
1048
1049 // so we can't really know where it's going attthis point or calc the proper shipping,
1050 // shipping tax rate, tax rate, total tax, product total w/o / w/tax ...
1051
1052 // major workflow / user address managment bug (pre-existing)
1053
1054 //
1056 $t->set_var( "tax_percentage", round( ( $total["tax"]) / ($total["subextax"] + $total["shipextax"]) * 100 , 2 ) );
1057
1058 // $t->set_var( "tax_percentage", round(7.00, 2) );
1059
1061
1062 $t->set_var( "tax_total", "" );
1063
1064 if ( !$ShowIncTaxColumn )
1065 {
1066 $currency->setValue( $total["inctax"] );
1067 $t->set_var( "total_ex_tax", $locale->format( $currency ) );
1068
1069 if ( $total["tax"]>0 )
1070 $t->parse( "tax_total", "tax_total_tpl" );
1071 else
1072 $t->set_var( "tax_total", "" );
1073 }
1074 else
1075 {
1076 $currency->setValue( $total["extax"] );
1077 $t->set_var( "total_ex_tax", $locale->format( $currency ) );
1078 $t->set_var( "tax_total", "" );
1079 }
1080
1081 $currency->setValue( $total["shipinctax"] );
1082 $t->set_var( "shipping_inc_tax", $locale->format( $currency ) );
1083
1084 $currency->setValue( $total["tax"] );
1085 $t->set_var( "total_cart_tax", $locale->format( $currency ) );
1086
1087 $t->set_var( "shipping_inc_hide_tax",$total["shipinctax"] );
1088 $currency->setValue( $total["shipextax"] );
1089 $t->set_var( "shipping_ex_tax", $locale->format( $currency ) );
1090 $t->set_var( "shipping_ex_hide_tax", $total["shipextax"] );
1091
1092 if ( $ShowSavingsColumn == false )
1093 {
1094 $ColSpanSizeTotals--;
1095 }
1096
1097 $SubTotalsColumns = $ColSpanSizeTotals;
1098
1099 if ( $ShowExTaxColumn == true )
1100 {
1101 if ( $ShowExTaxTotal == true or $ShowIncTaxColumn == false )
1102 {
1103 $GLOBALS["shcost"] = $total["shipextax"];
1104 $t->parse( "total_ex_tax_item", "total_ex_tax_item_tpl" );
1105 $t->parse( "subtotal_ex_tax_item", "subtotal_ex_tax_item_tpl" );
1106 $t->parse( "shipping_ex_tax_item", "shipping_ex_tax_item_tpl" );
1107 }
1108 else
1109 {
1110 $GLOBALS["shcost"] = $total["shipinctax"];
1111 $t->set_var( "total_ex_tax_item", "" );
1112 $t->set_var( "subtotal_ex_tax_item", "" );
1113 $t->set_var( "shipping_ex_tax_item", "" );
1114 }
1115 }
1116 else
1117 {
1118 $ColSpanSizeTotals--;
1119 $t->set_var( "total_ex_tax_item", "" );
1120 $t->set_var( "subtotal_ex_tax_item", "" );
1121 $t->set_var( "shipping_ex_tax_item", "" );
1122 }
1123
1124 if ( $ShowIncTaxColumn == true )
1125 {
1126 $t->parse( "total_inc_tax_item", "total_inc_tax_item_tpl" );
1127 $t->parse( "subtotal_inc_tax_item", "subtotal_inc_tax_item_tpl" );
1128 $t->parse( "shipping_inc_tax_item", "shipping_inc_tax_item_tpl" );
1129 }
1130 else
1131 {
1132 $ColSpanSizeTotals--;
1133 $t->set_var( "total_inc_tax_item", "" );
1134 $t->set_var( "subtotal_inc_tax_item", "" );
1135 $t->set_var( "shipping_inc_tax_item", "" );
1136 }
1137
1138 if ( $ShowIncTaxColumn and $ShowExTaxColumn and $ShowExTaxTotal )
1139 {
1140 $t->set_var( "subtotals_span_size", $SubTotalsColumns - 1 );
1141 }
1142 else
1143 {
1144 $t->set_var( "subtotals_span_size", $ColSpanSizeTotals );
1145 }
1146
1147 $t->set_var( "totals_span_size", $ColSpanSizeTotals );
1148 $t->parse( "cart_item_list", "cart_item_list_tpl" );
1149 $t->parse( "full_cart", "full_cart_tpl" );
1150
1151 if( $vat == true )
1152 {
1153 $currency->setValue( $total["tax"] );
1154 $t->set_var( "tax", $locale->format( $currency ) );
1155
1156 foreach( $tax as $taxGroup )
1157 {
1158 $currency->setValue( $taxGroup["basis"] );
1159 $t->set_var( "sub_tax_basis", $locale->format( $currency ) );
1160
1161 $currency->setValue( $taxGroup["tax"] );
1162 $t->set_var( "sub_tax", $locale->format( $currency ) );
1163
1164 $t->set_var( "sub_tax_percentage", $taxGroup["percentage"] );
1165 $t->parse( "tax_item", "tax_item_tpl", true );
1166 }
1167 $t->parse( "tax_specification", "tax_specification_tpl" );
1168 }
1169 else
1170 $t->set_var( "tax_specification", "" );
1171 }
1172 else
1173 {
1174 $t->parse( "empty_cart", "empty_cart_tpl" );
1175 $t->parse( "cart_checkout", "cart_checkout_tpl" );
1176 $t->set_var( "cart_checkout_button", "" );
1177 $t->set_var( "cart_item_list", "" );
1178 $t->set_var( "full_cart", "" );
1179 $t->set_var( "tax_specification", "" );
1180 $t->set_var( "tax_item", "" );
1181 }
1182
1183
1184
1185 $can_checkout = true;
1186
1187 $user =& eZUser::currentUser();
1188
1189 $t->set_var( "user_id", $user->id() );
1190 // print out the addresses
1191
1192 if ( $cart->personID() == 0 && $cart->companyID() == 0 )
1193 {
1194 $t->set_var( "customer_first_name", $user->firstName() );
1195 $t->set_var( "customer_last_name", $user->lastName() );
1196
1197 $addressArray = $user->addresses();
1198 }
1199 else
1200 {
1201 if ( $cart->personID() > 0 )
1202 {
1203 $customer = new eZPerson( $cart->personID() );
1204 $t->set_var( "customer_first_name", $customer->firstName() );
1205 $t->set_var( "customer_last_name", $customer->lastName() );
1206 }
1207 else
1208 {
1209 $customer = new eZCompany( $cart->companyID() );
1210 $t->set_var( "customer_first_name", $customer->name() );
1211 $t->set_var( "customer_last_name", "" );
1212 }
1213
1214 $addressArray = $customer->addresses();
1215 }
1216
1217 if ( $checkups == 1 )
1218 {
1219 $t->set_var("shipchange","onchange=\"return shipaddchange(this.form)\"");
1220 }
1221 else
1222 {
1223 $t->set_var("shipchange","");
1224 }
1225
1226 $t->parse( "shipping_select", "shipping_select_tpl", true );
1227
1228 foreach ( $addressArray as $address )
1229 {
1230 $t->set_var( "address_id", $address->id() );
1231 $t->set_var( "street1", $address->street1() );
1232
1233 if ( $address->street2() )
1234 $t->set_var( "street2", $address->street2().",&nbsp;" );
1235 else
1236 $t->set_var( "street2", "" );
1237
1238 $t->set_var( "zip", $address->zip() );
1239 $t->set_var( "place", $address->place() );
1240
1241 $country = $address->country();
1242
1243 if ( $country )
1244 {
1245 $country = ", " . $country->name();
1246 }
1247
1248 if ( $ini->variable( "eZUserMain", "SelectCountry" ) == "enabled" )
1249 $t->set_var( "country", $country );
1250 else
1251 $t->set_var( "country", "" );
1257 $region = $address->region();
1258
1259 if ( $region )
1260 {
1261 $region = ", " . $region->name();
1262 }
1263
1264 if ( $ini->variable( "eZUserMain", "SelectRegion" ) == "enabled" )
1265 $t->set_var( "region", $region );
1266 else
1267 $t->set_var( "region", "" );
1268
1269 unset( $mainAddress );
1270 $t->set_var( "is_selected", "" );
1271
1272 if ( isset( $BillingAddressID ) && $BillingAddressID == "" )
1273 {
1274 $mainAddress = $addressList[0];
1275
1276 //$mainAddress = $address->mainAddress( $user );
1277 $BillingAddressID = $mainAddress->id();
1278 }
1279
1280 /*
1281 if ( get_class( $mainAddress ) == "ezaddress" )
1282 {
1283 if ( $mainAddress->id() == $address->id() )
1284 {
1285 $t->set_var( "is_selected", "selected" );
1286 }
1287 }
1288 */
1289
1290 if ( $ini->variable( "eZTradeMain", "ShowBillingAddress" ) == "enabled" )
1291 {
1292 if ( isset( $BillingAddressID ) && (int)$BillingAddressID == $address->id() )
1293 $t->set_var( "billing_selected", "selected" );
1294 else
1295 $t->set_var( "billing_selected", "" );
1296 $t->parse( "billing_option", "billing_option_tpl", true );
1297 }
1298 else
1299 $t->set_var( "billing_option", "" );
1300
1301 $t->set_var("type_selected","");
1302
1303 if ($shipaddID == ""){
1304 if($addressList){
1305 if(isset($addressList[1]) &&$addressList[1]){
1306 $shipaddID = $addressList[1]->ID();
1307 }else{
1308 $shipaddID = $addressList[0]->ID();
1309 }
1310 }
1311 //$shipaddID = $mainAddress->id();
1312 }
1313
1314 if($shipaddID==$address->id())
1315 {
1316 $t->set_var("lastshipid","$shipaddID");
1317 $t->set_var("type_selected","selected");
1318 }
1319
1320 $t->parse( "shipping_address", "shipping_address_tpl", true );
1321 }
1322
1323
1324 if ( $ini->variable( "eZTradeMain", "ShowBillingAddress" ) == "enabled" )
1325 $t->parse( "billing_address", "billing_address_tpl", true );
1326 else
1327 $t->set_var( "billing_address", "" );
1328
1329
1330 // show the checkout types
1331
1332 if ( $total["inctax"] )
1333 {
1334 $checkout = new eZCheckout();
1335
1336 $instance =& $checkout->instance();
1337
1338 $paymentMethods =& $instance->paymentMethods( $useVoucher );
1339
1340 foreach ( $paymentMethods as $paymentMethod )
1341 {
1342 $t->set_var( "payment_method_id", $paymentMethod["ID"] );
1343 $t->set_var( "payment_method_text", $paymentMethod["Text"] );
1344
1345 $t->parse( "payment_method", "payment_method_tpl", true );
1346 }
1347 $t->parse( "show_payment", "show_payment_tpl" );
1348 }
1349 else
1350 {
1351 $t->set_var( "show_payment", "" );
1352 }
1353 $t->set_var( "sendorder_item", "" );
1354
1355 // Print the total sum.
1356 if ( isset( $totalVoucher ) )
1357 $total["inctax"] = $total["inctax"] - $totalVoucher["inctax"];
1358 else
1359 $total["inctax"] = $total["inctax"];
1360
1361 $currency->setValue( $total["inctax"] );
1362 $t->set_var( "cart_sum", $locale->format( $currency ) );
1363 $t->set_var( "cart_colspan", 1 + $i );
1364
1365 if ( isset( $sum ) && $sum <= 0 )
1366 $payment = false;
1367 else
1368 $payment = true;
1369
1370 // the total cost of the payment
1371
1372 $t->set_var( "total_cost_value", round($total["inctax"],2) );
1373
1374 //$t->set_var( "total_vat_value", $totalVAT );
1375 $t->set_var( "total_vat_value", round($total["tax"],2) );
1376 $t->set_var( "shipping_cost_value", round((float)$total["shipinctax"],2) );
1377 $t->set_var( "shipping_vat_value", round($total["shiptax"],2) );
1378
1379 // A check should be done in the code above for qty.
1380 $can_checkout = true;
1381
1382 if ( $can_checkout )
1383 $t->parse( "sendorder_item", "sendorder_item_tpl" );
1384
1385 $t->pparse( "output", "checkout_page_tpl" );
1386
1387 ?>
$i
$i
Definition: admin/adlist.php:91
$ColSpanSizeTotals
$ColSpanSizeTotals
Definition: checkout.php:54
$taxaddressID
$taxaddressID
Definition: checkout.php:606
$OrderDisclaimer
$OrderDisclaimer
Definition: checkout.php:59
$ShippingDisclaimerText
$ShippingDisclaimerText
Definition: checkout.php:61
$ShowOptionQuantity
$ShowOptionQuantity
Definition: checkout.php:48
$ShowExTaxColumn
$ShowExTaxColumn
Definition: checkout.php:50
$checkups
else $checkups
Definition: checkout.php:70
$currency
$currency
Definition: checkout.php:818
$locale
$locale
Definition: checkout.php:817
$ShowTaxBasis
$ShowTaxBasis
Definition: checkout.php:53
$markup
if($cart->ShipServiceCode &&(! eZHTTPTool::getVar("ShippingTypeID"))) if($cart->AddressID) if(true||eZHTTPTool::getVar("ShippingTypeID")||eZHTTPTool::getVar("ShippingAddressID")) $markup
Definition: checkout.php:539
$thisuser
$thisuser
Definition: checkout.php:543
$can_checkout
$can_checkout
Definition: checkout.php:1185
$user
$user
Definition: checkout.php:120
$shippingRegion
$shippingRegion
Definition: checkout.php:616
$PricesIncludeVAT
$PricesIncludeVAT
Definition: checkout.php:49
$payment
else $payment
Definition: checkout.php:1368
$CountryVATDiscrimination
$CountryVATDiscrimination
Definition: checkout.php:57
$ForceSSL
$ForceSSL
Definition: checkout.php:43
$shippingname
$shippingname
Definition: checkout.php:38
$items
$items
Definition: checkout.php:696
$vat
$vat
Definition: checkout.php:587
$t
if(! $cart||! $cart->items()) $t
Definition: checkout.php:138
$Language
$Language
Definition: checkout.php:40
$OrderReceiverEmail
$OrderReceiverEmail
Definition: checkout.php:42
$ini
$ini
Definition: checkout.php:36
$ShowSavingsColumn
$ShowSavingsColumn
Definition: checkout.php:74
$types
$types
Definition: checkout.php:507
$total
else $total["inctax"]
Definition: checkout.php:1359
$ShowPriceGroups
$ShowPriceGroups
Definition: checkout.php:45
$ShowCart
$ShowCart
Definition: checkout.php:73
$ShowNamedQuantity
$ShowNamedQuantity
Definition: checkout.php:46
turnColumnsOnOff
if( $vat==false) turnColumnsOnOff( $rowName, $t, $ShowSavingsColumn=false, $ShowExTaxColumn=false, $ShowIncTaxColumn=false)
Definition: checkout.php:666
$session
$session
Definition: checkout.php:118
$currentShippingType
$currentShippingType
Definition: checkout.php:541
$OrderSenderEmail
$OrderSenderEmail
Definition: checkout.php:41
$upscheck
$upscheck
Definition: checkout.php:64
$ShowQuantity
$ShowQuantity
Definition: checkout.php:44
$OrderDisclaimerText
$OrderDisclaimerText
Definition: checkout.php:60
$ShowExTaxTotal
$ShowExTaxTotal
Definition: checkout.php:52
$ShowIncTaxColumn
$ShowIncTaxColumn
Definition: checkout.php:51
$RequireQuantity
$RequireQuantity
Definition: checkout.php:47
$StateTaxShipping
$StateTaxShipping
Definition: checkout.php:56
$id
$id
Definition: checkout.php:545
$cart
$cart
Definition: checkout.php:112
$shippingAddress
$shippingAddress
Definition: checkout.php:615
$uspscheck
$uspscheck
Definition: checkout.php:65
$type
if(isset( $SendOrder)) $type
Definition: checkout.php:506
$StateTaxBilling
$StateTaxBilling
Definition: checkout.php:55
$test
$test
Definition: checkout.php:109
$address
$address
Definition: checkout.php:588
eZAddress
Definition: ezaddress.php:42
eZCart
Definition: ezcart.php:71
eZCheckout
Definition: ezcheckout.php:48
eZCompany
Definition: ezcompany.php:54
eZCurrency
Definition: ezcurrency.php:46
eZDateTime
Definition: ezdatetime.php:55
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZHTTPTool\getVar
static getVar( $name, $onlyCheckPost=false)
Definition: ezhttptool.php:55
eZLocale
Definition: ezlocale.php:119
eZOrderItem
Definition: ezorderitem.php:48
eZOrderOptionValue
Definition: ezorderoptionvalue.php:42
eZOrder
Definition: ezorder.php:52
eZPBLog\writeWarning
static writeWarning( $warning)
Definition: ezpblog.php:177
eZPerson
Definition: ezperson.php:43
eZPreOrder
Definition: ezpreorder.php:44
eZSession\globalSession
static & globalSession( $id="", $fetch=true)
Definition: kernel/ezsession/classes/ezsession.php:614
eZShippingType
Definition: ezshippingtype.php:45
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
eZVoucher
Definition: ezvoucher.php:54
$item
$item
Definition: classes/admin/linklist.php:228
$addressList
$addressList
Definition: companyview.php:215
$vouchers
$vouchers
Definition: customerview.php:241
$addressArray
$addressArray
Definition: customerview.php:94
$customer
$customer
Definition: customerview.php:72
$sum
$sum
Definition: fileinfo.php:26
exit
exit
Definition: folder.php:81
$product
$product
Definition: homepage.php:202
$numberOfItems
$numberOfItems
Definition: orderedit.php:382
$totalVAT
$totalVAT
Definition: orderedit.php:344
$paymentMethod
$paymentMethod
Definition: orderedit.php:668
$instance
$instance
Definition: orderedit.php:667
$checkout
foreach( $historyArray as $status) $checkout
Definition: orderedit.php:666
$Comment
$Comment
Definition: payment.php:133
$country
$country
Definition: paypal.php:46
$billingAddress
$billingAddress
Definition: paypal.php:44
$region
$region
Definition: paypal.php:45
$price
$price
Definition: pricegroupedit.php:39
$order
$order
Definition: productreport.php:182
$mainAddress
$mainAddress
Definition: step2.php:32
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.