Guest Posted January 20, 2009 Share Posted January 20, 2009 I'm UK-based and have installed shipping modules to post to the UK via first-class and to Europe and the rest of the world via airmail. Mostly works fine, the main problem is that if I set the European airmail to "European Countries" in the Modules-Shipping field, then it only appears as an option when delivering to a UK address. If I set it to "None" then it appears everywhere, included as the recommended option when sending to countries OUTSIDE Europe. What do I need to edit to fix this? Thanks in advance Quote Link to comment Share on other sites More sharing options...
Dr_killer_UK Posted February 10, 2009 Share Posted February 10, 2009 You ever get this figured out? Air mail is always showing up for UK addresses for me even though i didn't put GB (united kingdom country code) in and of the zones. I have 2 zones zone 1 is Europe country codes zone 2 is a few select countries out of Europe its doing my bloody head in lol Quote Link to comment Share on other sites More sharing options...
Dr_killer_UK Posted February 11, 2009 Share Posted February 11, 2009 I think you may be missing what i was missing in the code if ($order->delivery['country']['iso_code_2'] == 'GB') { $this->enabled = false; Try this airmail.php. The shipping costs are old but you can update them easily. // class constructor function airmail() { global $order; $this->code = 'airmail'; $this->title = MODULE_SHIPPING_AIRMAIL_TEXT_TITLE; $this->description = MODULE_SHIPPING_AIRMAIL_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_AIRMAIL_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_airmail.gif'; // upload icon to catalog/images/icon directory $this->tax_class = MODULE_SHIPPING_AIRMAIL_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_AIRMAIL_STATUS == 'True') ? true : false); if ($order->delivery['country']['iso_code_2'] == 'GB') { $this->enabled = false; } // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED $this->num_zones = 2; } // class methods function quote($method = '') { global $order, $shipping_weight, $shipping_num_boxes; $dest_country = $order->delivery['country']['iso_code_2']; $dest_zone = 0; $error = false; for ($i=1; $i<=$this->num_zones; $i++) { $countries_table = constant('MODULE_SHIPPING_AIRMAIL_COUNTRIES_' . $i); $country_zones = split("[,]", $countries_table); if (in_array($dest_country, $country_zones)) { $dest_zone = $i; break; } } // elari - Added to select default country if not in listing if ($dest_zone == 0) { $dest_zone = $this->num_zones; // the zone is the lastest zone avalaible } // elari - Added to select default country if not in listing if ($dest_zone == 0) { $error = true; // this can no more achieve since by default the value is set to the max number of zones } else { $shipping = -1; $zones_cost = constant('MODULE_SHIPPING_AIRMAIL_COST_' . $dest_zone); $zones_table = split("[:,]" , $zones_cost); $size = sizeof($zones_table); for ($i=0; $i<$size; $i+=2) { if ($shipping_weight <= $zones_table[$i]) { $shipping = $zones_table[$i+1]; if(tep_not_null($method) ) // Text shown on Checkout_Confirmation $shipping_method = ''; // Leaving this entry blank causes only the shipping title to show i.e Royal Mail 1st Class Rec else // Text shown on Checkout_shipping - Delivery Weight : 0.7 Kg's (Ships normally within 1 to 3 days) $shipping_method = MODULE_SHIPPING_AIRMAIL_TEXT_WAY . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_AIRMAIL_TEXT_UNITS . ' ' . MODULE_SHIPPING_AIRMAIL_DELIVERY_TIMES; if ($shipping_num_boxes > 1) { $shipping_method .= $shipping_num_boxes . 'x '; } break; } } if ($shipping == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_AIRMAIL_UNDEFINED_RATE; } else { $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_AIRMAIL_HANDLING_' . $dest_zone); } } // I want to add VAT to European purchases // If I add 1.175* at the start of line 183, then it works and adds 17.5%, but to ALL Zones // How do I make it only apply to Zone 1 below - viz. ($i == 2) // The following doesn't work either, but just leaving line 190 works as before - to ALL zones // if ($i == 2) { // $shipping_cost = $shipping_cost*1.175; // } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_AIRMAIL_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => $shipping_cost))); if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_AIRMAIL_INVALID_ZONE; return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_AIRMAIL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } // elari - Added to select default country if not in listing function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Zones Method', 'MODULE_SHIPPING_AIRMAIL_STATUS', 'True', 'Do you want to offer zone rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_AIRMAIL_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_AIRMAIL_SORT_ORDER', '9', 'Sort order of display.', '6', '0', now())"); for ($i = 1; $i <= $this->num_zones; $i++) { $default_countries = ''; if ($i == 1) { $default_countries = 'AL,AD,AM,AT,AZ,BY,BE,BA,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GI,GR,GL,HU,IS,IE,I T,KZ,KG,LV,LI,LT,LU,MK,MT,MD,MC,NL,NO,PL,PT,RO,RU,SM,SK,SI,ES,SE,CH,TJ,TR,TM,UA, U Z,VA'; //Airmail Rates for Europe at April 2007: Small packets to 2KG and printed Papers to 10KG (2 packets) $shipping_table = '.1:1.19,.12:1.31,.14:1.44,.16:1.57,.18:1.7,.2:1.83,.22:1.95,.24:2.07,.26:2.1 9,.28:2.3,.3:2.41,.32:2.48,.34:2.58,.36:2.68,.38:2.78,.4:2.88,.42:2.98,.44:3.08,. 46:3.18,.48:3.28,.5:3.38,.6:3.88,.7:4.38,.8:4.88,.9:5.38,1:5.88,1.1:6.38,1.2:6.88 ,1.3:7.38,1.4:7.88,1.5:8.38,1.6:8.88,1.7:9.38,1.8:9.88,1.9:10.38,2:10.88,2.5:13,3 :15.5,3.5:18,4:20.5,4.5:23,5:25.5,6:30,7:35,8:40,9:45,10:50,50:999'; } if ($i == 2) { $default_countries = 'All Others'; // this must be the lastest zone // Airmail Rates for Rest of World at April 2007: Small packets to 2KG and printed Papers to 10KG (2 packets) $shipping_table = '.1:1.58,.12:1.80,.14:2.02,.16:2.24,.18:2.46,.2:2.69,.22:2.89,.24:3.1,.26:3.3 ,.28:3.51,.3:3.72,.32:3.92,.34:4.12,.36:4.32,.38:4.52,.4:4.72,.42:4.92,.44:5.12,. 46:5.32,.48:5.52,.5:5.72,.6:6.66,.7:7.66,.8:8.66,.9:9.66,1:10.66,1.1:11.66,1.2:12 .66,1.3:13.66,1.4:14.66,1.5:15.66,1.6:16.66,1.7:17.66,1.8:18.66,1.9:19.66,2:20.66 ,2.5:25.66,3:30.66,3.5:30.66,4:40.66,4.5:45.66,5:50.66,6:60,7:70,8:80,9:90,10:100 ,11:999'; } tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_AIRMAIL_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_AIRMAIL_COST_" . $i ."', '" . $shipping_table . "', 'Shipping rates to Zone " . $i . " destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone " . $i . " destinations.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Handling Fee', 'MODULE_SHIPPING_AIRMAIL_HANDLING_" . $i ."', '0', 'If you want to add extra costs to customers for jiffy bags etc, the cost can be entered below (eg enter 1.50 for a value of £1.50)', '6', '0', now())"); // tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Handling Fee', 'MODULE_SHIPPING_AIRMAIL_TAX_CLASS" . $i ."', '0', 'TEST TEST for TAX the cost can be entered below (eg enter 1.50 for a value of £1.50)', '6', '0', now())"); STILL MY ATTEMPT TO INCUDE VAT ON POSTAGE } } // elari - Added to select default country if not in listing function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { $keys = array('MODULE_SHIPPING_AIRMAIL_STATUS', 'MODULE_SHIPPING_AIRMAIL_TAX_CLASS', 'MODULE_SHIPPING_AIRMAIL_SORT_ORDER'); for ($i=1; $i<=$this->num_zones; $i++) { $keys[] = 'MODULE_SHIPPING_AIRMAIL_COUNTRIES_' . $i; $keys[] = 'MODULE_SHIPPING_AIRMAIL_COST_' . $i; $keys[] = 'MODULE_SHIPPING_AIRMAIL_HANDLING_' . $i; // $keys[] = 'MODULE_SHIPPING_AIRMAIL_TAX_CLASS' . $i; STILL MY ATTEMPT TO INCUDE VAT ON POSTAGE } return $keys; } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.