Advertisement
Tsimi

checkout_payment.php Points and Rewards BS

Sep 12th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.96 KB | None | 0 0
  1. <?php
  2. /*
  3.   $Id$
  4.  
  5.   osCommerce, Open Source E-Commerce Solutions
  6.   http://www.oscommerce.com
  7.  
  8.   Copyright (c) 2010 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();
  18.     tep_redirect(tep_href_link('login.php', '', '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('shopping_cart.php'));
  24.   }
  25.  
  26. // if no shipping method has been selected, redirect the customer to the shipping method selection page
  27.   if (!tep_session_is_registered('shipping')) {
  28.     tep_redirect(tep_href_link('checkout_shipping.php', '', 'SSL'));
  29.   }
  30.  
  31. // avoid hack attempts during the checkout procedure by checking the internal cartID
  32.   if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
  33.     if ($cart->cartID != $cartID) {
  34.       tep_redirect(tep_href_link('checkout_shipping.php', '', 'SSL'));
  35.     }
  36.   }
  37.  
  38. // Stock Check
  39.   if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
  40.     $products = $cart->get_products();
  41.     for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  42.       if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
  43.         tep_redirect(tep_href_link('shopping_cart.php'));
  44.         break;
  45.       }
  46.     }
  47.   }
  48.  
  49. // if no billing destination address was selected, use the customers own address as default
  50.   if (!tep_session_is_registered('billto')) {
  51.     tep_session_register('billto');
  52.     $billto = $customer_default_address_id;
  53.   } else {
  54. // verify the selected billing address
  55.     if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) {
  56.       $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'");
  57.       $check_address = tep_db_fetch_array($check_address_query);
  58.  
  59.       if ($check_address['total'] != '1') {
  60.         $billto = $customer_default_address_id;
  61.         if (tep_session_is_registered('payment')) tep_session_unregister('payment');
  62.       }
  63.     }
  64.   }
  65.  
  66.   require('includes/classes/order.php');
  67.   $order = new order;
  68.  
  69.   if (!tep_session_is_registered('comments')) tep_session_register('comments');
  70.   if (isset($_POST['comments']) && tep_not_null($_POST['comments'])) {
  71.     $comments = tep_db_prepare_input($_POST['comments']);
  72.   }
  73.  
  74.   $total_weight = $cart->show_weight();
  75.   $total_count = $cart->count_contents();
  76.  
  77. // load all enabled payment modules
  78.   require('includes/classes/payment.php');
  79.   $payment_modules = new payment;
  80.  
  81.   require('includes/languages/' . $language . '/checkout_payment.php');
  82.  
  83.   $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('checkout_shipping.php', '', 'SSL'));
  84.   $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link('checkout_payment.php', '', 'SSL'));
  85.  
  86.   require('includes/template_top.php');
  87. ?>
  88. <!-- BOF POINTS REWARDS BS -->
  89. <script type="text/javascript">
  90. var submitter = null;
  91. function submitFunction() {
  92.    submitter = 1;
  93.    }
  94. </script>
  95. <!-- EOF POINTS REWARDS BS -->
  96. <?php echo $payment_modules->javascript_validation(); ?>
  97.  
  98. <div class="page-header">
  99.   <h1><?php echo HEADING_TITLE; ?></h1>
  100. </div>
  101.  
  102. <?php echo tep_draw_form('checkout_payment', tep_href_link('checkout_confirmation.php', '', 'SSL'), 'post', 'class="form-horizontal" onsubmit="return check_form();"', true); ?>
  103.  
  104. <div class="contentContainer">
  105.  
  106. <?php
  107.   if (isset($_GET['payment_error']) && is_object(${$_GET['payment_error']}) && ($error = ${$_GET['payment_error']}->get_error())) {
  108. ?>
  109.  
  110.   <div class="contentText">
  111.     <?php echo '<strong>' . tep_output_string_protected($error['title']) . '</strong>'; ?>
  112.  
  113.     <p class="messageStackError"><?php echo tep_output_string_protected($error['error']); ?></p>
  114.   </div>
  115.  
  116. <?php
  117.   }
  118. ?>
  119.  
  120.   <h2><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></h2>
  121.  
  122.   <div class="contentText row">
  123.     <div class="col-sm-8">
  124.       <div class="alert alert-warning">
  125.         <?php echo TEXT_SELECTED_BILLING_DESTINATION; ?>
  126.         <div class="clearfix"></div>
  127.         <div class="pull-right">
  128.           <?php echo tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'fa fa-home', tep_href_link('checkout_payment_address.php', '', 'SSL')); ?>
  129.         </div>
  130.         <div class="clearfix"></div>
  131.       </div>
  132.     </div>
  133.     <div class="col-sm-4">
  134.       <div class="panel panel-primary">
  135.         <div class="panel-heading"><?php echo TITLE_BILLING_ADDRESS; ?></div>
  136.         <div class="panel-body">
  137.           <?php echo tep_address_label($customer_id, $billto, true, ' ', '<br />'); ?>
  138.         </div>
  139.       </div>
  140.     </div>
  141.   </div>
  142.  
  143.   <div class="clearfix"></div>
  144.  
  145.   <h2><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></h2>
  146.  
  147. <?php
  148.   $selection = $payment_modules->selection();
  149.  
  150.   if (sizeof($selection) > 1) {
  151. ?>
  152.  
  153.   <div class="contentText">
  154.     <div class="alert alert-warning">
  155.       <div class="row">
  156.         <div class="col-xs-8">
  157.           <?php echo TEXT_SELECT_PAYMENT_METHOD; ?>
  158.         </div>
  159.         <div class="col-xs-4 text-right">
  160.           <?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong>'; ?>
  161.         </div>
  162.       </div>
  163.     </div>
  164.   </div>
  165.  
  166.  
  167. <?php
  168.     } else {
  169. ?>
  170.  
  171.   <div class="contentText">
  172.     <div class="alert alert-info"><?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?></div>
  173.   </div>
  174.  
  175. <?php
  176.     }
  177. ?>
  178.  
  179.   <div class="contentText">
  180.  
  181.     <table class="table table-striped table-condensed table-hover">
  182.       <tbody>
  183. <?php
  184.   $radio_buttons = 0;
  185.   for ($i=0, $n=sizeof($selection); $i<$n; $i++) {
  186. ?>
  187.       <tr class="table-selection">
  188.         <td><strong><?php echo $selection[$i]['module']; ?></strong></td>
  189.         <td align="right">
  190.  
  191. <?php
  192.     if (sizeof($selection) > 1) {
  193.       echo tep_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $payment), 'aria-required="true"');
  194.     } else {
  195.       echo tep_draw_hidden_field('payment', $selection[$i]['id']);
  196.     }
  197. ?>
  198.  
  199.         </td>
  200.       </tr>
  201.  
  202. <?php
  203.     if (isset($selection[$i]['error'])) {
  204. ?>
  205.  
  206.       <tr>
  207.         <td colspan="2"><?php echo $selection[$i]['error']; ?></td>
  208.       </tr>
  209.  
  210. <?php
  211.     } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) {
  212. ?>
  213.  
  214.       <tr>
  215.         <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
  216.  
  217. <?php
  218.       for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {
  219. ?>
  220.  
  221.           <tr>
  222.             <td><?php echo $selection[$i]['fields'][$j]['title']; ?></td>
  223.             <td><?php echo $selection[$i]['fields'][$j]['field']; ?></td>
  224.           </tr>
  225.  
  226. <?php
  227.       }
  228. ?>
  229.  
  230.         </table></td>
  231.       </tr>
  232.  
  233. <?php
  234.     }
  235. ?>
  236.  
  237.  
  238.  
  239. <?php
  240.     $radio_buttons++;
  241.   }
  242. ?>
  243.       </tbody>
  244.     </table>
  245.  
  246.   </div>
  247. <!-- BOF POINTS REWARDS BS //-->
  248. <?php
  249.   if ((MODULE_HEADER_TAGS_POINTS_REWARDS_USE_POINTS_SYSTEM == 'True') && (MODULE_HEADER_TAGS_POINTS_REWARDS_USE_REDEEM_SYSTEM == 'True')) {
  250.       //echo points_selection();
  251.       $cart_show_total= $cart->show_total();
  252.       echo points_selection($cart_show_total);
  253.       if (tep_not_null(MODULE_HEADER_TAGS_POINTS_REWARDS_POINTS_USE_REFERRAL_SYSTEM) && (tep_count_customer_orders() == 0)) {
  254.           echo referral_input();
  255.       }
  256.   }
  257. ?>
  258. <!-- EOF POINTS REWARDS BS //-->
  259.   <hr>
  260.  
  261.   <div class="contentText">
  262.     <div class="form-group">
  263.       <label for="inputComments" class="control-label col-sm-4"><?php echo TABLE_HEADING_COMMENTS; ?></label>
  264.       <div class="col-sm-8">
  265.         <?php
  266.         echo tep_draw_textarea_field('comments', 'soft', 60, 5, $comments, 'id="inputComments" placeholder="' . TABLE_HEADING_COMMENTS . '"');
  267.         ?>
  268.       </div>
  269.     </div>
  270.   </div>
  271.  
  272.   <div class="buttonSet">
  273.     <div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fa fa-angle-right', null, 'primary', null, 'btn-success'); ?></div>
  274.   </div>
  275.  
  276.   <div class="clearfix"></div>
  277.  
  278.   <div class="contentText">
  279.     <div class="stepwizard">
  280.       <div class="stepwizard-row">
  281.         <div class="stepwizard-step">
  282.           <a href="<?php echo tep_href_link('checkout_shipping.php', '', 'SSL'); ?>"><button type="button" class="btn btn-default btn-circle">1</button></a>
  283.           <p><a href="<?php echo tep_href_link('checkout_shipping.php', '', 'SSL'); ?>"><?php echo CHECKOUT_BAR_DELIVERY; ?></a></p>
  284.         </div>
  285.         <div class="stepwizard-step">
  286.           <button type="button" class="btn btn-primary btn-circle">2</button>
  287.           <p><?php echo CHECKOUT_BAR_PAYMENT; ?></p>
  288.         </div>
  289.         <div class="stepwizard-step">
  290.           <button type="button" class="btn btn-default btn-circle" disabled="disabled">3</button>
  291.           <p><?php echo CHECKOUT_BAR_CONFIRMATION; ?></p>
  292.         </div>
  293.       </div>
  294.     </div>
  295.   </div>
  296.  
  297. </div>
  298.  
  299. </form>
  300.  
  301. <?php
  302.   require('includes/template_bottom.php');
  303.   require('includes/application_bottom.php');
  304. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement