Fontis_Australia - Version 2.5.0

Version Notes

Download this release

Release Info

Developer Fontis
Extension Fontis_Australia
Version 2.5.0
Comparing to
See all releases


Code changes from version 2.2.5 to 2.5.0

Files changed (71) hide show
  1. app/code/community/Fontis/Australia/Block/Autocomplete.php +5 -22
  2. app/code/community/Fontis/Australia/Block/Bpay/Form.php +1 -4
  3. app/code/community/Fontis/Australia/Block/Bpay/Info.php +2 -5
  4. app/code/community/Fontis/Australia/Block/Directdeposit/Form.php +1 -4
  5. app/code/community/Fontis/Australia/Block/Directdeposit/Info.php +4 -7
  6. app/code/community/Fontis/Australia/Block/Eparcel/Rate/Export.php +35 -0
  7. app/code/community/Fontis/Australia/Block/Getprice.php +3 -6
  8. app/code/community/Fontis/Australia/Block/Googleproducts.php +8 -11
  9. app/code/community/Fontis/Australia/Block/Myshopping.php +3 -6
  10. app/code/community/Fontis/Australia/Block/Shopbot.php +4 -7
  11. app/code/community/Fontis/Australia/Block/Shoppingdotcom.php +6 -9
  12. app/code/community/Fontis/Australia/Helper/Bpay.php +8 -11
  13. app/code/community/Fontis/Australia/Helper/Data.php +71 -22
  14. app/code/community/Fontis/Australia/Helper/Eparcel.php +117 -0
  15. app/code/community/Fontis/Australia/Model/Config/Condition.php +19 -3
  16. app/code/community/Fontis/Australia/Model/Config/CustomerGroupAccess.php +9 -12
  17. app/code/community/Fontis/Australia/Model/Config/CustomerGroups.php +17 -18
  18. app/code/community/Fontis/Australia/Model/Config/EmailNotificationLevel.php +29 -0
  19. app/code/community/Fontis/Australia/Model/Config/ProductAttributes.php +45 -50
  20. app/code/community/Fontis/Australia/Model/Mysql4/Shipping/Carrier/Eparcel.php +90 -79
  21. app/code/community/Fontis/Australia/Model/Mysql4/Shipping/Carrier/Eparcel/Collection.php +1 -4
  22. app/code/community/Fontis/Australia/Model/Observer.php +42 -0
  23. app/code/community/Fontis/Australia/Model/Payment/Bpay.php +33 -36
  24. app/code/community/Fontis/Australia/Model/Payment/Directdeposit.php +9 -12
  25. app/code/community/Fontis/Australia/Model/Shipping/Carrier/Australiapost.php +57 -61
  26. app/code/community/Fontis/Australia/Model/Shipping/Carrier/Eparcel.php +161 -314
  27. app/code/community/Fontis/Australia/Model/Shipping/Carrier/Eparcel/Export/Abstract.php +147 -147
  28. app/code/community/Fontis/Australia/Model/Shipping/Carrier/Eparcel/Export/Csv.php +97 -146
  29. app/code/community/Fontis/Australia/Model/Shipping/Carrier/Eparcel/Export/Exception.php +18 -4
  30. app/code/community/Fontis/Australia/Model/Shipping/Config/Eparcel.php +5 -8
  31. app/code/community/Fontis/Australia/Model/Shipping/Config/Eparcelcondition.php +1 -4
  32. app/code/community/Fontis/Australia/Model/Shipping/Config/Shippingmethods.php +2 -5
  33. app/code/community/Fontis/Australia/Model/Shipping/Config/Weightunits.php +1 -4
  34. app/code/community/Fontis/Australia/controllers/AjaxController.php +1 -4
  35. app/code/community/Fontis/Australia/controllers/EparcelController.php +75 -22
  36. app/code/community/Fontis/Australia/etc/adminhtml.xml +46 -0
  37. app/code/community/Fontis/Australia/etc/config.xml +19 -47
  38. app/code/community/Fontis/Australia/etc/system.xml +262 -180
  39. app/code/community/Fontis/Australia/sql/australia_setup/mysql4-install-0.7.0.php +16 -19
  40. app/code/community/Fontis/Australia/sql/australia_setup/mysql4-install-2.2.0.php +1 -4
  41. app/code/community/Fontis/Australia/sql/australia_setup/mysql4-install-2.2.2.php +4 -7
  42. app/code/community/Fontis/Australia/sql/australia_setup/mysql4-upgrade-1.2.1-1.2.2.php +1 -4
  43. app/code/community/Fontis/Australia/sql/australia_setup/mysql4-upgrade-2.1.0-2.2.0.php +1 -4
  44. app/code/community/Fontis/Australia/sql/australia_setup/mysql4-upgrade-2.2.1-2.2.2.php +1 -4
  45. app/code/community/Fontis/Australia/sql/australia_setup/mysql4-upgrade-2.3.0-2.4.0.php +43 -0
  46. app/design/adminhtml/default/default/template/fontis/australia/payment/bpay/form.phtml +4 -4
  47. app/design/adminhtml/default/default/template/fontis/australia/payment/bpay/info.phtml +1 -1
  48. app/design/adminhtml/default/default/template/fontis/australia/payment/directdeposit/form.phtml +1 -1
  49. app/design/adminhtml/default/default/template/fontis/australia/payment/directdeposit/info.phtml +1 -1
  50. app/design/adminhtml/default/default/template/fontis/australia/system/config/form/field/array_dropdown.phtml +2 -2
  51. app/design/frontend/base/default/layout/{fontis_australia.xml → fontis/australia.xml} +13 -7
  52. app/design/frontend/base/default/template/fontis/australia/payment/bpay/form.phtml +1 -4
  53. app/design/frontend/base/default/template/fontis/australia/payment/bpay/info.phtml +1 -1
  54. app/design/frontend/base/default/template/fontis/australia/payment/bpay/success.phtml +2 -13
  55. app/design/frontend/base/default/template/fontis/australia/payment/directdeposit/form.phtml +19 -21
  56. app/design/frontend/base/default/template/fontis/australia/payment/directdeposit/info.phtml +3 -8
  57. app/design/frontend/base/default/template/fontis/australia/payment/directdeposit/success.phtml +4 -11
  58. app/design/frontend/base/default/template/fontis/australia/postcode-checkout.phtml +50 -63
  59. app/design/frontend/base/default/template/fontis/australia/postcode.phtml +24 -34
  60. app/etc/modules/Fontis_Australia.xml +2 -5
  61. lib/Doghouse/Australia/Eparcel.php +48 -0
  62. lib/Doghouse/Australia/Eparcel/Parcel.php +76 -0
  63. lib/Doghouse/Australia/Eparcel/Parcel/Carton.php +25 -0
  64. lib/Doghouse/Australia/Eparcel/Record.php +37 -0
  65. lib/Doghouse/Australia/Eparcel/Record/Article.php +35 -0
  66. lib/Doghouse/Australia/Eparcel/Record/Article/CubicWeight.php +25 -0
  67. lib/Doghouse/Australia/Eparcel/Record/Consignment.php +66 -0
  68. lib/Doghouse/Australia/Eparcel/Record/Good.php +16 -0
  69. package.xml +7 -7
  70. skin/frontend/base/default/fontis/australia/css/postcode-autocomplete.css +23 -0
  71. skin/frontend/{default/default/images/fontis → base/default/fontis/australia/images}/bpay.png +0 -0
app/code/community/Fontis/Australia/Block/Autocomplete.php CHANGED
@@ -1,5 +1,4 @@
1
<?php
2
-
3
/**
4
* Fontis Australia Extension
5
*
@@ -9,14 +8,11 @@
9
* that is bundled with this package in the file LICENSE.txt.
10
* It is also available through the world-wide-web at this URL:
11
* http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
*
16
* @category Fontis
17
* @package Fontis_Australia
18
* @author Chris Norton
19
- * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
20
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
*/
22
@@ -25,7 +21,6 @@
25
*/
26
class Fontis_Australia_Block_Autocomplete extends Mage_Core_Block_Abstract
27
{
28
-
29
protected function _toHtml()
30
{
31
$html = '';
@@ -35,32 +30,20 @@ class Fontis_Australia_Block_Autocomplete extends Mage_Core_Block_Abstract
35
}
36
37
// Get the text that the customer has entered as a query.
38
- $query = $this->helper('australia')->getQueryText();
39
- $country = $this->helper('australia')->getQueryCountry();
40
- if ($country != "AU") {
41
return $html;
42
}
43
44
- /* @var $conn Varien_Db_Adapter_Pdo_Mysql */
45
- $conn = Mage::getSingleton('core/resource')->getConnection('australia_read');
46
- $resultArray = $conn->fetchAll(
47
- 'SELECT au.*, dcr.region_id FROM ' . Mage::getSingleton('core/resource')->getTableName('australia_postcode') . ' AS au
48
- INNER JOIN ' . Mage::getSingleton('core/resource')->getTableName('directory_country_region') . ' AS dcr ON au.region_code = dcr.code
49
- WHERE city LIKE :city ORDER BY city, region_code',
50
- array('city' => $query)
51
- );
52
-
53
$html = '<ul>';
54
$counter = 0;
55
- foreach ($resultArray as $item) {
56
$html .= '<li class="' . ((++$counter) % 2 ? 'odd' : 'even') . '" id="region-' . $item['region_id'] . '-postcode-' . $item['postcode'] . '">';
57
$html .= $item['city'] . '<span class="informal"> ' . $item['region_code'] . ', ' . $item['postcode'] . '</span>';
58
$html .= '</li>';
59
}
60
-
61
- $html.= '</ul>';
62
63
return $html;
64
}
65
-
66
}
1
<?php
2
/**
3
* Fontis Australia Extension
4
*
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
21
*/
22
class Fontis_Australia_Block_Autocomplete extends Mage_Core_Block_Abstract
23
{
24
protected function _toHtml()
25
{
26
$html = '';
30
}
31
32
// Get the text that the customer has entered as a query.
33
+ $results = $this->helper('australia')->getPostcodeAutocompleteResults();
34
+ if (empty($results)) {
35
return $html;
36
}
37
38
$html = '<ul>';
39
$counter = 0;
40
+ foreach ($results as $item) {
41
$html .= '<li class="' . ((++$counter) % 2 ? 'odd' : 'even') . '" id="region-' . $item['region_id'] . '-postcode-' . $item['postcode'] . '">';
42
$html .= $item['city'] . '<span class="informal"> ' . $item['region_code'] . ', ' . $item['postcode'] . '</span>';
43
$html .= '</li>';
44
}
45
+ $html .= '</ul>';
46
47
return $html;
48
}
49
}
app/code/community/Fontis/Australia/Block/Bpay/Form.php CHANGED
@@ -8,14 +8,11 @@
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
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
app/code/community/Fontis/Australia/Block/Bpay/Info.php CHANGED
@@ -8,14 +8,11 @@
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
@@ -56,7 +53,7 @@ class Fontis_Australia_Block_Bpay_Info extends Mage_Payment_Block_Info
56
$this->_convertAdditionalData();
57
}
58
return $this->_ref;
59
- }
60
61
/**
62
* Gets any additional data saved by the BPAY payment module.
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
53
$this->_convertAdditionalData();
54
}
55
return $this->_ref;
56
+ }
57
58
/**
59
* Gets any additional data saved by the BPAY payment module.
app/code/community/Fontis/Australia/Block/Directdeposit/Form.php CHANGED
@@ -8,14 +8,11 @@
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
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
app/code/community/Fontis/Australia/Block/Directdeposit/Info.php CHANGED
@@ -8,14 +8,11 @@
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
@@ -58,7 +55,7 @@ class Fontis_Australia_Block_Directdeposit_Info extends Mage_Payment_Block_Info
58
}
59
return $this->_accountBSB;
60
}
61
-
62
/**
63
* Gets the bank account number as set by the admin.
64
*
@@ -71,7 +68,7 @@ class Fontis_Australia_Block_Directdeposit_Info extends Mage_Payment_Block_Info
71
}
72
return $this->_accountNumber;
73
}
74
-
75
/**
76
* Gets the bank account number as set by the admin.
77
*
@@ -83,7 +80,7 @@ class Fontis_Australia_Block_Directdeposit_Info extends Mage_Payment_Block_Info
83
$this->_convertAdditionalData();
84
}
85
return $this->_message;
86
- }
87
88
/**
89
* Converts serialised additional data into a more usable form.
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
55
}
56
return $this->_accountBSB;
57
}
58
+
59
/**
60
* Gets the bank account number as set by the admin.
61
*
68
}
69
return $this->_accountNumber;
70
}
71
+
72
/**
73
* Gets the bank account number as set by the admin.
74
*
80
$this->_convertAdditionalData();
81
}
82
return $this->_message;
83
+ }
84
85
/**
86
* Converts serialised additional data into a more usable form.
app/code/community/Fontis/Australia/Block/Eparcel/Rate/Export.php ADDED
@@ -0,0 +1,35 @@
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
+ *
12
+ * @category Fontis
13
+ * @package Fontis_Australia
14
+ * @author Thai Phan
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Fontis_Australia_Block_Eparcel_Rate_Export extends Mage_Adminhtml_Block_System_Config_Form_Field
20
+ {
21
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
22
+ {
23
+ $this->setElement($element);
24
+ $url = $this->getUrl('australia/eparcel/exportTablerates');
25
+
26
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
27
+ ->setType('button')
28
+ ->setClass('')
29
+ ->setLabel('Export CSV')
30
+ ->setOnClick("setLocation('$url')")
31
+ ->toHtml();
32
+
33
+ return $html;
34
+ }
35
+ }
app/code/community/Fontis/Australia/Block/Getprice.php CHANGED
@@ -8,16 +8,13 @@
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 Tom Greenaway
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
class Fontis_Australia_Block_Getprice extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
22
{
23
protected $magentoOptions = array('final_price' => 'final_price', 'product_num' => 'product_num', "link" => "link", "category" => "category", "image_url" => "image_url", "currency" => "currency");
@@ -34,10 +31,10 @@ class Fontis_Australia_Block_Getprice extends Mage_Adminhtml_Block_System_Config
34
));
35
$this->_addAfter = false;
36
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add linked attribute');
37
-
38
parent::__construct();
39
$this->setTemplate('fontis/australia/system/config/form/field/array_dropdown.phtml');
40
-
41
// product options
42
$eav_config_model = Mage::getModel('eav/config');
43
$attributes = $eav_config_model->getEntityAttributeCodes('catalog_product');
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Tom Greenaway
15
* @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
class Fontis_Australia_Block_Getprice extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
19
{
20
protected $magentoOptions = array('final_price' => 'final_price', 'product_num' => 'product_num', "link" => "link", "category" => "category", "image_url" => "image_url", "currency" => "currency");
31
));
32
$this->_addAfter = false;
33
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add linked attribute');
34
+
35
parent::__construct();
36
$this->setTemplate('fontis/australia/system/config/form/field/array_dropdown.phtml');
37
+
38
// product options
39
$eav_config_model = Mage::getModel('eav/config');
40
$attributes = $eav_config_model->getEntityAttributeCodes('catalog_product');
app/code/community/Fontis/Australia/Block/Googleproducts.php CHANGED
@@ -8,21 +8,18 @@
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 Peter Spiller
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
class Fontis_Australia_Block_Googleproducts extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
22
{
23
// Map in some of the values not normally visible
24
protected $magentoOptions = array('is_salable' => 'is_saleable', 'manufacturer_name' => 'manufacturer_name', 'final_price' => 'final_price');
25
-
26
public function __construct()
27
{
28
$this->addColumn('magento', array(
@@ -35,10 +32,10 @@ class Fontis_Australia_Block_Googleproducts extends Mage_Adminhtml_Block_System_
35
));
36
$this->_addAfter = false;
37
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add linked attribute');
38
-
39
parent::__construct();
40
$this->setTemplate('fontis/australia/system/config/form/field/array_dropdown.phtml');
41
-
42
// product options
43
$eav_config_model = Mage::getModel('eav/config');
44
$attributes = $eav_config_model->getEntityAttributeCodes('catalog_product');
@@ -77,12 +74,12 @@ class Fontis_Australia_Block_Googleproducts extends Mage_Adminhtml_Block_System_
77
$model = Mage::getModel('australia/googleproducts');
78
foreach ($model->available_fields as $field) {
79
$rendered .= '<option value="'.$field.'">'.str_replace("_", " ", $field)."</option>";
80
- }
81
$rendered .= '</select>';
82
}
83
-
84
return $rendered;
85
}
86
-
87
-
88
}
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Peter Spiller
15
* @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
class Fontis_Australia_Block_Googleproducts extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
19
{
20
// Map in some of the values not normally visible
21
protected $magentoOptions = array('is_salable' => 'is_saleable', 'manufacturer_name' => 'manufacturer_name', 'final_price' => 'final_price');
22
+
23
public function __construct()
24
{
25
$this->addColumn('magento', array(
32
));
33
$this->_addAfter = false;
34
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add linked attribute');
35
+
36
parent::__construct();
37
$this->setTemplate('fontis/australia/system/config/form/field/array_dropdown.phtml');
38
+
39
// product options
40
$eav_config_model = Mage::getModel('eav/config');
41
$attributes = $eav_config_model->getEntityAttributeCodes('catalog_product');
74
$model = Mage::getModel('australia/googleproducts');
75
foreach ($model->available_fields as $field) {
76
$rendered .= '<option value="'.$field.'">'.str_replace("_", " ", $field)."</option>";
77
+ }
78
$rendered .= '</select>';
79
}
80
+
81
return $rendered;
82
}
83
+
84
+
85
}
app/code/community/Fontis/Australia/Block/Myshopping.php CHANGED
@@ -8,16 +8,13 @@
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 Tom Greenaway
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
class Fontis_Australia_Block_Myshopping extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
22
{
23
protected $magentoOptions = array('instock' => 'instock', 'brand' => 'brand', 'final_price' => 'final_price', 'product_id' => 'product_id', "category" => "category", "link" => "link", "image_url" => "image_url");
@@ -34,10 +31,10 @@ class Fontis_Australia_Block_Myshopping extends Mage_Adminhtml_Block_System_Conf
34
));
35
$this->_addAfter = false;
36
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add linked attribute');
37
-
38
parent::__construct();
39
$this->setTemplate('fontis/australia/system/config/form/field/array_dropdown.phtml');
40
-
41
// product options
42
$eav_config_model = Mage::getModel('eav/config');
43
$attributes = $eav_config_model->getEntityAttributeCodes('catalog_product');
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Tom Greenaway
15
* @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
class Fontis_Australia_Block_Myshopping extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
19
{
20
protected $magentoOptions = array('instock' => 'instock', 'brand' => 'brand', 'final_price' => 'final_price', 'product_id' => 'product_id', "category" => "category", "link" => "link", "image_url" => "image_url");
31
));
32
$this->_addAfter = false;
33
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add linked attribute');
34
+
35
parent::__construct();
36
$this->setTemplate('fontis/australia/system/config/form/field/array_dropdown.phtml');
37
+
38
// product options
39
$eav_config_model = Mage::getModel('eav/config');
40
$attributes = $eav_config_model->getEntityAttributeCodes('catalog_product');
app/code/community/Fontis/Australia/Block/Shopbot.php CHANGED
@@ -8,16 +8,13 @@
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 Tom Greenaway
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
class Fontis_Australia_Block_Shopbot extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
22
{
23
protected $magentoOptions = array("final_price" => "final_price", "link" => "link", "availability" => "availability", "price" => "price");
@@ -34,10 +31,10 @@ class Fontis_Australia_Block_Shopbot extends Mage_Adminhtml_Block_System_Config_
34
));
35
$this->_addAfter = false;
36
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add linked attribute');
37
-
38
parent::__construct();
39
$this->setTemplate('fontis/australia/system/config/form/field/array_dropdown.phtml');
40
-
41
// extra options
42
$this->magentoOptions['FONTIS-product-id'] = 'Product ID';
43
$this->magentoOptions['FONTIS-category'] = 'Product Category';
@@ -86,7 +83,7 @@ class Fontis_Australia_Block_Shopbot extends Mage_Adminhtml_Block_System_Config_
86
}
87
$rendered .= '</select>';
88
}
89
-
90
return $rendered;
91
}
92
}
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Tom Greenaway
15
* @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
class Fontis_Australia_Block_Shopbot extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
19
{
20
protected $magentoOptions = array("final_price" => "final_price", "link" => "link", "availability" => "availability", "price" => "price");
31
));
32
$this->_addAfter = false;
33
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add linked attribute');
34
+
35
parent::__construct();
36
$this->setTemplate('fontis/australia/system/config/form/field/array_dropdown.phtml');
37
+
38
// extra options
39
$this->magentoOptions['FONTIS-product-id'] = 'Product ID';
40
$this->magentoOptions['FONTIS-category'] = 'Product Category';
83
}
84
$rendered .= '</select>';
85
}
86
+
87
return $rendered;
88
}
89
}
app/code/community/Fontis/Australia/Block/Shoppingdotcom.php CHANGED
@@ -8,21 +8,18 @@
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 Peter Spiller
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
class Fontis_Australia_Block_Shoppingdotcom extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
22
{
23
// Map in some of the values not normally visible
24
protected $magentoOptions = array('is_salable' => 'is_saleable', 'manufacturer_name' => 'manufacturer_name', 'final_price' => 'final_price');
25
-
26
public function __construct()
27
{
28
$this->addColumn('magento', array(
@@ -35,10 +32,10 @@ class Fontis_Australia_Block_Shoppingdotcom extends Mage_Adminhtml_Block_System_
35
));
36
$this->_addAfter = false;
37
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add linked attribute');
38
-
39
parent::__construct();
40
$this->setTemplate('fontis/australia/system/config/form/field/array_dropdown.phtml');
41
-
42
// product options
43
$eav_config_model = Mage::getModel('eav/config');
44
$attributes = $eav_config_model->getEntityAttributeCodes('catalog_product');
@@ -77,10 +74,10 @@ class Fontis_Australia_Block_Shoppingdotcom extends Mage_Adminhtml_Block_System_
77
$model = Mage::getModel('australia/shoppingdotcom');
78
foreach ($model->available_fields as $field) {
79
$rendered .= '<option value="'.$field.'">'.str_replace("_", " ", $field)."</option>";
80
- }
81
$rendered .= '</select>';
82
}
83
-
84
return $rendered;
85
}
86
}
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Peter Spiller
15
* @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
class Fontis_Australia_Block_Shoppingdotcom extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
19
{
20
// Map in some of the values not normally visible
21
protected $magentoOptions = array('is_salable' => 'is_saleable', 'manufacturer_name' => 'manufacturer_name', 'final_price' => 'final_price');
22
+
23
public function __construct()
24
{
25
$this->addColumn('magento', array(
32
));
33
$this->_addAfter = false;
34
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add linked attribute');
35
+
36
parent::__construct();
37
$this->setTemplate('fontis/australia/system/config/form/field/array_dropdown.phtml');
38
+
39
// product options
40
$eav_config_model = Mage::getModel('eav/config');
41
$attributes = $eav_config_model->getEntityAttributeCodes('catalog_product');
74
$model = Mage::getModel('australia/shoppingdotcom');
75
foreach ($model->available_fields as $field) {
76
$rendered .= '<option value="'.$field.'">'.str_replace("_", " ", $field)."</option>";
77
+ }
78
$rendered .= '</select>';
79
}
80
+
81
return $rendered;
82
}
83
}
app/code/community/Fontis/Australia/Helper/Bpay.php CHANGED
@@ -8,17 +8,14 @@
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) 2009 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
* BPAY-specific helper
24
*/
@@ -28,10 +25,10 @@ class Fontis_Australia_Helper_Bpay extends Mage_Core_Helper_Abstract
28
{
29
$acceptCreditCards = Mage::getStoreConfig('payment/bpay/accept_credit_cards');
30
31
- $output = '
32
<div id="bpay" style="border: 2px solid rgb(16, 32, 75); margin: 0px; padding: 6px; width: 238px; font-family: Arial,Helvetica,sans-serif; background-color: rgb(255, 255, 255);">
33
<div class="bpayLogo" style="border: 2px solid rgb(20, 44, 97); width: 51px; height: 87px; float: left;">
34
- <img src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'frontend/default/default/images/fontis/bpay.png' . '" height="82" width="51">
35
</div>
36
<div class="customerReferenceBox" style="border: 2px solid rgb(20, 44, 97); padding: 0px 8px; height: 87px; width: 158px; margin-left: 60px; margin-bottom: 4px;">
37
<p class="customerReferenceBoxText" style="font-size: 13px; text-transform: capitalize; color: rgb(20, 44, 97); white-space: nowrap; line-height: 22px; font-weight: normal;">
@@ -39,7 +36,7 @@ class Fontis_Australia_Helper_Bpay extends Mage_Core_Helper_Abstract
39
<b>Ref</b>: ' . $customerReferenceNumber . '<br>
40
</p>
41
</div>';
42
-
43
if($acceptCreditCards) {
44
$output .= '<div>
45
<p class="billerTextHeading" style="font-size: 11px; text-transform: capitalize; color: rgb(20, 44, 97); white-space: nowrap; line-height: 20px; font-weight: bold;">Telephone &amp; Internet Banking &mdash; BPAY&reg;</p>
@@ -51,8 +48,8 @@ class Fontis_Australia_Helper_Bpay extends Mage_Core_Helper_Abstract
51
<p class="billerText" style="font-size: 11px; color: rgb(20, 44, 97);">Contact your bank or financial institution to make this payment from your cheque, savings, debit or transaction account. More info: www.bpay.com.au</p>
52
</div>';
53
}
54
-
55
- $output .= '</div>';
56
- return $output;
57
}
58
}
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
+
19
/**
20
* BPAY-specific helper
21
*/
25
{
26
$acceptCreditCards = Mage::getStoreConfig('payment/bpay/accept_credit_cards');
27
28
+ $output = '
29
<div id="bpay" style="border: 2px solid rgb(16, 32, 75); margin: 0px; padding: 6px; width: 238px; font-family: Arial,Helvetica,sans-serif; background-color: rgb(255, 255, 255);">
30
<div class="bpayLogo" style="border: 2px solid rgb(20, 44, 97); width: 51px; height: 87px; float: left;">
31
+ <img alt="BPAY" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'frontend/base/default/images/fontis/australia/bpay.png' . '" height="82" width="51">
32
</div>
33
<div class="customerReferenceBox" style="border: 2px solid rgb(20, 44, 97); padding: 0px 8px; height: 87px; width: 158px; margin-left: 60px; margin-bottom: 4px;">
34
<p class="customerReferenceBoxText" style="font-size: 13px; text-transform: capitalize; color: rgb(20, 44, 97); white-space: nowrap; line-height: 22px; font-weight: normal;">
36
<b>Ref</b>: ' . $customerReferenceNumber . '<br>
37
</p>
38
</div>';
39
+
40
if($acceptCreditCards) {
41
$output .= '<div>
42
<p class="billerTextHeading" style="font-size: 11px; text-transform: capitalize; color: rgb(20, 44, 97); white-space: nowrap; line-height: 20px; font-weight: bold;">Telephone &amp; Internet Banking &mdash; BPAY&reg;</p>
48
<p class="billerText" style="font-size: 11px; color: rgb(20, 44, 97);">Contact your bank or financial institution to make this payment from your cheque, savings, debit or transaction account. More info: www.bpay.com.au</p>
49
</div>';
50
}
51
+
52
+ $output .= '</div>';
53
+ return $output;
54
}
55
}
app/code/community/Fontis/Australia/Helper/Data.php CHANGED
@@ -8,40 +8,41 @@
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
* Data helper
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) {
@@ -50,15 +51,63 @@ class Fontis_Australia_Helper_Data extends Mage_Core_Helper_Abstract
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
- }
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
+
19
/**
20
* Data helper
21
*/
22
class Fontis_Australia_Helper_Data extends Mage_Core_Helper_Abstract
23
{
24
+ const XML_PATH_POSTCODE_AUTOCOMPLETE_ENABLED = 'fontis_australia/postcode_autocomplete/enabled';
25
+
26
const MAX_QUERY_LEN = 100;
27
28
+ const MAX_AUTOCOMPLETE_RESULTS_DEFAULT = 20;
29
+
30
protected $_queryText;
31
32
+ /**
33
+ * Gets the query text for city lookups in the postcode database.
34
+ */
35
public function getQueryText()
36
{
37
if (is_null($this->_queryText)) {
38
+ if ($this->_getRequest()->getParam('billing')) {
39
+ $tmp = $this->_getRequest()->getParam('billing');
40
+ $this->_queryText = $tmp['city'];
41
+ } elseif ($this->_getRequest()->getParam('shipping')) {
42
+ $tmp = $this->_getRequest()->getParam('shipping');
43
+ $this->_queryText = $tmp['city'];
44
} else {
45
+ $this->_queryText = $this->_getRequest()->getParam('city');
46
}
47
$this->_queryText = trim($this->_queryText);
48
if (Mage::helper('core/string')->strlen($this->_queryText) > self::MAX_QUERY_LEN) {
51
}
52
return $this->_queryText;
53
}
54
+
55
public function getQueryCountry()
56
{
57
+ return $this->_getRequest()->getParam('country');
58
+ }
59
+
60
+ public function getCitySuggestUrl()
61
+ {
62
+ return $this->_getUrl('australia/ajax/suggest', array('_secure'=>true));
63
+ }
64
+
65
+ /**
66
+ * Checks whether postcode autocomplete is enabled.
67
+ *
68
+ * @return bool
69
+ */
70
+ public function isPostcodeAutocompleteEnabled()
71
+ {
72
+ return Mage::getStoreConfigFlag(self::XML_PATH_POSTCODE_AUTOCOMPLETE_ENABLED);
73
}
74
75
+ /**
76
+ * @return int
77
+ */
78
+ public function getPostcodeAutocompleteMaxResults()
79
+ {
80
+ $max = Mage::getStoreConfig("fontis_australia/postcode_autocomplete/max_results");
81
+ if (!is_numeric($max)) {
82
+ return self::MAX_AUTOCOMPLETE_RESULTS_DEFAULT;
83
+ }
84
+ $max = (int) $max;
85
+ if ($max > 0) {
86
+ return $max;
87
+ } else {
88
+ return self::MAX_AUTOCOMPLETE_RESULTS_DEFAULT;
89
+ }
90
+ }
91
92
+ /**
93
+ * @return array
94
+ */
95
+ public function getPostcodeAutocompleteResults()
96
+ {
97
+ $country = $this->getQueryCountry();
98
+ if ($country != "AU") {
99
+ return array();
100
+ }
101
+
102
+ $res = Mage::getSingleton('core/resource');
103
+ /* @var $conn Varien_Db_Adapter_Pdo_Mysql */
104
+ $conn = $res->getConnection('australia_read');
105
+ return $conn->fetchAll(
106
+ 'SELECT au.*, dcr.region_id FROM ' . $res->getTableName('australia_postcode') . ' AS au
107
+ INNER JOIN ' . $res->getTableName('directory_country_region') . ' AS dcr ON au.region_code = dcr.code
108
+ WHERE city LIKE :city ORDER BY city, region_code, postcode
109
+ LIMIT ' . $this->getPostcodeAutocompleteMaxResults(),
110
+ array('city' => '%' . $this->getQueryText() . '%')
111
+ );
112
+ }
113
+ }
app/code/community/Fontis/Australia/Helper/Eparcel.php ADDED
@@ -0,0 +1,117 @@
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
+ *
12
+ * @category Fontis
13
+ * @package Fontis_Australia
14
+ * @author Thai Phan
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Fontis_Australia_Helper_Eparcel extends Mage_Core_Helper_Abstract
20
+ {
21
+ const XML_PATH_EMAIL_NOTIFICATION_ENABLED = 'doghouse_eparcelexport/email_notification/enabled';
22
+ const XML_PATH_EMAIL_NOTIFICATION_LEVEL = 'doghouse_eparcelexport/email_notification/level';
23
+
24
+ /* AUSTRALIA POST CHARGE CODES */
25
+ private $chargeCodes = array(
26
+
27
+ /* Domestic / Standard / Individual */
28
+ 'S1', // EPARCEL 1 Domestic
29
+ 'S2', // EPARCEL 2 Domestic
30
+ 'S3', // EPARCEL 3 Domestic
31
+ 'S4', // EPARCEL 4 Domestic
32
+ 'S5', // EPARCEL 5 Domestic
33
+ 'S6', // EPARCEL 6 Domestic
34
+ 'S7', // EPARCEL 7 Domestic
35
+ 'S8', // EPARCEL 8 Domestic
36
+
37
+ /* Domestic / Standard / Business */
38
+ 'B1', // B TO B EPARCEL 1 Domestic
39
+ 'B2', // B TO B EPARCEL 2 Domestic
40
+ 'B5', // B TO B EPARCEL 5 Domestic
41
+
42
+ /* Domestic / Express / Individual */
43
+ 'X1', // EXPRESS POST EPARCEL Domestic
44
+ 'X2', // EXPRESS POST EPARCEL 2 Domestic
45
+
46
+ /* Domestic / Express / Business */
47
+ 'XB1', // EXPRESS POST EPARCEL B2B Domestic
48
+ 'XB2', // EXPRESS POST EPARCEL B2B 2 Domestic
49
+
50
+ /* International / Standard */
51
+ 'AIR1', // INTERNATIONAL Airmail 1 International
52
+ 'AIR2', // INTERNATIONAL Airmail 2 International
53
+ 'AIR3', // INTERNATIONAL Airmail - 8 Zones International
54
+
55
+ /* International / Express */
56
+ 'EPI1', // Express Post International International
57
+ 'EPI2', // Express Post International International
58
+ 'EPI3', // Express Post International – 8 zones International
59
+
60
+ 'ECM1', // Express Courier Int'l Merchandise 1 International
61
+ 'ECM2', // Express Courier Int'l Merchandise 2 International
62
+ 'ECM3', // Express Courier Int'l Merch 8Zone International
63
+
64
+ 'ECD1', // EXPRESS COURIER INT'L DOC 1 International
65
+ 'ECD2', // EXPRESS COURIER INT'L DOC 2 International
66
+ 'ECD3', // Express Courier Int'l Doc – 8 zones International
67
+
68
+ /* Other */
69
+
70
+ 'CFR', // eParcel Call For Return Domestic
71
+ 'PR', // eParcel Post Returns Service Domestic
72
+
73
+ 'CS1', // CTC EPARCEL Domestic
74
+ 'CS4', // CTC EPARCEL Domestic
75
+ 'CS5', // CTC EPARCEL 5 Domestic
76
+ 'CS6', // CTC EPARCEL 6 Domestic
77
+ 'CS7', // CTC EPARCEL 7 Domestic
78
+ 'CS8', // CTC EPARCEL 8 Domestic
79
+
80
+ 'CX1', // CTC EXPRESS POST 500G BRK Domestic
81
+ 'CX2', // CTC EXPRESS POST MULTI BRK Domestic
82
+
83
+ 'RPI1', // Registered Post International International
84
+ );
85
+
86
+ /**
87
+ * Returns whether email notifications are enabled.
88
+ *
89
+ * @return bool
90
+ */
91
+ public function isEmailNotificationEnabled()
92
+ {
93
+ return Mage::getStoreConfigFlag(self::XML_PATH_EMAIL_NOTIFICATION_ENABLED);
94
+ }
95
+
96
+ /**
97
+ * Returns the email notification level, i.e. none, notify when despatched,
98
+ * or complete tracking.
99
+ *
100
+ * @return string
101
+ */
102
+ public function getEmailNotificationLevel()
103
+ {
104
+ return Mage::getStoreConfig(self::XML_PATH_EMAIL_NOTIFICATION_LEVEL);
105
+ }
106
+
107
+ /**
108
+ * Determines whether a given string is a valid eParcel charge code.
109
+ *
110
+ * @param string $chargeCode
111
+ * @return bool
112
+ */
113
+ public function isValidChargeCode($chargeCode)
114
+ {
115
+ return in_array($chargeCode, $this->chargeCodes);
116
+ }
117
+ }
app/code/community/Fontis/Australia/Model/Config/Condition.php CHANGED
@@ -1,13 +1,29 @@
1
<?php
2
3
class Fontis_Australia_Model_Config_Condition
4
{
5
public function toOptionArray()
6
{
7
return array(
8
- array('value' => 'new', 'label' => 'New'),
9
- array('value' => 'used', 'label' => 'Used'),
10
array('value' => 'refurbished', 'label' => 'Refurbished'),
11
);
12
}
13
- }
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
+ *
12
+ * @category Fontis
13
+ * @package Fontis_Australia
14
+ * @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
19
class Fontis_Australia_Model_Config_Condition
20
{
21
public function toOptionArray()
22
{
23
return array(
24
+ array('value' => 'new', 'label' => 'New'),
25
+ array('value' => 'used', 'label' => 'Used'),
26
array('value' => 'refurbished', 'label' => 'Refurbished'),
27
);
28
}
29
+ }
app/code/community/Fontis/Australia/Model/Config/CustomerGroupAccess.php CHANGED
@@ -8,14 +8,11 @@
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
@@ -27,12 +24,12 @@
27
*/
28
class Fontis_Australia_Model_Config_CustomerGroupAccess
29
{
30
- public function toOptionArray()
31
- {
32
- return array(
33
- array('value' => 0, 'label' => Mage::helper('adminhtml')->__('No restrictions')),
34
- array('value' => 1, 'label' => Mage::helper('adminhtml')->__('Only allow group ...')),
35
- array('value' => 2, 'label' => Mage::helper('adminhtml')->__('Allow all groups except ...'))
36
- );
37
- }
38
}
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
24
*/
25
class Fontis_Australia_Model_Config_CustomerGroupAccess
26
{
27
+ public function toOptionArray()
28
+ {
29
+ return array(
30
+ array('value' => 0, 'label' => Mage::helper('adminhtml')->__('No restrictions')),
31
+ array('value' => 1, 'label' => Mage::helper('adminhtml')->__('Only allow group ...')),
32
+ array('value' => 2, 'label' => Mage::helper('adminhtml')->__('Allow all groups except ...'))
33
+ );
34
+ }
35
}
app/code/community/Fontis/Australia/Model/Config/CustomerGroups.php CHANGED
@@ -8,14 +8,11 @@
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
@@ -27,18 +24,20 @@
27
*/
28
class Fontis_Australia_Model_Config_CustomerGroups
29
{
30
- public function toOptionArray()
31
- {
32
- $storeId = Mage::app()->getStore()->getId();
33
- $collection = Mage::getModel('customer/group')->setStoreId($storeId)->getCollection();
34
-
35
- $options = array();
36
-
37
- foreach($collection as $group)
38
- {
39
- $options[] = array('value' => $group->getCustomerGroupId(), 'label' => $group->getCustomerGroupCode());
40
- }
41
-
42
- return $options;
43
- }
44
}
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
24
*/
25
class Fontis_Australia_Model_Config_CustomerGroups
26
{
27
+ public function toOptionArray()
28
+ {
29
+ $storeId = Mage::app()->getStore()->getId();
30
+ $collection = Mage::getModel('customer/group')->setStoreId($storeId)->getCollection();
31
+
32
+ $options = array();
33
+
34
+ foreach ($collection as $group) {
35
+ $options[] = array(
36
+ 'value' => $group->getCustomerGroupId(),
37
+ 'label' => $group->getCustomerGroupCode()
38
+ );
39
+ }
40
+
41
+ return $options;
42
+ }
43
}
app/code/community/Fontis/Australia/Model/Config/EmailNotificationLevel.php ADDED
@@ -0,0 +1,29 @@
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
+ *
12
+ * @category Fontis
13
+ * @package Fontis_Australia
14
+ * @author Thai Phan
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Fontis_Australia_Model_Config_EmailNotificationLevel
20
+ {
21
+ public function toOptionArray()
22
+ {
23
+ return array(
24
+ array('value' => 'NONE', 'label' => Mage::helper('australia')->__('None')),
25
+ array('value' => 'DESPATCH', 'label' => Mage::helper('australia')->__('Despatch')),
26
+ array('value' => 'TRACKADV', 'label' => Mage::helper('australia')->__('Track Advice')),
27
+ );
28
+ }
29
+ }
app/code/community/Fontis/Australia/Model/Config/ProductAttributes.php CHANGED
@@ -1,50 +1,45 @@
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 Tom Greenaway
18
- * @copyright Copyright (c) 2010 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
- * List all available product attributes
24
- *
25
- * @category Fontis
26
- * @package Fontis_Australia
27
- */
28
- class Fontis_Australia_Model_Config_ProductAttributes {
29
- public function toOptionArray() {
30
- $eav_config = Mage::getModel('eav/config');
31
- $attributes = $eav_config->getEntityAttributeCodes('catalog_product');
32
-
33
- $options = array();
34
- $options[0] = "No Attribute";
35
-
36
- foreach($attributes as $att_code)
37
- {
38
- $attribute = $eav_config->getAttribute('catalog_product', $att_code);
39
- Mage::log($attribute);
40
-
41
- if ($att_code != '')
42
- {
43
- $options[$att_code] = $att_code;
44
- }
45
- }
46
-
47
- return $options;
48
- }
49
- }
50
-
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
+ *
12
+ * @category Fontis
13
+ * @package Fontis_Australia
14
+ * @author Tom Greenaway
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ /**
20
+ * List all available product attributes
21
+ *
22
+ * @category Fontis
23
+ * @package Fontis_Australia
24
+ */
25
+ class Fontis_Australia_Model_Config_ProductAttributes
26
+ {
27
+ public function toOptionArray() {
28
+ $eav_config = Mage::getModel('eav/config');
29
+ $attributes = $eav_config->getEntityAttributeCodes('catalog_product');
30
+
31
+ $options = array();
32
+ $options[0] = "No Attribute";
33
+
34
+ foreach ($attributes as $att_code) {
35
+ $attribute = $eav_config->getAttribute('catalog_product', $att_code);
36
+ Mage::log($attribute);
37
+
38
+ if ($att_code != '') {
39
+ $options[$att_code] = $att_code;
40
+ }
41
+ }
42
+
43
+ return $options;
44
+ }
45
+ }
app/code/community/Fontis/Australia/Model/Mysql4/Shipping/Carrier/Eparcel.php CHANGED
@@ -8,9 +8,6 @@
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
* Originally based on Magento Tablerate Shipping code and Auctionmaid Matrixrate.
16
* @copyright Copyright (c) 2008 Auction Maid (http://www.auctionmaid.com)
@@ -19,12 +16,14 @@
19
* @category Fontis
20
* @package Fontis_Australia
21
* @author Chris Norton
22
- * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
23
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
*/
25
26
class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_Model_Mysql4_Abstract
27
{
28
protected function _construct()
29
{
30
$this->_init('australia/eparcel', 'pk');
@@ -33,31 +32,34 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
33
public function getRate(Mage_Shipping_Model_Rate_Request $request)
34
{
35
$read = $this->_getReadAdapter();
36
- $write = $this->_getWriteAdapter();
37
38
- $postcode = $request->getDestPostcode();
39
$table = $this->getMainTable();
40
41
- $insuranceStep = (float)Mage::getConfig()->getNode('default/carriers/eparcel/insurance_step');
42
- $insuranceCostPerStep = (float)Mage::getConfig()->getNode('default/carriers/eparcel/insurance_cost_per_step');
43
- $signatureRequired = Mage::getConfig()->getNode('default/carriers/eparcel/signature_required');
44
if($signatureRequired) {
45
- $signatureCost = (float)Mage::getConfig()->getNode('default/carriers/eparcel/signature_cost');
46
} else {
47
$signatureCost = 0;
48
}
49
-
50
Mage::log($request->getDestCountryId());
51
Mage::log($request->getDestRegionId());
52
Mage::log($postcode);
53
Mage::log(var_export($request->getConditionName(), true));
54
-
55
- for ($j=0;$j<5;$j++)
56
- {
57
58
- $select = $read->select()->from($table);
59
60
61
switch($j) {
62
case 0:
63
$select->where(
@@ -69,13 +71,13 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
69
case 1:
70
$select->where(
71
$read->quoteInto(" (dest_country_id=? ", $request->getDestCountryId()).
72
- $read->quoteInto(" AND dest_region_id=? AND dest_zip='') ", $request->getDestRegionId())
73
);
74
break;
75
76
case 2:
77
$select->where(
78
- $read->quoteInto(" (dest_country_id=? AND dest_region_id='0' AND dest_zip='') ", $request->getDestCountryId())
79
);
80
break;
81
case 3:
@@ -86,7 +88,7 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
86
break;
87
case 4:
88
$select->where(
89
- " (dest_country_id='0' AND dest_region_id='0' AND dest_zip='')"
90
);
91
break;
92
}
@@ -126,48 +128,48 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
126
{
127
// have found a result or found nothing and at end of list!
128
foreach ($row as $data) {
129
- try {
130
$price = (float)($data['price']);
131
-
132
// add per-Kg cost
133
$conditionValue = (float)($request->getData($request->getConditionName()));
134
$price += (float)($data['price_per_kg']) * $conditionValue;
135
-
136
// add signature cost
137
$price += $signatureCost;
138
-
139
- // add version without insurance
140
- $data['price'] = (string)$price;
141
- $newdata[]=$data;
142
143
- // add version with insurance
144
- // work out how many insurance 'steps' we have
145
- $steps = ceil($request->getPackageValue() / $insuranceStep);
146
- Mage::log("Insurance steps: $steps");
147
- // add on number of 'steps' multiplied by the
148
- // insurance cost per step
149
- $insuranceCost = $insuranceCostPerStep * $steps;
150
- Mage::log("Insurance cost: $insuranceCost");
151
- $price += $insuranceCost;
152
-
153
$data['price'] = (string)$price;
154
- $data['delivery_type'] .= " with TransitCover";
155
$newdata[]=$data;
156
157
} catch(Exception $e) {
158
Mage::log($e->getMessage());
159
}
160
}
161
break;
162
}
163
- }
164
Mage::log(var_export($newdata, true));
165
return $newdata;
166
}
167
168
public function uploadAndImport(Varien_Object $object)
169
{
170
- Mage::log('Eparcel uploadAndImport');
171
$csvFile = $_FILES["groups"]["tmp_name"]["eparcel"]["fields"]["import"]["value"];
172
173
if (!empty($csvFile)) {
@@ -177,7 +179,6 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
177
$table = Mage::getSingleton('core/resource')->getTableName('australia/eparcel');
178
179
$websiteId = $object->getScopeId();
180
- $websiteModel = Mage::app()->getWebsite($websiteId);
181
182
if (isset($_POST['groups']['eparcel']['fields']['condition_name']['inherit'])) {
183
$conditionName = (string)Mage::getConfig()->getNode('default/carriers/eparcel/condition_name');
@@ -186,22 +187,23 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
186
}
187
188
$conditionFullName = Mage::getModel('australia/shipping_carrier_eparcel')->getCode('condition_name_short', $conditionName);
189
-
190
if (!empty($csv)) {
191
$exceptions = array();
192
$csvLines = explode("\n", $csv);
193
$csvLine = array_shift($csvLines);
194
$csvLine = $this->_getCsvValues($csvLine);
195
- if (count($csvLine) < 8) {
196
- $exceptions[0] = Mage::helper('shipping')->__('Invalid Table Rates File Format');
197
}
198
199
$countryCodes = array();
200
$regionCodes = array();
201
- foreach ($csvLines as $k=>$csvLine) {
202
$csvLine = $this->_getCsvValues($csvLine);
203
- if (count($csvLine) > 0 && count($csvLine) < 8) {
204
- $exceptions[0] = Mage::helper('shipping')->__('Invalid Table Rates File Format');
205
} else {
206
$countryCodes[] = $csvLine[0];
207
$regionCodes[] = $csvLine[1];
@@ -236,7 +238,7 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
236
if (empty($countryCodesToIds) || !array_key_exists($csvLine[0], $countryCodesToIds)) {
237
$countryId = '0';
238
if ($csvLine[0] != '*' && $csvLine[0] != '') {
239
- $exceptions[] = Mage::helper('shipping')->__('Invalid Country "%s" in the Row #%s', $csvLine[0], ($k+1));
240
}
241
} else {
242
$countryId = $countryCodesToIds[$csvLine[0]];
@@ -245,7 +247,7 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
245
if (empty($regionCodesToIds) || !array_key_exists($csvLine[1], $regionCodesToIds)) {
246
$regionId = '0';
247
if ($csvLine[1] != '*' && $csvLine[1] != '') {
248
- $exceptions[] = Mage::helper('shipping')->__('Invalid Region/State "%s" in the Row #%s', $csvLine[1], ($k+1));
249
}
250
} else {
251
$regionId = $regionCodesToIds[$csvLine[1]];
@@ -258,56 +260,67 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
258
}
259
260
if (!$this->_isPositiveDecimalNumber($csvLine[3]) || $csvLine[3] == '*' || $csvLine[3] == '') {
261
- $exceptions[] = Mage::helper('shipping')->__('Invalid %s "%s" in the Row #%s', $conditionFullName, $csvLine[3], ($k+1));
262
} else {
263
$csvLine[3] = (float)$csvLine[3];
264
}
265
266
if (!$this->_isPositiveDecimalNumber($csvLine[4]) || $csvLine[4] == '*' || $csvLine[4] == '') {
267
- $exceptions[] = Mage::helper('shipping')->__('Invalid %s "%s" in the Row #%s', $conditionFullName, $csvLine[4], ($k+1));
268
} else {
269
$csvLine[4] = (float)$csvLine[4];
270
}
271
272
if (!$this->_isPositiveDecimalNumber($csvLine[5])) {
273
- $exceptions[] = Mage::helper('shipping')->__('Invalid Shipping Price "%s" in the Row #%s', $csvLine[5], ($k+1));
274
} else {
275
$csvLine[5] = (float)$csvLine[5];
276
}
277
278
if (!$this->_isPositiveDecimalNumber($csvLine[6])) {
279
- $exceptions[] = Mage::helper('shipping')->__('Invalid Shipping Price per Kg "%s" in the Row #%s', $csvLine[6], ($k+1));
280
} else {
281
$csvLine[6] = (float)$csvLine[6];
282
}
283
-
284
- if (isset($csvLine[8]) AND !$this->_isValidChargeCode($csvLine[8])) {
285
- $exceptions[] = Mage::helper('shipping')->__('Invalid Charge Code "%s" in the Row #%s', $csvLine[8], ($k+1));
286
} else {
287
$csvLine[8] = isset($csvLine[8]) ? (string)$csvLine[8] : null;
288
}
289
-
290
- if (isset($csvLine[9]) AND !$this->_isValidChargeCode($csvLine[9])) {
291
- $exceptions[] = Mage::helper('shipping')->__('Invalid Charge Code "%s" in the Row #%s', $csvLine[9], ($k+1));
292
} else {
293
$csvLine[9] = isset($csvLine[9]) ? (string)$csvLine[9] : null;
294
}
295
296
$data[] = array(
297
- 'website_id' => $websiteId,
298
- 'dest_country_id' => $countryId,
299
- 'dest_region_id' => $regionId,
300
- 'dest_zip' => $zip,
301
- 'condition_name' => $conditionName,
302
- 'condition_from_value' => $csvLine[3],
303
- 'condition_to_value' => $csvLine[4],
304
- 'price' => $csvLine[5],
305
- 'price_per_kg' => $csvLine[6],
306
- 'delivery_type' => $csvLine[7],
307
- 'charge_codes_individual' => $csvLine[8],
308
- 'charge_codes_business' => $csvLine[9]
309
);
310
-
311
$dataDetails[] = array(
312
'country' => $csvLine[0],
313
'region' => $csvLine[1]
@@ -343,20 +356,19 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
343
$pcode1 = (int)$postcodeEntry[0];
344
$pcode2 = (int)$postcodeEntry[1];
345
Mage::log("Line $k, postcode range: $pcode1-$pcode2");
346
-
347
$postcodes = array_merge($postcodes, range(min($pcode1, $pcode2), max($pcode1, $pcode2)));
348
}
349
}
350
-
351
Mage::log(var_export($postcodes, true));
352
foreach($postcodes as $postcode) {
353
$dataLine['dest_zip'] = str_pad($postcode, 4, "0", STR_PAD_LEFT);
354
$connection->insert($table, $dataLine);
355
}
356
} catch (Exception $e) {
357
- //$exceptions[] = Mage::helper('shipping')->__('ERROR Row #%s (Country "%s", Region/State "%s", Zip "%s" and Value "%s")', ($k+1), $dataDetails[$k]['country'], $dataDetails[$k]['region'], $dataLine['dest_zip'], $dataLine['condition_value']);
358
Mage::log($e->getMessage());
359
- $exceptionas[] = $e->getMessage();
360
}
361
}
362
}
@@ -371,20 +383,20 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
371
/**
372
* Due to bugs in fgetcsv(), this extension is using tips from php.net.
373
* We could potentially swap this out for Zend's CSV parsers after testing for bugs in that.
374
- *
375
* Note: I've updated this code the latest version in the comments on php.net (Jonathan Melnick)
376
- *
377
* @author Jonathan Melnick
378
* @author Chris Norton
379
* @author Dave Walter
380
* @author justin at cam dot org
381
* @author Theodule
382
* @author dan dot jones at lunarfish dot co dot uk
383
- *
384
* @see http://www.php.net/manual/en/function.split.php#81490
385
* @see https://bugs.php.net/bug.php?id=45356
386
* @see http://stackoverflow.com/questions/12390851/fgetcsv-is-eating-the-first-letter-of-a-string-if-its-an-umlaut
387
- *
388
* @param string $string
389
* @param string $separator
390
*/
@@ -418,5 +430,4 @@ class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_M
418
{
419
return preg_match ("/^[0-9]+(\.[0-9]*)?#x2F;", $n);
420
}
421
-
422
}
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
*
12
* Originally based on Magento Tablerate Shipping code and Auctionmaid Matrixrate.
13
* @copyright Copyright (c) 2008 Auction Maid (http://www.auctionmaid.com)
16
* @category Fontis
17
* @package Fontis_Australia
18
* @author Chris Norton
19
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
20
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
*/
22
23
class Fontis_Australia_Model_Mysql4_Shipping_Carrier_Eparcel extends Mage_Core_Model_Mysql4_Abstract
24
{
25
+ const MIN_CSV_COLUMN_COUNT = 8;
26
+
27
protected function _construct()
28
{
29
$this->_init('australia/eparcel', 'pk');
32
public function getRate(Mage_Shipping_Model_Rate_Request $request)
33
{
34
$read = $this->_getReadAdapter();
35
36
+ $postcode = $request->getDestPostcode();
37
$table = $this->getMainTable();
38
+ $storeId = $request->getStoreId();
39
40
+ $insuranceStep = (float)Mage::getStoreConfig('default/carriers/eparcel/insurance_step', $storeId);
41
+ $insuranceCostPerStep = (float)Mage::getStoreConfig('default/carriers/eparcel/insurance_cost_per_step', $storeId);
42
+ $signatureRequired = Mage::getStoreConfigFlag('default/carriers/eparcel/signature_required', $storeId);
43
if($signatureRequired) {
44
+ $signatureCost = (float)Mage::getStoreConfig('default/carriers/eparcel/signature_cost', $storeId);
45
} else {
46
$signatureCost = 0;
47
}
48
+
49
Mage::log($request->getDestCountryId());
50
Mage::log($request->getDestRegionId());
51
Mage::log($postcode);
52
Mage::log(var_export($request->getConditionName(), true));
53
54
+ for ($j = 0; $j < 5; $j++) {
55
56
+ $select = $read->select()->from($table);
57
58
+ // Support for Multi Warehouse Extension.
59
+ if ($request->getWarehouseId() > 0) {
60
+ $select->where('stock_id = ?', $request->getWarehouseId());
61
+ }
62
+
63
switch($j) {
64
case 0:
65
$select->where(
71
case 1:
72
$select->where(
73
$read->quoteInto(" (dest_country_id=? ", $request->getDestCountryId()).
74
+ $read->quoteInto(" AND dest_region_id=? AND dest_zip='0000') ", $request->getDestRegionId())
75
);
76
break;
77
78
case 2:
79
$select->where(
80
+ $read->quoteInto(" (dest_country_id=? AND dest_region_id='0' AND dest_zip='0000') ", $request->getDestCountryId())
81
);
82
break;
83
case 3:
88
break;
89
case 4:
90
$select->where(
91
+ " (dest_country_id='0' AND dest_region_id='0' AND dest_zip='0000')"
92
);
93
break;
94
}
128
{
129
// have found a result or found nothing and at end of list!
130
foreach ($row as $data) {
131
+ try {
132
$price = (float)($data['price']);
133
+
134
// add per-Kg cost
135
$conditionValue = (float)($request->getData($request->getConditionName()));
136
$price += (float)($data['price_per_kg']) * $conditionValue;
137
+
138
// add signature cost
139
$price += $signatureCost;
140
141
+ // add version without insurance
142
$data['price'] = (string)$price;
143
$newdata[]=$data;
144
145
+ if (Mage::getStoreConfig('carriers/eparcel/insurance_enable', $storeId)) {
146
+ // add version with insurance
147
+ // work out how many insurance 'steps' we have
148
+ $steps = ceil($request->getPackageValue() / $insuranceStep);
149
+ Mage::log("Insurance steps: $steps");
150
+ // add on number of 'steps' multiplied by the
151
+ // insurance cost per step
152
+ $insuranceCost = $insuranceCostPerStep * $steps;
153
+ Mage::log("Insurance cost: $insuranceCost");
154
+ $price += $insuranceCost;
155
+
156
+ $data['price'] = (string)$price;
157
+ $data['delivery_type'] .= " with TransitCover";
158
+ $newdata[]=$data;
159
+ }
160
} catch(Exception $e) {
161
Mage::log($e->getMessage());
162
}
163
}
164
break;
165
}
166
+ }
167
Mage::log(var_export($newdata, true));
168
return $newdata;
169
}
170
171
public function uploadAndImport(Varien_Object $object)
172
{
173
$csvFile = $_FILES["groups"]["tmp_name"]["eparcel"]["fields"]["import"]["value"];
174
175
if (!empty($csvFile)) {
179
$table = Mage::getSingleton('core/resource')->getTableName('australia/eparcel');
180
181
$websiteId = $object->getScopeId();
182
183
if (isset($_POST['groups']['eparcel']['fields']['condition_name']['inherit'])) {
184
$conditionName = (string)Mage::getConfig()->getNode('default/carriers/eparcel/condition_name');
187
}
188
189
$conditionFullName = Mage::getModel('australia/shipping_carrier_eparcel')->getCode('condition_name_short', $conditionName);
190
+
191
if (!empty($csv)) {
192
$exceptions = array();
193
$csvLines = explode("\n", $csv);
194
$csvLine = array_shift($csvLines);
195
$csvLine = $this->_getCsvValues($csvLine);
196
+ if (count($csvLine) < self::MIN_CSV_COLUMN_COUNT) {
197
+ $exceptions[0] = Mage::helper('shipping')->__('Less than ' . self::MIN_CSV_COLUMN_COUNT . ' columns in the CSV header.');
198
}
199
200
$countryCodes = array();
201
$regionCodes = array();
202
+ foreach ($csvLines as $k => $csvLine) {
203
$csvLine = $this->_getCsvValues($csvLine);
204
+ $count = count($csvLine);
205
+ if ($count > 0 && $count < self::MIN_CSV_COLUMN_COUNT) {
206
+ $exceptions[0] = Mage::helper('shipping')->__('Less than ' . self::MIN_CSV_COLUMN_COUNT . ' columns in row ' . ($k + 1) . '.');
207
} else {
208
$countryCodes[] = $csvLine[0];
209
$regionCodes[] = $csvLine[1];
238
if (empty($countryCodesToIds) || !array_key_exists($csvLine[0], $countryCodesToIds)) {
239
$countryId = '0';
240
if ($csvLine[0] != '*' && $csvLine[0] != '') {
241
+ $exceptions[] = Mage::helper('shipping')->__('Invalid country "%s" on row #%s', $csvLine[0], ($k+1));
242
}
243
} else {
244
$countryId = $countryCodesToIds[$csvLine[0]];
247
if (empty($regionCodesToIds) || !array_key_exists($csvLine[1], $regionCodesToIds)) {
248
$regionId = '0';
249
if ($csvLine[1] != '*' && $csvLine[1] != '') {
250
+ $exceptions[] = Mage::helper('shipping')->__('Invalid region/state "%s" on row #%s', $csvLine[1], ($k+1));
251
}
252
} else {
253
$regionId = $regionCodesToIds[$csvLine[1]];
260
}
261
262
if (!$this->_isPositiveDecimalNumber($csvLine[3]) || $csvLine[3] == '*' || $csvLine[3] == '') {
263
+ $exceptions[] = Mage::helper('shipping')->__('Invalid %s "%s" on row #%s', $conditionFullName, $csvLine[3], ($k+1));
264
} else {
265
$csvLine[3] = (float)$csvLine[3];
266
}
267
268
if (!$this->_isPositiveDecimalNumber($csvLine[4]) || $csvLine[4] == '*' || $csvLine[4] == '') {
269
+ $exceptions[] = Mage::helper('shipping')->__('Invalid %s "%s" on row #%s', $conditionFullName, $csvLine[4], ($k+1));
270
} else {
271
$csvLine[4] = (float)$csvLine[4];
272
}
273
274
if (!$this->_isPositiveDecimalNumber($csvLine[5])) {
275
+ $exceptions[] = Mage::helper('shipping')->__('Invalid shipping price "%s" on row #%s', $csvLine[5], ($k+1));
276
} else {
277
$csvLine[5] = (float)$csvLine[5];
278
}
279
280
if (!$this->_isPositiveDecimalNumber($csvLine[6])) {
281
+ $exceptions[] = Mage::helper('shipping')->__('Invalid shipping price per kg "%s" on row #%s', $csvLine[6], ($k+1));
282
} else {
283
$csvLine[6] = (float)$csvLine[6];
284
}
285
+
286
+ /** @var Fontis_Australia_Helper_Eparcel $helper */
287
+ $helper = Mage::helper('australia/eparcel');
288
+
289
+ if (isset($csvLine[8]) && $csvLine[8] != '' && !$helper->isValidChargeCode($csvLine[8])) {
290
+ $exceptions[] = Mage::helper('shipping')->__('Invalid charge code "%s" on row #%s', $csvLine[8], ($k+1));
291
} else {
292
$csvLine[8] = isset($csvLine[8]) ? (string)$csvLine[8] : null;
293
}
294
+
295
+ if (isset($csvLine[9]) && $csvLine[9] != '' && !$helper->isValidChargeCode($csvLine[9])) {
296
+ $exceptions[] = Mage::helper('shipping')->__('Invalid charge code "%s" on row #%s', $csvLine[9], ($k+1));
297
} else {
298
$csvLine[9] = isset($csvLine[9]) ? (string)$csvLine[9] : null;
299
}
300
301
+ // If Multi Warehouse Ext is not used the value is 0 (as for no warehouse) otherwise is positive integer from table "warehouse"
302
+ if (isset($csvLine[10]) && intval($csvLine[10]) < 0) {
303
+ $exceptions[] = Mage::helper('shipping')->__('Invalid Warehouse ID "%s" in the Row #%s', $csvLine[10], ($k+1));
304
+ } else {
305
+ $csvLine[10] = isset($csvLine[10]) ? (int)$csvLine[10] : null;
306
+ }
307
+
308
$data[] = array(
309
+ 'website_id' => $websiteId,
310
+ 'dest_country_id' => $countryId,
311
+ 'dest_region_id' => $regionId,
312
+ 'dest_zip' => $zip,
313
+ 'condition_name' => $conditionName,
314
+ 'condition_from_value' => $csvLine[3],
315
+ 'condition_to_value' => $csvLine[4],
316
+ 'price' => $csvLine[5],
317
+ 'price_per_kg' => $csvLine[6],
318
+ 'delivery_type' => $csvLine[7],
319
+ 'charge_code_individual' => $csvLine[8],
320
+ 'charge_code_business' => $csvLine[9],
321
+ 'stock_id' => $csvLine[10],
322
);
323
+
324
$dataDetails[] = array(
325
'country' => $csvLine[0],
326
'region' => $csvLine[1]
356
$pcode1 = (int)$postcodeEntry[0];
357
$pcode2 = (int)$postcodeEntry[1];
358
Mage::log("Line $k, postcode range: $pcode1-$pcode2");
359
+
360
$postcodes = array_merge($postcodes, range(min($pcode1, $pcode2), max($pcode1, $pcode2)));
361
}
362
}
363
+
364
Mage::log(var_export($postcodes, true));
365
foreach($postcodes as $postcode) {
366
$dataLine['dest_zip'] = str_pad($postcode, 4, "0", STR_PAD_LEFT);
367
$connection->insert($table, $dataLine);
368
}
369
} catch (Exception $e) {
370
Mage::log($e->getMessage());
371
+ $exceptions[] = $e->getMessage();
372
}
373
}
374
}
383
/**
384
* Due to bugs in fgetcsv(), this extension is using tips from php.net.
385
* We could potentially swap this out for Zend's CSV parsers after testing for bugs in that.
386
+ *
387
* Note: I've updated this code the latest version in the comments on php.net (Jonathan Melnick)
388
+ *
389
* @author Jonathan Melnick
390
* @author Chris Norton
391
* @author Dave Walter
392
* @author justin at cam dot org
393
* @author Theodule
394
* @author dan dot jones at lunarfish dot co dot uk
395
+ *
396
* @see http://www.php.net/manual/en/function.split.php#81490
397
* @see https://bugs.php.net/bug.php?id=45356
398
* @see http://stackoverflow.com/questions/12390851/fgetcsv-is-eating-the-first-letter-of-a-string-if-its-an-umlaut
399
+ *
400
* @param string $string
401
* @param string $separator
402
*/
430
{
431
return preg_match ("/^[0-9]+(\.[0-9]*)?#x2F;", $n);
432
}
433
}
app/code/community/Fontis/Australia/Model/Mysql4/Shipping/Carrier/Eparcel/Collection.php CHANGED
@@ -8,16 +8,13 @@
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
* Originally based on Magento Tablerate Shipping code.
16
*
17
* @category Fontis
18
* @package Fontis_Australia
19
* @author Chris Norton
20
- * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
21
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
*/
23
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
*
12
* Originally based on Magento Tablerate Shipping code.
13
*
14
* @category Fontis
15
* @package Fontis_Australia
16
* @author Chris Norton
17
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
18
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
*/
20
app/code/community/Fontis/Australia/Model/Observer.php ADDED
@@ -0,0 +1,42 @@
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
+ *
12
+ * @category Fontis
13
+ * @package Fontis_Australia
14
+ * @author Thai Phan
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Fontis_Australia_Model_Observer
20
+ {
21
+ public function autoload()
22
+ {
23
+ require_once(__DIR__ . '/../lib/vendor/autoload.php');
24
+ }
25
+
26
+ /**
27
+ * Adds a history entry to orders placed using AU direct deposit or BPay.
28
+ */
29
+ public function addHistory($event)
30
+ {
31
+ $order = $event->getOrder();
32
+ if($order && $order->getPayment()) {
33
+ if($order->getPayment()->getMethod() == 'directdeposit_au') {
34
+ $order->addStatusHistoryComment('Order placed with Direct Deposit')
35
+ ->setIsCustomerNotified(false);
36
+ } else if($order->getPayment()->getMethod() == 'bpay') {
37
+ $order->addStatusHistoryComment('Order placed with BPay')
38
+ ->setIsCustomerNotified(false);
39
+ }
40
+ }
41
+ }
42
+ }
app/code/community/Fontis/Australia/Model/Payment/Bpay.php CHANGED
@@ -8,14 +8,11 @@
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
@@ -30,7 +27,7 @@ class Fontis_Australia_Model_Payment_Bpay extends Mage_Payment_Model_Method_Abst
30
protected $_code = 'bpay';
31
protected $_formBlockType = 'fontis_australia_block_bpay_form';
32
protected $_infoBlockType = 'fontis_australia_block_bpay_info';
33
-
34
protected $_ref = null;
35
36
public function isAvailable($quote = null)
@@ -39,10 +36,10 @@ class Fontis_Australia_Model_Payment_Bpay extends Mage_Payment_Model_Method_Abst
39
{
40
return false;
41
}
42
-
43
$groupAccess = $this->getConfigData('customer_group_access');
44
$group = $this->getConfigData('customer_group');
45
-
46
if($groupAccess == 0)
47
{
48
// No restrictions on access
@@ -66,7 +63,7 @@ class Fontis_Australia_Model_Payment_Bpay extends Mage_Payment_Model_Method_Abst
66
return true;
67
}
68
}
69
-
70
// Default, restrict access
71
return false;
72
}
@@ -82,29 +79,29 @@ class Fontis_Australia_Model_Payment_Bpay extends Mage_Payment_Model_Method_Abst
82
$info = $this->getInfoInstance();
83
$info->setBillerCode($this->getBillerCode());
84
$info->setRef($this->getRef());
85
-
86
$details = array();
87
if ($this->getBillerCode())
88
{
89
$details['biller_code'] = $this->getBillerCode();
90
-
91
if($this->getRef())
92
{
93
$details['ref'] = $this->getRef();
94
}
95
}
96
- if (!empty($details))
97
{
98
$this->getInfoInstance()->setAdditionalData(serialize($details));
99
}
100
return $this;
101
}
102
-
103
public function getBillerCode()
104
{
105
return $this->getConfigData('biller_code');
106
}
107
-
108
public function getRef()
109
{
110
if($this->_ref) {
@@ -129,38 +126,38 @@ class Fontis_Australia_Model_Payment_Bpay extends Mage_Payment_Model_Method_Abst
129
} else {
130
$order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
131
$this->_ref = $this->_calculateRef($order_id);
132
- }
133
//$this->assignData();
134
- }
135
return $this->_ref;
136
}
137
-
138
public function getMessage()
139
{
140
return $this->getConfigData('message');
141
}
142
-
143
protected function _calculateRef($ref, $seperator = '', $crn_length = 6)
144
{
145
- $revstr = strrev(intval($ref));
146
- $total = 0;
147
- for ($i = 0;$i < strlen($revstr); $i++) {
148
-
149
- if ($i%2 == 0) {
150
- $multiplier = 2;
151
- }
152
- else $multiplier = 1;
153
-
154
- $sub_total = intval($revstr[$i]) * $multiplier;
155
- if ($sub_total >= 10) {
156
- $temp = (string) $sub_total;
157
- $sub_total = intval($temp[0]) + intval($temp[1]);
158
- }
159
- $total += $sub_total;
160
- }
161
-
162
- $check_digit = (10 - ($total % 10))%10;
163
- $crn = str_pad(ltrim($ref, "0"),$crn_length-1,0,STR_PAD_LEFT) .$seperator. $check_digit;
164
return $crn;
165
}
166
}
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
27
protected $_code = 'bpay';
28
protected $_formBlockType = 'fontis_australia_block_bpay_form';
29
protected $_infoBlockType = 'fontis_australia_block_bpay_info';
30
+
31
protected $_ref = null;
32
33
public function isAvailable($quote = null)
36
{
37
return false;
38
}
39
+
40
$groupAccess = $this->getConfigData('customer_group_access');
41
$group = $this->getConfigData('customer_group');
42
+
43
if($groupAccess == 0)
44
{
45
// No restrictions on access
63
return true;
64
}
65
}
66
+
67
// Default, restrict access
68
return false;
69
}
79
$info = $this->getInfoInstance();
80
$info->setBillerCode($this->getBillerCode());
81
$info->setRef($this->getRef());
82
+
83
$details = array();
84
if ($this->getBillerCode())
85
{
86
$details['biller_code'] = $this->getBillerCode();
87
+
88
if($this->getRef())
89
{
90
$details['ref'] = $this->getRef();
91
}
92
}
93
+ if (!empty($details))
94
{
95
$this->getInfoInstance()->setAdditionalData(serialize($details));
96
}
97
return $this;
98
}
99
+
100
public function getBillerCode()
101
{
102
return $this->getConfigData('biller_code');
103
}
104
+
105
public function getRef()
106
{
107
if($this->_ref) {
126
} else {
127
$order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
128
$this->_ref = $this->_calculateRef($order_id);
129
+ }
130
//$this->assignData();
131
+ }
132
return $this->_ref;
133
}
134
+
135
public function getMessage()
136
{
137
return $this->getConfigData('message');
138
}
139
+
140
protected function _calculateRef($ref, $seperator = '', $crn_length = 6)
141
{
142
+ $revstr = strrev(intval($ref));
143
+ $total = 0;
144
+ for ($i = 0;$i < strlen($revstr); $i++) {
145
+
146
+ if ($i%2 == 0) {
147
+ $multiplier = 2;
148
+ }
149
+ else $multiplier = 1;
150
+
151
+ $sub_total = intval($revstr[$i]) * $multiplier;
152
+ if ($sub_total >= 10) {
153
+ $temp = (string) $sub_total;
154
+ $sub_total = intval($temp[0]) + intval($temp[1]);
155
+ }
156
+ $total += $sub_total;
157
+ }
158
+
159
+ $check_digit = (10 - ($total % 10))%10;
160
+ $crn = str_pad(ltrim($ref, "0"),$crn_length-1,0,STR_PAD_LEFT) .$seperator. $check_digit;
161
return $crn;
162
}
163
}
app/code/community/Fontis/Australia/Model/Payment/Directdeposit.php CHANGED
@@ -8,14 +8,11 @@
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
@@ -43,10 +40,10 @@ class Fontis_Australia_Model_Payment_Directdeposit extends Mage_Payment_Model_Me
43
{
44
return false;
45
}
46
-
47
$groupAccess = $this->getConfigData('customer_group_access');
48
$group = $this->getConfigData('customer_group');
49
-
50
if($groupAccess == 0)
51
{
52
// No restrictions on access
@@ -70,7 +67,7 @@ class Fontis_Australia_Model_Payment_Directdeposit extends Mage_Payment_Model_Me
70
return true;
71
}
72
}
73
-
74
// Default, restrict access
75
return false;
76
}
@@ -88,11 +85,11 @@ class Fontis_Australia_Model_Payment_Directdeposit extends Mage_Payment_Model_Me
88
{
89
$details['account_name'] = $this->getAccountName();
90
}
91
- if ($this->getAccountBSB())
92
{
93
$details['account_bsb'] = $this->getAccountBSB();
94
}
95
- if ($this->getAccountNumber())
96
{
97
$details['account_number'] = $this->getAccountNumber();
98
}
@@ -100,13 +97,13 @@ class Fontis_Australia_Model_Payment_Directdeposit extends Mage_Payment_Model_Me
100
{
101
$details['message'] = $this->getMessage();
102
}
103
- if (!empty($details))
104
{
105
$this->getInfoInstance()->setAdditionalData(serialize($details));
106
}
107
return $this;
108
}
109
-
110
public function getAccountName()
111
{
112
return Mage::getStoreConfig('payment/directdeposit_au/account_name', $this->getInfoInstance()->getQuote()->getStoreId());
@@ -121,7 +118,7 @@ class Fontis_Australia_Model_Payment_Directdeposit extends Mage_Payment_Model_Me
121
{
122
return Mage::getStoreConfig('payment/directdeposit_au/account_number', $this->getInfoInstance()->getQuote()->getStoreId());
123
}
124
-
125
public function getMessage()
126
{
127
return Mage::getStoreConfig('payment/directdeposit_au/message', $this->getInfoInstance()->getQuote()->getStoreId());
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
*
12
* @category Fontis
13
* @package Fontis_Australia
14
* @author Chris Norton
15
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
*/
18
40
{
41
return false;
42
}
43
+
44
$groupAccess = $this->getConfigData('customer_group_access');
45
$group = $this->getConfigData('customer_group');
46
+
47
if($groupAccess == 0)
48
{
49
// No restrictions on access
67
return true;
68
}
69
}
70
+
71
// Default, restrict access
72
return false;
73
}
85
{
86
$details['account_name'] = $this->getAccountName();
87
}
88
+ if ($this->getAccountBSB())
89
{
90
$details['account_bsb'] = $this->getAccountBSB();
91
}
92
+ if ($this->getAccountNumber())
93
{
94
$details['account_number'] = $this->getAccountNumber();
95
}
97
{
98
$details['message'] = $this->getMessage();
99
}
100
+ if (!empty($details))
101
{
102
$this->getInfoInstance()->setAdditionalData(serialize($details));
103
}
104
return $this;
105
}
106
+
107
public function getAccountName()
108
{
109
return Mage::getStoreConfig('payment/directdeposit_au/account_name', $this->getInfoInstance()->getQuote()->getStoreId());
118
{
119
return Mage::getStoreConfig('payment/directdeposit_au/account_number', $this->getInfoInstance()->getQuote()->getStoreId());
120
}
121
+
122
public function getMessage()
123
{
124
return Mage::getStoreConfig('payment/directdeposit_au/message', $this->getInfoInstance()->getQuote()->getStoreId());
app/code/community/Fontis/Australia/Model/Shipping/Carrier/Australiapost.php CHANGED
@@ -9,14 +9,11 @@
9
* that is bundled with this package in the file LICENSE.txt.
10
* It is also available through the world-wide-web at this URL:
11
* http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
*
16
* @category Fontis
17
* @package Fontis_Australia
18
* @author Chris Norton
19
- * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
20
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
*/
22
@@ -82,43 +79,42 @@ class Fontis_Australia_Model_Shipping_Carrier_Australiapost extends Mage_Shippin
82
83
if ($drc['err_msg'] == 'OK') {
84
// Check for registered post activation. If so, add extra options
85
- if ($this->getConfigData('registered_post'))
86
- if (in_array('STANDARD', $allowedShippingMethods)) {
87
- $title = $this->getConfigData('name') . " " . ucfirst(strtolower($shipping_method));
88
-
89
- $charge = $drc['charge'];
90
- $charge += $this->getConfigData('registered_post_charge');
91
-
92
- if ($this->getConfigData('person_to_person')) {
93
- $charge += 5.50;
94
- } elseif ($this->getConfigData('delivery_confirmation')) {
95
- $charge += 1.85;
96
- }
97
-
98
- $method = $this->_createMethod($request, $shipping_method, $title, $charge, $charge);
99
- $result->append($method);
100
-
101
- // Insurance only covers up to $5000 worth of goods.
102
- $packageValue = ($request->getPackageValue() > 5000) ? 5000 : $request->getPackageValue();
103
-
104
- // Insurance cost is $1.25 per $100 or part thereof. First $100 is
105
- // included in normal registered post costs.
106
- $insurance = (ceil($packageValue / 100) - 1) * 1.25;
107
-
108
- // Only add a new method if the insurance is different
109
- if ($insurance > 0) {
110
- $charge += $insurance;
111
-
112
- $title = $this->getConfigData('name') . " " . ucfirst(strtolower($shipping_method)) . ' with Extra Cover';
113
- $method = $this->_createMethod($request, $shipping_method . '_EC', $title, $charge, $charge);
114
- $result->append($method);
115
- }
116
- } else {
117
- $title = $this->getConfigData('name') . " " . ucfirst(strtolower($shipping_method));
118
-
119
- $method = $this->_createMethod($request, $shipping_method, $title, $drc['charge'], $drc['charge']);
120
- $result->append($method);
121
- }
122
}
123
}
124
} else {
@@ -267,23 +263,23 @@ class Fontis_Australia_Model_Shipping_Carrier_Australiapost extends Mage_Shippin
267
{
268
// Construct the appropriate URL and send all the information
269
// to the Australia Post DRC.
270
-
271
// don't make a call if the postcodes are not populated.
272
if(is_null($fromPostCode) || is_null($toPostCode)) {
273
return array('err_msg' => 'One of To or From Postcodes are missing');
274
}
275
-
276
/**
277
* Lucas van Staden @ doghouse media (lucas@dhmedia.com.au)
278
* Add a drc call cache to session. (valid for 1 hour)
279
* The call to drc is made at least 3-4 times, using the same data (ugh)
280
* - Add to cart (sometimes * 2)
281
* - Checkout * 2
282
- *
283
* Create a lookup cache based on FromPostcode->ToPostcode combination, and re-use cached data
284
* The end result will kill lookups in checkout process, as it was actually done at cart, which will speed checkout up.
285
*/
286
-
287
$drcCache = Mage::getSingleton('checkout/session')->getDrcCache();
288
if(!$drcCache) {
289
$drcCache = array();
@@ -292,8 +288,8 @@ class Fontis_Australia_Model_Shipping_Carrier_Australiapost extends Mage_Shippin
292
// prevents any mistake from stopping checkout as a new lookup will be done.
293
try {
294
$time = time();
295
- if($this->getConfigFlag('cache')
296
- && array_key_exists($fromPostCode, $drcCache)
297
&& array_key_exists($toPostCode, $drcCache[$fromPostCode])
298
&& $time - $drcCache[$fromPostCode][$toPostCode]['timestamp'] < 3600) {
299
if ($this->getConfigFlag('debug')) {
@@ -303,23 +299,23 @@ class Fontis_Australia_Model_Shipping_Carrier_Australiapost extends Mage_Shippin
303
}
304
} catch (Exception $e) {
305
mage::logException($e);
306
- }
307
}
308
-
309
- $url = "http://drc.edeliver.com.au/ratecalc.asp?" .
310
"Pickup_Postcode=" . rawurlencode($fromPostCode) .
311
"&Destination_Postcode=" . rawurlencode($toPostCode) .
312
"&Country=" . rawurlencode($destCountry) .
313
"&Weight=" . rawurlencode($weight) .
314
- "&Service_Type=" . rawurlencode($service) .
315
- "&Height=" . rawurlencode($height) .
316
- "&Width=" . rawurlencode($width) .
317
"&Length=" . rawurlencode($length) .
318
"&Quantity=" . rawurlencode($num_boxes);
319
-
320
if(extension_loaded('curl'))
321
{
322
-
323
if ($this->getConfigFlag('debug')) {
324
Mage::log('Using curl', null, 'fontis_australia.log');
325
}
@@ -346,15 +342,15 @@ class Fontis_Australia_Model_Shipping_Carrier_Australiapost extends Mage_Shippin
346
$drc_result = explode("\n",$drc_result);
347
//clean up array
348
$drc_result = array_map('trim', $drc_result);
349
- $drc_result = array_filter($drc_result);
350
-
351
}
352
else if(ini_get('allow_url_fopen'))
353
{
354
if ($this->getConfigFlag('debug')) {
355
Mage::log('Using fopen URL wrappers', null, 'fontis_australia.log');
356
}
357
-
358
$drc_result = file($url);
359
}
360
else
@@ -376,12 +372,12 @@ class Fontis_Australia_Model_Shipping_Carrier_Australiapost extends Mage_Shippin
376
return array('err_msg' => 'Parsing error on Australia Post results');
377
}
378
}
379
-
380
// save the drc data to lookup cache, with a timestamp.
381
if(is_array($drcCache)){
382
- $drcCache[$fromPostCode][$toPostCode] = array('result'=>$result,'timestamp'=>time());
383
Mage::getSingleton('checkout/session')->setDrcCache($drcCache);
384
- }
385
return $result;
386
}
387
9
* that is bundled with this package in the file LICENSE.txt.
10
* It is also available through the world-wide-web at this URL:
11
* http://opensource.org/licenses/osl-3.0.php
12
*
13
* @category Fontis
14
* @package Fontis_Australia
15
* @author Chris Norton
16
+ * @copyright Copyright (c) 2014 Fontis Pty. Ltd. (http://www.fontis.com.au)
17
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
*/
19
79
80
if ($drc['err_msg'] == 'OK') {
81
// Check for registered post activation. If so, add extra options
82
+ if ($this->getConfigData('registered_post')) {
83
+ $title = $this->getConfigData('name') . " " . ucfirst(strtolower($shipping_method));
84
+
85
+ $charge = $drc['charge'];
86
+ $charge += $this->getConfigData('registered_post_charge');
87
+
88
+ if ($this->getConfigData('person_to_person')) {
89
+ $charge += 5.50;
90
+ } elseif ($this->getConfigData('delivery_confirmation')) {
91
+ $charge += 1.85;
92
+ }
93
+
94
+ $method = $this->_createMethod($request, $shipping_method, $title, $charge, $charge);
95
+ $result->append($method);
96
+
97
+ // Insurance only covers up to $5000 worth of goods.
98
+ $packageValue = ($request->getPackageValue() > 5000) ? 5000 : $request->getPackageValue();
99
+
100
+ // Insurance cost is $1.25 per $100 or part thereof. First $100 is
101
+ // included in normal registered post costs.
102
+ $insurance = (ceil($packageValue / 100) - 1) * 1.25;
103
+
104
+ // Only add a new method if the insurance is different
105
+ if ($insurance > 0) {
106
+ $charge += $insurance;
107
+
108
+ $title = $this->getConfigData('name') . " " . ucfirst(strtolower($shipping_method)) . ' with Extra Cover';
109
+ $method = $this->_createMethod($request, $shipping_method . '_EC', $title, $charge, $charge);
110
+ $result->append($method);
111
+ }
112
+ } else {
113
+ $title = $this->getConfigData('name') . " " . ucfirst(strtolower($shipping_method));
114
+
115
+ $method = $this->_createMethod($request, $shipping_method, $title, $drc['charge'], $drc['charge']);
116
+ $result->append($method);
117
+ }
118
}
119
}
120
} else {
263
{
264
// Construct the appropriate URL and send all the information
265
// to the Australia Post DRC.
266
+
267
// don't make a call if the postcodes are not populated.
268
if(is_null($fromPostCode) || is_null($toPostCode)) {
269
return array('err_msg' => 'One of To or From Postcodes are missing');
270
}
271
+
272
/**
273
* Lucas van Staden @ doghouse media (lucas@dhmedia.com.au)
274
* Add a drc call cache to session. (valid for 1 hour)
275
* The call to drc is made at least 3-4 times, using the same data (ugh)
276
* - Add to cart (sometimes * 2)
277
* - Checkout * 2
278
+ *
279
* Create a lookup cache based on FromPostcode->ToPostcode combination, and re-use cached data
280
* The end result will kill lookups in checkout process, as it was actually done at cart, which will speed checkout up.
281
*/
282
+
283
$drcCache = Mage::getSingleton('checkout/session')->getDrcCache();
284
if(!$drcCache) {
285
$drcCache = array();
288
// prevents any mistake from stopping checkout as a new lookup will be done.
289
try {
290
$time = time();
291
+ if($this->getConfigFlag('cache')
292
+ && array_key_exists($fromPostCode, $drcCache)
293
&& array_key_exists($toPostCode, $drcCache[$fromPostCode])
294
&& $time - $drcCache[$fromPostCode][$toPostCode]['timestamp'] < 3600) {
295
if ($this->getConfigFlag('debug')) {
299
}
300
} catch (Exception $e) {
301
mage::logException($e);
302
+ }
303
}
304
+
305
+ $url = "http://drc.edeliver.com.au/ratecalc.asp?" .
306
"Pickup_Postcode=" . rawurlencode($fromPostCode) .
307
"&Destination_Postcode=" . rawurlencode($toPostCode) .
308
"&Country=" . rawurlencode($destCountry) .
309
"&Weight=" . rawurlencode($weight) .
310
+ "&Service_Type=" . rawurlencode($service) .
311
+ "&Height=" . rawurlencode($height) .
312
+ "&Width=" . rawurlencode($width) .
313
"&Length=" . rawurlencode($length) .
314
"&Quantity=" . rawurlencode($num_boxes);
315
+
316
if(extension_loaded('curl'))
317
{
318
+
319
if ($this->getConfigFlag('debug')) {
320
Mage::log('Using curl', null, 'fontis_australia.log');
321
}
342
$drc_result = explode("\n",$drc_result);
343
//clean up array
344
$drc_result = array_map('trim', $drc_result);
345
+ $drc_result = array_filter($drc_result);
346
+
347
}
348
else if(ini_get('allow_url_fopen'))
349
{
350
if ($this->getConfigFlag('debug')) {
351
Mage::log('Using fopen URL wrappers', null, 'fontis_australia.log');
352
}
353
+
354
$drc_result = file($url);
355
}
356
else
372
return array('err_msg' => 'Parsing error on Australia Post results');
373
}
374
}
375
+
376
// save the drc data to lookup cache, with a timestamp.
377
if(is_array($drcCache)){
378
+ $drcCache[$fromPostCode][$toPostCode] = array('result'=>$result,'timestamp'=>time());
379
Mage::getSingleton('checkout/session')->setDrcCache($drcCache);
380
+ }
381
return $result;
382
}
383
app/code/community/Fontis/Australia/Model/Shipping/Carrier/Eparcel.php CHANGED
@@ -8,9 +8,6 @@
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
* Originally based on Magento Tablerate Shipping code and Auctionmaid Matrixrate.
16
* @copyright Copyright (c) 2008 Auction Maid (http://www.auctionmaid.com)
@@ -19,7 +16,7 @@
19
* @category Fontis
20
* @package Fontis_Australia
21
* @author Chris Norton
22
- * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
23
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
*/
25
@@ -31,48 +28,55 @@
31
*/
32
33
class Fontis_Australia_Model_Shipping_Carrier_Eparcel
34
- extends Mage_Shipping_Model_Carrier_Abstract
35
- implements Mage_Shipping_Model_Carrier_Interface
36
{
37
- protected $_code = 'eparcel';
38
- protected $_default_condition_name = 'package_weight';
39
-
40
- protected $_conditionNames = array();
41
-
42
- public function __construct()
43
- {
44
- parent::__construct();
45
- foreach ($this->getCode('condition_name') as $k=>$v) {
46
- $this->_conditionNames[] = $k;
47
- }
48
- }
49
-
50
- public function collectRates(Mage_Shipping_Model_Rate_Request $request)
51
- {
52
- if (!$this->getConfigFlag('active')) {
53
- return false;