Author Topic: Australia Post shipping  (Read 223687 times)

UncleBuck

  • Beginner
  • *
  • Posts: 14
Australia Post shipping
« on: March 17, 2005, 01:27:22 am »
Given that I am a new Mambo and phpShop user, how easy would it be to create a shipping module for Australia Post by using their site at http://drc.edeliver.com.au/

They give all the details as to what would need to be passed to their web application and what gets returned.

See http://drc.edeliver.com.au/#Software

Yak

  • Beginner
  • *
  • Posts: 6
Re: Australia Post shipping
« Reply #1 on: April 16, 2005, 15:08:39 pm »
Bump  ;D
This would be a nice inclusion for us Aussies  :o

UncleBuck

  • Beginner
  • *
  • Posts: 14
Re: Australia Post shipping
« Reply #2 on: April 20, 2005, 04:06:38 am »
I know there is an osCommerce module that does this.

Does anyone know if an OC module could be easily converted for phpShop?

scotta

  • Beginner
  • *
  • Posts: 4
Re: Australia Post shipping
« Reply #3 on: April 30, 2005, 00:36:15 am »
I also looked into this a while ago. The Aust Post Delivery Rate Calculator would be a great tool to use as it has up to date shipping rates. At the time I had no idea how to go about it so I modified the Standard Shipping module to add a weight based component and then added a total of 250+ shipping rates to cover standard, express, os standard and os express.

I note that in the new pre-stable 1.2 release there is a Canadian Shipping module. If this uses a similar system to Aust Post then it may be a basis for a suitable hack.

Just need a good programmer out there to help us Australians out.

Scott

echidna

  • Beginner
  • *
  • Posts: 1
Re: Australia Post shipping
« Reply #4 on: May 25, 2005, 09:49:19 am »
I'm looking for this myself (and have posted elsewhere on the forum about it).

I've worked out how to use a php script to query the Australia Post Server but cannot yet get my head around feeding the 'real' variable from mambophpshop into the script.

What I've got so far looks like:

Code: [Select]
<?php
//set up the variables for Australia Post Query
$var_pickup '2476';
$var_destination '2001';
$var_country 'AU';
$var_weight '100';
$var_service 'Standard';
$var_length '100';
$var_width '100';
$var_height '100';
$var_quantity '1';

       
// Collect variables into the query URI for Australia Post
$myfile=file('http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode='.$var_pickup.'&Destination_Postcode='.$var_destination.'&Country='.$var_country.'&Weight='.$var_weight.'&Service_Type='.$var_service.'&Length='.$var_length.'&Width='.$var_width.'&Height='.$var_height.'&Quantity='.$var_quantity);
       
       
// Get Australia Post charge value separate to 'charge='
$APchargeArray split('=',$myfile[0]);
$APcharge $APchargeArray[1];

       
// Get Australia Post Time separate to 'days='
$APtimeArray split('=',$myfile[1]);
$APtime $APtimeArray[1];

       
// error message
$APerrorArray split('=',$myfile[2]);
$APerrorMessage $APerrorArray[1];
?>


So there are the input variables, and the output variables for Australia Post queries are:
  • $APcharge
  • $APtime
  • $APerrorMessage

$var_service could be hard coded into the script or be a choice made in the back end.

But I'm sure that the other variables are already in mambophpshop, so it *should* simply be a matter of
Code: [Select]
<?php $var_pickup $mambophpshopShopPostcodeVariableName?>
Whatever '$mambophpshopShopPostcodeVariableName' actually is? And so on the same for all the other variables in and out of mambo-phpshop.


Hoping some of yall can help
; D

infragreg

  • Beginner
  • *
  • Posts: 5
Re: Australia Post shipping
« Reply #5 on: July 02, 2005, 06:52:24 am »
looks like there's a few aussies here that would love a Australia Post shipping module :) (And a few Aussie payment processors too)

Wish I could code :(

But there's got to be a way...just a rough idea that just popped into my head. If say 30 Aussies chipped in say 50 bucks each and we hired someone for $1500 (in this example..could be more or less :) ) to just do the work on shipping and payment stuff...would that be a good idea?

We don't have to sell the modules...just get the things to work and be done with it...

when u look at how many options OSCommerce has, it makes you weep :) Granted OSCommerce has had a head start and way more developers over the years...but it just would be nice for mambo-phpshop to start to catch up...we have such a great cart here and fantastic CMS...shame to see it struggle so much...

if only i could code :( and don't say I could start to learn...i tried and nearly lost all my hair :) Just wasn't born for it...literally :)

anyway, just an idea :)

magyver

  • Beginner
  • *
  • Posts: 7
Re: Australia Post shipping
« Reply #6 on: September 01, 2005, 15:42:01 pm »
yep, you can add another one.

I was gong to have a look at zone shipping and work state by state.
I'm not interested in overseas. Run something like a lookup table to relate the different postcodes to the N1, N2, V1, V2 etc then run the clients postcode against the lookup table, then look up wieght then run the calculations. I will have to look at your link. I have been looking for thier calculator for months. The staff at Australia Post couldnt help me find it. Speaks for it's self.

jacko

  • Beginner
  • *
  • Posts: 5
Re: Australia Post shipping
« Reply #7 on: October 26, 2005, 15:30:25 pm »
Hi all .. just posted the info below in another (incorrect?) post!

One of our developers has written a shipping module (eDeliver) which calculates shipping based on standard and express post rates. Only problem is it's commercial (due to an arrangement with the client we developed it for - non-exclusively - in the first place). It is under $50AUD and I'm happy to donate half to Soeren for his outstanding work (and the other half to our developers XMAS presents)!

Let me know if it's of interest .. I'm not a dev so I'm unlikely to be able to help you on the technical aspects but happy to answer any questions I can (and try to get answers for others) in the event you want to built it yourself.

Scott

UncleBuck

  • Beginner
  • *
  • Posts: 14
Re: Australia Post shipping
« Reply #8 on: November 09, 2005, 03:38:58 am »
One of our developers has written a shipping module (eDeliver)

Jacko,
I hope they are not marketing it under that name as that is an Australia Post trade marked name.

They can get VERY nasty when you use one of their TM's without the official stamp of approval.

spinfx

  • Beginner
  • *
  • Posts: 38
Re: Australia Post shipping
« Reply #9 on: November 16, 2005, 04:57:30 am »
Given that I am a new Mambo and phpShop user, how easy would it be to create a shipping module for Australia Post by using their site at http://drc.edeliver.com.au/


Uncle Buck and readers:  This looks to be the best way to go. I have a developer working on some new components for us, but when he's finished I'll ask him how much for doing this. I'll post the cost on here when I have it and if anyone would like to make donations, we can hopefully provide the finished shipping module to the community.

Cheers, David

jacko

  • Beginner
  • *
  • Posts: 5
Re: Australia Post shipping
« Reply #10 on: December 05, 2005, 23:37:17 pm »
Hi All,

Firstly to UncleBuck .. no we are not actually marketing it at all. It's just that the code has already been written that uses AusPost's eDeliver functionality to calculate standard / express post costs and thought it may help other in Oz.

To spinfx, it is already written and as alluded to in the previous post it's $45 + GST - half of which we'll donate to Soeren. Of course you are quite welcome to have your developer do the same thing.

Any questions, just ask!

Regards,
Scott

spinfx

  • Beginner
  • *
  • Posts: 38
Re: Australia Post shipping
« Reply #11 on: December 13, 2005, 08:23:24 am »
. . . the code has already been written that uses AusPost's eDeliver functionality to calculate standard / express post costs and thought it may help other in Oz.

 . . . it is already written and as alluded to in the previous post it's $45 + GST - half of which we'll donate to Soeren.

Hi Scott

Thanks - just a few comments

1. We need Domestic (Aussie/NZ) and Overseas Rates for small packages and parcels
2. We need Airmail, Economy Airmail and Seamail rates for overseas
3. We need Standard and Express Post rates for Domestic

Does your existing script cater for all these options when interrogating the Aussie Post eDeliver Server?

If we decide to go with your script, how do we pay you? We are a WA Govt agency and can only pay by Credit Card or against an Invoice.

Cheers, David

Regards, David

benneh

  • Beginner
  • *
  • Posts: 16
Re: Australia Post shipping
« Reply #12 on: January 12, 2006, 01:17:27 am »
Another Aussie here who would love to see this functionality.  I would pledge up to $50 for someone to develop this.


bcoble

  • Beginner
  • *
  • Posts: 9
Re: Australia Post shipping
« Reply #13 on: January 13, 2006, 15:05:38 pm »
Hi there all...I am a coder php/mysql/js 5+ yrs - and a muso  ??? - but I have no experience in coding anything specifically for mambo/joomla yet...I'm new to VirtueMart and currently just trying to get a shop up and happening at my bands site http://www.beatels.com. I came across a bug/feature  :)  with the tax on shipping and came here searching for enlightenment. I saw the pleadings for someone to code this into a module and felt that I should say hello.

I've built web apps, intranets - even an order system for a telco that calls prices for customer orders from the wholesale supplier's website. Sounds kinda deja-vu to me...

I'm not expecting a huge amount of trade at our site - it's more of a service for our audience - so I've just created a bunch of shipping rates that covers most but not all of the possibilities. But the thought of being able to calculate shipping via AusPost by calling up their postage calculator (which I stupidly did by hand) from within the code does seem like a highly attractive/sensible way of doing things  ;)

I was really planning on doing other things in the few weeks I have spare before other duties call. But if it turns out that an Auspost module could be done in a short amount of time, I *may* be able to help.

One minor obstace is the fact that I have no idea of how mambo/joomla works in a *developer* sense - names of global variables, which class calls which, etc. I also have no idea how to write a module for mambo/joomla. Then again, I have never actually wanted to know until now. If someone could steer me in the right direction (good tutorials or tips from one of the virtuemart developers) for some of the above, I could at least assess whether I can help out with this...

On a slightly-related matter, I reported elsewhere in this forum that, although my standard shipping module was not adding tax to shipping costs, I had found that by manually updating the mos_vm_shipping_rate table shipping_rate_vat_id with the id from the tax rate you wished to use for that shipping rate, I was able to at least get tax added to shipping where applicable. Hope that helps anybody with the same problem.

Undeniably, it's an ugly solution, and I began to wonder if I should just fix the code myself. But that would mean I would need to get to know 'coding for mambo/joomla', which as I have said before, I had been avoiding...

"Life is what happens to you while you're busy making other plans" John Lennon

benneh

  • Beginner
  • *
  • Posts: 16
Re: Australia Post shipping
« Reply #14 on: January 14, 2006, 01:34:31 am »
Righto well I have practically zero experience with php, and I am not a programmer by trade, but I have messed around with programming a a little so I thought I would dive right in and give this a go, as I really need this functionality on my site.

I just took bits from other shipping modules and kinda slapped it all together, its taken me about 3 hours this morning to throw these files together, and I have made some good progress to the point this now works with the exception of pulling the delivery and parcel details out of the database.  Here is the Australia Post Class code:

This is auspost.php, located in "administrator\components\com_virtuemart\classes\shipping"
Code: [Select]
<?php
defined
('_VALID_MOS') or die('Direct Access to this location is not allowed.');
/**
*
* @version $Id: auspost.php,v 1.0 2006/01/13 12:00:00 benneh Exp $
* @package VirtueMart
* @subpackage shipping
* @copyright Copyright (C) 2006 Ben Wilson. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/

/**
*
* This class will charge a shipping rate determined by passing parameters to 
* http://drc.edeliver.com.au/ 
* @copyright (C) 2006 Ben Wilson

*******************************************************************************
*/
class auspost {

var $classname "auspost";

function list_rates( &$d ) {
global $total$tax_total$CURRENCY_DISPLAY;
$db =& new ps_DB;
$dbv =& new ps_DB;

$cart $_SESSION['cart'];

/** Read current Configuration ***/
require_once(CLASSPATH ."shipping/".$this->classname.".cfg.php");

if ( $_SESSION['auth']['show_price_including_tax'] != ) {
$taxrate 1;
$order_total $total $tax_total;
}
else {
$taxrate $this->get_tax_rate() + 1;
$order_total $total;
}

//TODO - extract variables from the database for the product weight and dimenstions, and the users zip/postcode and country
//$dbu = new ps_DB; //DB User
//$q  = "SELECT country,zip FROM #__{vm}_user_info WHERE user_info_id = '". $d["ship_to_info_id"] . "'";

//$dbc->query($q);
//$dbc->next_record();

//$zip = $dbc->f("zip");
//$country = $dbc->f("country");

//set up the variables for Australia Post Query

//Postcode of the pick-up address (e.g. 3015)
$Order_Pickup_Postcode Pickup_Postcode;
//$Order_Pickup_Postcode = '2615';

//Postcode of the delivery destination (e.g. 2615)
$Order_Destination_Postcode '2001';

//The country of delivery destination designated by two alpha characters. For example, AU stands for Australia
$Order_Country 'AU';

//The weight of the parcel or item measured in grams (g)
$Order_Weight '10000';

//The type of servive, available types are "Standard", "Express", "Air", "Sea", and "Economy"
$Order_Service_Type Service_Type;
//$Order_Service_Type = 'STANDARD';

//The length of the item or parcel in millimetres (mm)
$Order_Length '100';

//The width of the item or parcel in millimetres (mm)
$Order_Width '100';

//The height of the item or parcel in millimetres (mm)
$Order_Height '100';

//This is the quantity of items for which the customer is estimating the delivery charges
$Order_Quantity '1';


//Fee for packaging and handling, added to the delivery costs returned by auspost
$Order_Handling_Fee Handling_Fee;

    // Collect variables into the query URI for Australia Post
$myfile=file('http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode='.$Order_Pickup_Postcode.'&Destination_Postcode='.$Order_Destination_Postcode.'&Country='.$Order_Country.'&Weight='.$Order_Weight.'&Service_Type='.$Order_Service_Type.'&Length='.$Order_Length.'&Width='.$Order_Width.'&Height='.$Order_Height.'&Quantity='.$Order_Quantity);
       
// Get Australia Post charge value separate to 'charge='
$APchargeArray split('=',$myfile[0]);
$APcharge $APchargeArray[1];

// Get Australia Post Time separate to 'days='
$APtimeArray split('=',$myfile[1]);
$APtime $APtimeArray[1];

// error message
$APerrorArray split('=',$myfile[2]);
$APerrorMessage $APerrorArray[1];

$order_shipping $APcharge;

$html .= "<label for=\"flex_shipping_rate\">Australia Post: ".$CURRENCY_DISPLAY->getFullValue($order_shipping);
$html .= "</label>";

$_SESSION[$shipping_rate_id] = 1;

echo $html;
return true;
}

function get_rate( &$d ) {

$shipping_rate_id $d["shipping_rate_id"];
$is_arr explode("|"urldecode(urldecode($shipping_rate_id)) );
$order_shipping $is_arr[3];

return $order_shipping;

}


function get_tax_rate() {

/** Read current Configuration ***/
require_once(CLASSPATH ."shipping/".$this->classname.".cfg.php");

if( intval(FLEX_TAX_CLASS)== )
return( );
else {
require_once( CLASSPATH"ps_tax.php" );
$tax_rate ps_tax::get_taxrate_by_idintval(FLEX_TAX_CLASS) );
return $tax_rate;
}
}

/* Validate this Shipping method by checking if the SESSION contains the key
* @returns boolean False when the Shipping method is not in the SESSION
*/
function validate$d ) {

$shipping_rate_id $d["shipping_rate_id"];

if( array_key_exists$shipping_rate_id$_SESSION )) {

return true;
}
else {
return false;
}
}
/**
    * Show all configuration parameters for this Shipping method
    * @returns boolean False when the Shipping method has no configration
    */
function show_configuration() {
global $VM_LANG;
/** Read current Configuration ***/
require_once(CLASSPATH ."shipping/".$this->classname.".cfg.php");
    
?>

      <table>
    <tr>
        <td><strong>Pickup Postcode:</strong></td>
<td>
            <input type="text" name="Pickup_Postcode" class="inputbox" value="<?php echo Pickup_Postcode ?>" />
</td>
<td>
        <?php echo mm_ToolTip("Postcode of the pick-up address (e.g. 2615)"?>
        </td>
    </tr>
    <tr>
        <td><strong>Service Type:</strong>
</td>
<td>
            <input type="text" name="Service_Type" class="inputbox" value="<?php echo Service_Type ?>" />
</td>
<td>
        <?php echo mm_ToolTip("The Australia Post delivery service type (Types of service available include Standard|Express|Air|Sea|Economy)"?>
        </td>
    </tr>
    <tr>
        <td><strong>Handling Fee:</strong>
</td>
<td>
            <input type="text" name="Handling_Fee" class="inputbox" value="<?php echo Handling_Fee ?>" />
</td>
<td>
            <?php echo mm_ToolTip("This is your fee for packaging and handling, and is added to the delivery costs returned by auspost"?>
        </td>
    </tr>
  <tr>
<td><strong><?php echo $VM_LANG->_PHPSHOP_UPS_TAX_CLASS ?></strong></td>
<td>
  <?php
  require_once(CLASSPATH.'ps_tax.php');
  ps_tax::list_tax_value("FLEX_TAX_CLASS"FLEX_TAX_CLASS?>

</td>
<td><?php echo mm_ToolTip($VM_LANG->_PHPSHOP_UPS_TAX_CLASS_TOOLTIP?><td>
  </tr>
</table>
   <?php
   
// return false if there's no configuration
   
return true;
}
/**
  * Returns the "is_writeable" status of the configuration file
  * @param void
  * @returns boolean True when the configuration file is writeable, false when not
  */
function configfile_writeable() {
return is_writeableCLASSPATH."shipping/".$this->classname.".cfg.php" );
}

/**
* Writes the configuration file for this shipping method
* @param array An array of objects
* @returns boolean True when writing was successful
*/
function write_configuration( &$d ) {
    global $vmLogger;

$my_config_array = array("Pickup_Postcode" => $d['Pickup_Postcode'],
"Service_Type" => $d['Service_Type'],
"Handling_Fee" => $d['Handling_Fee'],
"FLEX_TAX_CLASS" => $d['FLEX_TAX_CLASS']
);
$config "<?php\n";
$config .= "defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); \n\n";
foreach( $my_config_array as $key => $value ) {
$config .= "define ('$key', '$value');\n";
}

$config .= "?>
";

if ($fp = fopen(CLASSPATH ."shipping/".$this->classname.".cfg.php", "w")) {
fputs($fp, $config, strlen($config));
fclose ($fp);
return true;
}
else {
$vmLogger->err( "Error writing to configuration file" );
return false;
}
}
}


?>

This is auspost.cfg.php, located in "administrator\components\com_virtuemart\classes\shipping"
Code: [Select]
<?php
defined
('_VALID_MOS') or die('Direct Access to this location is not allowed.'); 

define ('Pickup_Postcode''2615');
define ('Service_Type''STANDARD');
define ('Handling_Fee''5');
define ('FLEX_TAX_CLASS''0');
?>



This is auspost.ini, located in "administrator\components\com_virtuemart\classes\shipping"
Code: [Select]
# $Id: auspost.ini,v 1.0 2006/01/14 12:00:00 benneh Exp $
[General]
name = auspost
version = 1.0
creationDate = January 2006
author = Ben Wilson
authorEmail = ben@diversionware.com.au
authorUrl = diversionware.com.au/
copyright = diversionware
license = LGPL
description = Australia Post Shipping Module

[File]
filename =auspost.php


Now all I need to do is get out of the virtuemart database is package dimensions, weight and users delivery postcode.

It would be good if soeren or one of the more knowledgeable guys on this forum could let me know how to do that and save me some time, otherwise I will just keep at it and should have a fully working module for Australia Post very very shortly  8)