📄 freeoptions.php
字号:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | license@zen-cart.com so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: freeoptions.php 3797 2006-06-18 13:38:34Z ajeh $
//
class freeoptions extends base {
var $code, $title, $description, $icon, $enabled;
var $ck_freeoptions_total, $ck_freeoptions_weight, $ck_freeoptions_items;
// class constructor
function freeoptions() {
global $order, $db;
$this->code = 'freeoptions';
$this->title = MODULE_SHIPPING_FREEOPTIONS_TEXT_TITLE;
$this->description = MODULE_SHIPPING_FREEOPTIONS_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_FREEOPTIONS_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_FREEOPTIONS_TAX_CLASS;
$this->tax_basis = MODULE_SHIPPING_FREEOPTIONS_TAX_BASIS;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
}
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREEOPTIONS_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
// class methods
function quote($method = '') {
global $order;
// check if anything is configured for total, weight or item
if ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN !='' or MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX !='')) {
$this->ck_freeoptions_total = true;
} else {
$this->ck_freeoptions_total = false;
}
if ((MODULE_SHIPPING_FREEOPTIONS_WEIGHT_MIN !='' or MODULE_SHIPPING_FREEOPTIONS_WEIGHT_MAX !='')) {
$this->ck_freeoptions_weight = true;
} else {
$this->ck_freeoptions_weight = false;
}
if ((MODULE_SHIPPING_FREEOPTIONS_ITEMS_MIN !='' or MODULE_SHIPPING_FREEOPTIONS_ITEMS_MAX !='')) {
$this->ck_freeoptions_items = true;
} else {
$this->ck_freeoptions_items = false;
}
if ($this->ck_freeoptions_total or $this->ck_freeoptions_weight or $this->ck_freeoptions_items) {
$this->enabled = true;
} else {
$this->enabled = false;
}
// disabled if nothing validates for total, weight or item
if ($this->enabled) {
if ($this->ck_freeoptions_total) {
switch (true) {
case ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN !='' and MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX !='')):
if ($_SESSION['cart']->show_total() >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN and $_SESSION['cart']->show_total() <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
$this->ck_freeoptions_total = true;
} else {
$this->ck_freeoptions_total = false;
}
break;
case ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN !='')):
if ($_SESSION['cart']->show_total() >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) {
$this->ck_freeoptions_total = true;
} else {
$this->ck_freeoptions_total = false;
}
break;
case ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX !='')):
if ($_SESSION['cart']->show_total() <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
$this->ck_freeoptions_total = true;
} else {
$this->ck_freeoptions_total = false;
}
break;
}
}
if ($this->ck_freeoptions_weight) {
switch (true) {
case ((MODULE_SHIPPING_FREEOPTIONS_WEIGHT_MIN !='' and MODULE_SHIPPING_FREEOPTIONS_WEIGHT_MAX !='')):
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -