[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> checkout_payment.php (source)

   1  <?php
   2  /*

   3  $Id: checkout_payment.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13  // Most of this file is changed or moved to BTS - Basic Template System - format.

  14  // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  15  //       catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  16  // (Sub 'fallback' with your current template to see if there is a template specific file.)

  17  
  18    require ('includes/application_top.php');
  19  
  20  // if the customer is not logged on, redirect them to the login page

  21    if (!tep_session_is_registered('customer_id')) {
  22      $navigation->set_snapshot();
  23      tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  24    }
  25  
  26  // if there is nothing in the customers cart, redirect them to the shopping cart page

  27    if ($cart->count_contents() < 1) {
  28      tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
  29    }
  30  
  31  // if no shipping method has been selected, redirect the customer to the shipping method selection page

  32    if (!tep_session_is_registered('shipping')) {
  33      tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
  34    }
  35  
  36  // avoid hack attempts during the checkout procedure by checking the internal cartID

  37    if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
  38      if ($cart->cartID != $cartID) {
  39        tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
  40      }
  41    }
  42  // BOF - MOD: CREDIT CLASS Gift Voucher Contribution

  43  // if we have been here before and are coming back get rid of the credit covers variable

  44      if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');  //ICW ADDED FOR CREDIT CLASS SYSTEM

  45  // EOF - MOD: CREDIT CLASS Gift Voucher Contribution

  46  
  47  // Stock Check

  48    if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
  49  // BOF: MOD - QT Pro

  50  //    $products = $cart->get_products();

  51  //    for ($i=0, $n=sizeof($products); $i<$n; $i++) {

  52  //      if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {

  53  //        tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

  54  //        break;

  55  //      }

  56      $products = $cart->get_products();
  57      $any_out_of_stock = 0;
  58      for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  59       if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
  60         $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity'], $products[$i]['attributes']);
  61       }
  62       else{
  63         $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
  64       }
  65       if ($stock_check) $any_out_of_stock = 1;
  66        }
  67      if ($any_out_of_stock == 1) {
  68        tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
  69        break;
  70  // EOF: MOD - QT Pro

  71      }
  72    }
  73  
  74  // if no billing destination address was selected, use the customers own address as default

  75    if (!tep_session_is_registered('billto')) {
  76      tep_session_register('billto');
  77      $billto = $customer_default_address_id;
  78    } else {
  79  // verify the selected billing address

  80      if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) {
  81        $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 . "'");
  82        $check_address = tep_db_fetch_array($check_address_query);
  83  
  84        if ($check_address['total'] != '1') {
  85          $billto = $customer_default_address_id;
  86          if (tep_session_is_registered('payment')) tep_session_unregister('payment');
  87        }
  88      }
  89    }
  90  
  91    require (DIR_WS_CLASSES . 'order.php');
  92    $order = new order;
  93  // BOF - MOD: CREDIT CLASS Gift Voucher Contribution

  94    require (DIR_WS_CLASSES . 'order_total.php');
  95    $order_total_modules = new order_total;
  96    $order_total_modules->clear_posts();
  97  // EOF - MOD: CREDIT CLASS Gift Voucher Contribution

  98  
  99    if (!tep_session_is_registered('comments')) tep_session_register('comments');
 100    if (isset($HTTP_POST_VARS['comments']) && tep_not_null($HTTP_POST_VARS['comments'])) {
 101      $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
 102    }
 103  
 104    $total_weight = $cart->show_weight();
 105    $total_count = $cart->count_contents();
 106  // LINE ADDED: MOD - CREDIT CLASS Gift Voucher Contribution

 107    $total_count = $cart->count_contents_virtual();
 108  
 109  // load all enabled payment modules

 110    require (DIR_WS_CLASSES . 'payment.php');
 111    $payment_modules = new payment;
 112  
 113    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);
 114  
 115    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
 116    $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 117  
 118    $content = CONTENT_CHECKOUT_PAYMENT;
 119    
 120    $javascript = $content . '.js.php';
 121    
 122    include (bts_select('main', $content_template)); // BTSv1.5

 123  
 124    require (DIR_WS_INCLUDES . 'application_bottom.php');
 125  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7