[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/includes/modules/order_total/ -> ot_subtotal.php (source)

   1  <?php
   2  /*

   3  $Id: ot_subtotal.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    class ot_subtotal {
  14      var $title, $output;
  15  
  16      function ot_subtotal() {
  17        $this->code = 'ot_subtotal';
  18        $this->title = MODULE_ORDER_TOTAL_SUBTOTAL_TITLE;
  19        $this->description = MODULE_ORDER_TOTAL_SUBTOTAL_DESCRIPTION;
  20        $this->enabled = ((MODULE_ORDER_TOTAL_SUBTOTAL_STATUS == 'true') ? true : false);
  21        $this->sort_order = MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER;
  22  
  23        $this->output = array();
  24      }
  25  
  26      function process() {
  27        global $order, $currencies;
  28  
  29  // BOF: LINES ADDED

  30        $od_amount = $_SESSION['od_amount'];
  31        $subtotal = $order->info['subtotal'] - $od_amount;
  32        $order->info['subtotal'] = $order->info['subtotal'] - $od_amount;
  33  // EOF: LINES ADDED

  34  
  35        $this->output[] = array('title' => $this->title . ':',
  36                                'text' => $currencies->format($order->info['subtotal'], true, $order->info['currency'], $order->info['currency_value']),
  37                                'value' => $order->info['subtotal']);
  38      }
  39  
  40      function check() {
  41        if (!isset($this->_check)) {
  42          $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_SUBTOTAL_STATUS'");
  43          $this->_check = tep_db_num_rows($check_query);
  44        }
  45  
  46        return $this->_check;
  47      }
  48  
  49      function keys() {
  50        return array('MODULE_ORDER_TOTAL_SUBTOTAL_STATUS', 'MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER');
  51      }
  52  
  53      function install() {
  54        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Sub-Total', 'MODULE_ORDER_TOTAL_SUBTOTAL_STATUS', 'true', 'Do you want to display the order sub-total cost?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
  55        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER', '1', 'Sort order of display.', '6', '2', now())");
  56      }
  57  
  58      function remove() {
  59        tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
  60      }
  61    }
  62  ?>


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