[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 源代码 flat.php

Zen Cart 源代码 flat.php




下载文件

文件名: flat.php
文件类型: PHP文件
文件大小: 5.69 KiB
MD5: 4a24acc4462c7317100fbb9bff9ffa79

flat.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package shippingMethod
  4.  * @copyright Copyright 2003-2009 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  */
  8. // $Id: flat.php 14498 2009-10-01 20:16:16Z ajeh $
  9. //
  10.  
  11.   class flat {
  12.     var $code, $title, $description, $icon, $enabled;
  13.  
  14. // class constructor
  15.     function flat() {
  16.       global $order, $db;
  17.  
  18.       $this->code = 'flat';
  19.       $this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
  20.       $this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
  21.       $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
  22.       $this->icon = '';
  23.       $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
  24.       $this->tax_basis = MODULE_SHIPPING_FLAT_TAX_BASIS;
  25.  
  26.       // disable only when entire cart is free shipping
  27.       if (zen_get_shipping_enabled($this->code)) {
  28.         $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
  29.       }
  30.  
  31.       if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
  32.         $check_flag = false;
  33.         $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
  34.         while (!$check->EOF) {
  35.           if ($check->fields['zone_id'] < 1) {
  36.             $check_flag = true;
  37.             break;
  38.           } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
  39.             $check_flag = true;
  40.             break;
  41.           }
  42.           $check->MoveNext();
  43.         }
  44.  
  45.         if ($check_flag == false) {
  46.           $this->enabled = false;
  47.         }
  48.       }
  49.     }
  50.  
  51. // class methods
  52.     function quote($method = '') {
  53.       global $order;
  54.  
  55.       $this->quotes = array('id' => $this->code,
  56.                             'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
  57.                             'methods' => array(array('id' => $this->code,
  58.                                                      'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
  59.                                                      'cost' => MODULE_SHIPPING_FLAT_COST)));
  60.       if ($this->tax_class > 0) {
  61.         $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
  62.       }
  63.  
  64.       if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
  65.  
  66.       return $this->quotes;
  67.     }
  68.  
  69.     function check() {
  70.       global $db;
  71.       if (!isset($this->_check)) {
  72.         $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FLAT_STATUS'");
  73.         $this->_check = $check_query->RecordCount();
  74.       }
  75.       return $this->_check;
  76.     }
  77.  
  78.     function install() {
  79.       global $db;
  80.       $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_SHIPPING_FLAT_STATUS', 'True', '您是否要采用固定运费方式?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
  81.       $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('运费成本', 'MODULE_SHIPPING_FLAT_COST', '5.00', '使用该配送方式的订单的成本运费', '6', '0', now())");
  82.       $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_SHIPPING_FLAT_TAX_CLASS', '0', '计算运费使用的税率种类。', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
  83.       $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_SHIPPING_FLAT_TAX_BASIS', 'Shipping', '计算运费税的基准。选项为<br />Shipping - 基于客户的交货人地址<br />Billing - 基于客户的帐单地址<br />Store - 如果帐单地址/送货地区和商店地区相同,则基于商店地址', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");
  84.       $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_SHIPPING_FLAT_ZONE', '0', '如果选择了地区,仅该地区采用该配送方式。', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
  85.       $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('排序顺序', 'MODULE_SHIPPING_FLAT_SORT_ORDER', '0', '显示的顺序。', '6', '0', now())");
  86.     }
  87.  
  88.     function remove() {
  89.       global $db;
  90.       $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_FLAT\_%'");
  91.     }
  92.  
  93.     function keys() {
  94.       return array('MODULE_SHIPPING_FLAT_STATUS', 'MODULE_SHIPPING_FLAT_COST', 'MODULE_SHIPPING_FLAT_TAX_CLASS', 'MODULE_SHIPPING_FLAT_TAX_BASIS', 'MODULE_SHIPPING_FLAT_ZONE', 'MODULE_SHIPPING_FLAT_SORT_ORDER');
  95.     }
  96.   }
  97. ?>


cron