Codice: Seleziona tutto
<?php
/*
modulo di spedizione tramite Consegna in Sede
by hOZONE, hozone@tiscali.it, http://hozone.cjb.net
visita osCommerceITalia, http://www.oscommerceitalia.com
derivato dal modulo:
$Id: flat.php,v 1.40 2003/02/05 22:41:52 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
class CELEREA {
var $code, $title, $description, $icon, $enabled;
// class constructor
function CELEREA() {
global $order;
$this->code = 'celerea';
$this->title = MODULE_SHIPPING_CELEREA_TEXT_TITLE;
$this->description = MODULE_SHIPPING_CELEREA_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_CELEREA_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_CELEREA_TAX_CLASS;
if (!strstr($_SERVER['PHP_SELF'], DIR_WS_ADMIN)) {
if ( tep_get_shipping_unallowed($this->code)=='true' ) {
$this->enabled = ((MODULE_SHIPPING_CELEREA_STATUS == 'True') ? true : false);
} else {
$this->enabled = false;
}
} else {
$this->enabled = ((MODULE_SHIPPING_CELEREA_STATUS == 'True') ? true : false);
}
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_CELEREA_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_CELEREA_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
// class methods
function quote($method = '') {
global $order;
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_CELEREA_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_CELEREA_TEXT_WAY,
'cost' => MODULE_SHIPPING_CELEREA_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);
return $this->quotes;
}
function guest_extimate_quote($shipping_weight = '0', $p_price = '0', $p_ship_price = 0) {
global $currencies;
$return_string = '';
$return_string =
'<hr color="#c0c0c0" noshade="noshade" size="1">
<span class=shipping_extimator><b>'. strtoupper(EXTIMATOR_SHIPPING_BY . $this->title) . '</b>';
$return_string .= '<ul>';
$return_string .= '<li><p><span class=shipping_extimator>'. EXTIMATOR_SHIPPING_PRICE . $currencies->display_price(MODULE_SHIPPING_CELEREA_COST, $this->tax_class,'1', true) . '</span></p>';
$return_string .= '</ul>';
return $return_string;
}
function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_CELEREA_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}
function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Consegna in Sede Shipping', 'MODULE_SHIPPING_CELEREA_STATUS', 'True', 'Do you want to offer CELEREA rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_CELEREA_COST', '0.00', 'The shipping cost for all orders using this shipping method.', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Strada del sito di consegna', 'MODULE_SHIPPING_CELEREA_ADDR_VIA', '', 'Specificare la via e il numero civico del sito di consegna.', '6', '3', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Città del sito di consegna', 'MODULE_SHIPPING_CELEREA_ADDR_CITTA', '', 'Specificare la città e la provincia del sito di consegna.', '6', '4', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('CAP del sito di consegna', 'MODULE_SHIPPING_CELEREA_ADDR_CAP', '', 'Specificare il CAP del sito di consegna.', '6', '5', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_CELEREA_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_CELEREA_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_CELEREA_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
}
function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_SHIPPING_CELEREA_STATUS', 'MODULE_SHIPPING_CELEREA_COST', 'MODULE_SHIPPING_CELEREA_TAX_CLASS','MODULE_SHIPPING_CELEREA_ADDR_VIA','MODULE_SHIPPING_CELEREA_ADDR_CITTA','MODULE_SHIPPING_CELEREA_ADDR_CAP','MODULE_SHIPPING_CELEREA_ZONE', 'MODULE_SHIPPING_CELEREA_SORT_ORDER');
}
}
?>