marmee Posted October 8, 2007 Share Posted October 8, 2007 Hi all I need to factor in the shipping box weight (constant 200gram) to all orders, before oscommerce queries the rates and displays to customer. I'm using the Australie Post add on and tried to use $sweight = $shipping_weight*1000 + 200 in auspost.php but it had no effect whatsoever. Maybe my math is lame or im in the wrong section/file? Any help would be appreciated // class constructor function auspost() { global $order; $this->code = 'auspost'; $this->title = MODULE_SHIPPING_AUSPOST_TEXT_TITLE; $this->description = MODULE_SHIPPING_AUSPOST_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_AUSPOST_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'auspost.gif'; $this->tax_class = MODULE_SHIPPING_AUSPOST_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_AUSPOST_STATUS == 'True') ? true : false); if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_AUSPOST_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_AUSPOST_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $cart, $shipping_weight, $shipping_num_boxes, $total_weight; // AUS ONLY Other countries HIDE if ($order->delivery['country']['iso_code_2'] == 'AU') { // ONLY SHOWN IF LESS OR EQUAL TO MAX WEIGHT if ($shipping_weight <= MODULE_SHIPPING_AUSPOST_MAX_WEIGHT) { $frompcode = MODULE_SHIPPING_AUSPOST_SPCODE; $topcode = $order->delivery['postcode']; [color="#FF0000"] $sweight = $shipping_weight*1000; [/color] $swidth = MODULE_SHIPPING_AUSPOST_SWIDTH; $sheight = MODULE_SHIPPING_AUSPOST_SHEIGHT; $slength = MODULE_SHIPPING_AUSPOST_SDEPTH; $error = false; // If Insurance option selected - calculate insurance cost if (MODULE_SHIPPING_AUSPOST_INS_STATUS == 'True') { // Start with Base Cost $insurance = MODULE_SHIPPING_AUSPOST_INS_BASE ; if ($order->info['subtotal'] > MODULE_SHIPPING_AUSPOST_INS_UNIT) { $how_often = ceil((($order->info['subtotal'] - MODULE_SHIPPING_AUSPOST_INS_UNIT)/MODULE_SHIPPING_AUSPOST_INS_UNIT)); $insurance =+ MODULE_SHIPPING_AUSPOST_INS_BASE + ($how_often * MODULE_SHIPPING_AUSPOST_INS_ADD) ; } } // End calculating Insurance $url = "http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=$frompcode&Destination_Postcode=$topcode&Country=AU&Weight=$sweight&Service_Type=STANDARD&Height=$sheight&Width=$swidth&Length=$slength&Quantity=$shipping_num_boxes"; $myfile = file($url); foreach($myfile as $vals) { $bits = split("=", $vals); $$bits[0] = $bits[1]; Quote Link to comment Share on other sites More sharing options...
Guest Posted October 8, 2007 Share Posted October 8, 2007 Hi all I need to factor in the shipping box weight (constant 200gram) to all orders, before oscommerce queries the rates and displays to customer. I'm using the Australie Post add on and tried to use $sweight = $shipping_weight*1000 + 200 in auspost.php but it had no effect whatsoever. Maybe my math is lame or im in the wrong section/file? Any help would be appreciated // class constructor function auspost() { global $order; $this->code = 'auspost'; $this->title = MODULE_SHIPPING_AUSPOST_TEXT_TITLE; $this->description = MODULE_SHIPPING_AUSPOST_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_AUSPOST_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'auspost.gif'; $this->tax_class = MODULE_SHIPPING_AUSPOST_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_AUSPOST_STATUS == 'True') ? true : false); if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_AUSPOST_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_AUSPOST_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $cart, $shipping_weight, $shipping_num_boxes, $total_weight; // AUS ONLY Other countries HIDE if ($order->delivery['country']['iso_code_2'] == 'AU') { // ONLY SHOWN IF LESS OR EQUAL TO MAX WEIGHT if ($shipping_weight <= MODULE_SHIPPING_AUSPOST_MAX_WEIGHT) { $frompcode = MODULE_SHIPPING_AUSPOST_SPCODE; $topcode = $order->delivery['postcode']; [color="#FF0000"] $sweight = $shipping_weight*1000; [/color] $swidth = MODULE_SHIPPING_AUSPOST_SWIDTH; $sheight = MODULE_SHIPPING_AUSPOST_SHEIGHT; $slength = MODULE_SHIPPING_AUSPOST_SDEPTH; $error = false; // If Insurance option selected - calculate insurance cost if (MODULE_SHIPPING_AUSPOST_INS_STATUS == 'True') { // Start with Base Cost $insurance = MODULE_SHIPPING_AUSPOST_INS_BASE ; if ($order->info['subtotal'] > MODULE_SHIPPING_AUSPOST_INS_UNIT) { $how_often = ceil((($order->info['subtotal'] - MODULE_SHIPPING_AUSPOST_INS_UNIT)/MODULE_SHIPPING_AUSPOST_INS_UNIT)); $insurance =+ MODULE_SHIPPING_AUSPOST_INS_BASE + ($how_often * MODULE_SHIPPING_AUSPOST_INS_ADD) ; } } // End calculating Insurance $url = "http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=$frompcode&Destination_Postcode=$topcode&Country=AU&Weight=$sweight&Service_Type=STANDARD&Height=$sheight&Width=$swidth&Length=$slength&Quantity=$shipping_num_boxes"; $myfile = file($url); foreach($myfile as $vals) { $bits = split("=", $vals); $$bits[0] = $bits[1]; Why not set in in admin - look at max tare weight. Quote Link to comment Share on other sites More sharing options...
lostndazed Posted October 8, 2007 Share Posted October 8, 2007 Why not set in in admin - look at max tare weight. REad about Tare Weight here: http://www.oscommerce.info/kb/osCommerce/A...-_Packaging/160 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.