Fontis_Australia - Version 1.2

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.2
Comparing to
See all releases


Code changes from version 1.1 to 1.2

app/code/community/Fontis/Australia/Model/Shipping/Carrier/Australiapost.php CHANGED
@@ -275,6 +275,24 @@ class Fontis_Australia_Model_Shipping_Carrier_Australiapost
275
  return $method;
276
  }
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  protected function _drcRequest($service, $fromPostCode, $toPostCode, $destCountry, $weight, $length, $width, $height, $num_boxes)
279
  {
280
  // Construct the appropriate URL and send all the information
@@ -289,13 +307,44 @@ class Fontis_Australia_Model_Shipping_Carrier_Australiapost
289
  "&Width=" . $width .
290
  "&Length=" . $length .
291
  "&Quantity=" . $num_boxes;
292
-
293
- $drc_result = file($url);
294
- $result = array();
295
- foreach($drc_result as $vals)
296
- {
297
- $tokens = split("=", $vals);
298
- $result[$tokens[0]] = trim($tokens[1]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  }
300
 
301
  return $result;
275
  return $method;
276
  }
277
 
278
+ protected function _curl_get_file_contents($url)
279
+ {
280
+ $c = curl_init();
281
+ curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
282
+ curl_setopt($c, CURLOPT_URL, $url);
283
+ $contents = curl_exec($c);
284
+ curl_close($c);
285
+
286
+ if ($contents)
287
+ {
288
+ return $contents;
289
+ }
290
+ else
291
+ {
292
+ return false;
293
+ }
294
+ }
295
+
296
  protected function _drcRequest($service, $fromPostCode, $toPostCode, $destCountry, $weight, $length, $width, $height, $num_boxes)
297
  {
298
  // Construct the appropriate URL and send all the information
307
  "&Width=" . $width .
308
  "&Length=" . $length .
309
  "&Quantity=" . $num_boxes;
310
+
311
+ if(ini_get('allow_url_fopen'))
312
+ {
313
+ Mage::log('Using fopen URL wrappers', null, 'fontis_australia.log');
314
+ $drc_result = file($url);
315
+ }
316
+ else if(extension_loaded('curl'))
317
+ {
318
+ Mage::log('fopen URL wrappers unavailable, using curl', null, 'fontis_australia.log');
319
+ try {
320
+ $drc_result = $this->_curl_get_file_contents($url);
321
+ } catch(Exception $e) {
322
+ Mage::log($e);
323
+ $drc_result = array();
324
+ $drc_result['err_msg'] = 'FAIL';
325
+ }
326
+
327
+ $drc_result = explode("\n",$drc_result);
328
+
329
+ //clean up array
330
+ foreach($drc_result as $k => $vals) {
331
+ if($vals == '') unset($drc_result[$k]);
332
+ }
333
+ }
334
+ else
335
+ {
336
+ Mage::log('No download method available, could not contact DRC!', null, 'fontis_australia.log');
337
+ $a = array();
338
+ $a['err_msg'] = 'FAIL';
339
+ return $a;
340
+ }
341
+ Mage::log("DRC result: " . $drc_result, null, 'fontis_australia.log');
342
+
343
+ $result = array();
344
+ foreach($drc_result as $vals)
345
+ {
346
+ $tokens = split("=", $vals);
347
+ $result[$tokens[0]] = trim($tokens[1]);
348
  }
349
 
350
  return $result;
app/code/community/Fontis/Australia/etc/config.xml CHANGED
@@ -23,7 +23,7 @@
23
  <config>
24
  <modules>
25
  <Fontis_Australia>
26
- <version>1.1</version>
27
  <depends>
28
  <Mage_Shipping />
29
  <Mage_Payment />
23
  <config>
24
  <modules>
25
  <Fontis_Australia>
26
+ <version>1.2</version>
27
  <depends>
28
  <Mage_Shipping />
29
  <Mage_Payment />
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fontis_Australia</name>
4
- <version>1.1</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>
@@ -9,10 +9,10 @@
9
  <summary>Broad extension that provides functionality for Australian stores.</summary>
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>2009-02-06</date>
14
- <time>00:52:33</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="065996bf3178e22242bc2f4bd7967189"/><file name="system.xml" hash="55e1454a117345d75972ce83501f1cf1"/></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="Mysql4"><dir name="Shipping"><dir name="Carrier"><dir name="Eparcel"><file name="Collection.php" hash="87f450c6b318060b83e7d7d0662cdf50"/></dir><file name="Eparcel.php" hash="17a03d0e38cb193539938b5f092d0398"/></dir></dir></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="1d5feafcee979417f0c654a5b159a6b6"/><file name="Eparcel.php" hash="952dda45bd21c68d14d110850c3a749e"/></dir><dir name="Config"><file name="Eparcel.php" hash="8c754cdc86316dbee53db68f0e2652bc"/><file name="Eparcelcondition.php" hash="b8cc830ab6e0e397d32bf574f60b0500"/><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="f475b13bb5319599c4a852cfb8788f9a"/><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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fontis_Australia</name>
4
+ <version>1.2</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>
9
  <summary>Broad extension that provides functionality for Australian stores.</summary>
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><author><name>Fontis</name><user>auto-converted</user><email>magento@fontis.com.au</email></author></authors>
13
+ <date>2009-06-23</date>
14
+ <time>03:58:57</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="a00aa901731440bafb4a675e15164f74"/><file name="system.xml" hash="55e1454a117345d75972ce83501f1cf1"/></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="Mysql4"><dir name="Shipping"><dir name="Carrier"><dir name="Eparcel"><file name="Collection.php" hash="87f450c6b318060b83e7d7d0662cdf50"/></dir><file name="Eparcel.php" hash="17a03d0e38cb193539938b5f092d0398"/></dir></dir></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="a5555c24db85f036ed32f38b13b6d101"/><file name="Eparcel.php" hash="952dda45bd21c68d14d110850c3a749e"/></dir><dir name="Config"><file name="Eparcel.php" hash="8c754cdc86316dbee53db68f0e2652bc"/><file name="Eparcelcondition.php" hash="b8cc830ab6e0e397d32bf574f60b0500"/><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="f475b13bb5319599c4a852cfb8788f9a"/><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>