PDF rausgenommen
This commit is contained in:
209
msd2/myoos/includes/modules/shipping/ap.php
Normal file
209
msd2/myoos/includes/modules/shipping/ap.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: ap.php,v 1.4 2008/08/25 14:28:07 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: ap.php,v 1.05 2003/02/18 03:37:00 harley_vb
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2002 - 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Plänkers
|
||||
http://www.themedia.at & http://www.oscommerce.at
|
||||
|
||||
All rights reserved.
|
||||
|
||||
This program is free software licensed under the GNU General Public License (GPL).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class ap {
|
||||
var $code, $title, $description, $icon, $num_ap, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'ap';
|
||||
$this->title = $aLang['module_shipping_ap_text_title'];
|
||||
$this->description = $aLang['module_shipping_ap_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_AP_SORT_ORDER') ? MODULE_SHIPPING_AP_SORT_ORDER : null);
|
||||
$this->icon = OOS_ICONS . 'shipping_ap.gif';
|
||||
$this->tax_class = (defined('MODULE_SHIPPING_AP_TAX_CLASS') ? MODULE_SHIPPING_AP_TAX_CLASS : null);
|
||||
$this->enabled = (defined('MODULE_SHIPPING_AP_STATUS') && (MODULE_SHIPPING_AP_STATUS == 'True') ? true : false);
|
||||
|
||||
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_AP_ZONE > 0) ) {
|
||||
$check_flag = FALSE;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
|
||||
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_AP_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
|
||||
while ($check = $check_result->fields) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$check_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$check_result->Close();
|
||||
|
||||
if ($check_flag == FALSE) {
|
||||
$this->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
|
||||
$this->num_ap = 8;
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
|
||||
|
||||
$dest_country = $oOrder->delivery['country']['iso_code_2'];
|
||||
$dest_zone = 0;
|
||||
$error = FALSE;
|
||||
|
||||
for ($i=1; $i<=$this->num_ap; $i++) {
|
||||
$countries_table = constant('MODULE_SHIPPING_AP_COUNTRIES_' . $i);
|
||||
$country_zones = explode("[,]", $countries_table);
|
||||
if (in_array($dest_country, $country_zones)) {
|
||||
$dest_zone = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($dest_zone == 0) {
|
||||
$error = TRUE;
|
||||
} else {
|
||||
$shipping = -1;
|
||||
$ap_cost = constant('MODULE_SHIPPING_AP_COST_' . $i);
|
||||
|
||||
$ap_table = preg_split("/[:,]/" , $ap_cost);
|
||||
for ($i=0; $i<count($ap_table); $i+=2) {
|
||||
if ($shipping_weight <= $ap_table[$i]) {
|
||||
$shipping = $ap_table[$i+1];
|
||||
$shipping_method = $aLang['module_shipping_ap_text_way'] . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . $aLang['module_shipping_ap_text_units'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($shipping == -1) {
|
||||
$shipping_cost = 0;
|
||||
$shipping_method = $aLang['module_shipping_ap_undefined_rate'];
|
||||
} else {
|
||||
$shipping_cost = ($shipping + MODULE_SHIPPING_AP_HANDLING);
|
||||
}
|
||||
}
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' => $aLang['module_shipping_ap_text_title'],
|
||||
'methods' => array(array('id' => $this->code,
|
||||
'title' => $shipping_method . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_ap_text_units'] .')',
|
||||
'cost' => $shipping_cost * $shipping_num_boxes)));
|
||||
|
||||
if ($this->tax_class > 0) {
|
||||
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
|
||||
}
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_ap_invalid_zone'];
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_AP_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
function install() {
|
||||
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_HANDLING', '0', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_SORT_ORDER', '0', '6', '0', now())");
|
||||
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_1', 'DE,IT,SM', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_1', '1:12.35,2:13.80,3:15.25,4:16.70,5:18.15,6:19.60,7:21.05,8:22.50,9:23.95,10:25.40,11:26.85,12:28.30,13:29.75,14:31.20,15:32.65,16:34.10,17:35.55,18:37.00,19:38.45,20:39.90', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_2', 'AD,BE,DK,FO,GL,FI,FR,GR,GB,IE,LI,LU,MC,NL,PT,SE,CH,SK,SI,ES,CZ,HU,VA', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_2', '1:13.08,2:15.26,3:17.44,4:19.62,5:21.80,6:23.98,7:26.16,8:28.34,9:30.52,10:32.70,11:34.88,12:37.06,13:39.24,14:41.42,15:43.60,16:45.78,17:47.96,18:50.14,19:52.32,20:54.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_3', 'EG,AL,DZ,AM,AZ,BA,BG,EE,GE,GI,IS,IL,YU,HR,LV,LB,LY,LT,MT,MA,MK,MD,NO,PL,RO,RU,SY,TN,TR,UA,CY', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_3', '1:14.53,2:18.16,3:21.79,4:25.42,5:29.05,6:32.68,7:36.31,8:39.94,9:43.57,10:47.20,11:50.83,12:54.46,13:58.09,14:61.72,15:65.35,16:68.98,17:72.61,18:76.24,19:79.87,20:83.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_4', 'ET,BH,BJ,BF,CI,DJ,ER,GM,GH,GU,GN,GW,IQ,IR,YE,JO,CM,CA,CV,KZ,QA,KG,KW,LR,ML,MH,MR,FM,NE,NG,MP,OM,PR,SA,SN,SL,SO,SD,TJ,TG,TD,TM,UZ,AE,US,UM,CF', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_4', '1:17.44,2:23.98,3:30.52,4:37.06,5:43.60,6:50.14,7:56.68,8:63.22,9:69.76,10:76.30,11:82.84,12:89.38,13:95.92,14:102.46,15:109.00,16:115.54,17:122.08,18:128.62,19:135.16,20:141.70', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_5', 'AF,AO,AI,AG,GQ,AR,BS,BD,BB,BZ,BM,BT,BO,BW,BR,BN,BI,KY,CL,CN,CR,DM,DO,EC,SV,FK,GF,GA,GD,GP,GT,GY,HT,HN,HK,IN,ID,TP,JM,JP,KH,KE,CO,KM,CG,KP,KR,CU,LA,LS', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_5', '1:19.62,2:28.34,3:37.06,4:45.78,5:54.50,6:63.22,7:71.94,8:80.66,9:89.38,10:98.10,11:106.82,12:115.54,13:124.26,14:132.98,15:141.70,16:150.42,17:159.14,18:167.86,19:176.58,20:185.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_6', 'MO,MG,MW,MY,MV,MQ,MU,MX,MN,MS,MZ,MM,NA,NP,NI,AN,AW,PK,PA,PY,PE,PH,RE,RW,ZM,ST,SC,ZW,SG,LK,KN,LC,PM,VC,ZA,SR,SZ,TZ,TH,TT,TC,UG,UY,VE,VN,VG', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_6', '1:19.62,2:28.34,3:37.06,4:45.78,5:54.50,6:63.22,7:71.94,8:80.66,9:89.38,10:98.10,11:106.82,12:115.54,13:124.26,14:132.98,15:141.70,16:150.42,17:159.14,18:167.86,19:176.58,20:185.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_7', 'AU,CK,FJ,PF,KI,NR,NC,NZ,PG,PN,SB,TO,TV,VU,WF,WS', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_7', '1:23.98,2:37.06,3:50.14,4:63.22,5:76.30,6:89.38,7:102.46,8:115.54,9:128.62,10:141.70,11:154.78,12:167.86,13:180.94,14:194.02,15:207.10,16:220.18,17:233.26,18:246.34,19:259.42,20:272.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_8', 'AT', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_8', '2:3.56,4:4.36,8:5.45,12:6.90,20:9.08,31.5:12.72', '6', '0', now())");
|
||||
}
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
function keys() {
|
||||
$keys = array('MODULE_SHIPPING_AP_STATUS', 'MODULE_SHIPPING_AP_HANDLING', 'MODULE_SHIPPING_AP_TAX_CLASS', 'MODULE_SHIPPING_AP_ZONE', 'MODULE_SHIPPING_AP_SORT_ORDER');
|
||||
|
||||
for ($i = 1; $i <= $this->num_ap; $i ++) {
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_AP_COUNTRIES_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_AP_COST_' . $i;
|
||||
}
|
||||
|
||||
return $keys;
|
||||
}
|
||||
}
|
||||
|
209
msd2/myoos/includes/modules/shipping/apinsured.php
Normal file
209
msd2/myoos/includes/modules/shipping/apinsured.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: apinsured.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: ap.php,v 1.05 2003/02/18 03:37:00 harley_vb
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2002 - 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Plänkers
|
||||
http://www.themedia.at & http://www.oscommerce.at
|
||||
|
||||
All rights reserved.
|
||||
|
||||
This program is free software licensed under the GNU General Public License (GPL).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class apinsured {
|
||||
var $code, $title, $description, $icon, $num_ap_insured, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'apinsured';
|
||||
$this->title = $aLang['module_shipping_ap_insured_text_title'];
|
||||
$this->description = $aLang['module_shipping_ap_insured_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_AP_INSURED_SORT_ORDER') ? MODULE_SHIPPING_AP_INSURED_SORT_ORDER : null);
|
||||
$this->icon = OOS_ICONS . 'shipping_ap.gif';
|
||||
$this->tax_class = (defined('MODULE_SHIPPING_AP_INSURED_TAX_CLASS') ? MODULE_SHIPPING_AP_INSURED_TAX_CLASS : null);
|
||||
$this->enabled = (defined('MODULE_SHIPPING_AP_INSURED_STATUS') && (MODULE_SHIPPING_AP_INSURED_STATUS == 'True') ? true : false);
|
||||
|
||||
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_AP_INSURED_ZONE > 0) ) {
|
||||
$check_flag = FALSE;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
|
||||
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_AP_INSURED_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
|
||||
while ($check = $check_result->fields) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$check_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$check_result->Close();
|
||||
|
||||
if ($check_flag == FALSE) {
|
||||
$this->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
|
||||
$this->num_ap_insured = 8;
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
|
||||
|
||||
$dest_country = $oOrder->delivery['country']['iso_code_2'];
|
||||
$dest_zone = 0;
|
||||
$error = FALSE;
|
||||
|
||||
for ($i=1; $i<=$this->num_ap_insured; $i++) {
|
||||
$countries_table = constant('MODULE_SHIPPING_AP_INSURED_COUNTRIES_' . $i);
|
||||
$country_zones = preg_split("/[,]/", $countries_table);
|
||||
if (in_array($dest_country, $country_zones)) {
|
||||
$dest_zone = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($dest_zone == 0) {
|
||||
$error = TRUE;
|
||||
} else {
|
||||
$shipping = -1;
|
||||
$ap_insured_cost = constant('MODULE_SHIPPING_AP_INSURED_COST_' . $i);
|
||||
|
||||
$ap_insured_table = preg_split("/[:,]/" , $ap_insured_cost);
|
||||
for ($i=0; $i<count($ap_insured_table); $i+=2) {
|
||||
if ($shipping_weight <= $ap_insured_table[$i]) {
|
||||
$shipping = $ap_insured_table[$i+1];
|
||||
$shipping_method = $aLang['module_shipping_ap_insured_text_way'] . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . $aLang['module_shipping_ap_insured_text_units'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($shipping == -1) {
|
||||
$shipping_cost = 0;
|
||||
$shipping_method = $aLang['module_shipping_ap_insured_undefined_rate'];
|
||||
} else {
|
||||
$shipping_cost = ($shipping + MODULE_SHIPPING_AP_INSURED_HANDLING);
|
||||
}
|
||||
}
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' => $aLang['module_shipping_ap_insured_text_title'],
|
||||
'methods' => array(array('id' => $this->code,
|
||||
'title' => $shipping_method . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_ap_insured_text_units'] .')',
|
||||
'cost' => $shipping_cost * $shipping_num_boxes)));
|
||||
|
||||
if ($this->tax_class > 0) {
|
||||
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
|
||||
}
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_ap_insured_invalid_zone'];
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_AP_INSURED_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
function install() {
|
||||
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_HANDLING', '0', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_SORT_ORDER', '0', '6', '0', now())");
|
||||
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_1', 'DE,IT,SM', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_1', '1:12.35,2:13.80,3:15.25,4:16.70,5:18.15,6:19.60,7:21.05,8:22.50,9:23.95,10:25.40,11:26.85,12:28.30,13:29.75,14:31.20,15:32.65,16:34.10,17:35.55,18:37.00,19:38.45,20:39.90', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_2', 'AD,BE,DK,FO,GL,FI,FR,GR,GB,IE,LI,LU,MC,NL,PT,SE,CH,SK,SI,ES,CZ,HU,VA', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_2', '1:13.08,2:15.26,3:17.44,4:19.62,5:21.80,6:23.98,7:26.16,8:28.34,9:30.52,10:32.70,11:34.88,12:37.06,13:39.24,14:41.42,15:43.60,16:45.78,17:47.96,18:50.14,19:52.32,20:54.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_3', 'EG,AL,DZ,AM,AZ,BA,BG,EE,GE,GI,IS,IL,YU,HR,LV,LB,LY,LT,MT,MA,MK,MD,NO,PL,RO,RU,SY,TN,TR,UA,CY', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_3', '1:14.53,2:18.16,3:21.79,4:25.42,5:29.05,6:32.68,7:36.31,8:39.94,9:43.57,10:47.20,11:50.83,12:54.46,13:58.09,14:61.72,15:65.35,16:68.98,17:72.61,18:76.24,19:79.87,20:83.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_4', 'ET,BH,BJ,BF,CI,DJ,ER,GM,GH,GU,GN,GW,IQ,IR,YE,JO,CM,CA,CV,KZ,QA,KG,KW,LR,ML,MH,MR,FM,NE,NG,MP,OM,PR,SA,SN,SL,SO,SD,TJ,TG,TD,TM,UZ,AE,US,UM,CF', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_4', '1:17.44,2:23.98,3:30.52,4:37.06,5:43.60,6:50.14,7:56.68,8:63.22,9:69.76,10:76.30,11:82.84,12:89.38,13:95.92,14:102.46,15:109.00,16:115.54,17:122.08,18:128.62,19:135.16,20:141.70', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_5', 'AF,AO,AI,AG,GQ,AR,BS,BD,BB,BZ,BM,BT,BO,BW,BR,BN,BI,KY,CL,CN,CR,DM,DO,EC,SV,FK,GF,GA,GD,GP,GT,GY,HT,HN,HK,IN,ID,TP,JM,JP,KH,KE,CO,KM,CG,KP,KR,CU,LA,LS', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_5', '1:19.62,2:28.34,3:37.06,4:45.78,5:54.50,6:63.22,7:71.94,8:80.66,9:89.38,10:98.10,11:106.82,12:115.54,13:124.26,14:132.98,15:141.70,16:150.42,17:159.14,18:167.86,19:176.58,20:185.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_6', 'MO,MG,MW,MY,MV,MQ,MU,MX,MN,MS,MZ,MM,NA,NP,NI,AN,AW,PK,PA,PY,PE,PH,RE,RW,ZM,ST,SC,ZW,SG,LK,KN,LC,PM,VC,ZA,SR,SZ,TZ,TH,TT,TC,UG,UY,VE,VN,VG', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_6', '1:19.62,2:28.34,3:37.06,4:45.78,5:54.50,6:63.22,7:71.94,8:80.66,9:89.38,10:98.10,11:106.82,12:115.54,13:124.26,14:132.98,15:141.70,16:150.42,17:159.14,18:167.86,19:176.58,20:185.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_7', 'AU,CK,FJ,PF,KI,NR,NC,NZ,PG,PN,SB,TO,TV,VU,WF,WS', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_7', '1:23.98,2:37.06,3:50.14,4:63.22,5:76.30,6:89.38,7:102.46,8:115.54,9:128.62,10:141.70,11:154.78,12:167.86,13:180.94,14:194.02,15:207.10,16:220.18,17:233.26,18:246.34,19:259.42,20:272.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_8', 'AT', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_8', '2:3.56,4:4.36,8:5.45,12:6.90,20:9.08,31.5:12.72', '6', '0', now())");
|
||||
}
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
function keys() {
|
||||
$keys = array('MODULE_SHIPPING_AP_INSURED_STATUS', 'MODULE_SHIPPING_AP_INSURED_HANDLING', 'MODULE_SHIPPING_AP_INSURED_TAX_CLASS', 'MODULE_SHIPPING_AP_INSURED_ZONE', 'MODULE_SHIPPING_AP_INSURED_SORT_ORDER');
|
||||
|
||||
for ($i = 1; $i <= $this->num_ap_insured; $i ++) {
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_AP_INSURED_COUNTRIES_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_AP_INSURED_COST_' . $i;
|
||||
}
|
||||
|
||||
return $keys;
|
||||
}
|
||||
}
|
||||
|
303
msd2/myoos/includes/modules/shipping/chp.php
Normal file
303
msd2/myoos/includes/modules/shipping/chp.php
Normal file
@ -0,0 +1,303 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: chp.php,v 1.2 2007/08/11 05:59:52 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: chp.php,v 1.02 2003/02/18 03:37:00 harley_vb
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2002 - 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Plänkers
|
||||
http://www.themedia.at & http://www.oscommerce.at
|
||||
|
||||
All rights reserved.
|
||||
|
||||
This program is free software licensed under the GNU General Public License (GPL).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class chp {
|
||||
var $code, $title, $description, $icon, $num_chp, $types, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'chp';
|
||||
$this->title = $aLang['module_shipping_chp_text_title'];
|
||||
$this->description = $aLang['module_shipping_chp_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_CHP_SORT_ORDER') ? MODULE_SHIPPING_CHP_SORT_ORDER : null);
|
||||
$this->icon = OOS_ICONS . 'shipping_chp.gif';
|
||||
$this->tax_class = (defined('MODULE_SHIPPING_CHP_TAX_CLASS') ? MODULE_SHIPPING_CHP_TAX_CLASS : null);
|
||||
$this->enabled = (defined('MODULE_SHIPPING_CHP_STATUS') && (MODULE_SHIPPING_CHP_STATUS == 'True') ? true : false);
|
||||
|
||||
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_CHP_ZONE > 0) ) {
|
||||
$check_flag = FALSE;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
|
||||
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_CHP_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
|
||||
while ($check = $check_result->fields) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$check_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$check_result->Close();
|
||||
|
||||
if ($check_flag == FALSE) {
|
||||
$this->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
$this->types = array('ECO' => 'Economy',
|
||||
'PRI' => 'Priority',
|
||||
'URG' => 'Urgent');
|
||||
|
||||
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
|
||||
$this->num_chp = 7;
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
|
||||
|
||||
$dest_country = $oOrder->delivery['country']['iso_code_2'];
|
||||
$dest_zone = 0;
|
||||
$error = FALSE;
|
||||
|
||||
for ($j=1; $j<=$this->num_chp; $j++) {
|
||||
$countries_table = constant('MODULE_SHIPPING_CHP_COUNTRIES_' . $j);
|
||||
$country_zones = preg_split("/[,]/", $countries_table);
|
||||
if (in_array($dest_country, $country_zones)) {
|
||||
$dest_zone = $j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($dest_zone == 0) {
|
||||
$error = TRUE;
|
||||
} else {
|
||||
$shipping = -1;
|
||||
$chp_cost_eco = @constant('MODULE_SHIPPING_CHP_COST_ECO_' . $j);
|
||||
$chp_cost_pri = @constant('MODULE_SHIPPING_CHP_COST_PRI_' . $j);
|
||||
$chp_cost_urg = @constant('MODULE_SHIPPING_CHP_COST_URG_' . $j);
|
||||
|
||||
$methods = array();
|
||||
|
||||
if ($chp_cost_eco != '') {
|
||||
$chp_table_eco = preg_split("/[:,]/" , $chp_cost_eco);
|
||||
|
||||
for ($i=0; $i<count($chp_table_eco); $i+=2) {
|
||||
if ($shipping_weight <= $chp_table_eco[$i]) {
|
||||
$shipping_eco = $chp_table_eco[$i+1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($shipping_eco == -1) {
|
||||
$shipping_cost = 0;
|
||||
$shipping_method = $aLang['module_shipping_chp_undefined_rate'];
|
||||
} else {
|
||||
$shipping_cost_1 = ($shipping_eco + MODULE_SHIPPING_CHP_HANDLING);
|
||||
}
|
||||
|
||||
if ($shipping_eco != 0) {
|
||||
$methods[] = array('id' => 'ECO',
|
||||
'title' => 'Economy',
|
||||
'cost' => (MODULE_SHIPPING_CHP_HANDLING + $shipping_cost_1) * $shipping_num_boxes);
|
||||
}
|
||||
}
|
||||
|
||||
if ($chp_cost_pri != '') {
|
||||
$chp_table_pri = preg_split("/[:,]/" , $chp_cost_pri);
|
||||
|
||||
for ($i=0; $i<count($chp_table_pri); $i+=2) {
|
||||
if ($shipping_weight <= $chp_table_pri[$i]) {
|
||||
$shipping_pri = $chp_table_pri[$i+1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($shipping_pri == -1) {
|
||||
$shipping_cost = 0;
|
||||
$shipping_method = $aLang['module_shipping_chp_undefined_rate'];
|
||||
} else {
|
||||
$shipping_cost_2 = ($shipping_pri + MODULE_SHIPPING_CHP_HANDLING);
|
||||
}
|
||||
|
||||
if ($shipping_pri != 0) {
|
||||
$methods[] = array('id' => 'PRI',
|
||||
'title' => 'Priority',
|
||||
'cost' => (MODULE_SHIPPING_CHP_HANDLING + $shipping_cost_2) * $shipping_num_boxes);
|
||||
}
|
||||
}
|
||||
|
||||
if ($chp_cost_urg != '') {
|
||||
$chp_table_urg = preg_split("/[:,]/" , $chp_cost_urg);
|
||||
|
||||
for ($i=0; $i<count($chp_table_urg); $i+=2) {
|
||||
if ($shipping_weight <= $chp_table_urg[$i]) {
|
||||
$shipping_urg = $chp_table_urg[$i+1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($shipping_urg == -1) {
|
||||
$shipping_cost = 0;
|
||||
$shipping_method = $aLang['module_shipping_chp_undefined_rate'];
|
||||
} else {
|
||||
$shipping_cost_3 = ($shipping_urg + MODULE_SHIPPING_CHP_HANDLING);
|
||||
}
|
||||
|
||||
if ($shipping_urg != 0) {
|
||||
$methods[] = array('id' => 'URG',
|
||||
'title' => 'Urgent',
|
||||
'cost' => (MODULE_SHIPPING_CHP_HANDLING + $shipping_cost_3) * $shipping_num_boxes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_chp_text_units'] .')');
|
||||
$this->quotes['methods'] = $methods;
|
||||
|
||||
if ($this->tax_class > 0) {
|
||||
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
|
||||
}
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_chp_invalid_zone'];
|
||||
|
||||
if ( (oos_is_not_null($method)) && (isset($this->types[$method])) ) {
|
||||
|
||||
for ($i=0; $i<count($methods); $i++) {
|
||||
if ($method == $methods[$i]['id']) {
|
||||
$methodsc = array();
|
||||
$methodsc[] = array('id' => $methods[$i]['id'],
|
||||
'title' => $methods[$i]['title'],
|
||||
'cost' => $methods[$i]['cost']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->quotes['methods'] = $methodsc;
|
||||
}
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_CHP_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_CHP_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_HANDLING', '0', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_CHP_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_CHP_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_SORT_ORDER', '0', '6', '0', now())");
|
||||
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_1', 'CH,LI', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_1', '2:6.00,5:8.00,10:11.00,20:16.00,30:23.00', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_1', '2:8.00,5:10.00,10:13.00,20:19.00,30:26.00', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_2', 'AD,AT,BE,FR,DE,VA,IT,LU,MC,NL', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_2', '2:29,3:32,4:35,5:38,6:39,7:40,8:41,9:42,10:43,11:44,12:45,13:46,14:47,15:48,16:49,17:50,18:51,19:52,20:53,21:54,22:55,23:56,24:57,25:58,26:59,27:60,28:61,29:62,30:63', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_2', '2:33,3:37,4:41,5:46,6:49,7:51,8:53,9:55,10:57,11:60,12:61,13:62,14:63,15:64,16:65,17:66,18:67,19:68,20:69,21:70,22:71,23:72,24:73,25:74,26:75,27:76,28:77,29:78,30:79', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_2', '0.5:51,1:57,1.5:62,2:67,2.5:72,3:78,3.5:83,4:89,4.5:95,5:100,6:107,7:115,8:123,9:130,10:138,11:144,12:151,13:158,14:164,15:171,16:177,17:184,18:191,19:197,20:204,21:210,22:217,23:224,24:230,25:237,26:243,27:250,28:256,29:263,30:269', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_3', 'AL,BA,BG,HR,CZ,DK,EE,FI,GI,GR,HU,IS,IE,LV,LT,MK,MT,MH,NO,PL,PT,RO,SK,SI,ES,SE,GB,YU', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_3', '2:34,3:38,4:42,5:46,6:49,7:52,8:55,9:58,10:61,11:63,12:65,13:67,14:69,15:71,16:72,17:73,18:74,19:75,20:76,21:77,22:78,23:79,24:80,25:81,26:82,27:83,28:84,29:85,30:86', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_3', '2:38,3:43,4:48,5:53,6:58,7:62,8:66,9:68,10:71,11:75,12:78,13:81,14:84,15:87,16:90,17:91,18:92,19:93,20:94,21:95,22:96,23:97,24:98,25:99,26:100,27:101,28:102,29:103,30:104', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_3', '0.5:57,1:63,1.5:68,2:73,2.5:78,3:84,3.5:90,4:95,4.5:100,5:106,6:114,7:124,8:132,9:141,10:149,11:158,12:165,13:172,14:180,15:187,16:196,17:203,18:210,19:218,20:226,21:234,22:241,23:248,24:256,25:264,26:272,27:279,28:286,29:295,30:302', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_4', 'DZ,BY,CA,CY,EG,IL,JO,LB,LY,MD,MA,RU,PM,SY,TN,TR,UA,US', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_4', '2:38,3:44,4:50,5:56,6:62,7:68,8:74,9:80,10:86,11:92,12:98,13:104,14:110,15:116,16:121,17:126,18:131,19:136,20:141,21:145,22:149,23:153,24:157,25:161,26:165,27:169,28:173,29:177,30:181', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_4', '2:46,3:55,4:66,5:77,6:86,7:95,8:104,9:113,10:122,11:130,12:138,13:146,14:154,15:162,16:170,17:178,18:186,19:194,20:202,21:209,22:216,23:223,24:230,25:237,26:244,27:251,28:258,29:265,30:272', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_4', '0.5:65,1:72,1.5:79,2:87,2.5:94,3:101,3.5:108,4:115,4.5:123,5:130,6:141,7:152,8:164,9:175,10:186,11:198,12:209,13:220,14:232,15:243,16:254,17:266,18:277,19:288,20:300,21:309,22:318,23:328,24:337,25:346,26:355,27:365,28:374,29:383,30:392', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_5', 'AF,AO,AI,AG,AM,AZ,BS,BH,BD,BB,BZ,BJ,BM,BT,BW,BF,BI,KY,KH,CM,CV,CF,TD,CN,KM,CG,CR,CI,CU,DJ,DM,DO,SV,GQ,ER,ET,GA,GM,GE,GH,GD,GP,GT,GN,GW,HT,HN,HK,IN,IR,IQ,JM,JP,YE,KZ,KE,KP,KR,KW,KG,LA,LS', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_5', '2:43,3:50,4:57,5:64,6:71,7:78,8:85,9:92,10:99,11:104,12:109,13:114,14:119,15:124,16:129,17:134,18:139,19:144,20:149,21:153,22:157,23:161,24:165,25:169,26:173,27:177,28:181,29:185,30:189', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_5', '2:53,3:67,4:80,5:94,6:107,7:120,8:133,9:146,10:159,11:167,12:177,13:187,14:197,15:207,16:215,17:223,18:231,19:239,20:247,21:255,22:263,23:271,24:279,25:287,26:295,27:303,28:311,29:319,30:327', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_5', '0.5:83,1:96,1.5:108,2:121,2.5:133,3:145,3.5:158,4:170,4.5:182,5:195,6:214,7:234,8:253,9:273,10:293,11:311,12:330,13:348,14:367,15:385,16:404,17:422,18:441,19:459,20:478,21:495,22:513,23:530,24:548,25:565,26:583,27:600,28:618,29:636,30:653', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_6', 'LR,MO,MG,MW,MY,MV,ML,MQ,MR,MU,YT,MX,MN,MS,MZ,MM,NA,NP,NI,NE,NG,OM,PK,PA,QA,RE,RW,KN,LC,VC,SH,ZM,SM,ST,SA,SN,SC,SL,SG,SO,ZA,LK,SD,SZ,TW,TJ,TZ,TH,TG,TM,TC,UG,AE,UZ,VN,VG,VI,ZW', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_6', '2:43,3:50,4:57,5:64,6:71,7:78,8:85,9:92,10:99,11:104,12:109,13:114,14:119,15:124,16:129,17:134,18:139,19:144,20:149,21:153,22:157,23:161,24:165,25:169,26:173,27:177,28:181,29:185,30:189', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_6', '2:53,3:67,4:80,5:94,6:107,7:120,8:133,9:146,10:159,11:167,12:177,13:187,14:197,15:207,16:215,17:223,18:231,19:239,20:247,21:255,22:263,23:271,24:279,25:287,26:295,27:303,28:311,29:319,30:327', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_6', '0.5:83,1:96,1.5:108,2:121,2.5:133,3:145,3.5:158,4:170,4.5:182,5:195,6:214,7:234,8:253,9:273,10:293,11:311,12:330,13:348,14:367,15:385,16:404,17:422,18:441,19:459,20:478,21:495,22:513,23:530,24:548,25:565,26:583,27:600,28:618,29:636,30:653', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_7', 'AR,AW,AU,BO,BR,BN,CL,CO,CK,EC,FK,FJ,GF,PF,GY,ID,KI,NR,AN,NC,NZ,NF,PG,PY,PE,PH,PN,WS,SB,SR,TP,TO,TT,TV,UY,VU,VE,WF', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_7', '2:47,3:55,4:63,5:71,6:79,7:87,8:95,9:103,10:111,11:118,12:125,13:132,14:139,15:146,16:152,17:160,18:166,19:172,20:178,21:184,22:190,23:196,24:202,25:206,26:211,27:216,28:221,29:226,30:231', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_7', '2:65,3:83,4:101,5:119,6:136,7:153,8:170,9:187,10:204,11:219,12:234,13:249,14:264,15:279,16:294,17:309,18:324,19:339,20:354,21:367,22:380,23:393,24:406,25:419,26:432,27:445,28:458,29:471,30:484', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_7', '0.5:92,1:106,1.5:121,2:135,2.5:149,3:164,3.5:178,4:193,4.5:207,5:221,6:241,7:261,8:280,9:300,10:319,11:338,12:356,13:375,14:393,15:412,16:431,17:449,18:468,19:486,20:505,21:522,22:540,23:557,24:575,25:592,26:610,27:627,28:645,29:662,30:680', '6', '0', now())");
|
||||
}
|
||||
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
|
||||
function keys() {
|
||||
$keys = array('MODULE_SHIPPING_CHP_STATUS', 'MODULE_SHIPPING_CHP_HANDLING', 'MODULE_SHIPPING_CHP_TAX_CLASS', 'MODULE_SHIPPING_CHP_ZONE', 'MODULE_SHIPPING_CHP_SORT_ORDER');
|
||||
|
||||
for ($i=1; $i <= $this->num_chp; $i++) {
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_CHP_COUNTRIES_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_CHP_COST_ECO_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_CHP_COST_PRI_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_CHP_COST_URG_' . $i;
|
||||
}
|
||||
|
||||
return $keys;
|
||||
}
|
||||
}
|
||||
|
188
msd2/myoos/includes/modules/shipping/dp.php
Normal file
188
msd2/myoos/includes/modules/shipping/dp.php
Normal file
@ -0,0 +1,188 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: dp.php,v 1.3 2008/06/04 14:41:38 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: dp.php,v 1.36 2003/03/09 02:14:35 harley_vb
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2002 - 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class dp {
|
||||
var $code, $title, $description, $icon, $num_dp, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'dp';
|
||||
$this->title = $aLang['module_shipping_dp_text_title'];
|
||||
$this->description = $aLang['module_shipping_dp_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_DP_SORT_ORDER') ? MODULE_SHIPPING_DP_SORT_ORDER : null);
|
||||
$this->icon = OOS_ICONS . 'shipping_dp.gif';
|
||||
$this->tax_class = (defined('MODULE_SHIPPING_DP_TAX_CLASS') ? MODULE_SHIPPING_DP_TAX_CLASS : null);
|
||||
$this->enabled = (defined('MODULE_SHIPPING_DP_STATUS') && (MODULE_SHIPPING_DP_STATUS == 'True') ? true : false);
|
||||
|
||||
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_DP_ZONE > 0) ) {
|
||||
$check_flag = FALSE;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
|
||||
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_DP_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
|
||||
while ($check = $check_result->fields) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$check_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$check_result->Close();
|
||||
|
||||
if ($check_flag == FALSE) {
|
||||
$this->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
|
||||
$this->num_dp = 6;
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
|
||||
|
||||
$dest_country = $oOrder->delivery['country']['iso_code_2'];
|
||||
$dest_zone = 0;
|
||||
$error = FALSE;
|
||||
|
||||
for ($i=1; $i<=$this->num_dp; $i++) {
|
||||
$countries_table = constant('MODULE_SHIPPING_DP_COUNTRIES_' . $i);
|
||||
$country_zones = preg_split("/[,]/", $countries_table);
|
||||
if (in_array($dest_country, $country_zones)) {
|
||||
$dest_zone = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($dest_zone == 0) {
|
||||
$error = TRUE;
|
||||
} else {
|
||||
$shipping = -1;
|
||||
$dp_cost = constant('MODULE_SHIPPING_DP_COST_' . $i);
|
||||
|
||||
$dp_table = preg_split("/[:,]/" , $dp_cost);
|
||||
for ($i=0; $i<count($dp_table); $i+=2) {
|
||||
if ($shipping_weight <= $dp_table[$i]) {
|
||||
$shipping = $dp_table[$i+1];
|
||||
$shipping_method = $aLang['module_shipping_dp_text_way'] . ' ' . $dest_country . ': ';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($shipping == -1) {
|
||||
$shipping_cost = 0;
|
||||
$shipping_method = $aLang['module_shipping_dp_undefined_rate'];
|
||||
} else {
|
||||
$shipping_cost = ($shipping + MODULE_SHIPPING_DP_HANDLING);
|
||||
}
|
||||
}
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' => $aLang['module_shipping_dp_text_title'],
|
||||
'methods' => array(array('id' => $this->code,
|
||||
'title' => $shipping_method . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_dp_text_units'] .')',
|
||||
'cost' => $shipping_cost * $shipping_num_boxes)));
|
||||
|
||||
if ($this->tax_class > 0) {
|
||||
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
|
||||
}
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_dp_invalid_zone'];
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_DP_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_DP_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_HANDLING', '0', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_DP_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_DP_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_SORT_ORDER', '0', '6', '0', now())");
|
||||
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_1', 'AD,AT,BE,CZ,DK,FO,FI,FR,GR,GL,IE,IT,LI,LU,MC,NL,PL,PT,SM,SK,SE,CH,VA,GB,SP', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_1', '5:16.50,10:20.50,20:28.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_2', 'AL,AM,AZ,BY,BA,BG,HR,CY,GE,GI,HU,IS,KZ,LT,MK,MT,MD,NO,SI,UA,TR,YU,RU,RO,LV,EE', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_2', '5:25.00,10:35.00,20:45.00', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_3', 'DZ,BH,CA,EG,IR,IQ,IL,JO,KW,LB,LY,OM,SA,SY,US,AE,YE,MA,QA,TN,PM', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_3', '5:29.00,10:39.00,20:59.00', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_4', 'AF,AS,AO,AI,AG,AR,AW,AU,BS,BD,BB,BZ,BJ,BM,BT,BO,BW,BR,IO,BN,BF,BI,KH,CM,CV,KY,CF,TD,CL,CN,CC,CO,KM,CG,CR,CI,CU,DM,DO,EC,SV,ER,ET,FK,FJ,GF,PF,GA,GM,GH,GD,GP,GT,GN,GW,GY,HT,HN,HK,IN,ID,JM,JP,KE,KI,KG,KP,KR,LA,LS', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_4', '5:35.00,10:50.00,20:80.00', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_5', 'MO,MG,MW,MY,MV,ML,MQ,MR,MU,MX,MN,MS,MZ,MM,NA,NR,NP,AN,NC,NZ,NI,NE,NG,PK,PA,PG,PY,PE,PH,PN,RE,KN,LC,VC,SN,SC,SL,SO,LK,SR,SZ,ZA,SG,TG,TH,TZ,TT,TO,TM,TV,VN,WF,VE,UG,UZ,UY,ST,SH,SD,TW,GQ,LR,DJ,CG,RW,ZM,ZW', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_5', '5:35.00,10:50.00,20:80.00', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_6', 'DE', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_6', '5:6.70,10:9.70,20:13.00', '6', '0', now())");
|
||||
}
|
||||
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
|
||||
function keys() {
|
||||
$keys = array('MODULE_SHIPPING_DP_STATUS', 'MODULE_SHIPPING_DP_HANDLING', 'MODULE_SHIPPING_DP_TAX_CLASS', 'MODULE_SHIPPING_DP_ZONE', 'MODULE_SHIPPING_DP_SORT_ORDER');
|
||||
|
||||
for ($i = 1; $i <= $this->num_dp; $i ++) {
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_DP_COUNTRIES_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_DP_COST_' . $i;
|
||||
}
|
||||
|
||||
return $keys;
|
||||
}
|
||||
}
|
||||
|
308
msd2/myoos/includes/modules/shipping/fedexeu.php
Normal file
308
msd2/myoos/includes/modules/shipping/fedexeu.php
Normal file
@ -0,0 +1,308 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: fedexeu.php,v 1.2 2007/08/11 05:59:52 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: fedexeu.php,v 1.02 2003/02/18 03:37:00 harley_vb
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2002 - 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Pl<50>kers
|
||||
http://www.themedia.at & http://www.oscommerce.at
|
||||
|
||||
All rights reserved.
|
||||
|
||||
This program is free software licensed under the GNU General Public License (GPL).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class fedexeu {
|
||||
var $code, $title, $description, $icon, $num_fedexeu, $types, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'fedexeu';
|
||||
$this->title = $aLang['module_shipping_fedexeu_text_title'];
|
||||
$this->description = $aLang['module_shipping_fedexeu_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_FEDEXEU_SORT_ORDER') ? MODULE_SHIPPING_FEDEXEU_SORT_ORDER : null);
|
||||
$this->icon = OOS_ICONS . 'shipping_fedexeu.gif';
|
||||
$this->tax_class = (defined('MODULE_SHIPPING_FEDEXEU_TAX_CLASS') ? MODULE_SHIPPING_FEDEXEU_TAX_CLASS : null);
|
||||
$this->enabled = (defined('MODULE_SHIPPING_FEDEXEU_STATUS') && (MODULE_SHIPPING_FEDEXEU_STATUS == 'True') ? true : false);
|
||||
|
||||
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_FEDEXEU_ZONE > 0) ) {
|
||||
$check_flag = FALSE;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
|
||||
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_FEDEXEU_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
|
||||
while ($check = $check_result->fields) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$check_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$check_result->Close();
|
||||
|
||||
if ($check_flag == FALSE) {
|
||||
$this->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
$this->types = array('PAK' => 'FedEx Pak',
|
||||
'BOX' => 'FedEx Box');
|
||||
|
||||
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
|
||||
$this->num_fedexeu = 8;
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $oOrder, $aLang, $shipping_weight, $shipping_num_boxes;
|
||||
|
||||
$dest_country = $oOrder->delivery['country']['iso_code_2'];
|
||||
$dest_zone = 0;
|
||||
$error = FALSE;
|
||||
|
||||
for ($j=1; $j<=$this->num_fedexeu; $j++) {
|
||||
$countries_table = constant('MODULE_SHIPPING_FEDEXEU_COUNTRIES_' . $j);
|
||||
$country_zones = preg_split("/[,]/", $countries_table);
|
||||
if (in_array($dest_country, $country_zones)) {
|
||||
$dest_zone = $j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($dest_zone == 0) {
|
||||
$error = TRUE;
|
||||
} else {
|
||||
$shipping = -1;
|
||||
$fedexeu_cost_pak = @constant('MODULE_SHIPPING_FEDEXEU_COST_PAK_' . $j);
|
||||
$fedexeu_cost_box = @constant('MODULE_SHIPPING_FEDEXEU_COST_BOX_' . $j);
|
||||
|
||||
$methods = array();
|
||||
|
||||
if ($fedexeu_cost_pak != '') {
|
||||
$fedexeu_table_pak = preg_split("/[:,]/" , $fedexeu_cost_pak);
|
||||
|
||||
for ($i=0; $i<count($fedexeu_table_pak); $i+=2) {
|
||||
if ($shipping_weight <= $fedexeu_table_pak[$i]) {
|
||||
$shipping_pak = $fedexeu_table_pak[$i+1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($shipping_pak == -1) {
|
||||
$shipping_cost = 0;
|
||||
$shipping_method = $aLang['module_shipping_fedexeu_undefined_rate'];
|
||||
} else {
|
||||
$shipping_cost_1 = ($shipping_pak + MODULE_SHIPPING_FEDEXEU_HANDLING);
|
||||
}
|
||||
|
||||
if ($shipping_pak != 0) {
|
||||
$methods[] = array('id' => 'PAK',
|
||||
'title' => 'FedEx Pak',
|
||||
'cost' => (MODULE_SHIPPING_FEDEXEU_HANDLING + $shipping_cost_1) * $shipping_num_boxes);
|
||||
}
|
||||
}
|
||||
|
||||
if ($fedexeu_cost_box != '') {
|
||||
$fedexeu_table_box = preg_split("/[:,]/" , $fedexeu_cost_box);
|
||||
if ( ($shipping_weight > 10) and ($shipping_weight <= 20) ) {
|
||||
$shipping_box = number_format((($shipping_weight - 10)* 2 + 0.5), 0) * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' .$j) + $fedexeu_table_box[count ($fedexeu_table_box)-1];
|
||||
} elseif ( ($shipping_weight > 20) and ($shipping_weight <= 40) ) {
|
||||
$shipping_box = number_format((($shipping_weight - 20)* 2 + 0.5), 0) * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_' .$j) + 20 * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' .$j) + $fedexeu_table_box[count ($fedexeu_table_box)-1];
|
||||
} elseif ( ($shipping_weight > 40) and ($shipping_weight <= 70) ) {
|
||||
$shipping_box = number_format((($shipping_weight - 40)* 2 + 0.5), 0) * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_' .$j) + 20 * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' .$j) + 40 * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_' .$j) + $fedexeu_table_box[count ($fedexeu_table_box)-1];
|
||||
} else {
|
||||
|
||||
for ($i=0; $i<count($fedexeu_table_box); $i+=2) {
|
||||
if ($shipping_weight <= $fedexeu_table_box[$i]) {
|
||||
$shipping_box = $fedexeu_table_box[$i+1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($shipping_box == -1) {
|
||||
$shipping_cost = 0;
|
||||
$shipping_method = $aLang['module_shipping_fedexeu_undefined_rate'];
|
||||
} else {
|
||||
$shipping_cost_2 = ($shipping_box + MODULE_SHIPPING_FEDEXEU_HANDLING);
|
||||
}
|
||||
|
||||
if ($shipping_box != 0) {
|
||||
$methods[] = array('id' => 'BOX',
|
||||
'title' => 'FedEx Box',
|
||||
'cost' => (MODULE_SHIPPING_FEDEXEU_HANDLING + $shipping_cost_2) * $shipping_num_boxes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_fedexeu_text_units'] .')');
|
||||
|
||||
$this->quotes['methods'] = $methods;
|
||||
|
||||
if ($this->tax_class > 0) {
|
||||
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
|
||||
}
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_fedexeu_invalid_zone'];
|
||||
|
||||
if ( (oos_is_not_null($method)) && (isset($this->types[$method])) ) {
|
||||
|
||||
for ($i=0; $i<count($methods); $i++) {
|
||||
if ($method == $methods[$i]['id']) {
|
||||
$methodsc = array();
|
||||
$methodsc[] = array('id' => $methods[$i]['id'],
|
||||
'title' => $methods[$i]['title'],
|
||||
'cost' => $methods[$i]['cost']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->quotes['methods'] = $methodsc;
|
||||
}
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_FEDEXEU_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_HANDLING', '0', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SORT_ORDER', '0', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_1', 'AT,AD,BE,DK,DE,FI,FO,FR,GR,GL,GB,IE,IT,LU,MC,NL,PT,SE,SM,ES,VA', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_1', '0.5:41.40,1:48.20,1.5:51.30,2:54.40,2.5:57.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_1', '0.5:41.40,1:48.20,1.5:51.30,2:54.40,2.5:57.50,3:60.30,3.5:63.00,4:65.70,4.5:68.50,5:71.20,5.5:75.20,6:77.80,6.5:80.30,7:82.90,7.5:85.50,8:88.10,8.5:90.60,9:93.20,9.5:95.80,10:98.40', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_1', '1.70', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_1', '1.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_1', '1.10', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_2', 'GI,IS,LI,NO,CH', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_2', '0.5:51.90,1:58.20,1.5:64.40,2:70.70,2.5:77.00', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_2', '0.5:71.50,1:77.80,1.5:84.20,2:90.40,2.5:96.70,3:103.10,3.5:108.50,4:113.90,4.5:119.40,5:124.80,5.5:129.50,6:134.30,6.5:139.10,7:143.80,7.5:148.50,8:153.30,8.5:158.00,9:162.80,9.5:167.60,10:172.40', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_2', '1.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_2', '1.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_2', '1.60', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_3', 'AL,BA,BG,EE,HR,LV,LT,MK,MD,PL,RO,RU,SK,SI,CZ,TR,UA,HU,YU,BY', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_3', '0.5:51.10,1:57.60,1.5:64.20,2:70.70,2.5:77.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_3', '0.5:70.70,1:79.80,1.5:86.20,2:92.70,2.5:99.10,3:104.50,3.5:109.90,4:115.20,4.5:120.60,5:126.00,5.5:130.70,6:135.30,6.5:140.00,7:144.60,7.5:149.20,8:153.90,8.5:158.50,9:163.20,9.5:167.90,10:172.40', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_3', '2.10', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_3', '1.40', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_3', '1.70', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_4', 'CA,MX,PR,US', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_4', '0.5:50.30,1:58.30,1.5:66.10,2:74.10,2.5:81.90', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_4', '0.5:70.90,1:78.10,1.5:86.00,2:93.80,2.5:101.70,3:109.50,3.5:117.30,4:125.20,4.5:133.10,5:141.00,5.5:148.80,6:156.70,6.5:164.50,7:172.40,7.5:180.20,8:187.10,8.5:194.90,9:202.80,9.5:210.60,10:218.40', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_4', '4.10', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_4', '3.90', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_4', '3.80', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_5', 'AU,CN,HK,ID,JP,KR,MO,MY,NZ,PH,SG,TW,TH,VN', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_5', '0.5:55.80,1:74.60,1.5:93.20,2:111.90,2.5:130.40', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_5', '0.5:72.90,1:91.50,1.5:110.10,2:128.80,2.5:147.40,3:164.60,3.5:181.70,4:198.80,4.5:216.00,5:233.10,5.5:242.40,6:251.80,6.5:261.10,7:270.40,7.5:279.80,8:289.10,8.5:298.40,9:307.60,9.5:317.00,10:326.40', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_5', '4.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_5', '4.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_5', '3.70', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_6', 'BH,BD,BT,BN,KH,CY,EG,IN,IL,YE,JO,QA,KW,LA,LB,MT,MM,NP,OM,PK,SA,LK,SY,AE', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_6', '0.5:59.60,1:79.00,1.5:96.70,2:114.40,2.5:132.20', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_6', '0.5:81.20,1:100.50,1.5:118.30,2:136.10,2.5:153.90,3:171.70,3.5:189.50,4:207.30,4.5:225.10,5:242.70,5.5:251.70,6:260.70,6.5:269.70,7:278.50,7.5:287.40,8:296.30,8.5:305.10,9:314.10,9.5:322.90,10:331.90', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_6', '4.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_6', '4.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_6', '3.80', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_7', 'AI,AG,AR,AW,BS,BB,BZ,BM,BO,BR,KY,CL,CR,CO,DM,DO,EC,SV,GF,GD,GP,GT,GY,HT,HN,JM,VG,VI,MQ,MS,NI,AN,PA,PY,PE,KN,LC,VC,ZA,SR,TT,TC,UY,VE', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_7', '0.5:67.00,1:85.60,1.5:104.30,2:122.90,2.5:114.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_7', '0.5:84.20,1:102.80,1.5:121.40,2:140.00,2.5:158.70,3:175.70,3.5:192.90,4:210.10,4.5:227.20,5:244.30,5.5:254.40,6:264.50,6.5:274.50,7:284.60,7.5:294.60,8:304.60,8.5:314.70,9:324.80,9.5:334.90,10:344.90', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_7', '4.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_7', '4.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_7', '4.30', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_8', 'DZ,AS,AO,AM,AZ,BJ,BW,BF,BI,CM,CV,TD,CK,CG,DJ,GQ,ET,ER,FJ,FM,PF,GA,GM,GN,GW,GE,GH,GU,KZ,KE,KG,LS,LR,MG,MW,MV,ML,MA,MR,MU,MN,MZ,NA,NC,NE,NG,PW,PG,RE,RW,ZM,ZW,SN,SC,SL,SD,SZ,TZ,TG,TN,TM,UG,UZ,VU,WF', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_8', '0.5:68.50,1:86.90,1.5:105.50,2:124.00,2.5:142.40', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_8', '0.5:88.60,1:107.10,1.5:125.60,2:144.10,2.5:162.40,3:179.50,3.5:196.50,4:213.40,4.5:230.50,5:247.40,5.5:257.30,6:267.30,6.5:277.30,7:287.20,7.5:297.20,8:307.20,8.5:317.20,9:327.20,9.5:337.20,10:347.20', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_8', '5.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_8', '4.70', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_8', '4.70', '6', '0', now())");
|
||||
}
|
||||
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
|
||||
function keys() {
|
||||
$keys = array('MODULE_SHIPPING_FEDEXEU_STATUS', 'MODULE_SHIPPING_FEDEXEU_HANDLING', 'MODULE_SHIPPING_FEDEXEU_TAX_CLASS', 'MODULE_SHIPPING_FEDEXEU_ZONE', 'MODULE_SHIPPING_FEDEXEU_SORT_ORDER');
|
||||
|
||||
for ($i = 1; $i <= $this->num_fedexeu; $i ++) {
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_COUNTRIES_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_COST_PAK_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_COST_BOX_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_' . $i;
|
||||
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_' . $i;
|
||||
}
|
||||
|
||||
return $keys;
|
||||
}
|
||||
}
|
||||
|
124
msd2/myoos/includes/modules/shipping/flat.php
Normal file
124
msd2/myoos/includes/modules/shipping/flat.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: flat.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: flat.php,v 1.40 2003/02/05 22:41:52 hpdl
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class flat {
|
||||
var $code, $title, $description, $icon, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'flat';
|
||||
$this->title = $aLang['module_shipping_flat_text_title'];
|
||||
$this->description = $aLang['module_shipping_flat_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_FLAT_SORT_ORDER') ? MODULE_SHIPPING_FLAT_SORT_ORDER : null);
|
||||
$this->icon = '';
|
||||
$this->tax_class = (defined('MODULE_SHIPPING_FLAT_TAX_CLASS') ? MODULE_SHIPPING_FLAT_TAX_CLASS : null);
|
||||
$this->enabled = (defined('MODULE_SHIPPING_FLAT_STATUS') && (MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
|
||||
|
||||
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
|
||||
$check_flag = FALSE;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
|
||||
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
|
||||
while ($check = $check_result->fields) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$check_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$check_result->Close();
|
||||
|
||||
if ($check_flag == FALSE) {
|
||||
$this->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $aLang, $oOrder;
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' => $aLang['module_shipping_flat_text_title'],
|
||||
'methods' => array(array('id' => $this->code,
|
||||
'title' => $aLang['module_shipping_flat_text_way'],
|
||||
'cost' => MODULE_SHIPPING_FLAT_COST)));
|
||||
|
||||
if ($this->tax_class > 0) {
|
||||
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
|
||||
}
|
||||
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_FLAT_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
function install() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_FLAT_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FLAT_COST', '5.00', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_FLAT_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_FLAT_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FLAT_SORT_ORDER', '0', '6', '0', now())");
|
||||
}
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
function keys() {
|
||||
return array('MODULE_SHIPPING_FLAT_STATUS', 'MODULE_SHIPPING_FLAT_COST', 'MODULE_SHIPPING_FLAT_TAX_CLASS', 'MODULE_SHIPPING_FLAT_ZONE', 'MODULE_SHIPPING_FLAT_SORT_ORDER');
|
||||
}
|
||||
}
|
||||
|
128
msd2/myoos/includes/modules/shipping/item.php
Normal file
128
msd2/myoos/includes/modules/shipping/item.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: item.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: item.php,v 1.39 2003/02/05 22:41:52 hpdl
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class item {
|
||||
var $code, $title, $description, $icon, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'item';
|
||||
$this->title = $aLang['module_shipping_item_text_title'];
|
||||
$this->description = $aLang['module_shipping_item_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_ITEM_SORT_ORDER') ? MODULE_SHIPPING_ITEM_SORT_ORDER : null);
|
||||
$this->icon = '';
|
||||
$this->tax_class = (defined('MODULE_SHIPPING_ITEM_TAX_CLASS') ? MODULE_SHIPPING_ITEM_TAX_CLASS : null);
|
||||
$this->enabled = (defined('MODULE_SHIPPING_ITEM_STATUS') && (MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
|
||||
|
||||
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_ITEM_ZONE > 0) ) {
|
||||
$check_flag = FALSE;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
|
||||
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_ITEM_ZONE . "' and zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
|
||||
while ($check = $check_result->fields) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$check_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$check_result->Close();
|
||||
|
||||
if ($check_flag == FALSE) {
|
||||
$this->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $oOrder, $aLang, $total_count;
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' => $aLang['module_shipping_item_text_title'],
|
||||
'methods' => array(array('id' => $this->code,
|
||||
'title' => $aLang['module_shipping_item_text_way'],
|
||||
'cost' => (MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
|
||||
|
||||
if ($this->tax_class > 0) {
|
||||
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
|
||||
}
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_ITEM_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_ITEM_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ITEM_COST', '2.50', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ITEM_HANDLING', '0', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_ITEM_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_ITEM_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ITEM_SORT_ORDER', '0', '6', '0', now())");
|
||||
}
|
||||
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
|
||||
function keys() {
|
||||
return array('MODULE_SHIPPING_ITEM_STATUS', 'MODULE_SHIPPING_ITEM_COST', 'MODULE_SHIPPING_ITEM_HANDLING', 'MODULE_SHIPPING_ITEM_TAX_CLASS', 'MODULE_SHIPPING_ITEM_ZONE', 'MODULE_SHIPPING_ITEM_SORT_ORDER');
|
||||
}
|
||||
}
|
||||
|
122
msd2/myoos/includes/modules/shipping/selfpickup.php
Normal file
122
msd2/myoos/includes/modules/shipping/selfpickup.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: selfpickup.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: selfpickup.php,v 1.39 2003/02/05 22:41:52 hpdl
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class selfpickup {
|
||||
var $code, $title, $description, $icon, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'selfpickup';
|
||||
$this->title = $aLang['module_shipping_selfpickup_text_title'];
|
||||
$this->description = $aLang['module_shipping_selfpickup_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_SELFPICKUP_SORT_ORDER') ? MODULE_SHIPPING_SELFPICKUP_SORT_ORDER : null);
|
||||
$this->icon = '';
|
||||
$this->enabled = (defined('MODULE_SHIPPING_SELFPICKUP_STATUS') && (MODULE_SHIPPING_SELFPICKUP_STATUS == 'True') ? true : false);
|
||||
|
||||
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_SELFPICKUP_ZONE > 0) ) {
|
||||
$check_flag = FALSE;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
|
||||
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_SELFPICKUP_ZONE . "' and zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
|
||||
while ($check = $check_result->fields) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$check_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$check_result->Close();
|
||||
|
||||
if ($check_flag == FALSE) {
|
||||
$this->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $oOrder, $aLang, $total_count;
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' => $aLang['module_shipping_selfpickup_text_title'],
|
||||
'methods' => array(array('id' => $this->code,
|
||||
'title' => $aLang['module_shipping_selfpickup_text_way'],
|
||||
'cost' => 0 )));
|
||||
|
||||
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_SELFPICKUP_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_SELFPICKUP_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_SELFPICKUP_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_SELFPICKUP_SORT_ORDER', '0', '6', '0', now())");
|
||||
}
|
||||
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
|
||||
function keys() {
|
||||
return array('MODULE_SHIPPING_SELFPICKUP_STATUS', 'MODULE_SHIPPING_SELFPICKUP_ZONE', 'MODULE_SHIPPING_SELFPICKUP_SORT_ORDER');
|
||||
}
|
||||
}
|
||||
|
146
msd2/myoos/includes/modules/shipping/table.php
Normal file
146
msd2/myoos/includes/modules/shipping/table.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: table.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: table.php,v 1.27 2003/02/05 22:41:52 hpdl
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class table {
|
||||
var $code, $title, $description, $icon, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'table';
|
||||
$this->title = $aLang['module_shipping_table_text_title'];
|
||||
$this->description = $aLang['module_shipping_table_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_TABLE_SORT_ORDER') ? MODULE_SHIPPING_TABLE_SORT_ORDER : null);
|
||||
$this->icon = '';
|
||||
$this->tax_class = (defined('MODULE_SHIPPING_TABLE_TAX_CLASS') ? MODULE_SHIPPING_TABLE_TAX_CLASS : null);
|
||||
$this->enabled = (defined('MODULE_SHIPPING_TABLE_STATUS') && (MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
|
||||
|
||||
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {
|
||||
$check_flag = FALSE;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
|
||||
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_TABLE_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
|
||||
while ($check = $check_result->fields) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$check_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$check_result->Close();
|
||||
|
||||
if ($check_flag == FALSE) {
|
||||
$this->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $oOrder, $aLang, $shipping_weight, $shipping_num_boxes;
|
||||
|
||||
if (MODULE_SHIPPING_TABLE_MODE == 'price') {
|
||||
$oOrder_total = $_SESSION['cart']->show_total();
|
||||
} else {
|
||||
$oOrder_total = $shipping_weight;
|
||||
}
|
||||
|
||||
$table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLE_COST);
|
||||
$size = count($table_cost);
|
||||
for ($i=0, $n=$size; $i<$n; $i+=2) {
|
||||
if ($oOrder_total <= $table_cost[$i]) {
|
||||
$shipping = $table_cost[$i+1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
|
||||
$shipping = $shipping * $shipping_num_boxes;
|
||||
}
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' =>$aLang['module_shipping_table_text_title'],
|
||||
'methods' => array(array('id' => $this->code,
|
||||
'title' => $aLang['module_shipping_table_text_way'],
|
||||
'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
|
||||
|
||||
if ($this->tax_class > 0) {
|
||||
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
|
||||
}
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_TABLE_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_TABLE_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_TABLE_COST', '25:8.50,50:5.50,10000:0.00', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_TABLE_MODE', 'weight', '6', '0', 'oos_cfg_select_option(array(\'weight\', \'price\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_TABLE_HANDLING', '0', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_TABLE_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_TABLE_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_TABLE_SORT_ORDER', '0', '6', '0', now())");
|
||||
}
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
|
||||
function keys() {
|
||||
return array('MODULE_SHIPPING_TABLE_STATUS', 'MODULE_SHIPPING_TABLE_COST', 'MODULE_SHIPPING_TABLE_MODE', 'MODULE_SHIPPING_TABLE_HANDLING', 'MODULE_SHIPPING_TABLE_TAX_CLASS', 'MODULE_SHIPPING_TABLE_ZONE', 'MODULE_SHIPPING_TABLE_SORT_ORDER');
|
||||
}
|
||||
}
|
||||
|
141
msd2/myoos/includes/modules/shipping/weight.php
Normal file
141
msd2/myoos/includes/modules/shipping/weight.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: weight.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: weight.php,v 1.05 2003/02/18 03:37:00 harley_vb
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2002 - 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class weight {
|
||||
var $code, $title, $description, $icon, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'weight';
|
||||
$this->title = $aLang['module_shipping_weight_text_title'];
|
||||
$this->description = $aLang['module_shipping_weight_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_WEIGHT_SORT_ORDER') ? MODULE_SHIPPING_WEIGHT_SORT_ORDER : null);
|
||||
$this->icon = '';
|
||||
$this->tax_class = (defined('MODULE_SHIPPING_WEIGHT_TAX_CLASS') ? MODULE_SHIPPING_WEIGHT_TAX_CLASS : null);
|
||||
$this->enabled = (defined('MODULE_SHIPPING_WEIGHT_STATUS') && (MODULE_SHIPPING_WEIGHT_STATUS == 'True') ? true : false);
|
||||
|
||||
if ( ($this->enabled == TRUE) && ((defined('MODULE_SHIPPING_WEIGHT_ZONE') && (int)MODULE_SHIPPING_WEIGHT_ZONE > 0)) ) {
|
||||
$check_flag = FALSE;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$check_result = $dbconn->Execute("SELECT zone_id FROM " . $oostable['zones_to_geo_zones'] . " WHERE geo_zone_id = '" . MODULE_SHIPPING_WEIGHT_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
|
||||
while ($check = $check_result->fields) {
|
||||
if ($check['zone_id'] < 1) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
|
||||
$check_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$check_result->MoveNext();
|
||||
}
|
||||
|
||||
// Close result set
|
||||
$check_result->Close();
|
||||
|
||||
if ($check_flag == FALSE) {
|
||||
$this->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $oOrder, $aLang, $shipping_weight;
|
||||
|
||||
$weight_cost = preg_split("/[:,]/" , MODULE_SHIPPING_WEIGHT_COST);
|
||||
|
||||
if ($shipping_weight > $weight_cost[count ($weight_cost)-2]) {
|
||||
$shipping = ($shipping_weight-$weight_cost[count ($weight_cost)-2])* MODULE_SHIPPING_WEIGHT_STEP +$weight_cost[count ($weight_cost)-1];
|
||||
}
|
||||
for ($i = 0; $i < count($weight_cost); $i+=2) {
|
||||
if ($shipping_weight <= $weight_cost[$i]) {
|
||||
$shipping = $weight_cost[$i+1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' => $aLang['module_shipping_weight_text_title'],
|
||||
'methods' => array(array('id' => $this->code,
|
||||
'title' => $aLang['module_shipping_weight_text_way'],
|
||||
'cost' => $shipping + MODULE_SHIPPING_WEIGHT_HANDLING)));
|
||||
|
||||
if ($this->tax_class > 0) {
|
||||
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
|
||||
}
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_WEIGHT_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_HANDLING', '5', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_SORT_ORDER', '0', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_COST', '31:15,40:28,50:30.5,100:33', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_STEP', '0.28', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_MODE', 'weight', '6', '0', 'oos_cfg_select_option(array(\'weight\', \'price\'), ', now())");
|
||||
}
|
||||
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
|
||||
function keys() {
|
||||
return array('MODULE_SHIPPING_WEIGHT_STATUS', 'MODULE_SHIPPING_WEIGHT_HANDLING', 'MODULE_SHIPPING_WEIGHT_COST', 'MODULE_SHIPPING_WEIGHT_STEP', 'MODULE_SHIPPING_WEIGHT_TAX_CLASS', 'MODULE_SHIPPING_WEIGHT_ZONE', 'MODULE_SHIPPING_WEIGHT_SORT_ORDER');
|
||||
}
|
||||
}
|
||||
|
237
msd2/myoos/includes/modules/shipping/zones.php
Normal file
237
msd2/myoos/includes/modules/shipping/zones.php
Normal file
@ -0,0 +1,237 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: zones.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: zones.php,v 1.19 2003/02/05 22:41:53 hpdl
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
----------------------------------------------------------------------
|
||||
USAGE
|
||||
By default, the module comes with support for 1 zone. This can be
|
||||
easily changed by editing the line below in the zones constructor
|
||||
that defines $this->num_zones.
|
||||
|
||||
Next, you will want to activate the module by going to the Admin screen,
|
||||
clicking on Modules, then clicking on Shipping. A list of all shipping
|
||||
modules should appear. Click on the green dot next to the one labeled
|
||||
zones.php. A list of settings will appear to the right. Click on the
|
||||
Edit button.
|
||||
|
||||
PLEASE NOTE THAT YOU WILL LOSE YOUR CURRENT SHIPPING RATES AND OTHER
|
||||
SETTINGS IF YOU TURN OFF THIS SHIPPING METHOD. Make sure you keep a
|
||||
backup of your shipping settings somewhere at all times.
|
||||
|
||||
If you want an additional handling charge applied to orders that use this
|
||||
method, set the Handling Fee field.
|
||||
|
||||
Next, you will need to define which countries are in each zone. Determining
|
||||
this might take some time and effort. You should group a set of countries
|
||||
that has similar shipping charges for the same weight. For instance, when
|
||||
shipping from the US, the countries of Japan, Australia, New Zealand, and
|
||||
Singapore have similar shipping rates. As an example, one of my customers
|
||||
is using this set of zones:
|
||||
1: USA
|
||||
2: Canada
|
||||
3: Austria, Belgium, Great Britain, France, Germany, Greenland, Iceland,
|
||||
Ireland, Italy, Norway, Holland/Netherlands, Denmark, Poland, Spain,
|
||||
Sweden, Switzerland, Finland, Portugal, Israel, Greece
|
||||
4: Japan, Australia, New Zealand, Singapore
|
||||
5: Taiwan, China, Hong Kong
|
||||
|
||||
When you enter these country lists, enter them into the Zone X Countries
|
||||
fields, where "X" is the number of the zone. They should be entered as
|
||||
two character ISO country codes in all capital letters. They should be
|
||||
separated by commas with no spaces or other punctuation. For example:
|
||||
1: US
|
||||
2: CA
|
||||
3: AT,BE,GB,FR,DE,GL,IS,IE,IT,NO,NL,DK,PL,ES,SE,CH,FI,PT,IL,GR
|
||||
4: JP,AU,NZ,SG
|
||||
5: TW,CN,HK
|
||||
|
||||
Now you need to set up the shipping rate tables for each zone. Again,
|
||||
some time and effort will go into setting the appropriate rates. You
|
||||
will define a set of weight ranges and the shipping price for each
|
||||
range. For instance, you might want an order than weighs more than 0
|
||||
and less than or equal to 3 to cost 5.50 to ship to a certain zone.
|
||||
This would be defined by this: 3:5.5
|
||||
|
||||
You should combine a bunch of these rates together in a comma delimited
|
||||
list and enter them into the "Zone X Shipping Table" fields where "X"
|
||||
is the zone number. For example, this might be used for Zone 1:
|
||||
1:3.5,2:3.95,3:5.2,4:6.45,5:7.7,6:10.4,7:11.85, 8:13.3,9:14.75,10:16.2,11:17.65,
|
||||
12:19.1,13:20.55,14:22,15:23.45
|
||||
|
||||
The above example includes weights over 0 and up to 15. Note that
|
||||
units are not specified in this explanation since they should be
|
||||
specific to your locale.
|
||||
|
||||
CAVEATS
|
||||
At this time, it does not deal with weights that are above the highest amount
|
||||
defined. This will probably be the next area to be improved with the
|
||||
module. For now, you could have one last very high range with a very
|
||||
high shipping rate to discourage orders of that magnitude. For
|
||||
instance: 999:1000
|
||||
|
||||
If you want to be able to ship to any country in the world, you will
|
||||
need to enter every country code into the Country fields. For most
|
||||
shops, you will not want to enter every country. This is often
|
||||
because of too much fraud from certain places. If a country is not
|
||||
listed, then the module will add a $0.00 shipping charge and will
|
||||
indicate that shipping is not available to that destination.
|
||||
PLEASE NOTE THAT THE ORDER CAN STILL BE COMPLETED AND PROCESSED!
|
||||
|
||||
It appears that the osC shipping system automatically rounds the
|
||||
shipping weight up to the nearest whole unit. This makes it more
|
||||
difficult to design precise shipping tables. If you want to, you
|
||||
can hack the shipping.php file to get rid of the rounding.
|
||||
|
||||
Lastly, there is a limit of 255 characters on each of the Zone
|
||||
Shipping Tables and Zone Countries.
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
class zones {
|
||||
var $code, $title, $description, $num_zones, $enabled = FALSE;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
global $oOrder, $aLang;
|
||||
|
||||
$this->code = 'zones';
|
||||
$this->title = $aLang['module_shipping_zones_text_title'];
|
||||
$this->description = $aLang['module_shipping_zones_text_description'];
|
||||
$this->sort_order = (defined('MODULE_SHIPPING_ZONES_SORT_ORDER') ? MODULE_SHIPPING_ZONES_SORT_ORDER : null);
|
||||
$this->icon = '';
|
||||
$this->tax_class = (defined('MODULE_SHIPPING_ZONES_TAX_CLASS') ? MODULE_SHIPPING_ZONES_TAX_CLASS : null);
|
||||
$this->enabled = (defined('MODULE_SHIPPING_ZONES_STATUS') && (MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
|
||||
|
||||
|
||||
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
|
||||
$this->num_zones = 2;
|
||||
}
|
||||
|
||||
// class methods
|
||||
function quote($method = '') {
|
||||
global $oOrder, $aLang, $shipping_weight;
|
||||
|
||||
$dest_country = $oOrder->delivery['country']['iso_code_2'];
|
||||
$dest_zone = 0;
|
||||
$error = FALSE;
|
||||
|
||||
for ($i=1; $i<=$this->num_zones; $i++) {
|
||||
$countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
|
||||
$country_zones = preg_split("/[,]/", $countries_table);
|
||||
if (in_array($dest_country, $country_zones)) {
|
||||
$dest_zone = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($dest_zone == 0) {
|
||||
$error = TRUE;
|
||||
} else {
|
||||
$shipping = -1;
|
||||
$zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $dest_zone);
|
||||
|
||||
$zones_table = preg_split("/[:,]/", $zones_cost);
|
||||
$size = count($zones_table);
|
||||
for ($i=0; $i<$size; $i+=2) {
|
||||
if ($shipping_weight <= $zones_table[$i]) {
|
||||
$shipping = $zones_table[$i+1];
|
||||
$shipping_method = $aLang['module_shipping_zones_text_way'] . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . $aLang['module_shipping_zones_text_units'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($shipping == -1) {
|
||||
$shipping_cost = 0;
|
||||
$shipping_method = $aLang['module_shipping_zones_undefined_rate'];
|
||||
} else {
|
||||
$shipping_cost = ($shipping + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone));
|
||||
}
|
||||
}
|
||||
|
||||
$this->quotes = array('id' => $this->code,
|
||||
'module' => $aLang['module_shipping_zones_text_title'],
|
||||
'methods' => array(array('id' => $this->code,
|
||||
'title' => $shipping_method,
|
||||
'cost' => $shipping_cost)));
|
||||
|
||||
if ($this->tax_class > 0) {
|
||||
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
|
||||
}
|
||||
|
||||
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
|
||||
|
||||
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_zones_invalid_zone'];
|
||||
|
||||
return $this->quotes;
|
||||
}
|
||||
|
||||
|
||||
function check() {
|
||||
if (!isset($this->_check)) {
|
||||
$this->_check = defined('MODULE_SHIPPING_ZONES_STATUS');
|
||||
}
|
||||
|
||||
return $this->_check;
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_ZONES_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_ZONES_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ZONES_SORT_ORDER', '0', '6', '0', now())");
|
||||
for ($i = 1; $i <= $this->num_zones; $i++) {
|
||||
$default_countries = '';
|
||||
if ($i == 1) {
|
||||
$default_countries = 'US,CA';
|
||||
}
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ZONES_COUNTRIES_" . $i ."', '" . $default_countries . "', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ZONES_COST_" . $i ."', '3:8.50,7:10.50,99:20.00', '6', '0', now())");
|
||||
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ZONES_HANDLING_" . $i."', '0', '6', '0', now())");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function remove() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$configurationtable = $oostable['configuration'];
|
||||
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
|
||||
}
|
||||
|
||||
|
||||
function keys() {
|
||||
$keys = array('MODULE_SHIPPING_ZONES_STATUS', 'MODULE_SHIPPING_ZONES_TAX_CLASS', 'MODULE_SHIPPING_ZONES_SORT_ORDER');
|
||||
|
||||
for ($i=1; $i<=$this->num_zones; $i++) {
|
||||
$keys[] = 'MODULE_SHIPPING_ZONES_COUNTRIES_' . $i;
|
||||
$keys[] = 'MODULE_SHIPPING_ZONES_COST_' . $i;
|
||||
$keys[] = 'MODULE_SHIPPING_ZONES_HANDLING_' . $i;
|
||||
}
|
||||
|
||||
return $keys;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user