Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Jul 2007
    Posts
    342
    Plugin Contributions
    7

    Default Shipping UK Post codes

    Zen cart Version 1.5.7 PHP 7

    Module shipping UK Post Codes https://www.zen-cart.com/downloads.php?do=file&id=1238

    For some reason this is not loading the zones postal codes into the database, I have had to add to the database manually. Any ideas?
    PHP Code:
      class ukpost {    var $code$title$description$enabled$num_zones;
        function 
    ukpost() {      $this->code 'ukpost';      $this->title MODULE_SHIPPING_UKPOST_TEXT_TITLE;      $this->description MODULE_SHIPPING_UKPOST_TEXT_DESCRIPTION;      $this->sort_order defined('MODULE_SHIPPING_UKPOST_SORT_ORDER') ? MODULE_SHIPPING_ZONES_SORT_ORDER null;      $this->icon '';      $this->tax_class MODULE_SHIPPING_UKPOST_TAX_CLASS;      $this->tax_basis MODULE_SHIPPING_UKPOST_TAX_BASIS;
          if (
    zen_get_shipping_enabled($this->code)) {        $this->enabled = ((MODULE_SHIPPING_UKPOST_STATUS == 'True') ? true false);      }
          
    // CHANGE THIS SETTING TO INCREASE THE NUMBER OF ZONES      // NOTE... Default Num Zones is set at 4      // You will need to uninstall (if already installed) and reinstall       // to have the changed zones number visible in the admin.      $this->num_zones = 4;    }    // class methods    function quote($method = '') {      global $order, $shipping_weight, $shipping_num_boxes, $total_count;      $destination_postcode = $order->delivery['postcode'];      $pcode = preg_replace('/\s\s*/', '', $destination_postcode);      $len = strlen($pcode); //echo $len."<br>";      if ($len <= 6) {$plen = 3;} else {$plen = 4;}      $destination_pcode = strtoupper(trim(mb_substr($pcode,0,$plen)));      $dest_zone = 0;      $error = false;
          
    for ($i=1$i<=$this->num_zones$i++) {        $postcode_table constant('MODULE_SHIPPING_UKPOST_CODES_' $i);        $post_zones preg_split("/[,]/"$postcode_table);        if (in_array($destination_pcode$post_zones)) {          $dest_zone $i;          break;          }                    else { $dest_zone 1;}        }        if ($order->delivery['country_id'] != 222) {$dest_zone 0;}
          if (
    $dest_zone == 0) {        $error true;      } else {        $shipping = -1;        $postage_cost constant('MODULE_SHIPPING_UKPOST_COST_' $dest_zone);        $postcode_table preg_split("/[:,]/" $postage_cost);        $size sizeof($postcode_table);        $done false;        for ($i=0$i<$size$i+=2) {          switch (MODULE_SHIPPING_UKPOST_METHOD) {              case (MODULE_SHIPPING_UKPOST_METHOD == 'Weight'):              if (round($shipping_weight,9) <= $postcode_table[$i]) {                $shipping $postcode_table[$i+1];
                    switch (
    SHIPPING_BOX_WEIGHT_DISPLAY) {                case (0):                  $show_box_weight '';                  break;                case (1):                  $show_box_weight ' (' $shipping_num_boxes ' ' TEXT_SHIPPING_BOXES ')';                  break;                case (2):                  $show_box_weight ' (' number_format($shipping_weight $shipping_num_boxes,2) . MODULE_SHIPPING_UKPOST_TEXT_UNITS ')';                  break;                default:                  $show_box_weight ' (' $shipping_num_boxes ' x ' number_format($shipping_weight,2) . MODULE_SHIPPING_UKPOST_TEXT_UNITS ')';                  break;                }
                    
    $shipping_method MODULE_SHIPPING_UKPOST_TEXT_WAY ' ' $dest_country $show_box_weight;                $done true;                break;                }              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Price'):            // shipping adjustment              if (($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) <= $postcode_table[$i]) {                $shipping = $postcode_table[$i+1];                $shipping_method = MODULE_SHIPPING_UKPOST_TEXT_WAY . ' ' . $destination_postcode;                $done = true;                break;                }              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Item'):            // shipping adjustment              if (($total_count - $_SESSION['cart']->free_shipping_items()) <= $postcode_table[$i]) {                $shipping = $postcode_table[$i+1];                $shipping_method = MODULE_SHIPPING_UKPOST_TEXT_WAY . ' ' . $destination_postcode;                $done = true;                break;                }              break;          }          if ($done == true) {            break;          }        }        if ($shipping == -1) {          $shipping_cost = 0;          $shipping_method = MODULE_SHIPPING_UKPOST_UNDEFINED_RATE;        } else {          switch (MODULE_SHIPPING_UKPOST_METHOD) {              case (MODULE_SHIPPING_UKPOST_METHOD == 'Weight'):              // no charge per package by Price              $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Price'):              // no charge per package by Price              $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);            break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Item'):              // no charge per package by Item              $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);            break;          }        }      }      $this->quotes = array('id' => $this->code,                            'module' => MODULE_SHIPPING_UKPOST_TEXT_TITLE,                            'methods' => array(array('id' => $this->code,                                                     'title' => $shipping_method,                                                     'cost' => $shipping_cost)));
          
    if ($this->tax_class 0) {        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class$order->delivery['country']['id'], $order->delivery['zone_id']);      }
          if (
    zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon$this->title);
          if (
    $error == true$this->quotes['error'] = MODULE_SHIPPING_UKPOST_INVALID_CODE;
          return 
    $this->quotes;    }
        function 
    check() {      global $db;      if (!isset($this->_check)) {        $check_query $db->Execute("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_UKPOST_STATUS'");        $this->_check $check_query->RecordCount();      }      return $this->_check;    }    // Module Installation    function install() {      global $db;      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable PostCode Method', 'MODULE_SHIPPING_UKPOST_STATUS', 'True', '<img src=http://www.zenned.co.uk/images/logo_sm.gif><br />Do you want to include Zenned! UK postcode based shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Calculation Method', 'MODULE_SHIPPING_UKPOST_METHOD', 'Weight', 'Calculate cost based on Weight, Price or Item?', '6', '0', 'zen_cfg_select_option(array(\'Weight\', \'Price\', \'Item\'), ', now())");      $db->Execute("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_UKPOST_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_UKPOST_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_UKPOST_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
          
    for ($i 1$i <= $this->num_zones$i++) {        $default_postcodes '';        $description '';        $default_value '';        if ($i == 1) {          $default_postcodes 'LEAVE EMPTY';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:7.14,30.0:13.14,35.0:19.18';          $description 'Default Mainland Postcode Zone';        }        if ($i == 2) {          $default_postcodes ='AB31,AB32,AB33,AB34,AB35,AB36,AB37,AB38,AB40,AB41,AB42,AB43,AB44,AB45,AB46,AB47,AB48,AB49,AB50,AB51,AB52,AB53,AB54,AB55,AB56,KW1,KW2,KW3,KW4,KW5,KW6,KW7,KW8,KW9,KW10,KW11,KW12,KW13,KW14,PA21,PA22,PA23,PA24,PA25,PA26,PA27,PA28,PA29,PA30,PA31,PA32,PA33,PA34,PA35,PA36,PA37,PA38,PA39,PA40,PA41,PA45,PA46,PA47,PA48,PA49,PA20,PA42,PA43,PA44,PA60,PA61,PA62,PA63,PA64,PA65,PA66,PA67,PA68,PA69,PA70,PA71,PA72,PA73,PA74,PA75,PA76,PA77,PA78,PH17,PH18,PH19,PH20,PH21,PH22,PH23,PH24,PH25,PH26,PH30,PH31,PH32,PH33,PH34,PH35,PH36,PH37,PH38,PH39,PH40,PH41,PH42,PH43,PH44,PH49,PH50,KA27,KA28,HS1,HS2,HS3,HS4,HS5,HS6,HS7,HS8,HS9,ZE1,ZE2,ZE3,ZE4,IV1,IV2,IV3,IV4,IV5,IV6,IV7,IV8,IV9,IV10,IV11,IV12,IV13,IV14,IV15,IV16,IV17,IV18,IV19,IV20,IV21,IV22,IV23,IV24,IV25,IV26,IV27,IV28,IV29,IV30,IV3,IV32,IV33,IV34,IV35,IV36,IV37,IV38,IV39,IV40,IV41,IV42,IV43,IV44,IV45,IV46,IV47,IV48,IV49,IV50,IV51,IV52,IV53,IV54,IV55,IV56,IV57,IV58,IV59,IV60,IV61,IV62,IV63';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';          $description 'Scottish Highlands & Islands';        }                  if ($i == 3) {          $default_postcodes ='BT1,BT2,BT3,BT4,BT5,BT6,BT7,BT8,BT9,BT10,BT11,BT12,BT13,BT14,BT15,BT16,BT17,BT18,BT19,BT20,BT21,BT22,BT23,BT24,BT25,BT26,BT27,BT28,BT29,BT30,BT31,BT32,BT33,BT34,BT35,BT36,BT37,BT38,BT39,BT40,BT41,BT42,BT43,BT44,BT45,BT46,BT47,BT48,BT49,BT50,BT51,BT52,BT53,BT54,BT55,BT56,BT57,BT58,BT59,BT60,BT61,BT62,BT63,BT64,BT65,BT66,BT67,BT68,BT69,BT70,BT71,BT72,BT73,BT74,BT75,BT76,BT77,BT78,BT79,BT80,BT81,BT82,BT83,BT92,BT93,BT94,IM1,IM2,IM3,IM4,IM5,IM6,IM7,IM8,IM9,TR21,TR22,TR23, TR24,TR25';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';          $description 'Northern Ireland, Isle of Man, Isles of Scilly';        }                if ($i == 4) {          $default_postcodes 'JE1,JE2,JE3,JE4,GY1,GY2,GY3, &,GY4,GY5,GY6,GY7,GY8,GY9,GY10';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:22.53';          $description 'Channel Islands';        }                        $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" $i ."', '" $default_postcodes "', 'UK Post ".$description." - Zone " $i "', '6', '0', 'zen_cfg_textarea(', now())");        $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" $i ."', '" .$default_value"', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " $i " destinations.', '6', '0', 'zen_cfg_textarea(', now())");        $db->Execute("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_UKPOST_HANDLING_" $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");      }    }
        function 
    remove() {      global $db;      $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key in ('" implode("', '"$this->keys()) . "')");    }
        function 
    keys() {      $keys = array('MODULE_SHIPPING_UKPOST_STATUS''MODULE_SHIPPING_UKPOST_METHOD''MODULE_SHIPPING_UKPOST_TAX_CLASS''MODULE_SHIPPING_UKPOST_TAX_BASIS''MODULE_SHIPPING_UKPOST_SORT_ORDER''MODULE_SHIPPING_UKPOST_SKIPPED');
          for (
    $i=1$i<=$this->num_zones$i++) {        $keys[] = 'MODULE_SHIPPING_UKPOST_CODES_' $i;        $keys[] = 'MODULE_SHIPPING_UKPOST_COST_' $i;        $keys[] = 'MODULE_SHIPPING_UKPOST_HANDLING_' $i;      }
          return 
    $keys;    }  }?> 

  2. #2
    Join Date
    Jul 2007
    Posts
    342
    Plugin Contributions
    7

    Default Re: Shipping UK Post codes

    Quote Originally Posted by ianhg View Post
    Zen cart Version 1.5.7 PHP 7

    Module shipping UK Post Codes https://www.zen-cart.com/downloads.php?do=file&id=1238

    For some reason this is not loading the zones postal codes into the database, I have had to add to the database manually. Any ideas?
    PHP Code:
      class ukpost {    var $code$title$description$enabled$num_zones;
        function 
    ukpost() {      $this->code 'ukpost';      $this->title MODULE_SHIPPING_UKPOST_TEXT_TITLE;      $this->description MODULE_SHIPPING_UKPOST_TEXT_DESCRIPTION;      $this->sort_order defined('MODULE_SHIPPING_UKPOST_SORT_ORDER') ? MODULE_SHIPPING_ZONES_SORT_ORDER null;      $this->icon '';      $this->tax_class MODULE_SHIPPING_UKPOST_TAX_CLASS;      $this->tax_basis MODULE_SHIPPING_UKPOST_TAX_BASIS;
          if (
    zen_get_shipping_enabled($this->code)) {        $this->enabled = ((MODULE_SHIPPING_UKPOST_STATUS == 'True') ? true false);      }
          
    // CHANGE THIS SETTING TO INCREASE THE NUMBER OF ZONES      // NOTE... Default Num Zones is set at 4      // You will need to uninstall (if already installed) and reinstall       // to have the changed zones number visible in the admin.      $this->num_zones = 4;    }    // class methods    function quote($method = '') {      global $order, $shipping_weight, $shipping_num_boxes, $total_count;      $destination_postcode = $order->delivery['postcode'];      $pcode = preg_replace('/\s\s*/', '', $destination_postcode);      $len = strlen($pcode); //echo $len."<br>";      if ($len <= 6) {$plen = 3;} else {$plen = 4;}      $destination_pcode = strtoupper(trim(mb_substr($pcode,0,$plen)));      $dest_zone = 0;      $error = false;
          
    for ($i=1$i<=$this->num_zones$i++) {        $postcode_table constant('MODULE_SHIPPING_UKPOST_CODES_' $i);        $post_zones preg_split("/[,]/"$postcode_table);        if (in_array($destination_pcode$post_zones)) {          $dest_zone $i;          break;          }                    else { $dest_zone 1;}        }        if ($order->delivery['country_id'] != 222) {$dest_zone 0;}
          if (
    $dest_zone == 0) {        $error true;      } else {        $shipping = -1;        $postage_cost constant('MODULE_SHIPPING_UKPOST_COST_' $dest_zone);        $postcode_table preg_split("/[:,]/" $postage_cost);        $size sizeof($postcode_table);        $done false;        for ($i=0$i<$size$i+=2) {          switch (MODULE_SHIPPING_UKPOST_METHOD) {              case (MODULE_SHIPPING_UKPOST_METHOD == 'Weight'):              if (round($shipping_weight,9) <= $postcode_table[$i]) {                $shipping $postcode_table[$i+1];
                    switch (
    SHIPPING_BOX_WEIGHT_DISPLAY) {                case (0):                  $show_box_weight '';                  break;                case (1):                  $show_box_weight ' (' $shipping_num_boxes ' ' TEXT_SHIPPING_BOXES ')';                  break;                case (2):                  $show_box_weight ' (' number_format($shipping_weight $shipping_num_boxes,2) . MODULE_SHIPPING_UKPOST_TEXT_UNITS ')';                  break;                default:                  $show_box_weight ' (' $shipping_num_boxes ' x ' number_format($shipping_weight,2) . MODULE_SHIPPING_UKPOST_TEXT_UNITS ')';                  break;                }
                    
    $shipping_method MODULE_SHIPPING_UKPOST_TEXT_WAY ' ' $dest_country $show_box_weight;                $done true;                break;                }              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Price'):            // shipping adjustment              if (($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) <= $postcode_table[$i]) {                $shipping = $postcode_table[$i+1];                $shipping_method = MODULE_SHIPPING_UKPOST_TEXT_WAY . ' ' . $destination_postcode;                $done = true;                break;                }              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Item'):            // shipping adjustment              if (($total_count - $_SESSION['cart']->free_shipping_items()) <= $postcode_table[$i]) {                $shipping = $postcode_table[$i+1];                $shipping_method = MODULE_SHIPPING_UKPOST_TEXT_WAY . ' ' . $destination_postcode;                $done = true;                break;                }              break;          }          if ($done == true) {            break;          }        }        if ($shipping == -1) {          $shipping_cost = 0;          $shipping_method = MODULE_SHIPPING_UKPOST_UNDEFINED_RATE;        } else {          switch (MODULE_SHIPPING_UKPOST_METHOD) {              case (MODULE_SHIPPING_UKPOST_METHOD == 'Weight'):              // no charge per package by Price              $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Price'):              // no charge per package by Price              $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);            break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Item'):              // no charge per package by Item              $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);            break;          }        }      }      $this->quotes = array('id' => $this->code,                            'module' => MODULE_SHIPPING_UKPOST_TEXT_TITLE,                            'methods' => array(array('id' => $this->code,                                                     'title' => $shipping_method,                                                     'cost' => $shipping_cost)));
          
    if ($this->tax_class 0) {        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class$order->delivery['country']['id'], $order->delivery['zone_id']);      }
          if (
    zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon$this->title);
          if (
    $error == true$this->quotes['error'] = MODULE_SHIPPING_UKPOST_INVALID_CODE;
          return 
    $this->quotes;    }
        function 
    check() {      global $db;      if (!isset($this->_check)) {        $check_query $db->Execute("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_UKPOST_STATUS'");        $this->_check $check_query->RecordCount();      }      return $this->_check;    }    // Module Installation    function install() {      global $db;      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable PostCode Method', 'MODULE_SHIPPING_UKPOST_STATUS', 'True', '<img src=http://www.zenned.co.uk/images/logo_sm.gif><br />Do you want to include Zenned! UK postcode based shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Calculation Method', 'MODULE_SHIPPING_UKPOST_METHOD', 'Weight', 'Calculate cost based on Weight, Price or Item?', '6', '0', 'zen_cfg_select_option(array(\'Weight\', \'Price\', \'Item\'), ', now())");      $db->Execute("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_UKPOST_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_UKPOST_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_UKPOST_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
          
    for ($i 1$i <= $this->num_zones$i++) {        $default_postcodes '';        $description '';        $default_value '';        if ($i == 1) {          $default_postcodes 'LEAVE EMPTY';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:7.14,30.0:13.14,35.0:19.18';          $description 'Default Mainland Postcode Zone';        }        if ($i == 2) {          $default_postcodes ='AB31,AB32,AB33,AB34,AB35,AB36,AB37,AB38,AB40,AB41,AB42,AB43,AB44,AB45,AB46,AB47,AB48,AB49,AB50,AB51,AB52,AB53,AB54,AB55,AB56,KW1,KW2,KW3,KW4,KW5,KW6,KW7,KW8,KW9,KW10,KW11,KW12,KW13,KW14,PA21,PA22,PA23,PA24,PA25,PA26,PA27,PA28,PA29,PA30,PA31,PA32,PA33,PA34,PA35,PA36,PA37,PA38,PA39,PA40,PA41,PA45,PA46,PA47,PA48,PA49,PA20,PA42,PA43,PA44,PA60,PA61,PA62,PA63,PA64,PA65,PA66,PA67,PA68,PA69,PA70,PA71,PA72,PA73,PA74,PA75,PA76,PA77,PA78,PH17,PH18,PH19,PH20,PH21,PH22,PH23,PH24,PH25,PH26,PH30,PH31,PH32,PH33,PH34,PH35,PH36,PH37,PH38,PH39,PH40,PH41,PH42,PH43,PH44,PH49,PH50,KA27,KA28,HS1,HS2,HS3,HS4,HS5,HS6,HS7,HS8,HS9,ZE1,ZE2,ZE3,ZE4,IV1,IV2,IV3,IV4,IV5,IV6,IV7,IV8,IV9,IV10,IV11,IV12,IV13,IV14,IV15,IV16,IV17,IV18,IV19,IV20,IV21,IV22,IV23,IV24,IV25,IV26,IV27,IV28,IV29,IV30,IV3,IV32,IV33,IV34,IV35,IV36,IV37,IV38,IV39,IV40,IV41,IV42,IV43,IV44,IV45,IV46,IV47,IV48,IV49,IV50,IV51,IV52,IV53,IV54,IV55,IV56,IV57,IV58,IV59,IV60,IV61,IV62,IV63';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';          $description 'Scottish Highlands & Islands';        }                  if ($i == 3) {          $default_postcodes ='BT1,BT2,BT3,BT4,BT5,BT6,BT7,BT8,BT9,BT10,BT11,BT12,BT13,BT14,BT15,BT16,BT17,BT18,BT19,BT20,BT21,BT22,BT23,BT24,BT25,BT26,BT27,BT28,BT29,BT30,BT31,BT32,BT33,BT34,BT35,BT36,BT37,BT38,BT39,BT40,BT41,BT42,BT43,BT44,BT45,BT46,BT47,BT48,BT49,BT50,BT51,BT52,BT53,BT54,BT55,BT56,BT57,BT58,BT59,BT60,BT61,BT62,BT63,BT64,BT65,BT66,BT67,BT68,BT69,BT70,BT71,BT72,BT73,BT74,BT75,BT76,BT77,BT78,BT79,BT80,BT81,BT82,BT83,BT92,BT93,BT94,IM1,IM2,IM3,IM4,IM5,IM6,IM7,IM8,IM9,TR21,TR22,TR23, TR24,TR25';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';          $description 'Northern Ireland, Isle of Man, Isles of Scilly';        }                if ($i == 4) {          $default_postcodes 'JE1,JE2,JE3,JE4,GY1,GY2,GY3, &,GY4,GY5,GY6,GY7,GY8,GY9,GY10';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:22.53';          $description 'Channel Islands';        }                        $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" $i ."', '" $default_postcodes "', 'UK Post ".$description." - Zone " $i "', '6', '0', 'zen_cfg_textarea(', now())");        $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" $i ."', '" .$default_value"', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " $i " destinations.', '6', '0', 'zen_cfg_textarea(', now())");        $db->Execute("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_UKPOST_HANDLING_" $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");      }    }
        function 
    remove() {      global $db;      $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key in ('" implode("', '"$this->keys()) . "')");    }
        function 
    keys() {      $keys = array('MODULE_SHIPPING_UKPOST_STATUS''MODULE_SHIPPING_UKPOST_METHOD''MODULE_SHIPPING_UKPOST_TAX_CLASS''MODULE_SHIPPING_UKPOST_TAX_BASIS''MODULE_SHIPPING_UKPOST_SORT_ORDER''MODULE_SHIPPING_UKPOST_SKIPPED');
          for (
    $i=1$i<=$this->num_zones$i++) {        $keys[] = 'MODULE_SHIPPING_UKPOST_CODES_' $i;        $keys[] = 'MODULE_SHIPPING_UKPOST_COST_' $i;        $keys[] = 'MODULE_SHIPPING_UKPOST_HANDLING_' $i;      }
          return 
    $keys;    }  }?> 
    I am still struggling with this. Can anyone please point me in the right direction. So the problem is that postal codes and prices are not loading into the database. It all works ok if I manually update the database. So I guess the problem is with this:
    PHP Code:
    // Module Installation    function install() {      global $db;      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable PostCode Method', 'MODULE_SHIPPING_UKPOST_STATUS', 'True', 'UK postcode based shipping', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Calculation Method', 'MODULE_SHIPPING_UKPOST_METHOD', 'Weight', 'Calculate cost based on Weight, Price or Item?', '6', '0', 'zen_cfg_select_option(array(\'Weight\', \'Price\', \'Item\'), ', now())");      $db->Execute("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_UKPOST_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_UKPOST_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_UKPOST_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
          
    for ($i 1$i <= $this->num_zones$i++){        $default_postcodes '';        $description '';        $default_value '';        }                 if ($i == 1) {        $default_postcodes 'LEAVE EMPTY';      $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:7.14,30.0:13.14,35.0:19.18';       $description 'Default Mainland Postcode Zone';    }        if ($i == 2) {        $default_postcodes ='AB31,AB32,AB33,AB34,AB35,AB36,AB37,AB38,AB40,AB41,AB42,AB43,AB44,AB45,AB46,AB47,AB48,AB49,AB50,AB51,AB52,AB53,AB54,AB55,AB56,KW1,KW2,KW3,KW4,KW5,KW6,KW7,KW8,KW9,KW10,KW11,KW12,KW13,KW14,PA21,PA22,PA23,PA24,PA25,PA26,PA27,PA28,PA29,PA30,PA31,PA32,PA33,PA34,PA35,PA36,PA37,PA38,PA39,PA40,PA41,PA45,PA46,PA47,PA48,PA49,PA20,PA42,PA43,PA44,PA60,PA61,PA62,PA63,PA64,PA65,PA66,PA67,PA68,PA69,PA70,PA71,PA72,PA73,PA74,PA75,PA76,PA77,PA78,PH17,PH18,PH19,PH20,PH21,PH22,PH23,PH24,PH25,PH26,PH30,PH31,PH32,PH33,PH34,PH35,PH36,PH37,PH38,PH39,PH40,PH41,PH42,PH43,PH44,PH49,PH50,KA27,KA28,HS1,HS2,HS3,HS4,HS5,HS6,HS7,HS8,HS9,ZE1,ZE2,ZE3,ZE4,IV1,IV2,IV3,IV4,IV5,IV6,IV7,IV8,IV9,IV10,IV11,IV12,IV13,IV14,IV15,IV16,IV17,IV18,IV19,IV20,IV21,IV22,IV23,IV24,IV25,IV26,IV27,IV28,IV29,IV30,IV3,IV32,IV33,IV34,IV35,IV36,IV37,IV38,IV39,IV40,IV41,IV42,IV43,IV44,IV45,IV46,IV47,IV48,IV49,IV50,IV51,IV52,IV53,IV54,IV55,IV56,IV57,IV58,IV59,IV60,IV61,IV62,IV63';       $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50       ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Scottish Highlands & Islands';           }               if ($i == 3)  {         $default_postcodes ='BT1,BT2,BT3,BT4,BT5,BT6,BT7,BT8,BT9,BT10,BT11,BT12,BT13,BT14,BT15,BT16,BT17,BT18,BT19,BT20,BT21,BT22,BT23,BT24,BT25,BT26,BT27,BT28,BT29,BT30,BT31,BT32,BT33,BT34,BT35,BT36,BT37,BT38,BT39,BT40,BT41,BT42,BT43,BT44,BT45,BT46,BT47,BT48,BT49,BT50,BT51,BT52,BT53,BT54,BT55,BT56,BT57,BT58,BT59,BT60,BT61,BT62,BT63,BT64,BT65,BT66,BT67,BT68,BT69,BT70,BT71,BT72,BT73,BT74,BT75,BT76,BT77,BT78,BT79,BT80,BT81,BT82,BT83,BT92,BT93,BT94,IM1,IM2,IM3,IM4,IM5,IM6,IM7,IM8,IM9,TR21,TR22,TR23, TR24,TR25';   $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Northern Ireland, Isle of Man, Isles of Scilly';           }            if ($i == 4)  {         $default_postcodes 'JE1,JE2,JE3,JE4,GY1,GY2,GY3, &,GY4,GY5,GY6,GY7,GY8,GY9,GY10';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:22.53';          $description 'Channel Islands';        }                      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" $i ."', '" $default_postcodes "', 'UK Post ".$description." - Zone " $i "', '6', '0', 'zen_cfg_textarea(', now())");      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" $i ."', '" .$default_value"', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " $i " destinations.', '6', '0', 'zen_cfg_textarea(', now())");     $db->Execute("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_UKPOST_HANDLING_" $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");    
        } 
    Can someone please suggest a solution, using 1.5.7 PHP 7.4
    Many Thanks

  3. #3
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,691
    Plugin Contributions
    9

    Default Re: Shipping UK Post codes

    ian,
    are you on windows? the line feeds are not showing up in your code postings on this thread.

    for me, it makes it really hard to read the code and possibly provide some guidance.

    also, i take it you have looked for any log files?

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  4. #4
    Join Date
    Jul 2007
    Posts
    342
    Plugin Contributions
    7

    Default Re: Shipping UK Post codes

    Quote Originally Posted by carlwhat View Post
    ian,
    are you on windows? the line feeds are not showing up in your code postings on this thread.

    for me, it makes it really hard to read the code and possibly provide some guidance.

    also, i take it you have looked for any log files?

    best.
    Thanks for your speedy reply. No I am on a Mac. No Log files it just does not enter the post codes or prices. There should be 4 zones, I have managed to get the first zone to load but not the others. I have used this plugin several times but never encountered this issue. So I am presuming that it might be something to do with PHP 7.4 maybe. Hopefully you can see this OK. I was hoping to resolve the problem with this so i could update the plugin but I think I am out of my depth. I tried several different things yesterday based on the Zones shipping, but without any results. The plugin loads apart from the MODULE_SHIPPING_UKPOST_CODES_ & MODULE_SHIPPING_UKPOST_COST_ & MODULE_SHIPPING_UKPOST_HANDLING_
    If I add these to the database manually the plugin works fine and you can change the prices etc.

    PHP Code:
    // Module Installation//        function install() {      global $db;      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable PostCode Method', 'MODULE_SHIPPING_UKPOST_STATUS', 'True', 'UK postcode based shipping', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Calculation Method', 'MODULE_SHIPPING_UKPOST_METHOD', 'Weight', 'Calculate cost based on Weight, Price or Item?', '6', '0', 'zen_cfg_select_option(array(\'Weight\', \'Price\', \'Item\'), ', now())");      $db->Execute("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_UKPOST_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_UKPOST_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_UKPOST_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
          
    for ($i 1$i <= $this->num_zones$i++){        $default_postcodes '';        $description '';        $default_value '';        }                 if ($i == 1) {        $default_postcodes 'LEAVE EMPTY';      $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:7.14,30.0:13.14,35.0:19.18';       $description 'Default Mainland Postcode Zone';    }        if ($i == 2) {        $default_postcodes ='AB31,AB32,AB33,AB34,AB35,AB36,AB37,AB38,AB40,AB41,AB42,AB43,AB44,AB45,AB46,AB47,AB48,AB49,AB50,AB51,AB52,AB53,AB54,AB55,AB56,KW1,KW2,KW3,KW4,KW5,KW6,KW7,KW8,KW9,KW10,KW11,KW12,KW13,KW14,PA21,PA22,PA23,PA24,PA25,PA26,PA27,PA28,PA29,PA30,PA31,PA32,PA33,PA34,PA35,PA36,PA37,PA38,PA39,PA40,PA41,PA45,PA46,PA47,PA48,PA49,PA20,PA42,PA43,PA44,PA60,PA61,PA62,PA63,PA64,PA65,PA66,PA67,PA68,PA69,PA70,PA71,PA72,PA73,PA74,PA75,PA76,PA77,PA78,PH17,PH18,PH19,PH20,PH21,PH22,PH23,PH24,PH25,PH26,PH30,PH31,PH32,PH33,PH34,PH35,PH36,PH37,PH38,PH39,PH40,PH41,PH42,PH43,PH44,PH49,PH50,KA27,KA28,HS1,HS2,HS3,HS4,HS5,HS6,HS7,HS8,HS9,ZE1,ZE2,ZE3,ZE4,IV1,IV2,IV3,IV4,IV5,IV6,IV7,IV8,IV9,IV10,IV11,IV12,IV13,IV14,IV15,IV16,IV17,IV18,IV19,IV20,IV21,IV22,IV23,IV24,IV25,IV26,IV27,IV28,IV29,IV30,IV3,IV32,IV33,IV34,IV35,IV36,IV37,IV38,IV39,IV40,IV41,IV42,IV43,IV44,IV45,IV46,IV47,IV48,IV49,IV50,IV51,IV52,IV53,IV54,IV55,IV56,IV57,IV58,IV59,IV60,IV61,IV62,IV63';       $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50       ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Scottish Highlands & Islands';           }               if ($i == 3)  {         $default_postcodes ='BT1,BT2,BT3,BT4,BT5,BT6,BT7,BT8,BT9,BT10,BT11,BT12,BT13,BT14,BT15,BT16,BT17,BT18,BT19,BT20,BT21,BT22,BT23,BT24,BT25,BT26,BT27,BT28,BT29,BT30,BT31,BT32,BT33,BT34,BT35,BT36,BT37,BT38,BT39,BT40,BT41,BT42,BT43,BT44,BT45,BT46,BT47,BT48,BT49,BT50,BT51,BT52,BT53,BT54,BT55,BT56,BT57,BT58,BT59,BT60,BT61,BT62,BT63,BT64,BT65,BT66,BT67,BT68,BT69,BT70,BT71,BT72,BT73,BT74,BT75,BT76,BT77,BT78,BT79,BT80,BT81,BT82,BT83,BT92,BT93,BT94,IM1,IM2,IM3,IM4,IM5,IM6,IM7,IM8,IM9,TR21,TR22,TR23, TR24,TR25';   $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Northern Ireland, Isle of Man, Isles of Scilly';           }            if ($i == 4)  {         $default_postcodes 'JE1,JE2,JE3,JE4,GY1,GY2,GY3, &,GY4,GY5,GY6,GY7,GY8,GY9,GY10';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:22.53';          $description 'Channel Islands';        }                      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" $i ."', '" $default_postcodes "', 'UK Post ".$description." - Zone " $i "', '6', '0', 'zen_cfg_textarea(', now())");      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" $i ."', '" .$default_value"', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " $i " destinations.', '6', '0', 'zen_cfg_textarea(', now())");     $db->Execute("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_UKPOST_HANDLING_" $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");    
        } 
    This the full php
    PHP Code:

      
    class ukpost extends base {    var $code$title$description$icon$enabled$num_zones;// class constructor    function __construct() {    global $db;      $this->code = 'ukpost';      $this->title = MODULE_SHIPPING_UKPOST_TEXT_TITLE;      $this->description = MODULE_SHIPPING_UKPOST_TEXT_DESCRIPTION;      $this->sort_order = defined('MODULE_SHIPPING_UKPOST_SORT_ORDER') ? MODULE_SHIPPING_UKPOST_SORT_ORDER : null;      if (null === $this->sort_order) return false;            $this->icon = '';      $this->tax_class = MODULE_SHIPPING_UKPOST_TAX_CLASS;      $this->tax_basis = MODULE_SHIPPING_UKPOST_TAX_BASIS;// disable only when entire cart is free shipping      if (zen_get_shipping_enabled($this->code)) {        $this->enabled = ((MODULE_SHIPPING_UKPOST_STATUS == 'True') ? true : false);      }
          // CHANGE THIS SETTING TO INCREASE THE NUMBER OF ZONES      // NOTE... Default Num Zones is set at 4      // You will need to uninstall (if already installed) and reinstall       // to have the changed zones number visible in the admin.      $this->num_zones = 4;                   // if (IS_ADMIN_FLAG === true) { // global $db; // for ($i = 1; $i <= $this->num_zones; $i++) { //  $check = $db->Execute("select * from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_UKPOST_". $i ."'");  // if ($this->enabled && $check->EOF){  //  $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " . $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" . $i ."', '" . $default_postcodes . "', 'UK Post ".$description." - Zone " . $i . "', '6', '0', 'zen_cfg_textarea(', now())");  //       $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" . $i ."', '" .$default_value. "', 'Shipping rates to Zone " . $i . " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " . $i . " destinations.', '6', '0', 'zen_cfg_textarea(', now())");  //       $db->Execute("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_UKPOST_HANDLING_" . $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())"); // } // }  // }      if ($this->enabled){   global $db;   for ($i = 1; $i <= $this->num_zones; $i++) {//  $check_query = $db->Execute("select configuration_value from" . TABLE_CONFIGURATION ." where configuration_key = 'MODULE_SHIPPING_UKPOST_HANDLING_METHOD'");//   if ($check_query->EOF){ //db->Execute("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_UKPOST_HANDLING_" . $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())"); //   }//   } } }   }       // class methods    function quote($method = '') {      global $order, $shipping_weight, $shipping_num_boxes, $total_count;      $destination_postcode = $order->delivery['postcode'];      $pcode = preg_replace('/\s\s*/', '', $destination_postcode);      $len = strlen($pcode); //echo $len."<br>";      if ($len <= 6) {$plen = 3;} else {$plen = 4;}      $destination_pcode = strtoupper(trim(mb_substr($pcode,0,$plen)));      $dest_zone = 0;      $error = false;
          
    for ($i=1$i<=$this->num_zones$i++) {        $postcode_table constant('MODULE_SHIPPING_UKPOST_CODES_' $i);        $post_zones preg_split("/[,]/"$postcode_table);        if (in_array($destination_pcode$post_zones)) {          $dest_zone $i;          break;          }                    else { $dest_zone 1;}        }        if ($order->delivery['country_id'] != 222) {$dest_zone 0;}
          if (
    $dest_zone == 0) {        $error true;      } else {        $shipping = -1;        $postage_cost constant('MODULE_SHIPPING_UKPOST_COST_' $dest_zone);        $postcode_table preg_split("/[:,]/" $postage_cost);        $size sizeof($postcode_table);        $done false;        for ($i=0$i<$size$i+=2) {          switch (MODULE_SHIPPING_UKPOST_METHOD) {              case (MODULE_SHIPPING_UKPOST_METHOD == 'Weight'):              if (round($shipping_weight,9) <= $postcode_table[$i]) {                $shipping $postcode_table[$i+1];
                    switch (
    SHIPPING_BOX_WEIGHT_DISPLAY) {                case (0):                  $show_box_weight '';                  break;                case (1):                  $show_box_weight ' (' $shipping_num_boxes ' ' TEXT_SHIPPING_BOXES ')';                  break;                case (2):                  $show_box_weight ' (' number_format($shipping_weight $shipping_num_boxes,2) . MODULE_SHIPPING_UKPOST_TEXT_UNITS ')';                  break;                default:                  $show_box_weight ' (' $shipping_num_boxes ' x ' number_format($shipping_weight,2) . MODULE_SHIPPING_UKPOST_TEXT_UNITS ')';                  break;                }
                    
    $shipping_method MODULE_SHIPPING_UKPOST_TEXT_WAY ' ' $dest_country $show_box_weight;                $done true;                break;                }              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Price'):            // shipping adjustment              if (($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) <= $postcode_table[$i]) {                $shipping = $postcode_table[$i+1];                $shipping_method = MODULE_SHIPPING_UKPOST_TEXT_WAY . ' ' . $destination_postcode;                $done = true;                break;                }              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Item'):            // shipping adjustment              if (($total_count - $_SESSION['cart']->free_shipping_items()) <= $postcode_table[$i]) {                $shipping = $postcode_table[$i+1];                $shipping_method = MODULE_SHIPPING_UKPOST_TEXT_WAY . ' ' . $destination_postcode;                $done = true;                break;                }              break;          }          if ($done == true) {            break;          }        }        if ($shipping == -1) {          $shipping_cost = 0;          $shipping_method = MODULE_SHIPPING_UKPOST_UNDEFINED_RATE;        } else {          switch (MODULE_SHIPPING_UKPOST_METHOD) {              case (MODULE_SHIPPING_UKPOST_METHOD == 'Weight'):              // no charge per package by Price              $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Price'):              // no charge per package by Price              $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);            break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Item'):              // no charge per package by Item              $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);            break;          }        }      }      $this->quotes = array('id' => $this->code,                            'module' => MODULE_SHIPPING_UKPOST_TEXT_TITLE,                            'methods' => array(array('id' => $this->code,                                                     'title' => $shipping_method,                                                     'cost' => $shipping_cost)));
          
    if ($this->tax_class 0) {        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class$order->delivery['country']['id'], $order->delivery['zone_id']);      }
          if (
    zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon$this->title);
          if (
    $error == true$this->quotes['error'] = MODULE_SHIPPING_UKPOST_INVALID_CODE;
          return 
    $this->quotes;    }
        function 
    check() {      global $db;      if (!isset($this->_check)) {        $check_query $db->Execute("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_UKPOST_STATUS'");        $this->_check $check_query->RecordCount();      }      return $this->_check;    }    // Module Installation//        function install() {      global $db;      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable PostCode Method', 'MODULE_SHIPPING_UKPOST_STATUS', 'True', 'UK postcode based shipping', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Calculation Method', 'MODULE_SHIPPING_UKPOST_METHOD', 'Weight', 'Calculate cost based on Weight, Price or Item?', '6', '0', 'zen_cfg_select_option(array(\'Weight\', \'Price\', \'Item\'), ', now())");      $db->Execute("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_UKPOST_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_UKPOST_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_UKPOST_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
          
    for ($i 1$i <= $this->num_zones$i++){        $default_postcodes '';        $description '';        $default_value '';        }                 if ($i == 1) {        $default_postcodes 'LEAVE EMPTY';      $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:7.14,30.0:13.14,35.0:19.18';       $description 'Default Mainland Postcode Zone';    }        if ($i == 2) {        $default_postcodes ='AB31,AB32,AB33,AB34,AB35,AB36,AB37,AB38,AB40,AB41,AB42,AB43,AB44,AB45,AB46,AB47,AB48,AB49,AB50,AB51,AB52,AB53,AB54,AB55,AB56,KW1,KW2,KW3,KW4,KW5,KW6,KW7,KW8,KW9,KW10,KW11,KW12,KW13,KW14,PA21,PA22,PA23,PA24,PA25,PA26,PA27,PA28,PA29,PA30,PA31,PA32,PA33,PA34,PA35,PA36,PA37,PA38,PA39,PA40,PA41,PA45,PA46,PA47,PA48,PA49,PA20,PA42,PA43,PA44,PA60,PA61,PA62,PA63,PA64,PA65,PA66,PA67,PA68,PA69,PA70,PA71,PA72,PA73,PA74,PA75,PA76,PA77,PA78,PH17,PH18,PH19,PH20,PH21,PH22,PH23,PH24,PH25,PH26,PH30,PH31,PH32,PH33,PH34,PH35,PH36,PH37,PH38,PH39,PH40,PH41,PH42,PH43,PH44,PH49,PH50,KA27,KA28,HS1,HS2,HS3,HS4,HS5,HS6,HS7,HS8,HS9,ZE1,ZE2,ZE3,ZE4,IV1,IV2,IV3,IV4,IV5,IV6,IV7,IV8,IV9,IV10,IV11,IV12,IV13,IV14,IV15,IV16,IV17,IV18,IV19,IV20,IV21,IV22,IV23,IV24,IV25,IV26,IV27,IV28,IV29,IV30,IV3,IV32,IV33,IV34,IV35,IV36,IV37,IV38,IV39,IV40,IV41,IV42,IV43,IV44,IV45,IV46,IV47,IV48,IV49,IV50,IV51,IV52,IV53,IV54,IV55,IV56,IV57,IV58,IV59,IV60,IV61,IV62,IV63';       $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50       ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Scottish Highlands & Islands';           }               if ($i == 3)  {         $default_postcodes ='BT1,BT2,BT3,BT4,BT5,BT6,BT7,BT8,BT9,BT10,BT11,BT12,BT13,BT14,BT15,BT16,BT17,BT18,BT19,BT20,BT21,BT22,BT23,BT24,BT25,BT26,BT27,BT28,BT29,BT30,BT31,BT32,BT33,BT34,BT35,BT36,BT37,BT38,BT39,BT40,BT41,BT42,BT43,BT44,BT45,BT46,BT47,BT48,BT49,BT50,BT51,BT52,BT53,BT54,BT55,BT56,BT57,BT58,BT59,BT60,BT61,BT62,BT63,BT64,BT65,BT66,BT67,BT68,BT69,BT70,BT71,BT72,BT73,BT74,BT75,BT76,BT77,BT78,BT79,BT80,BT81,BT82,BT83,BT92,BT93,BT94,IM1,IM2,IM3,IM4,IM5,IM6,IM7,IM8,IM9,TR21,TR22,TR23, TR24,TR25';   $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Northern Ireland, Isle of Man, Isles of Scilly';           }            if ($i == 4)  {         $default_postcodes 'JE1,JE2,JE3,JE4,GY1,GY2,GY3, &,GY4,GY5,GY6,GY7,GY8,GY9,GY10';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:22.53';          $description 'Channel Islands';        }                      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" $i ."', '" $default_postcodes "', 'UK Post ".$description." - Zone " $i "', '6', '0', 'zen_cfg_textarea(', now())");      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" $i ."', '" .$default_value"', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " $i " destinations.', '6', '0', 'zen_cfg_textarea(', now())");     $db->Execute("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_UKPOST_HANDLING_" $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");    
        }
        function 
    remove() {      global $db;      $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key like 'MODULE\_SHIPPING\_UKPOST\_%'");    }
        function 
    keys() {      $keys = array('MODULE_SHIPPING_UKPOST_STATUS''MODULE_SHIPPING_UKPOST_METHOD''MODULE_SHIPPING_UKPOST_TAX_CLASS''MODULE_SHIPPING_UKPOST_TAX_BASIS''MODULE_SHIPPING_UKPOST_SORT_ORDER''MODULE_SHIPPING_UKPOST_SKIPPED');
          for (
    $i=1$i<=$this->num_zones$i++) {        $keys[] = 'MODULE_SHIPPING_UKPOST_CODES_' $i;        $keys[] = 'MODULE_SHIPPING_UKPOST_COST_' $i;        $keys[] = 'MODULE_SHIPPING_UKPOST_HANDLING_' $i;      }
          return 
    $keys;    }  }?> 

  5. #5
    Join Date
    Jul 2007
    Posts
    342
    Plugin Contributions
    7

    Default Re: Shipping UK Post codes

    PHP Code:
    <?php
     
    class ukpost extends base {    var $code$title$description$icon$enabled$num_zones;// class constructor    function __construct() {    global $db;      $this->code = 'ukpost';      $this->title = MODULE_SHIPPING_UKPOST_TEXT_TITLE;      $this->description = MODULE_SHIPPING_UKPOST_TEXT_DESCRIPTION;      $this->sort_order = defined('MODULE_SHIPPING_UKPOST_SORT_ORDER') ? MODULE_SHIPPING_UKPOST_SORT_ORDER : null;      if (null === $this->sort_order) return false;            $this->icon = '';      $this->tax_class = MODULE_SHIPPING_UKPOST_TAX_CLASS;      $this->tax_basis = MODULE_SHIPPING_UKPOST_TAX_BASIS;// disable only when entire cart is free shipping      if (zen_get_shipping_enabled($this->code)) {        $this->enabled = ((MODULE_SHIPPING_UKPOST_STATUS == 'True') ? true : false);      }
          // CHANGE THIS SETTING TO INCREASE THE NUMBER OF ZONES      // NOTE... Default Num Zones is set at 4      // You will need to uninstall (if already installed) and reinstall       // to have the changed zones number visible in the admin.      $this->num_zones = 4;                   // if (IS_ADMIN_FLAG === true) { // global $db; // for ($i = 1; $i <= $this->num_zones; $i++) { //  $check = $db->Execute("select * from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_UKPOST_". $i ."'");  // if ($this->enabled && $check->EOF){  //  $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " . $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" . $i ."', '" . $default_postcodes . "', 'UK Post ".$description." - Zone " . $i . "', '6', '0', 'zen_cfg_textarea(', now())");  //       $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" . $i ."', '" .$default_value. "', 'Shipping rates to Zone " . $i . " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " . $i . " destinations.', '6', '0', 'zen_cfg_textarea(', now())");  //       $db->Execute("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_UKPOST_HANDLING_" . $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())"); // } // }  // }      if ($this->enabled){   global $db;   for ($i = 1; $i <= $this->num_zones; $i++) {//  $check_query = $db->Execute("select configuration_value from" . TABLE_CONFIGURATION ." where configuration_key = 'MODULE_SHIPPING_UKPOST_HANDLING_METHOD'");//   if ($check_query->EOF){ //db->Execute("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_UKPOST_HANDLING_" . $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())"); //   }//   } } }   }       // class methods    function quote($method = '') {      global $order, $shipping_weight, $shipping_num_boxes, $total_count;      $destination_postcode = $order->delivery['postcode'];      $pcode = preg_replace('/\s\s*/', '', $destination_postcode);      $len = strlen($pcode); //echo $len."<br>";      if ($len <= 6) {$plen = 3;} else {$plen = 4;}      $destination_pcode = strtoupper(trim(mb_substr($pcode,0,$plen)));      $dest_zone = 0;      $error = false;
          
    for ($i=1$i<=$this->num_zones$i++) {        $postcode_table constant('MODULE_SHIPPING_UKPOST_CODES_' $i);        $post_zones preg_split("/[,]/"$postcode_table);        if (in_array($destination_pcode$post_zones)) {          $dest_zone $i;          break;          }                    else { $dest_zone 1;}        }        if ($order->delivery['country_id'] != 222) {$dest_zone 0;}
          if (
    $dest_zone == 0) {        $error true;      } else {        $shipping = -1;        $postage_cost constant('MODULE_SHIPPING_UKPOST_COST_' $dest_zone);        $postcode_table preg_split("/[:,]/" $postage_cost);        $size sizeof($postcode_table);        $done false;        for ($i=0$i<$size$i+=2) {          switch (MODULE_SHIPPING_UKPOST_METHOD) {              case (MODULE_SHIPPING_UKPOST_METHOD == 'Weight'):              if (round($shipping_weight,9) <= $postcode_table[$i]) {                $shipping $postcode_table[$i+1];
                    switch (
    SHIPPING_BOX_WEIGHT_DISPLAY) {                case (0):                  $show_box_weight '';                  break;                case (1):                  $show_box_weight ' (' $shipping_num_boxes ' ' TEXT_SHIPPING_BOXES ')';                  break;                case (2):                  $show_box_weight ' (' number_format($shipping_weight $shipping_num_boxes,2) . MODULE_SHIPPING_UKPOST_TEXT_UNITS ')';                  break;                default:                  $show_box_weight ' (' $shipping_num_boxes ' x ' number_format($shipping_weight,2) . MODULE_SHIPPING_UKPOST_TEXT_UNITS ')';                  break;                }
                    
    $shipping_method MODULE_SHIPPING_UKPOST_TEXT_WAY ' ' $dest_country $show_box_weight;                $done true;                break;                }              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Price'):            // shipping adjustment              if (($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) <= $postcode_table[$i]) {                $shipping = $postcode_table[$i+1];                $shipping_method = MODULE_SHIPPING_UKPOST_TEXT_WAY . ' ' . $destination_postcode;                $done = true;                break;                }              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Item'):            // shipping adjustment              if (($total_count - $_SESSION['cart']->free_shipping_items()) <= $postcode_table[$i]) {                $shipping = $postcode_table[$i+1];                $shipping_method = MODULE_SHIPPING_UKPOST_TEXT_WAY . ' ' . $destination_postcode;                $done = true;                break;                }              break;          }          if ($done == true) {            break;          }        }        if ($shipping == -1) {          $shipping_cost = 0;          $shipping_method = MODULE_SHIPPING_UKPOST_UNDEFINED_RATE;        } else {          switch (MODULE_SHIPPING_UKPOST_METHOD) {              case (MODULE_SHIPPING_UKPOST_METHOD == 'Weight'):              // no charge per package by Price              $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Price'):              // no charge per package by Price              $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);            break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Item'):              // no charge per package by Item              $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);            break;          }        }      }      $this->quotes = array('id' => $this->code,                            'module' => MODULE_SHIPPING_UKPOST_TEXT_TITLE,                            'methods' => array(array('id' => $this->code,                                                     'title' => $shipping_method,                                                     'cost' => $shipping_cost)));
          
    if ($this->tax_class 0) {        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class$order->delivery['country']['id'], $order->delivery['zone_id']);      }
          if (
    zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon$this->title);
          if (
    $error == true$this->quotes['error'] = MODULE_SHIPPING_UKPOST_INVALID_CODE;
          return 
    $this->quotes;    }
        function 
    check() {      global $db;      if (!isset($this->_check)) {        $check_query $db->Execute("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_UKPOST_STATUS'");        $this->_check $check_query->RecordCount();      }      return $this->_check;    }    // Module Installation//        function install() {      global $db;      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable PostCode Method', 'MODULE_SHIPPING_UKPOST_STATUS', 'True', 'UK postcode based shipping', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Calculation Method', 'MODULE_SHIPPING_UKPOST_METHOD', 'Weight', 'Calculate cost based on Weight, Price or Item?', '6', '0', 'zen_cfg_select_option(array(\'Weight\', \'Price\', \'Item\'), ', now())");      $db->Execute("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_UKPOST_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_UKPOST_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_UKPOST_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
          
    for ($i 1$i <= $this->num_zones$i++){        $default_postcodes '';        $description '';        $default_value '';        }                 if ($i == 1) {        $default_postcodes 'LEAVE EMPTY';      $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:7.14,30.0:13.14,35.0:19.18';       $description 'Default Mainland Postcode Zone';    }        if ($i == 2) {        $default_postcodes ='AB31,AB32,AB33,AB34,AB35,AB36,AB37,AB38,AB40,AB41,AB42,AB43,AB44,AB45,AB46,AB47,AB48,AB49,AB50,AB51,AB52,AB53,AB54,AB55,AB56,KW1,KW2,KW3,KW4,KW5,KW6,KW7,KW8,KW9,KW10,KW11,KW12,KW13,KW14,PA21,PA22,PA23,PA24,PA25,PA26,PA27,PA28,PA29,PA30,PA31,PA32,PA33,PA34,PA35,PA36,PA37,PA38,PA39,PA40,PA41,PA45,PA46,PA47,PA48,PA49,PA20,PA42,PA43,PA44,PA60,PA61,PA62,PA63,PA64,PA65,PA66,PA67,PA68,PA69,PA70,PA71,PA72,PA73,PA74,PA75,PA76,PA77,PA78,PH17,PH18,PH19,PH20,PH21,PH22,PH23,PH24,PH25,PH26,PH30,PH31,PH32,PH33,PH34,PH35,PH36,PH37,PH38,PH39,PH40,PH41,PH42,PH43,PH44,PH49,PH50,KA27,KA28,HS1,HS2,HS3,HS4,HS5,HS6,HS7,HS8,HS9,ZE1,ZE2,ZE3,ZE4,IV1,IV2,IV3,IV4,IV5,IV6,IV7,IV8,IV9,IV10,IV11,IV12,IV13,IV14,IV15,IV16,IV17,IV18,IV19,IV20,IV21,IV22,IV23,IV24,IV25,IV26,IV27,IV28,IV29,IV30,IV3,IV32,IV33,IV34,IV35,IV36,IV37,IV38,IV39,IV40,IV41,IV42,IV43,IV44,IV45,IV46,IV47,IV48,IV49,IV50,IV51,IV52,IV53,IV54,IV55,IV56,IV57,IV58,IV59,IV60,IV61,IV62,IV63';       $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50       ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Scottish Highlands & Islands';           }               if ($i == 3)  {         $default_postcodes ='BT1,BT2,BT3,BT4,BT5,BT6,BT7,BT8,BT9,BT10,BT11,BT12,BT13,BT14,BT15,BT16,BT17,BT18,BT19,BT20,BT21,BT22,BT23,BT24,BT25,BT26,BT27,BT28,BT29,BT30,BT31,BT32,BT33,BT34,BT35,BT36,BT37,BT38,BT39,BT40,BT41,BT42,BT43,BT44,BT45,BT46,BT47,BT48,BT49,BT50,BT51,BT52,BT53,BT54,BT55,BT56,BT57,BT58,BT59,BT60,BT61,BT62,BT63,BT64,BT65,BT66,BT67,BT68,BT69,BT70,BT71,BT72,BT73,BT74,BT75,BT76,BT77,BT78,BT79,BT80,BT81,BT82,BT83,BT92,BT93,BT94,IM1,IM2,IM3,IM4,IM5,IM6,IM7,IM8,IM9,TR21,TR22,TR23, TR24,TR25';   $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Northern Ireland, Isle of Man, Isles of Scilly';           }            if ($i == 4)  {         $default_postcodes 'JE1,JE2,JE3,JE4,GY1,GY2,GY3, &,GY4,GY5,GY6,GY7,GY8,GY9,GY10';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:22.53';          $description 'Channel Islands';        }                      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" $i ."', '" $default_postcodes "', 'UK Post ".$description." - Zone " $i "', '6', '0', 'zen_cfg_textarea(', now())");      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" $i ."', '" .$default_value"', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " $i " destinations.', '6', '0', 'zen_cfg_textarea(', now())");     $db->Execute("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_UKPOST_HANDLING_" $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");    
        }
        function 
    remove() {      global $db;      $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key like 'MODULE\_SHIPPING\_UKPOST\_%'");    }
        function 
    keys() {      $keys = array('MODULE_SHIPPING_UKPOST_STATUS''MODULE_SHIPPING_UKPOST_METHOD''MODULE_SHIPPING_UKPOST_TAX_CLASS''MODULE_SHIPPING_UKPOST_TAX_BASIS''MODULE_SHIPPING_UKPOST_SORT_ORDER''MODULE_SHIPPING_UKPOST_SKIPPED');
          for (
    $i=1$i<=$this->num_zones$i++) {        $keys[] = 'MODULE_SHIPPING_UKPOST_CODES_' $i;        $keys[] = 'MODULE_SHIPPING_UKPOST_COST_' $i;        $keys[] = 'MODULE_SHIPPING_UKPOST_HANDLING_' $i;      }
          return 
    $keys;    }  }?>

  6. #6
    Join Date
    Jul 2007
    Posts
    342
    Plugin Contributions
    7

    Default Re: Shipping UK Post codes

    PHP Code:
    // Module Installation//   
         
    function install() {     
     global 
    $db;    
      
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable PostCode Method', 'MODULE_SHIPPING_UKPOST_STATUS', 'True', 'UK postcode based shipping', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Calculation Method', 'MODULE_SHIPPING_UKPOST_METHOD', 'Weight', 'Calculate cost based on Weight, Price or Item?', '6', '0', 'zen_cfg_select_option(array(\'Weight\', \'Price\', \'Item\'), ', now())");      $db->Execute("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_UKPOST_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_UKPOST_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");   

       
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_UKPOST_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");

          for (
    $i 1$i <= $this->num_zones$i++){   
         
    $default_postcodes '';    
        
    $description '';     
       
    $default_value '';    
        }  
                   if (
    $i == 1) {      
      
    $default_postcodes 'LEAVE EMPTY';   
       
    $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:7.14,30.0:13.14,35.0:19.18';       $description 'Default Mainland Postcode Zone';   
     }      
      if (
    $i == 2) {     
       
    $default_postcodes ='AB31,AB32,AB33,AB34,AB35,AB36,AB37,AB38,AB40,AB41,AB42,AB43,AB44,AB45,AB46,AB47,AB48,AB49,AB50,AB51,AB52,AB53,AB54,AB55,AB56,KW1,KW2,KW3,KW4,KW5,KW6,KW7,KW8,KW9,KW10,KW11,KW12,KW13,KW14,PA21,PA22,PA23,PA24,PA25,PA26,PA27,PA28,PA29,PA30,PA31,PA32,PA33,PA34,PA35,PA36,PA37,PA38,PA39,PA40,PA41,PA45,PA46,PA47,PA48,PA49,PA20,PA42,PA43,PA44,PA60,PA61,PA62,PA63,PA64,PA65,PA66,PA67,PA68,PA69,PA70,PA71,PA72,PA73,PA74,PA75,PA76,PA77,PA78,PH17,PH18,PH19,PH20,PH21,PH22,PH23,PH24,PH25,PH26,PH30,PH31,PH32,PH33,PH34,PH35,PH36,PH37,PH38,PH39,PH40,PH41,PH42,PH43,PH44,PH49,PH50,KA27,KA28,HS1,HS2,HS3,HS4,HS5,HS6,HS7,HS8,HS9,ZE1,ZE2,ZE3,ZE4,IV1,IV2,IV3,IV4,IV5,IV6,IV7,IV8,IV9,IV10,IV11,IV12,IV13,IV14,IV15,IV16,IV17,IV18,IV19,IV20,IV21,IV22,IV23,IV24,IV25,IV26,IV27,IV28,IV29,IV30,IV3,IV32,IV33,IV34,IV35,IV36,IV37,IV38,IV39,IV40,IV41,IV42,IV43,IV44,IV45,IV46,IV47,IV48,IV49,IV50,IV51,IV52,IV53,IV54,IV55,IV56,IV57,IV58,IV59,IV60,IV61,IV62,IV63';       $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50       ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Scottish Highlands & Islands';      
         }         
          if (
    $i == 3)  {     
        
    $default_postcodes ='BT1,BT2,BT3,BT4,BT5,BT6,BT7,BT8,BT9,BT10,BT11,BT12,BT13,BT14,BT15,BT16,BT17,BT18,BT19,BT20,BT21,BT22,BT23,BT24,BT25,BT26,BT27,BT28,BT29,BT30,BT31,BT32,BT33,BT34,BT35,BT36,BT37,BT38,BT39,BT40,BT41,BT42,BT43,BT44,BT45,BT46,BT47,BT48,BT49,BT50,BT51,BT52,BT53,BT54,BT55,BT56,BT57,BT58,BT59,BT60,BT61,BT62,BT63,BT64,BT65,BT66,BT67,BT68,BT69,BT70,BT71,BT72,BT73,BT74,BT75,BT76,BT77,BT78,BT79,BT80,BT81,BT82,BT83,BT92,BT93,BT94,IM1,IM2,IM3,IM4,IM5,IM6,IM7,IM8,IM9,TR21,TR22,TR23, TR24,TR25';   $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';     
      
    $description 'Northern Ireland, Isle of Man, Isles of Scilly';           }       
         if (
    $i == 4)  {     
        
    $default_postcodes 'JE1,JE2,JE3,JE4,GY1,GY2,GY3, &,GY4,GY5,GY6,GY7,GY8,GY9,GY10';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:22.53';          $description 'Channel Islands';    
        }                  
       
     
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" $i ."', '" $default_postcodes "', 'UK Post ".$description." - Zone " $i "', '6', '0', 'zen_cfg_textarea(', now())");    
      
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" $i ."', '" .$default_value"', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " $i " destinations.', '6', '0', 'zen_cfg_textarea(', now())");     

    $db->Execute("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_UKPOST_HANDLING_" $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");    
        }
        function 
    remove() {    
      global 
    $db;      $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key like 'MODULE\_SHIPPING\_UKPOST\_%'");    }
        function 
    keys() {      $keys = array('MODULE_SHIPPING_UKPOST_STATUS''MODULE_SHIPPING_UKPOST_METHOD''MODULE_SHIPPING_UKPOST_TAX_CLASS''MODULE_SHIPPING_UKPOST_TAX_BASIS''MODULE_SHIPPING_UKPOST_SORT_ORDER''MODULE_SHIPPING_UKPOST_SKIPPED');
          for (
    $i=1$i<=$this->num_zones$i++) {      
      
    $keys[] = 'MODULE_SHIPPING_UKPOST_CODES_' $i;    
        
    $keys[] = 'MODULE_SHIPPING_UKPOST_COST_' $i;    
        
    $keys[] = 'MODULE_SHIPPING_UKPOST_HANDLING_' $i;      }
          return 
    $keys;    }  } 
    Quote Originally Posted by ianhg View Post
    PHP Code:
    <?php
     
    class ukpost extends base {    var $code$title$description$icon$enabled$num_zones;// class constructor    function __construct() {    global $db;      $this->code = 'ukpost';      $this->title = MODULE_SHIPPING_UKPOST_TEXT_TITLE;      $this->description = MODULE_SHIPPING_UKPOST_TEXT_DESCRIPTION;      $this->sort_order = defined('MODULE_SHIPPING_UKPOST_SORT_ORDER') ? MODULE_SHIPPING_UKPOST_SORT_ORDER : null;      if (null === $this->sort_order) return false;            $this->icon = '';      $this->tax_class = MODULE_SHIPPING_UKPOST_TAX_CLASS;      $this->tax_basis = MODULE_SHIPPING_UKPOST_TAX_BASIS;// disable only when entire cart is free shipping      if (zen_get_shipping_enabled($this->code)) {        $this->enabled = ((MODULE_SHIPPING_UKPOST_STATUS == 'True') ? true : false);      }
          // CHANGE THIS SETTING TO INCREASE THE NUMBER OF ZONES      // NOTE... Default Num Zones is set at 4      // You will need to uninstall (if already installed) and reinstall       // to have the changed zones number visible in the admin.      $this->num_zones = 4;                   // if (IS_ADMIN_FLAG === true) { // global $db; // for ($i = 1; $i <= $this->num_zones; $i++) { //  $check = $db->Execute("select * from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_UKPOST_". $i ."'");  // if ($this->enabled && $check->EOF){  //  $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " . $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" . $i ."', '" . $default_postcodes . "', 'UK Post ".$description." - Zone " . $i . "', '6', '0', 'zen_cfg_textarea(', now())");  //       $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" . $i ."', '" .$default_value. "', 'Shipping rates to Zone " . $i . " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " . $i . " destinations.', '6', '0', 'zen_cfg_textarea(', now())");  //       $db->Execute("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_UKPOST_HANDLING_" . $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())"); // } // }  // }      if ($this->enabled){   global $db;   for ($i = 1; $i <= $this->num_zones; $i++) {//  $check_query = $db->Execute("select configuration_value from" . TABLE_CONFIGURATION ." where configuration_key = 'MODULE_SHIPPING_UKPOST_HANDLING_METHOD'");//   if ($check_query->EOF){ //db->Execute("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_UKPOST_HANDLING_" . $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())"); //   }//   } } }   }       // class methods    function quote($method = '') {      global $order, $shipping_weight, $shipping_num_boxes, $total_count;      $destination_postcode = $order->delivery['postcode'];      $pcode = preg_replace('/\s\s*/', '', $destination_postcode);      $len = strlen($pcode); //echo $len."<br>";      if ($len <= 6) {$plen = 3;} else {$plen = 4;}      $destination_pcode = strtoupper(trim(mb_substr($pcode,0,$plen)));      $dest_zone = 0;      $error = false;
          
    for ($i=1$i<=$this->num_zones$i++) {        $postcode_table constant('MODULE_SHIPPING_UKPOST_CODES_' $i);        $post_zones preg_split("/[,]/"$postcode_table);        if (in_array($destination_pcode$post_zones)) {          $dest_zone $i;          break;          }                    else { $dest_zone 1;}        }        if ($order->delivery['country_id'] != 222) {$dest_zone 0;}
          if (
    $dest_zone == 0) {        $error true;      } else {        $shipping = -1;        $postage_cost constant('MODULE_SHIPPING_UKPOST_COST_' $dest_zone);        $postcode_table preg_split("/[:,]/" $postage_cost);        $size sizeof($postcode_table);        $done false;        for ($i=0$i<$size$i+=2) {          switch (MODULE_SHIPPING_UKPOST_METHOD) {              case (MODULE_SHIPPING_UKPOST_METHOD == 'Weight'):              if (round($shipping_weight,9) <= $postcode_table[$i]) {                $shipping $postcode_table[$i+1];
                    switch (
    SHIPPING_BOX_WEIGHT_DISPLAY) {                case (0):                  $show_box_weight '';                  break;                case (1):                  $show_box_weight ' (' $shipping_num_boxes ' ' TEXT_SHIPPING_BOXES ')';                  break;                case (2):                  $show_box_weight ' (' number_format($shipping_weight $shipping_num_boxes,2) . MODULE_SHIPPING_UKPOST_TEXT_UNITS ')';                  break;                default:                  $show_box_weight ' (' $shipping_num_boxes ' x ' number_format($shipping_weight,2) . MODULE_SHIPPING_UKPOST_TEXT_UNITS ')';                  break;                }
                    
    $shipping_method MODULE_SHIPPING_UKPOST_TEXT_WAY ' ' $dest_country $show_box_weight;                $done true;                break;                }              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Price'):            // shipping adjustment              if (($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) <= $postcode_table[$i]) {                $shipping = $postcode_table[$i+1];                $shipping_method = MODULE_SHIPPING_UKPOST_TEXT_WAY . ' ' . $destination_postcode;                $done = true;                break;                }              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Item'):            // shipping adjustment              if (($total_count - $_SESSION['cart']->free_shipping_items()) <= $postcode_table[$i]) {                $shipping = $postcode_table[$i+1];                $shipping_method = MODULE_SHIPPING_UKPOST_TEXT_WAY . ' ' . $destination_postcode;                $done = true;                break;                }              break;          }          if ($done == true) {            break;          }        }        if ($shipping == -1) {          $shipping_cost = 0;          $shipping_method = MODULE_SHIPPING_UKPOST_UNDEFINED_RATE;        } else {          switch (MODULE_SHIPPING_UKPOST_METHOD) {              case (MODULE_SHIPPING_UKPOST_METHOD == 'Weight'):              // no charge per package by Price              $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);              break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Price'):              // no charge per package by Price              $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);            break;              case (MODULE_SHIPPING_UKPOST_METHOD == 'Item'):              // no charge per package by Item              $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_UKPOST_HANDLING_' . $dest_zone);            break;          }        }      }      $this->quotes = array('id' => $this->code,                            'module' => MODULE_SHIPPING_UKPOST_TEXT_TITLE,                            'methods' => array(array('id' => $this->code,                                                     'title' => $shipping_method,                                                     'cost' => $shipping_cost)));
          
    if ($this->tax_class 0) {        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class$order->delivery['country']['id'], $order->delivery['zone_id']);      }
          if (
    zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon$this->title);
          if (
    $error == true$this->quotes['error'] = MODULE_SHIPPING_UKPOST_INVALID_CODE;
          return 
    $this->quotes;    }
        function 
    check() {      global $db;      if (!isset($this->_check)) {        $check_query $db->Execute("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_UKPOST_STATUS'");        $this->_check $check_query->RecordCount();      }      return $this->_check;    }    // Module Installation//        function install() {      global $db;      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable PostCode Method', 'MODULE_SHIPPING_UKPOST_STATUS', 'True', 'UK postcode based shipping', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Calculation Method', 'MODULE_SHIPPING_UKPOST_METHOD', 'Weight', 'Calculate cost based on Weight, Price or Item?', '6', '0', 'zen_cfg_select_option(array(\'Weight\', \'Price\', \'Item\'), ', now())");      $db->Execute("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_UKPOST_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_UKPOST_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_UKPOST_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
          
    for ($i 1$i <= $this->num_zones$i++){        $default_postcodes '';        $description '';        $default_value '';        }                 if ($i == 1) {        $default_postcodes 'LEAVE EMPTY';      $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:7.14,30.0:13.14,35.0:19.18';       $description 'Default Mainland Postcode Zone';    }        if ($i == 2) {        $default_postcodes ='AB31,AB32,AB33,AB34,AB35,AB36,AB37,AB38,AB40,AB41,AB42,AB43,AB44,AB45,AB46,AB47,AB48,AB49,AB50,AB51,AB52,AB53,AB54,AB55,AB56,KW1,KW2,KW3,KW4,KW5,KW6,KW7,KW8,KW9,KW10,KW11,KW12,KW13,KW14,PA21,PA22,PA23,PA24,PA25,PA26,PA27,PA28,PA29,PA30,PA31,PA32,PA33,PA34,PA35,PA36,PA37,PA38,PA39,PA40,PA41,PA45,PA46,PA47,PA48,PA49,PA20,PA42,PA43,PA44,PA60,PA61,PA62,PA63,PA64,PA65,PA66,PA67,PA68,PA69,PA70,PA71,PA72,PA73,PA74,PA75,PA76,PA77,PA78,PH17,PH18,PH19,PH20,PH21,PH22,PH23,PH24,PH25,PH26,PH30,PH31,PH32,PH33,PH34,PH35,PH36,PH37,PH38,PH39,PH40,PH41,PH42,PH43,PH44,PH49,PH50,KA27,KA28,HS1,HS2,HS3,HS4,HS5,HS6,HS7,HS8,HS9,ZE1,ZE2,ZE3,ZE4,IV1,IV2,IV3,IV4,IV5,IV6,IV7,IV8,IV9,IV10,IV11,IV12,IV13,IV14,IV15,IV16,IV17,IV18,IV19,IV20,IV21,IV22,IV23,IV24,IV25,IV26,IV27,IV28,IV29,IV30,IV3,IV32,IV33,IV34,IV35,IV36,IV37,IV38,IV39,IV40,IV41,IV42,IV43,IV44,IV45,IV46,IV47,IV48,IV49,IV50,IV51,IV52,IV53,IV54,IV55,IV56,IV57,IV58,IV59,IV60,IV61,IV62,IV63';       $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50       ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Scottish Highlands & Islands';           }               if ($i == 3)  {         $default_postcodes ='BT1,BT2,BT3,BT4,BT5,BT6,BT7,BT8,BT9,BT10,BT11,BT12,BT13,BT14,BT15,BT16,BT17,BT18,BT19,BT20,BT21,BT22,BT23,BT24,BT25,BT26,BT27,BT28,BT29,BT30,BT31,BT32,BT33,BT34,BT35,BT36,BT37,BT38,BT39,BT40,BT41,BT42,BT43,BT44,BT45,BT46,BT47,BT48,BT49,BT50,BT51,BT52,BT53,BT54,BT55,BT56,BT57,BT58,BT59,BT60,BT61,BT62,BT63,BT64,BT65,BT66,BT67,BT68,BT69,BT70,BT71,BT72,BT73,BT74,BT75,BT76,BT77,BT78,BT79,BT80,BT81,BT82,BT83,BT92,BT93,BT94,IM1,IM2,IM3,IM4,IM5,IM6,IM7,IM8,IM9,TR21,TR22,TR23, TR24,TR25';   $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Northern Ireland, Isle of Man, Isles of Scilly';           }            if ($i == 4)  {         $default_postcodes 'JE1,JE2,JE3,JE4,GY1,GY2,GY3, &,GY4,GY5,GY6,GY7,GY8,GY9,GY10';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:22.53';          $description 'Channel Islands';        }                      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" $i ."', '" $default_postcodes "', 'UK Post ".$description." - Zone " $i "', '6', '0', 'zen_cfg_textarea(', now())");      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" $i ."', '" .$default_value"', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " $i " destinations.', '6', '0', 'zen_cfg_textarea(', now())");     $db->Execute("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_UKPOST_HANDLING_" $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");    
        }
        function 
    remove() {      global $db;      $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key like 'MODULE\_SHIPPING\_UKPOST\_%'");    }
        function 
    keys() {      $keys = array('MODULE_SHIPPING_UKPOST_STATUS''MODULE_SHIPPING_UKPOST_METHOD''MODULE_SHIPPING_UKPOST_TAX_CLASS''MODULE_SHIPPING_UKPOST_TAX_BASIS''MODULE_SHIPPING_UKPOST_SORT_ORDER''MODULE_SHIPPING_UKPOST_SKIPPED');
          for (
    $i=1$i<=$this->num_zones$i++) {        $keys[] = 'MODULE_SHIPPING_UKPOST_CODES_' $i;        $keys[] = 'MODULE_SHIPPING_UKPOST_COST_' $i;        $keys[] = 'MODULE_SHIPPING_UKPOST_HANDLING_' $i;      }
          return 
    $keys;    }  }?>
    Last edited by ianhg; 18 Mar 2021 at 02:55 AM.

  7. #7
    Join Date
    Jul 2007
    Posts
    342
    Plugin Contributions
    7

    Default Re: Shipping UK Post codes

    Sorry this is the best I could do, every time I coped and pasted the format changed . This is the install section.
    Quote Originally Posted by ianhg View Post
    PHP Code:
    // Module Installation//   
         
    function install() {     
     global 
    $db;    
      
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable PostCode Method', 'MODULE_SHIPPING_UKPOST_STATUS', 'True', 'UK postcode based shipping', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Calculation Method', 'MODULE_SHIPPING_UKPOST_METHOD', 'Weight', 'Calculate cost based on Weight, Price or Item?', '6', '0', 'zen_cfg_select_option(array(\'Weight\', \'Price\', \'Item\'), ', now())");      $db->Execute("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_UKPOST_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");      $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_UKPOST_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");   

       
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_UKPOST_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");

          for (
    $i 1$i <= $this->num_zones$i++){   
         
    $default_postcodes '';    
        
    $description '';     
       
    $default_value '';    
        }  
                   if (
    $i == 1) {      
      
    $default_postcodes 'LEAVE EMPTY';   
       
    $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50          ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:7.14,30.0:13.14,35.0:19.18';       $description 'Default Mainland Postcode Zone';   
     }      
      if (
    $i == 2) {     
       
    $default_postcodes ='AB31,AB32,AB33,AB34,AB35,AB36,AB37,AB38,AB40,AB41,AB42,AB43,AB44,AB45,AB46,AB47,AB48,AB49,AB50,AB51,AB52,AB53,AB54,AB55,AB56,KW1,KW2,KW3,KW4,KW5,KW6,KW7,KW8,KW9,KW10,KW11,KW12,KW13,KW14,PA21,PA22,PA23,PA24,PA25,PA26,PA27,PA28,PA29,PA30,PA31,PA32,PA33,PA34,PA35,PA36,PA37,PA38,PA39,PA40,PA41,PA45,PA46,PA47,PA48,PA49,PA20,PA42,PA43,PA44,PA60,PA61,PA62,PA63,PA64,PA65,PA66,PA67,PA68,PA69,PA70,PA71,PA72,PA73,PA74,PA75,PA76,PA77,PA78,PH17,PH18,PH19,PH20,PH21,PH22,PH23,PH24,PH25,PH26,PH30,PH31,PH32,PH33,PH34,PH35,PH36,PH37,PH38,PH39,PH40,PH41,PH42,PH43,PH44,PH49,PH50,KA27,KA28,HS1,HS2,HS3,HS4,HS5,HS6,HS7,HS8,HS9,ZE1,ZE2,ZE3,ZE4,IV1,IV2,IV3,IV4,IV5,IV6,IV7,IV8,IV9,IV10,IV11,IV12,IV13,IV14,IV15,IV16,IV17,IV18,IV19,IV20,IV21,IV22,IV23,IV24,IV25,IV26,IV27,IV28,IV29,IV30,IV3,IV32,IV33,IV34,IV35,IV36,IV37,IV38,IV39,IV40,IV41,IV42,IV43,IV44,IV45,IV46,IV47,IV48,IV49,IV50,IV51,IV52,IV53,IV54,IV55,IV56,IV57,IV58,IV59,IV60,IV61,IV62,IV63';       $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50       ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';       $description 'Scottish Highlands & Islands';      
         }         
          if (
    $i == 3)  {     
        
    $default_postcodes ='BT1,BT2,BT3,BT4,BT5,BT6,BT7,BT8,BT9,BT10,BT11,BT12,BT13,BT14,BT15,BT16,BT17,BT18,BT19,BT20,BT21,BT22,BT23,BT24,BT25,BT26,BT27,BT28,BT29,BT30,BT31,BT32,BT33,BT34,BT35,BT36,BT37,BT38,BT39,BT40,BT41,BT42,BT43,BT44,BT45,BT46,BT47,BT48,BT49,BT50,BT51,BT52,BT53,BT54,BT55,BT56,BT57,BT58,BT59,BT60,BT61,BT62,BT63,BT64,BT65,BT66,BT67,BT68,BT69,BT70,BT71,BT72,BT73,BT74,BT75,BT76,BT77,BT78,BT79,BT80,BT81,BT82,BT83,BT92,BT93,BT94,IM1,IM2,IM3,IM4,IM5,IM6,IM7,IM8,IM9,TR21,TR22,TR23, TR24,TR25';   $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:18.45';     
      
    $description 'Northern Ireland, Isle of Man, Isles of Scilly';           }       
         if (
    $i == 4)  {     
        
    $default_postcodes 'JE1,JE2,JE3,JE4,GY1,GY2,GY3, &,GY4,GY5,GY6,GY7,GY8,GY9,GY10';          $default_value '0.01:1.39,0.25:1.72,0.50:2.24,0.75:2.75,1.00:3.35,1.25:4.50           ,1.50:5.20,1.75:5.90,2.0:6.60,25.0:22.53';          $description 'Channel Islands';    
        }                  
       
     
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Post Codes', 'MODULE_SHIPPING_UKPOST_CODES_" $i ."', '" $default_postcodes "', 'UK Post ".$description." - Zone " $i "', '6', '0', 'zen_cfg_textarea(', now())");    
      
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_UKPOST_COST_" $i ."', '" .$default_value"', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " $i " destinations.', '6', '0', 'zen_cfg_textarea(', now())");     

    $db->Execute("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_UKPOST_HANDLING_" $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");    
        }
        function 
    remove() {    
      global 
    $db;      $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key like 'MODULE\_SHIPPING\_UKPOST\_%'");    }
        function 
    keys() {      $keys = array('MODULE_SHIPPING_UKPOST_STATUS''MODULE_SHIPPING_UKPOST_METHOD''MODULE_SHIPPING_UKPOST_TAX_CLASS''MODULE_SHIPPING_UKPOST_TAX_BASIS''MODULE_SHIPPING_UKPOST_SORT_ORDER''MODULE_SHIPPING_UKPOST_SKIPPED');
          for (
    $i=1$i<=$this->num_zones$i++) {      
      
    $keys[] = 'MODULE_SHIPPING_UKPOST_CODES_' $i;    
        
    $keys[] = 'MODULE_SHIPPING_UKPOST_COST_' $i;    
        
    $keys[] = 'MODULE_SHIPPING_UKPOST_HANDLING_' $i;      }
          return 
    $keys;    }  } 

  8. #8
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,691
    Plugin Contributions
    9

    Default Re: Shipping UK Post codes

    its better....

    ian, i am a bit confused. the automated install of the values does not work? but you can manually add them?

    if you manually add them, and it worked; why do you care if the install works again? once the values are in the database they are in until you remove them.

    so, i'm curious what problem are we actually trying to solve here?

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  9. #9
    Join Date
    Jul 2007
    Posts
    342
    Plugin Contributions
    7

    Default Re: Shipping UK Post codes

    Quote Originally Posted by carlwhat View Post
    its better....

    ian, i am a bit confused. the automated install of the values does not work? but you can manually add them?

    if you manually add them, and it worked; why do you care if the install works again? once the values are in the database they are in until you remove them.

    so, i'm curious what problem are we actually trying to solve here?

    best.
    Thanks again. Its more about fixing the plugin to make it work on a fresh install for other people. As I said I have installed this many times and it was not until recently that I had any problems. I fixed one issue to do with PHP 7 and submitted the plugin and it worked fine. But for some strange reason now on a fresh install it will not load if ($i ==2) , ($1==3) and ($1 == 4) into the database. So I added it manually to the database.
    Do you see anything wrong with the install code that would be a problem for PHP 7.4? Appreciate your help.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Shipping UK Post codes

    Is it possible that the line-breaks issue is actually the root cause of the problem?

    ie: if the line-break isn't recognized, then any line that contains a // comment will cause subsequent lines to also be commented-out, until a recognized line-break.
    Thus, some commands may not be running at all.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 How do I exclude certain post codes in a sale?
    By Mikec87 in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 25 Jul 2014, 06:28 AM
  2. v150 Only allow delivery to specific post codes
    By mkyle in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 31 Jul 2012, 09:34 PM
  3. Extracting Customer Post Codes From Zen
    By clarkeyi in forum General Questions
    Replies: 1
    Last Post: 22 Apr 2009, 01:54 PM
  4. Shipping costs for Various Post Codes
    By Derek Lamothe in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 1 Oct 2008, 08:09 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR