Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Auspost Shipping Module Problem - Help required !


deltrum

Recommended Posts

I have installed the Auspost Shipping Contribution however, am getting this error when I get to the checkout.

 

										Shipping Method							[img=templates/ryper/images/infobox/top_spacer.png]																																							[img=images/icons/pixel_trans.gif]																											
[size=4]
[center]Please fill in [b]at least[/b] your billing address to get shipping quotes.[/size][/center]
							
																																																	[img=images/icons/pixel_trans.gif]																							Please select the preferred shipping method to use on this order.																							 																							[img=images/icons/pixel_trans.gif]																																											[img=images/icons/pixel_trans.gif]																																																																																	[img=images/icons/pixel_trans.gif]																															[b]MODULE_SHIPPING_AUSPOST_TEXT_TITLE[/b] [img=images/icons/auspost.gif]																															[img=images/icons/pixel_trans.gif]																																																											[img=images/icons/pixel_trans.gif]																															MODULE_SHIPPING_AUSPOST_TEXT_WAY [b]6149[/b] - 4 MODULE_SHIPPING_AUSPOST_TEXT_SHIPPINGDAYS
															1 MODULE_SHIPPING_AUSPOST_TEXT_BOXES 0MODULE_SHIPPING_AUSPOST_TEXT_UNITS (MODULE_SHIPPING_AUSPOST_TEXT_INCLUDE $5.00 MODULE_SHIPPING_AUSPOST_TEXT_HANDLING $4.35 MODULE_SHIPPING_AUSPOST_TEXT_INSURANCE)																															$21.85																																																														[img=images/icons/pixel_trans.gif]																																																																									[img=images/icons/pixel_trans.gif]																																											[img=images/icons/pixel_trans.gif]																																																																																	[img=images/icons/pixel_trans.gif]																															[b]Store Pickup. Monday - Friday 9:30 - 18:00[/b]																															[img=images/icons/pixel_trans.gif]																																																											[img=images/icons/pixel_trans.gif]																															Please pick up your order at our shop.																															$0.00																																																																																																																																																

 

I have the following defined in the language file:

 

/includes/languages/english/modules/shipping/auspost.php

 

define('MODULE_SHIPPING_AUSPOST_TEXT_TITLE', 'AusPOST Parcel Post');
define('MODULE_SHIPPING_AUSPOST_TEXT_DESCRIPTION', 'AusPOST Parcel Post');
define('MODULE_SHIPPING_AUSPOST_TEXT_UNITS', 'kg(s)');
define('MODULE_SHIPPING_AUSPOST_TEXT_BOXES', 'boxes');
define('MODULE_SHIPPING_AUSPOST_TEXT_INCLUDE', 'incl');
define('MODULE_SHIPPING_AUSPOST_TEXT_HANDLING', 'handling');
define('MODULE_SHIPPING_AUSPOST_TEXT_INSURANCE', 'insurance');
define('MODULE_SHIPPING_AUSPOST_TEXT_SHIPPINGDAYS', 'days Estimated Delivery Time*');
define('MODULE_SHIPPING_AUSPOST_TEXT_WAY', 'Delivery to');
define('MODULE_SHIPPING_AUSPOST_TEXT_ERROR', '<font color="#FF0000">ERROR:</font></b> We apologise, we are unable to obtain a valid quote from the Australia Post Server.<br>If you would like to use this option as your shipping method, please contact us.');

 

And here is the Auspost.php file:

 

includes/modules/shipping/auspost.php

 

<?php
/*
 $Id: auspost.php,v 3.0.1 July 1st 2007
 Contribution updated to :
 Remove obsolete module
 Fix bug which prevented some postcode calculations being performed
 Allow use of both insured and uninsured parcels

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]
 Copyright (c) 2007 osCommerce
 Released under the GNU General Public License
*/
 class auspost {
   var $code, $title, $description, $icon, $enabled;
// 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'];
 $sweight = $shipping_weight*1000;   
 $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
/**
* Initialize the cURL session
*/
$ch = curl_init();
/**
* Set the URL of the page or file to download.
*/
curl_setopt($ch, CURLOPT_URL,
"[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"]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[/url]");
/**
* Ask cURL to return the contents in a variable
* instead of simply echoing them to the browser.
*/
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
/**
* Execute the cURL session
*/
$contents = curl_exec ($ch);
/**
* Close cURL session
*/
curl_close ($ch);
						   $vals = explode("\n", $contents);
						    foreach ($vals as $value) {
										    $bits = explode("=" ,$value);
										    $$bits[0] = $bits[1];
						    }

 if ($charge <= 0) {
$error = true;
 } else {

$handling = MODULE_SHIPPING_AUSPOST_HANDLING;
  if ($handling >0) {
 $handling_details = " $" . MODULE_SHIPPING_AUSPOST_HANDLING . " " .MODULE_SHIPPING_AUSPOST_TEXT_HANDLING;
  } else {
 $handling_details = "";
  }

  if ($insurance >0) {
 $insurance_details = " $" .$insurance . " " .MODULE_SHIPPING_AUSPOST_TEXT_INSURANCE;
  } else {
 $insurance_details = "";
  }

 if ($insurance == 0 && $handling  == 0) {
  $auspost_addons = "";
 } else {
  $auspost_addons = " (" . 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/1.1)* $shipping_num_boxes);
 }

 $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'] = 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_AUSPOST_TEXT_ERROR . " " . $total_weight . " " . $shipping_weight ;

 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_AUSPOST_STATUS'");
    $this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
   }
   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 auspost', 'MODULE_SHIPPING_AUSPOST_STATUS', 'True', 'Do you want to offer auspost?', '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, date_added) VALUES ('Dispatch Postcode', 'MODULE_SHIPPING_AUSPOST_SPCODE', '2000', 'Dispatch Postcode?', '6', '0', now())");
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 Insurance', 'MODULE_SHIPPING_AUSPOST_INS_STATUS', 'True', 'Do you want to include insurance?', '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, date_added) values ('Insurance Base Cost', 'MODULE_SHIPPING_AUSPOST_INS_BASE', '4.35', 'Cost for the first unit of insurance. Needs to be sent <b>Registered Mail</b> for Insurance.', '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 ('Insurance Addition Cost', 'MODULE_SHIPPING_AUSPOST_INS_ADD', '1.15', 'Cost for each addition unit of insurance over Base Cost.', '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 ('Insurance Unit Size', 'MODULE_SHIPPING_AUSPOST_INS_UNIT', '100', 'Insurance units are based on these increments - (size in Dollars).', '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 ('Handling Fee', 'MODULE_SHIPPING_AUSPOST_HANDLING', '5.00', 'Handling Fee for this shipping method', '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 ('Maximum Weight (kg)', 'MODULE_SHIPPING_AUSPOST_MAX_WEIGHT', '20', 'Maximum weight allowed by AustPost (in kg).  A packaging allowance of <b>3 kg</b> is allowed.  EG. 20 - 3 = 17.  17 becomes cutoff point for use.', '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 ('Parcel Height (mm)', 'MODULE_SHIPPING_AUSPOST_SHEIGHT', '100', 'Parcel Height (in mm)', '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 ('Parcel Width (mm)', 'MODULE_SHIPPING_AUSPOST_SWIDTH', '100', 'Parcel Width (in mm)', '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 ('Parcel Depth (mm)', 'MODULE_SHIPPING_AUSPOST_SDEPTH', '100', 'Parcel Depth (in mm)', '6', '0', 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 ('Shipping Zone', 'MODULE_SHIPPING_AUSPOST_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', 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_AUSPOST_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 of display.', 'MODULE_SHIPPING_AUSPOST_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
   }
   function remove() {
  tep_db_query("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_INS_STATUS', 'MODULE_SHIPPING_AUSPOST_INS_BASE',  'MODULE_SHIPPING_AUSPOST_INS_ADD', 'MODULE_SHIPPING_AUSPOST_INS_UNIT',  'MODULE_SHIPPING_AUSPOST_MAX_WEIGHT', 'MODULE_SHIPPING_AUSPOST_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', );
   }
 }
?>

 

Any help would be appreciated...thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...