ot_loworderfee.php
来自「Zen Cart是真正的电子商务艺术」· PHP 代码 · 共 111 行
PHP
111 行
<?php
/**
* ot_total order-total module
*
* @package orderTotal
* @copyright Copyright 2003-2007 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: ot_loworderfee.php 6101 2007-04-01 10:30:22Z wilt $
*/
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->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) ) {
if ( ($pass == true) && ( $order->info['subtotal'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {
$charge_it = 'true';
$cart_content_type = $_SESSION['cart']->get_content_type();
$gv_content_only = $_SESSION['cart']->gv_only();
if ($cart_content_type == 'physical' or $cart_content_type == 'mixed') {
$charge_it = 'true';
} else {
// check to see if everything is virtual, if so - skip the low order fee.
if ((($cart_content_type == 'virtual') and MODULE_ORDER_TOTAL_LOWORDERFEE_VIRTUAL == 'true')) {
$charge_it = 'false';
if ((($gv_content_only > 0) and MODULE_ORDER_TOTAL_LOWORDERFEE_GV == 'false')) {
$charge_it = 'true';
}
}
if ((($gv_content_only > 0) and MODULE_ORDER_TOTAL_LOWORDERFEE_GV == 'true')) {
// check to see if everything is gift voucher, if so - skip the low order fee.
$charge_it = 'false';
if ((($cart_content_type == 'virtual') and MODULE_ORDER_TOTAL_LOWORDERFEE_VIRTUAL == 'false')) {
$charge_it = 'true';
}
}
}
if ($charge_it == 'true') {
$tax_address = zen_get_tax_locations();
$tax = zen_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
$tax_description = zen_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
// calculate from flat fee or percentage
if (substr(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, -1) == '%') {
$low_order_fee = ($order->info['subtotal'] * (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE/100));
} else {
$low_order_fee = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
}
$order->info['tax'] += zen_calculate_tax($low_order_fee, $tax);
$order->info['tax_groups']["$tax_description"] += zen_calculate_tax($low_order_fee, $tax);
$order->info['total'] += $low_order_fee + zen_calculate_tax($low_order_fee, $tax);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$low_order_fee += zen_calculate_tax($low_order_fee, $tax);
}
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format($low_order_fee, true, $order->info['currency'], $order->info['currency_value']),
'value' => $low_order_fee);
}
}
}
}
function check() {
global $db;
if (!isset($this->_check)) {
$check_query = "select configuration_value
from " . TABLE_CONFIGURATION . "
where configuration_key = 'MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS'";
$check_query = $db->Execute($check_query);
$this->_check = $check_query->RecordCount();
}
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', 'MODULE_ORDER_TOTAL_LOWORDERFEE_VIRTUAL', 'MODULE_ORDER_TOTAL_LOWORDERFEE_GV');
}
function install() {
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('璇ユā鍧楀凡瀹夎
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?