Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- $Id$
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
- Copyright (c) 2010 osCommerce
- Released under the GNU General Public License
- */
- require('includes/application_top.php');
- // if the customer is not logged on, redirect them to the login page
- if (!tep_session_is_registered('customer_id')) {
- $navigation->set_snapshot(array('mode' => 'SSL', 'page' => 'checkout_payment.php'));
- tep_redirect(tep_href_link('login.php', '', 'SSL'));
- }
- // if there is nothing in the customers cart, redirect them to the shopping cart page
- if ($cart->count_contents() < 1) {
- tep_redirect(tep_href_link('shopping_cart.php'));
- }
- // avoid hack attempts during the checkout procedure by checking the internal cartID
- if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
- if ($cart->cartID != $cartID) {
- tep_redirect(tep_href_link('checkout_shipping.php', '', 'SSL'));
- }
- }
- // if no shipping method has been selected, redirect the customer to the shipping method selection page
- if (!tep_session_is_registered('shipping')) {
- tep_redirect(tep_href_link('checkout_shipping.php', '', 'SSL'));
- }
- if (!tep_session_is_registered('payment')) tep_session_register('payment');
- if (isset($_POST['payment'])) $payment = $_POST['payment'];
- if (!tep_session_is_registered('comments')) tep_session_register('comments');
- if (isset($_POST['comments']) && tep_not_null($_POST['comments'])) {
- $comments = tep_db_prepare_input($_POST['comments']);
- }
- // load the selected payment module
- require('includes/classes/payment.php');
- $payment_modules = new payment($payment);
- require('includes/classes/order.php');
- $order = new order;
- $payment_modules->update_status();
- /*
- if ( ($payment_modules->selected_module != $payment) || ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {
- tep_redirect(tep_href_link('checkout_payment.php', 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
- }
- */
- // BOF POINTS REWARDS BS //-->
- if ((USE_POINTS_SYSTEM == 'true') && (USE_REDEEM_SYSTEM == 'true')) {
- if (isset($_POST['customer_shopping_points_spending']) && is_numeric($_POST['customer_shopping_points_spending']) && ($_POST['customer_shopping_points_spending'] > 0)) {
- $customer_shopping_points_spending = false;
- // This if sentence should include check for amount of points on account compared to the transferred point from checkout_payment.php
- // Possible Hack Fix included
- if (tep_calc_shopping_pvalue($_POST['customer_shopping_points_spending']) < $order->info['total'] && !is_object($$payment) || (tep_get_shopping_points($customer_id) < $_POST['customer_shopping_points_spending'])) {
- $customer_shopping_points_spending = false;
- tep_redirect(tep_href_link('checkout_payment.php', 'error_message=' . urlencode(REDEEM_SYSTEM_ERROR_POINTS_NOT), 'SSL'));
- } else {
- $customer_shopping_points_spending = $_POST['customer_shopping_points_spending'];
- if (!tep_session_is_registered('customer_shopping_points_spending')) tep_session_register('customer_shopping_points_spending');
- }
- }
- //To ensure only the first order of a new customer is entitled to grant point to his/her referrer. Otherwise, a hacker might hard-code the email address of a referrer and cheat for point on every single order the new customer made.
- if (tep_not_null(USE_REFERRAL_SYSTEM) && (tep_count_customer_orders() == 0)) {
- if (isset($_POST['customer_referred']) && tep_not_null($_POST['customer_referred'])) {
- $customer_referral = false;
- $check_mail = trim($_POST['customer_referred']);
- if (tep_validate_email($check_mail) == false) {
- tep_redirect(tep_href_link('checkout_payment.php', 'error_message=' . urlencode(REFERRAL_ERROR_NOT_VALID), 'SSL'));
- } else {
- $valid_referral_query = tep_db_query("select customers_id from customers where customers_email_address = '" . $check_mail . "' limit 1");
- $valid_referral = tep_db_fetch_array($valid_referral_query);
- if (!tep_db_num_rows($valid_referral_query)) {
- tep_redirect(tep_href_link('checkout_payment.php', 'error_message=' . urlencode(REFERRAL_ERROR_NOT_FOUND), 'SSL'));
- }
- if ($check_mail == $order->customer['email_address']) {
- tep_redirect(tep_href_link('checkout_payment.php', 'error_message=' . urlencode(REFERRAL_ERROR_SELF), 'SSL'));
- } else {
- $customer_referral = $valid_referral['customers_id'];
- if (!tep_session_is_registered('customer_referral')) tep_session_register('customer_referral');
- }
- }
- }
- }
- }
- if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) && (!$customer_shopping_points_spending) || (is_object($$payment) && ($$payment->enabled == false)) ) {
- tep_redirect(tep_href_link('checkout_payment.php', 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
- }
- // EOF POINTS REWARDS BS //-->
- if (is_array($payment_modules->modules)) {
- $payment_modules->pre_confirmation_check();
- }
- // load the selected shipping module
- require('includes/classes/shipping.php');
- $shipping_modules = new shipping($shipping);
- require('includes/classes/order_total.php');
- $order_total_modules = new order_total;
- $order_total_modules->process();
- // Stock Check
- $any_out_of_stock = false;
- if (STOCK_CHECK == 'true') {
- for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
- if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
- $any_out_of_stock = true;
- }
- }
- // Out of Stock
- if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {
- tep_redirect(tep_href_link('shopping_cart.php'));
- }
- }
- require('includes/languages/' . $language . '/checkout_confirmation.php');
- $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('checkout_shipping.php', '', 'SSL'));
- $breadcrumb->add(NAVBAR_TITLE_2);
- require('includes/template_top.php');
- ?>
- <div class="page-header">
- <h1><?php echo HEADING_TITLE; ?></h1>
- </div>
- <?php
- if ($messageStack->size('checkout_confirmation') > 0) {
- echo $messageStack->output('checkout_confirmation');
- }
- if (isset($$payment->form_action_url)) {
- $form_action_url = $$payment->form_action_url;
- } else {
- $form_action_url = tep_href_link('checkout_process.php', '', 'SSL');
- }
- echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');
- ?>
- <div class="contentContainer">
- <div class="contentText">
- <div class="panel panel-default">
- <div class="panel-heading"><?php echo '<strong>' . HEADING_PRODUCTS . '</strong>' . tep_draw_button(TEXT_EDIT, 'fa fa-edit', tep_href_link('shopping_cart.php'), NULL, NULL, 'pull-right btn-info btn-xs' ); ?></div>
- <div class="panel-body">
- <table width="100%" class="table-hover order_confirmation">
- <tbody>
- <?php
- for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
- echo ' <tr>' . "\n" .
- ' <td align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x </td>' . "\n" .
- ' <td valign="top">' . $order->products[$i]['name'];
- if (STOCK_CHECK == 'true') {
- echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);
- }
- if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
- for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
- echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
- }
- }
- echo '</td>' . "\n";
- if (sizeof($order->info['tax_groups']) > 1) echo ' <td valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";
- echo ' <td align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "\n" .
- ' </tr>' . "\n";
- }
- ?>
- </tbody>
- </table>
- <hr>
- <table width="100%" class="pull-right">
- <?php
- if (MODULE_ORDER_TOTAL_INSTALLED) {
- echo $order_total_modules->output();
- }
- ?>
- </table>
- </div>
- </div>
- </div>
- <div class="clearfix"></div>
- <div class="row">
- <?php
- if ($sendto != false) {
- ?>
- <div class="col-sm-4">
- <div class="panel panel-info">
- <div class="panel-heading"><?php echo '<strong>' . HEADING_DELIVERY_ADDRESS . '</strong>' . tep_draw_button(TEXT_EDIT, 'fa fa-edit', tep_href_link('checkout_shipping_address.php', '', 'SSL'), NULL, NULL, 'pull-right btn-info btn-xs' ); ?></div>
- <div class="panel-body">
- <?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br />'); ?>
- </div>
- </div>
- </div>
- <?php
- }
- ?>
- <div class="col-sm-4">
- <div class="panel panel-warning">
- <div class="panel-heading"><?php echo '<strong>' . HEADING_BILLING_ADDRESS . '</strong>' . tep_draw_button(TEXT_EDIT, 'fa fa-edit', tep_href_link('checkout_payment_address.php', '', 'SSL'), NULL, NULL, 'pull-right btn-info btn-xs' ); ?></div>
- <div class="panel-body">
- <?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br />'); ?>
- </div>
- </div>
- </div>
- <div class="col-sm-4">
- <?php
- if ($order->info['shipping_method']) {
- ?>
- <div class="panel panel-info">
- <div class="panel-heading"><?php echo '<strong>' . HEADING_SHIPPING_METHOD . '</strong>' . tep_draw_button(TEXT_EDIT, 'fa fa-edit', tep_href_link('checkout_shipping.php', '', 'SSL'), NULL, NULL, 'pull-right btn-info btn-xs' ); ?></div>
- <div class="panel-body">
- <?php echo $order->info['shipping_method']; ?>
- </div>
- </div>
- <?php
- }
- ?>
- <div class="panel panel-warning">
- <div class="panel-heading"><?php echo '<strong>' . HEADING_PAYMENT_METHOD . '</strong>' . tep_draw_button(TEXT_EDIT, 'fa fa-edit', tep_href_link('checkout_payment.php', '', 'SSL'), NULL, NULL, 'pull-right btn-info btn-xs' ); ?></div>
- <div class="panel-body">
- <?php echo $order->info['payment_method']; ?>
- </div>
- </div>
- </div>
- </div>
- <?php
- if (is_array($payment_modules->modules)) {
- if ($confirmation = $payment_modules->confirmation()) {
- ?>
- <hr>
- <h2><?php echo HEADING_PAYMENT_INFORMATION; ?></h2>
- <div class="contentText row">
- <?php
- if (tep_not_null($confirmation['title'])) {
- echo '<div class="col-sm-6">';
- echo ' <div class="alert alert-danger">';
- echo $confirmation['title'];
- echo ' </div>';
- echo '</div>';
- }
- ?>
- <?php
- if (isset($confirmation['fields'])) {
- echo '<div class="col-sm-6">';
- echo ' <div class="alert alert-info">';
- $fields = '';
- for ($i=0, $n=sizeof($confirmation['fields']); $i<$n; $i++) {
- $fields .= $confirmation['fields'][$i]['title'] . ' ' . $confirmation['fields'][$i]['field'] . '<br>';
- }
- if (strlen($fields) > 4) echo substr($fields,0,-4);
- echo ' </div>';
- echo '</div>';
- }
- ?>
- </div>
- <div class="clearfix"></div>
- <?php
- }
- }
- if (tep_not_null($order->info['comments'])) {
- ?>
- <hr>
- <h2><?php echo '<strong>' . HEADING_ORDER_COMMENTS . '</strong>' . tep_draw_button(TEXT_EDIT, 'fa fa-edit', tep_href_link('checkout_payment.php', '', 'SSL'), NULL, NULL, 'pull-right btn-info btn-xs' ); ?></h2>
- <blockquote>
- <?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?>
- </blockquote>
- <?php
- }
- ?>
- <div class="buttonSet">
- <div class="text-right">
- <?php
- if (is_array($payment_modules->modules)) {
- echo $payment_modules->process_button();
- }
- echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'fa fa-ok', null, 'primary', null, 'btn-success');
- ?>
- </div>
- </div>
- <div class="clearfix"></div>
- <div class="contentText">
- <div class="stepwizard">
- <div class="stepwizard-row">
- <div class="stepwizard-step">
- <a href="<?php echo tep_href_link('checkout_shipping.php', '', 'SSL'); ?>"><button type="button" class="btn btn-default btn-circle">1</button></a>
- <p><a href="<?php echo tep_href_link('checkout_shipping.php', '', 'SSL'); ?>"><?php echo CHECKOUT_BAR_DELIVERY; ?></a></p>
- </div>
- <div class="stepwizard-step">
- <a href="<?php echo tep_href_link('checkout_payment.php', '', 'SSL'); ?>"><button type="button" class="btn btn-default btn-circle">2</button></a>
- <p><a href="<?php echo tep_href_link('checkout_payment.php', '', 'SSL'); ?>"><?php echo CHECKOUT_BAR_PAYMENT; ?></a></p>
- </div>
- <div class="stepwizard-step">
- <button type="button" class="btn btn-primary btn-circle">3</button>
- <p><?php echo CHECKOUT_BAR_CONFIRMATION; ?></p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </form>
- <?php
- require('includes/template_bottom.php');
- require('includes/application_bottom.php');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement