Hello Everyone,
I want to convert this osc shipping module but i'm stuck.
I hope someone can help me here.
Here is the code:
PHP Code:
<?php
/*
  $Id: fastway.php,v 1.0 2006/02/21

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce
  

  Released under the GNU General Public License
*/

class fastway {
var 
$code$title$description$enabled$num_zones$surcharge_factor$icon$enabled;

// class constructor:w

function fastway() {
      global 
$order;

      
$this->code 'fastway';
      
$this->title MODULE_SHIPPING_FASTWAY_TEXT_TITLE;
      
$this->description MODULE_SHIPPING_FASTWAY_TEXT_DESCRIPTION;
      
$this->icon DIR_WS_ICONS '';
      
$this->sort_order MODULE_SHIPPING_FASTWAY_SORT_ORDER;
      
$this->icon DIR_WS_ICONS 'fastway.gif';
      
$this->tax_class MODULE_SHIPPING_FASTWAY_TAX_CLASS;
      
$this->enabled = ((MODULE_SHIPPING_FASTWAY_STATUS == 'True') ? true false);

      if ( (
$this->enabled == true) && ((int)MODULE_SHIPPING_FASTWAY_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_FASTWAY_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;
      }

// Customize this setting for the number of zones needed (no change required by default)
$this->num_zones 6;

//More options can be added later for Express, Overnight etc when someone codes it.
$this->types = array('Fast Off-Peak' => 'std');

// Change this surcharge factor to increase your profit margin on freight
$this->surcharge_factor MODULE_SHIPPING_FASTWAY_SURCHARGE;
}
}
// class methods

function quote($method '') {

global 
$order$cart$shipping_weight$shipping_num_boxes,  $total_weight;

// First get the dest zip and check the db for our dest zone
    
$topcode $order->delivery['postcode'];

if ( 
$topcode == '' ){
// Something is wrong, we didn't find any zone
    
$this->quotes['error'] = MODULE_SHIPPING_FASTWAY_NO_POSTCODE_FOUND;
return 
$this->quotes;
}

$sql "SELECT * FROM fastway_zones WHERE $topcode >= f_postcode and $topcode <= f_postcode";


$qResult tep_db_query($sql); 
$rec tep_db_fetch_array($qResult); 


    if (
$rec['f_delivery'] = 'S/D') {
    
$days 'same';
    }
    if (
$rec['f_delivery'] = 'N/D') {
    
$days 'next';
    } else {
    
$days $rec['f_delivery'];
}

if (
$rec['f_zone'] == '1') {
        
$shipping = -1;
$dest_zone 1;
        
$zones_cost constant('MODULE_SHIPPING_ZONE_1_COST');
        
$zones_handling constant('MODULE_SHIPPING_ZONE_1_HANDLING');
}
elseif (
$rec['f_zone'] == '2') {
        
$shipping = -1;
$dest_zone 2;
        
$zones_cost constant('MODULE_SHIPPING_ZONE_2_COST');
        
$zones_handling constant('MODULE_SHIPPING_ZONE_2_HANDLING');
}
elseif (
$rec['f_zone'] == '3') {
        
$shipping = -1;
$dest_zone 3;
        
$zones_cost constant('MODULE_SHIPPING_ZONE_3_COST');
        
$zones_handling constant('MODULE_SHIPPING_ZONE_3_HANDLING');
}
elseif (
$rec['f_zone'] == '4') {;
        
$shipping = -1;
$dest_zone 4;
        
$zones_cost constant('MODULE_SHIPPING_ZONE_4_COST');
        
$zones_handling constant('MODULE_SHIPPING_ZONE_4_HANDLING');
}
elseif (
$rec['f_zone'] == 'L') {
        
$shipping = -1;
$dest_zone 5;
        
$zones_cost constant('MODULE_SHIPPING_ZONE_LOCAL_COST');
        
$zones_handling constant('MODULE_SHIPPING_ZONE_LOCAL_HANDLING');
}
elseif (
$rec['f_zone'] == 'S/H') {
        
$shipping = -1;
$dest_zone 6;
        
$zones_cost constant('MODULE_SHIPPING_ZONE_SHORT_COST');
        
$zones_handling constant('MODULE_SHIPPING_ZONE_SHORT_HANDLING');
} else {
        
// Something is wrong, we didn't find any zone
        
$this->quotes['error'] = MODULE_SHIPPING_FASTWAY_NO_ZONE_FOUND;
        return 
$this->quotes;
}

        
$zones_table split("[:,]" $zones_cost);
        
$size sizeof($zones_table);
        for (
$i=0$i<$size$i+=2) {
          if (
$shipping_weight <= $zones_table[$i]) {
            
$shipping $zones_table[$i+1];
            break;
          }
        }

        
$handling MODULE_SHIPPING_FASTWAY_HANDLING;
          if (
$handling >0) {
            
$handling_details " $" MODULE_SHIPPING_FASTWAY_HANDLING " " .MODULE_SHIPPING_FASTWAY_TEXT_HANDLING;
          } else {
            
$handling_details "";
          }

              if (
$handling  == 0) {
                
$fastways_addons "";
              } else {
                
$fastways_addons " (" MODULE_SHIPPING_FASTWAY_TEXT_INCLUDE $handling_details.") ";
              }


        if (
$shipping == -1) {
          
$shipping_cost 0;
          
$shipping_method MODULE_SHIPPING_FASTWAY_UNDEFINED_RATE;
        } else {
          
$shipping_cost = ($shipping $shipping_num_boxes) + MODULE_SHIPPING_FASTWAY_HANDLING $insurance;
          
$shipping_method MODULE_SHIPPING_FASTWAY_TEXT_WAY" <b>"  $topcode "</b> - " $days " " MODULE_SHIPPING_FASTWAY_TEXT_SHIPPINGDAYS "<br>" .$shipping_num_boxes "&nbsp;" .MODULE_SHIPPING_FASTWAY_TEXT_BOXES  " " $total_weight MODULE_SHIPPING_FASTWAY_TEXT_UNITS $fastways_addons;

        }

      
$this->quotes = array('id' => $this->code,
                            
'module' => MODULE_SHIPPING_FASTWAY_TEXT_TITLE,
                            
'methods' => array(array('id' => $this->code,
                                                     
'title' => $shipping_method,
                                                     
'cost' => $shipping_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);

      if (
$error == true$this->quotes['error'] = MODULE_SHIPPING_FASTWAY_TEXT_ERROR;

      return 
$this->quotes;
    }

function 
check() {
if (!isset(
$this->_check)) {
$check_query tep_db_query("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_FASTWAY_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 Fastway', 'MODULE_SHIPPING_FASTWAY_STATUS', 'True', 'Do you want to offer Fastway postcode/zone 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 ('Insurance', 'MODULE_SHIPPING_FASTWAY_INSURANCE', '25:5.90', 'Insurance cost is based on the total cost of items. Example: 25:8.50,50:5.50,etc.. Up to $25 charge $8.50, from there to $50 charge $5.50, etc', '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 ('Surcharge', 'MODULE_SHIPPING_FASTWAY_SURCHARGE', '', 'Do you want to add a surcharge on your freight quote (this can cover additional handling costs.) Enter it in the format of 1.1 for 10% 1.2 for 20% etc', '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 ('Dispatch Postcode', 'MODULE_SHIPPING_FASTWAY_SPCODE', '2000', 'Dispatch Postcode?', '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 ('Handling Fee', 'MODULE_SHIPPING_FASTWAY_HANDLING', '10', 'Handling Fee for this shipping method (Flat rate $ value)', '6', '0', 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_FASTWAY_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, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_FASTWAY_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, date_added) values ('Sort order of display.', 'MODULE_SHIPPING_FASTWAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '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 ('Local Zone Shipping Table', 'MODULE_SHIPPING_ZONE_LOCAL_COST', '3:8.50,7:10.50,99:20.00', 'Shipping rates to Local Zone destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Local Zone destinations.', '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 ('Local Zone Handling Fee', 'MODULE_SHIPPING_ZONE_LOCAL_HANDLING', '0', 'Handling Fee for this shipping zone', '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 ('Short Haul Shipping Table', 'MODULE_SHIPPING_ZONE_SHORT_COST', '3:8.50,7:10.50,99:20.00', 'Shipping rates to Short Haul Zone destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Short Haul Zone destinations.', '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 ('Short Haul Handling Fee', 'MODULE_SHIPPING_ZONE_SHORT_HANDLING', '0', 'Handling Fee for this shipping zone', '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 ('Zone 1 Shipping Table', 'MODULE_SHIPPING_ZONE_1_COST', '3:8.50,7:10.50,99:20.00', 'Shipping rates to Zone 1 destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone 1 destinations.', '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 ('Zone 1 Handling Fee', 'MODULE_SHIPPING_ZONE_1_HANDLING', '0', 'Handling Fee for this shipping zone', '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 ('Zone 2 Shipping Table', 'MODULE_SHIPPING_ZONE_2_COST', '3:8.50,7:10.50,99:20.00', 'Shipping rates to Zone 2 destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone 2 destinations.', '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 ('Zone 2 Handling Fee', 'MODULE_SHIPPING_ZONE_2_HANDLING', '0', 'Handling Fee for this shipping zone', '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 ('Zone 3 Shipping Table', 'MODULE_SHIPPING_ZONE_3_COST', '3:8.50,7:10.50,99:20.00', 'Shipping rates to Zone 3 destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone 3 destinations.', '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 ('Zone 3 Handling Fee', 'MODULE_SHIPPING_ZONE_3_HANDLING', '0', 'Handling Fee for this shipping zone', '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 ('Zone 4 Shipping Table', 'MODULE_SHIPPING_ZONE_4_COST', '3:8.50,7:10.50,99:20.00', 'Shipping rates to Zone 4 destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone 4 destinations.', '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 ('Zone 4 Handling Fee', 'MODULE_SHIPPING_ZONE_4_HANDLING', '0', 'Handling Fee for this shipping zone', '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_FASTWAY_STATUS''MODULE_SHIPPING_FASTWAY_INSURANCE''MODULE_SHIPPING_FASTWAY_SURCHARGE''MODULE_SHIPPING_FASTWAY_MAX_SHIPWEIGHT''MODULE_SHIPPING_FASTWAY_SPCODE''MODULE_SHIPPING_FASTWAY_HANDLING''MODULE_SHIPPING_FASTWAY_ZONE''MODULE_SHIPPING_FASTWAY_TAX_CLASS''MODULE_SHIPPING_FASTWAY_SORT_ORDER''MODULE_SHIPPING_ZONE_LOCAL_COST''MODULE_SHIPPING_ZONE_LOCAL_HANDLING''MODULE_SHIPPING_ZONE_SHORT_COST''MODULE_SHIPPING_ZONE_SHORT_HANDLING''MODULE_SHIPPING_ZONE_1_COST''MODULE_SHIPPING_ZONE_1_HANDLING''MODULE_SHIPPING_ZONE_2_COST''MODULE_SHIPPING_ZONE_2_HANDLING''MODULE_SHIPPING_ZONE_3_COST''MODULE_SHIPPING_ZONE_3_HANDLING''MODULE_SHIPPING_ZONE_4_COST''MODULE_SHIPPING_ZONE_4_HANDLING');
    }
  }
?>
Thank you.