[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 ot_loworderfee.php

Zen Cart 源代码 ot_loworderfee.php




下载文件

文件名: ot_loworderfee.php
文件类型: PHP文件
文件大小: 8.66 KiB
MD5: 9aac6667d45cf8aca06745d47b312de5

ot_loworderfee.php - 关闭高亮
  1. <?php
  2. /**
  3.  * ot_total order-total module
  4.  *
  5.  * @package orderTotal
  6.  * @copyright Copyright 2003-2007 Zen Cart Development Team
  7.  * @copyright Portions Copyright 2003 osCommerce
  8.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  9.  * @version $Id: ot_loworderfee.php 6101 2007-04-01 10:30:22Z wilt $
  10.  */
  11.   class ot_loworderfee {
  12.     var $title, $output;
  13.  
  14.     function ot_loworderfee() {
  15.       $this->code = 'ot_loworderfee';
  16.       $this->title = MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE;
  17.       $this->description = MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION;
  18.       $this->sort_order = MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER;
  19.  
  20.       $this->output = array();
  21.     }
  22.  
  23.     function process() {
  24.       global $order, $currencies;
  25.  
  26.       if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') {
  27.         switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
  28.           case 'national':
  29.             if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
  30.           case 'international':
  31.             if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
  32.           case 'both':
  33.             $pass = true; break;
  34.           default:
  35.             $pass = false; break;
  36.         }
  37.  
  38. //        if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {
  39.         if ( ($pass == true) && ( $order->info['subtotal'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {
  40.           $charge_it = 'true';
  41.           $cart_content_type = $_SESSION['cart']->get_content_type();
  42.           $gv_content_only = $_SESSION['cart']->gv_only();
  43.           if ($cart_content_type == 'physical' or $cart_content_type == 'mixed') {
  44.             $charge_it = 'true';
  45.           } else {
  46.             // check to see if everything is virtual, if so - skip the low order fee.
  47.             if ((($cart_content_type == 'virtual') and MODULE_ORDER_TOTAL_LOWORDERFEE_VIRTUAL == 'true')) {
  48.               $charge_it = 'false';
  49.               if ((($gv_content_only > 0) and MODULE_ORDER_TOTAL_LOWORDERFEE_GV == 'false')) {
  50.                 $charge_it = 'true';
  51.               }
  52.             }
  53.  
  54.             if ((($gv_content_only > 0) and MODULE_ORDER_TOTAL_LOWORDERFEE_GV == 'true')) {
  55.             // check to see if everything is gift voucher, if so - skip the low order fee.
  56.               $charge_it = 'false';
  57.               if ((($cart_content_type == 'virtual') and MODULE_ORDER_TOTAL_LOWORDERFEE_VIRTUAL == 'false')) {
  58.                 $charge_it = 'true';
  59.               }
  60.             }
  61.           }
  62.  
  63.           if ($charge_it == 'true') {
  64.             $tax_address = zen_get_tax_locations();
  65.             $tax = zen_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
  66.             $tax_description = zen_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
  67.  
  68. // calculate from flat fee or percentage
  69.             if (substr(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, -1) == '%') {
  70.               $low_order_fee = ($order->info['subtotal'] * (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE/100));
  71.             } else {
  72.               $low_order_fee = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
  73.             }
  74.  
  75.  
  76.             $order->info['tax'] += zen_calculate_tax($low_order_fee, $tax);
  77.             $order->info['tax_groups']["$tax_description"] += zen_calculate_tax($low_order_fee, $tax);
  78.             $order->info['total'] += $low_order_fee + zen_calculate_tax($low_order_fee, $tax);
  79.             if (DISPLAY_PRICE_WITH_TAX == 'true') {
  80.               $low_order_fee += zen_calculate_tax($low_order_fee, $tax);
  81.             }
  82.  
  83.             $this->output[] = array('title' => $this->title . ':',
  84.                                     'text' => $currencies->format($low_order_fee, true, $order->info['currency'], $order->info['currency_value']),
  85.                                     'value' => $low_order_fee);
  86.           }
  87.         }
  88.       }
  89.     }
  90.  
  91.     function check() {
  92.       global $db;
  93.       if (!isset($this->_check)) {
  94.         $check_query = "select configuration_value
  95.                        from " . TABLE_CONFIGURATION . "
  96.                        where configuration_key = 'MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS'";
  97.  
  98.         $check_query = $db->Execute($check_query);
  99.         $this->_check = $check_query->RecordCount();
  100.       }
  101.  
  102.       return $this->_check;
  103.     }
  104.  
  105.     function keys() {
  106.       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');
  107.     }
  108.  
  109.     function install() {
  110.       global $db;
  111.       $db->Execute("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', '', '6', '1','zen_cfg_select_option(array(\'true\'), ', now())");
  112.       $db->Execute("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', '400', '显示的排序顺序。', '6', '2', now())");
  113.       $db->Execute("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', '您要收取低额订单费用吗?', '6', '3', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
  114.       $db->Execute("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())");
  115.       $db->Execute("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', '按百分比收取 - 包含符号 % 例如: 10%<br />收取固定金额 - 例如: 输入 5 表示 5元', '6', '5', '', now())");
  116.       $db->Execute("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_DESTINATION', 'both', '该送货地区收取低额订单费。', '6', '6', 'zen_cfg_select_option(array(\'national\', \'international\', \'both\'), ', now())");
  117.       $db->Execute("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', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
  118.       $db->Execute("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_VIRTUAL', 'false', '购物车中只有虚拟商品时,不收取低额订单费', '6', '8', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
  119.       $db->Execute("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_GV', 'false', '购物车中只有礼券时,不收取低额订单费', '6', '9', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
  120.     }
  121.  
  122.     function remove() {
  123.       global $db;
  124.       $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
  125.     }
  126.   }
  127. ?>


cron