[ Index ] |
|
Code source de osCommerce 2.2ms2-060817 |
1 <?php 2 /* 3 $Id: cod.php,v 1.28 2003/02/14 05:51:31 hpdl Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2003 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 13 class cod { 14 var $code, $title, $description, $enabled; 15 16 // class constructor 17 function cod() { 18 global $order; 19 20 $this->code = 'cod'; 21 $this->title = MODULE_PAYMENT_COD_TEXT_TITLE; 22 $this->description = MODULE_PAYMENT_COD_TEXT_DESCRIPTION; 23 $this->sort_order = MODULE_PAYMENT_COD_SORT_ORDER; 24 $this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false); 25 26 if ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) { 27 $this->order_status = MODULE_PAYMENT_COD_ORDER_STATUS_ID; 28 } 29 30 if (is_object($order)) $this->update_status(); 31 } 32 33 // class methods 34 function update_status() { 35 global $order; 36 37 if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_COD_ZONE > 0) ) { 38 $check_flag = false; 39 $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_COD_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); 40 while ($check = tep_db_fetch_array($check_query)) { 41 if ($check['zone_id'] < 1) { 42 $check_flag = true; 43 break; 44 } elseif ($check['zone_id'] == $order->delivery['zone_id']) { 45 $check_flag = true; 46 break; 47 } 48 } 49 50 if ($check_flag == false) { 51 $this->enabled = false; 52 } 53 } 54 55 // disable the module if the order only contains virtual products 56 if ($this->enabled == true) { 57 if ($order->content_type == 'virtual') { 58 $this->enabled = false; 59 } 60 } 61 } 62 63 function javascript_validation() { 64 return false; 65 } 66 67 function selection() { 68 return array('id' => $this->code, 69 'module' => $this->title); 70 } 71 72 function pre_confirmation_check() { 73 return false; 74 } 75 76 function confirmation() { 77 return false; 78 } 79 80 function process_button() { 81 return false; 82 } 83 84 function before_process() { 85 return false; 86 } 87 88 function after_process() { 89 return false; 90 } 91 92 function get_error() { 93 return false; 94 } 95 96 function check() { 97 if (!isset($this->_check)) { 98 $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_COD_STATUS'"); 99 $this->_check = tep_db_num_rows($check_query); 100 } 101 return $this->_check; 102 } 103 104 function install() { 105 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 Cash On Delivery Module', 'MODULE_PAYMENT_COD_STATUS', 'True', 'Do you want to accept Cash On Delevery payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); 106 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_COD_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())"); 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_COD_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, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_COD_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())"); 109 } 110 111 function remove() { 112 tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); 113 } 114 115 function keys() { 116 return array('MODULE_PAYMENT_COD_STATUS', 'MODULE_PAYMENT_COD_ZONE', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', 'MODULE_PAYMENT_COD_SORT_ORDER'); 117 } 118 } 119 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 19:48:25 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |