Version Notes
Download this release
Release Info
Developer | Fontis |
Extension | Fontis_Australia |
Version | 3.0.0 |
Comparing to | |
See all releases |
Code changes from version 2.5.0 to 3.0.0
- app/code/community/Fontis/Australia/Block/Autocomplete.php +3 -0
- app/code/community/Fontis/Australia/Block/Bpay/Form.php +0 -1
- app/code/community/Fontis/Australia/Block/Bpay/Info.php +0 -2
- app/code/community/Fontis/Australia/Block/Directdeposit/Form.php +0 -2
- app/code/community/Fontis/Australia/Block/Directdeposit/Info.php +1 -3
- app/code/community/Fontis/Australia/Block/Getprice.php +0 -84
- app/code/community/Fontis/Australia/Block/Googleproducts.php +0 -85
- app/code/community/Fontis/Australia/Block/Myshopping.php +0 -84
- app/code/community/Fontis/Australia/Block/Shopbot.php +0 -89
- app/code/community/Fontis/Australia/Block/Shoppingdotcom.php +0 -83
- app/code/community/Fontis/Australia/Helper/Address.php +59 -0
- app/code/community/Fontis/Australia/Helper/Australiapost.php +167 -0
- app/code/community/Fontis/Australia/Helper/Bpay.php +0 -55
- app/code/community/Fontis/Australia/Helper/Clickandsend.php +78 -0
- app/code/community/Fontis/Australia/Helper/Data.php +9 -1
- app/code/community/Fontis/Australia/Model/Address/Australiapost.php +93 -0
- app/code/community/Fontis/Australia/Model/Address/Config/Backend.php +37 -0
- app/code/community/Fontis/Australia/Model/Address/Interface.php +56 -0
- app/code/community/Fontis/Australia/Model/Child.php +0 -100
- app/code/community/Fontis/Australia/Model/Config/Condition.php +3 -0
- app/code/community/Fontis/Australia/Model/Config/CustomerGroupAccess.php +7 -3
- app/code/community/Fontis/Australia/Model/Config/CustomerGroups.php +4 -1
- app/code/community/Fontis/Australia/Model/Config/EmailNotificationLevel.php +7 -3
- app/code/community/Fontis/Australia/Model/Config/ProductAttributes.php +3 -0
- app/code/community/Fontis/Australia/Model/FeedCronBase.php +0 -281
- app/code/community/Fontis/Australia/Model/Getprice.php +0 -69
- app/code/community/Fontis/Australia/Model/Getprice/Child.php +0 -137
- app/code/community/Fontis/Australia/Model/Getprice/Cron.php +0 -135
- app/code/community/Fontis/Australia/Model/Googleproducts.php +0 -61
- app/code/community/Fontis/Australia/Model/Googleproducts/Cron.php +0 -180
- app/code/community/Fontis/Australia/Model/Myshopping.php +0 -57
- app/code/community/Fontis/Australia/Model/Myshopping/Child.php +0 -152
- app/code/community/Fontis/Australia/Model/Myshopping/Cron.php +0 -89
- app/code/community/Fontis/Australia/Model/Mysql4/Shipping/Carrier/Eparcel.php +9 -5
- app/code/community/Fontis/Australia/Model/Mysql4/Shipping/Carrier/Eparcel/Collection.php +5 -4
- app/code/community/Fontis/Australia/Model/Observer.php +24 -0
- app/code/community/Fontis/Australia/Model/Payment/Bpay.php +119 -109
- app/code/community/Fontis/Australia/Model/Payment/Directdeposit.php +69 -63
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/Australiapost.php +342 -314
- app/code/community/Fontis/Australia/Model/Shipping/{Config/Shippingmethods.php → Carrier/Australiapost/Source/Method.php} +12 -11
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/Australiapost/Source/Visibility.php +58 -0
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/Clickandsend.php +231 -0
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/Clickandsend/Export/Csv.php +50 -0
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/Clickandsend/Export/Exception.php +21 -0
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/Clickandsend/Source/Categories/Item.php +59 -0
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/Clickandsend/Source/Instructions/Nondelivery.php +56 -0
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/{Eparcel/Export → Common/Export/Csv}/Abstract.php +3 -5
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/Eparcel.php +26 -17
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/Eparcel/Export/Csv.php +13 -6
- app/code/community/Fontis/Australia/Model/Shipping/Carrier/Eparcel/Export/Exception.php +0 -16
- app/code/community/Fontis/Australia/Model/Shipping/Config/Eparcelcondition.php +9 -6
- app/code/community/Fontis/Australia/Model/Shipping/Config/Weightunits.php +25 -9
- app/code/community/Fontis/Australia/Model/Shopbot.php +0 -38
- app/code/community/Fontis/Australia/Model/Shopbot/Child.php +0 -158
- app/code/community/Fontis/Australia/Model/Shopbot/Cron.php +0 -81
- app/code/community/Fontis/Australia/Model/Shoppingdotcom.php +0 -104
- app/code/community/Fontis/Australia/Model/Shoppingdotcom/Cron.php +0 -89
- app/code/community/Fontis/Australia/controllers/AddressController.php +85 -0
- app/code/community/Fontis/Australia/controllers/ClickandsendController.php +50 -0
- app/code/community/Fontis/Australia/etc/config.xml +49 -82
- app/code/community/Fontis/Australia/etc/system.xml +241 -388
- app/code/community/Fontis/Australia/lib/composer.json +5 -0
- app/code/community/Fontis/Australia/lib/composer.lock +217 -0
- app/code/community/Fontis/Australia/lib/vendor/autoload.php +7 -0
- app/code/community/Fontis/Australia/lib/vendor/composer/ClassLoader.php +379 -0
- app/code/community/Fontis/Australia/lib/vendor/composer/autoload_classmap.php +9 -0
- app/code/community/Fontis/Australia/lib/vendor/composer/autoload_namespaces.php +13 -0
- app/code/community/Fontis/Australia/lib/vendor/composer/autoload_psr4.php +9 -0
- app/code/community/Fontis/Australia/lib/vendor/composer/autoload_real.php +50 -0
- app/code/community/Fontis/Australia/lib/vendor/composer/installed.json +199 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/.gitignore +4 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/LICENSE +165 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/README.md +135 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/composer.json +23 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/phpunit.xml.dist +28 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/Common/Auspost.php +74 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/Common/Enum.php +63 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/Common/config.json +22 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/DeliveryChoice/DeliveryChoiceClient.php +87 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/DeliveryChoice/Enum/Day.php +38 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/DeliveryChoice/Enum/DeliveryNetwork.php +33 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/DeliveryChoice/Enum/State.php +39 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/DeliveryChoice/service.json +145 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/Postage/Enum/EnvelopeType.php +35 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/Postage/Enum/ServiceCode.php +48 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/Postage/Enum/ServiceOption.php +43 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/Postage/PostageClient.php +79 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/Postage/service.json +291 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/Auspost/Tests/Common/AuspostTest.php +79 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/Auspost/Tests/Common/EnumTest.php +77 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/Auspost/Tests/DeliveryChoice/DeliveryChoiceClientTest.php +64 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/Auspost/Tests/DeliveryChoice/OperationsTest.php +419 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/Auspost/Tests/Postage/OperationsTest.php +525 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/Auspost/Tests/Postage/PostageClientTest.php +60 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/bootstrap.php +37 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_customer_collection_points +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_customer_collection_points_footscray +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_customer_collection_points_hoppers_crossing +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_customer_collection_points_invalid_last_update +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_customer_collection_points_last_update +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_customer_collection_points_victoria +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_delivery_dates +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_delivery_dates_number_of_dates_1 +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_delivery_dates_number_of_dates_2 +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_delivery_timeslots +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_delivery_timeslots_monday +11 -0
- app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/tests/mock/deliverychoice/list_postcode_capabilities +11 -0
app/code/community/Fontis/Australia/Block/Autocomplete.php
CHANGED
@@ -21,6 +21,9 @@
|
|
21 |
*/
|
22 |
class Fontis_Australia_Block_Autocomplete extends Mage_Core_Block_Abstract
|
23 |
{
|
|
|
|
|
|
|
24 |
protected function _toHtml()
|
25 |
{
|
26 |
$html = '';
|
21 |
*/
|
22 |
class Fontis_Australia_Block_Autocomplete extends Mage_Core_Block_Abstract
|
23 |
{
|
24 |
+
/**
|
25 |
+
* @return string
|
26 |
+
*/
|
27 |
protected function _toHtml()
|
28 |
{
|
29 |
$html = '';
|
app/code/community/Fontis/Australia/Block/Bpay/Form.php
CHANGED
@@ -16,7 +16,6 @@
|
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
19 |
-
|
20 |
class Fontis_Australia_Block_Bpay_Form extends Mage_Payment_Block_Form
|
21 |
{
|
22 |
protected function _construct()
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
|
|
19 |
class Fontis_Australia_Block_Bpay_Form extends Mage_Payment_Block_Form
|
20 |
{
|
21 |
protected function _construct()
|
app/code/community/Fontis/Australia/Block/Bpay/Info.php
CHANGED
@@ -16,10 +16,8 @@
|
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
19 |
-
|
20 |
class Fontis_Australia_Block_Bpay_Info extends Mage_Payment_Block_Info
|
21 |
{
|
22 |
-
|
23 |
protected $_billerCode;
|
24 |
protected $_ref;
|
25 |
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
|
|
19 |
class Fontis_Australia_Block_Bpay_Info extends Mage_Payment_Block_Info
|
20 |
{
|
|
|
21 |
protected $_billerCode;
|
22 |
protected $_ref;
|
23 |
|
app/code/community/Fontis/Australia/Block/Directdeposit/Form.php
CHANGED
@@ -18,11 +18,9 @@
|
|
18 |
|
19 |
class Fontis_Australia_Block_Directdeposit_Form extends Mage_Payment_Block_Form
|
20 |
{
|
21 |
-
|
22 |
protected function _construct()
|
23 |
{
|
24 |
parent::_construct();
|
25 |
$this->setTemplate('fontis/australia/payment/directdeposit/form.phtml');
|
26 |
}
|
27 |
-
|
28 |
}
|
18 |
|
19 |
class Fontis_Australia_Block_Directdeposit_Form extends Mage_Payment_Block_Form
|
20 |
{
|
|
|
21 |
protected function _construct()
|
22 |
{
|
23 |
parent::_construct();
|
24 |
$this->setTemplate('fontis/australia/payment/directdeposit/form.phtml');
|
25 |
}
|
|
|
26 |
}
|
app/code/community/Fontis/Australia/Block/Directdeposit/Info.php
CHANGED
@@ -18,7 +18,6 @@
|
|
18 |
|
19 |
class Fontis_Australia_Block_Directdeposit_Info extends Mage_Payment_Block_Info
|
20 |
{
|
21 |
-
|
22 |
protected $_accountName;
|
23 |
protected $_accountBSB;
|
24 |
protected $_accountNumber;
|
@@ -85,7 +84,7 @@ class Fontis_Australia_Block_Directdeposit_Info extends Mage_Payment_Block_Info
|
|
85 |
/**
|
86 |
* Converts serialised additional data into a more usable form.
|
87 |
*
|
88 |
-
* @return
|
89 |
*/
|
90 |
protected function _convertAdditionalData()
|
91 |
{
|
@@ -103,5 +102,4 @@ class Fontis_Australia_Block_Directdeposit_Info extends Mage_Payment_Block_Info
|
|
103 |
}
|
104 |
return $this;
|
105 |
}
|
106 |
-
|
107 |
}
|
18 |
|
19 |
class Fontis_Australia_Block_Directdeposit_Info extends Mage_Payment_Block_Info
|
20 |
{
|
|
|
21 |
protected $_accountName;
|
22 |
protected $_accountBSB;
|
23 |
protected $_accountNumber;
|
84 |
/**
|
85 |
* Converts serialised additional data into a more usable form.
|
86 |
*
|
87 |
+
* @return Fontis_Australia_Block_Directdeposit_Info
|
88 |
*/
|
89 |
protected function _convertAdditionalData()
|
90 |
{
|
102 |
}
|
103 |
return $this;
|
104 |
}
|
|
|
105 |
}
|
app/code/community/Fontis/Australia/Block/Getprice.php
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fontis Australia Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
*
|
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");
|
21 |
-
|
22 |
-
public function __construct()
|
23 |
-
{
|
24 |
-
$this->addColumn('magento', array(
|
25 |
-
'label' => Mage::helper('adminhtml')->__('Magento product attribute'),
|
26 |
-
'size' => 28,
|
27 |
-
));
|
28 |
-
$this->addColumn('xmlfeed', array(
|
29 |
-
'label' => Mage::helper('adminhtml')->__('Getprice feed tag'),
|
30 |
-
'size' => 28
|
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');
|
41 |
-
|
42 |
-
foreach($attributes as $att_code)
|
43 |
-
{
|
44 |
-
$attribute = $eav_config_model->getAttribute('catalog_product', $att_code);
|
45 |
-
Mage::log($attribute);
|
46 |
-
|
47 |
-
if ($att_code != '')
|
48 |
-
{
|
49 |
-
$this->magentoOptions[$att_code] = $att_code;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
asort($this->magentoOptions);
|
53 |
-
}
|
54 |
-
|
55 |
-
protected function _renderCellTemplate($columnName)
|
56 |
-
{
|
57 |
-
if (empty($this->_columns[$columnName])) {
|
58 |
-
throw new Exception('Wrong column name specified.');
|
59 |
-
}
|
60 |
-
$column = $this->_columns[$columnName];
|
61 |
-
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
62 |
-
|
63 |
-
if($columnName == 'magento')
|
64 |
-
{
|
65 |
-
$rendered = '<select name="'.$inputName.'">';
|
66 |
-
foreach($this->magentoOptions as $att => $name)
|
67 |
-
{
|
68 |
-
$rendered .= '<option value="'.$att.'">'.$name.'</option>';
|
69 |
-
}
|
70 |
-
$rendered .= '</select>';
|
71 |
-
}
|
72 |
-
else
|
73 |
-
{
|
74 |
-
$rendered = '<select name="' . $inputName . '">';
|
75 |
-
$model = Mage::getModel('australia/getprice');
|
76 |
-
foreach ($model->available_fields as $field) {
|
77 |
-
$rendered .= '<option value="'.$field.'">'.str_replace("_", " ", $field)."</option>";
|
78 |
-
}
|
79 |
-
$rendered .= '</select>';
|
80 |
-
}
|
81 |
-
|
82 |
-
return $rendered;
|
83 |
-
}
|
84 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Fontis/Australia/Block/Googleproducts.php
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fontis Australia Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
*
|
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(
|
26 |
-
'label' => Mage::helper('adminhtml')->__('Magento product attribute'),
|
27 |
-
'size' => 28,
|
28 |
-
));
|
29 |
-
$this->addColumn('xmlfeed', array(
|
30 |
-
'label' => Mage::helper('adminhtml')->__('Google Products feed tag'),
|
31 |
-
'size' => 28
|
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');
|
42 |
-
|
43 |
-
foreach($attributes as $att_code)
|
44 |
-
{
|
45 |
-
$attribute = $eav_config_model->getAttribute('catalog_product', $att_code);
|
46 |
-
if ($att_code != '')
|
47 |
-
{
|
48 |
-
$this->magentoOptions[$att_code] = $att_code;
|
49 |
-
}
|
50 |
-
}
|
51 |
-
asort($this->magentoOptions);
|
52 |
-
}
|
53 |
-
|
54 |
-
protected function _renderCellTemplate($columnName)
|
55 |
-
{
|
56 |
-
if (empty($this->_columns[$columnName])) {
|
57 |
-
throw new Exception('Wrong column name specified.');
|
58 |
-
}
|
59 |
-
$column = $this->_columns[$columnName];
|
60 |
-
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
61 |
-
|
62 |
-
if($columnName == 'magento')
|
63 |
-
{
|
64 |
-
$rendered = '<select name="'.$inputName.'">';
|
65 |
-
foreach($this->magentoOptions as $att => $name)
|
66 |
-
{
|
67 |
-
$rendered .= '<option value="'.$att.'">'.$name.'</option>';
|
68 |
-
}
|
69 |
-
$rendered .= '</select>';
|
70 |
-
}
|
71 |
-
else
|
72 |
-
{
|
73 |
-
$rendered = '<select name="' . $inputName . '">';
|
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
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fontis Australia Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
*
|
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");
|
21 |
-
|
22 |
-
public function __construct()
|
23 |
-
{
|
24 |
-
$this->addColumn('magento', array(
|
25 |
-
'label' => Mage::helper('adminhtml')->__('Magento product attribute'),
|
26 |
-
'size' => 28,
|
27 |
-
));
|
28 |
-
$this->addColumn('xmlfeed', array(
|
29 |
-
'label' => Mage::helper('adminhtml')->__('Myshopping feed tag'),
|
30 |
-
'size' => 28
|
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');
|
41 |
-
|
42 |
-
foreach($attributes as $att_code)
|
43 |
-
{
|
44 |
-
$attribute = $eav_config_model->getAttribute('catalog_product', $att_code);
|
45 |
-
Mage::log($attribute);
|
46 |
-
|
47 |
-
if ($att_code != '')
|
48 |
-
{
|
49 |
-
$this->magentoOptions[$att_code] = $att_code;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
asort($this->magentoOptions);
|
53 |
-
}
|
54 |
-
|
55 |
-
protected function _renderCellTemplate($columnName)
|
56 |
-
{
|
57 |
-
if (empty($this->_columns[$columnName])) {
|
58 |
-
throw new Exception('Wrong column name specified.');
|
59 |
-
}
|
60 |
-
$column = $this->_columns[$columnName];
|
61 |
-
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
62 |
-
|
63 |
-
if($columnName == 'magento')
|
64 |
-
{
|
65 |
-
$rendered = '<select name="'.$inputName.'">';
|
66 |
-
foreach($this->magentoOptions as $att => $name)
|
67 |
-
{
|
68 |
-
$rendered .= '<option value="'.$att.'">'.$name.'</option>';
|
69 |
-
}
|
70 |
-
$rendered .= '</select>';
|
71 |
-
}
|
72 |
-
else
|
73 |
-
{
|
74 |
-
$rendered = '<select name="' . $inputName . '">';
|
75 |
-
$model = Mage::getModel('australia/myshopping');
|
76 |
-
foreach ($model->available_fields as $field) {
|
77 |
-
$rendered .= '<option value="'.$field.'">'.str_replace("_", " ", $field)."</option>";
|
78 |
-
}
|
79 |
-
$rendered .= '</select>';
|
80 |
-
}
|
81 |
-
|
82 |
-
return $rendered;
|
83 |
-
}
|
84 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Fontis/Australia/Block/Shopbot.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fontis Australia Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
*
|
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");
|
21 |
-
|
22 |
-
public function __construct()
|
23 |
-
{
|
24 |
-
$this->addColumn('magento', array(
|
25 |
-
'label' => Mage::helper('adminhtml')->__('Magento product attribute'),
|
26 |
-
'size' => 28,
|
27 |
-
));
|
28 |
-
$this->addColumn('xmlfeed', array(
|
29 |
-
'label' => Mage::helper('adminhtml')->__('Shopbot feed tag'),
|
30 |
-
'size' => 28
|
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';
|
41 |
-
$this->magentoOptions['FONTIS-image-link'] = 'Product Image Link';
|
42 |
-
|
43 |
-
// product options
|
44 |
-
$eav_config_model = Mage::getModel('eav/config');
|
45 |
-
$attributes = $eav_config_model->getEntityAttributeCodes('catalog_product');
|
46 |
-
|
47 |
-
foreach($attributes as $att_code)
|
48 |
-
{
|
49 |
-
$attribute = $eav_config_model->getAttribute('catalog_product', $att_code);
|
50 |
-
Mage::log($attribute);
|
51 |
-
|
52 |
-
if ($att_code != '')
|
53 |
-
{
|
54 |
-
$this->magentoOptions[$att_code] = $att_code;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
asort($this->magentoOptions);
|
58 |
-
}
|
59 |
-
|
60 |
-
protected function _renderCellTemplate($columnName)
|
61 |
-
{
|
62 |
-
if (empty($this->_columns[$columnName])) {
|
63 |
-
throw new Exception('Wrong column name specified.');
|
64 |
-
}
|
65 |
-
$column = $this->_columns[$columnName];
|
66 |
-
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
67 |
-
|
68 |
-
if($columnName == 'magento')
|
69 |
-
{
|
70 |
-
$rendered = '<select name="'.$inputName.'">';
|
71 |
-
foreach($this->magentoOptions as $att => $name)
|
72 |
-
{
|
73 |
-
$rendered .= '<option value="'.$att.'">'.$name.'</option>';
|
74 |
-
}
|
75 |
-
$rendered .= '</select>';
|
76 |
-
}
|
77 |
-
else
|
78 |
-
{
|
79 |
-
$rendered = '<select name="' . $inputName . '">';
|
80 |
-
$model = Mage::getModel('australia/shopbot');
|
81 |
-
foreach ($model->available_fields as $field) {
|
82 |
-
$rendered .= '<option value="'.$field.'">'.str_replace("_", " ", $field)."</option>";
|
83 |
-
}
|
84 |
-
$rendered .= '</select>';
|
85 |
-
}
|
86 |
-
|
87 |
-
return $rendered;
|
88 |
-
}
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Fontis/Australia/Block/Shoppingdotcom.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fontis Australia Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
*
|
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(
|
26 |
-
'label' => Mage::helper('adminhtml')->__('Magento product attribute'),
|
27 |
-
'size' => 28,
|
28 |
-
));
|
29 |
-
$this->addColumn('xmlfeed', array(
|
30 |
-
'label' => Mage::helper('adminhtml')->__('Shopping.com feed tag'),
|
31 |
-
'size' => 28
|
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');
|
42 |
-
|
43 |
-
foreach($attributes as $att_code)
|
44 |
-
{
|
45 |
-
$attribute = $eav_config_model->getAttribute('catalog_product', $att_code);
|
46 |
-
if ($att_code != '')
|
47 |
-
{
|
48 |
-
$this->magentoOptions[$att_code] = $att_code;
|
49 |
-
}
|
50 |
-
}
|
51 |
-
asort($this->magentoOptions);
|
52 |
-
}
|
53 |
-
|
54 |
-
protected function _renderCellTemplate($columnName)
|
55 |
-
{
|
56 |
-
if (empty($this->_columns[$columnName])) {
|
57 |
-
throw new Exception('Wrong column name specified.');
|
58 |
-
}
|
59 |
-
$column = $this->_columns[$columnName];
|
60 |
-
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
61 |
-
|
62 |
-
if($columnName == 'magento')
|
63 |
-
{
|
64 |
-
$rendered = '<select name="'.$inputName.'">';
|
65 |
-
foreach($this->magentoOptions as $att => $name)
|
66 |
-
{
|
67 |
-
$rendered .= '<option value="'.$att.'">'.$name.'</option>';
|
68 |
-
}
|
69 |
-
$rendered .= '</select>';
|
70 |
-
}
|
71 |
-
else
|
72 |
-
{
|
73 |
-
$rendered = '<select name="' . $inputName . '">';
|
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/Address.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @author Thai Phan
|
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 |
+
|
20 |
+
/**
|
21 |
+
* Helper functions for address validation
|
22 |
+
*/
|
23 |
+
class Fontis_Australia_Helper_Address extends Mage_Core_Helper_Abstract
|
24 |
+
{
|
25 |
+
const XML_PATH_ADDRESS_VALIDATION_ENABLED = 'fontis_australia/address_validation/enabled';
|
26 |
+
const XML_PATH_ADDRESS_VALIDATION_BACKEND = 'fontis_australia/address_validation/backend';
|
27 |
+
const XML_PATH_DELIVERY_CHOICES_DEVELOPER_MODE = 'fontis_australia/address_validation/delivery_choices_developer_mode';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Checks whether checkout address validation is enabled.
|
31 |
+
*
|
32 |
+
* @return bool
|
33 |
+
*/
|
34 |
+
public function isAddressValidationEnabled()
|
35 |
+
{
|
36 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_ADDRESS_VALIDATION_ENABLED);
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Gets the selected backend for address validation, e.g. Australia Post
|
41 |
+
* Delivery Choices
|
42 |
+
*
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
public function getAddressValidationBackend()
|
46 |
+
{
|
47 |
+
return Mage::getStoreConfig(self::XML_PATH_ADDRESS_VALIDATION_BACKEND);
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Checks whether developer mode is enabled for Delivery Choices.
|
52 |
+
*
|
53 |
+
* @return bool
|
54 |
+
*/
|
55 |
+
public function isDeliveryChoicesDeveloperMode()
|
56 |
+
{
|
57 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_DELIVERY_CHOICES_DEVELOPER_MODE);
|
58 |
+
}
|
59 |
+
}
|
app/code/community/Fontis/Australia/Helper/Australiapost.php
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
/**
|
20 |
+
* Collection of Australia Post utility functions.
|
21 |
+
*/
|
22 |
+
class Fontis_Australia_Helper_Australiapost extends Mage_Core_Helper_Data
|
23 |
+
{
|
24 |
+
const XML_PATH_AUSTRALIA_POST_DEVELOPER_MODE = 'carriers/australiapost/developer_mode';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Returns whether the Australia Post functionality is enabled in the
|
28 |
+
* backend.
|
29 |
+
*
|
30 |
+
* @return bool
|
31 |
+
*/
|
32 |
+
public function isActive()
|
33 |
+
{
|
34 |
+
return Mage::getStoreConfig('carriers/australiapost/active');
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Checks whether developer mode is enabled for the Australia Post shipping
|
39 |
+
* rates API.
|
40 |
+
*
|
41 |
+
* @return bool
|
42 |
+
*/
|
43 |
+
public function isAustraliaPostDeveloperMode()
|
44 |
+
{
|
45 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_AUSTRALIA_POST_DEVELOPER_MODE);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get the country ID, e.g. "AU" or "US"
|
50 |
+
*
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
public function getCountryId()
|
54 |
+
{
|
55 |
+
return Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getData('country_id');
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Determines whether "Signature on Delivery" is enabled and available for
|
60 |
+
* the current destination. This is a domestic option.
|
61 |
+
*
|
62 |
+
* @return bool
|
63 |
+
*/
|
64 |
+
public function isSignatureOnDelivery()
|
65 |
+
{
|
66 |
+
return Fontis_Australia_Model_Shipping_Carrier_Australiapost_Source_Visibility::OPTIONAL == $this->getSignatureOnDelivery() &&
|
67 |
+
$this->getCountryId() == 'AU';
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Returns the visibility of "Signature of Delivery" shipping methods.
|
72 |
+
*
|
73 |
+
* @return Fontis_Australia_Model_Shipping_Carrier_Australiapost_Source_Visibility
|
74 |
+
*/
|
75 |
+
public function getSignatureOnDelivery()
|
76 |
+
{
|
77 |
+
return Mage::getStoreConfig('carriers/australiapost/signature_on_delivery');
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Determines whether "Extra Cover" is enabled for the current destination.
|
82 |
+
*
|
83 |
+
* @return bool
|
84 |
+
*/
|
85 |
+
public function isExtraCover()
|
86 |
+
{
|
87 |
+
return Fontis_Australia_Model_Shipping_Carrier_Australiapost_Source_Visibility::OPTIONAL == $this->getExtraCover();
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Returns the visibility of "Extra Cover" shipping methods.
|
92 |
+
*
|
93 |
+
* @return Fontis_Australia_Model_Shipping_Carrier_Australiapost_Source_Visibility
|
94 |
+
*/
|
95 |
+
public function getExtraCover()
|
96 |
+
{
|
97 |
+
return Mage::getStoreConfig('carriers/australiapost/extra_cover');
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Determines whether "Pick Up" is enabled and available for
|
102 |
+
* the current destination. This is an international option.
|
103 |
+
*
|
104 |
+
* @return bool
|
105 |
+
*/
|
106 |
+
public function isPickUp()
|
107 |
+
{
|
108 |
+
return Fontis_Australia_Model_Shipping_Carrier_Australiapost_Source_Visibility::OPTIONAL == $this->getPickUp() &&
|
109 |
+
$this->getCountryId() != 'AU';
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Returns the visibility of "Extra Cover" shipping methods.
|
114 |
+
*
|
115 |
+
* @return Fontis_Australia_Model_Shipping_Carrier_Australiapost_Source_Visibility
|
116 |
+
*/
|
117 |
+
public function getPickUp()
|
118 |
+
{
|
119 |
+
return Mage::getStoreConfig('carriers/australiapost/pick_up');
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Get all the simple items in an order.
|
124 |
+
*
|
125 |
+
* @param Mage_Shipping_Model_Rate_Request $order
|
126 |
+
* @return array
|
127 |
+
*/
|
128 |
+
public function getAllSimpleItems(Mage_Shipping_Model_Rate_Request $order)
|
129 |
+
{
|
130 |
+
$items = array();
|
131 |
+
foreach ($order->getAllItems() as $item) {
|
132 |
+
if ($item->getProductType() == 'simple') {
|
133 |
+
$items[] = $item;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
return $items;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Get the attribute value for a product, e.g. its length attribute. If the
|
141 |
+
* order only has one item and we've set which product attribute we want to
|
142 |
+
* to get the attribute value from, use that product attribute. For all
|
143 |
+
* other cases, because we can't assume the dimensions of the order, just
|
144 |
+
* use the default config setting.
|
145 |
+
*
|
146 |
+
* @param $order
|
147 |
+
* @param $attribute
|
148 |
+
* @return string
|
149 |
+
*/
|
150 |
+
public function getAttribute($order, $attribute)
|
151 |
+
{
|
152 |
+
$items = $this->getAllSimpleItems($order);
|
153 |
+
if (count($items) == 1) {
|
154 |
+
$attributeCode = Mage::getStoreConfig('carriers/australiapost/' . $attribute . '_attribute');
|
155 |
+
if (empty($attributeCode)) {
|
156 |
+
return Mage::getStoreConfig('carriers/australiapost/default_' . $attribute);
|
157 |
+
}
|
158 |
+
$_attribute = $items[0]->getData($attributeCode);
|
159 |
+
if (empty($_attribute)) {
|
160 |
+
return Mage::getStoreConfig('carriers/australiapost/default_' . $attribute);
|
161 |
+
}
|
162 |
+
return $_attribute;
|
163 |
+
} else {
|
164 |
+
return Mage::getStoreConfig('carriers/australiapost/default_' . $attribute);
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
app/code/community/Fontis/Australia/Helper/Bpay.php
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fontis Australia Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
*
|
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 |
-
*/
|
22 |
-
class Fontis_Australia_Helper_Bpay extends Mage_Core_Helper_Abstract
|
23 |
-
{
|
24 |
-
public function bpayInfoBlock($billerCode, $customerReferenceNumber)
|
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;">
|
35 |
-
<b>Biller Code</b>: ' . $billerCode . '<br>
|
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 & Internet Banking — BPAY®</p>
|
43 |
-
<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, credit card or transaction account. More info: www.bpay.com.au</p>
|
44 |
-
</div>';
|
45 |
-
} else {
|
46 |
-
$output .= '<div>
|
47 |
-
<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 & Internet Banking — BPAY®</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/Clickandsend.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
use Auspost\Postage\Enum\ServiceCode;
|
19 |
+
use Auspost\Postage\Enum\ServiceOption;
|
20 |
+
|
21 |
+
class Fontis_Australia_Helper_Clickandsend extends Mage_Core_Helper_Abstract
|
22 |
+
{
|
23 |
+
const XML_PATH_CLICK_AND_SEND_ENABLED = 'fontis_australia/clickandsend/active';
|
24 |
+
const XML_PATH_CLICK_AND_SEND_FILTER_SHIPPING_METHODS = 'fontis_australia/clickandsend/filter';
|
25 |
+
const XML_PATH_CLICK_AND_SEND_EXPORT_ALL = 'fontis_australia/clickandsend/export_all';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @return bool
|
29 |
+
*/
|
30 |
+
public function isClickAndSendEnabled()
|
31 |
+
{
|
32 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_CLICK_AND_SEND_ENABLED);
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @return bool
|
37 |
+
*/
|
38 |
+
public function isFilterShippingMethods()
|
39 |
+
{
|
40 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_CLICK_AND_SEND_FILTER_SHIPPING_METHODS);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @return bool
|
45 |
+
*/
|
46 |
+
public function isExportAll()
|
47 |
+
{
|
48 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_CLICK_AND_SEND_EXPORT_ALL);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns shipping method service options not supported by Click & Send.
|
53 |
+
*
|
54 |
+
* @return array
|
55 |
+
*/
|
56 |
+
public function getDisallowedServiceOptions()
|
57 |
+
{
|
58 |
+
return array(
|
59 |
+
ServiceOption::AUS_SERVICE_OPTION_SIGNATURE_ON_DELIVERY,
|
60 |
+
ServiceOption::INTL_SERVICE_OPTION_EXTRA_COVER,
|
61 |
+
ServiceOption::INTL_SERVICE_OPTION_PICKUP_METRO
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Returns shipping method service codes not supported by Click & Send.
|
67 |
+
*
|
68 |
+
* @return array
|
69 |
+
*/
|
70 |
+
public function getDisallowedServiceCodes()
|
71 |
+
{
|
72 |
+
return array(
|
73 |
+
ServiceCode::AUS_PARCEL_COURIER,
|
74 |
+
ServiceCode::AUS_PARCEL_COURIER_SATCHEL_MEDIUM,
|
75 |
+
ServiceCode::INTL_SERVICE_SEA_MAIL
|
76 |
+
);
|
77 |
+
}
|
78 |
+
}
|
app/code/community/Fontis/Australia/Helper/Data.php
CHANGED
@@ -31,6 +31,8 @@ class Fontis_Australia_Helper_Data extends Mage_Core_Helper_Abstract
|
|
31 |
|
32 |
/**
|
33 |
* Gets the query text for city lookups in the postcode database.
|
|
|
|
|
34 |
*/
|
35 |
public function getQueryText()
|
36 |
{
|
@@ -52,14 +54,20 @@ class Fontis_Australia_Helper_Data extends Mage_Core_Helper_Abstract
|
|
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 |
/**
|
31 |
|
32 |
/**
|
33 |
* Gets the query text for city lookups in the postcode database.
|
34 |
+
*
|
35 |
+
* @return string
|
36 |
*/
|
37 |
public function getQueryText()
|
38 |
{
|
54 |
return $this->_queryText;
|
55 |
}
|
56 |
|
57 |
+
/**
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
public function getQueryCountry()
|
61 |
{
|
62 |
return $this->_getRequest()->getParam('country');
|
63 |
}
|
64 |
|
65 |
+
/**
|
66 |
+
* @return string
|
67 |
+
*/
|
68 |
public function getCitySuggestUrl()
|
69 |
{
|
70 |
+
return $this->_getUrl('australia/ajax/suggest', array('_secure' => true));
|
71 |
}
|
72 |
|
73 |
/**
|
app/code/community/Fontis/Australia/Model/Address/Australiapost.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
use Auspost\Common\Auspost;
|
19 |
+
use Auspost\DeliveryChoice\DeliveryChoiceClient;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Australia Post Delivery Choices address validation backend
|
23 |
+
*/
|
24 |
+
class Fontis_Australia_Model_Address_Australiapost implements Fontis_Australia_Model_Address_Interface
|
25 |
+
{
|
26 |
+
protected $client;
|
27 |
+
|
28 |
+
public function __construct()
|
29 |
+
{
|
30 |
+
/** @var Fontis_Australia_Helper_Address $helper */
|
31 |
+
$helper = Mage::helper('australia/address');
|
32 |
+
$options = array();
|
33 |
+
if ($helper->isDeliveryChoicesDeveloperMode()) {
|
34 |
+
$options['developer_mode'] = true;
|
35 |
+
} else {
|
36 |
+
$options['email_address'] = Mage::getStoreConfig('fontis_australia/address_validation/delivery_choices_account_email');
|
37 |
+
$options['password'] = Mage::getStoreConfig('fontis_australia/address_validation/delivery_choices_account_password');
|
38 |
+
}
|
39 |
+
|
40 |
+
$this->setClient(Auspost::factory($options)->get('deliverychoice'));
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Set the Australia Post Delivery Choices client
|
45 |
+
*
|
46 |
+
* @param DeliveryChoiceClient $client
|
47 |
+
*/
|
48 |
+
public function setClient(DeliveryChoiceClient $client)
|
49 |
+
{
|
50 |
+
$this->client = $client;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Converts the customer provided address data into an Australia
|
55 |
+
* Post-supported format.
|
56 |
+
*
|
57 |
+
* @param array $street Address lines
|
58 |
+
* @param string $state Address state
|
59 |
+
* @param string $suburb Address city / suburb
|
60 |
+
* @param string $postcode Address postcode
|
61 |
+
* @param string $country Address country
|
62 |
+
*
|
63 |
+
* @return array
|
64 |
+
*/
|
65 |
+
public function validateAddress(array $street, $state, $suburb, $postcode, $country)
|
66 |
+
{
|
67 |
+
$address = array(
|
68 |
+
'address_line_1' => $street[0],
|
69 |
+
'state' => $state,
|
70 |
+
'suburb' => $suburb,
|
71 |
+
'postcode' => $postcode,
|
72 |
+
'country' => $country
|
73 |
+
);
|
74 |
+
if (count($street) > 1) {
|
75 |
+
$address['address_line_2'] = $street[1];
|
76 |
+
}
|
77 |
+
|
78 |
+
$result = array();
|
79 |
+
try {
|
80 |
+
$result = $this->client->validateAddress($address);
|
81 |
+
|
82 |
+
$result = $result['ValidateAustralianAddressResponse'];
|
83 |
+
if (is_array($result['Address']['AddressLine'])) {
|
84 |
+
$result['Address']['AddressLine'] = $result['Address']['AddressLine'][0];
|
85 |
+
}
|
86 |
+
unset($result['Address']['DeliveryPointIdentifier']);
|
87 |
+
} catch (Exception $e) {
|
88 |
+
$result['ValidAustralianAddress'] = false;
|
89 |
+
Mage::logException($e);
|
90 |
+
}
|
91 |
+
return $result;
|
92 |
+
}
|
93 |
+
}
|
app/code/community/Fontis/Australia/Model/Address/Config/Backend.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fontis Australia Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
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 |
+
/**
|
20 |
+
* System configuration backend type for address validation
|
21 |
+
*/
|
22 |
+
class Fontis_Australia_Model_Address_Config_Backend
|
23 |
+
{
|
24 |
+
const AUSTRALIA_POST = 'australia/address_australiapost';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Returns an array of the available address validation backends.
|
28 |
+
*
|
29 |
+
* @return array
|
30 |
+
*/
|
31 |
+
public function toOptionArray()
|
32 |
+
{
|
33 |
+
return array(
|
34 |
+
array('value' => self::AUSTRALIA_POST, 'label' => Mage::helper('australia')->__('Australia Post Delivery Choices'))
|
35 |
+
);
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Fontis/Australia/Model/Address/Interface.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
/**
|
20 |
+
* Address validation backend interface
|
21 |
+
*/
|
22 |
+
interface Fontis_Australia_Model_Address_Interface
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Sends the customer's address off to some backend for validation and then
|
26 |
+
* maps the response to the following array structure:
|
27 |
+
*
|
28 |
+
* array(
|
29 |
+
* 'ValidAustralianAddress' => true,
|
30 |
+
* 'Address' => array(
|
31 |
+
* 'AddressLine' => '42 Wallaby Way',
|
32 |
+
* 'Country' => array(
|
33 |
+
* 'CountryCode' => 'AU',
|
34 |
+
* 'CountryName' => 'Australia'
|
35 |
+
* ),
|
36 |
+
* 'PostCode' => '2000',
|
37 |
+
* 'StateOrTerritory' => 'NSW',
|
38 |
+
* 'SuburbOrPlaceOrLocality' => 'Sydney'
|
39 |
+
* )
|
40 |
+
* );
|
41 |
+
*
|
42 |
+
* Tip: If the value for the 'ValidAustraliaAddress' key is false then
|
43 |
+
* the 'Address' key isn't needed.
|
44 |
+
*
|
45 |
+
* Note: Country and SuburbOrPlaceOrLocality are used by Magento.
|
46 |
+
*
|
47 |
+
* @param array $street Address lines
|
48 |
+
* @param string $state Address state
|
49 |
+
* @param string $suburb Address city / suburb
|
50 |
+
* @param string $postcode Address postcode
|
51 |
+
* @param string $country Address country
|
52 |
+
*
|
53 |
+
* @return array
|
54 |
+
*/
|
55 |
+
public function validateAddress(array $street, $state, $suburb, $postcode, $country);
|
56 |
+
}
|
app/code/community/Fontis/Australia/Model/Child.php
DELETED
@@ -1,100 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fontis Australia Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com 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 |
-
|
22 |
-
$input = "";
|
23 |
-
do {
|
24 |
-
$input .= fgets(STDIN);
|
25 |
-
} while (!feof(STDIN));
|
26 |
-
|
27 |
-
$config = json_decode($input);
|
28 |
-
|
29 |
-
errlog("Child got: ".$input);
|
30 |
-
|
31 |
-
// Start-up Magento stack
|
32 |
-
require_once $config->magento_path . '/app/Mage.php';
|
33 |
-
// Copied from the original - apparently it fixes problems on some flavours of hosting...
|
34 |
-
// TODO: Explain why/what?
|
35 |
-
$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = $config->magento_path . "/app/code/community/Fontis/Australia/Model/Child.php";
|
36 |
-
|
37 |
-
$store_id = $config->store_id;
|
38 |
-
Mage::app($store_id);
|
39 |
-
|
40 |
-
|
41 |
-
$products = array();
|
42 |
-
foreach($config->entity_ids as $entity_id) {
|
43 |
-
errlog("Processing $entity_id");
|
44 |
-
// Load product, tax helper and generate final price information
|
45 |
-
$product = Mage::getModel('catalog/product')->load($entity_id);
|
46 |
-
|
47 |
-
//Collect basic attributes
|
48 |
-
$product_data = $product->getData();
|
49 |
-
|
50 |
-
// Add generated attributes
|
51 |
-
$tax = Mage::helper('tax');
|
52 |
-
$final_price = $tax->getPrice($product, $product->getFinalPrice(), true);
|
53 |
-
$product_data['final_price'] = $final_price;
|
54 |
-
$product_data['manufacturer_name'] = $product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($product);
|
55 |
-
$product_data['link'] = str_replace("Child.php/", "", $product->getProductUrl());
|
56 |
-
$product_data['sku'] = $product->getSku();
|
57 |
-
$product_data['image_url'] = (string)Mage::helper('catalog/image')->init($product, 'image');
|
58 |
-
$product_data['instock'] = $product->isSaleable() ? "Y" : "N"; // myshopping
|
59 |
-
$product_data['availability'] = $product->isSaleable() ? "yes" : "no"; // shopbot
|
60 |
-
$product_data['product_id'] = $product->getId();
|
61 |
-
$product_data['product_num'] = $product->getEntityId();
|
62 |
-
$product_data['brand'] = $product_data['manufacturer_name'] == "No" ? "Generic" : $product_data['manufacturer_name']; // myshopping
|
63 |
-
$product_data['currency'] = Mage::getStoreConfig('fontis_feeds/'. $config->config_path .'/currency');
|
64 |
-
|
65 |
-
if (Mage::getStoreConfig('fontis_feeds/'. $config->config_path .'/manufacturer')) {
|
66 |
-
if ($product_data['manufacturer_name'] != "No") {
|
67 |
-
$product_data['manufacturer'] = $product_data['manufacturer_name']; // getprice
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
if ($config->generate_categories) {
|
72 |
-
$category_found = false;
|
73 |
-
foreach($product->getCategoryCollection() as $c) {
|
74 |
-
$children = $c->getData('children_count');
|
75 |
-
if ($children <= 0) {
|
76 |
-
$product_data['category'] = utf8_encode($c->getName());
|
77 |
-
|
78 |
-
$loaded_categories = Mage::getModel('catalog/category')
|
79 |
-
->getCollection()
|
80 |
-
->addIdFilter(array($c->getId()))
|
81 |
-
->addAttributeToSelect(array('name'), 'inner')->load();
|
82 |
-
|
83 |
-
foreach($loaded_categories as $loaded_category) {
|
84 |
-
$product_data['category'] = utf8_encode($loaded_category->getName());
|
85 |
-
}
|
86 |
-
$category_found = true;
|
87 |
-
}
|
88 |
-
}
|
89 |
-
if (!$category_found) {
|
90 |
-
$product_data['category'] = utf8_encode(Mage::getStoreConfig('fontis_feeds/'. $config->config_path .'/defaultcategory'));
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
$products[] = $product_data;
|
95 |
-
}
|
96 |
-
fwrite (STDOUT, json_encode($products));
|
97 |
-
|
98 |
-
function errlog($mesg) {
|
99 |
-
fwrite (STDERR, "Child: ".$mesg."\n");
|
100 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Fontis/Australia/Model/Config/Condition.php
CHANGED
@@ -18,6 +18,9 @@
|
|
18 |
|
19 |
class Fontis_Australia_Model_Config_Condition
|
20 |
{
|
|
|
|
|
|
|
21 |
public function toOptionArray()
|
22 |
{
|
23 |
return array(
|
18 |
|
19 |
class Fontis_Australia_Model_Config_Condition
|
20 |
{
|
21 |
+
/**
|
22 |
+
* @return array
|
23 |
+
*/
|
24 |
public function toOptionArray()
|
25 |
{
|
26 |
return array(
|
app/code/community/Fontis/Australia/Model/Config/CustomerGroupAccess.php
CHANGED
@@ -24,12 +24,16 @@
|
|
24 |
*/
|
25 |
class Fontis_Australia_Model_Config_CustomerGroupAccess
|
26 |
{
|
|
|
|
|
|
|
27 |
public function toOptionArray()
|
28 |
{
|
|
|
29 |
return array(
|
30 |
-
array('value' => 0, 'label' =>
|
31 |
-
array('value' => 1, 'label' =>
|
32 |
-
array('value' => 2, 'label' =>
|
33 |
);
|
34 |
}
|
35 |
}
|
24 |
*/
|
25 |
class Fontis_Australia_Model_Config_CustomerGroupAccess
|
26 |
{
|
27 |
+
/**
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
public function toOptionArray()
|
31 |
{
|
32 |
+
$helper = Mage::helper('adminhtml');
|
33 |
return array(
|
34 |
+
array('value' => 0, 'label' => $helper->__('No restrictions')),
|
35 |
+
array('value' => 1, 'label' => $helper->__('Only allow group ...')),
|
36 |
+
array('value' => 2, 'label' => $helper->__('Allow all groups except ...')),
|
37 |
);
|
38 |
}
|
39 |
}
|
app/code/community/Fontis/Australia/Model/Config/CustomerGroups.php
CHANGED
@@ -24,6 +24,9 @@
|
|
24 |
*/
|
25 |
class Fontis_Australia_Model_Config_CustomerGroups
|
26 |
{
|
|
|
|
|
|
|
27 |
public function toOptionArray()
|
28 |
{
|
29 |
$storeId = Mage::app()->getStore()->getId();
|
@@ -34,7 +37,7 @@ class Fontis_Australia_Model_Config_CustomerGroups
|
|
34 |
foreach ($collection as $group) {
|
35 |
$options[] = array(
|
36 |
'value' => $group->getCustomerGroupId(),
|
37 |
-
'label' => $group->getCustomerGroupCode()
|
38 |
);
|
39 |
}
|
40 |
|
24 |
*/
|
25 |
class Fontis_Australia_Model_Config_CustomerGroups
|
26 |
{
|
27 |
+
/**
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
public function toOptionArray()
|
31 |
{
|
32 |
$storeId = Mage::app()->getStore()->getId();
|
37 |
foreach ($collection as $group) {
|
38 |
$options[] = array(
|
39 |
'value' => $group->getCustomerGroupId(),
|
40 |
+
'label' => $group->getCustomerGroupCode(),
|
41 |
);
|
42 |
}
|
43 |
|
app/code/community/Fontis/Australia/Model/Config/EmailNotificationLevel.php
CHANGED
@@ -18,12 +18,16 @@
|
|
18 |
|
19 |
class Fontis_Australia_Model_Config_EmailNotificationLevel
|
20 |
{
|
|
|
|
|
|
|
21 |
public function toOptionArray()
|
22 |
{
|
|
|
23 |
return array(
|
24 |
-
array('value' => 'NONE', 'label' =>
|
25 |
-
array('value' => 'DESPATCH', 'label' =>
|
26 |
-
array('value' => 'TRACKADV', 'label' =>
|
27 |
);
|
28 |
}
|
29 |
}
|
18 |
|
19 |
class Fontis_Australia_Model_Config_EmailNotificationLevel
|
20 |
{
|
21 |
+
/**
|
22 |
+
* @return array
|
23 |
+
*/
|
24 |
public function toOptionArray()
|
25 |
{
|
26 |
+
$helper = Mage::helper('australia');
|
27 |
return array(
|
28 |
+
array('value' => 'NONE', 'label' => $helper->__('None')),
|
29 |
+
array('value' => 'DESPATCH', 'label' => $helper->__('Despatch')),
|
30 |
+
array('value' => 'TRACKADV', 'label' => $helper->__('Track Advice')),
|
31 |
);
|
32 |
}
|
33 |
}
|
app/code/community/Fontis/Australia/Model/Config/ProductAttributes.php
CHANGED
@@ -24,6 +24,9 @@
|
|
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');
|
24 |
*/
|
25 |
class Fontis_Australia_Model_Config_ProductAttributes
|
26 |
{
|
27 |
+
/**
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
public function toOptionArray() {
|
31 |
$eav_config = Mage::getModel('eav/config');
|
32 |
$attributes = $eav_config->getEntityAttributeCodes('catalog_product');
|
app/code/community/Fontis/Australia/Model/FeedCronBase.php
DELETED
@@ -1,281 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fontis Australia Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com 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 |
-
|
22 |
-
abstract class Fontis_Australia_Model_FeedCronBase {
|
23 |
-
protected $BATCH_SIZE = 100;
|
24 |
-
protected $accumulator;
|
25 |
-
protected $product_category_accumulator;
|
26 |
-
protected $store;
|
27 |
-
protected $required_fields = array();
|
28 |
-
protected $generate_product_category = false;
|
29 |
-
|
30 |
-
protected function getPath() {
|
31 |
-
$path = "";
|
32 |
-
$output_path = Mage::getStoreConfig('fontis_feeds/'.$this->config_path.'/output');
|
33 |
-
|
34 |
-
if (substr($output_path, 0, 1) == "/") {
|
35 |
-
$path = $output_path . '/';
|
36 |
-
} else {
|
37 |
-
$path = $this->info("base_dir") . '/' . $output_path . '/';
|
38 |
-
}
|
39 |
-
|
40 |
-
return str_replace('//', '/', $path);
|
41 |
-
}
|
42 |
-
|
43 |
-
public function generateFeed() {
|
44 |
-
$this->log('Entering update function');
|
45 |
-
if (!Mage::getStoreConfig('fontis_feeds/'.$this->config_path.'/active')) {
|
46 |
-
$this->log('Module disabled');
|
47 |
-
} else {
|
48 |
-
$this->setupAppData();
|
49 |
-
|
50 |
-
$stores = Mage::app()->getStores();
|
51 |
-
$this->log("Found " . count($stores) . " stores - starting to process.");
|
52 |
-
foreach($stores as $this->store) {
|
53 |
-
$this->log('Processing store: ' . $this->store->getName());
|
54 |
-
if ($this->generate_product_category) {
|
55 |
-
// Create the entire products xml file
|
56 |
-
$this->batchProcessStore();
|
57 |
-
// Create for each leaf category, their produ |