[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/includes/modules/payment/ -> freecharger.php (source)

   1  <?php
   2  /*

   3    WebMakers.com Added: Free Payments and Shipping

   4    Written by Linda McGrath [email protected]

   5    http://www.thewebmakerscorner.com

   6  

   7    osCMax Power E-Commerce

   8    http://oscdox.com

   9  

  10    Copyright 2006 osCMax2005 osCMax, 2002 osCommerce

  11  

  12    Released under the GNU General Public License

  13  */
  14  
  15    class freecharger {
  16      var $code, $title, $description, $enabled, $payment;
  17  
  18  // class constructor

  19      function freecharger() {
  20        global $order;
  21        $this->code = 'freecharger';
  22        $this->title = MODULE_PAYMENT_FREECHARGER_TEXT_TITLE;
  23        $this->description = MODULE_PAYMENT_FREECHARGER_TEXT_DESCRIPTION;
  24        $this->sort_order = MODULE_PAYMENT_FREECHARGER_SORT_ORDER;
  25        $this->enabled = ((MODULE_PAYMENT_FREECHARGER_STATUS == 'True') ? true : false);
  26  
  27        if ((int)MODULE_PAYMENT_FREECHARGER_ORDER_STATUS_ID > 0) {
  28          $this->order_status = MODULE_PAYMENT_FREECHARGER_ORDER_STATUS_ID;
  29          $payment='freecharger';
  30        } else {
  31          if ($payment=='freecharger') {
  32            $payment='';
  33          }
  34        }
  35  
  36        if (is_object($order)) $this->update_status();
  37  
  38        $this->email_footer = MODULE_PAYMENT_FREECHARGER_TEXT_EMAIL_FOOTER;
  39      }
  40  
  41  // class methods

  42      function update_status() {
  43        global $order;
  44  
  45        if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_FREECHARGER_ZONE > 0) ) {
  46          $check_flag = false;
  47          $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_FREECHARGER_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
  48          while ($check = tep_db_fetch_array($check_query)) {
  49            if ($check['zone_id'] < 1) {
  50              $check_flag = true;
  51              break;
  52            } elseif ($check['zone_id'] == $order->billing['zone_id']) {
  53              $check_flag = true;
  54              break;
  55            }
  56          }
  57  
  58          if ($check_flag == false) {
  59            $this->enabled = false;
  60          }
  61        }
  62      }
  63  
  64      function javascript_validation() {
  65        return false;
  66      }
  67  
  68      function selection() {
  69        return array('id' => $this->code,
  70                     'module' => $this->title);
  71      }
  72  
  73      function pre_confirmation_check() {
  74        return false;
  75      }
  76  
  77      function confirmation() {
  78        return array('title' => MODULE_PAYMENT_FREECHARGER_TEXT_DESCRIPTION);
  79      }
  80  
  81      function process_button() {
  82        return false;
  83      }
  84  
  85      function before_process() {
  86        return false;
  87      }
  88  
  89      function after_process() {
  90        return false;
  91      }
  92  
  93      function get_error() {
  94        return false;
  95      }
  96  
  97      function check() {
  98        if (!isset($this->_check)) {
  99          $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_FREECHARGER_STATUS'");
 100          $this->_check = tep_db_num_rows($check_query);
 101        }
 102        return $this->_check;
 103      }
 104  
 105      function install() {
 106        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 ('Enable Free Charge Module', 'MODULE_PAYMENT_FREECHARGER_STATUS', 'True', 'Do you want to accept Free Charge payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now());");
 107        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 of display.', 'MODULE_PAYMENT_FREECHARGER_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
 108        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_FREECHARGER_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
 109        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_FREECHARGER_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
 110      }
 111  
 112      function remove() {
 113        tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
 114      }
 115  
 116      function keys() {
 117        return array('MODULE_PAYMENT_FREECHARGER_STATUS', 'MODULE_PAYMENT_FREECHARGER_ZONE', 'MODULE_PAYMENT_FREECHARGER_ORDER_STATUS_ID', 'MODULE_PAYMENT_FREECHARGER_SORT_ORDER');
 118      }
 119    }
 120  ?>


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