Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Modding this file?


abubobbob

Recommended Posts

How would i go about modding these files and uploading it under a new name to add another shipping option. I basically want an exact copy just under a new name, i tried renaming all instances of AIRMAIL with AIRMAILREC and class airmailrec { but this did not work :(

 

<?php
/*

$Id: zones.php,v 1.20 2003/06/15 19:48:09 thomasamoulton Exp $

 Some changes to zonesworld for MS2
 by Paul Mathot 2004/05/12
 added: $shipping_num_boxes and shippingtax
 it's a direct replacement for zones.php now
 credits to the osCommerce team and elari

osCommerce, Open Source E-Commerce Solutions
[url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

Copyright © 2002-2003 elari for 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.

elari
i have made some change to this module, that come now with 3 default zone
1 : NL can be changed for your country
2 : AT,BE,GB,DE,FR,GL,IS,IE,IT,NO,DK,PL,ES,SE,CH,FI,PT,IL,GR   that are other European country except NL defined in zone 1
3 : All Other World Country not defined.
    If you define more zone, keep in mind that this is the lastest zone that will be used for country not listed


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!
elari : this has been changed, now the country not listed use the rate defined for
lastest zone

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 airmail {
  var $code, $title, $description, $enabled, $num_zones;

// class constructor
  function airmail() {
  global $order;
    $this->code = 'airmail';
    $this->title = MODULE_SHIPPING_AIRMAIL_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_AIRMAIL_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_AIRMAIL_SORT_ORDER;
     $this->icon = DIR_WS_ICONS . 'shipping_airmail.gif'; // upload icon to catalog/images/icon directory
    $this->tax_class = MODULE_SHIPPING_AIRMAIL_TAX_CLASS;
    $this->enabled = ((MODULE_SHIPPING_AIRMAIL_STATUS == 'True') ? true : false);
 if ($order->delivery['country']['iso_code_2'] == 'GB')  {
 $this->enabled = false;
 }
    // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
    $this->num_zones = 2;
  }

// class methods
  function quote($method = '') {
    global $order, $shipping_weight, $shipping_num_boxes;

    $dest_country = $order->delivery['country']['iso_code_2'];
    $dest_zone = 0;
    $error = false;
    for ($i=1; $i<=$this->num_zones; $i++) {
      $countries_table = constant('MODULE_SHIPPING_AIRMAIL_COUNTRIES_' . $i);
      $country_zones = split("[,]", $countries_table);
      if (in_array($dest_country, $country_zones)) {
        $dest_zone = $i;
        break;
      }
    }

    // elari - Added to select default country if not in listing      
    if ($dest_zone == 0) {
      $dest_zone = $this->num_zones;    // the zone is the lastest zone avalaible
    }
    // elari - Added to select default country if not in listing
    if ($dest_zone == 0) {
      $error = true;      // this can no more achieve since by default the value is set to the max number of zones
    } else {
      $shipping = -1;
      $zones_cost = constant('MODULE_SHIPPING_AIRMAIL_COST_' . $dest_zone);

      $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];
	   if(tep_not_null($method) )
		// Text shown on Checkout_Confirmation
		$shipping_method = ''; // Leaving this entry blank causes only the shipping title to show i.e Royal Mail 1st Class Rec 	  
		else
		// Text shown on Checkout_shipping -  Delivery Weight : 0.7 Kg's (Ships normally within 1 to 3 days)
		$shipping_method = MODULE_SHIPPING_AIRMAIL_TEXT_WAY . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_AIRMAIL_TEXT_UNITS . ' ' . MODULE_SHIPPING_AIRMAIL_DELIVERY_TIMES; 
          if ($shipping_num_boxes > 1) {
            $shipping_method .= $shipping_num_boxes . 'x ';
          }
          break;
        }
      }

      if ($shipping == -1) {
        $shipping_cost = 0;
        $shipping_method = MODULE_SHIPPING_AIRMAIL_UNDEFINED_RATE;
      } else {
        $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_AIRMAIL_HANDLING_' . $dest_zone);
      }
    }

    $this->quotes = array('id' => $this->code,
                          'module' => MODULE_SHIPPING_AIRMAIL_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_AIRMAIL_INVALID_ZONE;

    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_AIRMAIL_STATUS'");
      $this->_check = tep_db_num_rows($check_query);
    }
    return $this->_check;
  }

  // elari - Added to select default country if not in listing
  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 Zones Method', 'MODULE_SHIPPING_AIRMAIL_STATUS', 'True', 'Do you want to offer 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, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_AIRMAIL_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', 'MODULE_SHIPPING_AIRMAIL_SORT_ORDER', '9', 'Sort order of display.', '6', '0', now())");
    for ($i = 1; $i <= $this->num_zones; $i++) {
       $default_countries = '';
      if ($i == 1) {
        $default_countries = 'AL,AD,AM,AT,AZ,BY,BE,BA,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GI,GR,GL,HU,IS,IE,I
T,KZ,KG,LV,LI,LT,LU,MK,MT,MD,MC,NL,NO,PL,PT,RO,RU,SM,SK,SI,ES,SE,CH,TJ,TR,TM,UA,U
Z,VA';
        $shipping_table = '.1:1.1,.2:1.69,.3:2.23,.4:2.69,.5:3.19,.6:3.69,.7:4.19,.8:4.69,.9:5.19,1:5.6
9,1.1:6.19,1.2:6.69,1.3:7.19,1.4:7.69,1.5:8.19,1.6:8.69,1.7:9.19,1.8:9.69,1.9:10.
19,2:10.69,99:999
';
      }
      if ($i == 2) {
        $default_countries = 'All Others'; // this must be the lastest zone
        $shipping_table = '.1:1.46,.2:2.48,.3:3.43,.4:4.38,.5:5.33,.6:6.28,.7:7.23,.8:8.18,.9:9.13,1:10
.08,1.1:11.03,1.2:11.98,1.3:12.93,1.4:13.88,1.5:14.83,1.6:15.78,1.7:16.73,1.8:17.
68,1.9:18.63,2:19.58,99:999';
      }
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_AIRMAIL_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '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 " . $i ." Shipping Table', 'MODULE_SHIPPING_AIRMAIL_COST_" . $i ."', '" . $shipping_table . "', 'Shipping rates to Zone " . $i . " 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 " . $i . " 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 " . $i ." Handling Fee', 'MODULE_SHIPPING_AIRMAIL_HANDLING_" . $i ."', '0', 'If you want to add extra costs to customers for jiffy bags etc, the cost can be entered below (eg enter 1.50 for a value of £1.50)', '6', '0', now())");
    }
  }
  // elari - Added to select default country if not in listing

  function remove() {
    tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
  }

  function keys() {
    $keys = array('MODULE_SHIPPING_AIRMAIL_STATUS', 'MODULE_SHIPPING_AIRMAIL_TAX_CLASS', 'MODULE_SHIPPING_AIRMAIL_SORT_ORDER');

    for ($i=1; $i<=$this->num_zones; $i++) {
      $keys[] = 'MODULE_SHIPPING_AIRMAIL_COUNTRIES_' . $i;
      $keys[] = 'MODULE_SHIPPING_AIRMAIL_COST_' . $i;
      $keys[] = 'MODULE_SHIPPING_AIRMAIL_HANDLING_' . $i;
    }

    return $keys;
  }
}
?>

 

<?php
/*
 $Id: zones.php,v 1.3 2002/11/19 01:48:08 dgw_ Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2002 osCommerce

 Released under the GNU General Public License
*/

define('MODULE_SHIPPING_AIRMAIL_TEXT_TITLE', 'Airmail International Signed For');
define('MODULE_SHIPPING_AIRMAIL_TEXT_DESCRIPTION', 'Airmail International Signed For');
define('MODULE_SHIPPING_AIRMAIL_TEXT_WAY', 'Delivery Weight');
define('MODULE_SHIPPING_AIRMAIL_TEXT_UNITS', 'Kg\'s');
define('MODULE_SHIPPING_AIRMAIL_DELIVERY_TIMES', '(Ships normally within 1 to 3 days)'); 
define('MODULE_SHIPPING_AIRMAIL_INVALID_ZONE', 'Sorry, this shipping method is not available to your country');
define('MODULE_SHIPPING_AIRMAIL_UNDEFINED_RATE', 'The shipping rate cannot be determined at this time (2.00Kg cart weight exceeded');
?>

 

Thanks for the help.

 

Adam

Link to comment
Share on other sites

Otay above my top post is the two original files, heres my attempt at making a new shipping module thats not working for some reason :( any can spot where ive gone wrong... It just shows up as a blank line in the osc panel that when i click install on nothing happens :(.

 

<?php
/*

$Id: zones.php,v 1.20 2003/06/15 19:48:09 thomasamoulton Exp $

 Some changes to zonesworld for MS2
 by Paul Mathot 2004/05/12
 added: $shipping_num_boxes and shippingtax
 it's a direct replacement for zones.php now
 credits to the osCommerce team and elari

osCommerce, Open Source E-Commerce Solutions
[url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

Copyright © 2002-2003 elari for 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.

elari
i have made some change to this module, that come now with 3 default zone
1 : NL can be changed for your country
2 : AT,BE,GB,DE,FR,GL,IS,IE,IT,NO,DK,PL,ES,SE,CH,FI,PT,IL,GR   that are other European country except NL defined in zone 1
3 : All Other World Country not defined.
    If you define more zone, keep in mind that this is the lastest zone that will be used for country not listed


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!
elari : this has been changed, now the country not listed use the rate defined for
lastest zone

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 airmailrec {
  var $code, $title, $description, $enabled, $num_zones;

// class constructor
  function airmairecl() {
  global $order;
    $this->code = 'airmailrec';
    $this->title = MODULE_SHIPPING_AIRMAILREC_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_AIRMAILREC_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_AIRMAILREC_SORT_ORDER;
     $this->icon = DIR_WS_ICONS . 'shipping_airmail.gif'; // upload icon to catalog/images/icon directory
    $this->tax_class = MODULE_SHIPPING_AIRMAILREC_TAX_CLASS;
    $this->enabled = ((MODULE_SHIPPING_AIRMAILREC_STATUS == 'True') ? true : false);
 if ($order->delivery['country']['iso_code_2'] == 'GB')  {
 $this->enabled = false;
 }
    // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
    $this->num_zones = 2;
  }

// class methods
  function quote($method = '') {
    global $order, $shipping_weight, $shipping_num_boxes;

    $dest_country = $order->delivery['country']['iso_code_2'];
    $dest_zone = 0;
    $error = false;
    for ($i=1; $i<=$this->num_zones; $i++) {
      $countries_table = constant('MODULE_SHIPPING_AIRMAILREC_COUNTRIES_' . $i);
      $country_zones = split("[,]", $countries_table);
      if (in_array($dest_country, $country_zones)) {
        $dest_zone = $i;
        break;
      }
    }

    // elari - Added to select default country if not in listing      
    if ($dest_zone == 0) {
      $dest_zone = $this->num_zones;    // the zone is the lastest zone avalaible
    }
    // elari - Added to select default country if not in listing
    if ($dest_zone == 0) {
      $error = true;      // this can no more achieve since by default the value is set to the max number of zones
    } else {
      $shipping = -1;
      $zones_cost = constant('MODULE_SHIPPING_AIRMAILREC_COST_' . $dest_zone);

      $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];
	   if(tep_not_null($method) )
		// Text shown on Checkout_Confirmation
		$shipping_method = ''; // Leaving this entry blank causes only the shipping title to show i.e Royal Mail 1st Class Rec 	  
		else
		// Text shown on Checkout_shipping -  Delivery Weight : 0.7 Kg's (Ships normally within 1 to 3 days)
		$shipping_method = MODULE_SHIPPING_AIRMAILREC_TEXT_WAY . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_AIRMAILREC_TEXT_UNITS . ' ' . MODULE_SHIPPING_AIRMAILREC_DELIVERY_TIMES; 
          if ($shipping_num_boxes > 1) {
            $shipping_method .= $shipping_num_boxes . 'x ';
          }
          break;
        }
      }

      if ($shipping == -1) {
        $shipping_cost = 0;
        $shipping_method = MODULE_SHIPPING_AIRMAILREC_UNDEFINED_RATE;
      } else {
        $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_AIRMAILREC_HANDLING_' . $dest_zone);
      }
    }

    $this->quotes = array('id' => $this->code,
                          'module' => MODULE_SHIPPING_AIRMAILREC_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_AIRMAILREC_INVALID_ZONE;

    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_AIRMAILREC_STATUS'");
      $this->_check = tep_db_num_rows($check_query);
    }
    return $this->_check;
  }

  // elari - Added to select default country if not in listing
  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 Airmail Recorded', 'MODULE_SHIPPING_AIRMAILREC_STATUS', 'True', 'Do you want to offer 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, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_AIRMAILREC_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', 'MODULE_SHIPPING_AIRMAILREC_SORT_ORDER', '10', 'Sort order of display.', '6', '0', now())");
    for ($i = 1; $i <= $this->num_zones; $i++) {
       $default_countries = '';
      if ($i == 1) {
        $default_countries = 'AL,AD,AM,AT,AZ,BY,BE,BA,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GI,GR,GL,HU,IS,IE,I
T,KZ,KG,LV,LI,LT,LU,MK,MT,MD,MC,NL,NO,PL,PT,RO,RU,SM,SK,SI,ES,SE,CH,TJ,TR,TM,UA,U
Z,VA';
        $shipping_table = '.1:1.1,.2:1.69,.3:2.23,.4:2.69,.5:3.19,.6:3.69,.7:4.19,.8:4.69,.9:5.19,1:5.6
9,1.1:6.19,1.2:6.69,1.3:7.19,1.4:7.69,1.5:8.19,1.6:8.69,1.7:9.19,1.8:9.69,1.9:10.
19,2:10.69,99:999
';
      }
      if ($i == 2) {
        $default_countries = 'All Others'; // this must be the lastest zone
        $shipping_table = '.1:1.46,.2:2.48,.3:3.43,.4:4.38,.5:5.33,.6:6.28,.7:7.23,.8:8.18,.9:9.13,1:10
.08,1.1:11.03,1.2:11.98,1.3:12.93,1.4:13.88,1.5:14.83,1.6:15.78,1.7:16.73,1.8:17.
68,1.9:18.63,2:19.58,99:999';
      }
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_AIRMAILREC_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '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 " . $i ." Shipping Table', 'MODULE_SHIPPING_AIRMAILREC_COST_" . $i ."', '" . $shipping_table . "', 'Shipping rates to Zone " . $i . " 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 " . $i . " 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 " . $i ." Handling Fee', 'MODULE_SHIPPING_AIRMAILREC_HANDLING_" . $i ."', '0', 'If you want to add extra costs to customers for jiffy bags etc, the cost can be entered below (eg enter 1.50 for a value of £1.50)', '6', '0', now())");
    }
  }
  // elari - Added to select default country if not in listing

  function remove() {
    tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
  }

  function keys() {
    $keys = array('MODULE_SHIPPING_AIRMAILREC_STATUS', 'MODULE_SHIPPING_AIRMAILREC_TAX_CLASS', 'MODULE_SHIPPING_AIRMAILREC_SORT_ORDER');

    for ($i=1; $i<=$this->num_zones; $i++) {
      $keys[] = 'MODULE_SHIPPING_AIRMAILREC_COUNTRIES_' . $i;
      $keys[] = 'MODULE_SHIPPING_AIRMAILREC_COST_' . $i;
      $keys[] = 'MODULE_SHIPPING_AIRMAILREC_HANDLING_' . $i;
    }

    return $keys;
  }
}
?>

 

<?php
/*
 $Id: zones.php,v 1.3 2002/11/19 01:48:08 dgw_ Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2002 osCommerce

 Released under the GNU General Public License
*/

define('MODULE_SHIPPING_AIRMAILREC_TEXT_TITLE', 'Airmail International Signed For');
define('MODULE_SHIPPING_AIRMAILREC_TEXT_DESCRIPTION', 'Airmail International Signed For');
define('MODULE_SHIPPING_AIRMAILREC_TEXT_WAY', 'Delivery Weight');
define('MODULE_SHIPPING_AIRMAILREC_TEXT_UNITS', 'Kg\'s');
define('MODULE_SHIPPING_AIRMAILREC_DELIVERY_TIMES', '(Ships normally within 1 to 3 days)'); 
define('MODULE_SHIPPING_AIRMAILREC_INVALID_ZONE', 'Sorry, this shipping method is not available to your country');
define('MODULE_SHIPPING_AIRMAILREC_UNDEFINED_RATE', 'The shipping rate cannot be determined at this time (2.00Kg cart weight exceeded');

 

Thanks in advance for any help.

Link to comment
Share on other sites

You have a typo:

   function airmairecl() {

- try removing that terminal 'l'

 

Nice spot one reason why i shouldnt be working l8 night on this :). Unfortunately no dice :(. Still the same problem. Thanks for the help passion that lil l would have been causing me enough problems anyways good 2 get it out the way now :D

Link to comment
Share on other sites

Sry to bump this one, but im having no luck... cant seem to make this into its own individual shipping module, it still just appears as a blank line in my osc admin panel that i can select, but nothing happens when clicking on the install button :(. I fixed the typo in it (thanks perfect passion), but its still to work properly... if anyone can see where im going wrong it would be a major help :). Heres the original code that works:

 

placed in /catalog/include/modules/shipping/...

 

<?php

class airmail {
  var $code, $title, $description, $enabled, $num_zones;

// class constructor
  function airmail() {
  global $order;
    $this->code = 'airmail';
    $this->title = MODULE_SHIPPING_AIRMAIL_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_AIRMAIL_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_AIRMAIL_SORT_ORDER;
     $this->icon = DIR_WS_ICONS . 'shipping_airmail.gif'; // upload icon to catalog/images/icon directory
    $this->tax_class = MODULE_SHIPPING_AIRMAIL_TAX_CLASS;
    $this->enabled = ((MODULE_SHIPPING_AIRMAIL_STATUS == 'True') ? true : false);
 if ($order->delivery['country']['iso_code_2'] == 'GB')  {
 $this->enabled = false;
 }
    // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
    $this->num_zones = 2;
  }

// class methods
  function quote($method = '') {
    global $order, $shipping_weight, $shipping_num_boxes;

    $dest_country = $order->delivery['country']['iso_code_2'];
    $dest_zone = 0;
    $error = false;
    for ($i=1; $i<=$this->num_zones; $i++) {
      $countries_table = constant('MODULE_SHIPPING_AIRMAIL_COUNTRIES_' . $i);
      $country_zones = split("[,]", $countries_table);
      if (in_array($dest_country, $country_zones)) {
        $dest_zone = $i;
        break;
      }
    }

    // elari - Added to select default country if not in listing      
    if ($dest_zone == 0) {
      $dest_zone = $this->num_zones;    // the zone is the lastest zone avalaible
    }
    // elari - Added to select default country if not in listing
    if ($dest_zone == 0) {
      $error = true;      // this can no more achieve since by default the value is set to the max number of zones
    } else {
      $shipping = -1;
      $zones_cost = constant('MODULE_SHIPPING_AIRMAIL_COST_' . $dest_zone);

      $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];
	   if(tep_not_null($method) )
		// Text shown on Checkout_Confirmation
		$shipping_method = ''; // Leaving this entry blank causes only the shipping title to show i.e Royal Mail 1st Class Rec 	  
		else
		// Text shown on Checkout_shipping -  Delivery Weight : 0.7 Kg's (Ships normally within 1 to 3 days)
		$shipping_method = MODULE_SHIPPING_AIRMAIL_TEXT_WAY . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_AIRMAIL_TEXT_UNITS . ' ' . MODULE_SHIPPING_AIRMAIL_DELIVERY_TIMES; 
          if ($shipping_num_boxes > 1) {
            $shipping_method .= $shipping_num_boxes . 'x ';
          }
          break;
        }
      }

      if ($shipping == -1) {
        $shipping_cost = 0;
        $shipping_method = MODULE_SHIPPING_AIRMAIL_UNDEFINED_RATE;
      } else {
        $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_AIRMAIL_HANDLING_' . $dest_zone);
      }
    }

    $this->quotes = array('id' => $this->code,
                          'module' => MODULE_SHIPPING_AIRMAIL_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_AIRMAIL_INVALID_ZONE;

    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_AIRMAIL_STATUS'");
      $this->_check = tep_db_num_rows($check_query);
    }
    return $this->_check;
  }

  // elari - Added to select default country if not in listing
  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 Zones Method', 'MODULE_SHIPPING_AIRMAIL_STATUS', 'True', 'Do you want to offer 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, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_AIRMAIL_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', 'MODULE_SHIPPING_AIRMAIL_SORT_ORDER', '9', 'Sort order of display.', '6', '0', now())");
    for ($i = 1; $i <= $this->num_zones; $i++) {
       $default_countries = '';
      if ($i == 1) {
        $default_countries = 'AL,AD,AM,AT,AZ,BY,BE,BA,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GI,GR,GL,HU,IS,IE,I
T,KZ,KG,LV,LI,LT,LU,MK,MT,MD,MC,NL,NO,PL,PT,RO,RU,SM,SK,SI,ES,SE,CH,TJ,TR,TM,UA,U
Z,VA';
        $shipping_table = '.1:1.1,.2:1.69,.3:2.23,.4:2.69,.5:3.19,.6:3.69,.7:4.19,.8:4.69,.9:5.19,1:5.6
9,1.1:6.19,1.2:6.69,1.3:7.19,1.4:7.69,1.5:8.19,1.6:8.69,1.7:9.19,1.8:9.69,1.9:10.
19,2:10.69,99:999
';
      }
      if ($i == 2) {
        $default_countries = 'All Others'; // this must be the lastest zone
        $shipping_table = '.1:1.46,.2:2.48,.3:3.43,.4:4.38,.5:5.33,.6:6.28,.7:7.23,.8:8.18,.9:9.13,1:10
.08,1.1:11.03,1.2:11.98,1.3:12.93,1.4:13.88,1.5:14.83,1.6:15.78,1.7:16.73,1.8:17.
68,1.9:18.63,2:19.58,99:999';
      }
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_AIRMAIL_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '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 " . $i ." Shipping Table', 'MODULE_SHIPPING_AIRMAIL_COST_" . $i ."', '" . $shipping_table . "', 'Shipping rates to Zone " . $i . " 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 " . $i . " 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 " . $i ." Handling Fee', 'MODULE_SHIPPING_AIRMAIL_HANDLING_" . $i ."', '0', 'If you want to add extra costs to customers for jiffy bags etc, the cost can be entered below (eg enter 1.50 for a value of £1.50)', '6', '0', now())");
    }
  }
  // elari - Added to select default country if not in listing

  function remove() {
    tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
  }

  function keys() {
    $keys = array('MODULE_SHIPPING_AIRMAIL_STATUS', 'MODULE_SHIPPING_AIRMAIL_TAX_CLASS', 'MODULE_SHIPPING_AIRMAIL_SORT_ORDER');

    for ($i=1; $i<=$this->num_zones; $i++) {
      $keys[] = 'MODULE_SHIPPING_AIRMAIL_COUNTRIES_' . $i;
      $keys[] = 'MODULE_SHIPPING_AIRMAIL_COST_' . $i;
      $keys[] = 'MODULE_SHIPPING_AIRMAIL_HANDLING_' . $i;
    }

    return $keys;
  }
}
?>

 

Here is my mod to it trying 2 make a 2nd different version of it:

 

<?php

class airmailrec {
  var $code, $title, $description, $enabled, $num_zones;

// class constructor
  function airmairec() {
  global $order;
    $this->code = 'airmailrec';
    $this->title = MODULE_SHIPPING_AIRMAILREC_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_AIRMAILREC_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_AIRMAILREC_SORT_ORDER;
     $this->icon = DIR_WS_ICONS . 'shipping_airmail.gif'; // upload icon to catalog/images/icon directory
    $this->tax_class = MODULE_SHIPPING_AIRMAILREC_TAX_CLASS;
    $this->enabled = ((MODULE_SHIPPING_AIRMAILREC_STATUS == 'True') ? true : false);
 if ($order->delivery['country']['iso_code_2'] == 'GB')  {
 $this->enabled = false;
 }
    // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
    $this->num_zones = 2;
  }

// class methods
  function quote($method = '') {
    global $order, $shipping_weight, $shipping_num_boxes;

    $dest_country = $order->delivery['country']['iso_code_2'];
    $dest_zone = 0;
    $error = false;
    for ($i=1; $i<=$this->num_zones; $i++) {
      $countries_table = constant('MODULE_SHIPPING_AIRMAILREC_COUNTRIES_' . $i);
      $country_zones = split("[,]", $countries_table);
      if (in_array($dest_country, $country_zones)) {
        $dest_zone = $i;
        break;
      }
    }

    // elari - Added to select default country if not in listing      
    if ($dest_zone == 0) {
      $dest_zone = $this->num_zones;    // the zone is the lastest zone avalaible
    }
    // elari - Added to select default country if not in listing
    if ($dest_zone == 0) {
      $error = true;      // this can no more achieve since by default the value is set to the max number of zones
    } else {
      $shipping = -1;
      $zones_cost = constant('MODULE_SHIPPING_AIRMAILREC_COST_' . $dest_zone);

      $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];
	   if(tep_not_null($method) )
		// Text shown on Checkout_Confirmation
		$shipping_method = ''; // Leaving this entry blank causes only the shipping title to show i.e Royal Mail 1st Class Rec 	  
		else
		// Text shown on Checkout_shipping -  Delivery Weight : 0.7 Kg's (Ships normally within 1 to 3 days)
		$shipping_method = MODULE_SHIPPING_AIRMAILREC_TEXT_WAY . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_AIRMAILREC_TEXT_UNITS . ' ' . MODULE_SHIPPING_AIRMAILREC_DELIVERY_TIMES; 
          if ($shipping_num_boxes > 1) {
            $shipping_method .= $shipping_num_boxes . 'x ';
          }
          break;
        }
      }

      if ($shipping == -1) {
        $shipping_cost = 0;
        $shipping_method = MODULE_SHIPPING_AIRMAILREC_UNDEFINED_RATE;
      } else {
        $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_AIRMAILREC_HANDLING_' . $dest_zone);
      }
    }

    $this->quotes = array('id' => $this->code,
                          'module' => MODULE_SHIPPING_AIRMAILREC_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_AIRMAILREC_INVALID_ZONE;

    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_AIRMAILREC_STATUS'");
      $this->_check = tep_db_num_rows($check_query);
    }
    return $this->_check;
  }

  // elari - Added to select default country if not in listing
  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 Airmail Recorded', 'MODULE_SHIPPING_AIRMAILREC_STATUS', 'True', 'Do you want to offer 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, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_AIRMAILREC_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', 'MODULE_SHIPPING_AIRMAILREC_SORT_ORDER', '10', 'Sort order of display.', '6', '0', now())");
    for ($i = 1; $i <= $this->num_zones; $i++) {
       $default_countries = '';
      if ($i == 1) {
        $default_countries = 'AL,AD,AM,AT,AZ,BY,BE,BA,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GI,GR,GL,HU,IS,IE,I
T,KZ,KG,LV,LI,LT,LU,MK,MT,MD,MC,NL,NO,PL,PT,RO,RU,SM,SK,SI,ES,SE,CH,TJ,TR,TM,UA,U
Z,VA';
        $shipping_table = '.1:1.1,.2:1.69,.3:2.23,.4:2.69,.5:3.19,.6:3.69,.7:4.19,.8:4.69,.9:5.19,1:5.6
9,1.1:6.19,1.2:6.69,1.3:7.19,1.4:7.69,1.5:8.19,1.6:8.69,1.7:9.19,1.8:9.69,1.9:10.
19,2:10.69,99:999
';
      }
      if ($i == 2) {
        $default_countries = 'All Others'; // this must be the lastest zone
        $shipping_table = '.1:1.46,.2:2.48,.3:3.43,.4:4.38,.5:5.33,.6:6.28,.7:7.23,.8:8.18,.9:9.13,1:10
.08,1.1:11.03,1.2:11.98,1.3:12.93,1.4:13.88,1.5:14.83,1.6:15.78,1.7:16.73,1.8:17.
68,1.9:18.63,2:19.58,99:999';
      }
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_AIRMAILREC_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '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 " . $i ." Shipping Table', 'MODULE_SHIPPING_AIRMAILREC_COST_" . $i ."', '" . $shipping_table . "', 'Shipping rates to Zone " . $i . " 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 " . $i . " 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 " . $i ." Handling Fee', 'MODULE_SHIPPING_AIRMAILREC_HANDLING_" . $i ."', '0', 'If you want to add extra costs to customers for jiffy bags etc, the cost can be entered below (eg enter 1.50 for a value of £1.50)', '6', '0', now())");
    }
  }
  // elari - Added to select default country if not in listing

  function remove() {
    tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
  }

  function keys() {
    $keys = array('MODULE_SHIPPING_AIRMAILREC_STATUS', 'MODULE_SHIPPING_AIRMAILREC_TAX_CLASS', 'MODULE_SHIPPING_AIRMAILREC_SORT_ORDER');

    for ($i=1; $i<=$this->num_zones; $i++) {
      $keys[] = 'MODULE_SHIPPING_AIRMAILREC_COUNTRIES_' . $i;
      $keys[] = 'MODULE_SHIPPING_AIRMAILREC_COST_' . $i;
      $keys[] = 'MODULE_SHIPPING_AIRMAILREC_HANDLING_' . $i;
    }

    return $keys;
  }
}
?>

 

And here is the original /language file:

 

<?php
/*
 $Id: zones.php,v 1.3 2002/11/19 01:48:08 dgw_ Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2002 osCommerce

 Released under the GNU General Public License
*/

define('MODULE_SHIPPING_AIRMAIL_TEXT_TITLE', 'Airmail International Signed For');
define('MODULE_SHIPPING_AIRMAIL_TEXT_DESCRIPTION', 'Airmail International Signed For');
define('MODULE_SHIPPING_AIRMAIL_TEXT_WAY', 'Delivery Weight');
define('MODULE_SHIPPING_AIRMAIL_TEXT_UNITS', 'Kg\'s');
define('MODULE_SHIPPING_AIRMAIL_DELIVERY_TIMES', '(Ships normally within 1 to 3 days)'); 
define('MODULE_SHIPPING_AIRMAIL_INVALID_ZONE', 'Sorry, this shipping method is not available to your country');
define('MODULE_SHIPPING_AIRMAIL_UNDEFINED_RATE', 'The shipping rate cannot be determined at this time (2.00Kg cart weight exceeded');
?>

 

Finally my changed version of the language file:

 

<?php
/*
 $Id: zones.php,v 1.3 2002/11/19 01:48:08 dgw_ Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2002 osCommerce

 Released under the GNU General Public License
*/

define('MODULE_SHIPPING_AIRMAILREC_TEXT_TITLE', 'Airmail International Signed For');
define('MODULE_SHIPPING_AIRMAILREC_TEXT_DESCRIPTION', 'Airmail International Signed For');
define('MODULE_SHIPPING_AIRMAILREC_TEXT_WAY', 'Delivery Weight');
define('MODULE_SHIPPING_AIRMAILREC_TEXT_UNITS', 'Kg\'s');
define('MODULE_SHIPPING_AIRMAILREC_DELIVERY_TIMES', '(Ships normally within 1 to 3 days)'); 
define('MODULE_SHIPPING_AIRMAILREC_INVALID_ZONE', 'Sorry, this shipping method is not available to your country');
define('MODULE_SHIPPING_AIRMAILREC_UNDEFINED_RATE', 'The shipping rate cannot be determined at this time (2.00Kg cart weight exceeded');
?>

 

Thanks alot to anyone who can help me.

 

Regards

 

Adam

Link to comment
Share on other sites

Making a new shipping type is quite easy:

 

1. Rename both includes\modules\shipping\flat.php and includes\languages\english\modules\shipping\flat.php (or whatever method you want to base yours off) to a unique name for your new shipping method.

 

2. Open up both files, now you need to replace the word "FLAT" and "flat" (use case sensitive replace) with your new shipping method name.

 

That's it, that's all you gotta do in a nutshell, really.

Link to comment
Share on other sites

Making a new shipping type is quite easy:

 

1. Rename both includes\modules\shipping\flat.php and includes\languages\english\modules\shipping\flat.php (or whatever method you want to base yours off) to a unique name for your new shipping method.

 

2. Open up both files, now you need to replace the word "FLAT" and "flat" (use case sensitive replace) with your new shipping method name.

 

That's it, that's all you gotta do in a nutshell, really.

 

Thats what ive done with this file... but just doesnt seem to work. If i copy the flat rate options can i make them subject to different zones, so ppl from UK wont see options for international shipping and vice versa?

Link to comment
Share on other sites

of course you can. You can create 10 clones and assign a tax zone(=geo zone) to each, and each zone's countries will only see the one you made for them

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...