Jump to content
Sign in to follow this  
Island101

AustPOST3.011c simple question

Recommended Posts

Hi all,

Simple question here im sure someone here can answer very quickly.

I am using Australia post contrib

 

Now, when someone makes a purchase and the data gets sent to my banks gateway. "Payway Net"

It would pass the delivery description as HTML, which in return gives me errors when viewing

transactions at payways website.

 

It would output this durcing the Payment page

"Shipping Method: AusPOST Parcel Post

(Delivery to <b>4119</b> - 1 days Estimated Delivery Time*<br>1 boxes

1kg(s) (incl $5.00 handling $6.65 insurance) )"

 

Id like to just remove the HTML tags , but im not sure which file it would be at. i assumed around the language folders?

 

Thanks.

Share this post


Link to post
Share on other sites

Hi all,

Simple question here im sure someone here can answer very quickly.

I am using Australia post contrib

 

Now, when someone makes a purchase and the data gets sent to my banks gateway. "Payway Net"

It would pass the delivery description as HTML, which in return gives me errors when viewing

transactions at payways website.

 

It would output this durcing the Payment page

"Shipping Method: AusPOST Parcel Post

(Delivery to <b>4119</b> - 1 days Estimated Delivery Time*<br>1 boxes

1kg(s) (incl $5.00 handling $6.65 insurance) )"

 

Id like to just remove the HTML tags , but im not sure which file it would be at. i assumed around the language folders?

 

Thanks.

 

you must be able to find one here:

includes/languages/modules/shipping/<module_name.php>

 

Letme know how it goes.

 

Cheers

Shiva


Our truest life is when we are in dreams awake.

-- Henry David Thoreau --

Share this post


Link to post
Share on other sites

Hi Thanks for the response. I do see some HTML tags in there but not for the delivery calculation thing i posted above.

 

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.');

 

 

The HTML tags are on the error msg if it dosnt get a calculation from aus post DRC.

Any other places i can look?

 

Thanks again

Share this post


Link to post
Share on other sites

Hi Thanks for the response. I do see some HTML tags in there but not for the delivery calculation thing i posted above.

 

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.');

 

 

The HTML tags are on the error msg if it dosnt get a calculation from aus post DRC.

Any other places i can look?

 

Thanks again

 

then must be hardcoded in the includes/modules/shipping/<shipping_module>.php

 

near the code like

 

$this->quotes


Our truest life is when we are in dreams awake.

-- Henry David Thoreau --

Share this post


Link to post
Share on other sites

Ah found it , it was in "catalog\includes\modules\shipping\auspost.php"

 

Now what id like to try and do is remove most of the text in it so it just says "Shipping Method: AusPOST Parcel Post"

 

Instead of all that extra delivery and weight stuff. Would i be able to remove it from deleting some code in this file?

The <b> and <br> was found in there =)

 

<?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
 http://www.oscommerce.com

 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,
"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");
/**
* 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 = split("\n", $contents);
                               foreach ($vals as $value) {

                                               $bits = split("=" ,$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', );
   }
 }
?>

Share this post


Link to post
Share on other sites

Replace the code

 

$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;

 

as

 

$shipping_auspost_method = MODULE_SHIPPING_AUSPOST_TEXT_WAY. $topcode ." - " . $days . " " . MODULE_SHIPPING_AUSPOST_TEXT_SHIPPINGDAYS . $shipping_num_boxes . " " .MODULE_SHIPPING_AUSPOST_TEXT_BOXES . " " . $total_weight . MODULE_SHIPPING_AUSPOST_TEXT_UNITS . $auspost_addons;


Our truest life is when we are in dreams awake.

-- Henry David Thoreau --

Share this post


Link to post
Share on other sites

Awsome thanks.

 

One more question, which part of the code would i delete to remove these part of the text

 

"(Delivery to 4119 - 1 days Estimated Delivery Time*1 boxes 0.25kg(s) (incl $3 handling) ):"

 

I just want to keep the MODULE_SHIPPING_AUSPOST_TEXT_WAY part.

 

Thanks

Share this post


Link to post
Share on other sites

Awsome thanks.

 

One more question, which part of the code would i delete to remove these part of the text

 

"(Delivery to 4119 - 1 days Estimated Delivery Time*1 boxes 0.25kg(s) (incl $3 handling) ):"

 

I just want to keep the MODULE_SHIPPING_AUSPOST_TEXT_WAY part.

 

Thanks

 

change this:

'title' => $shipping_auspost_method,

to

'title' => MODULE_SHIPPING_AUSPOST_TEXT_WAY,


Our truest life is when we are in dreams awake.

-- Henry David Thoreau --

Share this post


Link to post
Share on other sites

Thank you sooooo much.

I tried for a day to figure this out myself to no avail. You are a legend <Internet high five> for you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×