Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Australian International Shipping Options


bobsi18

Recommended Posts

Hi there everyone...

 

I'm looking for advice for Australian international shipping options... I'm currently using the AusPost shipping module and it's great, I will continue to use it.

 

I want all packages sent overseas to be insured. I can set insured costs in admin for the international airmail option of the Australia Post module. However, Australia Post just doesn't offer insurance to some countries. What I'd like to do is offer a different postage service to those countries, specifically Express Courier International (http://www.auspost.com.au/eci/main.html).

 

ECI fees work on weight and the country zone of the customer receiving the parcel, there are 4 zones with different prices per weight category. There is a surcharge for insurance, which increases with the value of the parcel.

 

So what I'm wondering is: is anyone using this postage option? How did you integrate is with oscommerce? does anyone know of a similar shipping module that I could modify?

 

Thanks for any advice.

 

~Barbara~

Link to comment
Share on other sites

Ok... I've found this contribution (Zone Shipping with the support of Insurance Charge) and have modified it to my needs... I've only one small problem, I don't want this shipping method to show for Australian customers, I only want it to show for international customers. So I tried adding a 'shipping zone' (like what is used for the flat rate shipping), but I can't get it to work. The module works fine if there's without the 'shipping zone', it's when I try to integrate it that's I'm having troubles... So I'm wondering if any of you geniuses can take a look for me...

 

Thanks,

:) barbara

 

/includes/modules/shipping/zones1.php...

<?php
/*

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

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

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 class zones1 {
   var $code, $title, $description, $enabled, $num_zones1;

// class constructor
   function zones1() {

     $this->code = 'zones1';
     $this->title = MODULE_SHIPPING_ZONES1_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_ZONES1_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_ZONES1_SORT_ORDER;
     $this->icon = '';
     $this->tax_class = MODULE_SHIPPING_ZONES1_TAX_CLASS;
     $this->enabled = ((MODULE_SHIPPING_ZONES1_STATUS == 'True') ? true : false);






if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ZONES1_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_ZONES1_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 ZONES1 NEEDED
     $this->num_zones1 = 4;
     }
// class methods
   function quote($method = '') {
     global $order, $cart, $shipping_weight, $shipping_num_boxes;

     $dest_country = $order->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     $error = false;

// Zone insurance enhancement
     $order_total = $cart->show_total();
// Zone insurance enhancement 

     for ($i=1; $i<=$this->num_zones1; $i++) {
       $countries_table = constant('MODULE_SHIPPING_ZONES1_COUNTRIES_' . $i);
       $country_zones1 = split("[,]", $countries_table);
       if (in_array($dest_country, $country_zones1)) {
         $dest_zone = $i;
         break;
       }
     }

     if ($dest_zone == 0) {
       $error = true;
     } else {
       $shipping = -1;
       $insurance = -1;
       $zones1_cost = constant('MODULE_SHIPPING_ZONES1_COST_' . $dest_zone);

// Zone insurance enhancement 
       $zones1_insurance = constant('MODULE_SHIPPING_ZONES1_INSURANCE_' . $dest_zone);
// Zone insurance enhancement 

       $zones1_table = split("[:,]" , $zones1_cost);
       $size = sizeof($zones1_table);
       for ($i=0; $i<$size; $i+=2) {
         if ($shipping_weight <= $zones1_table[$i]) {
           $shipping = $zones1_table[$i+1];
           $shipping_method = MODULE_SHIPPING_ZONES1_TEXT_WAY . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_ZONES1_TEXT_UNITS;
           break;
         }
       }

// Zone insurance enhancement  
       $zones1_table_insurance = split("[:,]" , $zones1_insurance);
       $size = sizeof($zones1_table_insurance);
       for ($i=0; $i<$size; $i+=2) {
         if ($order_total <= $zones1_table_insurance[$i]) {
           $insurance = $zones1_table_insurance[$i+1];
           break;
         }
       }
// Zone insurance enhancement 

       if ($shipping == -1 or $insurance == -1) {
         $shipping_cost = 0;
         $insurance = 0;
         $shipping_method = MODULE_SHIPPING_ZONES1_UNDEFINED_RATE;
       } else {
         $shipping_cost = ($shipping * $shipping_num_boxes) + $insurance + constant('MODULE_SHIPPING_ZONES1_HANDLING_' . $dest_zone);
       }
     }

     $this->quotes = array('id' => $this->code,
                           'module' => MODULE_SHIPPING_ZONES1_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_ZONES1_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_ZONES1_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 ECI', 'MODULE_SHIPPING_ZONES1_STATUS', 'True', 'Do you want to offer Express Courier International?', '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_ZONES1_TAX_CLASS', '0', 'Use the following tax class on the postage 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_ZONES1_SORT_ORDER', '0', 'Sort order of display.', '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_ZONES1_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())");
     for ($i = 1; $i <= $this->num_zones1; $i++) {
     if ($i == 1) {
     $code = 'A';
     $codedet = 'A (New Zealand)';
     }
     if ($i == 2) {
     $code = 'B';
     $codedet = 'B (Asia/Pacific)';
     }
     if ($i == 3) {
     $code = 'C';
     $codedet = 'C (USA/Canada/Middle East)';
     }
     if ($i == 4) {
     $code = 'D';
     $codedet = 'D (Rest of the World';
     }
       $default_countries = '';
       if ($i == 1) {
         $default_countries = 'NZ';
       }
       if ($i == 2) {
         $default_countries = 'BD,BT,BN,KH,CN,CK,TP,FJ,PF,GU,HK,IN,ID,JP,KI,KR,LA,MO,MY,MV,MH,FM,MM,NR,NP,N
C,NU,PK,PW,PG,PH,PN,WS,SG,SB,LK,TW,TH,TK,TO,TV,VU,VN,WF';
       }
       if ($i == 3) {
         $default_countries = 'AF,BH,CA,KM,CY,IR,IL,JO,KW,MG,MU,OM,QU,RE,SA,PM,SY,AE,US,YE';
       }
       if ($i == 4) {
         $default_countries = 'AL,DZ,AO,AI,AG,AR,AM,AT,AZ,BS,BB,BY,BE,BZ,BJ,BM,BO,BA,BW,BR,IO,BG,BF,BI,CM,C
V,KY,CF,TD,CL,CO,CG,CR,CI,HR,CU,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FI,FR,G
F,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GT,GN,GW,GY,HT,HN,HU,IS,IE,IT,JM,KZ,KE,KG,LV,LS,L
R,LY,LI,LT,LU,MK,MW,ML,MT,MO,MR,MD,MC,MN,MS,MA,MZ,NA,NL,AN,NI,NE,NG,NO,PA,PY,PE,P
L,PT,PR,RO,RU,RW,KN,LC,VC,ST,SN,SC,SL,SK,SI,SO,ZA,ES,SD,SR,SZ,SE,CH,TJ,TZ,TG,TT,T
N,TR,TM,TC,UG,UA,GB,UY,UZ,VA,VE,VG,VI,ZM,ZW';
       }
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $code ." Countries', 'MODULE_SHIPPING_ZONES1_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $codedet . ".', '6', '0', now())");
               if ($i == 1) {
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone A Postage Table', 'MODULE_SHIPPING_ZONES1_COST_" . $i ."', '.475:37.50,.975:42.00,1.975:49.50,2.975:57.00,4.975:72.50,7.475:92.50,9.975:113.
00,12.475:133.00,14.975:153.00,17.475:173.00,19.975:193.00,200:1000.00,', 'Postage rates to Zone A (New Zealand)', '6', '0', now())");
       }
                       if ($i == 2) {
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $code ." Postage Table', 'MODULE_SHIPPING_ZONES1_COST_" . $i ."', '.475:40.00,.975:46.50,1.975:55.50,2.975:67.50,4.975:88.00,7.475:115.50,9.975:143
.00,12.475:170.50,14.975:198.00,17.475:225.50,19.975:253.00,200:1000.00,', 'Postage rates to Zone B (Asia/Pacific)', '6', '0', now())");
       }
                       if ($i == 3) {
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone C Postage Table', 'MODULE_SHIPPING_ZONES1_COST_" . $i ."', '.475:43.50,.975:52.00,1.975:62.50,2.975:79.00,4.975:104.00,7.475:139.00,9.975:17
4.00,12.475:211.00,14.975:248.50,17.475:286.00,19.975:323.50,200:1000.00,', 'Postage rates to Zone C (USA/Canada/Middle East)', '6', '0', now())");
       }
                       if ($i == 4) {
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone D Postage Table', 'MODULE_SHIPPING_ZONES1_COST_" . $i ."', '.475:45.50,.975:55.00,1.975:69.50,2.975:86.50,4.975:120.50,7.475:163.00,9.975:20
5.50,12.475:248.00,14.975:290.50,17.475:333.00,19.975:375.50,200:1000.00,', 'Postage rates to Zone D (Rest of the World)', '6', '0', now())");
       }

// Zone insurance enhancement 
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $code ." Insurance Table', 'MODULE_SHIPPING_ZONES1_INSURANCE_" . $i ."', '100:7.50,200:9.50,300:11.50,400:13.50,500:15.50,600:17.50,700:19.50,800:21.50,90
0:23.50,10000:10000.00', 'Insurance rates based on the value order ($5.50 plus $2 per $100 ordered)', '6', '0', now())");
// Zone insurance enhancement 
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $code ." Handling Fee', 'MODULE_SHIPPING_ZONES1_HANDLING_" . $i."', '4', 'Handling Fee for this postage zone (cost of packaging, etc.)', '6', '0', now())");
     }
   }

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

   function keys() {
     $keys = array('MODULE_SHIPPING_ZONES1_STATUS', 'MODULE_SHIPPING_ZONES1_TAX_CLASS', 'MODULE_SHIPPING_ZONES1_SORT_ORDER',
     'MODULE_SHIPPING_ZONES1_ZONE');

     for ($i=1; $i<=$this->num_zones1; $i++) {
       $keys[] = 'MODULE_SHIPPING_ZONES1_COUNTRIES_' . $i;
       $keys[] = 'MODULE_SHIPPING_ZONES1_COST_' . $i;
// Zone insurance enhancement 
       $keys[] = 'MODULE_SHIPPING_ZONES1_INSURANCE_' . $i;
// Zone insurance enhancement 
       $keys[] = 'MODULE_SHIPPING_ZONES1_HANDLING_' . $i;
     }

     return $keys;
   }
 }
?>

Link to comment
Share on other sites

  • 3 weeks later...

I', still having trouble with this one - I don't want to offer it to my Australian customers, only to international ones. Does aynone know how to go about this??? Please help me out here, one of the last hurdles before I go live...

 

~bobsi18~

Link to comment
Share on other sites

GOT IT!!! For anyone interested in using Express Courier International for international postage from Australia... Download the zones1 contribution from the contribution area and then replace catalog/includes/modules/shipping/zones1.php with this:

<?php
/*

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

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

 Copyright © 2003 osCommerce

 Released under the GNU General Public License

*/

 class zones1 {
   var $code, $title, $description, $enabled, $num_zones1;

// class constructor
   function zones1() {

     $this->code = 'zones1';
     $this->title = MODULE_SHIPPING_ZONES1_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_ZONES1_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_ZONES1_SORT_ORDER;
     $this->icon = '';
     $this->tax_class = MODULE_SHIPPING_ZONES1_TAX_CLASS;
     $this->enabled = ((MODULE_SHIPPING_ZONES1_STATUS == 'True') ? true : false);






if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ZONES1_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_ZONES1_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 ZONES1 NEEDED
     $this->num_zones1 = 4;
     }
// class methods
   function quote($method = '') {
     global $order, $cart, $shipping_weight, $shipping_num_boxes, $enabled;

     $dest_country = $order->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     $error = false;

// Zone insurance enhancement
     $order_total = $cart->show_total();
// Zone insurance enhancement 

     for ($i=1; $i<=$this->num_zones1; $i++) {
       $countries_table = constant('MODULE_SHIPPING_ZONES1_COUNTRIES_' . $i);
       $country_zones1 = split("[,]", $countries_table);
       if (in_array($dest_country, $country_zones1)) {
         $dest_zone = $i;
         break;
       }
     }

     if ($dest_zone == 0) {
       $error = true;
       $this->enabled = false;
     } else {
       $shipping = -1;
       $insurance = -1;
       $zones1_cost = constant('MODULE_SHIPPING_ZONES1_COST_' . $dest_zone);

// Zone insurance enhancement 
       $zones1_insurance = constant('MODULE_SHIPPING_ZONES1_INSURANCE_' . $dest_zone);
// Zone insurance enhancement 

       $zones1_table = split("[:,]" , $zones1_cost);
       $size = sizeof($zones1_table);
       for ($i=0; $i<$size; $i+=2) {
         if ($shipping_weight <= $zones1_table[$i]) {
           $shipping = $zones1_table[$i+1];
           $shipping_method = MODULE_SHIPPING_ZONES1_TEXT_WAY . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_ZONES1_TEXT_UNITS;
           break;
         }
       }

// Zone insurance enhancement  
       $zones1_table_insurance = split("[:,]" , $zones1_insurance);
       $size = sizeof($zones1_table_insurance);
       for ($i=0; $i<$size; $i+=2) {
         if ($order_total <= $zones1_table_insurance[$i]) {
           $insurance = $zones1_table_insurance[$i+1];
           break;
         }
       }
// Zone insurance enhancement 

       if ($shipping == -1 or $insurance == -1) {
         $shipping_cost = 0;
         $insurance = 0;
         $shipping_method = MODULE_SHIPPING_ZONES1_UNDEFINED_RATE;
       } else {
         $shipping_cost = ($shipping * $shipping_num_boxes) + $insurance + constant('MODULE_SHIPPING_ZONES1_HANDLING_' . $dest_zone);
       }
     }

     $this->quotes = array('id' => $this->code,
                           'module' => MODULE_SHIPPING_ZONES1_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'] = $order->delivery['country']['iso_code_2'];

if ($order->delivery['country']['iso_code_2'] != 'AU') {
     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_ZONES1_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 ECI', 'MODULE_SHIPPING_ZONES1_STATUS', 'True', 'Do you want to offer Express Courier International?', '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_ZONES1_TAX_CLASS', '0', 'Use the following tax class on the postage 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_ZONES1_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_ZONES1_SORT_ORDER', '0', 'Sort order of display.', '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_ZONES1_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())");
     for ($i = 1; $i <= $this->num_zones1; $i++) {
     if ($i == 1) {
     $code = 'A';
     $codedet = 'A (New Zealand)';
     }
     if ($i == 2) {
     $code = 'B';
     $codedet = 'B (Asia/Pacific)';
     }
     if ($i == 3) {
     $code = 'C';
     $codedet = 'C (USA/Canada/Middle East)';
     }
     if ($i == 4) {
     $code = 'D';
     $codedet = 'D (Rest of the World)';
     }
       $default_countries = '';
       if ($i == 1) {
         $default_countries = 'NZ';
       }
       if ($i == 2) {
         $default_countries = 'BD,BT,BN,KH,CN,CK,TP,FJ,PF,GU,HK,IN,ID,JP,KI,KR,LA,MO,MY,MV,MH,FM,MM,NR,NP,N
C,NU,PK,PW,PG,PH,PN,WS,SG,SB,LK,TW,TH,TK,TO,TV,VU,VN,WF';
       }
       if ($i == 3) {
         $default_countries = 'AF,BH,CA,KM,CY,IR,IL,JO,KW,MG,MU,OM,QU,RE,SA,PM,SY,AE,US,YE';
       }
       if ($i == 4) {
         $default_countries = 'AL,DZ,AO,AI,AG,AR,AM,AT,AZ,BS,BB,BY,BE,BZ,BJ,BM,BO,BA,BW,BR,IO,BG,BF,BI,CM,C
V,KY,CF,TD,CL,CO,CG,CR,CI,HR,CU,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FI,FR,G
F,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GT,GN,GW,GY,HT,HN,HU,IS,IE,IT,JM,KZ,KE,KG,LV,LS,L
R,LY,LI,LT,LU,MK,MW,ML,MT,MO,MR,MD,MC,MN,MS,MA,MZ,NA,NL,AN,NI,NE,NG,NO,PA,PY,PE,P
L,PT,PR,RO,RU,RW,KN,LC,VC,ST,SN,SC,SL,SK,SI,SO,ZA,ES,SD,SR,SZ,SE,CH,TJ,TZ,TG,TT,T
N,TR,TM,TC,UG,UA,GB,UY,UZ,VA,VE,VG,VI,ZM,ZW';
       }
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $code ." Countries', 'MODULE_SHIPPING_ZONES1_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $codedet . ".', '6', '0', now())");
               if ($i == 1) {
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone A Postage Table', 'MODULE_SHIPPING_ZONES1_COST_" . $i ."', '.475:37.50,.975:42.00,1.975:49.50,2.975:57.00,4.975:72.50,7.475:92.50,9.975:113.
00,12.475:133.00,14.975:153.00,17.475:173.00,19.975:193.00,200:1000.00,', 'Postage rates to Zone A (New Zealand)', '6', '0', now())");
       }
                       if ($i == 2) {
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $code ." Postage Table', 'MODULE_SHIPPING_ZONES1_COST_" . $i ."', '.475:40.00,.975:46.50,1.975:55.50,2.975:67.50,4.975:88.00,7.475:115.50,9.975:143
.00,12.475:170.50,14.975:198.00,17.475:225.50,19.975:253.00,200:1000.00,', 'Postage rates to Zone B (Asia/Pacific)', '6', '0', now())");
       }
                       if ($i == 3) {
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone C Postage Table', 'MODULE_SHIPPING_ZONES1_COST_" . $i ."', '.475:43.50,.975:52.00,1.975:62.50,2.975:79.00,4.975:104.00,7.475:139.00,9.975:17
4.00,12.475:211.00,14.975:248.50,17.475:286.00,19.975:323.50,200:1000.00,', 'Postage rates to Zone C (USA/Canada/Middle East)', '6', '0', now())");
       }
                       if ($i == 4) {
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone D Postage Table', 'MODULE_SHIPPING_ZONES1_COST_" . $i ."', '.475:45.50,.975:55.00,1.975:69.50,2.975:86.50,4.975:120.50,7.475:163.00,9.975:20
5.50,12.475:248.00,14.975:290.50,17.475:333.00,19.975:375.50,200:1000.00,', 'Postage rates to Zone D (Rest of the World)', '6', '0', now())");
       }

// Zone insurance enhancement 
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $code ." Insurance Table', 'MODULE_SHIPPING_ZONES1_INSURANCE_" . $i ."', '100:7.50,200:9.50,300:11.50,400:13.50,500:15.50,600:17.50,700:19.50,800:21.50,90
0:23.50,10000:10000.00', 'Insurance rates based on the value order ($5.50 plus $2 per $100 ordered)', '6', '0', now())");
// Zone insurance enhancement 
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $code ." Handling Fee', 'MODULE_SHIPPING_ZONES1_HANDLING_" . $i."', '4', 'Handling Fee for this postage zone (cost of packaging, etc.)', '6', '0', now())");
     }
   }

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

   function keys() {
     $keys = array('MODULE_SHIPPING_ZONES1_STATUS', 'MODULE_SHIPPING_ZONES1_TAX_CLASS', 'MODULE_SHIPPING_ZONES1_SORT_ORDER',
     'MODULE_SHIPPING_ZONES1_ZONE');

     for ($i=1; $i<=$this->num_zones1; $i++) {
       $keys[] = 'MODULE_SHIPPING_ZONES1_COUNTRIES_' . $i;
       $keys[] = 'MODULE_SHIPPING_ZONES1_COST_' . $i;
// Zone insurance enhancement 
       $keys[] = 'MODULE_SHIPPING_ZONES1_INSURANCE_' . $i;
// Zone insurance enhancement 
       $keys[] = 'MODULE_SHIPPING_ZONES1_HANDLING_' . $i;
     }

     return $keys;
   }
 }
?>

Link to comment
Share on other sites

Why don't you post it as a contribution?

:) bit scared to - I'm sure theres a few errors in there :), but if you think there's a call for it, I will.

 

~bobsi18~

Link to comment
Share on other sites

:) bit scared to - I'm sure theres a few errors in there :), but if you think there's a call for it, I will.

 

~bobsi18~

If there are errors, it will not be the first or last to be posted with errors.

 

Sometimes, we need to just go for it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...