Fontis_Australia - Version 1.0

Version Notes

Currently active are modules for BPAY, direct deposit, Australia Post, the addition of regions and postcodes, and the addition of ABN and phone number to the general configuration values (although currently not in use).

Download this release

Release Info

Developer Magento Core Team
Extension Fontis_Australia
Version 1.0
Comparing to
See all releases


Code changes from version 0.8.0 to 1.0

app/code/community/Fontis/Australia/Block/Autocomplete.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fontis Australia Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Fontis
16
+ * @package Fontis_Australia
17
+ * @author Chris Norton
18
+ * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /**
23
+ * Autocomplete queries list
24
+ */
25
+ class Fontis_Australia_Block_Autocomplete extends Mage_Core_Block_Abstract
26
+ {
27
+ protected function _toHtml()
28
+ {
29
+ $html = '';
30
+
31
+ if (!$this->_beforeToHtml()) {
32
+ return $html;
33
+ }
34
+
35
+ // Get the text that the customer has entered as a query.
36
+ $query = $this->helper('australia')->getQueryText();
37
+ $country = $this->helper('australia')->getQueryCountry();
38
+ if($country != "AU") return $html;
39
+
40
+ $conn = Mage::getModel('Core/Mysql4_Config')->getReadConnection();
41
+ $resultArray = $conn->fetchAll('SELECT au.*, dcr.region_id FROM au_postcode AS au
42
+ INNER JOIN directory_country_region AS dcr ON au.region_code = dcr.code
43
+ WHERE city LIKE \'%' . $query . '%\' ORDER BY city, region_code');
44
+
45
+ $html = '<ul>';
46
+ $counter = 0;
47
+ foreach ($resultArray as $item) {
48
+ $html .= '<li class="'.((++$counter)%2?'odd':'even').'" id="region-' . $item['region_id'] . '-postcode-' . $item['postcode'] . '">';
49
+ $html .= $item['city'] . '<span class="informal"> ' . $item['region_code'] . ', ' . $item['postcode'] . '</span>';
50
+ $html .= '</li>';
51
+ }
52
+
53
+ $html.= '</ul>';
54
+
55
+ return $html;
56
+ }
57
+ }
app/code/community/Fontis/Australia/Helper/Data.php CHANGED
@@ -24,5 +24,41 @@
24
  */
25
  class Fontis_Australia_Helper_Data extends Mage_Core_Helper_Abstract
26
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  }
24
  */
25
  class Fontis_Australia_Helper_Data extends Mage_Core_Helper_Abstract
26
  {
27
+ const MAX_QUERY_LEN = 100;
28
+
29
+ protected $_queryText;
30
+
31
+ /**
32
+ * Gets the query text for city lookups in the postcode database.
33
+ */
34
+ public function getQueryText()
35
+ {
36
+ if (is_null($this->_queryText)) {
37
+ if($this->_getRequest()->getParam('billing')) {
38
+ $tmp = $this->_getRequest()->getParam('billing');
39
+ $this->_queryText = $tmp['city'];
40
+ } else if($this->_getRequest()->getParam('shipping')) {
41
+ $tmp = $this->_getRequest()->getParam('shipping');
42
+ $this->_queryText = $tmp['city'];
43
+ } else {
44
+ $this->_queryText = $this->_getRequest()->getParam('city');
45
+ }
46
+ $this->_queryText = trim($this->_queryText);
47
+ if (Mage::helper('core/string')->strlen($this->_queryText) > self::MAX_QUERY_LEN) {
48
+ $this->_queryText = Mage::helper('core/string')->substr($this->_queryText, 0, self::MAX_QUERY_LEN);
49
+ }
50
+ }
51
+ return $this->_queryText;
52
+ }
53
+
54
+ public function getQueryCountry()
55
+ {
56
+ return $this->_queryText = $this->_getRequest()->getParam('country');
57
+ }
58
+
59
+ public function getCitySuggestUrl()
60
+ {
61
+ return $this->_getUrl('australia/ajax/suggest');
62
+ }
63
 
64
  }
app/code/community/Fontis/Australia/Model/Payment/Westpac/PayWay_Api.php DELETED
@@ -1,170 +0,0 @@
1
- <?php
2
- /**
3
- * Fontis Australia Extension
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Fontis
16
- * @package Fontis_Australia
17
- * @author Chris Norton
18
- * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
- */
21
-
22
- /**
23
- * PayWay API payment model
24
- *
25
- * @category Fontis
26
- * @package Fontis_Australia
27
- */
28
- class Fontis_Australia_Model_Payment_Westpac_PayWay_Api extends Mage_Payment_Model_Method_Abstract
29
- {
30
- protected $_code = 'bpay';
31
- protected $_formBlockType = 'fontis_australia_block_payway_api_form';
32
- protected $_infoBlockType = 'fontis_australia_block_payway_api_info';
33
-
34
- protected $_ref = null;
35
-
36
- // Set to allow the admin to set whether or not payment has been received.
37
- protected $_canCapture = true;
38
-
39
- public function isAvailable($quote = null)
40
- {
41
- $groupAccess = $this->getConfigData('customer_group_access');
42
- $group = $this->getConfigData('customer_group');
43
-
44
- if($groupAccess == 0)
45
- {
46
- // No restrictions on access
47
- return true;
48
- }
49
- elseif($groupAccess == 1)
50
- {
51
- // Only allow customer to access this method if they are part of the
52
- // specified group
53
- if($group == $quote->getCustomerGroupId())
54
- {
55
- return true;
56
- }
57
- }
58
- elseif($groupAccess == 2)
59
- {
60
- // Only allow customer to access this method if they are NOT part
61
- // of the specified group
62
- if($group != $quote->getCustomerGroupId())
63
- {
64
- return true;
65
- }
66
- }
67
-
68
- // Default, restrict access
69
- return false;
70
- }
71
-
72
- /**
73
- * Assign data to info model instance
74
- *
75
- * @param mixed $data
76
- * @return Fontis_Australia_Model_Payment_Method_Bpay
77
- */
78
- public function assignData($data)
79
- {
80
- $info = $this->getInfoInstance();
81
- $info->setBillerCode($this->getBillerCode());
82
- $info->setRef($this->getRef());
83
-
84
- $details = array();
85
- if ($this->getBillerCode())
86
- {
87
- $details['biller_code'] = $this->getBillerCode();
88
-
89
- if($this->getRef())
90
- {
91
- $details['ref'] = $this->getRef();
92
- }
93
- }
94
- if (!empty($details))
95
- {
96
- $this->getInfoInstance()->setAdditionalData(serialize($details));
97
- }
98
- return $this;
99
- }
100
-
101
- public function getBillerCode()
102
- {
103
- return $this->getConfigData('biller_code');
104
- }
105
-
106
- public function getRef()
107
- {
108
- if($this->_ref)
109
- {
110
- return $this->_ref;
111
- }
112
- else
113
- {
114
- // Check whether we will be calculating the reference code based on
115
- // the customer ID or the order ID.
116
- if($this->getConfigData('calculate_using_customerid'))
117
- {
118
- $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
119
-
120
- if($customer_id)
121
- {
122
- $this->_ref = $this->calculateRef($customer_id);
123
- return $this->_ref;
124
- }
125
- else
126
- {
127
- return null;
128
- }
129
- }
130
- else
131
- {
132
- $order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
133
- $this->_ref = 0123456789;
134
- return $this->_ref;
135
- }
136
-
137
- }
138
- }
139
-
140
- public function calculateRef($number)
141
- {
142
- $revstr = strrev(intval($number));
143
- $total = 0;
144
- for ($i = 0;$i < strlen($revstr); $i++)
145
- {
146
- if ($i%2 == 0)
147
- {
148
- $multiplier = 2;
149
- }
150
- else
151
- {
152
- $multiplier = 1;
153
- }
154
-
155
- $sub_total = intval($revstr[$i]) * $multiplier;
156
-
157
- if ($sub_total >= 10)
158
- {
159
- $temp = (string) $sub_total;
160
- $sub_total = intval($temp[0]) + intval($temp[1]);
161
- }
162
-
163
- $total += $sub_total;
164
- }
165
-
166
- $check_digit = (10 - ($total % 10))%10;
167
- $crn = str_pad($number,6-1,0,STR_PAD_LEFT) . $check_digit ;
168
- return $crn;
169
- }
170
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Fontis/Australia/Model/Payment/Westpac/PayWay_Net.php DELETED
@@ -1,170 +0,0 @@
1
- <?php
2
- /**
3
- * Fontis Australia Extension
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Fontis
16
- * @package Fontis_Australia
17
- * @author Chris Norton
18
- * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
- */
21
-
22
- /**
23
- * PayWay Net payment model
24
- *
25
- * @category Fontis
26
- * @package Fontis_Australia
27
- */
28
- class Fontis_Australia_Model_Payment_Westpac_PayWay_Net extends Mage_Payment_Model_Method_Abstract
29
- {
30
- protected $_code = 'bpay';
31
- protected $_formBlockType = 'fontis_australia_block_payway_net_form';
32
- protected $_infoBlockType = 'fontis_australia_block_payway_net_info';
33
-
34
- protected $_ref = null;
35
-
36
- // Set to allow the admin to set whether or not payment has been received.
37
- protected $_canCapture = true;
38
-
39
- public function isAvailable($quote = null)
40
- {
41
- $groupAccess = $this->getConfigData('customer_group_access');
42
- $group = $this->getConfigData('customer_group');
43
-
44
- if($groupAccess == 0)
45
- {
46
- // No restrictions on access
47
- return true;
48
- }
49
- elseif($groupAccess == 1)
50
- {
51
- // Only allow customer to access this method if they are part of the
52
- // specified group
53
- if($group == $quote->getCustomerGroupId())
54
- {
55
- return true;
56
- }
57
- }
58
- elseif($groupAccess == 2)
59
- {
60
- // Only allow customer to access this method if they are NOT part
61
- // of the specified group
62
- if($group != $quote->getCustomerGroupId())
63
- {
64
- return true;
65
- }
66
- }
67
-
68
- // Default, restrict access
69
- return false;
70
- }
71
-
72
- /**
73
- * Assign data to info model instance
74
- *
75
- * @param mixed $data
76
- * @return Fontis_Australia_Model_Payment_Method_Bpay
77
- */
78
- public function assignData($data)
79
- {
80
- $info = $this->getInfoInstance();
81
- $info->setBillerCode($this->getBillerCode());
82
- $info->setRef($this->getRef());
83
-
84
- $details = array();
85
- if ($this->getBillerCode())
86
- {
87
- $details['biller_code'] = $this->getBillerCode();
88
-
89
- if($this->getRef())
90
- {
91
- $details['ref'] = $this->getRef();
92
- }
93
- }
94
- if (!empty($details))
95
- {
96
- $this->getInfoInstance()->setAdditionalData(serialize($details));
97
- }
98
- return $this;
99
- }
100
-
101
- public function getBillerCode()
102
- {
103
- return $this->getConfigData('biller_code');
104
- }
105
-
106
- public function getRef()
107
- {
108
- if($this->_ref)
109
- {
110
- return $this->_ref;
111
- }
112
- else
113
- {
114
- // Check whether we will be calculating the reference code based on
115
- // the customer ID or the order ID.
116
- if($this->getConfigData('calculate_using_customerid'))
117
- {
118
- $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
119
-
120
- if($customer_id)
121
- {
122
- $this->_ref = $this->calculateRef($customer_id);
123
- return $this->_ref;
124
- }
125
- else
126
- {
127
- return null;
128
- }
129
- }
130
- else
131
- {
132
- $order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
133
- $this->_ref = 0123456789;
134
- return $this->_ref;
135
- }
136
-
137
- }
138
- }
139
-
140
- public function calculateRef($number)
141
- {
142
- $revstr = strrev(intval($number));
143
- $total = 0;
144
- for ($i = 0;$i < strlen($revstr); $i++)
145
- {
146
- if ($i%2 == 0)
147
- {
148
- $multiplier = 2;
149
- }
150
- else
151
- {
152
- $multiplier = 1;
153
- }
154
-
155
- $sub_total = intval($revstr[$i]) * $multiplier;
156
-
157
- if ($sub_total >= 10)
158
- {
159
- $temp = (string) $sub_total;
160
- $sub_total = intval($temp[0]) + intval($temp[1]);
161
- }
162
-
163
- $total += $sub_total;
164
- }
165
-
166
- $check_digit = (10 - ($total % 10))%10;
167
- $crn = str_pad($number,6-1,0,STR_PAD_LEFT) . $check_digit ;
168
- return $crn;
169
- }
170
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Fontis/Australia/controllers/AjaxController.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fontis Australia Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com and you will be sent a copy immediately.
14
+ *
15
+ * @category Fontis
16
+ * @package Fontis_Australia
17
+ * @author Chris Norton
18
+ * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /**
23
+ * Australia AJAX Controller
24
+ *
25
+ * The primary purpose of this controller is to allow for AJAX requests to query the postcode database.
26
+ *
27
+ * @category Fontis
28
+ * @package Fontis_Australia
29
+ * @module Australia
30
+ */
31
+ class Fontis_Australia_AjaxController extends Mage_Core_Controller_Front_Action
32
+ {
33
+ public function suggestAction()
34
+ {
35
+ $this->getResponse()->setBody($this->getLayout()->createBlock('australia/autocomplete')->toHtml());
36
+ }
37
+ }
app/code/community/Fontis/Australia/etc/config.xml CHANGED
@@ -23,7 +23,7 @@
23
  <config>
24
  <modules>
25
  <Fontis_Australia>
26
- <version>0.8.0</version>
27
  <depends>
28
  <Mage_Shipping />
29
  <Mage_Payment />
@@ -95,6 +95,13 @@
95
  </args>
96
  </australia>
97
  </routers>
 
 
 
 
 
 
 
98
  </frontend>
99
  <default>
100
  <carriers>
23
  <config>
24
  <modules>
25
  <Fontis_Australia>
26
+ <version>1.0</version>
27
  <depends>
28
  <Mage_Shipping />
29
  <Mage_Payment />
95
  </args>
96
  </australia>
97
  </routers>
98
+ <layout>
99
+ <updates>
100
+ <australia module="Fontis_Australia">
101
+ <file>fontis_australia.xml</file>
102
+ </australia>
103
+ </updates>
104
+ </layout>
105
  </frontend>
106
  <default>
107
  <carriers>
app/code/community/Fontis/Australia/sql/australia_setup/postcodes.txt CHANGED
@@ -8982,7 +8982,7 @@
8982
  ('3996','Pound\ Creek','VIC')
8983
  ('4000','Brisbane','QLD')
8984
  ('4000','Brisbane\ Adelaide\ Street','QLD')
8985
- ('4000','Brisbane\ Gpo','QLD')
8986
  ('4000','Spring\ Hill','QLD')
8987
  ('4001','Brisbane','QLD')
8988
  ('4001','Central\ Plaza','QLD')
@@ -14198,7 +14198,7 @@
14198
  ('5950','Export\ Park','SA')
14199
  ('6000','City\ Delivery\ Centre','WA')
14200
  ('6000','Perth','WA')
14201
- ('6000','Perth\ Gpo','WA')
14202
  ('6001','Perth','WA')
14203
  ('6003','Highgate','WA')
14204
  ('6003','Northbridge','WA')
@@ -16919,14 +16919,14 @@
16919
  ('9010','Brisbane','QLD')
16920
  ('9013','Brisbane','QLD')
16921
  ('9015','Brisbane','QLD')
16922
- ('9016','Brisbane\ Gpo\ Boxes','QLD')
16923
- ('9017','Brisbane\ Gpo\ Boxes','QLD')
16924
- ('9018','Brisbane\ Gpo\ Boxes','QLD')
16925
- ('9019','Brisbane\ Gpo\ Boxes','QLD')
16926
  ('9020','Brisbane','QLD')
16927
- ('9021','Brisbane\ Gpo\ Boxes','QLD')
16928
- ('9022','Brisbane\ Gpo\ Boxes','QLD')
16929
- ('9023','Brisbane\ Gpo\ Boxes','QLD')
16930
  ('9464','Northgate\ Mc','QLD')
16931
  ('9726','Gold\ Coast\ Mc','QLD')
16932
  ('9728','Gold\ Coast\ Mc','QLD')
8982
  ('3996','Pound\ Creek','VIC')
8983
  ('4000','Brisbane','QLD')
8984
  ('4000','Brisbane\ Adelaide\ Street','QLD')
8985
+ ('4000','Brisbane\ GPO','QLD')
8986
  ('4000','Spring\ Hill','QLD')
8987
  ('4001','Brisbane','QLD')
8988
  ('4001','Central\ Plaza','QLD')
14198
  ('5950','Export\ Park','SA')
14199
  ('6000','City\ Delivery\ Centre','WA')
14200
  ('6000','Perth','WA')
14201
+ ('6000','Perth\ GPO','WA')
14202
  ('6001','Perth','WA')
14203
  ('6003','Highgate','WA')
14204
  ('6003','Northbridge','WA')
16919
  ('9010','Brisbane','QLD')
16920
  ('9013','Brisbane','QLD')
16921
  ('9015','Brisbane','QLD')
16922
+ ('9016','Brisbane\ GPO\ Boxes','QLD')
16923
+ ('9017','Brisbane\ GPO\ Boxes','QLD')
16924
+ ('9018','Brisbane\ GPO\ Boxes','QLD')
16925
+ ('9019','Brisbane\ GPO\ Boxes','QLD')
16926
  ('9020','Brisbane','QLD')
16927
+ ('9021','Brisbane\ GPO\ Boxes','QLD')
16928
+ ('9022','Brisbane\ GPO\ Boxes','QLD')
16929
+ ('9023','Brisbane\ GPO\ Boxes','QLD')
16930
  ('9464','Northgate\ Mc','QLD')
16931
  ('9726','Gold\ Coast\ Mc','QLD')
16932
  ('9728','Gold\ Coast\ Mc','QLD')
app/design/frontend/default/default/template/fontis/australia/postcode-checkout.phtml ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fontis Australia Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Fontis
16
+ * @package Fontis_Australia
17
+ * @author Chris Norton
18
+ * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ ?>
22
+ <script type="text/javascript">
23
+
24
+ //============ Billing ============//
25
+ var autocomplete_city_billing = new Element('div', { id: 'autocomplete_city_billing', 'class': 'search-autocomplete' });
26
+ $('billing:city').parentNode.appendChild(autocomplete_city_billing);
27
+
28
+ function updateAddressBilling(text, item) {
29
+ // Update state and postcode fields
30
+ var id = item.id;
31
+ var tokens = id.split('-');
32
+
33
+ // Assume item at index 1 is region_id, item at index 3 is postcode
34
+ $('billing:region_id').value = tokens[1];
35
+ $('billing:postcode').value = tokens[3];
36
+ }
37
+
38
+ // Create the autocompleter and assign it to a variable for future use.
39
+ var completer = new Ajax.Autocompleter("billing:city", "autocomplete_city_billing", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
40
+ afterUpdateElement: updateAddressBilling,
41
+ minChars: 2,
42
+ parameters: 'country=' + $F('billing:country_id')
43
+ });
44
+
45
+ // Detect when the country has changed and update the parameters sent by the autocompleter.
46
+ $('billing:country_id').observe('change', function() {
47
+ completer = new Ajax.Autocompleter("billing:city", "autocomplete_city_billing", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
48
+ afterUpdateElement: updateAddressBilling,
49
+ minChars: 2,
50
+ parameters: 'country=' + $F('billing:country_id')
51
+ });
52
+ });
53
+
54
+ //============ Shipping ============//
55
+ var autocomplete_city_shipping = new Element('div', { id: 'autocomplete_city_shipping', 'class': 'search-autocomplete' });
56
+ $('shipping:city').parentNode.appendChild(autocomplete_city_shipping);
57
+
58
+ function updateAddressShipping(text, item) {
59
+ // Update state and postcode fields
60
+ var id = item.id;
61
+ var tokens = id.split('-');
62
+
63
+ // Assume item at index 1 is region_id, item at index 3 is postcode
64
+ $('shipping:region_id').value = tokens[1];
65
+ $('shipping:postcode').value = tokens[3];
66
+ }
67
+
68
+ // Create the autocompleter and assign it to a variable for future use.
69
+ var completer = new Ajax.Autocompleter("shipping:city", "autocomplete_city_shipping", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
70
+ afterUpdateElement: updateAddressShipping,
71
+ minChars: 2,
72
+ parameters: 'country=' + $F('shipping:country_id')
73
+ });
74
+
75
+ // Detect when the country has changed and update the parameters sent by the autocompleter.
76
+ $('shipping:country_id').observe('change', function() {
77
+ completer = new Ajax.Autocompleter("shipping:city", "autocomplete_city_shipping", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
78
+ afterUpdateElement: updateAddressShipping,
79
+ minChars: 2,
80
+ parameters: 'country=' + $F('shipping:country_id')
81
+ });
82
+ });
83
+
84
+ </script>
app/design/frontend/default/default/template/fontis/australia/postcode.phtml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fontis Australia Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Fontis
16
+ * @package Fontis_Australia
17
+ * @author Chris Norton
18
+ * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ ?>
22
+ <script type="text/javascript">
23
+
24
+ // Create and insert the div that will hold the list of autocomplete items. This
25
+ // is added to the DOM immediately following the #city field.
26
+ var autocomplete_city = new Element('div', { id: 'autocomplete_city', 'class': 'search-autocomplete' });
27
+ $('city').parentNode.appendChild(autocomplete_city);
28
+
29
+ function updateAddress(text, item) {
30
+ // Update state and postcode fields
31
+ var id = item.id;
32
+ var tokens = id.split('-');
33
+
34
+ // Assume item at index 1 is region_id, item at index 3 is postcode
35
+ $('region_id').value = tokens[1];
36
+ $('zip').value = tokens[3];
37
+ }
38
+
39
+ // Create the autocompleter and assign it to a variable for future use.
40
+ var completer = new Ajax.Autocompleter("city", "autocomplete_city", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
41
+ afterUpdateElement: updateAddress,
42
+ minChars: 2,
43
+ parameters: 'country=' + $F('country')
44
+ });
45
+
46
+ // Detect when the country has changed and update the parameters sent by the autocompleter.
47
+ $('country').observe('change', function() {
48
+ completer = new Ajax.Autocompleter("city", "autocomplete_city", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
49
+ afterUpdateElement: updateAddress,
50
+ minChars: 2,
51
+ parameters: 'country=' + $F('country')
52
+ });
53
+ });
54
+
55
+ </script>
app/design/frontend/default/default/template/fontis/australia/postcode.phtml.~1~ ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fontis Australia Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Fontis
16
+ * @package Fontis_Australia
17
+ * @author Chris Norton
18
+ * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ ?>
22
+ <script type="text/javascript">
23
+
24
+ // Create and insert the div that will hold the list of autocomplete items. This
25
+ // is added to the DOM immediately following the #city field.
26
+ var autocomplete_city = new Element('div', { id: 'autocomplete_city', 'class': 'search-autocomplete' });
27
+
28
+ function updateAddress(text, item) {
29
+ // Update state and postcode fields
30
+ var id = item.id;
31
+ var tokens = id.split('-');
32
+
33
+ // Assume item at index 1 is region_id, item at index 3 is postcode
34
+ $('region_id').value = tokens[1];
35
+ $('zip').value = tokens[3];
36
+ }
37
+
38
+ if($('city')) {
39
+ function updateAddress(text, item) {
40
+ // Update state and postcode fields
41
+ var id = item.id;
42
+ var tokens = id.split('-');
43
+
44
+ // Assume item at index 1 is region_id, item at index 3 is postcode
45
+ $('region_id').value = tokens[1];
46
+ $('zip').value = tokens[3];
47
+ }
48
+
49
+ $('city').parentNode.appendChild(autocomplete_city);
50
+
51
+ // Create the autocompleter and assign it to a variable for future use.
52
+ var completer = new Ajax.Autocompleter("city", "autocomplete_city", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
53
+ afterUpdateElement: updateAddress,
54
+ minChars: 2,
55
+ parameters: 'country=' + $F('country')
56
+ });
57
+
58
+ // Detect when the country has changed and update the parameters sent by the autocompleter.
59
+ $('country').observe('change', function() {
60
+ completer = new Ajax.Autocompleter("city", "autocomplete_city", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
61
+ afterUpdateElement: updateAddress,
62
+ minChars: 2,
63
+ parameters: 'country=' + $F('country')
64
+ });
65
+ });
66
+ }
67
+
68
+ if($('billing:city')) {
69
+ function updateAddress(text, item) {
70
+ // Update state and postcode fields
71
+ var id = item.id;
72
+ var tokens = id.split('-');
73
+
74
+ // Assume item at index 1 is region_id, item at index 3 is postcode
75
+ $('billing:region_id').value = tokens[1];
76
+ $('billing:postcode').value = tokens[3];
77
+ }
78
+
79
+ $('billing:city').parentNode.appendChild(autocomplete_city);
80
+
81
+ // Create the autocompleter and assign it to a variable for future use.
82
+ var completer = new Ajax.Autocompleter("billing:city", "autocomplete_city", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
83
+ afterUpdateElement: updateAddress,
84
+ minChars: 2,
85
+ parameters: 'country=' + $F('billing:country_id')
86
+ });
87
+
88
+ // Detect when the country has changed and update the parameters sent by the autocompleter.
89
+ $('billing:country_id').observe('change', function() {
90
+ completer = new Ajax.Autocompleter("billing:city", "autocomplete_city", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
91
+ afterUpdateElement: updateAddress,
92
+ minChars: 2,
93
+ parameters: 'country=' + $F('billing:country_id')
94
+ });
95
+ });
96
+ }
97
+
98
+
99
+ if($('shipping:city')) {
100
+ function updateAddress(text, item) {
101
+ // Update state and postcode fields
102
+ var id = item.id;
103
+ var tokens = id.split('-');
104
+
105
+ // Assume item at index 1 is region_id, item at index 3 is postcode
106
+ $('shipping:region_id').value = tokens[1];
107
+ $('shipping:postcode').value = tokens[3];
108
+ }
109
+
110
+ $('shipping:city').parentNode.appendChild(autocomplete_city);
111
+
112
+ // Create the autocompleter and assign it to a variable for future use.
113
+ var completer = new Ajax.Autocompleter("shipping:city", "autocomplete_city", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
114
+ afterUpdateElement: updateAddress,
115
+ minChars: 2,
116
+ parameters: 'country=' + $F('shipping:country_id')
117
+ });
118
+
119
+ // Detect when the country has changed and update the parameters sent by the autocompleter.
120
+ $('shipping:country_id').observe('change', function() {
121
+ completer = new Ajax.Autocompleter("shipping:city", "autocomplete_city", "<?=$this->helper('australia')->getCitySuggestUrl();?>", {
122
+ afterUpdateElement: updateAddress,
123
+ minChars: 2,
124
+ parameters: 'country=' + $F('shipping:country_id')
125
+ });
126
+ });
127
+ }
128
+ </script>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fontis_Australia</name>
4
- <version>0.8.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>This extension is intended to provide most of the functionality needed to run a Magento store in Australia. This includes all essential payment and shipping methods as well as small localisations such as adding the store's ABN, adding Australian states and territories to the region directory and adding in a postcode database.</description>
11
  <notes>Currently active are modules for BPAY, direct deposit, Australia Post, the addition of regions and postcodes, and the addition of ABN and phone number to the general configuration values (although currently not in use).</notes>
12
  <authors><author><name>Chris Norton</name><user>auto-converted</user><email>chris.norton@fontis.com.au</email></author><author><name>Lloyd Hazlett</name><user>auto-converted</user><email>hazzard43@fastmail.fm</email></author></authors>
13
- <date>2008-08-18</date>
14
- <time>08:39:17</time>
15
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="fontis"><dir name="australia"><dir name="payment"><dir name="bpay"><file name="form.phtml" hash="2bd318e4e8ac220a6b2f8339d5cf090d"/><file name="info.phtml" hash="70dae47552b94f5773afb59d00555a4b"/></dir><dir name="directdeposit"><file name="form.phtml" hash="1d01443b2e0f3147bf65dd9c799d4744"/><file name="info.phtml" hash="70d76862e026d4e8d76e6c32a36a5d74"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="fontis"><dir name="australia"><dir name="payment"><dir name="bpay"><file name="form.phtml" hash="2bd318e4e8ac220a6b2f8339d5cf090d"/><file name="info.phtml" hash="f578ec338f8b333f20af6253676fa167"/></dir><dir name="directdeposit"><file name="form.phtml" hash="1ad42dfd4409c49166e864469b24b898"/><file name="info.phtml" hash="70d76862e026d4e8d76e6c32a36a5d74"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Fontis"><dir name="Australia"><dir name="Block"><dir name="Bpay"><file name="Form.php" hash="958e11d14d7c87054a68d34b60c498d6"/><file name="Info.php" hash="a28f40be3c76637eb43ba80c61031512"/></dir><dir name="Directdeposit"><file name="Form.php" hash="13589d5d85499678bdc62fde04107095"/><file name="Info.php" hash="0f31ac7451127c87813c823423a9057b"/></dir></dir><dir name="etc"><file name="config.xml" hash="7f178215ce15d810f804e38d6b976450"/><file name="system.xml" hash="da40a4584279c6b0618f64ec5c6651fd"/></dir><dir name="Helper"><file name="Data.php" hash="8aa57f77ae93ad1b6371c0b3e34e4a79"/></dir><dir name="Model"><dir name="Config"><file name="CustomerGroupAccess.php" hash="e531a8049b9a877e01c2b806b065dbef"/><file name="CustomerGroups.php" hash="8014e56b1141cb9bbb63f807ec1c87a5"/></dir><dir name="Payment"><dir name="Westpac"><file name="PayWay_Api.php" hash="9bf2eb944136d2fd30c3c5e4443987e2"/><file name="PayWay_Net.php" hash="5ae8290955bc009b54081401bd38692b"/></dir><file name="Bpay.php" hash="56d5b9d3e17cbc9ff4316fef2574401a"/><file name="Directdeposit.php" hash="21c4febe6d321450fba4de5e655093c8"/></dir><dir name="Shipping"><dir name="Carrier"><file name="Australiapost.php" hash="791bdc2384774739a7563ab548400cbc"/></dir><dir name="Config"><file name="Weightunits.php" hash="e13ba9de393ae67420f863d4008c3c72"/></dir></dir><dir name="Tax"><file name="Gst.php" hash="d7e024971dab498e80de8c957d2911f2"/></dir></dir><dir name="sql"><dir name="australia_setup"><file name="mysql4-install-0.7.0.php" hash="c85da407f2817d022b065a3baa1b2688"/><file name="postcodes.txt" hash="7ed0415d5e9972b60c990f5660e03aae"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fontis_Australia.xml" hash="a60b83cf1b1b449a16fe09da16342a4d"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fontis_Australia</name>
4
+ <version>1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
  <channel>community</channel>
10
  <description>This extension is intended to provide most of the functionality needed to run a Magento store in Australia. This includes all essential payment and shipping methods as well as small localisations such as adding the store's ABN, adding Australian states and territories to the region directory and adding in a postcode database.</description>
11
  <notes>Currently active are modules for BPAY, direct deposit, Australia Post, the addition of regions and postcodes, and the addition of ABN and phone number to the general configuration values (although currently not in use).</notes>
12
  <authors><author><name>Chris Norton</name><user>auto-converted</user><email>chris.norton@fontis.com.au</email></author><author><name>Lloyd Hazlett</name><user>auto-converted</user><email>hazzard43@fastmail.fm</email></author></authors>
13
+ <date>2008-10-27</date>
14
+ <time>07:14:15</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="fontis"><dir name="australia"><dir name="payment"><dir name="bpay"><file name="form.phtml" hash="2bd318e4e8ac220a6b2f8339d5cf090d"/><file name="info.phtml" hash="70dae47552b94f5773afb59d00555a4b"/></dir><dir name="directdeposit"><file name="form.phtml" hash="1d01443b2e0f3147bf65dd9c799d4744"/><file name="info.phtml" hash="70d76862e026d4e8d76e6c32a36a5d74"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="fontis"><dir name="australia"><dir name="payment"><dir name="bpay"><file name="form.phtml" hash="2bd318e4e8ac220a6b2f8339d5cf090d"/><file name="info.phtml" hash="f578ec338f8b333f20af6253676fa167"/></dir><dir name="directdeposit"><file name="form.phtml" hash="1ad42dfd4409c49166e864469b24b898"/><file name="info.phtml" hash="70d76862e026d4e8d76e6c32a36a5d74"/></dir></dir><file name="postcode-checkout.phtml" hash="51867acd43c4f8c982ab1fea103a579f"/><file name="postcode.phtml" hash="b0d7bfa170c7ca3bd4a256f0404d7189"/><file name="postcode.phtml.~1~" hash="85dbbd2b416f85f230dcce12e52cb397"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Fontis"><dir name="Australia"><dir name="Block"><dir name="Bpay"><file name="Form.php" hash="958e11d14d7c87054a68d34b60c498d6"/><file name="Info.php" hash="a28f40be3c76637eb43ba80c61031512"/></dir><dir name="Directdeposit"><file name="Form.php" hash="13589d5d85499678bdc62fde04107095"/><file name="Info.php" hash="0f31ac7451127c87813c823423a9057b"/></dir><file name="Autocomplete.php" hash="4f33f809dae969781ead580b13e9bd3a"/></dir><dir name="controllers"><file name="AjaxController.php" hash="5fb086e3236446b6a6f10f4c78eb3fcb"/></dir><dir name="etc"><file name="config.xml" hash="dfe2fc7f2706d90f6f41f89d9cdfe3db"/><file name="system.xml" hash="da40a4584279c6b0618f64ec5c6651fd"/></dir><dir name="Helper"><file name="Data.php" hash="e493486d7a5ccd5589d99d08b136b819"/></dir><dir name="Model"><dir name="Config"><file name="CustomerGroupAccess.php" hash="e531a8049b9a877e01c2b806b065dbef"/><file name="CustomerGroups.php" hash="8014e56b1141cb9bbb63f807ec1c87a5"/></dir><dir name="Payment"><file name="Bpay.php" hash="56d5b9d3e17cbc9ff4316fef2574401a"/><file name="Directdeposit.php" hash="21c4febe6d321450fba4de5e655093c8"/></dir><dir name="Shipping"><dir name="Carrier"><file name="Australiapost.php" hash="791bdc2384774739a7563ab548400cbc"/></dir><dir name="Config"><file name="Weightunits.php" hash="e13ba9de393ae67420f863d4008c3c72"/></dir></dir><dir name="Tax"><file name="Gst.php" hash="d7e024971dab498e80de8c957d2911f2"/></dir></dir><dir name="sql"><dir name="australia_setup"><file name="mysql4-install-0.7.0.php" hash="c85da407f2817d022b065a3baa1b2688"/><file name="postcodes.txt" hash="21083a0f94e200259c9b4540666b251e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fontis_Australia.xml" hash="a60b83cf1b1b449a16fe09da16342a4d"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>