Ok since there were no takers, I had a go at it my self. Can some one have a look and see all ok please (I know its not) as I have basicly merged storepickup.php with austpost.php
here is the code
------auspostv1302.php-------------------
<?php
/*
$Id: auspost.php,v 2.0.2 2003/10/15
osCommerce, Open Source E-Commerce Solutions
<http://www.oscommerce.com>
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
//--------------------------------------------------------------//
// Module originally created by Steve Kemp for osCommerce //
// - <http://www.snowtech.com.au> (Snowtech Services) //
// //
// Module migrated to ZenCart by Greg Hooper //
// - <http://www.ozetrade.net> (OZeTrade.net) //
// //
// This module was migrated and tested on zen-cart-v1.2.2d //
//--------------------------------------------------------------//
// auspostv1302.php Updated to version v1.3.0.2 by OAVS but needs further hacking to work
class auspost {
var $code, $title, $description, $icon, $enabled;
// class constructor
function auspost() {
global $order, $db, $template;
$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 = $template->get_template_dir('auspost.gif', '', '','images/icons'). '/' . 'auspost.gif';
$this->tax_class = MODULE_SHIPPING_AUSPOST_TAX_CLASS;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_AUSPOST_STATUS == 'True') ? true : false);
}
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_AUSPOST_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("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->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
// class methods
function quote($method = '') {
global $order, $cart, $shipping_weight, $shipping_num_boxes, $total_weight;
$frompcode = MODULE_SHIPPING_AUSPOST_SPCODE;
$topcode = $order->delivery['postcode'];
$sweight = $shipping_weight*1000;
$swidth = MODULE_SHIPPING_AUSPOST_SWIDTH;
$sheight = MODULE_SHIPPING_AUSPOST_SHEIGHT;
$slength = MODULE_SHIPPING_AUSPOST_SDEPTH;
$error = false;
$insurance_table = split("[:,]" , MODULE_SHIPPING_AUSPOST_INSURANCE);
for ($i = 0; $i < count($insurance_table); $i+=2) {
//if ($cart->show_total() <= $insurance_table[$i]) {
if ($_SESSION['cart']->show_total() <= $insurance_table[$i]) {
$insurance = $insurance_table[$i+1];
$insurance_details = " $" .$insurance . " " .MODULE_SHIPPING_AUSPOST_TEXT_INSURANCE;
break;
}
}
$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];
}
if ($charge <= 0) {
$error = true;
} else {
$handling = MODULE_SHIPPING_AUSPOST_HANDLING;
if (($handling >0) && (MODULE_AUSPOST_HIDE_HANDLING !='Yes')) {
$handling_details = " $" . MODULE_SHIPPING_AUSPOST_HANDLING . " " .MODULE_SHIPPING_AUSPOST_TEXT_HANDLING;
} else {
$handling_details = "";
}
if (($insurance >0) && (MODULE_AUSPOST_HIDE_HANDLING !='Yes')) {
$insurance_details = " $" .$insurance . " " .MODULE_SHIPPING_AUSPOST_TEXT_INSURANCE;
} else {
$insurance_details = "";
}
if ($insurance == 0 && $handling == 0) {
$auspost_addons = "";
} else {
$auspost_addons = "<br>" . MODULE_SHIPPING_AUSPOST_TEXT_INCLUDE . $handling_details . $insurance_details . " ";
}
$shipping_auspost_method = MODULE_SHIPPING_AUSPOST_TEXT_WAY. " <b>" . $topcode . "</b> - " . $days . " " . MODULE_SHIPPING_AUSPOST_TEXT_SHIPPINGDAYS . "<br>" .$shipping_num_boxes . " " .MODULE_SHIPPING_AUSPOST_TEXT_BOXES . " " . $total_weight . MODULE_SHIPPING_AUSPOST_TEXT_UNITS . $auspost_addons;
$shipping_auspost_cost = $charge;
}
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_AUSPOST_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => $shipping_auspost_method,
'cost' => ($shipping_auspost_cost + MODULE_SHIPPING_AUSPOST_HANDLING) + $insurance)));
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_AUSPOST_TEXT_ERROR;
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_AUSPOST_STATUS'");
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
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 auspost', 'MODULE_SHIPPING_AUSPOST_STATUS', 'True', 'Do you want to offer auspost?', '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, date_added) values ('Insurance', 'MODULE_SHIPPING_AUSPOST_INSURANCE', '25:5.90', 'Insurance cost is based on the total cost of items. Example: 25:8.50,50:5.50,etc.. Up to $25 charge $8.50, from there to $50 charge $5.50, etc', '6', '3', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Dispatch Postcode', 'MODULE_SHIPPING_AUSPOST_SPCODE', '2000', 'Dispatch Postcode?', '6', '2', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_AUSPOST_HANDLING', '10', 'Handling Fee for this shipping method', '6', '4', 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 ('Hide Handling Fee', 'MODULE_AUSPOST_HIDE_HANDLING', 'No', 'The handling fee is still in the total shipping cost but the Handling Fee is not itemised on the invoice.', '6', '5', 'zen_cfg_select_option(array(\'Yes\', \'No\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Parcel Height', 'MODULE_SHIPPING_AUSPOST_SHEIGHT', '100', 'Parcel Height (in mm)', '6', '6', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Parcel Width', 'MODULE_SHIPPING_AUSPOST_SWIDTH', '100', 'Parcel Width (in mm)', '6', '7', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Parcel Depth', 'MODULE_SHIPPING_AUSPOST_SDEPTH', '100', 'Parcel Depth (in mm)', '6', '8', 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 ('Shipping Zone', 'MODULE_SHIPPING_AUSPOST_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', 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_AUSPOST_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, date_added) values ('Sort order of display.', 'MODULE_SHIPPING_AUSPOST_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '11', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_AUSPOST_COST', '0.00', 'The shipping cost for all orders using this shipping method.', '6', '0', 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_AUSPOST_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\'), ', now())");
}
function remove() {
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_SHIPPING_AUSPOST_STATUS', 'MODULE_SHIPPING_AUSPOST_SPCODE', 'MODULE_SHIPPING_AUSPOST_INSURANCE', 'MODULE_SHIPPING_AUSPOST_HANDLING', 'MODULE_AUSPOST_HIDE_HANDLING', 'MODULE_SHIPPING_AUSPOST_SHEIGHT', 'MODULE_SHIPPING_AUSPOST_SWIDTH', 'MODULE_SHIPPING_AUSPOST_SDEPTH', 'MODULE_SHIPPING_AUSPOST_ZONE', 'MODULE_SHIPPING_AUSPOST_TAX_CLASS', 'MODULE_SHIPPING_AUSPOST_SORT_ORDER');
//return array('MODULE_SHIPPING_AUSPOST_STATUS', 'MODULE_SHIPPING_AUSPOST_COST', 'MODULE_SHIPPING_AUSPOST_TAX_CLASS', 'MODULE_SHIPPING_AUSPOST_TAX_BASIS', 'MODULE_SHIPPING_AUSPOST_ZONE', 'MODULE_SHIPPING_AUSPOST_SORT_ORDER');
}
}
?>