WikiFormatting: checkout_confirmation.php.2.txt

File checkout_confirmation.php.2.txt, 16.4 KB (added by ashokmca31, 3 years ago)
Line 
1<?php
2/*
3  $Id: checkout_confirmation.php 1739 2007-12-20 00:52:16Z hpdl $
4
5  osCommerce, Open Source E-Commerce Solutions
6  http://www.oscommerce.com
7
8  Copyright (c) 2003 osCommerce
9
10  Released under the GNU General Public License
11*/
12
13  require('includes/application_top.php');
14
15// if the customer is not logged on, redirect them to the login page
16  if (!tep_session_is_registered('customer_id')) {
17    $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
18    tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
19  }
20
21// if there is nothing in the customers cart, redirect them to the shopping cart page
22  if ($cart->count_contents() < 1) {
23    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
24  }
25
26// avoid hack attempts during the checkout procedure by checking the internal cartID
27  if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
28    if ($cart->cartID != $cartID) {
29      tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
30    }
31  }
32
33// if no shipping method has been selected, redirect the customer to the shipping method selection page
34  if (!tep_session_is_registered('shipping')) {
35    tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
36  }
37
38  if (!tep_session_is_registered('payment')) tep_session_register('payment');
39  if (isset($HTTP_POST_VARS['payment'])) $payment = $HTTP_POST_VARS['payment'];
40
41  if (!tep_session_is_registered('comments')) tep_session_register('comments');
42  if (tep_not_null($HTTP_POST_VARS['comments'])) {
43    $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
44  }
45
46// load the selected payment module
47  require(DIR_WS_CLASSES . 'payment.php');
48  $payment_modules = new payment($payment);
49
50  require(DIR_WS_CLASSES . 'order.php');
51  $order = new order;
52
53  $payment_modules->update_status();
54
55  if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {
56    tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
57  }
58
59  if (is_array($payment_modules->modules)) {
60    $payment_modules->pre_confirmation_check();
61  }
62
63// load the selected shipping module
64  require(DIR_WS_CLASSES . 'shipping.php');
65  $shipping_modules = new shipping($shipping);
66
67  require(DIR_WS_CLASSES . 'order_total.php');
68  $order_total_modules = new order_total;
69  $order_total_modules->process();
70
71// Stock Check
72  $any_out_of_stock = false;
73  if (STOCK_CHECK == 'true') {
74    for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
75      if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
76        $any_out_of_stock = true;
77      }
78    }
79    // Out of Stock
80    if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {
81      tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
82    }
83  }
84
85  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);
86
87  $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
88  $breadcrumb->add(NAVBAR_TITLE_2);
89?>
90<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
91<html <?php echo HTML_PARAMS; ?>>
92<head>
93<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
94<title><?php echo TITLE; ?></title>
95<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
96<link rel="stylesheet" type="text/css" href="stylesheet.css">
97</head>
98<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
99<!-- header //-->
100<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
101<!-- header_eof //-->
102
103<!-- body //-->
104<table border="0" width="100%" cellspacing="3" cellpadding="3">
105  <tr>
106    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
107<!-- left_navigation //-->
108<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
109<!-- left_navigation_eof //-->
110    </table></td>
111<!-- body_text //-->
112    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
113      <tr>
114        <td>
115<?php
116  if (isset($$payment->form_action_url)) {
117    $form_action_url = $$payment->form_action_url;
118  } else {
119    $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
120  }
121
122  echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');
123?>
124        <table border="0" width="100%" cellspacing="0" cellpadding="0">
125          <tr>
126            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
127            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_confirmation.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
128          </tr>
129        </table></td>
130      </tr>
131      <tr>
132        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
133      </tr>
134      <tr>
135        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
136          <tr class="infoBoxContents">
137<?php
138  if ($sendto != false) {
139?>
140            <td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
141              <tr>
142                <td class="main"><?php echo '<b>' . HEADING_DELIVERY_ADDRESS . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
143              </tr>
144              <tr>
145                <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>
146              </tr>
147<?php
148    if ($order->info['shipping_method']) {
149?>
150              <tr>
151                <td class="main"><?php echo '<b>' . HEADING_SHIPPING_METHOD . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
152              </tr>
153              <tr>
154                <td class="main"><?php echo $order->info['shipping_method']; ?></td>
155              </tr>
156<?php
157    }
158?>
159            </table></td>
160<?php
161  }
162?>
163            <td width="<?php echo (($sendto != false) ? '70%' : '100%'); ?>" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
164              <tr>
165                <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
166<?php
167  if (sizeof($order->info['tax_groups']) > 1) {
168?>
169                  <tr>
170                    <td class="main" colspan="2"><?php echo '<b>' . HEADING_PRODUCTS . '</b> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
171                    <td class="smallText" align="right"><b><?php echo HEADING_TAX; ?></b></td>
172                    <td class="smallText" align="right"><b><?php echo HEADING_TOTAL; ?></b></td>
173                  </tr>
174<?php
175  } else {
176?>
177                  <tr>
178                    <td class="main" colspan="3"><?php echo '<b>' . HEADING_PRODUCTS . '</b> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
179                  </tr>
180<?php
181  }
182
183  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
184    echo '          <tr>' . "\n" .
185         '            <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
186         '            <td class="main" valign="top">' . $order->products[$i]['name'];
187
188    if (STOCK_CHECK == 'true') {
189      echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);
190    }
191
192    if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
193      for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
194        echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
195      }
196    }
197
198    echo '</td>' . "\n";
199
200    if (sizeof($order->info['tax_groups']) > 1) echo '            <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";
201
202    echo '            <td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "\n" .
203         '          </tr>' . "\n";
204  }
205?>
206                </table></td>
207              </tr>
208            </table></td>
209          </tr>
210        </table></td>
211      </tr>
212      <tr>
213        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
214      </tr>
215      <tr>
216        <td class="main"><b><?php echo HEADING_BILLING_INFORMATION; ?></b></td>
217      </tr>
218      <tr>
219        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
220      </tr>
221      <tr>
222        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
223          <tr class="infoBoxContents">
224            <td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
225              <tr>
226                <td class="main"><?php echo '<b>' . HEADING_BILLING_ADDRESS . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
227              </tr>
228              <tr>
229                <td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></td>
230              </tr>
231              <tr>
232                <td class="main"><?php echo '<b>' . HEADING_PAYMENT_METHOD . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
233              </tr>
234              <tr>
235                <td class="main"><?php echo $order->info['payment_method']; ?></td>
236              </tr>
237            </table></td>
238            <td width="70%" valign="top" align="right"><table border="0" cellspacing="0" cellpadding="2">
239<?php
240  if (MODULE_ORDER_TOTAL_INSTALLED) {
241    echo $order_total_modules->output();
242  }
243?>
244            </table></td>
245          </tr>
246        </table></td>
247      </tr>
248<?php
249  if (is_array($payment_modules->modules)) {
250    if ($confirmation = $payment_modules->confirmation()) {
251?>
252      <tr>
253        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
254      </tr>
255      <tr>
256        <td class="main"><b><?php echo HEADING_PAYMENT_INFORMATION; ?></b></td>
257      </tr>
258      <tr>
259        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
260      </tr>
261      <tr>
262        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
263          <tr class="infoBoxContents">
264            <td><table border="0" cellspacing="0" cellpadding="2">
265              <tr>
266                <td class="main" colspan="4"><?php echo $confirmation['title']; ?></td>
267              </tr>
268<?php
269      for ($i=0, $n=sizeof($confirmation['fields']); $i<$n; $i++) {
270?>
271              <tr>
272                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
273                <td class="main"><?php echo $confirmation['fields'][$i]['title']; ?></td>
274                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
275                <td class="main"><?php echo $confirmation['fields'][$i]['field']; ?></td>
276              </tr>
277<?php
278      }
279?>
280            </table></td>
281          </tr>
282        </table></td>
283      </tr>
284<?php
285    }
286  }
287?>
288      <tr>
289        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
290      </tr>
291<?php
292  if (tep_not_null($order->info['comments'])) {
293?>
294      <tr>
295        <td class="main"><?php echo '<b>' . HEADING_ORDER_COMMENTS . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
296      </tr>
297      <tr>
298        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
299      </tr>
300      <tr>
301        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
302          <tr class="infoBoxContents">
303            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
304              <tr>
305                <td class="main"><?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?></td>
306              </tr>
307            </table></td>
308          </tr>
309        </table></td>
310      </tr>
311      <tr>
312        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
313      </tr>
314<?php
315  }
316?>
317      <tr>
318        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
319          <tr>
320            <td align="right" class="main">
321<?php
322  if (is_array($payment_modules->modules)) {
323    echo $payment_modules->process_button();
324  }
325
326  echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . "\n";
327?>
328            </td>
329          </tr>
330        </table></td>
331      </tr>
332      <tr>
333        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
334      </tr>
335      <tr>
336        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
337          <tr>
338            <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
339              <tr>
340                <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
341                <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
342              </tr>
343            </table></td>
344<?php //---PayPal WPP Modification START ---//-- ?>
345<?php if ($show_payment_page || !$ec_enabled) { ?>
346            <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
347<?php } ?>
348<?php //---PayPal WPP Modification END ---//-- ?>
349            <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
350              <tr>
351                <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
352                <td><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
353                <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
354              </tr>
355            </table></td>
356            <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
357              <tr>
358                <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
359                <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
360              </tr>
361            </table></td>
362          </tr>
363          <tr>
364            <td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
365<?php //---PayPal WPP Modification START ---//-- ?>
366<?php if ($show_payment_page || !$ec_enabled) { ?>
367                <td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_PAYMENT . '</a>'; ?></td>
368<?php } ?>
369<?php //---PayPal WPP Modification END ---//-- ?>
370            <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
371            <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
372          </tr>
373        </table></td>
374      </tr>
375    </table></form></td>
376<!-- body_text_eof //-->
377    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
378<!-- right_navigation //-->
379<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
380<!-- right_navigation_eof //-->
381    </table></td>
382  </tr>
383</table>
384<!-- body_eof //-->
385
386<!-- footer //-->
387<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
388<!-- footer_eof //-->
389<br>
390</body>
391</html>
392<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>