Advertisement
Boelle

Untitled

Jan 23rd, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.32 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) 2014 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(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. // 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(FILENAME_CHECKOUT_SHIPPING, '', '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(FILENAME_CHECKOUT_SHIPPING, '', '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(FILENAME_SHOPPING_CART));
  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(DIR_WS_CLASSES . 'order.php');
  67. $order = new order;
  68.  
  69. if (!tep_session_is_registered('comments')) tep_session_register('comments');
  70. if (isset($HTTP_POST_VARS['comments']) && tep_not_null($HTTP_POST_VARS['comments'])) {
  71. $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
  72. }
  73.  
  74. $total_weight = $cart->show_weight();
  75. $total_count = $cart->count_contents();
  76.  
  77. // load all enabled payment modules
  78. require(DIR_WS_CLASSES . 'payment.php');
  79. $payment_modules = new payment;
  80.  
  81. require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);
  82.  
  83. $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
  84. $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
  85.  
  86. require(DIR_WS_INCLUDES . 'template_top.php');
  87. ?>
  88.  
  89. <script type="text/javascript"><!--
  90. var selected;
  91.  
  92. function selectRowEffect(object, buttonSelect) {
  93. if (!selected) {
  94. if (document.getElementById) {
  95. selected = document.getElementById('defaultSelected');
  96. } else {
  97. selected = document.all['defaultSelected'];
  98. }
  99. }
  100.  
  101. if (selected) selected.className = 'moduleRow';
  102. object.className = 'moduleRowSelected';
  103. selected = object;
  104.  
  105. // one button is not an array
  106. if (document.checkout_payment.payment[0]) {
  107. document.checkout_payment.payment[buttonSelect].checked=true;
  108. } else {
  109. document.checkout_payment.payment.checked=true;
  110. }
  111. }
  112.  
  113. function rowOverEffect(object) {
  114. if (object.className == 'moduleRow') object.className = 'moduleRowOver';
  115. }
  116.  
  117. function rowOutEffect(object) {
  118. if (object.className == 'moduleRowOver') object.className = 'moduleRow';
  119. }
  120. //--></script>
  121. <?php echo $payment_modules->javascript_validation(); ?>
  122.  
  123. <h1><?php echo HEADING_TITLE; ?></h1>
  124.  
  125. <?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true); ?>
  126.  
  127. <div class="contentContainer">
  128.  
  129. <?php
  130. if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {
  131. ?>
  132.  
  133. <div class="contentText">
  134. <?php echo '<strong>' . tep_output_string_protected($error['title']) . '</strong>'; ?>
  135.  
  136. <p class="messageStackError"><?php echo tep_output_string_protected($error['error']); ?></p>
  137. </div>
  138.  
  139. <?php
  140. }
  141. ?>
  142.  
  143. <?php //----- BEGINNING OF ADDITION: MATC -----//
  144. if($HTTP_GET_VARS['matcerror'] == 'true'){
  145. ?>
  146. <tr>
  147. <td><?php
  148. $matc_error_box_contents = array();
  149. $matc_error_box_contents[] = array('text' => MATC_ERROR);
  150. new errorBox($matc_error_box_contents);
  151.  
  152. ?></td>
  153. </tr>
  154. <?php } //----- END OF ADDITION: MATC -----// ?>
  155.  
  156. <h2><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></h2>
  157.  
  158. <div class="contentText">
  159. <div class="ui-widget infoBoxContainer" style="float: right;">
  160. <div class="ui-widget-header infoBoxHeading"><?php echo TITLE_BILLING_ADDRESS; ?></div>
  161.  
  162. <div class="ui-widget-content infoBoxContents">
  163. <?php echo tep_address_label($customer_id, $billto, true, ' ', '<br />'); ?>
  164. </div>
  165. </div>
  166.  
  167. <?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br /><br /><?php echo tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'home', tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')); ?>
  168. </div>
  169.  
  170. <div style="clear: both;"></div>
  171.  
  172. <h2><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></h2>
  173.  
  174. <?php
  175. $selection = $payment_modules->selection();
  176.  
  177. if (sizeof($selection) > 1) {
  178. ?>
  179.  
  180. <div class="contentText">
  181. <div style="float: right;">
  182. <?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong>'; ?>
  183. </div>
  184.  
  185. <?php echo TEXT_SELECT_PAYMENT_METHOD; ?>
  186. </div>
  187.  
  188. <?php
  189. } else {
  190. ?>
  191.  
  192. <div class="contentText">
  193. <?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?>
  194. </div>
  195.  
  196. <?php
  197. }
  198. ?>
  199.  
  200. <div class="contentText">
  201.  
  202. <?php
  203. $radio_buttons = 0;
  204. for ($i=0, $n=sizeof($selection); $i<$n; $i++) {
  205. ?>
  206.  
  207. <table border="0" width="100%" cellspacing="0" cellpadding="2">
  208.  
  209. <?php
  210. if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) {
  211. echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
  212. } else {
  213. echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
  214. }
  215. ?>
  216.  
  217. <td><strong><?php echo $selection[$i]['module']; ?></strong></td>
  218. <td align="right">
  219.  
  220. <?php
  221. if (sizeof($selection) > 1) {
  222. echo tep_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $payment));
  223. } else {
  224. echo tep_draw_hidden_field('payment', $selection[$i]['id']);
  225. }
  226. ?>
  227.  
  228. </td>
  229. </tr>
  230.  
  231. <?php
  232. if (isset($selection[$i]['error'])) {
  233. ?>
  234.  
  235. <tr>
  236. <td colspan="2"><?php echo $selection[$i]['error']; ?></td>
  237. </tr>
  238.  
  239. <?php
  240. } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) {
  241. ?>
  242.  
  243. <tr>
  244. <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
  245.  
  246. <?php
  247. for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {
  248. ?>
  249.  
  250. <tr>
  251. <td><?php echo $selection[$i]['fields'][$j]['title']; ?></td>
  252. <td><?php echo $selection[$i]['fields'][$j]['field']; ?></td>
  253. </tr>
  254.  
  255. <?php
  256. }
  257. ?>
  258.  
  259. </table></td>
  260. </tr>
  261.  
  262. <?php
  263. }
  264. ?>
  265.  
  266. </table>
  267.  
  268. <?php
  269. $radio_buttons++;
  270. }
  271. ?>
  272.  
  273. </div>
  274.  
  275. <h2><?php echo TABLE_HEADING_COMMENTS; ?></h2>
  276.  
  277. <div class="contentText">
  278. <?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?>
  279. </div>
  280.  
  281. <div class="contentText">
  282. <div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
  283. <div id="coProgressBar" style="height: 5px;"></div>
  284.  
  285. <table border="0" width="100%" cellspacing="0" cellpadding="2">
  286. <tr>
  287. <td align="center" width="33%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
  288. <td align="center" width="33%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
  289. <td align="center" width="33%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
  290. </tr>
  291.  
  292. <!-- BEGINNING OF ADDITION: MATC -->
  293. <?php
  294. if(MATC_AT_CHECKOUT != 'false'){
  295. require(DIR_WS_MODULES . 'matc.php');
  296. }
  297. ?>
  298. <!-- END OF ADDITION: MATC -->
  299.  
  300. </table>
  301. </div>
  302.  
  303. <div style="float: right;"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></div>
  304. </div>
  305. </div>
  306.  
  307. <script type="text/javascript">
  308. $('#coProgressBar').progressbar({
  309. value: 66
  310. });
  311. </script>
  312.  
  313. </form>
  314.  
  315. <?php
  316. require(DIR_WS_INCLUDES . 'template_bottom.php');
  317. require(DIR_WS_INCLUDES . 'application_bottom.php');
  318. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement