Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Is there a AU shipping mod for v1.3.0.2

Is there a AU shipping mod for v1.3.0.2

Locked

Views: 2,860

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
1 Aug 2006, 2:59 AM
#1
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Is there a AU shipping mod for v1.3.0.2

I am looking for Australain Post shipping mod for the version V1.3.0.2 . I have the old one and works with the old zen version but not with the new version.

Can some one please help with the code ?

Thanks

Downunder QLD

1 Aug 2006, 4:24 AM
#2
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Is there a AU shipping mod for v1.3.0.2

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'); } } ?>

Downunder QLD

1 Aug 2006, 8:55 AM
#3
gerard avatar

gerard

Zen Follower

Join Date:
Oct 2005
Location:
Qld Australia
Posts:
124
Plugin Contributions:
1

Re: Is there a AU shipping mod for v1.3.0.2

Yeah, just check the downloads section for SHIPPING. It works on the latest ZC and has a new "registered Post charg " option.

Gerard :smile:

The Quality of your Life is directly affected by the Quality of your Thoughts ...

1 Aug 2006, 11:19 PM
#4
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Is there a AU shipping mod for v1.3.0.2

Thank you Gerard

When I enter the db stuff I am getting an error. Would you know why?

Table structure for table geo_zones

DROP TABLE IF EXISTS geo_zones;
CREATE TABLE geo_zones (
geo_zone_id int(11) NOT NULL auto_increment,
geo_zone_name varchar(32) NOT NULL default '',
geo_zone_description varchar(255) NOT NULL default '',
last_modified datetime default NULL,
date_added datetime NOT NULL default '',
PRIMARY KEY (geo_zone_id)
) TYPE=MyISAM;
1067 Invalid default value for 'date_added'
in:
[CREATE TABLE geo_zones ( geo_zone_id int(11) NOT NULL auto_increment, geo_zone_name varchar(32) NOT NULL default '', geo_zone_description varchar(255) NOT NULL default '', last_modified datetime default NULL, date_added datetime NOT NULL default '', PRIMARY KEY (geo_zone_id) ) TYPE=MyISAM;]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

Downunder QLD

2 Aug 2006, 12:31 AM
#5
gerard avatar

gerard

Zen Follower

Join Date:
Oct 2005
Location:
Qld Australia
Posts:
124
Plugin Contributions:
1

Re: Is there a AU shipping mod for v1.3.0.2

Check in phpmyadmin or whatever you use if there is a geo_zones table. I had the same problem myself when I first added the program. The second time I installed it on a different PC it worked first go.

Hera is my table structure for geo-zones in case it helps

-- Table structure for table geo_zones

CREATE TABLE geo_zones (
geo_zone_id int(11) NOT NULL auto_increment,
geo_zone_name varchar(32) collate latin1_general_ci NOT NULL default '',
geo_zone_description varchar(255) collate latin1_general_ci NOT NULL default '',
last_modified datetime default NULL,
date_added datetime NOT NULL default '0001-01-01 00:00:00',
PRIMARY KEY (geo_zone_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=4 ;

--
-- Dumping data for table geo_zones

INSERT INTO geo_zones VALUES (1, 'Australian Zones', 'All Local Zones', '2006-07-29 10:05:07', '0000-00-00 00:00:00');
INSERT INTO geo_zones VALUES (2, 'World Zones', 'All International Zones', '2006-07-29 10:07:09', '0000-00-00 00:00:00');
INSERT INTO geo_zones VALUES (3, 'everything else', 'the rest', NULL, '2006-07-29 10:09:52');

You might have to just create the geo-zones table in phpmyadmin and dump the above info into it and see what happens.

Gerard :smile:

The Quality of your Life is directly affected by the Quality of your Thoughts ...

2 Aug 2006, 12:43 AM
#6
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Is there a AU shipping mod for v1.3.0.2

Thanks Gerard,

Inserting this code does install the table in phpAdmin but I still can not see auspost in the zen. I have uploaded all the files etc.

BTW if I try to to add the other austpost.sql, it wipes the one below totally and and does nothing else.

Here is the one does install
-- Table structure for table geo_zones

CREATE TABLE geo_zones (
geo_zone_id int(11) NOT NULL auto_increment,
geo_zone_name varchar(32) collate latin1_general_ci NOT NULL default '',
geo_zone_description varchar(255) collate latin1_general_ci NOT NULL default '',
last_modified datetime default NULL,
date_added datetime NOT NULL default '0001-01-01 00:00:00',
PRIMARY KEY (geo_zone_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=4 ;

--
-- Dumping data for table geo_zones

INSERT INTO geo_zones VALUES (1, 'Australian Zones', 'All Local Zones', '2006-07-29 10:05:07', '0000-00-00 00:00:00');
INSERT INTO geo_zones VALUES (2, 'World Zones', 'All International Zones', '2006-07-29 10:07:09', '0000-00-00 00:00:00');
INSERT INTO geo_zones VALUES (3, 'everything else', 'the rest', NULL, '2006-07-29 10:09:52');

Downunder QLD

2 Aug 2006, 1:18 AM
#7
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Is there a AU shipping mod for v1.3.0.2

Strangely I am also getting this. I never had this problem with previous zen carts prior to 1.3.0.2 .

Any ideas how may I fix this?


Zone Definitions - Taxes, Payment and Shipping
1146 Table 'arthq_store.zones_to_geo_zones' doesn't exist
in:
[select count(*) as num_zones from zones_to_geo_zones where geo_zone_id = '1' group by geo_zone_id]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

Downunder QLD

2 Aug 2006, 1:58 AM
#8
gerard avatar

gerard

Zen Follower

Join Date:
Oct 2005
Location:
Qld Australia
Posts:
124
Plugin Contributions:
1

Re: Is there a AU shipping mod for v1.3.0.2

Ignore the sample DB, I am not sure what it is doing there, but in the next version of Auspost, I will remove it :thumbsup:

The table 'arthq_store.zones", is that something you added?, because in my 3 shopping carts, that does not exsist. Have you used a table prefix "arthq" ?

Providing the php files are all in your "overides directories", then it should be as easy as admin/ modules/ shipping and then install the relevent modules.
Let me know how you go.

Gerard :smile:

The Quality of your Life is directly affected by the Quality of your Thoughts ...

2 Aug 2006, 2:09 AM
#9
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Is there a AU shipping mod for v1.3.0.2

When I look at my tables , they do not have prefixes. Site domain is called 'arthq' and not sure where its picking it up from.

admin/ modules/ shipping ?? no I think I have not done this yet. I'll see it it works after admin/ modules/ shipping fix.

.....oh you mean the navigation ..duh yes I have done this and can not see. I'll go back and chack all again

Thanks

Downunder QLD

2 Aug 2006, 2:18 AM
#10
gerard avatar

gerard

Zen Follower

Join Date:
Oct 2005
Location:
Qld Australia
Posts:
124
Plugin Contributions:
1

Re: Is there a AU shipping mod for v1.3.0.2

Do you have a URL ?

The Quality of your Life is directly affected by the Quality of your Thoughts ...

2 Aug 2006, 2:27 AM
#11
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Is there a AU shipping mod for v1.3.0.2

Silly silly me. I was placing all the austpost stuff under a folder within the template name. Asoon as I have took them out and put them in the defaukt dir as your instructions, they are there now.

Yes URL is http://www.arthq.com.au/store/

Downunder QLD

2 Aug 2006, 2:33 AM
#12
gerard avatar

gerard

Zen Follower

Join Date:
Oct 2005
Location:
Qld Australia
Posts:
124
Plugin Contributions:
1

Re: Is there a AU shipping mod for v1.3.0.2

So it works then :thumbsup:

Gerard :smile:

The Quality of your Life is directly affected by the Quality of your Thoughts ...

2 Aug 2006, 4:12 AM
#13
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Is there a AU shipping mod for v1.3.0.2

All the australian Post mods are showing fine EXCEPT in admin> Location/Taxes > Zone Definitions

says -
Zone Definitions - Taxes, Payment and Shipping
1146 Table 'arthq_store.zones_to_geo_zones' doesn't exist
in:
[select count(*) as num_zones from zones_to_geo_zones where geo_zone_id = '3' group by geo_zone_id]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

I don't have and have not selected prefixes , so why is it asking for 'arthq_store.zones_to_geo_zones' How can fix this have no idea and need the cart working by tomorrow. Please need help

Downunder QLD

2 Aug 2006, 5:15 AM
#14
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Is there a AU shipping mod for v1.3.0.2

Ok I have taken all austpost modules out. I have deleted the table geo_zones.

Now if I install any of the existing shipping modules, I am getting the same error message as below.

I need a Zen master please..

Downunder QLD

2 Aug 2006, 5:38 AM
#15
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Is there a AU shipping mod for v1.3.0.2

It seems I get this error when I select 'Zone Definitions - Taxes, Payment and Shipping' from admin

Downunder QLD

2 Aug 2006, 6:56 AM
#16
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Is there a AU shipping mod for v1.3.0.2

When it all fails ... start again .. whi said that?

Re installed database then re installed all the mods.

One thing I have noticed that
CREATE TABLE geo_zones and CREATE TABLE zones_to_geo_zones did not work as Mysql complained about not having the correct values for date_added datetime NOT NULL default '',

So in both tables
CREATE TABLE geo_zones
AND
CREATE TABLE zones_to_geo_zones

So change this -
date_added datetime NOT NULL default '',

to this
date_added datetime NOT NULL default '0001-01-01 00:00:00',

leave everyting else the same. It then works (I haven't tested yet)

Downunder QLD