[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> checkout_confirmation.php (source)

   1  <?php
   2  /*

   3  $Id: checkout_confirmation.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(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
  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  // 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  // if no shipping method has been selected, redirect the customer to the shipping method selection page

  39    if (!tep_session_is_registered('shipping')) {
  40      tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
  41    }
  42  
  43    if (!tep_session_is_registered('payment')) tep_session_register('payment');
  44    if (isset($HTTP_POST_VARS['payment'])) $payment = $HTTP_POST_VARS['payment'];
  45  
  46    if (!tep_session_is_registered('comments')) tep_session_register('comments');
  47    if (tep_not_null($HTTP_POST_VARS['comments'])) {
  48      $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
  49    }
  50  
  51  // load the selected payment module

  52    require (DIR_WS_CLASSES . 'payment.php');
  53    $payment_modules = new payment($payment);
  54  // LINE ADDED: MOD - ICW CREDIT CLASS SYSTEM

  55    require (DIR_WS_CLASSES . 'order_total.php');
  56  
  57    require (DIR_WS_CLASSES . 'order.php');
  58    $order = new order;
  59  
  60    $payment_modules->update_status();
  61  // BOF: MOD - ICW ADDED FOR CREDIT CLASS SYSTEM

  62    $order_total_modules = new order_total;
  63    $order_total_modules->collect_posts();
  64    $order_total_modules->pre_confirmation_check();
  65  
  66  //  if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {

  67  //    tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));

  68    if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {
  69      tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=ccerr&error=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));  // Rigadin in v5.13: modified error coding in URL

  70  // EOF: MOD - ICW ADDED FOR CREDIT CLASS SYSTEM

  71    }
  72  
  73    if (is_array($payment_modules->modules)) {
  74      $payment_modules->pre_confirmation_check();
  75    }
  76  
  77  // load the selected shipping module

  78    require (DIR_WS_CLASSES . 'shipping.php');
  79    $shipping_modules = new shipping($shipping);
  80  // BOF: MOD - ICW CREDIT CLASS SYSTEM

  81  // ICW Credit class amendment Lines below repositioned

  82  //  require(DIR_WS_CLASSES . 'order_total.php');

  83  //  $order_total_modules = new order_total;

  84  // EOF: MOD - ICW CREDIT CLASS SYSTEM

  85  
  86  // Stock Check

  87    $any_out_of_stock = false;
  88    if (STOCK_CHECK == 'true') {
  89  // BOF: MOD - QT Pro

  90  //    for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

  91  //      if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {

  92      $check_stock='';
  93      for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
  94        if (isset($order->products[$i]['attributes']) && is_array($order->products[$i]['attributes'])) {
  95          $attributes=array();
  96          foreach ($order->products[$i]['attributes'] as $attribute) {
  97            $attributes[$attribute['option_id']]=$attribute['value_id'];
  98          }
  99          $check_stock[$i] = tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'], $attributes);
 100        } else {
 101          $check_stock[$i] = tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);
 102        }
 103        if ($check_stock[$i]) {
 104  // EOF: MOD - QT Pro

 105          $any_out_of_stock = true;
 106        }
 107      }
 108      // Out of Stock

 109      if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {
 110        tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 111      }
 112    }
 113  
 114    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);
 115  
 116    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
 117    $breadcrumb->add(NAVBAR_TITLE_2);
 118  
 119    $content = CONTENT_CHECKOUT_CONFIRMATION;
 120  
 121    include (bts_select('main', $content_template)); // BTSv1.5

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


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