ot_loworderfee.php
来自「全新且完善的强大网上商店系统」· PHP 代码 · 共 77 行
PHP
77 行
<?php
class ot_loworderfee {
var $title, $output;
function ot_loworderfee() {
$this->code = 'ot_loworderfee';
$this->title = MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE;
$this->description = MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER;
$this->output = array();
}
function process() {
global $order, $currencies;
if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') {
switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
case 'national':
if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
case 'international':
if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
case 'both':
$pass = true; break;
default:
$pass = false; break;
}
if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {
$tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$tax_description = tep_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$order->info['tax'] += tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$order->info['tax_groups']["$tax_description"] += tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$order->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format(tep_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), true, $order->info['currency'], $order->info['currency_value']),
'value' => tep_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax));
}
}
}
function check() {
global $db,$table_configuration;
if (!isset($this->_check)) {
$query = $db->query("select configuration_value from $table_configuration where configuration_key = 'MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS'");
$this->_check = $db->num_rows($query);
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS', 'MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER', 'MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE', 'MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER', 'MODULE_ORDER_TOTAL_LOWORDERFEE_FEE', 'MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION', 'MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS');
}
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_ORDER_TOTAL_LOWORDERFEE_STATUS', 'true', 'Do you want to display the low order fee?', '6', '1','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_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER', '4', 'Sort order of display.', '6', '2', now())");
$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_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE', 'false', 'Do you want to allow low order fees?', '6', '3', '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, use_function, date_added) values ('订单手绪费', 'MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER', '50', '如果订单低于这个金额则添加手绪费', '6', '4', 'currencies->format', now())");
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values ('手绪费', 'MODULE_ORDER_TOTAL_LOWORDERFEE_FEE', '5', '最低的手绪费', '6', '5', 'currencies->format', now())");
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Attach Low Order Fee On Orders Made', 'MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION', 'both', 'Attach low order fee for orders sent to the set destination.', '6', '6', 'tep_cfg_select_option(array(\'national\', \'international\', \'both\'), ', 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_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS', '0', '使用以下税率', '6', '7', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
}
function remove() {
global $db,$table_configuration;
$db->query("delete from $table_configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?