⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 order_total.php

📁 集成了投票调查、流量统计、文件上传、留言版、论坛、软件下载、文章赏析、通讯录、网上购物 等板块 管理账户为peilei 密码为800901
💻 PHP
字号:
<?php
/*
  $Id: order_total.php,v 1.2 2002/04/08 01:13:43 hpdl Exp $

  网络商店 - 吉鑫网络
 http://www.chinaifc.com

Copyright (c) 2000,2001 网络商店

      汗化版权所有吉鑫网络
*/

  class order_total {
    var $modules;

// class constructor
    function order_total() {
      global $language;

      if (MODULE_ORDER_TOTAL_INSTALLED) {
        $this->modules = explode(';', MODULE_ORDER_TOTAL_INSTALLED);

        reset($this->modules);
        while (list(, $value) = each($this->modules)) {
          include(DIR_WS_LANGUAGES . $language . '/modules/order_total/' . $value);
          include(DIR_WS_MODULES . 'order_total/' . $value);

          $class = substr($value, 0, strrpos($value, '.'));
          $GLOBALS[$class] = new $class;
        }
      }
    }

    function process() {
      $order_total_array = array();
      if (MODULE_ORDER_TOTAL_INSTALLED) {
        reset($this->modules);
        while (list(, $value) = each($this->modules)) {
          $class = substr($value, 0, strrpos($value, '.'));
          if ($GLOBALS[$class]->enabled) {
            $GLOBALS[$class]->process();

            for ($i=0; $i<sizeof($GLOBALS[$class]->output); $i++) {
              if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {
                $order_total_array[] = array('code' => $GLOBALS[$class]->code,
                                             'title' => $GLOBALS[$class]->output[$i]['title'],
                                             'text' => $GLOBALS[$class]->output[$i]['text'],
                                             'value' => $GLOBALS[$class]->output[$i]['value'],
                                             'sort_order' => $GLOBALS[$class]->sort_order);
              }
            }
          }
        }
      }

      return $order_total_array;
    }

    function output() {
      $output_string = '';
      if (MODULE_ORDER_TOTAL_INSTALLED) {
        reset($this->modules);
        while (list(, $value) = each($this->modules)) {
          $class = substr($value, 0, strrpos($value, '.'));
          if ($GLOBALS[$class]->enabled) {
            for ($i=0; $i<sizeof($GLOBALS[$class]->output); $i++) {
              $output_string .= '              <tr>' . "\n" .
                                '                <td align="right" class="main">' . $GLOBALS[$class]->output[$i]['title'] . '</td>' . "\n" .
                                '                <td align="right" class="main">' . $GLOBALS[$class]->output[$i]['text'] . '</td>' . "\n" .
                                '              </tr>';
            }
          }
        }
      }

      return $output_string;
    }
// ICW ORDER TOTAL CREDIT CLASS/GV SYSTEM - START ADDITION
function credit_selection() {
      $output_string = '';
      $selection_string = '';
      $close_string = '';
      if (MODULE_ORDER_TOTAL_INSTALLED) {
      	$output1_string = '<tr>';
        $output1_string .= '   <td><table border="0" width="100%" cellspacing="0" cellpadding="0">';
        $output1_string .= '      <tr>';
        $output1_string .= '        <td class="tableHeading">'.TABLE_HEADING_CREDIT.'</td>';
        $output1_string .= '      </tr>';
        $output1_string .= '    </table></td>';
        $output1_string .= '  </tr>';
        $output1_string .= '  <tr>';
        $output1_string .= '    <td>'.tep_draw_separator().'</td>';
        $output1_string .= '  </tr>';
        reset($this->modules);
        $output_string = '';
        while (list(, $value) = each($this->modules)) {
          $class = substr($value, 0, strrpos($value, '.'));
          if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {
            if ($GLOBALS[$class]->selection_test()) {
              $output_string = '<tr><td><table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" .
                                ' <tr class="payment-odd">' . "\n" .
                                '    <td align="left" class="main">' . $GLOBALS[$class]->title;
              if ($GLOBALS[$class]->include_shipping == 'false') $output_string .= SHIPPING_NOT_INCLUDED;
              if ($GLOBALS[$class]->include_tax == 'false') $output_string .= TAX_NOT_INCLUDED;
              $output_string .= '</td>' . "\n" .  '    <td align="right" class="main">';
              $output_string .= $GLOBALS[$class]->user_prompt;
              $output_string .= '<input type="checkbox" onClick="submitFunction()" name="'. 'c_'.$GLOBALS[$class]->code . '">';
              $output_string .= '&nbsp;</td>' . "\n" .
                                 '  </tr>' . "\n";
                                 
              $output_string .= '</table></tr></td>' . "\n";
           }

           $selection_string .= $GLOBALS[$class]->credit_selection();
           $output_string .= $selection_string;
           $output_string .= $close_string;
           if ($output_string != '') $output_string = $output1_string . $output_string;
        }	
      }
}

      return $output_string;
    }
    
    function selection_test() {
      if (MODULE_ORDER_TOTAL_INSTALLED) {
        reset($this->modules);
        while (list(, $value) = each($this->modules)) {
          $class = substr($value, 0, strrpos($value, '.'));
          if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class)  {
            $GLOBALS[$class]->selection_test();
          }
        }
      }
    }

      function update_credit_account($i) {
      if (MODULE_ORDER_TOTAL_INSTALLED) {
        reset($this->modules);
        while (list(, $value) = each($this->modules)) {
          $class = substr($value, 0, strrpos($value, '.'));
          if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
            $GLOBALS[$class]->update_credit_account($i);
          }
        }
      }
    }
   
    function collect_posts() {
      global $HTTP_POST_VARS,$HTTP_SESSION_VARS;
      if (MODULE_ORDER_TOTAL_INSTALLED) {
        reset($this->modules);
        while (list(, $value) = each($this->modules)) {
          $class = substr($value, 0, strrpos($value, '.'));
          if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
            $post_var = 'c_'.$GLOBALS[$class]->code;
            $GLOBALS[$post_var] = $HTTP_POST_VARS[$post_var];
            if (!tep_session_is_registered($post_var)) tep_session_register($post_var);
            $GLOBALS[$class]->collect_posts();
          }
        }
      }
    }
    function pre_confirmation_check() {
      global $payment, $order, $credit_covers;
      if (MODULE_ORDER_TOTAL_INSTALLED) {
      	$total_deductions  = 0;
        reset($this->modules);
        $order_total = $order->info['total'];
        while (list(, $value) = each($this->modules)) {
          $class = substr($value, 0, strrpos($value, '.'));
          $order_total=$this->get_order_total_main($class,$order_total);
          if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
            $total_deductions = $total_deductions + $GLOBALS[$class]->pre_confirmation_check($order_total);
            $order_total = $order_total - $GLOBALS[$class]->pre_confirmation_check($order_total);
          }
        }
        If ($order->info['total'] - $total_deductions <= 0 ) {
 	  $credit_covers = true;
        }
      }
    }
    function apply_credit() {
      if (MODULE_ORDER_TOTAL_INSTALLED) {
        reset($this->modules);
        while (list(, $value) = each($this->modules)) {
          $class = substr($value, 0, strrpos($value, '.'));
          if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
            $GLOBALS[$class]->apply_credit();
//            $order->info['total'] = $order->info['total'] - $deduct_amount;
          }
        }
      }
    }
    function clear_posts() {
      global $HTTP_POST_VARS,$HTTP_SESSION_VARS;
      if (MODULE_ORDER_TOTAL_INSTALLED) {
        reset($this->modules);
        while (list(, $value) = each($this->modules)) {
          $class = substr($value, 0, strrpos($value, '.'));
          if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
            $post_var = 'c_'.$GLOBALS[$class]->code;
            if (tep_session_is_registered($post_var)) tep_session_unregister($post_var);
          }
        }
      }
    }
  function get_order_total_main($class, $order_total) {
    global $credit, $order;
    if ($GLOBALS[$class]->include_tax == 'false') $order_total=$order_total-$order->info['tax'];
    if ($GLOBALS[$class]->include_shipping == 'false') $order_total=$order_total-$order->info['shipping_cost'];
    return $order_total;
  }
// ICW ORDER TOTAL CREDIT CLASS/GV SYSTEM - END ADDITION  
  }
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -