| [ Index ] |
|
Code source de osCommerce 2.2ms2-060817 |
1 <?php 2 /* 3 $Id: checkout_payment.php,v 1.113 2003/06/29 23:03:27 hpdl Exp $ 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(); 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 $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 . "'"); 56 $check_address = tep_db_fetch_array($check_address_query); 57 58 if ($check_address['total'] != '1') { 59 $billto = $customer_default_address_id; 60 if (tep_session_is_registered('payment')) tep_session_unregister('payment'); 61 } 62 } 63 64 require(DIR_WS_CLASSES . 'order.php'); 65 $order = new order; 66 67 if (!tep_session_is_registered('comments')) tep_session_register('comments'); 68 69 $total_weight = $cart->show_weight(); 70 $total_count = $cart->count_contents(); 71 72 // load all enabled payment modules 73 require(DIR_WS_CLASSES . 'payment.php'); 74 $payment_modules = new payment; 75 76 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT); 77 78 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); 79 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); 80 ?> 81 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 82 <html <?php echo HTML_PARAMS; ?>> 83 <head> 84 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 85 <title><?php echo TITLE; ?></title> 86 <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> 87 <link rel="stylesheet" type="text/css" href="stylesheet.css"> 88 <script language="javascript"><!-- 89 var selected; 90 91 function selectRowEffect(object, buttonSelect) { 92 if (!selected) { 93 if (document.getElementById) { 94 selected = document.getElementById('defaultSelected'); 95 } else { 96 selected = document.all['defaultSelected']; 97 } 98 } 99 100 if (selected) selected.className = 'moduleRow'; 101 object.className = 'moduleRowSelected'; 102 selected = object; 103 104 // one button is not an array 105 if (document.checkout_payment.payment[0]) { 106 document.checkout_payment.payment[buttonSelect].checked=true; 107 } else { 108 document.checkout_payment.payment.checked=true; 109 } 110 } 111 112 function rowOverEffect(object) { 113 if (object.className == 'moduleRow') object.className = 'moduleRowOver'; 114 } 115 116 function rowOutEffect(object) { 117 if (object.className == 'moduleRowOver') object.className = 'moduleRow'; 118 } 119 //--></script> 120 <?php echo $payment_modules->javascript_validation(); ?> 121 </head> 122 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> 123 <!-- header //--> 124 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 125 <!-- header_eof //--> 126 127 <!-- body //--> 128 <table border="0" width="100%" cellspacing="3" cellpadding="3"> 129 <tr> 130 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> 131 <!-- left_navigation //--> 132 <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> 133 <!-- left_navigation_eof //--> 134 </table></td> 135 <!-- body_text //--> 136 <td width="100%" valign="top"><?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> 137 <tr> 138 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 139 <tr> 140 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 141 <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_payment.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 142 </tr> 143 </table></td> 144 </tr> 145 <tr> 146 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> 147 </tr> 148 <?php 149 if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) { 150 ?> 151 <tr> 152 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 153 <tr> 154 <td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td> 155 </tr> 156 </table></td> 157 </tr> 158 <tr> 159 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBoxNotice"> 160 <tr class="infoBoxNoticeContents"> 161 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 162 <tr> 163 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 164 <td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td> 165 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 166 </tr> 167 </table></td> 168 </tr> 169 </table></td> 170 </tr> 171 <tr> 172 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> 173 </tr> 174 <?php 175 } 176 ?> 177 <tr> 178 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 179 <tr> 180 <td class="main"><b><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></b></td> 181 </tr> 182 </table></td> 183 </tr> 184 <tr> 185 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> 186 <tr class="infoBoxContents"> 187 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 188 <tr> 189 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 190 <td class="main" width="50%" valign="top"><?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br><br><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?></td> 191 <td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2"> 192 <tr> 193 <td class="main" align="center" valign="top"><b><?php echo TITLE_BILLING_ADDRESS; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td> 194 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 195 <td class="main" valign="top"><?php echo tep_address_label($customer_id, $billto, true, ' ', '<br>'); ?></td> 196 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 197 </tr> 198 </table></td> 199 </tr> 200 </table></td> 201 </tr> 202 </table></td> 203 </tr> 204 <tr> 205 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> 206 </tr> 207 <tr> 208 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 209 <tr> 210 <td class="main"><b><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></b></td> 211 </tr> 212 </table></td> 213 </tr> 214 <tr> 215 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> 216 <tr class="infoBoxContents"> 217 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 218 <?php 219 $selection = $payment_modules->selection(); 220 221 if (sizeof($selection) > 1) { 222 ?> 223 <tr> 224 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 225 <td class="main" width="50%" valign="top"><?php echo TEXT_SELECT_PAYMENT_METHOD; ?></td> 226 <td class="main" width="50%" valign="top" align="right"><b><?php echo TITLE_PLEASE_SELECT; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td> 227 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 228 </tr> 229 <?php 230 } else { 231 ?> 232 <tr> 233 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 234 <td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?></td> 235 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 236 </tr> 237 <?php 238 } 239 240 $radio_buttons = 0; 241 for ($i=0, $n=sizeof($selection); $i<$n; $i++) { 242 ?> 243 <tr> 244 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 245 <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 246 <?php 247 if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) { 248 echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; 249 } else { 250 echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; 251 } 252 ?> 253 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 254 <td class="main" colspan="3"><b><?php echo $selection[$i]['module']; ?></b></td> 255 <td class="main" align="right"> 256 <?php 257 if (sizeof($selection) > 1) { 258 echo tep_draw_radio_field('payment', $selection[$i]['id']); 259 } else { 260 echo tep_draw_hidden_field('payment', $selection[$i]['id']); 261 } 262 ?> 263 </td> 264 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 265 </tr> 266 <?php 267 if (isset($selection[$i]['error'])) { 268 ?> 269 <tr> 270 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 271 <td class="main" colspan="4"><?php echo $selection[$i]['error']; ?></td> 272 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 273 </tr> 274 <?php 275 } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) { 276 ?> 277 <tr> 278 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 279 <td colspan="4"><table border="0" cellspacing="0" cellpadding="2"> 280 <?php 281 for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) { 282 ?> 283 <tr> 284 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 285 <td class="main"><?php echo $selection[$i]['fields'][$j]['title']; ?></td> 286 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 287 <td class="main"><?php echo $selection[$i]['fields'][$j]['field']; ?></td> 288 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 289 </tr> 290 <?php 291 } 292 ?> 293 </table></td> 294 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 295 </tr> 296 <?php 297 } 298 ?> 299 </table></td> 300 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 301 </tr> 302 <?php 303 $radio_buttons++; 304 } 305 ?> 306 </table></td> 307 </tr> 308 </table></td> 309 </tr> 310 <tr> 311 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> 312 </tr> 313 <tr> 314 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 315 <tr> 316 <td class="main"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td> 317 </tr> 318 </table></td> 319 </tr> 320 <tr> 321 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> 322 <tr class="infoBoxContents"> 323 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 324 <tr> 325 <td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td> 326 </tr> 327 </table></td> 328 </tr> 329 </table></td> 330 </tr> 331 <tr> 332 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> 333 </tr> 334 <tr> 335 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> 336 <tr class="infoBoxContents"> 337 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 338 <tr> 339 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 340 <td class="main"><b><?php echo TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td> 341 <td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td> 342 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 343 </tr> 344 </table></td> 345 </tr> 346 </table></td> 347 </tr> 348 <tr> 349 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> 350 </tr> 351 <tr> 352 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 353 <tr> 354 <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 355 <tr> 356 <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td> 357 <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> 358 </tr> 359 </table></td> 360 <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 361 <tr> 362 <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> 363 <td><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td> 364 <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> 365 </tr> 366 </table></td> 367 <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> 368 <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 369 <tr> 370 <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> 371 <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td> 372 </tr> 373 </table></td> 374 </tr> 375 <tr> 376 <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> 377 <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td> 378 <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td> 379 <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td> 380 </tr> 381 </table></td> 382 </tr> 383 </table></form></td> 384 <!-- body_text_eof //--> 385 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> 386 <!-- right_navigation //--> 387 <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> 388 <!-- right_navigation_eof //--> 389 </table></td> 390 </tr> 391 </table> 392 <!-- body_eof //--> 393 394 <!-- footer //--> 395 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 396 <!-- footer_eof //--> 397 <br> 398 </body> 399 </html> 400 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 19:48:25 2007 | par Balluche grâce à PHPXref 0.7 |
|