Guest Posted August 16, 2006 Share Posted August 16, 2006 <?php /* $Id: zones.php, */ class first { var $code, $title, $description, $enabled, $num_zones; // class constructor function first() { $this->code = 'first'; $this->title = MODULE_SHIPPING_FIRST_TEXT_TITLE; $this->description = MODULE_SHIPPING_FIRST_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_FIRST_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_FIRST_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_FIRST_STATUS == 'True') ? true : false); $this->num_zones = 1; } // 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; if ($order->delivery['country']['iso_code_2'] == 'GB') { // UK ONLY Other countries HIDE for ($i=1; $i<=$this->num_zones; $i++) { $countries_table = constant('MODULE_SHIPPING_FIRST_COUNTRIES_' . $i); $country_zones = split("[,]", $countries_table); if (in_array($dest_country, $country_zones)) { $dest_zone = $i; break; } } if ($dest_zone == 0) { $error = true; } else { $shipping = -1; $zones_cost = constant('MODULE_SHIPPING_FIRST_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]; $shipping_method = 'Delivery Weight : ' . $shipping_weight . ' ' . MODULE_SHIPPING_FIRST_TEXT_UNITS; break; } } if ($shipping == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_FIRST_UNDEFINED_RATE; } else { $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_FIRST_HANDLING_' . $dest_zone); } } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_FIRST_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_FIRST_INVALID_ZONE; return $this->quotes; } } function check() { Hi all, trying to set up UK Zone rate shipping, where if the country is not the UK, the shipping module will be hidden. I used this code for that if ($order->delivery['country']['iso_code_2'] == 'GB') { // UK ONLY Other countries HIDE What I require now, is if the order weight is over 3Kg for the module to be complately hidden or if the order price is more than ?30 to hide the shipping module. Can anyone help. Link to comment Share on other sites More sharing options...
Guest Posted August 16, 2006 Share Posted August 16, 2006 Is this coding ok? <?php /* $Id: zones.php,v 1.20 2003/06/15 19:48:09 thomasamoulton Exp $ */ class first { var $code, $title, $description, $enabled, $num_zones; // class constructor function first() { global $order, $total_weight; $this->code = 'first'; $this->title = MODULE_SHIPPING_FIRST_TEXT_TITLE; $this->description = MODULE_SHIPPING_FIRST_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_FIRST_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_FIRST_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_FIRST_STATUS == 'True') ? true : false); $this->num_zones = 1; if ($total_weight > 3) { $this->enabled = false; } } // class methods function quote($method = '') { Link to comment Share on other sites More sharing options...
Guest Posted August 16, 2006 Share Posted August 16, 2006 Managed to find the call to for weight is greater than 3Kg to disable if ($total_weight > 3) { $this->enabled = false; } Whats the coding for if price is greater than ?30.00 disable. Please this is doing my nut in. :'( Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.