house.php
来自「全新且完善的强大网上商店系统」· PHP 代码 · 共 86 行
PHP
86 行
<?php
class house {
var $code, $title, $description, $icon, $enabled;
// class constructor
function house() {
global $order,$db,$table_zones_to_geo_zones;
$this->code = 'house';
$this->title = MODULE_SHIPPING_HOUSE_TEXT_TITLE;
$this->description = MODULE_SHIPPING_HOUSE_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_HOUSE_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_HOUSE_TAX_CLASS;
$this->enabled = ((MODULE_SHIPPING_HOUSE_STATUS == 'True') ? true : false);
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_HOUSE_ZONE > 0) ) {
$check_flag = false;
$check_query = $db->query("select zone_id from $table_zones_to_geo_zones where geo_zone_id = '" . MODULE_SHIPPING_HOUSE_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while ($check = $db->fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
// class methods
function quote($method = '') {
global $order;
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_HOUSE_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_HOUSE_TEXT_WAY,
'cost' => MODULE_SHIPPING_HOUSE_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);
return $this->quotes;
}
function check() {
global $db,$table_configuration;
if (!isset($this->_check)) {
$check_query = $db->query("select configuration_value from $table_configuration where configuration_key = 'MODULE_SHIPPING_HOUSE_STATUS'");
$this->_check = $db->num_rows($check_query);
}
return $this->_check;
}
function install() {
global $db,$table_configuration;
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('是否支持送货上门', 'MODULE_SHIPPING_HOUSE_STATUS', 'True', '是否接受送货上门?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('配送费用', 'MODULE_SHIPPING_HOUSE_COST', '5.00', '使用货到付款的费用', '6', '0', now())");
$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 ('税率', 'MODULE_SHIPPING_HOUSE_TAX_CLASS', '0', '这种配送方式的税率', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
$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 ('配送地区', 'MODULE_SHIPPING_HOUSE_ZONE', '0', '支持这种配送方式的地区,如果选择地区,那么将只有这一个地区只持送货上门', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('排序', 'MODULE_SHIPPING_HOUSE_SORT_ORDER', '0', '在配送方式中的排列顺序.', '6', '0', now())");
}
function remove() {
global $db,$table_configuration;
$db->query("delete from $table_configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_SHIPPING_HOUSE_STATUS', 'MODULE_SHIPPING_HOUSE_COST', 'MODULE_SHIPPING_HOUSE_TAX_CLASS', 'MODULE_SHIPPING_HOUSE_ZONE', 'MODULE_SHIPPING_HOUSE_SORT_ORDER');
}
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?