Version Notes
Notes
Download this release
Release Info
Developer | Patryk Grudniewski |
Extension | iparcel_connect |
Version | 2.4.4 |
Comparing to | |
See all releases |
Code changes from version 2.4.3.2 to 2.4.4
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Checkitems/Button.php +6 -4
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Mapping/Button.php +6 -7
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Iparcel/Dashboard.php +6 -7
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Logs.php +26 -25
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Logs/Grid.php +59 -55
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php +15 -14
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Invoice/Totals.php +15 -14
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Form.php +15 -14
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Tracking.php +16 -15
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Totals.php +16 -15
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Salesrule/Rule/Sync.php +6 -7
- app/code/community/Iparcel/Shipping/Block/Adminhtml/System/Config/Form/Field/Method.php +16 -15
- app/code/community/Iparcel/Shipping/Block/Catalog/Product.php +13 -12
- app/code/community/Iparcel/Shipping/Block/Catalog/Product/List.php +60 -59
- app/code/community/Iparcel/Shipping/Block/Catalogsearch/Advanced/Result.php +29 -26
- app/code/community/Iparcel/Shipping/Block/Catalogsearch/Result.php +29 -26
- app/code/community/Iparcel/Shipping/Block/Cpf.php +22 -21
- app/code/community/Iparcel/Shipping/Block/Html/Head/Iparcel.php +13 -12
- app/code/community/Iparcel/Shipping/Block/Html/Head/Jquery.php +13 -12
- app/code/community/Iparcel/Shipping/Block/Html/Head/Post.php +18 -17
- app/code/community/Iparcel/Shipping/Block/Payment/Info.php +30 -29
- app/code/community/Iparcel/Shipping/Block/Sales/Order/Creditmemo/Totals.php +18 -17
- app/code/community/Iparcel/Shipping/Block/Sales/Order/Invoice/Totals.php +15 -14
- app/code/community/Iparcel/Shipping/Block/Sales/Order/Totals.php +18 -17
- app/code/community/Iparcel/Shipping/Block/Tax/Checkout/Tax.php +20 -19
- app/code/community/Iparcel/Shipping/Helper/Api.php +792 -559
- app/code/community/Iparcel/Shipping/Helper/Api/External.php +72 -70
- app/code/community/Iparcel/Shipping/Helper/Data.php +32 -28
- app/code/community/Iparcel/Shipping/Helper/International.php +53 -47
- app/code/community/Iparcel/Shipping/Helper/Sales/Data.php +101 -101
- app/code/community/Iparcel/Shipping/Helper/String.php +15 -14
- app/code/community/Iparcel/Shipping/Helper/Tax.php +42 -41
- app/code/community/Iparcel/Shipping/Model/Api/External/Sales/Order.php +467 -427
- app/code/community/Iparcel/Shipping/Model/Api/Log.php +156 -147
- app/code/community/Iparcel/Shipping/Model/Carrier/Iparcel.php +159 -150
- app/code/community/Iparcel/Shipping/Model/Catalog/Mapping.php +13 -12
- app/code/community/Iparcel/Shipping/Model/Catalog/Product/Observer.php +58 -54
- app/code/community/Iparcel/Shipping/Model/Config/Catalog/Mapping.php +58 -57
- app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Monthday.php +17 -16
- app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Weekday.php +17 -16
- app/code/community/Iparcel/Shipping/Model/Config/Data/Time/Hour.php +17 -16
- app/code/community/Iparcel/Shipping/Model/Config/Data/Time/Minute.php +17 -16
- app/code/community/Iparcel/Shipping/Model/Config/Guid.php +17 -16
- app/code/community/Iparcel/Shipping/Model/Config/Script/Js.php +76 -72
- app/code/community/Iparcel/Shipping/Model/Cpf.php +34 -31
- app/code/community/Iparcel/Shipping/Model/Cpf/Order.php +25 -23
- app/code/community/Iparcel/Shipping/Model/Cpf/Quote.php +26 -24
- app/code/community/Iparcel/Shipping/Model/Parcel.php +27 -25
- app/code/community/Iparcel/Shipping/Model/Payment/Iparcel.php +10 -10
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf.php +12 -11
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Collection.php +12 -11
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order.php +12 -11
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order/Collection.php +12 -11
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote.php +12 -11
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote/Collection.php +12 -11
- app/code/community/Iparcel/Shipping/Model/Resource/Parcel.php +12 -11
- app/code/community/Iparcel/Shipping/Model/Resource/Parcel/Collection.php +12 -11
- app/code/community/Iparcel/Shipping/Model/Resource/Setup.php +6 -6
- app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals.php +12 -11
- app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals/Collection.php +12 -11
- app/code/community/Iparcel/Shipping/Model/Sales/Order.php +18 -17
- app/code/community/Iparcel/Shipping/Model/Sales/Order/Observer.php +238 -220
- app/code/community/Iparcel/Shipping/Model/Sales/Order/Shipment/Observer.php +71 -67
- app/code/community/Iparcel/Shipping/Model/Sales/Quote/Observer.php +55 -52
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Mapping/Configurable/Price.php +19 -18
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Mapping/Mode.php +21 -20
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Product/Attribute.php +25 -24
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Product/Attribute/Boolean.php +27 -27
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Date/Weekday.php +25 -24
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Sales/Order/Status.php +19 -18
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Tax/Mode.php +21 -20
- app/code/community/Iparcel/Shipping/Model/Tax/Calculation.php +54 -54
- app/code/community/Iparcel/Shipping/Model/Tax/Totals.php +26 -24
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Abstract.php +110 -104
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Creditmemo.php +22 -21
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Invoice.php +22 -21
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Quote.php +57 -53
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Creditmemo.php +22 -21
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Invoice.php +22 -21
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Quote.php +58 -54
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Creditmemo.php +22 -21
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Invoice.php +22 -21
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Quote.php +60 -56
- app/code/community/Iparcel/Shipping/controllers/Adminhtml/LogController.php +35 -32
- app/code/community/Iparcel/Shipping/controllers/Adminhtml/Sync/AjaxController.php +163 -155
- app/code/community/Iparcel/Shipping/controllers/Adminhtml/SyncController.php +12 -10
- app/code/community/Iparcel/Shipping/controllers/AjaxController.php +44 -43
- app/code/community/Iparcel/Shipping/controllers/DevController.php +82 -78
- app/code/community/Iparcel/Shipping/controllers/InternationalController.php +42 -39
- app/code/community/Iparcel/Shipping/controllers/OrderController.php +129 -112
- app/code/community/Iparcel/Shipping/etc/config.xml +430 -430
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-0.2.0.php +20 -21
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-0.3.0.php +20 -21
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-2.3.4.2.php +97 -98
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.2.0-0.3.0.php +30 -31
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.0-0.3.1.php +26 -27
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.1-0.3.2.php +29 -30
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.2-2.0.0.php +42 -43
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.0.0-2.3.4.2.php +2 -3
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.2-2.3.4.4.php +2 -3
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.3-2.3.4.4.php +2 -3
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.4.0.3-2.4.1.0.php +16 -17
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.4.1.17-2.4.3.0.php +38 -39
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.4.1.6-2.4.1.7.php +18 -19
- package.xml +24 -6
- var/connect/iparcel_connect.xml +123 -0
app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Checkitems/Button.php
CHANGED
@@ -2,11 +2,12 @@
|
|
2 |
/**
|
3 |
* Frontend Model Class for catalog_mapping/check_items/check_items config button
|
4 |
*
|
5 |
-
* @category
|
6 |
* @package Iparcel_Shipping
|
7 |
-
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Catalog_Checkitems_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
|
|
10 |
|
11 |
/**
|
12 |
* Get Button Html
|
@@ -14,7 +15,8 @@ class Iparcel_Shipping_Block_Adminhtml_Catalog_Checkitems_Button extends Mage_Ad
|
|
14 |
* @param Varien_Data_Form_Element_Abstract $element
|
15 |
* @return string
|
16 |
*/
|
17 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
|
|
18 |
$url = Mage::helper('adminhtml')->getUrl("shippingip/sync_ajax/checkitems");
|
19 |
|
20 |
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
2 |
/**
|
3 |
* Frontend Model Class for catalog_mapping/check_items/check_items config button
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Catalog_Checkitems_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
|
12 |
/**
|
13 |
* Get Button Html
|
15 |
* @param Varien_Data_Form_Element_Abstract $element
|
16 |
* @return string
|
17 |
*/
|
18 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
19 |
+
{
|
20 |
$url = Mage::helper('adminhtml')->getUrl("shippingip/sync_ajax/checkitems");
|
21 |
|
22 |
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Mapping/Button.php
CHANGED
@@ -2,11 +2,12 @@
|
|
2 |
/**
|
3 |
* Frontend Model Class for catalog_mapping/upload/upload config button
|
4 |
*
|
5 |
-
* @category
|
6 |
* @package Iparcel_Shipping
|
7 |
-
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Catalog_Mapping_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
|
|
10 |
|
11 |
/**
|
12 |
* Get Button Html
|
@@ -14,7 +15,8 @@ class Iparcel_Shipping_Block_Adminhtml_Catalog_Mapping_Button extends Mage_Admin
|
|
14 |
* @param Varien_Data_Form_Element_Abstract $element
|
15 |
* @return string
|
16 |
*/
|
17 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
|
|
18 |
$url = Mage::helper('adminhtml')->getUrl("shippingip/sync_ajax/catalog");
|
19 |
|
20 |
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
@@ -26,7 +28,4 @@ class Iparcel_Shipping_Block_Adminhtml_Catalog_Mapping_Button extends Mage_Admin
|
|
26 |
|
27 |
return $html;
|
28 |
}
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
}
|
2 |
/**
|
3 |
* Frontend Model Class for catalog_mapping/upload/upload config button
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Catalog_Mapping_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
|
12 |
/**
|
13 |
* Get Button Html
|
15 |
* @param Varien_Data_Form_Element_Abstract $element
|
16 |
* @return string
|
17 |
*/
|
18 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
19 |
+
{
|
20 |
$url = Mage::helper('adminhtml')->getUrl("shippingip/sync_ajax/catalog");
|
21 |
|
22 |
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
28 |
|
29 |
return $html;
|
30 |
}
|
|
|
|
|
|
|
31 |
}
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Iparcel/Dashboard.php
CHANGED
@@ -2,11 +2,12 @@
|
|
2 |
/**
|
3 |
* Frontend Model Class for carriers/i-parcel/additionalfields config button
|
4 |
*
|
5 |
-
* @category
|
6 |
* @package Iparcel_Shipping
|
7 |
-
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Iparcel_Dashboard extends Mage_Adminhtml_Block_System_Config_Form_Field
|
|
|
10 |
|
11 |
/**
|
12 |
* Get Button Html
|
@@ -14,7 +15,8 @@ class Iparcel_Shipping_Block_Adminhtml_Iparcel_Dashboard extends Mage_Adminhtml_
|
|
14 |
* @param Varien_Data_Form_Element_Abstract $element
|
15 |
* @return string
|
16 |
*/
|
17 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
|
|
18 |
$url = 'http://globalaccess.i-parcel.com';
|
19 |
|
20 |
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
@@ -26,7 +28,4 @@ class Iparcel_Shipping_Block_Adminhtml_Iparcel_Dashboard extends Mage_Adminhtml_
|
|
26 |
|
27 |
return $html;
|
28 |
}
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
}
|
2 |
/**
|
3 |
* Frontend Model Class for carriers/i-parcel/additionalfields config button
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Iparcel_Dashboard extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
|
12 |
/**
|
13 |
* Get Button Html
|
15 |
* @param Varien_Data_Form_Element_Abstract $element
|
16 |
* @return string
|
17 |
*/
|
18 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
19 |
+
{
|
20 |
$url = 'http://globalaccess.i-parcel.com';
|
21 |
|
22 |
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
28 |
|
29 |
return $html;
|
30 |
}
|
|
|
|
|
|
|
31 |
}
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Logs.php
CHANGED
@@ -6,33 +6,34 @@
|
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Logs extends Mage_Adminhtml_Block_Widget_Grid_Container
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
}
|
38 |
-
?>
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Logs extends Mage_Adminhtml_Block_Widget_Grid_Container
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initialize factory instance
|
13 |
+
*/
|
14 |
+
public function __construct()
|
15 |
+
{
|
16 |
+
$this->_blockGroup = 'shippingip';
|
17 |
+
$this->_controller = 'adminhtml_logs';
|
18 |
+
$this->_headerText = $this->__('Logs');
|
19 |
|
20 |
+
parent::__construct();
|
21 |
+
}
|
22 |
|
23 |
+
/**
|
24 |
+
* Preparing child blocks for each added button ,removing add button, adding clear button
|
25 |
+
*
|
26 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Logs
|
27 |
+
*/
|
28 |
+
protected function _prepareLayout()
|
29 |
+
{
|
30 |
+
$this->_removeButton('add');
|
31 |
|
32 |
+
$this->_addButton('clear', array(
|
33 |
+
'label' => $this->__('Clear'),
|
34 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/clear').'\')'
|
35 |
+
));
|
36 |
|
37 |
+
return parent::_prepareLayout();
|
38 |
+
}
|
39 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Logs/Grid.php
CHANGED
@@ -4,65 +4,69 @@
|
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Logs_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
55 |
|
56 |
-
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
67 |
}
|
68 |
-
?>
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Logs_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Internal constructor, that is called from real constructor
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
protected function _construct()
|
16 |
+
{
|
17 |
+
$this->setFilterVisibility(false);
|
18 |
+
$this->setPagerVisibility(false);
|
19 |
+
}
|
20 |
|
21 |
+
/**
|
22 |
+
* Prepare grid collection object
|
23 |
+
*
|
24 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Logs_Grid
|
25 |
+
*/
|
26 |
+
protected function _prepareCollection()
|
27 |
+
{
|
28 |
+
$collection = Mage::getModel('shippingip/api_log')->getJson();
|
29 |
+
$this->setCollection($collection);
|
30 |
|
31 |
+
return parent::_prepareCollection();
|
32 |
+
}
|
33 |
|
34 |
+
/**
|
35 |
+
* Prepare grid columns
|
36 |
+
*
|
37 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Logs_Grid
|
38 |
+
*/
|
39 |
+
protected function _prepareColumns()
|
40 |
+
{
|
41 |
+
$this->addColumn('timestamp', array(
|
42 |
+
'header' => $this->__('Timestamp'),
|
43 |
+
'index' => 'timestamp',
|
44 |
+
'width' => '200px'
|
45 |
+
));
|
46 |
+
$this->addColumn('controller', array(
|
47 |
+
'header' => $this->__('API Controller'),
|
48 |
+
'index' => 'controller',
|
49 |
+
'width' => '200px'
|
50 |
+
));
|
51 |
+
$this->addColumn('request', array(
|
52 |
+
'header' => $this->__('Request'),
|
53 |
+
'index' => 'request'
|
54 |
+
));
|
55 |
+
$this->addColumn('response', array(
|
56 |
+
'header' => $this->__('Response'),
|
57 |
+
'index' => 'response'
|
58 |
+
));
|
59 |
|
60 |
+
return parent::_prepareColumns();
|
61 |
+
}
|
62 |
|
63 |
+
/**
|
64 |
+
* Get Grid Row's Class
|
65 |
+
*
|
66 |
+
* $return string
|
67 |
+
*/
|
68 |
+
public function getRowClass()
|
69 |
+
{
|
70 |
+
return 'read';
|
71 |
+
}
|
72 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php
CHANGED
@@ -6,18 +6,19 @@
|
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Creditmemo_Totals extends Mage_Adminhtml_Block_Sales_Order_Creditmemo_Totals
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
}
|
23 |
-
?>
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Creditmemo_Totals extends Mage_Adminhtml_Block_Sales_Order_Creditmemo_Totals
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initialize creditmemo totals array
|
13 |
+
*
|
14 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Sales_Order_Creditmemo_Totals
|
15 |
+
*/
|
16 |
+
protected function _initTotals()
|
17 |
+
{
|
18 |
+
parent::_initTotals();
|
19 |
+
foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total) {
|
20 |
+
$this->addTotal($total, array('shipping','tax'));
|
21 |
+
}
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Invoice/Totals.php
CHANGED
@@ -6,18 +6,19 @@
|
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Invoice_Totals extends Mage_Adminhtml_Block_Sales_Order_Invoice_Totals
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
}
|
23 |
-
?>
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Invoice_Totals extends Mage_Adminhtml_Block_Sales_Order_Invoice_Totals
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initialize order totals array
|
13 |
+
*
|
14 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Sales_Order_Invoice_Totals
|
15 |
+
*/
|
16 |
+
protected function _initTotals()
|
17 |
+
{
|
18 |
+
parent::_initTotals();
|
19 |
+
foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total) {
|
20 |
+
$this->addTotal($total, array('shipping','tax'));
|
21 |
+
}
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Form.php
CHANGED
@@ -6,18 +6,19 @@
|
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Form extends Mage_Adminhtml_Block_Sales_Order_Shipment_View_Form
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
}
|
23 |
-
?>
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Form extends Mage_Adminhtml_Block_Sales_Order_Shipment_View_Form
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get create label button html
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function getCreateLabelButton()
|
17 |
+
{
|
18 |
+
if ($this->getShipment()->getOrder()->getShippingCarrier()->getCarrierCode() == "i-parcel") {
|
19 |
+
return null;
|
20 |
+
} else {
|
21 |
+
return parent::getCreateLabelButton();
|
22 |
+
}
|
23 |
+
}
|
24 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Tracking.php
CHANGED
@@ -2,22 +2,23 @@
|
|
2 |
/**
|
3 |
* Shipment tracking control form
|
4 |
*
|
5 |
-
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Tracking extends Mage_Adminhtml_Block_Sales_Order_Shipment_View_Tracking
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
}
|
23 |
-
?>
|
2 |
/**
|
3 |
* Shipment tracking control form
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Tracking extends Mage_Adminhtml_Block_Sales_Order_Shipment_View_Tracking
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get relevant path to template
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function getTemplate()
|
17 |
+
{
|
18 |
+
if ($this->getShipment()->getOrder()->getShippingMethod(true)->getCarrierCode() == 'i-parcel') {
|
19 |
+
return 'iparcel/sales/order/shipment/view/tracking.phtml';
|
20 |
+
} else {
|
21 |
+
return parent::getTemplate();
|
22 |
+
}
|
23 |
+
}
|
24 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Totals.php
CHANGED
@@ -6,19 +6,20 @@
|
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Totals extends Mage_Adminhtml_Block_Sales_Order_Totals
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
}
|
24 |
-
?>
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Totals extends Mage_Adminhtml_Block_Sales_Order_Totals
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initialize order totals array
|
13 |
+
*
|
14 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Sales_Order_Totals
|
15 |
+
*/
|
16 |
+
protected function _initTotals()
|
17 |
+
{
|
18 |
+
parent::_initTotals();
|
19 |
+
$totalCollection = Mage::helper('shippingip/tax')->getTotal($this->getOrder());
|
20 |
+
foreach ($totalCollection as $total) {
|
21 |
+
$this->addTotal($total, array('shipping','tax'));
|
22 |
+
}
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Salesrule/Rule/Sync.php
CHANGED
@@ -2,11 +2,12 @@
|
|
2 |
/**
|
3 |
* Frontend Model Class for salesrules/upload/sync config button
|
4 |
*
|
5 |
-
* @category
|
6 |
* @package Iparcel_Shipping
|
7 |
-
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Adminhtml_Salesrule_Rule_Sync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
|
|
10 |
|
11 |
/**
|
12 |
* Get Button Html
|
@@ -14,7 +15,8 @@ class Iparcel_Shipping_Block_Adminhtml_Salesrule_Rule_Sync extends Mage_Adminhtm
|
|
14 |
* @param Varien_Data_Form_Element_Abstract $element
|
15 |
* @return string
|
16 |
*/
|
17 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
|
|
18 |
$url = Mage::helper('adminhtml')->getUrl("shippingip/sync/salesrule");
|
19 |
|
20 |
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
@@ -26,7 +28,4 @@ class Iparcel_Shipping_Block_Adminhtml_Salesrule_Rule_Sync extends Mage_Adminhtm
|
|
26 |
|
27 |
return $html;
|
28 |
}
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
}
|
2 |
/**
|
3 |
* Frontend Model Class for salesrules/upload/sync config button
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Salesrule_Rule_Sync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
|
12 |
/**
|
13 |
* Get Button Html
|
15 |
* @param Varien_Data_Form_Element_Abstract $element
|
16 |
* @return string
|
17 |
*/
|
18 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
19 |
+
{
|
20 |
$url = Mage::helper('adminhtml')->getUrl("shippingip/sync/salesrule");
|
21 |
|
22 |
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
28 |
|
29 |
return $html;
|
30 |
}
|
|
|
|
|
|
|
31 |
}
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/System/Config/Form/Field/Method.php
CHANGED
@@ -1,19 +1,20 @@
|
|
1 |
<?php
|
2 |
-
class Iparcel_Shipping_Block_Adminhtml_System_Config_Form_Field_Method extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
}
|
19 |
-
?>
|
1 |
<?php
|
2 |
+
class Iparcel_Shipping_Block_Adminhtml_System_Config_Form_Field_Method extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->addColumn('service_id', array(
|
7 |
+
'label' => $this->__('Service Level ID'),
|
8 |
+
'style' => 'width:85px'
|
9 |
+
));
|
10 |
+
$this->addColumn('title', array(
|
11 |
+
'label' => $this->__('Method Title'),
|
12 |
+
'style' => 'width:120px'
|
13 |
+
));
|
14 |
|
15 |
+
$this->_addAfter = false;
|
16 |
+
$this->_addButtonLabel = $this->__('Add Description');
|
17 |
|
18 |
+
parent::__construct();
|
19 |
+
}
|
20 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Catalog/Product.php
CHANGED
@@ -4,17 +4,18 @@
|
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Catalog_Product extends Mage_Catalog_Block_Product_View
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
19 |
}
|
20 |
-
?>
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Catalog_Product extends Mage_Catalog_Block_Product_View
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Retrieve qty for product
|
13 |
+
*
|
14 |
+
* @param Mage_Catalog_Model_Product $product
|
15 |
+
* $return float
|
16 |
+
*/
|
17 |
+
public function getStock()
|
18 |
+
{
|
19 |
+
return Mage::getModel('cataloginventory/stock_item')->loadByProduct($this->getProduct())->getQty();
|
20 |
+
}
|
21 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Catalog/Product/List.php
CHANGED
@@ -4,71 +4,72 @@
|
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
-
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
|
61 |
-
|
62 |
-
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
73 |
}
|
74 |
-
?>
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Retrieve loaded category collection
|
13 |
+
*
|
14 |
+
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
15 |
+
*/
|
16 |
+
protected function _getProductCollection()
|
17 |
+
{
|
18 |
+
if (is_null($this->_productCollection)) {
|
19 |
+
$layer = $this->getLayer();
|
20 |
+
/* @var $layer Mage_Catalog_Model_Layer */
|
21 |
+
if ($this->getShowRootCategory()) {
|
22 |
+
$this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
|
23 |
+
}
|
24 |
|
25 |
+
// if this is a product view page
|
26 |
+
if (Mage::registry('product')) {
|
27 |
+
// get collection of categories this product is associated with
|
28 |
+
$categories = Mage::registry('product')->getCategoryCollection()
|
29 |
+
->setPage(1, 1)
|
30 |
+
->load();
|
31 |
+
// if the product is associated with any category
|
32 |
+
if ($categories->count()) {
|
33 |
+
// show products from this category
|
34 |
+
$this->setCategoryId(current($categories->getIterator()));
|
35 |
+
}
|
36 |
+
}
|
37 |
|
38 |
+
$origCategory = null;
|
39 |
+
if ($this->getCategoryId()) {
|
40 |
+
$category = Mage::getModel('catalog/category')->load($this->getCategoryId());
|
41 |
+
if ($category->getId()) {
|
42 |
+
$origCategory = $layer->getCurrentCategory();
|
43 |
+
$layer->setCurrentCategory($category);
|
44 |
+
}
|
45 |
+
}
|
46 |
+
$this->_productCollection = $layer->getProductCollection();
|
47 |
|
48 |
+
$helper = Mage::helper('shippingip/international');
|
49 |
+
// if international customer enabled and it is international customer
|
50 |
+
if ($helper->checkEnabled() && $helper->getInternational()) {
|
51 |
+
// add international visibility attribute to filter
|
52 |
+
$this->_productCollection->addAttributeToFilter($helper->getVisibilityAttributeName(), true);
|
53 |
+
}
|
54 |
|
55 |
+
$this->prepareSortableFieldsByCategory($layer->getCurrentCategory());
|
56 |
|
57 |
+
if ($origCategory) {
|
58 |
+
$layer->setCurrentCategory($origCategory);
|
59 |
+
}
|
60 |
+
}
|
61 |
|
62 |
+
return $this->_productCollection;
|
63 |
+
}
|
64 |
|
65 |
+
/**
|
66 |
+
* Retrieve qty for product
|
67 |
+
*
|
68 |
+
* @param Mage_Catalog_Model_Product $product
|
69 |
+
* $return float
|
70 |
+
*/
|
71 |
+
public function getStock($product)
|
72 |
+
{
|
73 |
+
return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
|
74 |
+
}
|
75 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Catalogsearch/Advanced/Result.php
CHANGED
@@ -1,33 +1,36 @@
|
|
1 |
<?php
|
2 |
-
class Iparcel_Shipping_Block_Catalogsearch_Advanced_Result extends Mage_CatalogSearch_Block_Advanced_Result
|
3 |
-
|
|
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
15 |
}
|
16 |
-
return $this->_productCollection;
|
17 |
-
}
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
32 |
}
|
33 |
-
?>
|
1 |
<?php
|
2 |
+
class Iparcel_Shipping_Block_Catalogsearch_Advanced_Result extends Mage_CatalogSearch_Block_Advanced_Result
|
3 |
+
{
|
4 |
+
protected $_productCollection;
|
5 |
|
6 |
+
protected function _getProductCollection()
|
7 |
+
{
|
8 |
+
if (is_null($this->_productCollection)) {
|
9 |
+
$this->_productCollection = $this->getSearchModel()->getProductCollection();
|
10 |
|
11 |
+
$helper = Mage::helper('shippingip/international');
|
12 |
+
// if international customer enabled and it is international customer
|
13 |
+
if ($helper->checkEnabled() && $helper->getInternational()) {
|
14 |
+
// add international visibility attribute to filter
|
15 |
+
$this->_productCollection->addAttributeToFilter($helper->getVisibilityAttributeName(), true);
|
16 |
+
}
|
17 |
+
}
|
18 |
+
return $this->_productCollection;
|
19 |
}
|
|
|
|
|
20 |
|
21 |
+
public function getLoadedProductCollection()
|
22 |
+
{
|
23 |
+
return $this->_getProductCollection();
|
24 |
+
}
|
25 |
|
26 |
+
/**
|
27 |
+
* Retrieve qty for product
|
28 |
+
*
|
29 |
+
* @param Mage_Catalog_Model_Product $product
|
30 |
+
* $return float
|
31 |
+
*/
|
32 |
+
public function getStock($product)
|
33 |
+
{
|
34 |
+
return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
|
35 |
+
}
|
36 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Catalogsearch/Result.php
CHANGED
@@ -1,32 +1,35 @@
|
|
1 |
<?php
|
2 |
-
class Iparcel_Shipping_Block_Catalogsearch_Result extends Mage_CatalogSearch_Block_Result
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
31 |
}
|
32 |
-
?>
|
1 |
<?php
|
2 |
+
class Iparcel_Shipping_Block_Catalogsearch_Result extends Mage_CatalogSearch_Block_Result
|
3 |
+
{
|
4 |
+
protected function _getProductCollection()
|
5 |
+
{
|
6 |
+
if (is_null($this->_productCollection)) {
|
7 |
+
$this->_productCollection = $this->getListBlock()->getLoadedProductCollection();
|
8 |
|
9 |
+
$helper = Mage::helper('shippingip/international');
|
10 |
+
// if international customer enabled and it is international customer
|
11 |
+
if ($helper->checkEnabled() && $helper->getInternational()) {
|
12 |
+
// add international visibility attribute to filter
|
13 |
+
$this->_productCollection->addAttributeToFilter($helper->getVisibilityAttributeName(), true);
|
14 |
+
}
|
15 |
+
}
|
16 |
|
17 |
+
return $this->_productCollection;
|
18 |
+
}
|
19 |
|
20 |
+
public function getLoadedProductCollection()
|
21 |
+
{
|
22 |
+
return $this->_getProductCollection();
|
23 |
+
}
|
24 |
|
25 |
+
/**
|
26 |
+
* Retrieve qty for product
|
27 |
+
*
|
28 |
+
* @param Mage_Catalog_Model_Product $product
|
29 |
+
* $return float
|
30 |
+
*/
|
31 |
+
public function getStock($product)
|
32 |
+
{
|
33 |
+
return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
|
34 |
+
}
|
35 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Cpf.php
CHANGED
@@ -2,26 +2,27 @@
|
|
2 |
/**
|
3 |
* i-parcel cpf block
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Cpf extends Mage_Core_Block_Template
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
}
|
27 |
-
?>
|
2 |
/**
|
3 |
* i-parcel cpf block
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Cpf extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Geting formated array with cpfs list
|
13 |
+
*
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function getCpf()
|
17 |
+
{
|
18 |
+
$cpfCollection = Mage::getModel('shippingip/cpf')->getCollection();
|
19 |
+
$response = array();
|
20 |
+
foreach ($cpfCollection as $cpf) {
|
21 |
+
$response[$cpf->getCountryCode()] = array(
|
22 |
+
'name' => $cpf->getName(),
|
23 |
+
'required' => $cpf->getRequired()
|
24 |
+
);
|
25 |
+
}
|
26 |
+
return $response;
|
27 |
+
}
|
28 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Html/Head/Iparcel.php
CHANGED
@@ -1,19 +1,20 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* i-parcel frontend scripts block
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Html_Head_Iparcel extends Mage_Core_Block_Template
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
}
|
19 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* i-parcel frontend scripts block
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Html_Head_Iparcel extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Checking if frontend scripts are enabled
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function getFlag()
|
17 |
+
{
|
18 |
+
return Mage::getStoreConfigFlag('iparcel/scripts/scripts');
|
19 |
+
}
|
20 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Html/Head/Jquery.php
CHANGED
@@ -1,19 +1,20 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* i-parcel jQuery block
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Html_Head_Jquery extends Mage_Core_Block_Template
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
}
|
19 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* i-parcel jQuery block
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Html_Head_Jquery extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Checking if i-parcel's jQuery is enabled
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function getFlag()
|
17 |
+
{
|
18 |
+
return Mage::getStoreConfigFlag('iparcel/scripts/jquery');
|
19 |
+
}
|
20 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Html/Head/Post.php
CHANGED
@@ -1,24 +1,25 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* i-parcel custom post script block
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Html_Head_Post extends Mage_Core_Block_Template
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
}
|
24 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* i-parcel custom post script block
|
4 |
*
|
5 |
* @category Iparcel
|
6 |
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Html_Head_Post extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Checking if there's store config for custom post script, if yes returning script directory, if not returning default directory
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function getScript()
|
17 |
+
{
|
18 |
+
$file = Mage::getStoreConfig('iparcel/scripts/post');
|
19 |
+
if ($file) {
|
20 |
+
return Mage::getModel('shippingip/config_script_js')->getUploadDir('post').$file;
|
21 |
+
} else {
|
22 |
+
return 'iparcel/post.js';
|
23 |
+
}
|
24 |
+
}
|
25 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Payment/Info.php
CHANGED
@@ -1,34 +1,35 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* i-parcel payment method info block
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Payment_Info extends Mage_Payment_Block_Info
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
33 |
}
|
34 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* i-parcel payment method info block
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Payment_Info extends Mage_Payment_Block_Info
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Prepare information specific to current payment method
|
13 |
+
*
|
14 |
+
* @param Varien_Object|array $transport
|
15 |
+
* @return Varien_Object
|
16 |
+
*/
|
17 |
+
protected function _prepareSpecificInformation($transport = null)
|
18 |
+
{
|
19 |
+
if (null === $this->_paymentSpecificInformation) {
|
20 |
+
if (null === $transport) {
|
21 |
+
$transport = new Varien_Object();
|
22 |
+
} elseif (is_array($transport)) {
|
23 |
+
$transport = new Varien_Object($transport);
|
24 |
+
}
|
25 |
+
Mage::dispatchEvent('payment_info_block_prepare_specific_information', array(
|
26 |
+
'transport' => $transport,
|
27 |
+
'payment' => $this->getInfo(),
|
28 |
+
'block' => $this,
|
29 |
+
));
|
30 |
+
$transport->addData(array('i-parcel' => "Order was placed using External Sales API"));
|
31 |
+
$this->_paymentSpecificInformation = $transport;
|
32 |
+
}
|
33 |
+
return $this->_paymentSpecificInformation;
|
34 |
+
}
|
35 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Sales/Order/Creditmemo/Totals.php
CHANGED
@@ -2,22 +2,23 @@
|
|
2 |
/**
|
3 |
* Block for i-parcel tax&duty creditmemo totals
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Sales_Order_Creditmemo_Totals extends Mage_Sales_Block_Order_Creditmemo_Totals
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
}
|
23 |
-
?>
|
2 |
/**
|
3 |
* Block for i-parcel tax&duty creditmemo totals
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Sales_Order_Creditmemo_Totals extends Mage_Sales_Block_Order_Creditmemo_Totals
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initialize order totals array
|
13 |
+
*
|
14 |
+
* @return Iparcel_Shipping_Block_Sales_Order_Creditmemo_Totals
|
15 |
+
*/
|
16 |
+
protected function _initTotals()
|
17 |
+
{
|
18 |
+
parent::_initTotals();
|
19 |
+
foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total) {
|
20 |
+
$this->addTotal($total, array('shipping','tax'));
|
21 |
+
}
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Sales/Order/Invoice/Totals.php
CHANGED
@@ -5,18 +5,19 @@
|
|
5 |
* @package Iparcel_Shipping
|
6 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
7 |
*/
|
8 |
-
class Iparcel_Shipping_Block_Sales_Order_Invoice_Totals extends Mage_Sales_Block_Order_Invoice_Totals
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
}
|
22 |
-
?>
|
5 |
* @package Iparcel_Shipping
|
6 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
7 |
*/
|
8 |
+
class Iparcel_Shipping_Block_Sales_Order_Invoice_Totals extends Mage_Sales_Block_Order_Invoice_Totals
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Initialize order totals array
|
12 |
+
*
|
13 |
+
* @return Iparcel_Shipping_Block_Sales_Order_Invoice_Totals
|
14 |
+
*/
|
15 |
+
protected function _initTotals()
|
16 |
+
{
|
17 |
+
parent::_initTotals();
|
18 |
+
foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total) {
|
19 |
+
$this->addTotal($total, array('shipping','tax'));
|
20 |
+
}
|
21 |
+
return $this;
|
22 |
+
}
|
23 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Sales/Order/Totals.php
CHANGED
@@ -2,22 +2,23 @@
|
|
2 |
/**
|
3 |
* i-parcel shipping tax&duty order totals block
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Block_Sales_Order_Totals extends Mage_Sales_Block_Order_Totals
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
}
|
23 |
-
?>
|
2 |
/**
|
3 |
* i-parcel shipping tax&duty order totals block
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Block_Sales_Order_Totals extends Mage_Sales_Block_Order_Totals
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initialize order totals array
|
13 |
+
*
|
14 |
+
* @return Iparce-Shipping_Block_Sales_Order_Totals
|
15 |
+
*/
|
16 |
+
protected function _initTotals()
|
17 |
+
{
|
18 |
+
parent::_initTotals();
|
19 |
+
foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total) {
|
20 |
+
$this->addTotal($total, array('shipping','tax'));
|
21 |
+
}
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
}
|
|
app/code/community/Iparcel/Shipping/Block/Tax/Checkout/Tax.php
CHANGED
@@ -1,23 +1,24 @@
|
|
1 |
<?php
|
2 |
-
class Iparcel_Shipping_Block_Tax_Checkout_Tax extends Mage_Tax_Block_Checkout_Tax
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
}
|
23 |
-
?>
|
1 |
<?php
|
2 |
+
class Iparcel_Shipping_Block_Tax_Checkout_Tax extends Mage_Tax_Block_Checkout_Tax
|
3 |
+
{
|
4 |
+
protected function _toHtml()
|
5 |
+
{
|
6 |
+
/* var $shippingAddress Mage_Sales_Model_Quote_Address */
|
7 |
+
$shippingAddress = $this->getQuote()->getShippingAddress();
|
8 |
+
if ($shippingAddress->getId()) {
|
9 |
+
$shippingMethod = explode('_', $shippingAddress->getShippingMethod());
|
10 |
+
$carrier = $shippingMethod[0];
|
11 |
+
$carrier_flag = ($carrier == 'i-parcel');
|
12 |
+
$domestic_flag = ($shippingAddress->getCountryId() == Mage::getStoreConfig('general/store_information/merchant_country'));
|
13 |
+
} else {
|
14 |
+
$carrier_flag = false;
|
15 |
+
$domestic_flag = false;
|
16 |
+
}
|
17 |
|
18 |
+
$iparcel_tax_intercept = Mage::getStoreConfigFlag('iparcel/tax/mode');
|
19 |
|
20 |
+
if (!$iparcel_tax_intercept || !$carrier_flag || $domestic_flag) {
|
21 |
+
return parent::_toHtml();
|
22 |
+
}
|
23 |
+
}
|
24 |
}
|
|
app/code/community/Iparcel/Shipping/Helper/Api.php
CHANGED
@@ -1,564 +1,797 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
|
|
|
|
|
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Helper_Api
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
}
|
564 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* I-parcel sending API helper
|
4 |
*
|
5 |
+
* This helper facilitates the connection to the API web service documented
|
6 |
+
* here: http://webservices.i-parcel.com/Help
|
7 |
+
*
|
8 |
+
* @category Iparcel
|
9 |
+
* @package Iparcel_Shipping
|
10 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
11 |
*/
|
12 |
+
class Iparcel_Shipping_Helper_Api
|
13 |
+
{
|
14 |
+
/** @var string URL for the SubmitCatalog endpoint */
|
15 |
+
protected $_submitCatalog = 'https://webservices.i-parcel.com/api/SubmitCatalog';
|
16 |
+
|
17 |
+
/** @var string URL for the Quote endpoint */
|
18 |
+
protected $_quote = 'https://webservices.i-parcel.com/api/Quote';
|
19 |
+
|
20 |
+
/** @var string URL for the SubmitParcel endpoint */
|
21 |
+
protected $_submitParcel = 'https://webservices.i-parcel.com/api/SubmitParcel';
|
22 |
+
|
23 |
+
/** @var string URL for the BusinessSettings endpoint */
|
24 |
+
protected $_businessSettings = 'https://webservices.i-parcel.com/api/BusinessSettings';
|
25 |
+
|
26 |
+
/** @var string URL for the CheckItems endpoint */
|
27 |
+
protected $_checkItems = 'https://webservices.i-parcel.com/api/CheckItems';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Send POST requests to the REST API
|
31 |
+
*
|
32 |
+
* @param string $post POST Data to send
|
33 |
+
* @param string $url REST API URL to send POST data to
|
34 |
+
* @param array $header Array of headers to attach to the request
|
35 |
+
* @return string Response from the POST request
|
36 |
+
*/
|
37 |
+
protected function _rest($post, $url, array $header)
|
38 |
+
{
|
39 |
+
$curl = curl_init($url);
|
40 |
+
|
41 |
+
$timeout = 15;
|
42 |
+
if ($timeout) {
|
43 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
|
44 |
+
}
|
45 |
+
|
46 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
47 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
48 |
+
curl_setopt($curl, CURLOPT_POST, true);
|
49 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
|
50 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, "$post");
|
51 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
52 |
+
|
53 |
+
$response = curl_exec($curl);
|
54 |
+
|
55 |
+
curl_close($curl);
|
56 |
+
|
57 |
+
return $response;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Send REST XML requests
|
62 |
+
*
|
63 |
+
* Wrapper for _rest() that sends a SimpleXMLElement object to the API.
|
64 |
+
*
|
65 |
+
* @param SimpleXMLElement $xml XML to send
|
66 |
+
* @param string $url REST API URL to send POST data to
|
67 |
+
* @return string Response from the POST request
|
68 |
+
*/
|
69 |
+
protected function _restXML($xml, $url)
|
70 |
+
{
|
71 |
+
return $this->_rest($xml->asXml, $url, array('Content-Type: text/xml'));
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Send REST JSON requests
|
76 |
+
*
|
77 |
+
* Wrapper for _rest() that sends the passed data as JSON to the API.
|
78 |
+
*
|
79 |
+
* @param string $json Data to be JSON encoded and sent to the API
|
80 |
+
* @param string $url REST API URL to send POST data to
|
81 |
+
* @return string Response from the POST request
|
82 |
+
*/
|
83 |
+
protected function _restJSON($json, $url)
|
84 |
+
{
|
85 |
+
return $this->_rest(
|
86 |
+
json_encode($json),
|
87 |
+
$url,
|
88 |
+
array('Content-Type: text/json')
|
89 |
+
);
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Send SubmitCatalog request
|
94 |
+
*
|
95 |
+
* Takes the passed Product Collection and transforms it into data that can
|
96 |
+
* be passed to the API. It then submits the request as JSON to the
|
97 |
+
* SubmitCatalog API endpoint.
|
98 |
+
*
|
99 |
+
* @param Varien_Data_Collection $productCollection A Magento Product collection
|
100 |
+
* @return int The amount of products uploaded to the API
|
101 |
+
*/
|
102 |
+
public function submitCatalog(Varien_Data_Collection $productCollection)
|
103 |
+
{
|
104 |
+
//init log
|
105 |
+
$log = Mage::getModel('shippingip/api_log');
|
106 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
107 |
+
$log->setController('Submit Catalog');
|
108 |
+
|
109 |
+
$items = $this->prepareProductsForSubmitCatalog($productCollection);
|
110 |
+
|
111 |
+
$log->setRequest(json_encode($items));
|
112 |
+
|
113 |
+
$numberToUpload = count($items['SKUs']);
|
114 |
+
|
115 |
+
if ($numberToUpload > 0) {
|
116 |
+
$response = $this->_restJSON($items, $this->_submitCatalog);
|
117 |
+
|
118 |
+
$log->setResponse($response);
|
119 |
+
$log->save();
|
120 |
+
|
121 |
+
if (!preg_match('/.*Success.*/', $response)) {
|
122 |
+
$numberToUpload = -1;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
return $numberToUpload;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Prepare product collection for SubmitCatalog calls
|
131 |
+
*
|
132 |
+
* This function takes a Magento product collection and extracts the
|
133 |
+
* necessary information to send it to the SubmitCatalog API endpoint.
|
134 |
+
*
|
135 |
+
* @param Varien_Data_Collection $products Products to prepare
|
136 |
+
* @return array Prepared array of products and product information
|
137 |
+
*/
|
138 |
+
public function prepareProductsForSubmitCatalog(Varien_Data_Collection $products)
|
139 |
+
{
|
140 |
+
$hsCode = Mage::getModel('eav/entity_attribute')->load(Mage::getStoreConfig('catalog_mapping/attributes/hscodeus'));
|
141 |
+
/* var $hsCode Mage_Eav_Model_Entity_Attribute */
|
142 |
+
$shipAlone = Mage::getModel('eav/entity_attribute')->load(Mage::getStoreConfig('catalog_mapping/attributes/shipalone'));
|
143 |
+
/* var $shipAlone Mage_Eav_Model_Entity_Attribute */
|
144 |
+
|
145 |
+
$items = array();
|
146 |
+
$items['key'] = Mage::helper('shippingip')->getGuid();
|
147 |
+
|
148 |
+
$skus = $items['SKUs'] = array();
|
149 |
+
|
150 |
+
foreach ($products as $product) {
|
151 |
+
$product = Mage::getModel('catalog/product')->load($product->getId());
|
152 |
+
/* var $product Mage_Catalog_Model_Product */
|
153 |
+
|
154 |
+
$sku = $product->getSku() ?: '';
|
155 |
+
$name = $product->getName() ?: '';
|
156 |
+
if (empty($sku) || empty($name)) {
|
157 |
+
continue;
|
158 |
+
}
|
159 |
+
|
160 |
+
$item = array();
|
161 |
+
|
162 |
+
$item['SKU'] = $sku;
|
163 |
+
$item['ProductName'] = $name;
|
164 |
+
|
165 |
+
for ($i = 1; $i <= 6; $i++) {
|
166 |
+
$_attribute = Mage::getModel('eav/entity_attribute')
|
167 |
+
->load(Mage::getStoreConfig(sprintf('catalog_mapping/attributes/attribute%d', $i)));
|
168 |
+
/* var $_attributeCollection[] Mage_Eav_Model_Entity_Attribute */
|
169 |
+
// if attribute exists
|
170 |
+
$productAttribute = null;
|
171 |
+
if ($_attribute !== null) {
|
172 |
+
// and has attribute_code
|
173 |
+
if ($code = $_attribute->getAttributeCode()) {
|
174 |
+
// then productAttribute value is product's attribute_text (if exists) or product's data (if not)
|
175 |
+
$productAttribute = strip_tags($product->getAttributeText($code) ?: $product->getData($code));
|
176 |
+
}
|
177 |
+
}
|
178 |
+
$item["Attribute$i"] = (string)substr($productAttribute, 0, 255);
|
179 |
+
}
|
180 |
+
|
181 |
+
$price = null;
|
182 |
+
// if it's simple product and config is to get parent's price
|
183 |
+
if ($product->getTypeId() == 'simple' && Mage::getStoreConfig('catalog_mapping/attributes/price') == Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Configurable_Price::CONFIGURABLE) {
|
184 |
+
// get parentIds
|
185 |
+
$parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId()) ?: Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
|
186 |
+
// get price
|
187 |
+
$price = $parentIds ? Mage::getModel('catalog/product')->load($parentIds[0])->getPrice() : $product->getPrice();
|
188 |
+
}
|
189 |
+
// if there's no price
|
190 |
+
if (!$price) {
|
191 |
+
//get current product's price
|
192 |
+
$price = $product->getPrice();
|
193 |
+
}
|
194 |
+
|
195 |
+
$item['CountryOfOrigin'] = (string)$product->getCountryOfManufacture();
|
196 |
+
$item['CurrentPrice'] = (float)$price;
|
197 |
+
$item['Delete'] = $product->getIsDeleted() ? true : false;
|
198 |
+
$item['HSCodeCA'] = '';
|
199 |
+
|
200 |
+
if ($code = $hsCode->getAttributeCode()) {
|
201 |
+
$item['HSCodeUS'] = trim($product->getAttributeText($code)) ?: $product->getData($code);
|
202 |
+
} else {
|
203 |
+
$item['HSCodeUS'] = '';
|
204 |
+
}
|
205 |
+
|
206 |
+
$item['Height'] = (float)$product->getHeight();
|
207 |
+
$item['Length'] = (float)$product->getLength();
|
208 |
+
$item['ProductURL'] = $product->getUrlPath();
|
209 |
+
$item['SKN'] = '';
|
210 |
+
if ($code = $shipAlone->getAttributeCode()) {
|
211 |
+
$item['ShipAlone'] = $product->getAttributeText($code) == 'Yes' ? true : false;
|
212 |
+
}
|
213 |
+
$item['Width'] = (float)$product->getWidth();
|
214 |
+
$item['Weight'] = (float)$product->getWeight();
|
215 |
+
|
216 |
+
// Detect and handle a Simple Product with Custom Options
|
217 |
+
if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $product->getHasOptions()) {
|
218 |
+
// loop through each of the sorted products with custom options
|
219 |
+
// and build out custom option and option type based skus
|
220 |
+
foreach ($this->_findSimpleProductVariants($product) as $customOptionProduct) {
|
221 |
+
$customOptionSku = "";
|
222 |
+
$customOptionPriceMarkup = 0;
|
223 |
+
$customOptionName = "";
|
224 |
+
foreach ($customOptionProduct as $o) {
|
225 |
+
$customOptionSku .= "_" . $o["sku"];
|
226 |
+
$customOptionPriceMarkup += $o["price"];
|
227 |
+
$customOptionName .= " - " . $o["title"];
|
228 |
+
}
|
229 |
+
if ($customOptionSku != '') {
|
230 |
+
$item['SKU'] = $sku . "_" . $customOptionSku;
|
231 |
+
} else {
|
232 |
+
$item['SKU'] = $sku;
|
233 |
+
}
|
234 |
+
$item['CurrentPrice'] = (float)( $price + $customOptionPriceMarkup );
|
235 |
+
//append the product name with the custom option
|
236 |
+
$item['ProductName'] = $name . $customOptionName;
|
237 |
+
$items['SKUs'][] = $item;
|
238 |
+
$numberUploaded++;
|
239 |
+
}
|
240 |
+
} else {
|
241 |
+
$items['SKUs'][] = $item;
|
242 |
+
}
|
243 |
+
|
244 |
+
}
|
245 |
+
|
246 |
+
return $items;
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Send Quote request
|
251 |
+
*
|
252 |
+
* Takes the passed Rate Request and transforms it into data that can
|
253 |
+
* be passed to the API. It then submits the request as JSON to the
|
254 |
+
* Quote API endpoint.
|
255 |
+
*
|
256 |
+
* @param Mage_Shipping_Model_Rate_Request $request Magento Shipping Rate Request
|
257 |
+
* @return stdClass Response from the Quote API
|
258 |
+
*/
|
259 |
+
public function quote(Mage_Shipping_Model_Rate_Request $request)
|
260 |
+
{
|
261 |
+
// log init
|
262 |
+
$log = Mage::getModel('shippingip/api_log');
|
263 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
264 |
+
$log->setController('Quote');
|
265 |
+
|
266 |
+
$quote = Mage::getModel('checkout/cart')->getQuote();
|
267 |
+
/* var $quote Mage_Sales_Model_Quote */
|
268 |
+
$shippingAddress = $quote->getShippingAddress();
|
269 |
+
/* var $shippingAddress Mage_Sales_Model_Quote_Address */
|
270 |
+
$billingAddress = $quote->getBillingAddress();
|
271 |
+
/* var $billingAddress Mage_Sales_Model_Quote_Address */
|
272 |
+
|
273 |
+
$json = array();
|
274 |
+
$addressInfo = array();
|
275 |
+
|
276 |
+
$billingStreet = $billingAddress->getStreet();
|
277 |
+
|
278 |
+
$billing = array();
|
279 |
+
$billing['City'] = $billingAddress->getCity();
|
280 |
+
$billing['CountryCode'] = $billingAddress->getCountryId();
|
281 |
+
$billing['Email'] = $quote->getCustomerEmail();
|
282 |
+
$billing['FirstName'] = $billingAddress->getFirstname();
|
283 |
+
$billing['LastName'] = $billingAddress->getLastname();
|
284 |
+
$billing['Phone'] = $billingAddress->getTelephone();
|
285 |
+
$billing['PostCode'] = $billingAddress->getPostcode();
|
286 |
+
$billing['Region'] = $billingAddress->getRegion();
|
287 |
+
for ($i=0; $i<count($billingStreet); $i++) {
|
288 |
+
$billing['Street'.($i+1)] = $billingStreet[$i];
|
289 |
+
}
|
290 |
+
|
291 |
+
$addressInfo['Billing'] = $billing;
|
292 |
+
|
293 |
+
$shippingStreet = $shippingAddress->getStreet();
|
294 |
+
|
295 |
+
$shipping = array();
|
296 |
+
|
297 |
+
$shipping['City'] = $shippingAddress->getCity();
|
298 |
+
$shipping['CountryCode'] = $shippingAddress->getCountryId();
|
299 |
+
$shipping['Email'] = $quote->getCustomerEmail();
|
300 |
+
$shipping['FirstName'] = $shippingAddress->getFirstname();
|
301 |
+
$shipping['LastName'] = $shippingAddress->getLastname();
|
302 |
+
$shipping['Phone'] = $shippingAddress->getTelephone();
|
303 |
+
$shipping['PostCode'] = $shippingAddress->getPostcode();
|
304 |
+
$shipping['Region'] = $shippingAddress->getRegion();
|
305 |
+
for ($i=0; $i<count($shippingStreet); $i++) {
|
306 |
+
$shipping['Street'.($i+1)] = $billingStreet[$i];
|
307 |
+
}
|
308 |
+
|
309 |
+
$addressInfo['Shipping'] = $shipping;
|
310 |
+
|
311 |
+
$addressInfo['ControlNumber'] = $quote->getCpf();
|
312 |
+
|
313 |
+
$json['AddressInfo'] = $addressInfo;
|
314 |
+
|
315 |
+
$json['CurrencyCode'] = $quote->getQuoteCurrencyCode();
|
316 |
+
$json['DDP'] = true;
|
317 |
+
|
318 |
+
$itemsList = array();
|
319 |
+
|
320 |
+
foreach ($request->getAllItems() as $item) {
|
321 |
+
/* var $item Mage_Sales_Model_Quote_Item */
|
322 |
+
|
323 |
+
$itemProduct = Mage::getModel('catalog/product')->load($item->getProductId());
|
324 |
+
/* var $itemProduct Mage_Catalog_Model_Product */
|
325 |
+
|
326 |
+
//get item price
|
327 |
+
$itemPrice = (float)$item->getFinalPrice() ?: (float)$item->getPrice();
|
328 |
+
// if not price and item has parent (is configurable)
|
329 |
+
if (!$itemPrice && ($parent=$item->getParentItem())) {
|
330 |
+
// get parent price
|
331 |
+
$itemPrice = (float)$parent->getFinalPrice() ?: (float)$parent->getPrice();
|
332 |
+
}
|
333 |
+
// if still not price
|
334 |
+
if (!$itemPrice) {
|
335 |
+
// get product price
|
336 |
+
$itemPrice = (float)$item->getProduct()->getPrice();
|
337 |
+
}
|
338 |
+
|
339 |
+
// if product isn't virtual and is configurable or downloadable
|
340 |
+
if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(), array('configurable','downloadable'))) {
|
341 |
+
// add line item node
|
342 |
+
$lineItem = array();
|
343 |
+
|
344 |
+
$lineItem['Quantity'] = $item->getTotalQty();
|
345 |
+
$lineItem['SKU'] = $item->getSku();
|
346 |
+
$lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
347 |
+
$lineItem['ValueShopperCurrency'] = $itemPrice;
|
348 |
+
$lineItem['ValueUSD'] = $itemPrice;
|
349 |
+
|
350 |
+
$itemsList[] = $lineItem;
|
351 |
+
}
|
352 |
+
}
|
353 |
+
|
354 |
+
$json['ItemDetailsList'] = $itemsList;
|
355 |
+
|
356 |
+
// Get discounts
|
357 |
+
$totals = $quote->getTotals();
|
358 |
+
$discount = 0;
|
359 |
+
if (isset($totals['discount']) && $totals['discount']->getValue()) {
|
360 |
+
$discount = -1 * $totals['discount']->getValue();
|
361 |
+
}
|
362 |
+
|
363 |
+
$json['OtherDiscount'] = $discount;
|
364 |
+
$json['OtherDiscountCurrency'] = $quote->getQuoteCurrencyCode();
|
365 |
+
$json['ParcelID'] = 0;
|
366 |
+
$json['ServiceLevel'] = 115;
|
367 |
+
$json['SessionID'] = '';
|
368 |
+
$json['key'] = Mage::helper('shippingip')->getGuid();
|
369 |
+
|
370 |
+
$log->setRequest(json_encode($json));
|
371 |
+
|
372 |
+
$response = $this->_restJSON($json, $this->_quote);
|
373 |
+
|
374 |
+
$log->setResponse($response);
|
375 |
+
$log->save();
|
376 |
+
|
377 |
+
return json_decode($response);
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Send Submit Parcel request
|
382 |
+
*
|
383 |
+
* Takes the passed Order and transforms it into data that can be passed to
|
384 |
+
* the API. It then submits the request as JSON to the SubmitParcel API
|
385 |
+
* endpoint.
|
386 |
+
*
|
387 |
+
* @param Mage_Sales_Model_Order $order Magento Order to be acknowledged as parcel
|
388 |
+
* @return stdClass Response from the SubmitParcel API
|
389 |
+
*/
|
390 |
+
public function submitParcel(Mage_Sales_Model_Order $order)
|
391 |
+
{
|
392 |
+
// init log
|
393 |
+
$log = Mage::getModel('shippingip/api_log');
|
394 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
395 |
+
$log->setController('Submit Parcel');
|
396 |
+
|
397 |
+
$quote = $order->getQuote();
|
398 |
+
/* var $quote Mage_Sales_Model_Quote */
|
399 |
+
$shippingAddress = $quote->getShippingAddress();
|
400 |
+
/* var $shippingAddress Mage_Sales_Model_Quote_Address */
|
401 |
+
$billingAddress = $quote->getBillingAddress();
|
402 |
+
/* var $billingAddress Mage_Sales_Model_Quote_Address */
|
403 |
+
|
404 |
+
$json = array();
|
405 |
+
|
406 |
+
$addressInfo = array();
|
407 |
+
|
408 |
+
$billingStreet = $billingAddress->getStreet();
|
409 |
+
|
410 |
+
$billing = array();
|
411 |
+
|
412 |
+
$billing['City'] = $billingAddress->getCity();
|
413 |
+
$billing['CountryCode'] = $billingAddress->getCountryId();
|
414 |
+
$billing['Email'] = $quote->getCustomerEmail();
|
415 |
+
$billing['FirstName'] = $billingAddress->getFirstname();
|
416 |
+
$billing['LastName'] = $billingAddress->getLastname();
|
417 |
+
$billing['Phone'] = $billingAddress->getTelephone();
|
418 |
+
$billing['PostCode'] = $billingAddress->getPostcode();
|
419 |
+
$billing['Region'] = $billingAddress->getRegion();
|
420 |
+
$billing['Street1'] = $billingStreet[0];
|
421 |
+
$billing['Street2'] = $billingStreet[1];
|
422 |
+
|
423 |
+
$addressInfo['Billing'] = $billing;
|
424 |
+
|
425 |
+
$shippingStreet = $shippingAddress->getStreet();
|
426 |
+
|
427 |
+
$shipping = array();
|
428 |
+
|
429 |
+
$shipping['City'] = $shippingAddress->getCity();
|
430 |
+
$shipping['CountryCode'] = $shippingAddress->getCountryId();
|
431 |
+
$shipping['Email'] = $quote->getCustomerEmail();
|
432 |
+
$shipping['FirstName'] = $shippingAddress->getFirstname();
|
433 |
+
$shipping['LastName'] = $shippingAddress->getLastname();
|
434 |
+
$shipping['Phone'] = $shippingAddress->getTelephone();
|
435 |
+
$shipping['PostCode'] = $shippingAddress->getPostcode();
|
436 |
+
$shipping['Region'] = $shippingAddress->getRegion();
|
437 |
+
$shipping['Street1'] = $shippingStreet[0];
|
438 |
+
$shipping['Street2'] = $shippingStreet[1];
|
439 |
+
|
440 |
+
$addressInfo['Shipping'] = $shipping;
|
441 |
+
|
442 |
+
$addressInfo['ControlNumber'] = $order->getCpf();
|
443 |
+
|
444 |
+
$json['AddressInfo'] = $addressInfo;
|
445 |
+
|
446 |
+
$json['CurrencyCode'] = $quote->getQuoteCurrencyCode();
|
447 |
+
$json['DDP'] = true;
|
448 |
+
|
449 |
+
$itemsList = array();
|
450 |
+
foreach ($order->getAllItems() as $item) {
|
451 |
+
/* var $item Mage_Sales_Model_Order_Item */
|
452 |
+
$itemProduct = Mage::getModel('catalog/product')->load($item->getProductId());
|
453 |
+
/* var $itemProduct Mage_Catalog_Model_Product */
|
454 |
+
|
455 |
+
//get item price
|
456 |
+
$itemPrice = (float)$item->getFinalPrice() ?: (float)$item->getPrice();
|
457 |
+
// if not price and item has parent (is configurable)
|
458 |
+
if (!$itemPrice && ($parent=$item->getParentItem())) {
|
459 |
+
// get parent price
|
460 |
+
$itemPrice = (float)$parent->getFinalPrice() ?: (float)$parent->getPrice();
|
461 |
+
}
|
462 |
+
// if still not price
|
463 |
+
if (!$itemPrice) {
|
464 |
+
// get product price
|
465 |
+
$itemPrice = (float)$item->getProduct()->getPrice();
|
466 |
+
}
|
467 |
+
|
468 |
+
// if product isn't virtual and is configurable or downloadable
|
469 |
+
if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(), array('configurable','downloadable'))) {
|
470 |
+
// add line item node
|
471 |
+
$lineItem = array();
|
472 |
+
|
473 |
+
$lineItem['Quantity'] = $item->getQtyOrdered();
|
474 |
+
$lineItem['SKU'] = $item->getSku();
|
475 |
+
$lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
476 |
+
$lineItem['ValueShopperCurrency'] = $itemPrice;
|
477 |
+
$lineItem['ValueUSD'] = $itemPrice;
|
478 |
+
|
479 |
+
$itemsList[] = $lineItem;
|
480 |
+
}
|
481 |
+
}
|
482 |
+
|
483 |
+
$json['ItemDetailsList'] = $itemsList;
|
484 |
+
|
485 |
+
// if order_reference is set add it to request
|
486 |
+
if (Mage::getStoreConfig('carriers/i-parcel/order_reference')) {
|
487 |
+
$json['OrderReference'] = $order->getIncrementId();
|
488 |
+
}
|
489 |
+
|
490 |
+
// Get discounts
|
491 |
+
$totals = $quote->getTotals();
|
492 |
+
$discount = 0;
|
493 |
+
if (isset($totals['discount']) && $totals['discount']->getValue()) {
|
494 |
+
$discount = -1 * $totals['discount']->getValue();
|
495 |
+
}
|
496 |
+
|
497 |
+
// Get ServiceLevelID
|
498 |
+
$method = $order->getShippingMethod();
|
499 |
+
/* var $method string */
|
500 |
+
$method = explode('_', $method);
|
501 |
+
/* var $method array */
|
502 |
+
array_shift($method);
|
503 |
+
$serviceLevelId = implode('_', $method);
|
504 |
+
/* var $serviceLevelId string */
|
505 |
+
|
506 |
+
$json['OtherDiscount'] = $discount;
|
507 |
+
$json['OtherDiscountCurrency'] = $quote->getQuoteCurrencyCode();
|
508 |
+
$json['ParcelID'] = Mage::getSingleton('checkout/session')->getParcelId();
|
509 |
+
$json['ServiceLevel'] = $serviceLevelId;
|
510 |
+
$json['SessionID'] = '';
|
511 |
+
$json['key'] = Mage::helper('shippingip')->getGuid();
|
512 |
+
|
513 |
+
$log->setRequest(json_encode($json));
|
514 |
+
|
515 |
+
$response = $this->_restJSON($json, $this->_submitParcel);
|
516 |
+
|
517 |
+
$log->setResponse($response);
|
518 |
+
$log->save();
|
519 |
+
|
520 |
+
return json_decode($response);
|
521 |
+
}
|
522 |
+
|
523 |
+
/**
|
524 |
+
* Send Business Settings request
|
525 |
+
*
|
526 |
+
* @return stdClass Response from the BusinessSettings API
|
527 |
+
*/
|
528 |
+
public function businessSettings()
|
529 |
+
{
|
530 |
+
// init log
|
531 |
+
$log = Mage::getModel('shippingip/api_log');
|
532 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
533 |
+
$log->setController('Business Settings');
|
534 |
+
|
535 |
+
$json = Mage::helper('shippingip')->getGuid();
|
536 |
+
|
537 |
+
$log->setRequest(json_encode($json));
|
538 |
+
|
539 |
+
$response = $this->_restJSON($json, $this->_businessSettings);
|
540 |
+
|
541 |
+
$log->setResponse($response);
|
542 |
+
$log->save();
|
543 |
+
|
544 |
+
return json_decode($response);
|
545 |
+
}
|
546 |
+
|
547 |
+
/**
|
548 |
+
* Send Check Items request
|
549 |
+
*
|
550 |
+
* Takes the passed Product Collection and transforms it into data that can
|
551 |
+
* be passed to the API. It then submits the request as JSON to the
|
552 |
+
* CheckItems API endpoint.
|
553 |
+
*
|
554 |
+
* @param Varien_Data_Collection $collection A Magento Product collection
|
555 |
+
* @return int The amount of items confirmed valid by the API
|
556 |
+
*/
|
557 |
+
public function checkItems(Varien_Data_Collection $collection)
|
558 |
+
{
|
559 |
+
//init log
|
560 |
+
$log = Mage::getModel('shippingip/api_log');
|
561 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
562 |
+
$log->setController('Check Items');
|
563 |
+
|
564 |
+
$json = array();
|
565 |
+
|
566 |
+
$json['SessionID'] = 'SESSION';
|
567 |
+
$json['ItemDetailsList'] = array();
|
568 |
+
|
569 |
+
foreach ($collection as $product) {
|
570 |
+
/* var $product Mage_Catalog_Model_Product */
|
571 |
+
if (!$product->getSku()) {
|
572 |
+
continue;
|
573 |
+
}
|
574 |
+
$item = array();
|
575 |
+
$item['SKU'] = $product->getSku();
|
576 |
+
$item['Quantity'] = 1;
|
577 |
+
$item['itemStyle'] = null;
|
578 |
+
|
579 |
+
$json['ItemDetailsList'][] = $item;
|
580 |
+
}
|
581 |
+
|
582 |
+
$json['AddressInfo'] = array();
|
583 |
+
|
584 |
+
$json['AddressInfo']['Billing'] = array();
|
585 |
+
$json['AddressInfo']['Shipping'] = array();
|
586 |
+
|
587 |
+
$json['AddressInfo']['Shipping']['CountryCode'] = "CA";
|
588 |
+
$json['AddressInfo']['Shipping']['PostCode'] = "A1A1A1";
|
589 |
+
|
590 |
+
$json['CurrencyCode'] = "CAN";
|
591 |
+
$json['DDP'] = true;
|
592 |
+
$json['Insurance'] = false;
|
593 |
+
$json['ServiceLevel'] = 115;
|
594 |
+
$json['key'] = Mage::helper('shippingip')->getGuid();
|
595 |
+
|
596 |
+
$log->setRequest(json_encode($json));
|
597 |
+
|
598 |
+
$response = $this->_restJSON($json, $this->_checkItems);
|
599 |
+
|
600 |
+
$log->setResponse($response);
|
601 |
+
$log->save();
|
602 |
+
|
603 |
+
$response = json_decode($response);
|
604 |
+
if ($response->ItemDetailsList) {
|
605 |
+
return count($response->ItemDetailsList);
|
606 |
+
} else {
|
607 |
+
return 0;
|
608 |
+
}
|
609 |
+
}
|
610 |
+
|
611 |
+
/**
|
612 |
+
* Send Sales Rule request
|
613 |
+
*
|
614 |
+
* Takes the passed SalesRules and transforms it into data that can be
|
615 |
+
* passed to the API. It then submits the request as JSON to the
|
616 |
+
* SalesRule API endpoint.
|
617 |
+
*
|
618 |
+
* @param Mage_SalesRule_Model_Resource_Rule_Collection Collection of SalesRules to submit
|
619 |
+
* @return string Response from the SalesRule request
|
620 |
+
*/
|
621 |
+
public function salesRule(Mage_SalesRule_Model_Resource_Rule_Collection $_collection)
|
622 |
+
{
|
623 |
+
$log = Mage::getModel('shippingip/api_log');
|
624 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
625 |
+
$log->setController('Sales Rule');
|
626 |
+
|
627 |
+
$json = array();
|
628 |
+
$json['key'] = Mage::helper('shippingip')->getGuid();
|
629 |
+
$json['ItemDetailsList'] = array();
|
630 |
+
|
631 |
+
foreach ($_collection as $_rule) {
|
632 |
+
/* var $_rule Mage_SalesRule_Model_Rule */
|
633 |
+
$item = array();
|
634 |
+
$item['Name'] = $_rule->getName();
|
635 |
+
$item['FormDate'] = $_rule->getFromDate();
|
636 |
+
$item['ToDate'] = $_rule->getToDate();
|
637 |
+
$item['IsActive'] = $_rule->getIsActive();
|
638 |
+
$item['StopRulesProcessing'] = $_rule->getStopRulesProcessing();
|
639 |
+
$item['SimpleAction'] = $_rule->getSimpleAction();
|
640 |
+
$item['DiscountAmount'] = $_rule->getDiscountAmount();
|
641 |
+
$item['DiscountQty'] = $_rule->getDiscountQty();
|
642 |
+
$item['DiscountStep'] = $_rule->getDiscountStep();
|
643 |
+
$item['SimpleFreeShipping'] = $_rule->getSimpleFreeShipping();
|
644 |
+
$item['ApplyToShipping'] = $_rule->getApplyToShipping();
|
645 |
+
$item['TimesUsed'] = $_rule->getTimesUsed();
|
646 |
+
$item['CouponType'] = $_rule->getCouponType();
|
647 |
+
|
648 |
+
$item['Conditions'] = unserialize($_rule->getConditionsSerialized());
|
649 |
+
$item['Actions'] = unserialize($_rule->getActionsSerialized());
|
650 |
+
|
651 |
+
$json['ItemDetailsList'][] = $item;
|
652 |
+
}
|
653 |
+
|
654 |
+
$log->setRequest(json_encode($json));
|
655 |
+
|
656 |
+
// FIXME: This API Call is no longer used. Should it be removed?
|
657 |
+
$response = $this->_restJSON($json, null);
|
658 |
+
|
659 |
+
$log->setResponse($response);
|
660 |
+
$log->save();
|
661 |
+
|
662 |
+
return json_decode($response);
|
663 |
+
}
|
664 |
+
|
665 |
+
/**
|
666 |
+
* Set the URLs for API Calls.
|
667 |
+
*
|
668 |
+
* Useful for setting the API endpoint URLs to controlled URLs for testing.
|
669 |
+
*
|
670 |
+
* @param array $urls Array of URLs to set as [var_name] => 'value'
|
671 |
+
* @return boolean True on success
|
672 |
+
*/
|
673 |
+
public function setUrls($urls)
|
674 |
+
{
|
675 |
+
try {
|
676 |
+
foreach ($urls as $name => $url) {
|
677 |
+
$this->{$name} = $url;
|
678 |
+
}
|
679 |
+
} catch (Exception $e) {
|
680 |
+
Mage::log($e->getMessage());
|
681 |
+
return false;
|
682 |
+
}
|
683 |
+
|
684 |
+
return true;
|
685 |
+
}
|
686 |
+
|
687 |
+
/**
|
688 |
+
* Performs the work of handling Simple Products with Custom Options
|
689 |
+
*
|
690 |
+
* @param Mage_Catalog_Model_Product $product Product with Options
|
691 |
+
* @return array Options array with all product variations
|
692 |
+
*/
|
693 |
+
private function _findSimpleProductVariants($product)
|
694 |
+
{
|
695 |
+
// get product options collection object
|
696 |
+
$options = Mage::getModel('catalog/product_option')
|
697 |
+
->getCollection()
|
698 |
+
->addProductToFilter($product->getId())
|
699 |
+
->addPriceToResult(0)
|
700 |
+
->addValuesToResult();
|
701 |
+
|
702 |
+
// array indeces for products and product options
|
703 |
+
$optCount = 0;
|
704 |
+
$optTypeCount = 0;
|
705 |
+
|
706 |
+
// arrays for sorted products, sorting key/value lookups
|
707 |
+
$sorted = array();
|
708 |
+
$productOptions = array();
|
709 |
+
$productSorting = array();
|
710 |
+
|
711 |
+
foreach ($options as $option) {
|
712 |
+
// array for products custom options
|
713 |
+
$customOptions = array();
|
714 |
+
$optSortOrder = $option["sort_order"];
|
715 |
+
$optSortKey = 0;
|
716 |
+
foreach ($option->getValues() as $values) {
|
717 |
+
$customOption = array();
|
718 |
+
// create the sku portion with custom option id and option type id.. 1_2 -> Size_Large
|
719 |
+
$customOption["sku"] = $values["option_id"] . "-" . $values["option_type_id"];
|
720 |
+
$customOption["price"] = $values["price"];
|
721 |
+
$customOption["title"] = $values["title"];
|
722 |
+
$customOption["sort_order"] = $values["sort_order"];
|
723 |
+
// Add `required` bit. Used later to build SKU variations
|
724 |
+
$customOption['required'] = $option->getIsRequire();
|
725 |
+
// add custom option type to collection
|
726 |
+
$customOptions[$optTypeCount] = $customOption;
|
727 |
+
$optTypeCount++;
|
728 |
+
}
|
729 |
+
// maintain index to sort order relationship
|
730 |
+
$productSorting[$optCount] = $optSortOrder;
|
731 |
+
// add custom option type collection to options collections
|
732 |
+
$customOptionProducts[$optCount] = $customOptions;
|
733 |
+
$optCount++;
|
734 |
+
}
|
735 |
+
// sort by array sort_order value while maintaining array index
|
736 |
+
asort($productSorting);
|
737 |
+
$sortCount = 0;
|
738 |
+
|
739 |
+
// iterate sorted indeces and build sorted array of products
|
740 |
+
foreach ($productSorting as $k => $v) {
|
741 |
+
$sorted[$sortCount] = $customOptionProducts[$k];
|
742 |
+
$sortCount++;
|
743 |
+
}
|
744 |
+
|
745 |
+
return $this->_findVariations($sorted);
|
746 |
+
}
|
747 |
+
|
748 |
+
/**
|
749 |
+
* Given an array of options, returns all of the valid option variations
|
750 |
+
*
|
751 |
+
* @param array $options Array of option arrays (sku, price, title, sort_order, required)
|
752 |
+
* @return array Array of arrays, representing the possible option variations
|
753 |
+
*/
|
754 |
+
private function _findVariations($options)
|
755 |
+
{
|
756 |
+
// filter out empty values
|
757 |
+
$options = array_filter($options);
|
758 |
+
$result = array(array());
|
759 |
+
$optionalProductOptions = array();
|
760 |
+
|
761 |
+
// Remove the optional product options
|
762 |
+
foreach ($options as $key => $option) {
|
763 |
+
foreach ($option as $product) {
|
764 |
+
if ($product['required'] == false) {
|
765 |
+
$optionalProductOptions[$key][$product['sku']] = $product;
|
766 |
+
unset($options[$key]);
|
767 |
+
}
|
768 |
+
}
|
769 |
+
}
|
770 |
+
|
771 |
+
// Add all variations of the required options to the $result array
|
772 |
+
foreach ($options as $key => $values) {
|
773 |
+
$append = array();
|
774 |
+
foreach ($result as $product) {
|
775 |
+
foreach ($values as $item) {
|
776 |
+
$product[$key] = $item;
|
777 |
+
$append[] = $product;
|
778 |
+
}
|
779 |
+
}
|
780 |
+
$result = $append;
|
781 |
+
}
|
782 |
+
|
783 |
+
// Add a new product to the $result array for each variation of optional
|
784 |
+
// product options.
|
785 |
+
foreach ($result as $productConfiguration) {
|
786 |
+
foreach ($optionalProductOptions as $option) {
|
787 |
+
foreach ($option as $product) {
|
788 |
+
$newVariation = $productConfiguration;
|
789 |
+
$newVariation[] = $product;
|
790 |
+
$result[] = $newVariation;
|
791 |
+
}
|
792 |
+
}
|
793 |
+
}
|
794 |
+
|
795 |
+
return $result;
|
796 |
+
}
|
797 |
}
|
|
app/code/community/Iparcel/Shipping/Helper/Api/External.php
CHANGED
@@ -2,81 +2,83 @@
|
|
2 |
/**
|
3 |
* External API Helper
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Helper_Api_External
|
10 |
-
|
|
|
11 |
* var $_allowedAddr array
|
12 |
*
|
13 |
* List of allowed addresses and subnets
|
14 |
*/
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
81 |
}
|
82 |
-
?>
|
2 |
/**
|
3 |
* External API Helper
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Helper_Api_External
|
10 |
+
{
|
11 |
+
/*
|
12 |
* var $_allowedAddr array
|
13 |
*
|
14 |
* List of allowed addresses and subnets
|
15 |
*/
|
16 |
+
protected $_allowedAddr = array(
|
17 |
+
'47.19.112.64/27',
|
18 |
+
'23.96.0.0/18',
|
19 |
+
'23.96.64.0/28',
|
20 |
+
'23.96.64.64/26',
|
21 |
+
'23.96.64.128/27',
|
22 |
+
'23.96.64.160/28',
|
23 |
+
'23.96.80.0/20',
|
24 |
+
'23.96.96.0/19',
|
25 |
+
'23.100.16.0/20',
|
26 |
+
'137.116.112.0/20',
|
27 |
+
'137.117.32.0/19',
|
28 |
+
'137.117.64.0/18',
|
29 |
+
'137.135.64.0/18',
|
30 |
+
'157.56.176.0/21',
|
31 |
+
'168.61.32.0/20',
|
32 |
+
'168.61.48.0/21',
|
33 |
+
'168.62.32.0/19',
|
34 |
+
'168.62.160.0/19',
|
35 |
+
'138.91.96.0/25',
|
36 |
+
'138.91.96.128/26',
|
37 |
+
'138.91.96.192/28',
|
38 |
+
'138.91.112.0/20',
|
39 |
+
'191.234.32.0/19',
|
40 |
+
'191.236.0.0/19',
|
41 |
+
'191.238.0.0/25',
|
42 |
+
'191.238.0.128/26',
|
43 |
+
'191.238.0.192/23',
|
44 |
+
'191.238.1.0/24',
|
45 |
+
'191.238.2.0/23',
|
46 |
+
'191.238.4.0/24',
|
47 |
+
'191.238.8.0/21',
|
48 |
+
'191.238.16.0/20',
|
49 |
+
'191.238.32.0/19',
|
50 |
+
);
|
51 |
|
52 |
+
/**
|
53 |
+
* Checking if ip address matches range
|
54 |
+
*
|
55 |
+
* @param string $ip, string $range
|
56 |
+
* @return bool
|
57 |
+
*/
|
58 |
+
protected function _cidrMatch($ip, $range)
|
59 |
+
{
|
60 |
+
list ($subnet, $bits) = explode('/', $range);
|
61 |
+
$ip = ip2long($ip);
|
62 |
+
$subnet = ip2long($subnet);
|
63 |
+
$mask = -1 << (32 - $bits);
|
64 |
+
$subnet &= $mask;
|
65 |
+
return ($ip & $mask) == $subnet;
|
66 |
+
}
|
67 |
|
68 |
+
/**
|
69 |
+
* Checking if request ip address is allowed
|
70 |
+
*
|
71 |
+
* @return bool
|
72 |
+
*/
|
73 |
+
public function isAllowed()
|
74 |
+
{
|
75 |
+
return true;
|
76 |
+
$ip = Mage::helper('core/http')->getRemoteAddr();
|
77 |
+
foreach ($this->_allowedAddr as $range) {
|
78 |
+
if ($this->_cidrMatch($ip, $range)) {
|
79 |
+
return true;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
return false;
|
83 |
+
}
|
84 |
}
|
|
app/code/community/Iparcel/Shipping/Helper/Data.php
CHANGED
@@ -2,35 +2,39 @@
|
|
2 |
/**
|
3 |
* Iparcel_Shipping default data Helper
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Helper_Data extends Mage_Core_Helper_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
36 |
}
|
2 |
/**
|
3 |
* Iparcel_Shipping default data Helper
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Helper_Data extends Mage_Core_Helper_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Getting GUID key
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function getGuid()
|
17 |
+
{
|
18 |
+
return Mage::getStoreConfig('iparcel/config/userid');
|
19 |
+
}
|
20 |
|
21 |
+
/**
|
22 |
+
* Getting Customer ID
|
23 |
+
*
|
24 |
+
* @return string
|
25 |
+
*/
|
26 |
+
public function getCustomerID()
|
27 |
+
{
|
28 |
+
return Mage::getStoreConfig('iparcel/config/custid');
|
29 |
+
}
|
30 |
|
31 |
+
/**
|
32 |
+
* Getting external JS Scripts URL
|
33 |
+
*
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
public function getScriptUrl()
|
37 |
+
{
|
38 |
+
return '//script.i-parcel.com/';
|
39 |
+
}
|
40 |
}
|
app/code/community/Iparcel/Shipping/Helper/International.php
CHANGED
@@ -1,56 +1,62 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
* i-parcel international customer helper
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Helper_International
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
56 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
* i-parcel international customer helper
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Helper_International
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get international flag from customer session
|
13 |
+
*
|
14 |
+
* @return bool
|
15 |
+
*/
|
16 |
+
public function getInternational()
|
17 |
+
{
|
18 |
+
return Mage::getSingleton('checkout/session')->getInternationalFlag();
|
19 |
+
}
|
20 |
|
21 |
+
/**
|
22 |
+
* Set international flag to customer session, respond with new state
|
23 |
+
*
|
24 |
+
* @param bool $v
|
25 |
+
* @return bool
|
26 |
+
*/
|
27 |
+
public function setInternational($v)
|
28 |
+
{
|
29 |
+
Mage::getSingleton('checkout/session')->setInternationalFlag($v);
|
30 |
+
return Mage::getSingleton('checkout/session')->getInternationalFlag();
|
31 |
+
}
|
32 |
|
33 |
+
/**
|
34 |
+
* Checking if international customer is enabled
|
35 |
+
*
|
36 |
+
* @return bool
|
37 |
+
*/
|
38 |
+
public function checkEnabled()
|
39 |
+
{
|
40 |
+
return Mage::getStoreConfigFlag('iparcel/international_customer/enable');
|
41 |
+
}
|
42 |
|
43 |
+
/**
|
44 |
+
* Get international visibility attribute ID
|
45 |
+
*
|
46 |
+
* @return string
|
47 |
+
*/
|
48 |
+
public function getVisibilityAttributeId()
|
49 |
+
{
|
50 |
+
return Mage::getStoreConfig('iparcel/international_customer/visibility');
|
51 |
+
}
|
52 |
|
53 |
+
/**
|
54 |
+
* Get international visibility attribute name
|
55 |
+
*
|
56 |
+
* @return string
|
57 |
+
*/
|
58 |
+
public function getVisibilityAttributeName()
|
59 |
+
{
|
60 |
+
return Mage::getModel('catalog/resource_eav_attribute')->load($this->getVisibilityAttributeId())->getName();
|
61 |
+
}
|
62 |
}
|
app/code/community/Iparcel/Shipping/Helper/Sales/Data.php
CHANGED
@@ -6,113 +6,113 @@
|
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Helper_Sales_Data extends Mage_Sales_Helper_Data
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
}
|
118 |
-
?>
|
6 |
* @package Iparcel_Shipping
|
7 |
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Helper_Sales_Data extends Mage_Sales_Helper_Data
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Check allow to send new order confirmation email
|
13 |
+
*
|
14 |
+
* @param mixed $store
|
15 |
+
* @return bool
|
16 |
+
*/
|
17 |
+
public function canSendNewOrderConfirmationEmail($store = null)
|
18 |
+
{
|
19 |
+
$parent = parent::canSendNewOrderConfirmationEmail($store);
|
20 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
21 |
+
}
|
22 |
|
23 |
+
/**
|
24 |
+
* Check allow to send new order email
|
25 |
+
*
|
26 |
+
* @param mixed $store
|
27 |
+
* @return bool
|
28 |
+
*/
|
29 |
+
public function canSendNewOrderEmail($store = null)
|
30 |
+
{
|
31 |
+
$parent = parent::canSendNewOrderEmail($store);
|
32 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
33 |
+
}
|
34 |
|
35 |
+
/**
|
36 |
+
* Check allow to send order comment email
|
37 |
+
*
|
38 |
+
* @param mixed $store
|
39 |
+
* @return bool
|
40 |
+
*/
|
41 |
+
public function canSendOrderCommentEmail($store = null)
|
42 |
+
{
|
43 |
+
$parent = parent::canSendOrderCommentEmail($store);
|
44 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
45 |
+
}
|
46 |
|
47 |
+
/**
|
48 |
+
* Check allow to send new shipment email
|
49 |
+
*
|
50 |
+
* @param mixed $store
|
51 |
+
* @return bool
|
52 |
+
*/
|
53 |
+
public function canSendNewShipmentEmail($store = null)
|
54 |
+
{
|
55 |
+
$parent = parent::canSendNewShipmentEmail($store);
|
56 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
57 |
+
}
|
58 |
|
59 |
+
/**
|
60 |
+
* Check allow to send shipment comment email
|
61 |
+
*
|
62 |
+
* @param mixed $store
|
63 |
+
* @return bool
|
64 |
+
*/
|
65 |
+
public function canSendShipmentCommentEmail($store = null)
|
66 |
+
{
|
67 |
+
$parent = parent::canSendShipmentCommentEmail($store);
|
68 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
69 |
+
}
|
70 |
|
71 |
+
/**
|
72 |
+
* Check allow to send new invoice email
|
73 |
+
*
|
74 |
+
* @param mixed $store
|
75 |
+
* @return bool
|
76 |
+
*/
|
77 |
+
public function canSendNewInvoiceEmail($store = null)
|
78 |
+
{
|
79 |
+
$parent = parent::canSendNewInvoiceEmail($store);
|
80 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
81 |
+
}
|
82 |
|
83 |
+
/**
|
84 |
+
* Check allow to send invoice comment email
|
85 |
+
*
|
86 |
+
* @param mixed $store
|
87 |
+
* @return bool
|
88 |
+
*/
|
89 |
+
public function canSendInvoiceCommentEmail($store = null)
|
90 |
+
{
|
91 |
+
$parent = parent::canSendInvoiceCommentEmail($store);
|
92 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
93 |
+
}
|
94 |
|
95 |
+
/**
|
96 |
+
* Check allow to send new creditmemo email
|
97 |
+
*
|
98 |
+
* @param mixed $store
|
99 |
+
* @return bool
|
100 |
+
*/
|
101 |
+
public function canSendNewCreditmemoEmail($store = null)
|
102 |
+
{
|
103 |
+
$parent = parent::canSendNewCreditmemoEmail($store);
|
104 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
105 |
+
}
|
106 |
|
107 |
+
/**
|
108 |
+
* Check allow to send creditmemo comment email
|
109 |
+
*
|
110 |
+
* @param mixed $store
|
111 |
+
* @return bool
|
112 |
+
*/
|
113 |
+
public function canSendCreditmemoCommentEmail($store = null)
|
114 |
+
{
|
115 |
+
$parent = parent::canSendCreditmemoCommentEmail($store);
|
116 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
117 |
+
}
|
118 |
}
|
|
app/code/community/Iparcel/Shipping/Helper/String.php
CHANGED
@@ -2,19 +2,20 @@
|
|
2 |
/**
|
3 |
* i-parcel shipping helper for strings
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Helper_String
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
19 |
}
|
20 |
-
?>
|
2 |
/**
|
3 |
* i-parcel shipping helper for strings
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiocoders.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Helper_String
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Checking if string has integer value
|
13 |
+
*
|
14 |
+
* @param string $str
|
15 |
+
* @return bool
|
16 |
+
*/
|
17 |
+
public function isInteger(string $str)
|
18 |
+
{
|
19 |
+
return (int)$str == $str;
|
20 |
+
}
|
21 |
}
|
|
app/code/community/Iparcel/Shipping/Helper/Tax.php
CHANGED
@@ -2,46 +2,47 @@
|
|
2 |
/**
|
3 |
* i-parcel helper for shipping tax&duty
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Helper_Tax extends Mage_Core_Helper_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
46 |
}
|
47 |
-
?>
|
2 |
/**
|
3 |
* i-parcel helper for shipping tax&duty
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Helper_Tax extends Mage_Core_Helper_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Getting shipping tax&duty totals for order
|
13 |
+
*
|
14 |
+
* @param Mage_Sales_Model_Order $order
|
15 |
+
* @return Varien_Data_Connection
|
16 |
+
*/
|
17 |
+
public function getTotal(Mage_Sales_Model_Order $order)
|
18 |
+
{
|
19 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($order->getId());
|
20 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
21 |
+
$collection = new Varien_Data_Collection();
|
22 |
+
switch ($taxduty->getMode()) {
|
23 |
+
case '2':
|
24 |
+
$collection->addItem(new Varien_Object(array(
|
25 |
+
'code' => 'shippingip_duty',
|
26 |
+
'value' => $taxduty->getDuty(),
|
27 |
+
'base_value' => $taxduty->getDuty(),
|
28 |
+
'label' => Mage::getStoreConfig('iparcel/tax/duty_label')
|
29 |
+
)));
|
30 |
+
$collection->addItem(new Varien_Object(array(
|
31 |
+
'code' => 'shippingip_tax',
|
32 |
+
'value' => $taxduty->getTax(),
|
33 |
+
'base_value' => $taxduty->getTax(),
|
34 |
+
'label' => Mage::getStoreConfig('iparcel/tax/tax_label')
|
35 |
+
)));
|
36 |
+
break;
|
37 |
+
case '1':
|
38 |
+
$collection->addItem(new Varien_Object(array(
|
39 |
+
'code' => 'shippingip_tax',
|
40 |
+
'value' => $taxduty->getTax()+$taxduty->getDuty(),
|
41 |
+
'base_value' => $taxduty->getTax()+$taxduty->getDuty(),
|
42 |
+
'label' => Mage::getStoreConfig('iparcel/tax/tax_duty_label')
|
43 |
+
)));
|
44 |
+
break;
|
45 |
+
}
|
46 |
+
return $collection;
|
47 |
+
}
|
48 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Api/External/Sales/Order.php
CHANGED
@@ -2,438 +2,478 @@
|
|
2 |
/**
|
3 |
* i-parcel External Sales API processing model
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Api_External_Sales_Order extends Varien_Object
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
/* if no default billing do nothing */
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
}
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
$ship->setCarrier('i-parcel');
|
342 |
-
$ship->setCarrierTitle('i-parcel');
|
343 |
-
$ship->setMethod('auto');
|
344 |
-
$ship->setMethodTitle('Auto');
|
345 |
-
$ship->setPrice($shippingCosts);
|
346 |
-
$ship->setCost($shippingCosts);
|
347 |
-
$ship->setMethodDescription(Mage::getStoreConfig('carriers/i-parcel/whitelabelship').': '.Mage::getStoreConfig('carriers/i-parcel/backend_name'));
|
348 |
-
|
349 |
-
// import order's post data and shipping rate
|
350 |
-
$_orderCreator->importPostData($orderData['order'])
|
351 |
-
->getQuote()
|
352 |
-
->getShippingAddress()
|
353 |
-
->addShippingRate(Mage::getModel('sales/quote_address_rate')->importShippingRate($ship));
|
354 |
-
|
355 |
-
try{
|
356 |
-
// create order
|
357 |
-
$_order = $_orderCreator->createOrder();
|
358 |
-
/* var $_order Mage_Sales_Model_Order */
|
359 |
-
}catch(Exception $e){
|
360 |
-
$errors = array();
|
361 |
-
|
362 |
-
$messages = Mage::getSingleton('adminhtml/session_quote')->getMessages();
|
363 |
-
/* var $messages Mage_Core_Model_Message_Collection */
|
364 |
-
foreach ($messages->getErrors() as $error){
|
365 |
-
/* var $error Mage_Core_Model_Message_Error */
|
366 |
-
$errors[] = $error->getText();
|
367 |
-
$messages->deleteMessageByIdentifier($error->getIdentifier());
|
368 |
-
}
|
369 |
-
$errors = implode("\n",$errors);
|
370 |
-
|
371 |
-
$message = $e->getMessage();
|
372 |
-
$message = trim($message);
|
373 |
-
if($message != ''){
|
374 |
-
$errors .= "\n{$message}";
|
375 |
-
}
|
376 |
-
|
377 |
-
Mage::throwException($errors);
|
378 |
-
}
|
379 |
-
|
380 |
-
$_order->setShippingDescription($ship->getMethodDescription());
|
381 |
-
$_order->setBaseShippingAmount($ship->getPrice());
|
382 |
-
$_order->setShippingAmount($ship->getPrice());
|
383 |
-
$_order->setGlobalCurrencyCode($currency);
|
384 |
-
$_order->setBaseCurrencyCode($currency);
|
385 |
-
$_order->setStoreCurrencyCode($currency);
|
386 |
-
$_order->setOrderCurrencyCode($currency);
|
387 |
-
$_order->setTaxAmount($tax);
|
388 |
-
$_order->setSubtotal($subtotal);
|
389 |
-
$_order->setGrandTotal($grandtotal);
|
390 |
-
$_order->setBaseGrandTotal($grandtotal-$tax);
|
391 |
-
$_order->save();
|
392 |
-
$_order->sendNewOrderEmail();
|
393 |
-
|
394 |
-
Mage::getSingleton('adminhtml/session_quote')->clear();
|
395 |
-
Mage::unregister('rule_data');
|
396 |
-
|
397 |
-
$this->setOrder($_order);
|
398 |
-
return $_order;
|
399 |
-
}
|
400 |
-
|
401 |
-
/**
|
402 |
-
* Creating invoice for the order
|
403 |
-
*
|
404 |
-
* @return Mage_Sales_Model_Order_Invoice
|
405 |
-
*/
|
406 |
-
public function createInvoice(){
|
407 |
-
$order = $this->getOrder();
|
408 |
-
/* var $order Mage_Sales_Model_Order */
|
409 |
-
if(!$order->canInvoice()){
|
410 |
-
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
|
411 |
-
}
|
412 |
-
$invoice = Mage::getModel('sales/service_order',$order)->prepareInvoice();
|
413 |
-
/* var $invoice = Mage_Sales_Model_Order_Invoice */
|
414 |
-
if (!$invoice->getTotalQty()){
|
415 |
-
Mage::throwException(Mage::helper('core')->__('Cannot create invoice without products.'));
|
416 |
-
}
|
417 |
-
$invoice->setRequestCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
|
418 |
-
$invoice->register();
|
419 |
-
$transactionSave = Mage::getModel('core/resource_transaction')
|
420 |
-
->addObject($invoice)
|
421 |
-
->addObject($invoice->getOrder());
|
422 |
-
/* var $transactionSave Mage_Core_Model_Resource_Transaction */
|
423 |
-
$transactionSave->save();
|
424 |
-
$invoice->sendEmail();
|
425 |
-
$this->setInvoice($invoice);
|
426 |
-
return $invoice;
|
427 |
-
}
|
428 |
-
|
429 |
-
/**
|
430 |
-
* Setter for tracking number
|
431 |
-
*
|
432 |
-
* @param string $number
|
433 |
-
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
434 |
-
*/
|
435 |
-
public function setTrackingNumber($number){
|
436 |
-
Mage::getSingleton('checkout/session')->setTrackingNumber($number);
|
437 |
-
return parent::setTrackingNumber($number);
|
438 |
-
}
|
439 |
}
|
2 |
/**
|
3 |
* i-parcel External Sales API processing model
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Api_External_Sales_Order extends Varien_Object
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initialize adminhtml quote session
|
13 |
+
*
|
14 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
15 |
+
*/
|
16 |
+
protected function _initSession()
|
17 |
+
{
|
18 |
+
$_orderData = $this->getOrderData();
|
19 |
+
/* var $_orderData array */
|
20 |
+
$data = $_orderData['session'];
|
21 |
+
/* var $data array */
|
22 |
+
if (!$data) {
|
23 |
+
Mage::throwException('Session data not specified');
|
24 |
+
}
|
25 |
+
if (empty($data['customer_id'])) {
|
26 |
+
Mage::throwException('Customer ID not specified');
|
27 |
+
}
|
28 |
+
Mage::getSingleton('adminhtml/session_quote')->setCustomerId((int) $data['customer_id']);
|
29 |
+
return $this;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Processing quote
|
34 |
+
*
|
35 |
+
* @return Iparcel_Shipping_MOdel_Api_External_Sales_Order
|
36 |
+
*/
|
37 |
+
protected function _processQuote()
|
38 |
+
{
|
39 |
+
$data = $this->getOrderData();
|
40 |
+
/* var $data array */
|
41 |
+
if (empty($data['order'])) {
|
42 |
+
Mage::throwException('Order Data not specified');
|
43 |
+
}
|
44 |
+
if (empty($data['add_products'])) {
|
45 |
+
Mage::throwException('No products specified');
|
46 |
+
}
|
47 |
+
$_orderCreate = Mage::getSingleton('adminhtml/sales_order_create');
|
48 |
+
/* var $_orderCreate Mage_Adminhtml_Model_Sales_Order_Create */
|
49 |
+
$_orderCreate->importPostData($data['order']);
|
50 |
+
$_orderCreate->getBillingAddress();
|
51 |
+
$_orderCreate->setShippingAsBilling(true);
|
52 |
+
$_orderCreate->addProducts($data['add_products']);
|
53 |
+
$_orderCreate->getQuote()->getPayment()->addData($data['payment']);
|
54 |
+
$_orderCreate->setPaymentData($data['payment']);
|
55 |
+
$_orderCreate->initRuleData()->saveQuote();
|
56 |
+
|
57 |
+
return $this;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Customer setter
|
62 |
+
*
|
63 |
+
* @param array $user, int $websiteId
|
64 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
65 |
+
*/
|
66 |
+
public function setCustomer($user, $websiteId)
|
67 |
+
{
|
68 |
+
$customer = Mage::getModel('customer/customer');
|
69 |
+
/* var $customer Mage_Customer_Model_Customer */
|
70 |
+
if ($websiteId) {
|
71 |
+
$customer->setWebsiteId($websiteId);
|
72 |
+
}
|
73 |
+
$customer->loadByEmail($user['email']);
|
74 |
+
// if customer exists set existing
|
75 |
+
if ($customer->getId()) {
|
76 |
+
parent::setCustomer($customer);
|
77 |
+
} else {
|
78 |
+
$customer->setEmail($user['email']);
|
79 |
+
$customer->setFirstname($user['firstname']);
|
80 |
+
$customer->setLastname($user['lastname']);
|
81 |
+
$customer->setPassword($user['password']);
|
82 |
+
$customer->setConfirmation(null);
|
83 |
+
$customer->save();
|
84 |
+
// else create new one
|
85 |
+
parent::setCustomer($customer);
|
86 |
+
}
|
87 |
+
// set customer email and return
|
88 |
+
$this->setCustomerEmail($user['email']);
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Customer Billing Address setter
|
94 |
+
*
|
95 |
+
* @param array $_address
|
96 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
97 |
+
*/
|
98 |
+
public function setCustomerBillingAddress($_address)
|
99 |
+
{
|
100 |
+
$address = Mage::getModel('customer/address');
|
101 |
+
/* var $address Mage_Customer_Model_Address */
|
102 |
+
$customer = $this->getCustomer();
|
103 |
+
/* var $customer Mage_Customer_Model_Customer */
|
104 |
+
// throw exception if customer is not specified
|
105 |
+
if (!$customer) {
|
106 |
+
Mage::throwException('Customer not specified');
|
107 |
+
}
|
108 |
+
$region = Mage::getModel('directory/region')->loadByCode($_address['region_id'], $_address['country_id']);
|
109 |
+
$address->setCustomerId($customer->getId());
|
110 |
+
$address->setFirstname($_address['firstname']);
|
111 |
+
$address->setLastname($_address['lastname']);
|
112 |
+
$address->setCountryId($_address['country_id']);
|
113 |
+
$address->setStreet($_address['street']);
|
114 |
+
$address->setPostcode($_address['postcode']);
|
115 |
+
$address->setCity($_address['city']);
|
116 |
+
$address->setTelephone(isset($_address['telephone']) ? $_address['telephone'] : '');
|
117 |
+
$address->setRegion(isset($_address['region_id']) ? $_address['region_id'] : '');
|
118 |
+
$address->setRegionId($region->getId());
|
119 |
+
$address->save();
|
120 |
+
return parent::setCustomerBillingAddress($address);
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Setting default billing address for customer
|
125 |
+
*
|
126 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
127 |
+
*/
|
128 |
+
public function setDefaultCustomerBillingAddress()
|
129 |
+
{
|
130 |
+
$customer = $this->getCustomer();
|
131 |
+
/* var $customer Mage_Customer_Model_Customer */
|
132 |
+
if (!$customer) {
|
133 |
+
Mage::throwException('Customer is not specified');
|
134 |
+
}
|
135 |
|
136 |
/* if no default billing do nothing */
|
137 |
+
if (!$customer->getDefaultBilling()) {
|
138 |
+
return $this;
|
139 |
+
}
|
140 |
+
|
141 |
+
$address = $customer->getDefaultBillingAddress();
|
142 |
+
/* var $address Mage_Customer_Model_Address */
|
143 |
+
return parent::setCustomerBillingAddress($address);
|
144 |
}
|
145 |
|
146 |
+
/**
|
147 |
+
* Helper function to determine if the customer has a default Billing Address
|
148 |
+
*
|
149 |
+
* @return boolean True if a default billing address is set for the customer
|
150 |
+
*/
|
151 |
+
public function getCustomerHasDefaultBilling()
|
152 |
+
{
|
153 |
+
$customer = $this->getCustomer();
|
154 |
+
return (bool)$customer->getDefaultBilling();
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Customer Shipping Address setter
|
159 |
+
*
|
160 |
+
* @param array $_address
|
161 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
162 |
+
*/
|
163 |
+
public function setCustomerShippingAddress($_address)
|
164 |
+
{
|
165 |
+
$address = Mage::getModel('customer/address');
|
166 |
+
/* var $address Mage_Customer_Model_Address */
|
167 |
+
$customer = $this->getCustomer();
|
168 |
+
/* var $customer Mage_Customer_Model_Customer */
|
169 |
+
// throw exception if customer is not specified
|
170 |
+
if (!$customer) {
|
171 |
+
Mage::throwException('Customer not specified');
|
172 |
+
}
|
173 |
+
$region = Mage::getModel('directory/region')->loadByCode($_address['region_id'], $_address['country_id']);
|
174 |
+
$address->setCustomerId($customer->getId());
|
175 |
+
$address->setFirstname($_address['firstname']);
|
176 |
+
$address->setLastname($_address['lastname']);
|
177 |
+
$address->setCountryId($_address['country_id']);
|
178 |
+
$address->setStreet($_address['street']);
|
179 |
+
$address->setPostcode($_address['postcode']);
|
180 |
+
$address->setCity($_address['city']);
|
181 |
+
$address->setTelephone(isset($_address['telephone']) ? $_address['telephone'] : '');
|
182 |
+
$address->setRegion(isset($_address['region_id']) ? $_address['region_id'] : '');
|
183 |
+
$address->setRegionId($region->getId());
|
184 |
+
$address->save();
|
185 |
+
return parent::setCustomerShippingAddress($address);
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Setting default shipping address for customer
|
190 |
+
*
|
191 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
192 |
+
*/
|
193 |
+
public function setDefaultCustomerShippingAddress()
|
194 |
+
{
|
195 |
+
$customer = $this->getCustomer();
|
196 |
+
/* var $customer Mage_Customer_Model_Customer */
|
197 |
+
if (!$customer) {
|
198 |
+
Mage::throwException('Customer is not specified');
|
199 |
+
}
|
200 |
+
|
201 |
+
/* if no default shipping do nothing */
|
202 |
+
if (!$customer->getDefaultShippingAddress()) {
|
203 |
+
return $this;
|
204 |
+
}
|
205 |
+
|
206 |
+
$address = $customer->getDefaultShippingAddress();
|
207 |
+
/* var $address Mage_Customer_Model_Address */
|
208 |
+
return parent::setCustomerShippingAddress($address);
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Helper function to determine if the customer has a default Shipping Address
|
213 |
+
*
|
214 |
+
* @return boolean True if a default shipping address is set for the customer
|
215 |
+
*/
|
216 |
+
public function getCustomerHasDefaultShipping()
|
217 |
+
{
|
218 |
+
$customer = $this->getCustomer();
|
219 |
+
return (bool)$customer->getDefaultShipping();
|
220 |
+
}
|
221 |
+
|
222 |
+
/** Order data setter
|
223 |
+
*
|
224 |
+
* @param array $data
|
225 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
226 |
+
*/
|
227 |
+
public function setOrderData($data)
|
228 |
+
{
|
229 |
+
$_products = array();
|
230 |
+
$_options = new Varien_Data_Collection();
|
231 |
+
foreach ($data as $product) {
|
232 |
+
$_product = Mage::getModel('catalog/product')->getCollection()
|
233 |
+
->addAttributeToFilter('sku', $product['sku'])
|
234 |
+
->addAttributeToSelect('*')
|
235 |
+
->getFirstItem();
|
236 |
+
/* var $_product Mage_Catalog_Model_Product */
|
237 |
+
$_product->load($_product->getId());
|
238 |
+
$_products[$_product->getId()] = array(
|
239 |
+
'qty' => $product['qty'],
|
240 |
+
'price' => is_string($product['price']) ? (float)str_replace(",", ".", $product['price']) : $product['price']
|
241 |
+
);
|
242 |
+
foreach ($product['options'] as $code => $value) {
|
243 |
+
$_options->addItem(new Varien_Object(
|
244 |
+
array(
|
245 |
+
'product' => $_product,
|
246 |
+
'code' => $code,
|
247 |
+
'value' => $value
|
248 |
+
)
|
249 |
+
));
|
250 |
+
}
|
251 |
+
}
|
252 |
+
// set products and options
|
253 |
+
$this->setProducts($_products);
|
254 |
+
$this->setOptions($_options);
|
255 |
+
|
256 |
+
$_customerBillingAddress = $this->getCustomerBillingAddress();
|
257 |
+
/* var $_customerBillingAddress Mage_Customer_Model_Address */
|
258 |
+
$_customerShippingAddress = $this->getCustomerShippingAddress() ?: $this->getCustomerBillingAddress();
|
259 |
+
/* var $_customerShippingAddress Mage_Customer_Model_Address */
|
260 |
+
$_customer = $this->getCustomer();
|
261 |
+
/* var $_customer Mage_Customer_Model_Customer */
|
262 |
+
$_orderData = array(
|
263 |
+
'session' => array(
|
264 |
+
'customer_id' => $_customer->getId(),
|
265 |
+
'store_id' => $this->getStoreId()
|
266 |
+
),
|
267 |
+
'payment' => array(
|
268 |
+
'method' => 'iparcel'
|
269 |
+
),
|
270 |
+
'add_products' => $_products,
|
271 |
+
'order' => array(
|
272 |
+
'currency' => 'USD',
|
273 |
+
'account' => array(
|
274 |
+
'group_id' => '1',
|
275 |
+
'email' => $_customer->getEmail()
|
276 |
+
),
|
277 |
+
'billing_address' => array(
|
278 |
+
'customer_address_id' => $_customerBillingAddress->getId(),
|
279 |
+
'prefix' => '',
|
280 |
+
'firstname' => $_customerBillingAddress->getFirstname(),
|
281 |
+
'middlename' => '',
|
282 |
+
'lastname' => $_customerBillingAddress->getLastname(),
|
283 |
+
'suffix' => '',
|
284 |
+
'company' => '',
|
285 |
+
'street' => $_customerBillingAddress->getStreet(),
|
286 |
+
'city' => $_customerBillingAddress->getCity(),
|
287 |
+
'country_id' => $_customerBillingAddress->getCountryId(),
|
288 |
+
'region' => $_customerBillingAddress->getRegion(),
|
289 |
+
'region_id' => $_customerBillingAddress->getRegionId(),
|
290 |
+
'postcode' => $_customerBillingAddress->getPostcode(),
|
291 |
+
'telephone' => $_customerBillingAddress->getTelephone(),
|
292 |
+
'fax' => ''
|
293 |
+
),
|
294 |
+
'shipping_address' => array(
|
295 |
+
'customer_address_id' => $_customerShippingAddress->getId(),
|
296 |
+
'prefix' => '',
|
297 |
+
'firstname' => $_customerShippingAddress->getFirstname(),
|
298 |
+
'middlename' => '',
|
299 |
+
'lastname' => $_customerShippingAddress->getLastname(),
|
300 |
+
'suffix' => '',
|
301 |
+
'company' => '',
|
302 |
+
'street' => $_customerShippingAddress->getStreet(),
|
303 |
+
'city' => $_customerShippingAddress->getCity(),
|
304 |
+
'country_id' => $_customerShippingAddress->getCountryId(),
|
305 |
+
'region' => $_customerShippingAddress->getRegion(),
|
306 |
+
'region_id' => $_customerBillingAddress->getRegionId(),
|
307 |
+
'postcode' => $_customerShippingAddress->getPostcode(),
|
308 |
+
'telephone' => $_customerShippingAddress->getTelephone(),
|
309 |
+
'fax' => ''
|
310 |
+
),
|
311 |
+
'shipping_method' => 'i-parcel_auto',
|
312 |
+
'comment' => array(
|
313 |
+
'customer_note' => 'This order has ben programmatically created via I-Parcel extension'
|
314 |
+
),
|
315 |
+
'send_confirmation' => '0'
|
316 |
+
),
|
317 |
+
);
|
318 |
+
return parent::setOrderData($_orderData);
|
319 |
}
|
320 |
|
321 |
+
/**
|
322 |
+
* Creating order method
|
323 |
+
*
|
324 |
+
* @return Mage_Sales_Model_Order
|
325 |
+
*/
|
326 |
+
public function createOrder()
|
327 |
+
{
|
328 |
+
$orderData = $this->getOrderData();
|
329 |
+
/* var $orderData array */
|
330 |
+
if (!$orderData) {
|
331 |
+
Mage::throwException('Order Data is not specified');
|
332 |
+
}
|
333 |
+
|
334 |
+
$tax = $this->getTax() ?: 0;
|
335 |
+
$shippingCosts = $this->getShippingCosts();
|
336 |
+
$this->_initSession();
|
337 |
+
$this->_processQuote();
|
338 |
+
|
339 |
+
$_orderCreator = Mage::getSingleton('adminhtml/sales_order_create');
|
340 |
+
/* var $_orderCreator Mage_Adminhtml_Sales_Order_Create */
|
341 |
+
|
342 |
+
$subtotal = 0;
|
343 |
+
|
344 |
+
// processing order's items, setting prices, totals etc
|
345 |
+
foreach ($this->getProducts() as $id => $productData) {
|
346 |
+
$_product = Mage::getModel('catalog/product')->load($id);
|
347 |
+
/* var $_product Mage_Catalog_Model_Product */
|
348 |
+
$item = Mage::getSingleton('adminhtml/sales_order_create')->getQuote()->getItemByProduct($_product);
|
349 |
+
/* var $item Mage_Sales_Model_Quote_Item */
|
350 |
+
if (!$item) {
|
351 |
+
continue;
|
352 |
+
}
|
353 |
+
foreach ($this->getOptions() as $option) {
|
354 |
+
if ($option['product']->getId() == $_product->getId()) {
|
355 |
+
$item->addOption($option);
|
356 |
+
}
|
357 |
+
}
|
358 |
+
$price = empty($productData['price']) ? $_product->getFinalPrice() : $productData['price'];
|
359 |
+
$qty = $productData['qty'];
|
360 |
+
$item->setCustomPrice($price);
|
361 |
+
$item->setOriginalCustomPrice($price);
|
362 |
+
$rowtotal = (float)$qty * (float)$price;
|
363 |
+
$subtotal += $rowtotal;
|
364 |
+
$item->setRowTotal($rowtotal);
|
365 |
+
}
|
366 |
+
|
367 |
+
// calc grand total
|
368 |
+
$grandtotal = $subtotal+$tax+$shippingCosts;
|
369 |
+
|
370 |
+
// set currency
|
371 |
+
if (!$this->getCurrency()) {
|
372 |
+
Mage::throwException('Currency is not specified');
|
373 |
+
}
|
374 |
+
$currency = $this->getCurrency();
|
375 |
+
|
376 |
+
// generate shipping rate
|
377 |
+
$ship = Mage::getModel('shipping/rate_result_method');
|
378 |
+
/* var $ship Mage_Shipping_Model_Rate_Result_Method */
|
379 |
+
$ship->setCarrier('i-parcel');
|
380 |
+
$ship->setCarrierTitle('i-parcel');
|
381 |
+
$ship->setMethod('auto');
|
382 |
+
$ship->setMethodTitle('Auto');
|
383 |
+
$ship->setPrice($shippingCosts);
|
384 |
+
$ship->setCost($shippingCosts);
|
385 |
+
$ship->setMethodDescription(Mage::getStoreConfig('carriers/i-parcel/whitelabelship').': '.Mage::getStoreConfig('carriers/i-parcel/backend_name'));
|
386 |
+
|
387 |
+
// import order's post data and shipping rate
|
388 |
+
$_orderCreator->importPostData($orderData['order'])
|
389 |
+
->getQuote()
|
390 |
+
->getShippingAddress()
|
391 |
+
->addShippingRate(Mage::getModel('sales/quote_address_rate')->importShippingRate($ship));
|
392 |
+
|
393 |
+
try {
|
394 |
+
// create order
|
395 |
+
$_order = $_orderCreator->createOrder();
|
396 |
+
/* var $_order Mage_Sales_Model_Order */
|
397 |
+
} catch (Exception $e) {
|
398 |
+
$errors = array();
|
399 |
+
|
400 |
+
$messages = Mage::getSingleton('adminhtml/session_quote')->getMessages();
|
401 |
+
/* var $messages Mage_Core_Model_Message_Collection */
|
402 |
+
foreach ($messages->getErrors() as $error) {
|
403 |
+
/* var $error Mage_Core_Model_Message_Error */
|
404 |
+
$errors[] = $error->getText();
|
405 |
+
$messages->deleteMessageByIdentifier($error->getIdentifier());
|
406 |
+
}
|
407 |
+
$errors = implode("\n", $errors);
|
408 |
+
|
409 |
+
$message = $e->getMessage();
|
410 |
+
$message = trim($message);
|
411 |
+
if ($message != '') {
|
412 |
+
$errors .= "\n{$message}";
|
413 |
+
}
|
414 |
+
|
415 |
+
Mage::throwException($errors);
|
416 |
+
}
|
417 |
+
|
418 |
+
$_order->setShippingDescription($ship->getMethodDescription());
|
419 |
+
$_order->setBaseShippingAmount($ship->getPrice());
|
420 |
+
$_order->setShippingAmount($ship->getPrice());
|
421 |
+
$_order->setGlobalCurrencyCode($currency);
|
422 |
+
$_order->setBaseCurrencyCode($currency);
|
423 |
+
$_order->setStoreCurrencyCode($currency);
|
424 |
+
$_order->setOrderCurrencyCode($currency);
|
425 |
+
$_order->setTaxAmount($tax);
|
426 |
+
$_order->setSubtotal($subtotal);
|
427 |
+
$_order->setGrandTotal($grandtotal);
|
428 |
+
$_order->setBaseGrandTotal($grandtotal-$tax);
|
429 |
+
$_order->save();
|
430 |
+
$_order->sendNewOrderEmail();
|
431 |
+
|
432 |
+
Mage::getSingleton('adminhtml/session_quote')->clear();
|
433 |
+
Mage::unregister('rule_data');
|
434 |
+
|
435 |
+
$this->setOrder($_order);
|
436 |
+
return $_order;
|
437 |
+
}
|
438 |
+
|
439 |
+
/**
|
440 |
+
* Creating invoice for the order
|
441 |
+
*
|
442 |
+
* @return Mage_Sales_Model_Order_Invoice
|
443 |
+
*/
|
444 |
+
public function createInvoice()
|
445 |
+
{
|
446 |
+
$order = $this->getOrder();
|
447 |
+
/* var $order Mage_Sales_Model_Order */
|
448 |
+
if (!$order->canInvoice()) {
|
449 |
+
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
|
450 |
+
}
|
451 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
452 |
+
/* var $invoice = Mage_Sales_Model_Order_Invoice */
|
453 |
+
if (!$invoice->getTotalQty()) {
|
454 |
+
Mage::throwException(Mage::helper('core')->__('Cannot create invoice without products.'));
|
455 |
+
}
|
456 |
+
$invoice->setRequestCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
|
457 |
+
$invoice->register();
|
458 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
459 |
+
->addObject($invoice)
|
460 |
+
->addObject($invoice->getOrder());
|
461 |
+
/* var $transactionSave Mage_Core_Model_Resource_Transaction */
|
462 |
+
$transactionSave->save();
|
463 |
+
$invoice->sendEmail();
|
464 |
+
$this->setInvoice($invoice);
|
465 |
+
return $invoice;
|
466 |
+
}
|
467 |
+
|
468 |
+
/**
|
469 |
+
* Setter for tracking number
|
470 |
+
*
|
471 |
+
* @param string $number
|
472 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
473 |
+
*/
|
474 |
+
public function setTrackingNumber($number)
|
475 |
+
{
|
476 |
+
Mage::getSingleton('checkout/session')->setTrackingNumber($number);
|
477 |
+
return parent::setTrackingNumber($number);
|
478 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
}
|
app/code/community/Iparcel/Shipping/Model/Api/Log.php
CHANGED
@@ -2,152 +2,161 @@
|
|
2 |
/**
|
3 |
* i-parcel XML log model
|
4 |
*
|
5 |
-
* Category
|
6 |
-
* Package
|
7 |
-
* Author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Api_Log extends Varien_Object
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
}
|
153 |
-
?>
|
2 |
/**
|
3 |
* i-parcel XML log model
|
4 |
*
|
5 |
+
* Category Iparcel
|
6 |
+
* Package Iparcel_Shipping
|
7 |
+
* Author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Api_Log extends Varien_Object
|
10 |
+
{
|
11 |
+
const LOG_FILENAME = "iparcel.log";
|
12 |
+
const MAX_LOG_SIZE = 10;
|
13 |
+
|
14 |
+
protected $_jsonData;
|
15 |
+
/**
|
16 |
+
* Internal constructor
|
17 |
+
*/
|
18 |
+
protected function _construct()
|
19 |
+
{
|
20 |
+
$this->setLogFilename(Mage::getBaseDir('log').'/'.self::LOG_FILENAME);
|
21 |
+
$this->setJson($this->_read());
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Read log file method
|
26 |
+
*
|
27 |
+
* @return Varien_Data_Collection
|
28 |
+
*/
|
29 |
+
protected function _read()
|
30 |
+
{
|
31 |
+
$response = new Varien_Data_Collection();
|
32 |
+
|
33 |
+
if (!file_exists($this->getLogFilename())) {
|
34 |
+
$this->_jsonData = array();
|
35 |
+
return $response;
|
36 |
+
}
|
37 |
+
|
38 |
+
$file = fopen($this->getLogFilename(), "r");
|
39 |
+
$this->_jsonData = json_decode(fread($file, filesize($this->getLogFilename())), true);
|
40 |
+
fclose($file);
|
41 |
+
|
42 |
+
if (!is_array($this->_jsonData)) {
|
43 |
+
if (!$this->_clear()) {
|
44 |
+
Mage::throwException(Mage::helper('shippingip')->__('Access Forbidden for i-parcel log file'));
|
45 |
+
}
|
46 |
+
$this->_jsonData = array();
|
47 |
+
return $response;
|
48 |
+
}
|
49 |
+
|
50 |
+
// for each json log node append Varien Object to Varien Data Collection
|
51 |
+
foreach ($this->_jsonData['logs'] as $log) {
|
52 |
+
$_log = new Varien_Object(array(
|
53 |
+
'timestamp' => $log['Timestamp'],
|
54 |
+
'controller' => $log['Controller'],
|
55 |
+
'response' => $log['Response'],
|
56 |
+
'request' => $log['Request']
|
57 |
+
));
|
58 |
+
$response->addItem($_log);
|
59 |
+
}
|
60 |
+
return $response;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Internal save method
|
65 |
+
*
|
66 |
+
* @return bool
|
67 |
+
*/
|
68 |
+
protected function _save()
|
69 |
+
{
|
70 |
+
try {
|
71 |
+
$file = fopen($this->getLogFilename(), 'w');
|
72 |
+
fwrite($file, json_encode($this->_jsonData));
|
73 |
+
fclose($file);
|
74 |
+
return true;
|
75 |
+
} catch (Exception $e) {
|
76 |
+
return false;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Internal create JSON file method
|
82 |
+
*
|
83 |
+
* @return bool
|
84 |
+
*/
|
85 |
+
protected function _create()
|
86 |
+
{
|
87 |
+
$this->_jsonData['created'] = $this->getTimestamp();
|
88 |
+
$this->_jsonData['edited'] = $this->getTimestamp();
|
89 |
+
$this->_jsonData['logs'] = array();
|
90 |
+
|
91 |
+
$this->_appendLog();
|
92 |
+
return $this->_save();
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Internal append XML to file method
|
97 |
+
*
|
98 |
+
* @return bool
|
99 |
+
*/
|
100 |
+
protected function _append()
|
101 |
+
{
|
102 |
+
$this->_jsonData['edited'] = $this->getTimestamp();
|
103 |
+
|
104 |
+
$this->_appendLog();
|
105 |
+
return $this->_save();
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Internal clear XML file method
|
110 |
+
*
|
111 |
+
* @return bool
|
112 |
+
*/
|
113 |
+
protected function _clear()
|
114 |
+
{
|
115 |
+
return unlink($this->getLogFilename());
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Internal append log nodes to SimpleXMLExtended object
|
120 |
+
*/
|
121 |
+
protected function _appendLog()
|
122 |
+
{
|
123 |
+
$log = array();
|
124 |
+
$log['Timestamp'] = $this->getTimestamp();
|
125 |
+
$log['Controller'] = $this->getController();
|
126 |
+
$log['Request'] = $this->getRequest();
|
127 |
+
$log['Response'] = $this->getResponse();
|
128 |
+
|
129 |
+
$this->_jsonData['logs'][] = $log;
|
130 |
+
if (self::MAX_LOG_SIZE < count($this->_jsonData['logs'])) {
|
131 |
+
array_shift($this->_jsonData['logs']);
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Save log file method
|
137 |
+
*
|
138 |
+
* @return bool
|
139 |
+
*/
|
140 |
+
public function save()
|
141 |
+
{
|
142 |
+
$this->setTimestamp(date('d/m/Y h:i:sA T'));
|
143 |
+
$_request = $this->getRequest();
|
144 |
+
$_response = $this->getResponse();
|
145 |
+
$_controller = $this->getController();
|
146 |
+
if (!($_request !== null && $_response !== null && $_controller)) {
|
147 |
+
Mage::throwException(Mage::helper('shippingip')->__('Log data is not filled'));
|
148 |
+
}
|
149 |
+
// append if file exists, if not create new
|
150 |
+
return file_exists($this->getLogFilename()) ? $this->_append() : $this->_create();
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Clear log file method
|
155 |
+
*
|
156 |
+
* @return bool
|
157 |
+
*/
|
158 |
+
public function clear()
|
159 |
+
{
|
160 |
+
return $this->_clear();
|
161 |
+
}
|
162 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Carrier/Iparcel.php
CHANGED
@@ -2,105 +2,111 @@
|
|
2 |
/**
|
3 |
* i-parcel shipping method model
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
* refactor: add result check, add intermediate storage for parcel_id
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
{
|
105 |
try {
|
106 |
if (Mage::getStoreConfig('carriers/i-parcel/active')) {
|
@@ -113,36 +119,36 @@ class Iparcel_Shipping_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier
|
|
113 |
/* var $businessSettings stdClass */
|
114 |
|
115 |
// collect rates only if the business settings model is 2 or 3
|
116 |
-
|
117 |
isset($businessSettings->model) &&
|
118 |
in_array($businessSettings->model, array(2, 3))) {
|
119 |
$quote = Mage::helper('shippingip/api')->quote($request);
|
120 |
/* var $quote stdClass */
|
121 |
|
122 |
$serviceLevel = isset($quote->ServiceLevels) ?
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
foreach ($serviceLevel as $ci) {
|
147 |
// setting up values
|
148 |
$servicename = @$ci->ServiceLevelID;
|
@@ -151,22 +157,24 @@ class Iparcel_Shipping_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier
|
|
151 |
$tax = (float)@$ci->TaxCompanyCurrency;
|
152 |
$shipping = (float)@$ci->ShippingChargeCompanyCurrency;
|
153 |
|
154 |
-
|
155 |
-
|
156 |
// true if tax intercepting is disabled
|
157 |
|
158 |
$total = $tax_flag ? (float)($duty + $tax + $shipping) : (float)$shipping;
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
$shiplabel = $methods_names[$servicename];
|
163 |
$title = $tax_flag ?
|
164 |
Mage::helper('shippingip')
|
165 |
-
->__(
|
|
|
166 |
$shiplabel,
|
167 |
$this->_formatPrice($shipping),
|
168 |
$this->_formatPrice($duty),
|
169 |
-
$this->_formatPrice($tax)
|
|
|
170 |
$shiplabel;
|
171 |
|
172 |
$method = Mage::getModel('shipping/rate_result_method');
|
@@ -199,20 +207,21 @@ class Iparcel_Shipping_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier
|
|
199 |
Mage::logException($e);
|
200 |
}
|
201 |
return false;
|
202 |
-
|
203 |
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
207 |
|
208 |
-
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
|
214 |
-
|
215 |
-
|
216 |
|
217 |
/**
|
218 |
* @param float|int $price
|
@@ -225,16 +234,16 @@ class Iparcel_Shipping_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier
|
|
225 |
return $helper->formatPrice($price, false);
|
226 |
}
|
227 |
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
}
|
2 |
/**
|
3 |
* i-parcel shipping method model
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
10 |
+
{
|
11 |
+
protected $_code = 'i-parcel';
|
12 |
+
protected $_carrier = 'i-parcel';
|
13 |
+
protected $_trackingUrl = 'https://tracking.i-parcel.com/secure/track.aspx?track=';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Check if carrier has shipping label option available
|
17 |
+
*
|
18 |
+
* @return bool
|
19 |
+
*/
|
20 |
+
public function isShippingLabelsAvailable()
|
21 |
+
{
|
22 |
+
return true;
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Check if carrier has shipping tracking option available
|
27 |
+
*
|
28 |
+
* @return bool
|
29 |
+
*/
|
30 |
+
public function isTrackingAvailable()
|
31 |
+
{
|
32 |
+
return true;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Get info for track order page
|
37 |
+
*
|
38 |
+
* @param string $number
|
39 |
+
* @return Varien_Object
|
40 |
+
*/
|
41 |
+
public function getTrackingInfo($number)
|
42 |
+
{
|
43 |
+
return new Varien_Object(array(
|
44 |
+
'tracking' => $number,
|
45 |
+
'carrier_title' => $this->_carrier,
|
46 |
+
'url' => $this->_trackingUrl.$number
|
47 |
+
));
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Return container types of carrier
|
52 |
+
*
|
53 |
+
* @return array
|
54 |
+
*/
|
55 |
+
public function getContainerTypes(Varien_Object $params = null)
|
56 |
+
{
|
57 |
+
return array('DEFAULT' => Mage::helper('shippingip')->__('Default box'));
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Do request to shipment
|
62 |
+
*
|
63 |
+
* @param Mage_Shipping_Model_Shipment_Request $request
|
64 |
+
* @return Varien_Object
|
65 |
+
*/
|
66 |
+
public function requestToShipment(Mage_Shipping_Model_Shipment_Request $request)
|
67 |
+
{
|
68 |
+
$shipping = $request->getOrderShipment();
|
69 |
+
/* var $shipping Mage_Sales_Model_Order_Shipment */
|
70 |
+
$tracking = $shipping->getAllTracks();
|
71 |
+
if (empty($tracking)) {
|
72 |
+
Mage::throwException('Invalid Request To Shipment Call');
|
73 |
+
}
|
74 |
+
$tracking = $tracking[0];
|
75 |
+
/* var $tracking Mage_Sales_Model_Order_Shipment_Track */
|
76 |
+
|
77 |
+
// prepare label PDF
|
78 |
+
$pdf = new Zend_Pdf();
|
79 |
+
$number = $tracking->getNumber();
|
80 |
+
$pdfPage = $pdf->pages[] = new Zend_Pdf_Page(('162:75'));
|
81 |
+
$barcodeFont = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir('media').'/font/code128.ttf');
|
82 |
+
$courier = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
|
83 |
+
$pdfPage->setFont($courier, 10);
|
84 |
+
$pdfPage->drawText($number, 15, 10);
|
85 |
+
$pdfPage->setFont($barcodeFont, 40);
|
86 |
+
$pdfPage->drawText($number, 15, 25);
|
87 |
+
|
88 |
+
$info = array();
|
89 |
+
$info[] = array(
|
90 |
+
'label_content' => $pdf->render(),
|
91 |
+
'tracking_number' => $number
|
92 |
+
);
|
93 |
+
|
94 |
+
// prepare response
|
95 |
+
$response = new Varien_Object();
|
96 |
+
$response->setTrackingNumer($number);
|
97 |
+
$response->setInfo($info);
|
98 |
+
|
99 |
+
return $response;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Collect shipping rates for i-parcel shipping
|
104 |
* refactor: add result check, add intermediate storage for parcel_id
|
105 |
+
*
|
106 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
107 |
+
* @return Mage_Shipping_Model_Rate_Result|bool
|
108 |
+
*/
|
109 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
110 |
{
|
111 |
try {
|
112 |
if (Mage::getStoreConfig('carriers/i-parcel/active')) {
|
119 |
/* var $businessSettings stdClass */
|
120 |
|
121 |
// collect rates only if the business settings model is 2 or 3
|
122 |
+
if (/*true || */$businessSettings &&
|
123 |
isset($businessSettings->model) &&
|
124 |
in_array($businessSettings->model, array(2, 3))) {
|
125 |
$quote = Mage::helper('shippingip/api')->quote($request);
|
126 |
/* var $quote stdClass */
|
127 |
|
128 |
$serviceLevel = isset($quote->ServiceLevels) ?
|
129 |
+
$quote->ServiceLevels :
|
130 |
+
(object)array();
|
131 |
+
|
132 |
+
//$serviceLevel = (object)array(
|
133 |
+
//(object)array(
|
134 |
+
//'ServiceLevelID' => 'test1',
|
135 |
+
//'DutyCompanyCurrency' => '2.33',
|
136 |
+
//'TaxCompanyCurrency' => '3.33',
|
137 |
+
//'ShippingChargeCompanyCurrency' => '4.33'
|
138 |
+
//),
|
139 |
+
//(object)array(
|
140 |
+
//'ServiceLevelID' => 'test2',
|
141 |
+
//'DutyCompanyCurrency' => '3.33',
|
142 |
+
//'TaxCompanyCurrency' => '4.33',
|
143 |
+
//'ShippingChargeCompanyCurrency' => '5.33'
|
144 |
+
//)
|
145 |
+
//);
|
146 |
+
|
147 |
+
// Load shipping methods names
|
148 |
+
$methods_names = $this->getMethodsNames();
|
149 |
+
/* var $methods_names array */
|
150 |
+
|
151 |
+
// Handling serviceLevels results and set up the shipping method
|
152 |
foreach ($serviceLevel as $ci) {
|
153 |
// setting up values
|
154 |
$servicename = @$ci->ServiceLevelID;
|
157 |
$tax = (float)@$ci->TaxCompanyCurrency;
|
158 |
$shipping = (float)@$ci->ShippingChargeCompanyCurrency;
|
159 |
|
160 |
+
$tax_flag = Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::DISABLED
|
161 |
+
|| $request->getDestCountryId() == $request->getCountryId();
|
162 |
// true if tax intercepting is disabled
|
163 |
|
164 |
$total = $tax_flag ? (float)($duty + $tax + $shipping) : (float)$shipping;
|
165 |
+
if (!isset($methods_names[$servicename])) {
|
166 |
+
continue;
|
167 |
+
}
|
168 |
$shiplabel = $methods_names[$servicename];
|
169 |
$title = $tax_flag ?
|
170 |
Mage::helper('shippingip')
|
171 |
+
->__(
|
172 |
+
'%s (Shipping Price: %s Duty: %s Tax: %s)',
|
173 |
$shiplabel,
|
174 |
$this->_formatPrice($shipping),
|
175 |
$this->_formatPrice($duty),
|
176 |
+
$this->_formatPrice($tax)
|
177 |
+
) :
|
178 |
$shiplabel;
|
179 |
|
180 |
$method = Mage::getModel('shipping/rate_result_method');
|
207 |
Mage::logException($e);
|
208 |
}
|
209 |
return false;
|
210 |
+
}
|
211 |
|
212 |
+
public function getMethodsNames()
|
213 |
+
{
|
214 |
+
$names = array();
|
215 |
+
$raw = Mage::getStoreConfig('carriers/i-parcel/name');
|
216 |
|
217 |
+
$raw = unserialize($raw);
|
218 |
|
219 |
+
foreach ($raw as $method) {
|
220 |
+
$names[$method['service_id']] = $method['title'];
|
221 |
+
}
|
222 |
|
223 |
+
return $names;
|
224 |
+
}
|
225 |
|
226 |
/**
|
227 |
* @param float|int $price
|
234 |
return $helper->formatPrice($price, false);
|
235 |
}
|
236 |
|
237 |
+
/**
|
238 |
+
* Get Allowed Shipping Methods
|
239 |
+
*
|
240 |
+
* @return array
|
241 |
+
*/
|
242 |
+
public function getAllowedMethods()
|
243 |
+
{
|
244 |
+
return array(
|
245 |
+
'i-parcel' => $this->_carrier,
|
246 |
+
'auto' => 'Auto'
|
247 |
+
);
|
248 |
+
}
|
249 |
}
|
app/code/community/Iparcel/Shipping/Model/Catalog/Mapping.php
CHANGED
@@ -2,17 +2,18 @@
|
|
2 |
/**
|
3 |
* Model for catalog mapping cron
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Catalog_Mapping
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
17 |
}
|
18 |
-
?>
|
2 |
/**
|
3 |
* Model for catalog mapping cron
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Catalog_Mapping
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Method called by cron
|
13 |
+
*/
|
14 |
+
public function sync()
|
15 |
+
{
|
16 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection();
|
17 |
+
Mage::helper('shippingip/api')->submitCatalog($productCollection);
|
18 |
+
}
|
19 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Catalog/Product/Observer.php
CHANGED
@@ -2,62 +2,66 @@
|
|
2 |
/**
|
3 |
* Catalog_Product observer class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Catalog_Product_Observer
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
62 |
}
|
63 |
-
?>
|
2 |
/**
|
3 |
* Catalog_Product observer class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Catalog_Product_Observer
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Checking if catalog upload on product save is enabled
|
13 |
+
*
|
14 |
+
* @return bool
|
15 |
+
*/
|
16 |
+
protected function _isEnabled()
|
17 |
+
{
|
18 |
+
return Mage::getStoreConfig('catalog_mapping/config/auto_upload') == Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode::ON_UPDATE;
|
19 |
+
}
|
20 |
|
21 |
+
/**
|
22 |
+
* catalog_product_save_after event handler
|
23 |
+
*/
|
24 |
+
public function product_save($observer)
|
25 |
+
{
|
26 |
+
if ($this->_isEnabled()) {
|
27 |
+
$product = $observer->getProduct();
|
28 |
+
$productCollection = new Varien_Data_Collection();
|
29 |
+
$productCollection->addItem($product);
|
30 |
+
Mage::helper('shippingip/api')->submitCatalog($productCollection);
|
31 |
+
}
|
32 |
+
}
|
33 |
|
34 |
+
/**
|
35 |
+
* catalog_product_attribute_update_before event handler
|
36 |
+
*/
|
37 |
+
public function product_massUpdate($observer)
|
38 |
+
{
|
39 |
+
if ($this->_isEnabled()) {
|
40 |
+
$productIds = $observer->getProductIds();
|
41 |
+
$attributesData = $observer->getAttributesData();
|
42 |
+
$productCollection = new Varien_Data_Collection();
|
43 |
+
foreach ($productIds as $id) {
|
44 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
45 |
+
foreach ($attributesData as $code => $value) {
|
46 |
+
$product->setData($code, $value);
|
47 |
+
}
|
48 |
+
$productCollection->addItem($product);
|
49 |
+
}
|
50 |
+
Mage::helper('shippingip/api')->submitCatalog($productCollection);
|
51 |
+
}
|
52 |
+
}
|
53 |
|
54 |
+
/**
|
55 |
+
* catalog_product_delete_before event handler
|
56 |
+
*/
|
57 |
+
public function product_delete($observer)
|
58 |
+
{
|
59 |
+
if ($this->_isEnabled()) {
|
60 |
+
$product = $observer->getProduct();
|
61 |
+
$product->setIsDeleted(true);
|
62 |
+
$productCollection = new Varien_Data_Collection();
|
63 |
+
$productCollection->addItem($product);
|
64 |
+
Mage::helper('shippingip/api')->submitCatalog($productCollection);
|
65 |
+
}
|
66 |
+
}
|
67 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Config/Catalog/Mapping.php
CHANGED
@@ -2,67 +2,68 @@
|
|
2 |
/**
|
3 |
* Backend model of auto catalog updates config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Config_Catalog_Mapping extends Mage_Core_Model_Config_Data
|
10 |
-
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
}
|
67 |
-
?>
|
68 |
-
|
2 |
/**
|
3 |
* Backend model of auto catalog updates config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Catalog_Mapping extends Mage_Core_Model_Config_Data
|
10 |
+
{
|
11 |
+
const CRON_STRING_PATH = 'crontab/jobs/iparcel_catalog_mapping/schedule/cron_expr';
|
12 |
|
13 |
+
/**
|
14 |
+
* Getting i-parcel cron string path
|
15 |
+
*
|
16 |
+
* @return string
|
17 |
+
*/
|
18 |
+
protected function _getCron()
|
19 |
+
{
|
20 |
+
return Mage::getModel('core/config_data')->load(self::CRON_STRING_PATH, 'path');
|
21 |
+
}
|
22 |
|
23 |
+
/**
|
24 |
+
* Method called after config save
|
25 |
+
* Checking if value is cron and enabling/disabling cron
|
26 |
+
*/
|
27 |
+
protected function _afterSave()
|
28 |
+
{
|
29 |
+
if ($this->getValue() == Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode::CRON) {
|
30 |
+
$params = Mage::app()->getRequest()->getParams();
|
31 |
+
$params = $params["groups"]["config"]["fields"];
|
32 |
+
/* var $params array */
|
33 |
|
34 |
+
$freq = $params['cron_frequency']['value'];
|
35 |
+
$cron_expr = array();
|
36 |
+
$cron_expr[3] = '*';
|
37 |
+
switch ($freq) {
|
38 |
+
case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY:
|
39 |
+
$cron_expr[2] = $params['cron_monthday']['value'];
|
40 |
+
$cron_expr[4] = '*';
|
41 |
+
break;
|
42 |
+
case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY:
|
43 |
+
$cron_expr[4] = $params['cron_weekday']['value'];
|
44 |
+
$cron_expr[2] = '*';
|
45 |
+
}
|
46 |
+
$cron_expr[0] = $params['cron_minute']['value'];
|
47 |
+
$cron_expr[1] = $params['cron_hour']['value'];
|
48 |
|
49 |
+
ksort($cron_expr, SORT_NUMERIC);
|
50 |
+
$cron_expr = trim(implode(' ', $cron_expr));
|
51 |
|
52 |
+
try {
|
53 |
+
$this->_getCron()
|
54 |
+
->setValue($cron_expr)
|
55 |
+
->setPath(self::CRON_STRING_PATH)
|
56 |
+
->save();
|
57 |
+
} catch (Exception $e) {
|
58 |
+
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression'));
|
59 |
+
}
|
60 |
+
} else {
|
61 |
+
try {
|
62 |
+
$this->_getCron()
|
63 |
+
->delete();
|
64 |
+
} catch (Exception $e) {
|
65 |
+
throw new Exception(Mage::helper('cron')->__('Unable to remove the cron expression'));
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
}
|
|
|
|
app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Monthday.php
CHANGED
@@ -2,21 +2,22 @@
|
|
2 |
/**
|
3 |
* Backend model for monthday config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Config_Data_Date_Monthday extends Mage_Core_Model_Config_Data
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
}
|
22 |
-
?>
|
2 |
/**
|
3 |
* Backend model for monthday config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Data_Date_Monthday extends Mage_Core_Model_Config_Data
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Saving monthday if proper value
|
13 |
+
*/
|
14 |
+
public function save()
|
15 |
+
{
|
16 |
+
$_monthday = $this->getValue();
|
17 |
+
if (Mage::helper('shippingip/string')->isInteger($_monthday) && $_monthday<=31 && $_monthday>0) {
|
18 |
+
return parent::save();
|
19 |
+
} else {
|
20 |
+
Mage::throwException(Mage::helper('shippingip')->__('Wrong day of month'));
|
21 |
+
}
|
22 |
+
}
|
23 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Weekday.php
CHANGED
@@ -2,21 +2,22 @@
|
|
2 |
/**
|
3 |
* Backend model for weekday config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Config_Data_Date_Weekday extends Mage_Core_Model_Config_Data
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
}
|
22 |
-
?>
|
2 |
/**
|
3 |
* Backend model for weekday config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Data_Date_Weekday extends Mage_Core_Model_Config_Data
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Saving weekday if proper value
|
13 |
+
*/
|
14 |
+
public function save()
|
15 |
+
{
|
16 |
+
$_weekday = $this->getValue();
|
17 |
+
if (Mage::helper('shippingip/string')->isInteger($_weekday) && $_weekday<=7 && $_weekday>0) {
|
18 |
+
return parent::save();
|
19 |
+
} else {
|
20 |
+
Mage::throwException(Mage::helper('shippingip')->__('Wrong day of week'));
|
21 |
+
}
|
22 |
+
}
|
23 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Config/Data/Time/Hour.php
CHANGED
@@ -2,21 +2,22 @@
|
|
2 |
/**
|
3 |
* Backend model for time hour config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Config_Data_Time_Hour extends Mage_Core_Model_Config_Data
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
}
|
22 |
-
?>
|
2 |
/**
|
3 |
* Backend model for time hour config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Data_Time_Hour extends Mage_Core_Model_Config_Data
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Saving hour if proper value
|
13 |
+
*/
|
14 |
+
public function save()
|
15 |
+
{
|
16 |
+
$_hour = $this->getValue();
|
17 |
+
if (Mage::helper('shippingip/string')->isInteger($_hour) && $_hour<24 && $_hour>=0) {
|
18 |
+
return parent::save();
|
19 |
+
} else {
|
20 |
+
Mage::throwException(Mage::helper('shippingip')->__('Wrong hour'));
|
21 |
+
}
|
22 |
+
}
|
23 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Config/Data/Time/Minute.php
CHANGED
@@ -2,21 +2,22 @@
|
|
2 |
/**
|
3 |
* Backend model for time minute config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Config_Data_Time_Minute extends Mage_Core_Model_Config_Data
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
}
|
22 |
-
?>
|
2 |
/**
|
3 |
* Backend model for time minute config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Data_Time_Minute extends Mage_Core_Model_Config_Data
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Saving minute if proper value
|
13 |
+
*/
|
14 |
+
public function save()
|
15 |
+
{
|
16 |
+
$_minute = $this->getValue();
|
17 |
+
if (Mage::helper('shippingip/string')->isInteger($_minute) && $_minute<60 && $_minute>=0) {
|
18 |
+
return parent::save();
|
19 |
+
} else {
|
20 |
+
Mage::throwException(Mage::helper('shippingip')->__('Wrong minute'));
|
21 |
+
}
|
22 |
+
}
|
23 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Config/Guid.php
CHANGED
@@ -1,21 +1,22 @@
|
|
1 |
<?php
|
2 |
/** Backend model for i-parcel GUID config field
|
3 |
*
|
4 |
-
* @category
|
5 |
-
* @package
|
6 |
-
* @author
|
7 |
*/
|
8 |
-
class Iparcel_Shipping_Model_Config_Guid extends Mage_Core_Model_Config_Data
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
20 |
}
|
21 |
-
?>
|
1 |
<?php
|
2 |
/** Backend model for i-parcel GUID config field
|
3 |
*
|
4 |
+
* @category Iparcel
|
5 |
+
* @package Iparcel_Shipping
|
6 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
7 |
*/
|
8 |
+
class Iparcel_Shipping_Model_Config_Guid extends Mage_Core_Model_Config_Data
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Saving config if proper value
|
12 |
+
*/
|
13 |
+
public function save()
|
14 |
+
{
|
15 |
+
$_guid = $this->getValue();
|
16 |
+
if (preg_match('/^[0-9A-Z]{8}-([0-9A-Z]{4}-){3}[0-9A-Z]{12}$/i', $_guid)) {
|
17 |
+
return parent::save();
|
18 |
+
} else {
|
19 |
+
Mage::throwException(Mage::helper('shippingip')->__('Wrong GUID'));
|
20 |
+
}
|
21 |
+
}
|
22 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Config/Script/Js.php
CHANGED
@@ -1,90 +1,94 @@
|
|
1 |
-
<?php
|
2 |
/**
|
3 |
* Backend model for JavaScript file config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
class Iparcel_Shipping_Model_Config_Script_Js extends Mage_Adminhtml_Model_System_Config_Backend_File
|
10 |
{
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
90 |
}
|
1 |
+
<?php
|
2 |
/**
|
3 |
* Backend model for JavaScript file config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>, Maciej Jarmuła <maciej.jarmula@sabiosystem.com>
|
8 |
*/
|
9 |
class Iparcel_Shipping_Model_Config_Script_Js extends Mage_Adminhtml_Model_System_Config_Backend_File
|
10 |
{
|
11 |
+
const UPLOAD_ROOT = 'js';
|
12 |
+
const UPLOAD_DIR = 'iparcel_custom';
|
13 |
|
14 |
+
/**
|
15 |
+
* Method called before config save
|
16 |
+
* Unlinking old or deleted file
|
17 |
+
*/
|
18 |
+
protected function _beforeSave()
|
19 |
+
{
|
20 |
+
$uploadDir = $this->_getUploadDir();
|
21 |
|
22 |
+
$file = $uploadDir.'/'.$this->getValue();
|
23 |
|
24 |
+
// if it's delete action and file exists
|
25 |
+
if ($delete && file_exists($file)) {
|
26 |
+
unlink($file);
|
27 |
+
}
|
28 |
|
29 |
+
// if it's set new action and old file exists
|
30 |
+
$file = $uploadDir.'/'. $_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
|
31 |
+
if (file_exists($file)) {
|
32 |
+
unlink($file);
|
33 |
+
}
|
34 |
+
parent::_beforeSave();
|
35 |
+
}
|
36 |
|
37 |
+
/**
|
38 |
+
* Getting directory where scripts are uploaded
|
39 |
+
*
|
40 |
+
* @param string $field
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
public function getUploadDir($field)
|
44 |
+
{
|
45 |
+
$uploadDir = self::UPLOAD_DIR;
|
46 |
|
47 |
+
$uploadDir = $uploadDir.'/'.$field. '/';
|
48 |
+
return $uploadDir;
|
49 |
+
}
|
50 |
|
51 |
+
/**
|
52 |
+
* Getting directory wher to upload
|
53 |
+
*
|
54 |
+
* @return string
|
55 |
+
*/
|
56 |
+
protected function _getUploadDir()
|
57 |
+
{
|
58 |
+
$uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT);
|
59 |
+
$uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR.'/'.$this->getField());
|
60 |
|
61 |
+
$uploadDir = $uploadRoot .'/'. $uploadDir;
|
62 |
+
return $uploadDir;
|
63 |
+
}
|
64 |
|
65 |
+
/**
|
66 |
+
* Returning if scope info should be added
|
67 |
+
*
|
68 |
+
* @return bool
|
69 |
+
*/
|
70 |
+
protected function _addWhetherScopeInfo()
|
71 |
+
{
|
72 |
+
return true;
|
73 |
+
}
|
74 |
|
75 |
+
/**
|
76 |
+
* Returning array of proper extensions
|
77 |
+
*
|
78 |
+
* @return array
|
79 |
+
*/
|
80 |
+
protected function _getAllowedExtensions()
|
81 |
+
{
|
82 |
+
return array('js');
|
83 |
+
}
|
84 |
|
85 |
+
/**
|
86 |
+
* Getting upload root directory
|
87 |
+
*
|
88 |
+
* @return string
|
89 |
+
*/
|
90 |
+
protected function _getUploadRoot($token)
|
91 |
+
{
|
92 |
+
return Mage::getBaseDir()."/$token";
|
93 |
+
}
|
94 |
}
|
app/code/community/Iparcel/Shipping/Model/Cpf.php
CHANGED
@@ -1,37 +1,40 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Db model for cpfs' types
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Cpf extends Mage_Core_Model_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
36 |
}
|
37 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Db model for cpfs' types
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Cpf extends Mage_Core_Model_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing model in internal constructor
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/cpf');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Processing data before model save
|
21 |
+
*/
|
22 |
+
protected function _beforeSave()
|
23 |
+
{
|
24 |
+
$this->setCountryCode(strtoupper($this->getCountryCode()));
|
25 |
+
}
|
26 |
|
27 |
+
/**
|
28 |
+
* Load CPF by country code
|
29 |
+
*
|
30 |
+
* @param string $code, string $attributes
|
31 |
+
* @return Iparcel_Shipping_Model_Cpf
|
32 |
+
*/
|
33 |
+
public function loadByCountryCode($code, $attributes = '*')
|
34 |
+
{
|
35 |
+
$collection = $this->getResourceCollection()
|
36 |
+
->addFieldToSelect($attributes)
|
37 |
+
->addFieldToFilter('country_code', $code);
|
38 |
+
return $collection->getFirstItem();
|
39 |
+
}
|
40 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Cpf/Order.php
CHANGED
@@ -2,29 +2,31 @@
|
|
2 |
/**
|
3 |
* Db model for order's cpfs' values
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Cpf_Order extends Mage_Core_Model_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
29 |
}
|
30 |
-
?>
|
2 |
/**
|
3 |
* Db model for order's cpfs' values
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Cpf_Order extends Mage_Core_Model_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing model in internal constructor
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/cpf_order');
|
17 |
+
}
|
18 |
|
19 |
+
/**
|
20 |
+
* Load CPF by order_id
|
21 |
+
*
|
22 |
+
* @param int $orderId, string $fields='*'
|
23 |
+
* @return Iparcel_Shipping_Model_Cpf_Order
|
24 |
+
*/
|
25 |
+
public function loadByOrderId($orderId, $fields = '*')
|
26 |
+
{
|
27 |
+
return $this->getCollection()
|
28 |
+
->addFieldToSelect($fields)
|
29 |
+
->addFieldToFilter('order_id', $orderId)
|
30 |
+
->getFirstItem();
|
31 |
+
}
|
32 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Cpf/Quote.php
CHANGED
@@ -2,29 +2,31 @@
|
|
2 |
/**
|
3 |
* Db model for quote's cpfs' values
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Cpf_Quote extends Mage_Core_Model_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
29 |
}
|
30 |
-
?>
|
2 |
/**
|
3 |
* Db model for quote's cpfs' values
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Cpf_Quote extends Mage_Core_Model_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing model in internal constructor
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/cpf_quote');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Load CPF by quote_id
|
21 |
+
*
|
22 |
+
* @param int $quoteId, string $fields='*'
|
23 |
+
* @return Iparcel_Shipping_Model_Cpf_Quote
|
24 |
+
*/
|
25 |
+
public function loadByQuoteId($quoteId, $fields = '*')
|
26 |
+
{
|
27 |
+
return $this->getCollection()
|
28 |
+
->addFieldToSelect($fields)
|
29 |
+
->addFieldToFilter('quote_id', $quoteId)
|
30 |
+
->getFirstItem();
|
31 |
+
}
|
32 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Parcel.php
CHANGED
@@ -1,30 +1,32 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Db model for cpfs' types
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Parcel extends Mage_Core_Model_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
29 |
}
|
30 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Db model for cpfs' types
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Parcel extends Mage_Core_Model_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing model in internal constructor
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/parcel');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Load Parcel by Order ID
|
21 |
+
*
|
22 |
+
* @param string $orderId, string $attributes
|
23 |
+
* @return Iparcel_Shipping_Model_Cpf
|
24 |
+
*/
|
25 |
+
public function loadByOrderId($orderId, $attributes = '*')
|
26 |
+
{
|
27 |
+
$collection = $this->getResourceCollection()
|
28 |
+
->addFieldToSelect($attributes)
|
29 |
+
->addFieldToFilter('order_id', $orderId);
|
30 |
+
return $collection->getFirstItem();
|
31 |
+
}
|
32 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Payment/Iparcel.php
CHANGED
@@ -2,15 +2,15 @@
|
|
2 |
/**
|
3 |
* Class for i-parcel external sales API payment method
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Payment_Iparcel extends Mage_Payment_Model_Method_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
15 |
}
|
16 |
-
?>
|
2 |
/**
|
3 |
* Class for i-parcel external sales API payment method
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Payment_Iparcel extends Mage_Payment_Model_Method_Abstract
|
10 |
+
{
|
11 |
+
protected $_code = 'iparcel';
|
12 |
+
protected $_infoBlockType = 'shippingip/payment_info';
|
13 |
+
protected $_canUseCheckout = false;
|
14 |
+
protected $_canUseForMultishipping = false;
|
15 |
+
protected $_canUseInternal = false;
|
16 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf.php
CHANGED
@@ -2,16 +2,17 @@
|
|
2 |
/**
|
3 |
* Resource Model for Iparcel_Shipping_Model_Cpf class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Cpf extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
17 |
-
?>
|
2 |
/**
|
3 |
* Resource Model for Iparcel_Shipping_Model_Cpf class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/cpf', 'id');
|
17 |
+
}
|
18 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Collection.php
CHANGED
@@ -2,16 +2,17 @@
|
|
2 |
/**
|
3 |
* Resource Collection Model for Iparcel_Shipping_Model_Cpf class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Cpf_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
17 |
-
?>
|
2 |
/**
|
3 |
* Resource Collection Model for Iparcel_Shipping_Model_Cpf class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource Collection
|
13 |
+
*/
|
14 |
+
public function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/cpf');
|
17 |
+
}
|
18 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order.php
CHANGED
@@ -2,16 +2,17 @@
|
|
2 |
/**
|
3 |
* Resource Model for Iparcel_Shipping_Model_Cpf_Order class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Cpf_Order extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
17 |
-
?>
|
2 |
/**
|
3 |
* Resource Model for Iparcel_Shipping_Model_Cpf_Order class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf_Order extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/cpf_order', 'id');
|
17 |
+
}
|
18 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order/Collection.php
CHANGED
@@ -2,16 +2,17 @@
|
|
2 |
/**
|
3 |
* Resource Collection Model for Iparcel_Shipping_Model_Cpf_Order class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Cpf_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
17 |
-
?>
|
2 |
/**
|
3 |
* Resource Collection Model for Iparcel_Shipping_Model_Cpf_Order class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource Collection
|
13 |
+
*/
|
14 |
+
public function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/cpf_order');
|
17 |
+
}
|
18 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote.php
CHANGED
@@ -2,16 +2,17 @@
|
|
2 |
/**
|
3 |
* Resource Model for Iparcel_Shipping_Model_Cpf_Quote class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Cpf_Quote extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
17 |
-
?>
|
2 |
/**
|
3 |
* Resource Model for Iparcel_Shipping_Model_Cpf_Quote class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf_Quote extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/cpf_quote', 'id');
|
17 |
+
}
|
18 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote/Collection.php
CHANGED
@@ -2,16 +2,17 @@
|
|
2 |
/**
|
3 |
* Resource Collection Model for Iparcel_Shipping_Model_Cpf_Quote class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Cpf_Quote_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
17 |
-
?>
|
2 |
/**
|
3 |
* Resource Collection Model for Iparcel_Shipping_Model_Cpf_Quote class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf_Quote_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource Collection
|
13 |
+
*/
|
14 |
+
public function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/cpf_quote');
|
17 |
+
}
|
18 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Parcel.php
CHANGED
@@ -2,16 +2,17 @@
|
|
2 |
/**
|
3 |
* Resource Model for Iparcel_Shipping_Model_Cpf class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Parcel extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
17 |
-
?>
|
2 |
/**
|
3 |
* Resource Model for Iparcel_Shipping_Model_Cpf class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Parcel extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/parcel', 'id');
|
17 |
+
}
|
18 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Parcel/Collection.php
CHANGED
@@ -2,16 +2,17 @@
|
|
2 |
/**
|
3 |
* Resource Collection Model for Iparcel_Shipping_Model_Cpf class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Parcel_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
17 |
-
?>
|
2 |
/**
|
3 |
* Resource Collection Model for Iparcel_Shipping_Model_Cpf class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Parcel_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource Collection
|
13 |
+
*/
|
14 |
+
public function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/parcel');
|
17 |
+
}
|
18 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Setup.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
* Setup Resource class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
|
|
|
10 |
}
|
11 |
-
?>
|
1 |
<?php
|
2 |
+
/**
|
3 |
* Setup Resource class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
|
10 |
+
{
|
11 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals.php
CHANGED
@@ -2,16 +2,17 @@
|
|
2 |
/**
|
3 |
* Resource Model for Iparcel_Shipping_Model_Tax_Totals class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Tax_Totals extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
17 |
-
?>
|
2 |
/**
|
3 |
* Resource Model for Iparcel_Shipping_Model_Tax_Totals class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Tax_Totals extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/tax_totals', 'id');
|
17 |
+
}
|
18 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals/Collection.php
CHANGED
@@ -2,16 +2,17 @@
|
|
2 |
/**
|
3 |
* Resource Collection Model for Iparcel_Shipping_Model_Tax_Totals class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Resource_Tax_Totals_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
17 |
-
?>
|
2 |
/**
|
3 |
* Resource Collection Model for Iparcel_Shipping_Model_Tax_Totals class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Tax_Totals_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource Collection
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/tax_totals');
|
17 |
+
}
|
18 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Sales/Order.php
CHANGED
@@ -2,22 +2,23 @@
|
|
2 |
/**
|
3 |
* Rewrite of Mage_Sales_Model_Order for i-parcel extension
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Sales_Order extends Mage_Sales_Model_Order
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
}
|
23 |
-
?>
|
2 |
/**
|
3 |
* Rewrite of Mage_Sales_Model_Order for i-parcel extension
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Sales_Order extends Mage_Sales_Model_Order
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Check order state before saving
|
13 |
+
*
|
14 |
+
* @return Iparcel_Shipping_Model_Sales_Order
|
15 |
+
*/
|
16 |
+
protected function _checkState()
|
17 |
+
{
|
18 |
+
if (Mage::registry('isExternalSale') && Mage::getStoreConfig('external_api/sales/order_status') != Mage_Sales_Model_Order::STATE_COMPLETE) {
|
19 |
+
return $this;
|
20 |
+
} else {
|
21 |
+
return parent::_checkState();
|
22 |
+
}
|
23 |
+
}
|
24 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Sales/Order/Observer.php
CHANGED
@@ -2,238 +2,256 @@
|
|
2 |
/**
|
3 |
* Sales_Order observer class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Sales_Order_Observer
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
|
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
179 |
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
|
|
195 |
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
|
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
|
|
228 |
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
|
|
237 |
|
238 |
/**
|
239 |
* sales_order_place_after event handler
|
@@ -244,6 +262,6 @@ class Iparcel_Shipping_Model_Sales_Order_Observer{
|
|
244 |
/** @var Mage_Sales_Model_Order $order */
|
245 |
$order = $observer->getOrder();
|
246 |
$this->_createShipment($order);
|
247 |
-
|
248 |
}
|
249 |
}
|
2 |
/**
|
3 |
* Sales_Order observer class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Sales_Order_Observer
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing CPF
|
13 |
+
*
|
14 |
+
* @param Mage_Sales_Model_Order $order
|
15 |
+
*/
|
16 |
+
protected function _initCpf($order)
|
17 |
+
{
|
18 |
+
$cpf = Mage::getModel('shippingip/cpf_order')->loadByOrderId($order->getId());
|
19 |
+
/* var $cpf Iparcel_Shippingip_Model_Cpf_Order */
|
20 |
+
if ($cpf->getId()) {
|
21 |
+
$order->setCpf($cpf->getValue());
|
22 |
+
}
|
23 |
+
}
|
24 |
|
25 |
+
/**
|
26 |
+
* Initializing Parcel
|
27 |
+
*
|
28 |
+
* @param Mage_Sales_Model_Order $order
|
29 |
+
*/
|
30 |
+
protected function _initParcel($order)
|
31 |
+
{
|
32 |
+
$parcel = Mage::getModel('shippingip/parcel')->loadByOrderId($order->getId());
|
33 |
+
if ($parcel->getParcelId()) {
|
34 |
+
$order->setParcel($parcel->getParcelId());
|
35 |
+
}
|
36 |
+
}
|
37 |
|
38 |
+
/**
|
39 |
+
* Searching for traching number in order comments
|
40 |
+
*
|
41 |
+
* @param Mage_Sales_Model_Order $order
|
42 |
+
* @return Mage_Sales_Model_Order_Status_History
|
43 |
+
*/
|
44 |
+
protected function _searchForTrackingNumber($order)
|
45 |
+
{
|
46 |
+
foreach ($order->getStatusHistoryCollection() as $status) {
|
47 |
+
/* var $status Mage_Sales_Model_Order_Status_History */
|
48 |
+
if (preg_match('/^i-parcel tracking number: ([0-9A-Z]+)$/', $status->getComment()) == 1) {
|
49 |
+
return $status;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
return null;
|
53 |
+
}
|
54 |
|
55 |
+
/**
|
56 |
+
* Creating shipment for an order
|
57 |
+
*
|
58 |
+
* @param Mage_Sales_Model_Order $order
|
59 |
+
*/
|
60 |
+
protected function _createShipment($order)
|
61 |
+
{
|
62 |
+
if (!$order->getQuote()) {
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
// if it's i-parcel shipping method
|
66 |
+
if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() != 'i-parcel') {
|
67 |
+
return;
|
68 |
+
}
|
69 |
+
if (!Mage::registry('isExternalSale') && Mage::getStoreConfigFlag('iparcel/config/submit_parcel')) {
|
70 |
+
/* var $submitParcel stdClass */
|
71 |
+
$submitParcel = Mage::helper('shippingip/api')->submitParcel($order);
|
72 |
+
if ($submitParcel && isset($submitParcel->ParcelID)) {
|
73 |
+
Mage::getSingleton('checkout/session')->setParcelId($submitParcel->ParcelID);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
$tracking = Mage::getSingleton('checkout/session')->getTrackingNumber();
|
77 |
+
if (!$tracking && isset($submitParcel)) {
|
78 |
+
$tracking = @$submitParcel->CarrierTrackingNumber;
|
79 |
+
}
|
80 |
+
/* var $tracking string */
|
81 |
+
if ($tracking && !$this->_searchForTrackingNumber($order)) {
|
82 |
+
$order->addStatusHistoryComment('i-parcel tracking number: '.$tracking);
|
83 |
+
}
|
84 |
+
// if autoship is enabled and order can be shipped
|
85 |
+
if (Mage::getStoreConfigFlag('carriers/i-parcel/autoship')) {
|
86 |
+
if ($order->canShip()) {
|
87 |
+
$converter = Mage::getModel('sales/convert_order');
|
88 |
+
/* var $converter Mage_Sales_Model_Convert_Order */
|
89 |
+
$shipment = $converter->toShipment($order);
|
90 |
+
/* var $shipment Mage_Sales_Model_Order_Shipment */
|
91 |
+
foreach ($order->getAllItems() as $orderItem) {
|
92 |
+
/* var $orderItem Mage_Sales_Model_Order_Item */
|
93 |
+
// continue if it is virtual or there is no quantity to ship
|
94 |
+
if (!$orderItem->getQtyToShip()) {
|
95 |
+
continue;
|
96 |
+
}
|
97 |
+
if ($order->getIsVirtual()) {
|
98 |
+
continue;
|
99 |
+
}
|
100 |
+
$item = $converter->itemToShipmentItem($orderItem);
|
101 |
+
/* var $item Mage_Sales_Model_Order_Shipment_Item */
|
102 |
+
$item->setQty($orderItem->getQtyToShip());
|
103 |
+
$shipment->addItem($item);
|
104 |
+
}
|
105 |
+
$shipment->register();
|
106 |
+
$shipment->getOrder()->setIsInProcess(true);
|
107 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
108 |
+
->addObject($shipment)
|
109 |
+
->addObject($order);
|
110 |
+
/* var $transactionSave Mage_Core_Model_Resource_Transaction */
|
111 |
+
$transactionSave->save();
|
112 |
+
$shipment->save();
|
113 |
+
$shipment->sendEmail();
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
|
118 |
+
/**
|
119 |
+
* Creating CPF for an order
|
120 |
+
*
|
121 |
+
* @param Mage_Sales_Model_Order $order
|
122 |
+
*/
|
123 |
+
protected function _createCpf($order)
|
124 |
+
{
|
125 |
+
if ($quote = $order->getQuote()) {
|
126 |
+
/* var $quote Mage_Sales_Model_Quote */
|
127 |
+
$cpf = Mage::getModel('shippingip/cpf_order')->loadByOrderId($order->getId());
|
128 |
+
/* var $cpf Iparcel_Shipping_Model_Cpf_Order */
|
129 |
+
// create CPF for order if quote has CPF
|
130 |
+
if ($quote->getCpf()) {
|
131 |
+
$cpf->setOrderId($order->getId());
|
132 |
+
$cpf->setValue($quote->getCpf());
|
133 |
+
$cpf->save();
|
134 |
+
} elseif ($cpf->getId()) {
|
135 |
+
$cpf->delete();
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
|
140 |
+
/**
|
141 |
+
* Creating Parcel for an order
|
142 |
+
*
|
143 |
+
* @param Mage_Sales_Model_Order $order
|
144 |
+
*/
|
145 |
+
protected function _createParcel($order, $parcel_id)
|
146 |
+
{
|
147 |
+
$parcel = Mage::getModel('shippingip/parcel')
|
148 |
+
->setOrderId($order->getId())
|
149 |
+
->setParcelId($parcel_id);
|
150 |
+
$parcel->save();
|
151 |
+
}
|
152 |
|
153 |
+
/**
|
154 |
+
* Saving Shipping Tax&Duty Totals
|
155 |
+
*
|
156 |
+
* @param Mage_Sales_Model_Order $order
|
157 |
+
*/
|
158 |
+
protected function _saveTaxDuty($order)
|
159 |
+
{
|
160 |
+
$session = Mage::getSingleton('checkout/session');
|
161 |
+
/* var $custSess Mage_Customer_Model_Session */
|
162 |
+
$_taxduty = $session->getTaxDutyTotal();
|
163 |
+
/* var $_taxduty array */
|
164 |
+
$session->unsTaxDutyTotal();
|
165 |
+
if ($_taxduty && $order->getShippingCarrier()->getCarrierCode() == 'i-parcel') {
|
166 |
+
try {
|
167 |
+
$taxduty = Mage::getModel('shippingip/tax_totals');
|
168 |
+
$taxduty->setMode($_taxduty['mode']);
|
169 |
+
$taxduty->setOrderId($order->getId());
|
170 |
+
$taxduty->setTax($_taxduty['tax']);
|
171 |
+
$taxduty->setDuty($_taxduty['duty']);
|
172 |
+
$taxduty->save();
|
173 |
+
} catch (Exception $e) {
|
174 |
+
Mage::logException($e);
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
|
179 |
+
/**
|
180 |
+
* Processing Shipping Tax&Duty Totals
|
181 |
+
* Setting correct order grand_total
|
182 |
+
*
|
183 |
+
* @param Mage_Sales_Model_Order $order
|
184 |
+
*/
|
185 |
+
protected function _processTaxDuty($order)
|
186 |
+
{
|
187 |
+
$_taxduty = Mage::getSingleton('checkout/session')->getTaxDutyTotal();
|
188 |
+
/* var $_taxduty array */
|
189 |
+
$order->setBaseGrandTotal($order->getBaseGrandTotal()+$_taxduty['tax']+$_taxduty['duty']);
|
190 |
+
$order->setGrandTotal($order->getGrandTotal()+$_taxduty['tax']+$_taxduty['duty']);
|
191 |
+
}
|
192 |
|
193 |
+
/**
|
194 |
+
* Setting order prefix for an order
|
195 |
+
*
|
196 |
+
* @param Mage_Sales_Model_Order $order
|
197 |
+
*/
|
198 |
+
protected function _setOrderPrefix($order)
|
199 |
+
{
|
200 |
+
// if prefix is specified and shipping carrier is i-parcel
|
201 |
+
if (Mage::getStoreConfig('carriers/i-parcel/prefix') && $order->getShippingCarrier()->getCarrierCode() == 'i-parcel') {
|
202 |
+
// and there's no prefix at the beginning
|
203 |
+
if (strpos($order->getIncrementId(), Mage::getStoreConfig('carriers/i-parcel/prefix')) !== 0) {
|
204 |
+
// add prefix at the beginning of increment ID
|
205 |
+
$order->setIncrementId(Mage::getStoreConfig('carriers/i-parcel/prefix').$order->getIncrementId());
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
|
210 |
+
/**
|
211 |
+
* Handling external sales API orders
|
212 |
+
* Setting choosen order status
|
213 |
+
*
|
214 |
+
* @param Mage_Sales_Model_Order $order
|
215 |
+
*/
|
216 |
+
protected function _handleExternal($order)
|
217 |
+
{
|
218 |
+
// if external sale is registered and choosen order status is not STATE_COMPLETE
|
219 |
+
if (Mage::registry('isExternalSale') && ($status=Mage::getStoreConfig('external_api/sales/order_status')) != Mage_Sales_Model_Order::STATE_COMPLETE) {
|
220 |
+
// set new state
|
221 |
+
$order->setState($status, $status);
|
222 |
+
}
|
223 |
+
}
|
224 |
|
225 |
+
/**
|
226 |
+
* sales_order_save_before event handler
|
227 |
+
*/
|
228 |
+
public function before_save($observer)
|
229 |
+
{
|
230 |
+
$order = $observer->getOrder();
|
231 |
+
$this->_setOrderPrefix($order);
|
232 |
+
$this->_processTaxDuty($order);
|
233 |
+
$this->_handleExternal($order);
|
234 |
+
}
|
235 |
|
236 |
+
/**
|
237 |
+
* sales_order_save_after event handler
|
238 |
+
*/
|
239 |
+
public function after_save($observer)
|
240 |
+
{
|
241 |
+
$order = $observer->getOrder();
|
242 |
+
$this->_saveTaxDuty($order);
|
243 |
+
$this->_createCpf($order);
|
244 |
+
}
|
245 |
|
246 |
+
/**
|
247 |
+
* sales_order_load_after event handler
|
248 |
+
*/
|
249 |
+
public function after_load($observer)
|
250 |
+
{
|
251 |
+
$order = $observer->getOrder();
|
252 |
+
$this->_initCpf($order);
|
253 |
+
$this->_initParcel($order);
|
254 |
+
}
|
255 |
|
256 |
/**
|
257 |
* sales_order_place_after event handler
|
262 |
/** @var Mage_Sales_Model_Order $order */
|
263 |
$order = $observer->getOrder();
|
264 |
$this->_createShipment($order);
|
265 |
+
$this->_createParcel($order, Mage::getSingleton('checkout/session')->getParcelId());
|
266 |
}
|
267 |
}
|
app/code/community/Iparcel/Shipping/Model/Sales/Order/Shipment/Observer.php
CHANGED
@@ -2,76 +2,80 @@
|
|
2 |
/**
|
3 |
* Sales_Order_Shipment observer class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Sales_Order_Shipment_Observer
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
76 |
}
|
77 |
-
?>
|
2 |
/**
|
3 |
* Sales_Order_Shipment observer class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Sales_Order_Shipment_Observer
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Getting tracking number from order's comments
|
13 |
+
*
|
14 |
+
* @param Mage_Sales_Model_Order $order
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function _getTrackingNumber($order)
|
18 |
+
{
|
19 |
+
$trackingNumber = '';
|
20 |
+
foreach ($order->getStatusHistoryCollection() as $status) {
|
21 |
+
preg_replace_callback('/^i-parcel tracking number: ([0-9A-Z]+)$/', function ($matches) use (&$trackingNumber) {
|
22 |
+
$trackingNumber = $matches[1];
|
23 |
+
}, $status->getComment());
|
24 |
+
}
|
25 |
+
return $trackingNumber;
|
26 |
+
}
|
27 |
|
28 |
+
/**
|
29 |
+
* Creating shipping label
|
30 |
+
*
|
31 |
+
* @param Mage_Sales_Model_Order_Shipment $shipment
|
32 |
+
*/
|
33 |
+
protected function _createShippingLabel($shipment)
|
34 |
+
{
|
35 |
+
$request = Mage::getModel('shipping/shipment_request');
|
36 |
+
/* var $request Mage_Shipping_Model_Shipment_Request */
|
37 |
+
$request->setOrderShipment($shipment);
|
38 |
+
$response = $shipment->getOrder()->getShippingCarrier()->requestToShipment($request);
|
39 |
+
$info = $response->getInfo();
|
40 |
+
$pdfContent = $info[0]['label_content'];
|
41 |
|
42 |
+
// parse PDF content
|
43 |
+
$outputPdf = new Zend_Pdf();
|
44 |
+
$outputPdf = Zend_Pdf::parse($pdfContent);
|
45 |
+
$shipment->setShippingLabel($outputPdf->render());
|
46 |
+
}
|
47 |
|
48 |
+
/**
|
49 |
+
* Creating tracking
|
50 |
+
*
|
51 |
+
* @param Mage_Sales_Model_Order_Shipment $shipment
|
52 |
+
*/
|
53 |
+
protected function _createTracking($shipment)
|
54 |
+
{
|
55 |
+
// do nothing if shipment has any tracks
|
56 |
+
if (count($shipment->getAllTracks())) {
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
$trackingNumber = $this->_getTrackingNumber($shipment->getOrder());
|
60 |
+
if ($trackingNumber != '') {
|
61 |
+
$tracking = Mage::getModel('sales/order_shipment_track')
|
62 |
+
->setNumber($trackingNumber)
|
63 |
+
->setCarrierCode('i-parcel')
|
64 |
+
->setTitle('i-parcel');
|
65 |
+
/* var $tracking Mage_Sales_Model_Order_Shipment_Track */
|
66 |
+
$shipment->addTrack($tracking);
|
67 |
+
$this->_createShippingLabel($shipment);
|
68 |
+
}
|
69 |
+
}
|
70 |
|
71 |
+
/**
|
72 |
+
* sales_order_shipment_save_before event handler
|
73 |
+
*/
|
74 |
+
public function before_save($observer)
|
75 |
+
{
|
76 |
+
$shipment = $observer->getShipment();
|
77 |
+
if ($shipment->getOrder()->getShippingCarrier() && $shipment->getOrder()->getShippingCarrier()->getCarrierCode() == 'i-parcel') {
|
78 |
+
$this->_createTracking($shipment);
|
79 |
+
}
|
80 |
+
}
|
81 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Sales/Quote/Observer.php
CHANGED
@@ -2,59 +2,62 @@
|
|
2 |
/**
|
3 |
* Sales_Quote observer class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Sales_Quote_Observer
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
59 |
}
|
60 |
-
?>
|
2 |
/**
|
3 |
* Sales_Quote observer class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Sales_Quote_Observer
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* sales_quote_save_before event handler
|
13 |
+
*/
|
14 |
+
public function before_save($observer)
|
15 |
+
{
|
16 |
+
$quote = $observer->getQuote();
|
17 |
+
/* var $quote Mage_Sales_Model_Quote */
|
18 |
+
$_post = Mage::app()->getFrontController()->getRequest()->getPost();
|
19 |
+
// adding CPF field to quote
|
20 |
+
if (isset($_post['shipping']) && isset($_post['shipping']['cpf'])) {
|
21 |
+
$_cpf = $_post['shipping']['cpf'];
|
22 |
+
} elseif (isset($_post['billing']) && isset($_post['billing']['cpf'])) {
|
23 |
+
$_cpf = $_post['billing']['cpf'];
|
24 |
+
} else {
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
$quote->setCpf($_cpf);
|
28 |
+
}
|
29 |
|
30 |
+
/**
|
31 |
+
* sales_quote_save_after event handler
|
32 |
+
*/
|
33 |
+
public function after_save($observer)
|
34 |
+
{
|
35 |
+
$quote = $observer->getQuote();
|
36 |
+
/* var $quote Mage_Sales_Model_Quote */
|
37 |
+
// creating CPF for quote
|
38 |
+
$cpf = Mage::getModel('shippingip/cpf_quote')->loadByQuoteId($quote->getId());
|
39 |
+
/* var $cpf Iparcel_Shipping_Model_Cpf_Quote */
|
40 |
+
if ($quote->getCpf() !== null) {
|
41 |
+
$cpf->setQuoteId($quote->getId());
|
42 |
+
$cpf->setValue($quote->getCpf());
|
43 |
+
$cpf->save();
|
44 |
+
} elseif ($cpf->getId()) {
|
45 |
+
$cpf->delete();
|
46 |
+
}
|
47 |
+
}
|
48 |
|
49 |
+
/**
|
50 |
+
* sales_quote_load_after event handler
|
51 |
+
*/
|
52 |
+
public function after_load($observer)
|
53 |
+
{
|
54 |
+
$quote = $observer->getQuote();
|
55 |
+
/* var $quote Mage_Sales_Model_Quote */
|
56 |
+
// appending existing cpf to loaded quote
|
57 |
+
$cpf = Mage::getModel('shippingip/cpf_quote')->loadByQuoteId($quote->getId());
|
58 |
+
/* var $cpf Iparcel_Shipping_Model_Cpf_Quote */
|
59 |
+
if ($cpf->getId()) {
|
60 |
+
$quote->setCpf($cpf->getValue());
|
61 |
+
}
|
62 |
+
}
|
63 |
}
|
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Mapping/Configurable/Price.php
CHANGED
@@ -2,24 +2,25 @@
|
|
2 |
/**
|
3 |
* Source model for catalog_mapping/attributes/price config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Configurable_Price
|
10 |
-
|
11 |
-
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
24 |
}
|
25 |
-
?>
|
2 |
/**
|
3 |
* Source model for catalog_mapping/attributes/price config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Configurable_Price
|
10 |
+
{
|
11 |
+
const CONFIGURABLE = "0";
|
12 |
+
const SIMPLE = "1";
|
13 |
|
14 |
+
/**
|
15 |
+
* Options list
|
16 |
+
*
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
public function toOptionArray()
|
20 |
+
{
|
21 |
+
return array(
|
22 |
+
array('value' => self::CONFIGURABLE, 'label' => Mage::helper('shippingip')->__("Parent product's price")),
|
23 |
+
array('value' => self::SIMPLE, 'label' => Mage::helper('shippingip')->__("Default"))
|
24 |
+
);
|
25 |
+
}
|
26 |
}
|
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Mapping/Mode.php
CHANGED
@@ -2,26 +2,27 @@
|
|
2 |
/**
|
3 |
* Source model for catalog_mapping/config/auto_upload config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
26 |
}
|
27 |
-
?>
|
2 |
/**
|
3 |
* Source model for catalog_mapping/config/auto_upload config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode
|
10 |
+
{
|
11 |
+
const DISABLED = "0";
|
12 |
+
const ON_UPDATE = "1";
|
13 |
+
const CRON = "2";
|
14 |
|
15 |
+
/**
|
16 |
+
* Options list
|
17 |
+
*
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function toOptionArray()
|
21 |
+
{
|
22 |
+
return array(
|
23 |
+
array('value' => self::DISABLED, 'label' => Mage::helper('shippingip')->__('Disabled')),
|
24 |
+
array('value' => self::ON_UPDATE, 'label' => Mage::helper('shippingip')->__('On product save')),
|
25 |
+
array('value' => self::CRON, 'label' => Mage::helper('shippingip')->__('Cron job'))
|
26 |
+
);
|
27 |
+
}
|
28 |
}
|
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Product/Attribute.php
CHANGED
@@ -2,29 +2,30 @@
|
|
2 |
/**
|
3 |
* Source model class for backend config fields with product atributes list
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Product_Attribute
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
29 |
}
|
30 |
-
?>
|
2 |
/**
|
3 |
* Source model class for backend config fields with product atributes list
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Product_Attribute
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Options list
|
13 |
+
*
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function toOptionArray()
|
17 |
+
{
|
18 |
+
$_attributeCollection = Mage::getResourceModel('catalog/product_attribute_collection')->addVisibleFilter();
|
19 |
+
/* var $_attributeCollection Mage_Catalog_Model_Resource_Product_Attribute_Collecton */
|
20 |
+
$attributeCollection = array(array('value' => 0, 'label' => '<empty>'));
|
21 |
+
foreach ($_attributeCollection as $_attribute) {
|
22 |
+
/* var $_attribute Mage_Catalog_Model_Product_Attribute_Collection */
|
23 |
+
$label = $_attribute->getFrontendLabel();
|
24 |
+
$attributeCollection[] = array(
|
25 |
+
'value' => $_attribute->getAttributeId(),
|
26 |
+
'label' => (empty($label)) ? Mage::helper('catalog')->__($_attribute->getAttributeCode()) : Mage::helper('catalog')->__($label)
|
27 |
+
);
|
28 |
+
}
|
29 |
+
return $attributeCollection;
|
30 |
+
}
|
31 |
}
|
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Product/Attribute/Boolean.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Source model class for backend config fields with boolean product atributes
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Product_Attribute_Boolean
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
31 |
}
|
32 |
-
?>
|
33 |
-
|
2 |
/**
|
3 |
* Source model class for backend config fields with boolean product atributes
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Product_Attribute_Boolean
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Options list
|
13 |
+
*
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function toOptionArray()
|
17 |
+
{
|
18 |
+
$_attributeCollection = Mage::getResourceModel('catalog/product_attribute_collection')
|
19 |
+
->addVisibleFilter()
|
20 |
+
->addFieldToFilter('frontend_input', 'boolean');
|
21 |
+
/* var $_attributeCollection Mage_Catalog_Model_Resource_Product_Attribute_Collection */
|
22 |
+
$attributeCollection = array(array('value' => 0, 'label' => '<empty>'));
|
23 |
+
foreach ($_attributeCollection as $_attribute) {
|
24 |
+
/* var $_attribute Mage_Catalog_Model_Product_Attribute */
|
25 |
+
$label = $_attribute->getFrontendLabel();
|
26 |
+
$attributeCollection[] = array(
|
27 |
+
'value' => $_attribute->getAttributeId(),
|
28 |
+
'label' => (empty($label)) ? Mage::helper('catalog')->__($_attribute->getAttributeCode()) : Mage::helper('catalog')->__($label)
|
29 |
+
);
|
30 |
+
}
|
31 |
+
return $attributeCollection;
|
32 |
+
}
|
33 |
}
|
|
|
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Date/Weekday.php
CHANGED
@@ -2,28 +2,29 @@
|
|
2 |
/**
|
3 |
* Source model for catalog_mapping/config/cron_weekday config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
-
*/
|
9 |
-
class Iparcel_Shipping_Model_System_Config_Source_Date_Weekday
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
}
|
29 |
-
?>
|
2 |
/**
|
3 |
* Source model for catalog_mapping/config/cron_weekday config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Date_Weekday
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Options list
|
13 |
+
*
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function toOptionArray()
|
17 |
+
{
|
18 |
+
$array = array();
|
19 |
+
for ($i=1; $i<8; $i++) {
|
20 |
+
$time = mktime(0, 0, 0, 1, $i, 1970);
|
21 |
+
$dayofweek = date('N', $time);
|
22 |
+
$array[$dayofweek] = array(
|
23 |
+
'value' => $dayofweek,
|
24 |
+
'label' => Mage::helper('shippingip')->__(date('l', $time))
|
25 |
+
);
|
26 |
+
}
|
27 |
+
ksort($array, SORT_NUMERIC);
|
28 |
+
return $array;
|
29 |
+
}
|
30 |
}
|
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Sales/Order/Status.php
CHANGED
@@ -2,22 +2,23 @@
|
|
2 |
/**
|
3 |
* Source model class for external_api/sales/order_status config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
-
*/
|
9 |
-
class Iparcel_Shipping_Model_System_Config_Source_Sales_Order_Status
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
}
|
23 |
-
?>
|
2 |
/**
|
3 |
* Source model class for external_api/sales/order_status config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Sales_Order_Status
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Options list
|
13 |
+
*
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function toOptionArray()
|
17 |
+
{
|
18 |
+
return array(
|
19 |
+
array('value' => Mage_Sales_Model_Order::STATE_COMPLETE, 'label' => Mage::helper('shippingip')->__('Complete')),
|
20 |
+
array('value' => 'pending', 'label' => Mage::helper('shippingip')->__('Pending')),
|
21 |
+
array('value' => Mage_Sales_Model_Order::STATE_PROCESSING, 'label' => Mage::helper('shippingip')->__('Processing'))
|
22 |
+
);
|
23 |
+
}
|
24 |
}
|
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Tax/Mode.php
CHANGED
@@ -2,26 +2,27 @@
|
|
2 |
/**
|
3 |
* Source model for iparcel/tax/mode config field
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_System_Config_Source_Tax_Mode
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
26 |
}
|
27 |
-
?>
|
2 |
/**
|
3 |
* Source model for iparcel/tax/mode config field
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Tax_Mode
|
10 |
+
{
|
11 |
+
const DISABLED = "0";
|
12 |
+
const CUMULATIVELY = "1";
|
13 |
+
const SEPARATELY = "2";
|
14 |
|
15 |
+
/**
|
16 |
+
* Options list
|
17 |
+
*
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function toOptionArray()
|
21 |
+
{
|
22 |
+
return array(
|
23 |
+
array('value' => self::DISABLED, 'label' => Mage::helper('shippingip')->__('Disabled')),
|
24 |
+
array('value' => self::CUMULATIVELY, 'label' => Mage::helper('shippingip')->__('Enabled - Tax and Duty cumulatively')),
|
25 |
+
array('value' => self::SEPARATELY, 'label' => Mage::helper('shippingip')->__('Enabled - Tax and Duty separately'))
|
26 |
+
);
|
27 |
+
}
|
28 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Tax/Calculation.php
CHANGED
@@ -2,63 +2,63 @@
|
|
2 |
/**
|
3 |
* i-parcel's rewritement of tax/calculation class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Calculation extends Mage_Tax_Model_Calculation
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
35 |
/* var $method string */
|
36 |
-
|
37 |
/* var $method array */
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
}
|
64 |
-
?>
|
2 |
/**
|
3 |
* i-parcel's rewritement of tax/calculation class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Calculation extends Mage_Tax_Model_Calculation
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get calculation tax rate by specific request
|
13 |
+
*
|
14 |
+
* @param Varien_Object $request
|
15 |
+
* @return float
|
16 |
+
*/
|
17 |
+
public function getRate($request)
|
18 |
+
{
|
19 |
+
if (!$request->getCountryId() || !$request->getCustomerClassId() || !$request->getProductClassId()) {
|
20 |
+
return 0;
|
21 |
+
}
|
22 |
+
/* var $quote Mage_Sales_Model_Quote */
|
23 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
24 |
+
// if no quote go to parent
|
25 |
+
// if i-parcel tax&duty intercepting is disabled go to parent
|
26 |
+
// if quote is virtual go to parent
|
27 |
+
// if not domestic shipping go to parent
|
28 |
+
if (!$quote->getId()
|
29 |
+
|| Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::DISABLED
|
30 |
+
|| $quote->isVirtual()
|
31 |
+
|| explode('_', $quote->getShippingAddress()->getShippingMethod())[0] != 'i-parcel'
|
32 |
+
|| Mage::getStoreConfig('general/store_information/merchant_country') == $request->getCountryId()) {
|
33 |
+
return parent::getRate($request);
|
34 |
+
}
|
35 |
+
$method = $quote->getShippingAddress()->getShippingMethod();
|
36 |
/* var $method string */
|
37 |
+
$method = explode('_', $method);
|
38 |
/* var $method array */
|
39 |
+
// if not i-parcel shipping go to parent
|
40 |
+
if ($method[0] != 'i-parcel') {
|
41 |
+
return parent::getRate($request);
|
42 |
+
}
|
43 |
|
44 |
+
/* var $totals array */
|
45 |
+
$totals = $quote->getTotals();
|
46 |
+
if (isset($totals['tax'])) {
|
47 |
+
$totals['tax']->setValue(0);
|
48 |
+
}
|
49 |
|
50 |
+
// set tax rate value to 0
|
51 |
+
$cacheKey = $this->_getRequestCacheKey($request);
|
52 |
+
/* var $cacheKey string */
|
53 |
+
if (!isset($this->_rateCache[$cacheKey])) {
|
54 |
+
$this->unsCalculationProcess();
|
55 |
+
$this->unsEventModuleId();
|
56 |
+
$this->setRateValue(0);
|
57 |
+
Mage::dispatchEvent('tax_rate_data_fetch', array('request'=>$request));
|
58 |
+
$this->setCalculationProcess($this->_formCalculationProcess());
|
59 |
+
$this->_rateCache[$cacheKey] = $this->getRateValue();
|
60 |
+
$this->_rateCalculationProcess[$cacheKey] = $this->getCalculationProcess();
|
61 |
+
}
|
62 |
+
return $this->_rateCache[$cacheKey];
|
63 |
+
}
|
64 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals.php
CHANGED
@@ -2,29 +2,31 @@
|
|
2 |
/**
|
3 |
* Db model for i-parcel's tax intercepting
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Totals extends Mage_Core_Model_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
29 |
}
|
30 |
-
?>
|
2 |
/**
|
3 |
* Db model for i-parcel's tax intercepting
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals extends Mage_Core_Model_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing model in internal constructor
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('shippingip/tax_totals');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Load totals by order_id
|
21 |
+
*
|
22 |
+
* @param int $orderId, string $fields='*'
|
23 |
+
* @return Iparcel_Shipping_Model_Tax_Totals
|
24 |
+
*/
|
25 |
+
public function loadByOrderId($orderId, $attributes = '*')
|
26 |
+
{
|
27 |
+
$collection = $this->getResourceCollection()
|
28 |
+
->addFieldToSelect($attributes)
|
29 |
+
->addFieldToFilter('order_id', $orderId);
|
30 |
+
return $collection->getFirstItem();
|
31 |
+
}
|
32 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Abstract.php
CHANGED
@@ -2,117 +2,123 @@
|
|
2 |
/**
|
3 |
* Abstract class for i-parcel shipping tax&duty tax and totals
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
abstract class Iparcel_Shipping_Model_Tax_Totals_Abstract extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
10 |
-
|
11 |
-
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
118 |
}
|
2 |
/**
|
3 |
* Abstract class for i-parcel shipping tax&duty tax and totals
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
abstract class Iparcel_Shipping_Model_Tax_Totals_Abstract extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
10 |
+
{
|
11 |
+
protected $_tax;
|
12 |
+
protected $_duty;
|
13 |
|
14 |
+
/**
|
15 |
+
* Those constants have to be redefined in derived class
|
16 |
+
*/
|
17 |
+
const XPATH_LABEL = null;
|
18 |
+
const TOTAL_CODE = null;
|
19 |
|
20 |
+
/**
|
21 |
+
* Checking if current total is enabled
|
22 |
+
*
|
23 |
+
* @return bool
|
24 |
+
*/
|
25 |
+
abstract protected function _isEnabled();
|
26 |
|
27 |
+
/**
|
28 |
+
* Adding amount to total
|
29 |
+
*/
|
30 |
+
abstract protected function _addAmountToTotal();
|
31 |
|
32 |
+
/**
|
33 |
+
* Checking if shipping is domestic
|
34 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
35 |
+
* @return bool
|
36 |
+
*/
|
37 |
+
protected function _isDomestic($address)
|
38 |
+
{
|
39 |
+
return Mage::getStoreConfig('general/store_information/merchant_country') == $address->getCountryId();
|
40 |
+
}
|
41 |
|
42 |
+
/**
|
43 |
+
* Getting mode od i-parcel shipping tax&duty
|
44 |
+
*
|
45 |
+
* @return string
|
46 |
+
*/
|
47 |
+
protected function _getMode()
|
48 |
+
{
|
49 |
+
return Mage::getStoreConfig('iparcel/tax/mode');
|
50 |
+
}
|
51 |
|
52 |
+
/**
|
53 |
+
* Getting label for current total
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
protected function _getLabel()
|
58 |
+
{
|
59 |
+
return Mage::getStoreConfig($this::XPATH_LABEL);
|
60 |
+
}
|
61 |
|
62 |
+
/**
|
63 |
+
* Setting total code in constructor
|
64 |
+
*/
|
65 |
+
public function __construct()
|
66 |
+
{
|
67 |
+
$this->setCode($this::TOTAL_CODE);
|
68 |
+
}
|
69 |
|
70 |
+
/**
|
71 |
+
* Collect totals process.
|
72 |
+
*
|
73 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
74 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Abstract
|
75 |
+
*/
|
76 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
77 |
+
{
|
78 |
+
parent::collect($address);
|
79 |
+
if ($this->_isEnabled() && !$this->_isDomestic($address)) {
|
80 |
+
$quote = $address->getQuote();
|
81 |
+
/* var $quote Mage_Sales_Model_Quote */
|
82 |
+
// return if it's virtual quote
|
83 |
+
if ($quote->isVirtual()) {
|
84 |
+
return $this;
|
85 |
+
}
|
86 |
+
// we need shipping address
|
87 |
+
if (($address->getAddressType() == 'billing')) {
|
88 |
+
$address = $address->getQuote()->getShippingAddress();
|
89 |
+
}
|
90 |
+
$this->_setAddress($address);
|
91 |
+
$_tax = 0;
|
92 |
+
$_duty = 0;
|
93 |
+
$_shipping = $address->getShippingMethod();
|
94 |
+
/* var $_shipping string */
|
95 |
+
$tax = Mage::registry('iparcel');
|
96 |
+
/* var $tax array */
|
97 |
+
if (isset($tax[$_shipping])) {
|
98 |
+
$tax = $tax[$_shipping];
|
99 |
+
$rates = $address->getShippingRatesCollection();
|
100 |
+
/* var $rates Mage_Eav_Model_Entity_Collection_Abstract */
|
101 |
+
foreach ($rates as $rate) {
|
102 |
+
/* var $rate Mage_Sales_Model_Quote_Address_Rate */
|
103 |
+
if (($name = $rate->getCarrier().'_'.$rate->getMethod()) == $_shipping) {
|
104 |
+
$_tax = $tax['tax'];
|
105 |
+
$_duty = $tax['duty'];
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
$this->_tax = $_tax;
|
110 |
+
$this->_duty = $_duty;
|
111 |
+
$this->_addAmountToTotal();
|
112 |
+
$address->setShippingipTotalTax($_tax);
|
113 |
+
$address->setShippingipTotalDuty($_duty);
|
114 |
+
if ($_tax+$_duty) {
|
115 |
+
Mage::getSingleton('checkout/session')->setTaxDutyTotal(array(
|
116 |
+
'mode' => $this->_getMode(),
|
117 |
+
'tax' => $_tax,
|
118 |
+
'duty' => $_duty
|
119 |
+
));
|
120 |
+
}
|
121 |
+
}
|
122 |
+
return $this;
|
123 |
+
}
|
124 |
}
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Creditmemo.php
CHANGED
@@ -2,26 +2,27 @@
|
|
2 |
/**
|
3 |
* Shipping duty tax for creditmemo total class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Totals_Duty_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
}
|
27 |
-
?>
|
2 |
/**
|
3 |
* Shipping duty tax for creditmemo total class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Duty_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Collect credit memo subtotal
|
13 |
+
*
|
14 |
+
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
15 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Duty_Creditmemo
|
16 |
+
*/
|
17 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
|
18 |
+
{
|
19 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($creditmemo->getOrder()->getId());
|
20 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
21 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY) {
|
22 |
+
$amount = $taxduty->getDuty();
|
23 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$amount);
|
24 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$amount);
|
25 |
+
}
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Invoice.php
CHANGED
@@ -2,26 +2,27 @@
|
|
2 |
/**
|
3 |
* Shipping duty tax for invoice total class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Totals_Duty_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
}
|
27 |
-
?>
|
2 |
/**
|
3 |
* Shipping duty tax for invoice total class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Duty_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Collect invoice subtotal
|
13 |
+
*
|
14 |
+
* @param Mage_Sales_Model_Order_Invoice $invoice
|
15 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Duty_Invoice
|
16 |
+
*/
|
17 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice)
|
18 |
+
{
|
19 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($invoice->getOrder()->getId());
|
20 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
21 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY) {
|
22 |
+
$amount = $taxduty->getDuty();
|
23 |
+
$invoice->setGrandTotal($invoice->getGrandTotal()+$amount);
|
24 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$amount);
|
25 |
+
}
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Quote.php
CHANGED
@@ -1,60 +1,64 @@
|
|
1 |
-
<?php
|
2 |
/**
|
3 |
* Shipping duty tax for quote total class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Totals_Duty_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract
|
10 |
-
|
11 |
-
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
60 |
}
|
1 |
+
<?php
|
2 |
/**
|
3 |
* Shipping duty tax for quote total class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Duty_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract
|
10 |
+
{
|
11 |
+
const XPATH_LABEL = 'iparcel/tax/duty_label';
|
12 |
+
const TOTAL_CODE = 'shippingip_total_duty';
|
13 |
|
14 |
+
/**
|
15 |
+
* Checking if current total is enabled
|
16 |
+
*
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
protected function _isEnabled()
|
20 |
+
{
|
21 |
+
return $this->_getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY;
|
22 |
+
}
|
23 |
|
24 |
+
/**
|
25 |
+
* Adding amount to total
|
26 |
+
*/
|
27 |
+
protected function _addAmountToTotal()
|
28 |
+
{
|
29 |
+
$this->_addAmount($this->_duty);
|
30 |
+
$this->_addBaseAmount($this->_duty);
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Fetching current total to quote
|
35 |
+
*
|
36 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
37 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Duty_Quote
|
38 |
+
*/
|
39 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
40 |
+
{
|
41 |
+
if ($this->_isEnabled() && !$this->_isDomestic($address)) {
|
42 |
+
$quote = $address->getQuote();
|
43 |
+
/* var $quote Mage_Sales_Model_Quote */
|
44 |
+
// do nothing if it's virtual quote
|
45 |
+
if ($quote->isVirtual()) {
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
// shipping address needed (it's shipping depended tax)
|
49 |
+
if (($address->getAddressType() == 'billing')) {
|
50 |
+
$address = $address->getQuote()->getShippingAddress();
|
51 |
+
}
|
52 |
+
$this->_setAddress($address);
|
53 |
+
$_duty = $address->getShippingipTotalDuty();
|
54 |
+
if ($_duty) {
|
55 |
+
$address->addTotal(array(
|
56 |
+
'code' => $this->getCode(),
|
57 |
+
'title' => $this->_getLabel(),
|
58 |
+
'value' => $_duty
|
59 |
+
));
|
60 |
+
}
|
61 |
+
}
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
}
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Creditmemo.php
CHANGED
@@ -2,26 +2,27 @@
|
|
2 |
/**
|
3 |
* Shipping tax tax for creditmemo total class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Totals_Tax_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
}
|
27 |
-
?>
|
2 |
/**
|
3 |
* Shipping tax tax for creditmemo total class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Tax_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Collect credit memo subtotal
|
13 |
+
*
|
14 |
+
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
15 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Tax_Creditmemo
|
16 |
+
*/
|
17 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
|
18 |
+
{
|
19 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($creditmemo->getOrder()->getId());
|
20 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
21 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY) {
|
22 |
+
$amount = $taxduty->getTax();
|
23 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$amount);
|
24 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$amount);
|
25 |
+
}
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Invoice.php
CHANGED
@@ -2,26 +2,27 @@
|
|
2 |
/**
|
3 |
* Shipping tax tax for invoice total class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Totals_Tax_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
}
|
27 |
-
?>
|
2 |
/**
|
3 |
* Shipping tax tax for invoice total class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Tax_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Collect invoice subtotal
|
13 |
+
*
|
14 |
+
* @param Mage_Sales_Model_Order_Invoice $invoice
|
15 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Tax_Invoice
|
16 |
+
*/
|
17 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice)
|
18 |
+
{
|
19 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($invoice->getOrder()->getId());
|
20 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
21 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY) {
|
22 |
+
$amount = $taxduty->getTax();
|
23 |
+
$invoice->setGrandTotal($invoice->getGrandTotal()+$amount);
|
24 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$amount);
|
25 |
+
}
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Quote.php
CHANGED
@@ -1,60 +1,64 @@
|
|
1 |
-
<?php
|
2 |
/**
|
3 |
* Shipping tax tax for quote total class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Totals_Tax_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
60 |
}
|
1 |
+
<?php
|
2 |
/**
|
3 |
* Shipping tax tax for quote total class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Tax_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract
|
10 |
+
{
|
11 |
+
const XPATH_LABEL = 'iparcel/tax/tax_label';
|
12 |
+
const TOTAL_CODE = 'shippingip_total_tax';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Checking if current total is enabled
|
16 |
+
*
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
protected function _isEnabled()
|
20 |
+
{
|
21 |
+
return $this->_getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY;
|
22 |
+
}
|
23 |
|
24 |
+
/**
|
25 |
+
* Adding amount to total
|
26 |
+
*/
|
27 |
+
protected function _addAmountToTotal()
|
28 |
+
{
|
29 |
+
$this->_addAmount($this->_tax);
|
30 |
+
$this->_addBaseAmount($this->_tax);
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Fetching current total to quote
|
35 |
+
*
|
36 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
37 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Tax_Quote
|
38 |
+
*/
|
39 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
40 |
+
{
|
41 |
+
if ($this->_isEnabled() && !$this->_isDomestic($address)) {
|
42 |
+
$quote = $address->getQuote();
|
43 |
+
/* var $quote Mage_Sales_Model_Quote */
|
44 |
+
// do nothing if it's virtual quote
|
45 |
+
if ($quote->isVirtual()) {
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
// shipping address needed (it's shipping depended tax)
|
49 |
+
if (($address->getAddressType() == 'billing')) {
|
50 |
+
$address = $address->getQuote()->getShippingAddress();
|
51 |
+
}
|
52 |
+
$this->_setAddress($address);
|
53 |
+
$_tax = $address->getShippingipTotalTax();
|
54 |
+
if ($_tax) {
|
55 |
+
$address->addTotal(array(
|
56 |
+
'code' => $this->getCode(),
|
57 |
+
'title' => $this->_getLabel(),
|
58 |
+
'value' => $_tax
|
59 |
+
));
|
60 |
+
}
|
61 |
+
}
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
}
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Creditmemo.php
CHANGED
@@ -2,26 +2,27 @@
|
|
2 |
/**
|
3 |
* Shipping tax&duty tax for creditmemo total class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
}
|
27 |
-
?>
|
2 |
/**
|
3 |
* Shipping tax&duty tax for creditmemo total class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Collect credit memo subtotal
|
13 |
+
*
|
14 |
+
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
15 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Taxduty_Creditmemo
|
16 |
+
*/
|
17 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
|
18 |
+
{
|
19 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($creditmemo->getOrder()->getId());
|
20 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
21 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::CUMULATIVELY) {
|
22 |
+
$amount = $taxduty->getTax()+$taxduty->getDuty();
|
23 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$amount);
|
24 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$amount);
|
25 |
+
}
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Invoice.php
CHANGED
@@ -2,26 +2,27 @@
|
|
2 |
/**
|
3 |
* Shipping tax&duty tax for invoice total class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
}
|
27 |
-
?>
|
2 |
/**
|
3 |
* Shipping tax&duty tax for invoice total class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Collect invoice subtotal
|
13 |
+
*
|
14 |
+
* @param Mage_Sales_Model_Order_Invoice $invoice
|
15 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Taxduty_Invoice
|
16 |
+
*/
|
17 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice)
|
18 |
+
{
|
19 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($invoice->getOrder()->getId());
|
20 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
21 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::CUMULATIVELY) {
|
22 |
+
$amount = $taxduty->getTax()+$taxduty->getDuty();
|
23 |
+
$invoice->setGrandTotal($invoice->getGrandTotal()+$amount);
|
24 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$amount);
|
25 |
+
}
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
}
|
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Quote.php
CHANGED
@@ -1,62 +1,66 @@
|
|
1 |
-
<?php
|
2 |
/**
|
3 |
* Shipping tax&duty tax for quote total class
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract
|
10 |
-
|
11 |
-
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
62 |
}
|
1 |
+
<?php
|
2 |
/**
|
3 |
* Shipping tax&duty tax for quote total class
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract
|
10 |
+
{
|
11 |
+
const TOTAL_CODE = 'shippingip_total_taxduty';
|
12 |
+
const XPATH_LABEL = 'iparcel/tax/tax_duty_label';
|
13 |
|
14 |
+
/**
|
15 |
+
* Checking if current total is enabled
|
16 |
+
*
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
protected function _isEnabled()
|
20 |
+
{
|
21 |
+
return $this->_getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::CUMULATIVELY;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Adding amount to total
|
26 |
+
*/
|
27 |
+
protected function _addAmountToTotal()
|
28 |
+
{
|
29 |
+
$this->_addAmount($this->_tax+$this->_duty);
|
30 |
+
$this->_addBaseAmount($this->_tax+$this->_duty);
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Fetching current total to quote
|
35 |
+
*
|
36 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
37 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Taxduty_Quote
|
38 |
+
*/
|
39 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
40 |
+
{
|
41 |
+
if ($this->_isEnabled() && !$this->_isDomestic($address)) {
|
42 |
+
$quote = $address->getQuote();
|
43 |
+
/* var $quote Mage_Sales_Model_Quote */
|
44 |
+
// do nothing if it's virtual quote
|
45 |
+
if ($quote->isVirtual()) {
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
// shipping address needed (it's shipping depended tax)
|
49 |
+
if (($address->getAddressType() == 'billing')) {
|
50 |
+
$address = $address->getQuote()->getShippingAddress();
|
51 |
+
}
|
52 |
+
$this->_setAddress($address);
|
53 |
+
$_tax = $address->getShippingipTotalTax();
|
54 |
+
$_duty = $address->getShippingipTotalDuty();
|
55 |
+
if ($_tax+$_duty) {
|
56 |
+
$address->addTotal(array(
|
57 |
+
'code' => $this->getCode(),
|
58 |
+
'title' => $this->_getLabel(),
|
59 |
+
'value' => $_tax+$_duty
|
60 |
+
));
|
61 |
+
|
62 |
+
}
|
63 |
+
}
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
}
|
app/code/community/Iparcel/Shipping/controllers/Adminhtml/LogController.php
CHANGED
@@ -2,39 +2,42 @@
|
|
2 |
/**
|
3 |
* Adminhtml i-parcel logs controller
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
39 |
}
|
40 |
-
?>
|
2 |
/**
|
3 |
* Adminhtml i-parcel logs controller
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Init adminhtml response
|
13 |
+
*
|
14 |
+
* @return Iparcel_Shipping_Adminhtml_LogController
|
15 |
+
*/
|
16 |
+
protected function _init()
|
17 |
+
{
|
18 |
+
$this->loadLayout()
|
19 |
+
->_setActiveMenu('iparcel/log')
|
20 |
+
->_title($this->__('Logs'))->_title($this->__('i-parcel Shipping'))
|
21 |
+
->_addBreadcrumb($this->__('Logs'), $this->__('Logs'))
|
22 |
+
->_addBreadcrumb($this->__('i-parcel Shipping'), $this->__('iparcel Shipping'));
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
|
26 |
+
/**
|
27 |
+
* Show grid action
|
28 |
+
*/
|
29 |
+
public function indexAction()
|
30 |
+
{
|
31 |
+
$this->_init()
|
32 |
+
->renderLayout();
|
33 |
+
}
|
34 |
|
35 |
+
/**
|
36 |
+
* Clear log action
|
37 |
+
*/
|
38 |
+
public function clearAction()
|
39 |
+
{
|
40 |
+
Mage::getModel('shippingip/api_log')->clear();
|
41 |
+
$this->_redirect('*/*/index');
|
42 |
+
}
|
43 |
}
|
|
app/code/community/Iparcel/Shipping/controllers/Adminhtml/Sync/AjaxController.php
CHANGED
@@ -2,172 +2,180 @@
|
|
2 |
/**
|
3 |
* Ajax Sync Controller
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Adminhtml_Sync_AjaxController extends Mage_Adminhtml_Controller_Action
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
|
114 |
-
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
150 |
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
172 |
}
|
173 |
-
?>
|
2 |
/**
|
3 |
* Ajax Sync Controller
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Adminhtml_Sync_AjaxController extends Mage_Adminhtml_Controller_Action
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Preparing handles for controller
|
13 |
+
*
|
14 |
+
* @params array $handles
|
15 |
+
* @return Iparcel_Shipping_Adminhtml_Sync_AjaxController
|
16 |
+
*/
|
17 |
+
protected function _setupHandles(array $handles)
|
18 |
+
{
|
19 |
+
$update = $this->getLayout()->getUpdate();
|
20 |
+
/* @var $update Mage_Core_Model_Layout_Update */
|
21 |
+
$update->resetHandles();
|
22 |
+
$update->addHandle('shippingip_sync_ajax');
|
23 |
+
foreach ($handles as $handle) {
|
24 |
+
if (is_string($handle)) {
|
25 |
+
$update->addHandle($handle);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
$this->addActionLayoutHandles();
|
29 |
+
$this->loadLayoutUpdates();
|
30 |
+
$this->generateLayoutXml();
|
31 |
+
$this->generateLayoutBlocks();
|
32 |
+
$this->_isLayoutLoaded = true;
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
|
36 |
+
/**
|
37 |
+
* Response for init querry
|
38 |
+
*
|
39 |
+
* @return array
|
40 |
+
*/
|
41 |
+
protected function _initResponse()
|
42 |
+
{
|
43 |
+
$step = Mage::getStoreConfig('catalog_mapping/upload/step');
|
44 |
+
return array('count' => Mage::getModel('catalog/product')->getCollection()->getSize()-floor(Mage::getStoreConfig('catalog_mapping/upload/offset')/$step)*$step);
|
45 |
+
}
|
46 |
|
47 |
+
/**
|
48 |
+
* Response for initCatalog querry
|
49 |
+
*
|
50 |
+
* @alias _initResponse
|
51 |
+
* @return array
|
52 |
+
*/
|
53 |
+
protected function _initCatalogResponse()
|
54 |
+
{
|
55 |
+
return $this->_initResponse();
|
56 |
+
}
|
57 |
|
58 |
+
/**
|
59 |
+
* Response for initCheckitems querry
|
60 |
+
*
|
61 |
+
* @alias _initResponse
|
62 |
+
* @return array
|
63 |
+
*/
|
64 |
+
protected function _initCheckitemsResponse()
|
65 |
+
{
|
66 |
+
return $this->_initResponse();
|
67 |
+
}
|
68 |
|
69 |
+
/**
|
70 |
+
* Response for uploadCatalog querry
|
71 |
+
*
|
72 |
+
* @param array $params
|
73 |
+
* @return array
|
74 |
+
*/
|
75 |
+
protected function _uploadCatalogResponse($params)
|
76 |
+
{
|
77 |
+
$page = $params['page'];
|
78 |
+
$step = $params['step'];
|
79 |
+
|
80 |
+
$offset = Mage::getStoreConfig('catalog_mapping/upload/offset');
|
81 |
+
$page += floor($offset/$step);
|
82 |
|
83 |
+
$productCollection = Mage::getModel('catalog/product')
|
84 |
+
->getCollection()
|
85 |
+
->setPageSize($step)
|
86 |
+
->setCurPage($page);
|
87 |
+
/* var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
|
88 |
+
|
89 |
+
$n = Mage::helper('shippingip/api')->submitCatalog($productCollection);
|
90 |
|
91 |
+
if ($n != -1) {
|
92 |
+
return array(
|
93 |
+
'page'=>$page,
|
94 |
+
'step'=>$step,
|
95 |
+
'uploaded'=>$n
|
96 |
+
);
|
97 |
+
} else {
|
98 |
+
return array(
|
99 |
+
'error'=>'1'
|
100 |
+
);
|
101 |
+
}
|
102 |
+
}
|
103 |
|
104 |
+
/**
|
105 |
+
* Response for _uploadCheckitems querry
|
106 |
+
*
|
107 |
+
* @param array $params
|
108 |
+
* @return array
|
109 |
+
*/
|
110 |
+
protected function _uploadCheckitemsResponse($params)
|
111 |
+
{
|
112 |
+
$page = $params['page'];
|
113 |
+
$step = $params['step'];
|
114 |
|
115 |
+
$productCollection = Mage::getModel('catalog/product')
|
116 |
+
->getCollection()
|
117 |
+
->setPageSize($step)
|
118 |
+
->setCurPage($page);
|
119 |
+
/* var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
|
120 |
|
121 |
+
$n = Mage::helper('shippingip/api')->checkItems($productCollection);
|
122 |
|
123 |
+
if ($n != -1) {
|
124 |
+
return array(
|
125 |
+
'page' => $page,
|
126 |
+
'step' => $step,
|
127 |
+
'uploaded' => $n
|
128 |
+
);
|
129 |
+
} else {
|
130 |
+
return array(
|
131 |
+
'error' => '1'
|
132 |
+
);
|
133 |
+
}
|
134 |
+
}
|
135 |
|
136 |
+
/**
|
137 |
+
* Submit Catalog request action
|
138 |
+
*/
|
139 |
+
public function catalogAction()
|
140 |
+
{
|
141 |
+
// if is xmlHttp Request
|
142 |
+
if ($this->getRequest()->isXmlHttpRequest()) {
|
143 |
+
// proceed it
|
144 |
+
$params = $this->getRequest()->getParams();
|
145 |
+
$params['type'] = '_'.$params['type'].'CatalogResponse';
|
146 |
+
if (method_exists($this, $params['type'])) {
|
147 |
+
$_response = $this->$params['type']($params);
|
148 |
+
$this->getResponse()
|
149 |
+
->setHeader('Content-Type', 'application/json')
|
150 |
+
->setBody(json_encode($_response));
|
151 |
+
}
|
152 |
+
} else {
|
153 |
+
// show layout if not
|
154 |
+
$this->_setupHandles(array('shippingip_sync_ajax_catalog'))
|
155 |
+
->renderLayout();
|
156 |
+
}
|
157 |
+
}
|
158 |
|
159 |
+
/**
|
160 |
+
* Check Items request action
|
161 |
+
*/
|
162 |
+
public function checkitemsAction()
|
163 |
+
{
|
164 |
+
// if is xmlHttp Request
|
165 |
+
if ($this->getRequest()->isXmlHttpRequest()) {
|
166 |
+
// proceed it
|
167 |
+
$params = $this->getRequest()->getParams();
|
168 |
+
$params['type'] = '_'.$params['type'].'CheckItemsResponse';
|
169 |
+
if (method_exists($this, $params['type'])) {
|
170 |
+
$_response = $this->$params['type']($params);
|
171 |
+
$this->getResponse()
|
172 |
+
->setHeader('Content-Type', 'application/json')
|
173 |
+
->setBody(json_encode($_response));
|
174 |
+
}
|
175 |
+
} else {
|
176 |
+
// show layout if not
|
177 |
+
$this->_setupHandles(array('shippingip_sync_ajax_checkitems'))
|
178 |
+
->renderLayout();
|
179 |
+
}
|
180 |
+
}
|
181 |
}
|
|
app/code/community/Iparcel/Shipping/controllers/Adminhtml/SyncController.php
CHANGED
@@ -2,15 +2,17 @@
|
|
2 |
/**
|
3 |
* Adminhtml i-parcel sync controller
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_Adminhtml_SyncController extends Mage_Adminhtml_Controller_Action
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
}
|
2 |
/**
|
3 |
* Adminhtml i-parcel sync controller
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_Adminhtml_SyncController extends Mage_Adminhtml_Controller_Action
|
10 |
+
{
|
11 |
+
public function salesruleAction()
|
12 |
+
{
|
13 |
+
$_salesRuleCollection = Mage::getResourceModel('salesrule/rule_collection');
|
14 |
+
/* var $_salesRuleCollection Mage_SalesRule_Model_Resource_Rule_Collection */
|
15 |
+
Mage::helper('shippingip/api')->salesRule($_salesRuleCollection);
|
16 |
+
$this->_redirectReferer();
|
17 |
+
}
|
18 |
}
|
app/code/community/Iparcel/Shipping/controllers/AjaxController.php
CHANGED
@@ -2,48 +2,49 @@
|
|
2 |
/**
|
3 |
* i-parcel frontend ajax controller
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_AjaxController extends Mage_Core_Controller_Front_Action
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
}
|
49 |
-
?>
|
2 |
/**
|
3 |
* i-parcel frontend ajax controller
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_AjaxController extends Mage_Core_Controller_Front_Action
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Configurable products action for post script
|
13 |
+
*/
|
14 |
+
public function configurableAction()
|
15 |
+
{
|
16 |
+
$sku = $this->getRequest()->getParam('sku');
|
17 |
+
$super_attribute = $this->getRequest()->getParam('super_attribute');
|
18 |
+
// var $product Mage_Catalog_Model_Product
|
19 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
|
20 |
+
// var $child Mage_Catalog_Model_Product
|
21 |
+
$child = Mage::getModel('catalog/product_type_configurable')->getProductByAttributes($super_attribute, $product);
|
22 |
+
// var $typeInstance Mage_Catalog_Model_Product_Type_Abstract
|
23 |
+
$typeInstance = $product->getTypeInstance(true);
|
24 |
+
if (!$typeInstance instanceof Mage_Catalog_Model_Product_Type_Configurable) {
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
$attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
|
28 |
+
// var $attributes array
|
29 |
+
$options = array();
|
30 |
+
foreach ($attributes as $attribute) {
|
31 |
+
$id = $attribute->getAttributeId();
|
32 |
+
foreach ($attribute->getPrices() as $value) {
|
33 |
+
if ($value['value_index'] == $super_attribute[$id]) {
|
34 |
+
$options[$attribute->getProductAttribute()->getAttributeCode()] = $value['label'];
|
35 |
+
break;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
if ($child) {
|
40 |
+
$this->getResponse()
|
41 |
+
->clearHeaders()
|
42 |
+
->setHeader('Content-Type', 'application/json');
|
43 |
+
echo json_encode(array(
|
44 |
+
'sku' => $child->getSku(),
|
45 |
+
'attributes' => $options,
|
46 |
+
'stock' => Mage::getModel('cataloginventory/stock_item')->loadByProduct($child)->getQty()
|
47 |
+
));
|
48 |
+
}
|
49 |
+
}
|
50 |
}
|
|
app/code/community/Iparcel/Shipping/controllers/DevController.php
CHANGED
@@ -2,88 +2,92 @@
|
|
2 |
/**
|
3 |
* External Ajax request controller
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_DevController extends Mage_Core_Controller_Front_Action
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
80 |
|
81 |
-
|
82 |
-
|
|
|
83 |
|
84 |
-
|
85 |
|
86 |
-
|
87 |
-
|
88 |
}
|
89 |
-
?>
|
2 |
/**
|
3 |
* External Ajax request controller
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_DevController extends Mage_Core_Controller_Front_Action
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Preparing headers for external ajax
|
13 |
+
*/
|
14 |
+
protected function _prepareHeaders()
|
15 |
+
{
|
16 |
+
$this->getResponse()
|
17 |
+
->clearHeaders()
|
18 |
+
->setHeader('Access-Control-Allow-Origin', '*');
|
19 |
+
}
|
20 |
|
21 |
+
/**
|
22 |
+
* Responding with region list for uri-specified country
|
23 |
+
*/
|
24 |
+
public function regionAction()
|
25 |
+
{
|
26 |
+
$this->_prepareHeaders();
|
27 |
+
$countryId = $this->getRequest()->getParam('country_id');
|
28 |
+
$_country = Mage::getModel('directory/country')->loadByCode($countryId);
|
29 |
+
/* var $_country Mage_Directory_Model_Country */
|
30 |
+
$iso3 = $_country->getIso3Code();
|
31 |
+
$_regionCollection = Mage::getModel('directory/region')
|
32 |
+
->getCollection()
|
33 |
+
->addCountryCodeFilter($iso3);
|
34 |
+
/* var $_regionCollection Mage_Directory_Model_Resource_Region_Collection */
|
35 |
+
$response = array();
|
36 |
+
foreach ($_regionCollection as $_region) {
|
37 |
+
$response[$_region->getCode()] = $_region->getDefaultName();
|
38 |
+
}
|
39 |
+
$this->getResponse()
|
40 |
+
->setHeader('Content-Type', 'application/json');
|
41 |
+
echo json_encode($response);
|
42 |
+
}
|
43 |
|
44 |
+
/**
|
45 |
+
* Responding with recent orders of uri-specified user
|
46 |
+
*/
|
47 |
+
public function recentOrdersAction()
|
48 |
+
{
|
49 |
+
$this->_prepareHeaders();
|
50 |
+
$email = $this->getRequest()->getParam('email');
|
51 |
+
$count = $this->getRequest()->getParam('count');
|
52 |
+
try {
|
53 |
+
if (!$email) {
|
54 |
+
Mage::throwException('User e-mail address is not specified');
|
55 |
+
}
|
56 |
+
if (!$count) {
|
57 |
+
Mage::throwException('Order count is not specified');
|
58 |
+
}
|
59 |
+
$customerId = Mage::getModel('customer/customer')
|
60 |
+
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
|
61 |
+
->loadByEmail($email)
|
62 |
+
->getId();
|
63 |
+
if (!$customerId) {
|
64 |
+
Mage::throwException('User with specified e-mail does not exist');
|
65 |
+
}
|
66 |
+
$_orderCollection = Mage::getResourceModel('sales/order_collection')
|
67 |
+
->addFieldToFilter('customer_id', $customerId)
|
68 |
+
->setOrder('entity_id', 'DESC')
|
69 |
+
->setPageSize($count)
|
70 |
+
->setCurPage(1);
|
71 |
+
/* var $_orderCollection Mage_Sales_Model_Resource_Order_Collection */
|
72 |
+
$response = array();
|
73 |
+
foreach ($_orderCollection as $_order) {
|
74 |
+
$response[] = array(
|
75 |
+
'increment_id' => $_order->getIncrementId(),
|
76 |
+
'created_at' => $_order->getCreatedAt()
|
77 |
+
);
|
78 |
+
}
|
79 |
+
echo json_encode($response);
|
80 |
+
} catch (Mage_Core_Exception $e) {
|
81 |
+
echo $e->getMessage();
|
82 |
+
}
|
83 |
+
}
|
84 |
|
85 |
+
public function orderAction()
|
86 |
+
{
|
87 |
+
$requestString = 'user[email]=tester@i-parcel.com&user[firstname]=Stefan&user[lastname]=eCom-Test&user[password]=nopassword&user[address][new]=1&user[address][firstname]=Stefan&user[address][lastname]=eCom-Test&user[address][street]=25 Test St &user[address][city]=York&user[address][region_id]=PA&user[address][postcode]=555555&user[address][country_id]=GB&user[address][telephone]=555-555-5555&key=63288480-915F-4DBD-9913-AD710742AC9E&tax=78.36&shipping=24.72¤cy=USD&tracking[email]=tester@i-parcel.com&tracking[number]=1205535867US&orders[0][sku]=hdb008&orders[0][qty]=1&orders[0][price]=240.00';
|
88 |
|
89 |
+
parse_str($requestString, $data);
|
90 |
|
91 |
+
$this->_forward('add', 'order', 'shippingip', $data);
|
92 |
+
}
|
93 |
}
|
|
app/code/community/Iparcel/Shipping/controllers/InternationalController.php
CHANGED
@@ -2,46 +2,49 @@
|
|
2 |
/**
|
3 |
* i-parcel International Customer controller
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_InternationalController extends Mage_Core_Controller_Front_Action
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
46 |
}
|
47 |
-
?>
|
2 |
/**
|
3 |
* i-parcel International Customer controller
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_InternationalController extends Mage_Core_Controller_Front_Action
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Preparing headers for external ajax
|
13 |
+
*/
|
14 |
+
protected function _prepareHeaders()
|
15 |
+
{
|
16 |
+
$this->getResponse()
|
17 |
+
->clearHeaders()
|
18 |
+
->setHeader('Access-Control-Allow-Origin', '*');
|
19 |
+
}
|
20 |
|
21 |
+
/**
|
22 |
+
* Changing international flag to true and printing if there was flag change
|
23 |
+
*/
|
24 |
+
public function enableAction()
|
25 |
+
{
|
26 |
+
$this->_prepareHeaders();
|
27 |
+
$current = Mage::helper('shippingip/international')->getInternational();
|
28 |
+
if ($current) {
|
29 |
+
echo 'false';
|
30 |
+
} else {
|
31 |
+
Mage::helper('shippingip/international')->setInternational(true);
|
32 |
+
echo 'true';
|
33 |
+
}
|
34 |
+
}
|
35 |
|
36 |
+
/**
|
37 |
+
* Changing international flag to false and printing if there was flag change
|
38 |
+
*/
|
39 |
+
public function disableAction()
|
40 |
+
{
|
41 |
+
$this->_prepareHeaders();
|
42 |
+
$current = Mage::helper('shippingip/international')->getInternational();
|
43 |
+
if ($current) {
|
44 |
+
Mage::helper('shippingip/international')->setInternational(false);
|
45 |
+
echo 'true';
|
46 |
+
} else {
|
47 |
+
echo 'false';
|
48 |
+
}
|
49 |
+
}
|
50 |
}
|
|
app/code/community/Iparcel/Shipping/controllers/OrderController.php
CHANGED
@@ -2,120 +2,137 @@
|
|
2 |
/**
|
3 |
* External API order controller
|
4 |
*
|
5 |
-
* @category
|
6 |
-
* @package
|
7 |
-
* @author
|
8 |
*/
|
9 |
-
class Iparcel_Shipping_OrderController extends Mage_Core_Controller_Front_Action
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
// checking if External Sales API is enabled
|
28 |
-
if(!$this->_isEnabled()){
|
29 |
-
Mage::throwException('External Sales API is disabled');
|
30 |
-
}
|
31 |
-
// checking if it is POST request
|
32 |
-
if ($request->getMethod() != 'POST'){
|
33 |
-
Mage::throwException('Wrong HTTP request');
|
34 |
-
}
|
35 |
-
// checking if POST GUID key is correct
|
36 |
-
if (strcasecmp($request->getPost('key'), Mage::helper('shippingip')->getGuid())){
|
37 |
-
Mage::throwException('Wrong GUID key');
|
38 |
-
}
|
39 |
-
// checking if request IP is allowed
|
40 |
-
if (!Mage::helper('shippingip/api_external')->isAllowed()){
|
41 |
-
Mage::throwException('Access Forbidden');
|
42 |
-
}
|
43 |
-
return $request;
|
44 |
-
}
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
Mage::throwException('There are no orders in your request');
|
66 |
-
}
|
67 |
-
$user = $request->getPost('user');
|
68 |
-
// checking if user's email is specified
|
69 |
-
if (!isset($user['email'])){
|
70 |
-
Mage::throwException('There is no customer email address in your request');
|
71 |
-
}
|
72 |
-
$model->setCustomer($user, Mage::app()->getWebsite()->getId());
|
73 |
-
if ($user['address']['new'] == 1){
|
74 |
-
$model->setCustomerBillingAddress($user['address']);
|
75 |
-
}
|
76 |
-
else{
|
77 |
-
$model->setDefaultCustomerBillingAddress();
|
78 |
-
}
|
79 |
-
if ($user['shipping_address']['new'] == 1){
|
80 |
-
$model->setCustomerShippingAddress($user['shipping_address']);
|
81 |
-
}else{
|
82 |
-
$model->setDefaultCustomerShippingAddress();
|
83 |
-
}
|
84 |
-
$model->setOrderData($orders);
|
85 |
-
$model->setShippingCosts($shipping);
|
86 |
-
$model->setTax($tax);
|
87 |
-
// if tracking specified set tracking number
|
88 |
-
if ($tracking !== NULL){
|
89 |
-
$model->setTrackingNumber($tracking['number']);
|
90 |
-
}
|
91 |
-
$model->setCurrency($currency);
|
92 |
-
// if order created successfully
|
93 |
-
$model->setStoreId(Mage::app()->getStore()->getId());
|
94 |
-
if ($order = $model->createOrder()){
|
95 |
-
$invoice = $model->createInvoice();
|
96 |
-
echo $order->getIncrementId();
|
97 |
-
}
|
98 |
-
}catch (Mage_Core_Exception $e){
|
99 |
-
echo $e->getMessage();
|
100 |
-
}
|
101 |
-
}
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
2 |
/**
|
3 |
* External API order controller
|
4 |
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com
|
8 |
*/
|
9 |
+
class Iparcel_Shipping_OrderController extends Mage_Core_Controller_Front_Action
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Checking if external sales API is enabled
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected function _isEnabled()
|
17 |
+
{
|
18 |
+
return Mage::getStoreConfigFlag('external_api/sales/enabled');
|
19 |
+
}
|
20 |
|
21 |
+
/**
|
22 |
+
* Checking if request is allowed
|
23 |
+
*
|
24 |
+
* @return Mage_Core_Controller_Request_Http
|
25 |
+
*/
|
26 |
+
protected function _checkRequest()
|
27 |
+
{
|
28 |
+
$request = $this->getRequest();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
//var $request Mage_Core_Controller_Request_Http
|
31 |
+
// checking if External Sales API is enabled
|
32 |
+
if (!$this->_isEnabled()) {
|
33 |
+
Mage::throwException('External Sales API is disabled');
|
34 |
+
}
|
35 |
+
// checking if it is POST request
|
36 |
+
if ($request->getMethod() != 'POST') {
|
37 |
+
Mage::throwException('Wrong HTTP request');
|
38 |
+
}
|
39 |
+
// checking if POST GUID key is correct
|
40 |
+
if (strcasecmp($request->getPost('key'), Mage::helper('shippingip')->getGuid())) {
|
41 |
+
Mage::throwException('Wrong GUID key');
|
42 |
+
}
|
43 |
+
// checking if request IP is allowed
|
44 |
+
if (!Mage::helper('shippingip/api_external')->isAllowed()) {
|
45 |
+
Mage::throwException('Access Forbidden');
|
46 |
+
}
|
47 |
+
return $request;
|
48 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
+
/**
|
51 |
+
* Adding new order
|
52 |
+
*/
|
53 |
+
public function AddAction()
|
54 |
+
{
|
55 |
+
// register global flag
|
56 |
+
Mage::register('isExternalSale', true);
|
57 |
+
try {
|
58 |
+
$request = $this->_checkRequest();
|
59 |
+
$orders = $request->getPost('orders');
|
60 |
+
$tax = $request->getPost('tax');
|
61 |
+
$tax = is_string($tax) ? (float)str_replace(",", ".", $tax) : $tax;
|
62 |
+
$shipping = $request->getPost('shipping');
|
63 |
+
$shipping = is_string($shipping) ? (float)str_replace(",", ".", $shipping) : $shipping;
|
64 |
+
$currency = $request->getPost('currency');
|
65 |
+
$tracking = $request->getPost('tracking');
|
66 |
+
$model = Mage::getModel('shippingip/api_external_sales_order');
|
67 |
+
// var $model Iparcel_Shipping_Model_Api_External_Sales_Order
|
68 |
+
// terminate if there's no orders in request
|
69 |
+
if (count($orders) == 0) {
|
70 |
+
Mage::throwException('There are no orders in your request');
|
71 |
+
}
|
72 |
+
$user = $request->getPost('user');
|
73 |
+
// checking if user's email is specified
|
74 |
+
if (!isset($user['email'])) {
|
75 |
+
Mage::throwException('There is no customer email address in your request');
|
76 |
+
}
|
77 |
+
$model->setCustomer($user, Mage::app()->getWebsite()->getId());
|
78 |
+
|
79 |
+
// If this is a new address, or the user doesn't have a default address
|
80 |
+
if ($user['address']['new'] == 1 || $model->getCustomerHasDefaultBilling() == false) {
|
81 |
+
$model->setCustomerBillingAddress($user['address']);
|
82 |
+
} else {
|
83 |
+
$model->setDefaultCustomerBillingAddress();
|
84 |
+
}
|
85 |
+
|
86 |
+
// If no ['shipping_address'] is given, reuse the ['address']
|
87 |
+
if (array_key_exists('shipping_address', $user) && is_array($user['shipping_address'])) {
|
88 |
+
$shippingAddress = $user['shipping_address'];
|
89 |
+
} else {
|
90 |
+
$shippingAddress = $user['address'];
|
91 |
+
}
|
92 |
+
|
93 |
+
// If this is a new address, or the user doesn't have a default address
|
94 |
+
if ($shippingAddress['new'] == 1 || $model->getCustomerHasDefaultShipping() == false) {
|
95 |
+
$model->setCustomerShippingAddress($shippingAddress);
|
96 |
+
} else {
|
97 |
+
$model->setDefaultCustomerShippingAddress();
|
98 |
+
}
|
99 |
+
|
100 |
+
$model->setOrderData($orders);
|
101 |
+
$model->setShippingCosts($shipping);
|
102 |
+
$model->setTax($tax);
|
103 |
+
// if tracking specified set tracking number
|
104 |
+
if ($tracking !== null) {
|
105 |
+
$model->setTrackingNumber($tracking['number']);
|
106 |
+
}
|
107 |
+
$model->setCurrency($currency);
|
108 |
+
// if order created successfully
|
109 |
+
$model->setStoreId(Mage::app()->getStore()->getId());
|
110 |
+
if ($order = $model->createOrder()) {
|
111 |
+
$invoice = $model->createInvoice();
|
112 |
+
echo $order->getIncrementId();
|
113 |
+
}
|
114 |
+
} catch (Mage_Core_Exception $e) {
|
115 |
+
echo $e->getMessage();
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Canceling an order
|
121 |
+
*/
|
122 |
+
public function CancelAction()
|
123 |
+
{
|
124 |
+
try {
|
125 |
+
$request = $this->_checkRequest();
|
126 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($request->getPost('order'));
|
127 |
+
// var $order Mage_Sales_Model_Order
|
128 |
+
if ($order->getId()) {
|
129 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
|
130 |
+
echo 'Order #'.$request->getPost('order').' cancelled.';
|
131 |
+
} else {
|
132 |
+
Mage::throwException('Order no longer exists');
|
133 |
+
}
|
134 |
+
} catch (Mage_Core_Exception $e) {
|
135 |
+
echo $e->getMessage();
|
136 |
+
}
|
137 |
+
}
|
138 |
}
|
app/code/community/Iparcel/Shipping/etc/config.xml
CHANGED
@@ -1,433 +1,433 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
+
<modules>
|
4 |
+
<Iparcel_Shipping>
|
5 |
+
<version>2.4.4</version>
|
6 |
+
</Iparcel_Shipping>
|
7 |
+
</modules>
|
8 |
+
<crontab>
|
9 |
+
<jobs>
|
10 |
+
<iparcel_catalog_mapping>
|
11 |
+
<run>
|
12 |
+
<model>shippingip/catalog_mapping::sync</model>
|
13 |
+
</run>
|
14 |
+
</iparcel_catalog_mapping>
|
15 |
+
</jobs>
|
16 |
+
</crontab>
|
17 |
+
<frontend>
|
18 |
+
<routers>
|
19 |
+
<ship>
|
20 |
+
<use>standard</use>
|
21 |
+
<args>
|
22 |
+
<module>Iparcel_Shipping</module>
|
23 |
+
<frontName>shippingip</frontName>
|
24 |
+
</args>
|
25 |
+
</ship>
|
26 |
+
</routers>
|
27 |
+
<layout>
|
28 |
+
<updates>
|
29 |
+
<shippingip>
|
30 |
+
<file>externalshipping.xml</file>
|
31 |
+
</shippingip>
|
32 |
+
</updates>
|
33 |
+
</layout>
|
34 |
+
</frontend>
|
35 |
+
<admin>
|
36 |
+
<routers>
|
37 |
+
<shippingip>
|
38 |
+
<use>admin</use>
|
39 |
+
<args>
|
40 |
+
<module>Iparcel_Shipping_Adminhtml</module>
|
41 |
+
<frontName>shippingip</frontName>
|
42 |
+
</args>
|
43 |
+
</shippingip>
|
44 |
+
</routers>
|
45 |
+
</admin>
|
46 |
+
<adminhtml>
|
47 |
+
<layout>
|
48 |
+
<updates>
|
49 |
+
<shippingip>
|
50 |
+
<file>externalsales.xml</file>
|
51 |
+
</shippingip>
|
52 |
+
</updates>
|
53 |
+
</layout>
|
54 |
+
<acl>
|
55 |
+
<resources>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<system>
|
59 |
+
<children>
|
60 |
+
<config>
|
61 |
+
<children>
|
62 |
+
<catalog_mapping>
|
63 |
+
<title>i-parcel Catalog Mapping</title>
|
64 |
+
</catalog_mapping>
|
65 |
+
<salesrules>
|
66 |
+
<title>i-parcel Sales Rules Synchronization</title>
|
67 |
+
</salesrules>
|
68 |
+
<external_api>
|
69 |
+
<title>i-parcel External API</title>
|
70 |
+
</external_api>
|
71 |
+
<iparcel>
|
72 |
+
<title>i-parcel Configuration</title>
|
73 |
+
</iparcel>
|
74 |
+
</children>
|
75 |
+
</config>
|
76 |
+
</children>
|
77 |
+
</system>
|
78 |
+
</children>
|
79 |
+
</admin>
|
80 |
+
</resources>
|
81 |
+
</acl>
|
82 |
+
</adminhtml>
|
83 |
+
<global>
|
84 |
+
<models>
|
85 |
+
<shippingip>
|
86 |
+
<class>Iparcel_Shipping_Model</class>
|
87 |
+
<resourceModel>shippingip_resource</resourceModel>
|
88 |
+
</shippingip>
|
89 |
+
<shippingip_resource>
|
90 |
+
<class>Iparcel_Shipping_Model_Resource</class>
|
91 |
+
<entities>
|
92 |
+
<api_order>
|
93 |
+
<!-- DEPRECATED in v2.3.4.2 -->
|
94 |
+
<table>iparcel_shipping_api_orders</table>
|
95 |
+
</api_order>
|
96 |
+
<cpf>
|
97 |
+
<table>iparcel_shipping_cpf</table>
|
98 |
+
</cpf>
|
99 |
+
<cpf_order>
|
100 |
+
<table>iparcel_shipping_cpf_order</table>
|
101 |
+
</cpf_order>
|
102 |
+
<cpf_quote>
|
103 |
+
<table>iparcel_shipping_cpf_quote</table>
|
104 |
+
</cpf_quote>
|
105 |
+
<parcel>
|
106 |
+
<table>iparcel_shipping_parcel</table>
|
107 |
+
</parcel>
|
108 |
+
<tax_totals>
|
109 |
+
<table>iparcel_shipping_tax_totals</table>
|
110 |
+
</tax_totals>
|
111 |
+
</entities>
|
112 |
+
</shippingip_resource>
|
113 |
+
<sales>
|
114 |
+
<rewrite>
|
115 |
+
<order>Iparcel_Shipping_Model_Sales_Order</order>
|
116 |
+
</rewrite>
|
117 |
+
</sales>
|
118 |
+
<tax>
|
119 |
+
<rewrite>
|
120 |
+
<calculation>Iparcel_Shipping_Model_Tax_Calculation</calculation>
|
121 |
+
</rewrite>
|
122 |
+
</tax>
|
123 |
+
</models>
|
124 |
+
<events>
|
125 |
+
<catalog_product_save_after>
|
126 |
+
<observers>
|
127 |
+
<iparcel_catalog_product_observer>
|
128 |
+
<type>singleton</type>
|
129 |
+
<class>Iparcel_Shipping_Model_Catalog_Product_Observer</class>
|
130 |
+
<method>product_save</method>
|
131 |
+
</iparcel_catalog_product_observer>
|
132 |
+
</observers>
|
133 |
+
</catalog_product_save_after>
|
134 |
+
<catalog_product_attribute_update_before>
|
135 |
+
<observers>
|
136 |
+
<iparcel_catalog_product_observer>
|
137 |
+
<type>singleton</type>
|
138 |
+
<class>Iparcel_Shipping_Model_Catalog_Product_Observer</class>
|
139 |
+
<method>product_massUpdate</method>
|
140 |
+
</iparcel_catalog_product_observer>
|
141 |
+
</observers>
|
142 |
+
</catalog_product_attribute_update_before>
|
143 |
+
<catalog_product_delete_before>
|
144 |
+
<observers>
|
145 |
+
<iparcel_catalog_product_observer>
|
146 |
+
<type>singleton</type>
|
147 |
+
<class>Iparcel_Shipping_Model_Catalog_Product_Observer</class>
|
148 |
+
<method>product_delete</method>
|
149 |
+
</iparcel_catalog_product_observer>
|
150 |
+
</observers>
|
151 |
+
</catalog_product_delete_before>
|
152 |
+
<sales_order_load_after>
|
153 |
+
<observers>
|
154 |
+
<iparcel_sales_order_load_after_observer>
|
155 |
+
<type>singleton</type>
|
156 |
+
<class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
|
157 |
+
<method>after_load</method>
|
158 |
+
</iparcel_sales_order_load_after_observer>
|
159 |
+
</observers>
|
160 |
+
</sales_order_load_after>
|
161 |
+
<sales_order_place_after>
|
162 |
+
<observers>
|
163 |
+
<iparcel_sales_order_place_after_observer>
|
164 |
+
<type>singleton</type>
|
165 |
+
<class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
|
166 |
+
<method>after_place</method>
|
167 |
+
</iparcel_sales_order_place_after_observer>
|
168 |
+
</observers>
|
169 |
+
</sales_order_place_after>
|
170 |
+
<sales_order_save_before>
|
171 |
+
<observers>
|
172 |
+
<iparcel_sales_order_save_before_observer>
|
173 |
+
<type>singleton</type>
|
174 |
+
<class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
|
175 |
+
<method>before_save</method>
|
176 |
+
</iparcel_sales_order_save_before_observer>
|
177 |
+
</observers>
|
178 |
+
</sales_order_save_before>
|
179 |
+
<sales_order_save_after>
|
180 |
+
<observers>
|
181 |
+
<iparcel_sales_order_save_after_observer>
|
182 |
+
<type>singleton</type>
|
183 |
+
<class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
|
184 |
+
<method>after_save</method>
|
185 |
+
</iparcel_sales_order_save_after_observer>
|
186 |
+
</observers>
|
187 |
+
</sales_order_save_after>
|
188 |
+
<sales_order_shipment_save_before>
|
189 |
+
<observers>
|
190 |
+
<iparcel_sales_order_shipment_save_before_observer>
|
191 |
+
<type>singleton</type>
|
192 |
+
<class>Iparcel_Shipping_Model_Sales_Order_Shipment_Observer</class>
|
193 |
+
<method>before_save</method>
|
194 |
+
</iparcel_sales_order_shipment_save_before_observer>
|
195 |
+
</observers>
|
196 |
+
</sales_order_shipment_save_before>
|
197 |
+
<sales_quote_load_after>
|
198 |
+
<observers>
|
199 |
+
<iparcel_sales_quote_load_after_observer>
|
200 |
+
<type>singleton</type>
|
201 |
+
<class>Iparcel_Shipping_Model_Sales_Quote_Observer</class>
|
202 |
+
<method>after_load</method>
|
203 |
+
</iparcel_sales_quote_load_after_observer>
|
204 |
+
</observers>
|
205 |
+
</sales_quote_load_after>
|
206 |
+
<sales_quote_save_after>
|
207 |
+
<observers>
|
208 |
+
<iparcel_sales_quote_save_after_observer>
|
209 |
+
<type>singleton</type>
|
210 |
+
<class>Iparcel_Shipping_Model_Sales_Quote_Observer</class>
|
211 |
+
<method>after_save</method>
|
212 |
+
</iparcel_sales_quote_save_after_observer>
|
213 |
+
</observers>
|
214 |
+
</sales_quote_save_after>
|
215 |
+
<sales_quote_save_before>
|
216 |
+
<observers>
|
217 |
+
<iparcel_sales_quote_save_before_observer>
|
218 |
+
<type>singleton</type>
|
219 |
+
<class>Iparcel_Shipping_Model_Sales_Quote_Observer</class>
|
220 |
+
<method>before_save</method>
|
221 |
+
</iparcel_sales_quote_save_before_observer>
|
222 |
+
</observers>
|
223 |
+
</sales_quote_save_before>
|
224 |
+
</events>
|
225 |
+
<resources>
|
226 |
+
<shippingip_setup>
|
227 |
+
<setup>
|
228 |
+
<module>Iparcel_Shipping</module>
|
229 |
+
<class>Iparcel_Shipping_Model_Resource_Setup</class>
|
230 |
+
</setup>
|
231 |
+
<connection>
|
232 |
+
<use>core_setup</use>
|
233 |
+
</connection>
|
234 |
+
</shippingip_setup>
|
235 |
+
<shippingip_write>
|
236 |
+
<connection>
|
237 |
+
<use>core_write</use>
|
238 |
+
</connection>
|
239 |
+
</shippingip_write>
|
240 |
+
<shippingip_read>
|
241 |
+
<connection>
|
242 |
+
<use>core_read</use>
|
243 |
+
</connection>
|
244 |
+
</shippingip_read>
|
245 |
+
</resources>
|
246 |
+
<blocks>
|
247 |
+
<adminhtml>
|
248 |
+
<rewrite>
|
249 |
+
<sales_order_shipment_view_form>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Form</sales_order_shipment_view_form>
|
250 |
+
<sales_order_shipment_view_tracking>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Tracking</sales_order_shipment_view_tracking>
|
251 |
+
<sales_order_totals>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Totals</sales_order_totals>
|
252 |
+
<sales_order_invoice_totals>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Invoice_Totals</sales_order_invoice_totals>
|
253 |
+
<sales_order_creditmemo_totals>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Creditmemo_Totals</sales_order_creditmemo_totals>
|
254 |
+
</rewrite>
|
255 |
+
</adminhtml>
|
256 |
+
<catalog>
|
257 |
+
<rewrite>
|
258 |
+
<product_list>Iparcel_Shipping_Block_Catalog_Product_List</product_list>
|
259 |
+
</rewrite>
|
260 |
+
</catalog>
|
261 |
+
<sales>
|
262 |
+
<rewrite>
|
263 |
+
<order_totals>Iparcel_Shipping_Block_Sales_Order_Totals</order_totals>
|
264 |
+
<order_invoice_totals>Iparcel_Shipping_Block_Sales_Order_Invoice_Totals</order_invoice_totals>
|
265 |
+
<order_creditmemo_totals>Iparcel_Shipping_Block_Sales_Order_Creditmemo_Totals</order_creditmemo_totals>
|
266 |
+
</rewrite>
|
267 |
+
</sales>
|
268 |
+
<shippingip>
|
269 |
+
<class>Iparcel_Shipping_Block</class>
|
270 |
+
</shippingip>
|
271 |
+
<tax>
|
272 |
+
<rewrite>
|
273 |
+
<checkout_tax>Iparcel_Shipping_Block_Tax_Checkout_Tax</checkout_tax>
|
274 |
+
</rewrite>
|
275 |
+
</tax>
|
276 |
+
</blocks>
|
277 |
+
<helpers>
|
278 |
+
<shippingip>
|
279 |
+
<class>Iparcel_Shipping_Helper</class>
|
280 |
+
</shippingip>
|
281 |
+
<sales>
|
282 |
+
<rewrite>
|
283 |
+
<data>Iparcel_Shipping_Helper_Sales_Data</data>
|
284 |
+
</rewrite>
|
285 |
+
</sales>
|
286 |
+
</helpers>
|
287 |
+
<sales>
|
288 |
+
<quote>
|
289 |
+
<totals>
|
290 |
+
<shippingip_totals_taxduty>
|
291 |
+
<class>shippingip/tax_totals_taxduty_quote</class>
|
292 |
+
<after>tax</after>
|
293 |
+
<before>grand_total</before>
|
294 |
+
</shippingip_totals_taxduty>
|
295 |
+
<shippingip_totals_tax>
|
296 |
+
<class>shippingip/tax_totals_tax_quote</class>
|
297 |
+
<after>tax</after>
|
298 |
+
<before>grand_total</before>
|
299 |
+
</shippingip_totals_tax>
|
300 |
+
<shippingip_totals_duty>
|
301 |
+
<class>shippingip/tax_totals_duty_quote</class>
|
302 |
+
<after>tax</after>
|
303 |
+
<before>grand_total</before>
|
304 |
+
</shippingip_totals_duty>
|
305 |
+
</totals>
|
306 |
+
</quote>
|
307 |
+
<order_invoice>
|
308 |
+
<totals>
|
309 |
+
<shippingip_totals_taxduty>
|
310 |
+
<class>shippingip/tax_totals_taxduty_invoice</class>
|
311 |
+
<after>shipping</after>
|
312 |
+
<before>grand_total</before>
|
313 |
+
</shippingip_totals_taxduty>
|
314 |
+
<shippingip_totals_tax>
|
315 |
+
<class>shippingip/tax_totals_tax_invoice</class>
|
316 |
+
<after>shipping</after>
|
317 |
+
<before>grand_total</before>
|
318 |
+
</shippingip_totals_tax>
|
319 |
+
<shippingip_totals_duty>
|
320 |
+
<class>shippingip/tax_totals_duty_invoice</class>
|
321 |
+
<after>shipping</after>
|
322 |
+
<before>grand_total</before>
|
323 |
+
</shippingip_totals_duty>
|
324 |
+
<discount>
|
325 |
+
<after>nominal,subtotal,msrp,freeshipping,tax_subtotal,weee</after>
|
326 |
+
<before>shipping</before>
|
327 |
+
</discount>
|
328 |
+
<shipping>
|
329 |
+
<after>discount</after>
|
330 |
+
<before>tax_shipping</before>
|
331 |
+
</shipping>
|
332 |
+
<tax_shipping>
|
333 |
+
<after>shipping</after>
|
334 |
+
<before>tax</before>
|
335 |
+
</tax_shipping>
|
336 |
+
<tax>
|
337 |
+
<after>tax_shipping</after>
|
338 |
+
<before>grand_total</before>
|
339 |
+
</tax>
|
340 |
+
</totals>
|
341 |
+
</order_invoice>
|
342 |
+
<order_creditmemo>
|
343 |
+
<totals>
|
344 |
+
<shippingip_totals_taxduty>
|
345 |
+
<class>shippingip/tax_totals_taxduty_creditmemo</class>
|
346 |
+
<after>shipping</after>
|
347 |
+
<before>grand_total</before>
|
348 |
+
</shippingip_totals_taxduty>
|
349 |
+
<shippingip_totals_tax>
|
350 |
+
<class>shippingip/tax_totals_tax_creditmemo</class>
|
351 |
+
<after>shipping</after>
|
352 |
+
<before>grand_total</before>
|
353 |
+
</shippingip_totals_tax>
|
354 |
+
<shippingip_totals_duty>
|
355 |
+
<class>shippingip/tax_totals_duty_creditmemo</class>
|
356 |
+
<after>shipping</after>
|
357 |
+
<before>grand_total</before>
|
358 |
+
</shippingip_totals_duty>
|
359 |
+
</totals>
|
360 |
+
</order_creditmemo>
|
361 |
+
</sales>
|
362 |
+
</global>
|
363 |
+
<default>
|
364 |
+
<carriers>
|
365 |
+
<i-parcel>
|
366 |
+
<active>1</active>
|
367 |
+
<model>shippingip/carrier_iparcel</model>
|
368 |
+
<title>I-Parcel</title>
|
369 |
+
<sort_order>10</sort_order>
|
370 |
+
<sallowspecific>0</sallowspecific>
|
371 |
+
<username>custtest</username>
|
372 |
+
<password>custtest</password>
|
373 |
+
<autoship>1</autoship>
|
374 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
375 |
+
<whitelabelpay>i-parcel</whitelabelpay>
|
376 |
+
<whitelabelship>i-parcel</whitelabelship>
|
377 |
+
</i-parcel>
|
378 |
+
</carriers>
|
379 |
+
<payment>
|
380 |
+
<iparcel>
|
381 |
+
<active>1</active>
|
382 |
+
<model>shippingip/payment_iparcel</model>
|
383 |
+
</iparcel>
|
384 |
+
</payment>
|
385 |
+
<iparcel>
|
386 |
+
<config>
|
387 |
+
<submit_parcel>1</submit_parcel>
|
388 |
+
<timeout>3</timeout>
|
389 |
+
</config>
|
390 |
+
<scripts>
|
391 |
+
<jquery>0</jquery>
|
392 |
+
<scripts>0</scripts>
|
393 |
+
</scripts>
|
394 |
+
<tax>
|
395 |
+
<mode>0</mode>
|
396 |
+
<tax_duty_label><![CDATA[Tax&Duty]]></tax_duty_label>
|
397 |
+
<tax_label>Tax</tax_label>
|
398 |
+
<duty_label>Duty</duty_label>
|
399 |
+
</tax>
|
400 |
+
</iparcel>
|
401 |
+
<external_api>
|
402 |
+
<sales>
|
403 |
+
<enabled>1</enabled>
|
404 |
+
<transactional_emails>0</transactional_emails>
|
405 |
+
<order_status>complete</order_status>
|
406 |
+
</sales>
|
407 |
+
</external_api>
|
408 |
+
<sales>
|
409 |
+
<totals_sort>
|
410 |
+
<shippingip_total_taxduty>35</shippingip_total_taxduty>
|
411 |
+
<shippingip_total_tax>36</shippingip_total_tax>
|
412 |
+
<shippingip_total_duty>37</shippingip_total_duty>
|
413 |
+
</totals_sort>
|
414 |
+
</sales>
|
415 |
+
<dev>
|
416 |
+
<i-parcel>
|
417 |
+
<debug>0</debug>
|
418 |
+
</i-parcel>
|
419 |
+
</dev>
|
420 |
+
<catalog_mapping>
|
421 |
+
<config>
|
422 |
+
<auto_upload>0</auto_upload>
|
423 |
+
</config>
|
424 |
+
<upload>
|
425 |
+
<step>100</step>
|
426 |
+
<offset>0</offset>
|
427 |
+
</upload>
|
428 |
+
<attributes>
|
429 |
+
<price>1</price>
|
430 |
+
</attributes>
|
431 |
+
</catalog_mapping>
|
432 |
+
</default>
|
433 |
</config>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-0.2.0.php
CHANGED
@@ -1,26 +1,25 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) !== true){
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
}
|
25 |
$installer->endSetup();
|
26 |
-
?>
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) !== true) {
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/api_order'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
+
'unsigned' => true,
|
15 |
+
'nullable' => false
|
16 |
+
), 'Order Id')
|
17 |
+
->addColumn('transactional_emails', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
|
18 |
+
'nullable' => false,
|
19 |
+
'default' => 1
|
20 |
+
), 'Transactional Emails Enabled');
|
21 |
+
$installer->getConnection()->createTable($table);
|
22 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/api_order'), 'IDX_ORDER', 'order_id');
|
23 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_API_ORDER_ID', $installer->getTable('shippingip/api_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
|
24 |
}
|
25 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-0.3.0.php
CHANGED
@@ -1,26 +1,25 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) !== true){
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
}
|
25 |
$installer->endSetup();
|
26 |
-
?>
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) !== true) {
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/api_order'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
+
'unsigned' => true,
|
15 |
+
'nullable' => false
|
16 |
+
), 'Order Id')
|
17 |
+
->addColumn('transactional_emails', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
|
18 |
+
'nullable' => false,
|
19 |
+
'default' => 1
|
20 |
+
), 'Transactional Emails Enabled');
|
21 |
+
$installer->getConnection()->createTable($table);
|
22 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/api_order'), 'IDX_ORDER', 'order_id');
|
23 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_API_ORDER_ID', $installer->getTable('shippingip/api_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
|
24 |
}
|
25 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-2.3.4.2.php
CHANGED
@@ -1,110 +1,109 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/tax_totals')) !== true){
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
}
|
31 |
|
32 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf')) !== true){
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
}
|
63 |
|
64 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_order')) !== true){
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
}
|
86 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_quote')) !== true){
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
}
|
108 |
|
109 |
$installer->endSetup();
|
110 |
-
?>
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/tax_totals')) !== true) {
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/tax_totals'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('tax', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
|
14 |
+
'nullable' => false
|
15 |
+
), 'Tax')
|
16 |
+
->addColumn('duty', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
|
17 |
+
'nullable' => true
|
18 |
+
), 'Duty')
|
19 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
20 |
+
'unsigned' => true,
|
21 |
+
'nullable' => false
|
22 |
+
), 'Order Id')
|
23 |
+
->addColumn('mode', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array(
|
24 |
+
'nullable' => false,
|
25 |
+
'default' => 0
|
26 |
+
), 'Mode');
|
27 |
+
$installer->getConnection()->createTable($table);
|
28 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/tax_totals'), 'IDX_ORDER', 'order_id');
|
29 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_TOTALS_ORDER_ID', $installer->getTable('shippingip/tax_totals'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
|
30 |
}
|
31 |
|
32 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf')) !== true) {
|
33 |
+
$table = $installer->getConnection()
|
34 |
+
->newTable($installer->getTable('shippingip/cpf'))
|
35 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
36 |
+
'identity' => true,
|
37 |
+
'unsigned' => true,
|
38 |
+
'nullable' => false,
|
39 |
+
'primary' => true
|
40 |
+
), 'Id')
|
41 |
+
->addColumn('country_code', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
42 |
+
'nullable' => false,
|
43 |
+
'unique' => true
|
44 |
+
), 'Country Code')
|
45 |
+
->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
46 |
+
'nullable' => false
|
47 |
+
), 'Name')
|
48 |
+
->addColumn('required', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
|
49 |
+
'nullable' => false,
|
50 |
+
'default' => false
|
51 |
+
), 'Required');
|
52 |
+
$installer->getConnection()->createTable($table);
|
53 |
|
54 |
+
$cpf = Mage::getModel('shippingip/cpf');
|
55 |
+
$cpf->setCountryCode('BR');
|
56 |
+
$cpf->setName('CPF');
|
57 |
+
$cpf->save();
|
58 |
+
$cpf = Mage::getModel('shippingip/cpf');
|
59 |
+
$cpf->setCountryCode('KR');
|
60 |
+
$cpf->setName('Control Number');
|
61 |
+
$cpf->save();
|
62 |
}
|
63 |
|
64 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_order')) !== true) {
|
65 |
+
$table = $installer->getConnection()
|
66 |
+
->newTable($installer->getTable('shippingip/cpf_order'))
|
67 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
68 |
+
'identity' => true,
|
69 |
+
'unsigned' => true,
|
70 |
+
'nullable' => false,
|
71 |
+
'primary' => true
|
72 |
+
), 'Id')
|
73 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
74 |
+
'unsigned' => true,
|
75 |
+
'nullable' => false,
|
76 |
+
'unique' => true
|
77 |
+
), 'Order Id')
|
78 |
+
->addColumn('value', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
79 |
+
'default' => '',
|
80 |
+
'nullable' => false,
|
81 |
+
), 'Value');
|
82 |
+
$installer->getConnection()->createTable($table);
|
83 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/cpf_order'), 'IDX_ORDER', 'order_id');
|
84 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_CPF_ORDER_ID', $installer->getTable('shippingip/cpf_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
|
85 |
}
|
86 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_quote')) !== true) {
|
87 |
+
$table = $installer->getConnection()
|
88 |
+
->newTable($installer->getTable('shippingip/cpf_quote'))
|
89 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
90 |
+
'identity' => true,
|
91 |
+
'unsigned' => true,
|
92 |
+
'nullable' => false,
|
93 |
+
'primary' => true
|
94 |
+
), 'Id')
|
95 |
+
->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
96 |
+
'unsigned' => true,
|
97 |
+
'nullable' => false,
|
98 |
+
'unique' => true
|
99 |
+
), 'Quote Id')
|
100 |
+
->addColumn('value', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
101 |
+
'default' => '',
|
102 |
+
'nullable' => false,
|
103 |
+
), 'Value');
|
104 |
+
$installer->getConnection()->createTable($table);
|
105 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/cpf_quote'), 'IDX_QUOTE', 'quote_id');
|
106 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_CPF_QUOTE_ID', $installer->getTable('shippingip/cpf_quote'), 'quote_id', $installer->getTable('sales/quote'), 'entity_id');
|
107 |
}
|
108 |
|
109 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.2.0-0.3.0.php
CHANGED
@@ -10,36 +10,35 @@ $query = 'SELECT `path`, `value` FROM '.$resource->getTableName('core/config_dat
|
|
10 |
`path` LIKE '%iparcel/config%' OR
|
11 |
`path` LIKE '%carriers/i-parcel/custid' OR
|
12 |
`path` LIKE '%carriers/i-parcel/userid'";
|
13 |
-
foreach ($readConnection->fetchAll($query) as $variable){
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
}
|
44 |
$installer->endSetup();
|
45 |
-
?>
|
10 |
`path` LIKE '%iparcel/config%' OR
|
11 |
`path` LIKE '%carriers/i-parcel/custid' OR
|
12 |
`path` LIKE '%carriers/i-parcel/userid'";
|
13 |
+
foreach ($readConnection->fetchAll($query) as $variable) {
|
14 |
+
$uri = explode('/', $variable['path']);
|
15 |
+
switch ($variable['path']) {
|
16 |
+
case 'carriers/i-parcel/custid':
|
17 |
+
case 'carriers/i-parcel/userid':
|
18 |
+
$config->saveConfig('iparcel/config/'.$uri[2], $variable['value']);
|
19 |
+
break;
|
20 |
+
case 'iparcel/catalog_mapping/attribute1':
|
21 |
+
case 'iparcel/catalog_mapping/attribute2':
|
22 |
+
case 'iparcel/catalog_mapping/attribute3':
|
23 |
+
case 'iparcel/catalog_mapping/attribute4':
|
24 |
+
case 'iparcel/catalog_mapping/attribute5':
|
25 |
+
case 'iparcel/catalog_mapping/attribute6':
|
26 |
+
case 'iparcel/catalog_mapping/hscodeus':
|
27 |
+
case 'iparcel/catalog_mapping/shipalone':
|
28 |
+
$config->saveConfig('catalog_mapping/attributes/'.$uri[2], $variable['value']);
|
29 |
+
break;
|
30 |
+
case 'sales/external/enabled':
|
31 |
+
case 'sales/external/transactional_emails':
|
32 |
+
$config->saveConfig('external_api/sales'.$uri[2], $variable['value']);
|
33 |
+
break;
|
34 |
+
case 'iparcel/config/scripts':
|
35 |
+
case 'iparcel/config/jquery':
|
36 |
+
$config->saveConfig('iparcel/scripts'.$uri[2], $variable['value']);
|
37 |
+
break;
|
38 |
+
case 'iparcel/catalog_mapping/upload_from':
|
39 |
+
case 'iparcel/catalog_mapping/upload_to':
|
40 |
+
$config->saveConfig('catalog_mapping/upload/'.$uri[2]=='upload_to' ? 'to' : 'from', $variable['value']);
|
41 |
+
break;
|
42 |
+
}
|
43 |
}
|
44 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.0-0.3.1.php
CHANGED
@@ -1,32 +1,31 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/tax_totals')) !== true){
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
}
|
31 |
$installer->endSetup();
|
32 |
-
?>
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/tax_totals')) !== true) {
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/tax_totals'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('tax', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
|
14 |
+
'nullable' => false
|
15 |
+
), 'Tax')
|
16 |
+
->addColumn('duty', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
|
17 |
+
'nullable' => true
|
18 |
+
), 'Duty')
|
19 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
20 |
+
'unsigned' => true,
|
21 |
+
'nullable' => false
|
22 |
+
), 'Order Id')
|
23 |
+
->addColumn('mode', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array(
|
24 |
+
'nullable' => false,
|
25 |
+
'default' => 0
|
26 |
+
), 'Mode');
|
27 |
+
$installer->getConnection()->createTable($table);
|
28 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/tax_totals'), 'IDX_ORDER', 'order_id');
|
29 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_TOTALS_ORDER_ID', $installer->getTable('shippingip/tax_totals'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
|
30 |
}
|
31 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.1-0.3.2.php
CHANGED
@@ -1,37 +1,36 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf')) !== true){
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
}
|
35 |
|
36 |
$installer->endSetup();
|
37 |
-
?>
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf')) !== true) {
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/cpf'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('country_code', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
14 |
+
'nullable' => false,
|
15 |
+
'unique' => true
|
16 |
+
), 'Country Code')
|
17 |
+
->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
18 |
+
'nullable' => false
|
19 |
+
), 'Name')
|
20 |
+
->addColumn('required', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
|
21 |
+
'nullable' => false,
|
22 |
+
'default' => false
|
23 |
+
), 'Required');
|
24 |
+
$installer->getConnection()->createTable($table);
|
25 |
|
26 |
+
$cpf = Mage::getModel('shippingip/cpf');
|
27 |
+
$cpf->setCountryCode('BR');
|
28 |
+
$cpf->setName('CPF');
|
29 |
+
$cpf->save();
|
30 |
+
$cpf = Mage::getModel('shippingip/cpf');
|
31 |
+
$cpf->setCountryCode('KR');
|
32 |
+
$cpf->setName('Control Number');
|
33 |
+
$cpf->save();
|
34 |
}
|
35 |
|
36 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.2-2.0.0.php
CHANGED
@@ -1,49 +1,48 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_order')) !== true){
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
}
|
26 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_quote')) !== true){
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
}
|
48 |
$installer->endSetup();
|
49 |
-
?>
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_order')) !== true) {
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/cpf_order'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
+
'unsigned' => true,
|
15 |
+
'nullable' => false,
|
16 |
+
'unique' => true
|
17 |
+
), 'Order Id')
|
18 |
+
->addColumn('value', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
19 |
+
'default' => '',
|
20 |
+
'nullable' => false,
|
21 |
+
), 'Value');
|
22 |
+
$installer->getConnection()->createTable($table);
|
23 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/cpf_order'), 'IDX_ORDER', 'order_id');
|
24 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_CPF_ORDER_ID', $installer->getTable('shippingip/cpf_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
|
25 |
}
|
26 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_quote')) !== true) {
|
27 |
+
$table = $installer->getConnection()
|
28 |
+
->newTable($installer->getTable('shippingip/cpf_quote'))
|
29 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
30 |
+
'identity' => true,
|
31 |
+
'unsigned' => true,
|
32 |
+
'nullable' => false,
|
33 |
+
'primary' => true
|
34 |
+
), 'Id')
|
35 |
+
->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
36 |
+
'unsigned' => true,
|
37 |
+
'nullable' => false,
|
38 |
+
'unique' => true
|
39 |
+
), 'Quote Id')
|
40 |
+
->addColumn('value', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
41 |
+
'default' => '',
|
42 |
+
'nullable' => false,
|
43 |
+
), 'Value');
|
44 |
+
$installer->getConnection()->createTable($table);
|
45 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/cpf_quote'), 'IDX_QUOTE', 'quote_id');
|
46 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_CPF_QUOTE_ID', $installer->getTable('shippingip/cpf_quote'), 'quote_id', $installer->getTable('sales/quote'), 'entity_id');
|
47 |
}
|
48 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.0.0-2.3.4.2.php
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) === true){
|
5 |
-
|
6 |
}
|
7 |
$installer->endSetup();
|
8 |
-
?>
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) === true) {
|
5 |
+
$installer->getConnection()->dropTable($installer->getTable('shippingip/api_order'));
|
6 |
}
|
7 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.2-2.3.4.4.php
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
-
if (file_exists(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME)){
|
5 |
-
|
6 |
}
|
7 |
$installer->endSetup();
|
8 |
-
?>
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
if (file_exists(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME)) {
|
5 |
+
unlink(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME);
|
6 |
}
|
7 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.3-2.3.4.4.php
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
-
if (file_exists(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME)){
|
5 |
-
|
6 |
}
|
7 |
$installer->endSetup();
|
8 |
-
?>
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
if (file_exists(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME)) {
|
5 |
+
unlink(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME);
|
6 |
}
|
7 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.4.0.3-2.4.1.0.php
CHANGED
@@ -1,22 +1,21 @@
|
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
-
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/parcel')) !== true){
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
}
|
21 |
$installer->endSetup();
|
22 |
-
?>
|
1 |
<?php
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/parcel')) !== true) {
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/parcel'))
|
7 |
+
->addColumn('parcel_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
+
'unsigned' => true,
|
15 |
+
'nullable' => false,
|
16 |
+
), 'Order Id');
|
17 |
+
$installer->getConnection()->createTable($table);
|
18 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/parcel'), 'IDX_ORDER', 'order_id', 'UNIQUE');
|
19 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_PARCEL_ORDER_ID', $installer->getTable('shippingip/parcel'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
|
20 |
}
|
21 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.4.1.17-2.4.3.0.php
CHANGED
@@ -5,47 +5,46 @@ $connection = $installer->getConnection();
|
|
5 |
$installer->startSetup();
|
6 |
|
7 |
$config_data_collection = Mage::getResourceModel('core/config_data_collection')
|
8 |
-
|
9 |
-
if($config_data_collection->getSize()){
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
}else{
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
}
|
49 |
|
50 |
$installer->endSetup();
|
51 |
-
?>
|
5 |
$installer->startSetup();
|
6 |
|
7 |
$config_data_collection = Mage::getResourceModel('core/config_data_collection')
|
8 |
+
->addFieldToFilter('path', 'carriers/i-parcel/whitelabelship');
|
9 |
+
if ($config_data_collection->getSize()) {
|
10 |
+
$config = array();
|
11 |
+
foreach ($config_data_collection as $config_data) {
|
12 |
+
if (!isset($config[$config_data->getScope()])) {
|
13 |
+
$config[$config_data->getScope()] = array();
|
14 |
+
}
|
15 |
+
$config[$config_data->getScope()][$config_data->getScopeId()] = $config_data->getValue();
|
16 |
+
}
|
17 |
|
18 |
+
foreach ($config as $scope => $scope_data) {
|
19 |
+
foreach ($scope_data as $scopeId => $value) {
|
20 |
+
$data = array(
|
21 |
+
'_'.str_replace('.', '_', microtime(true)) => array(
|
22 |
+
'service_id' => 115,
|
23 |
+
'title' => $value
|
24 |
+
)
|
25 |
+
);
|
26 |
|
27 |
+
Mage::getModel('core/config_data')
|
28 |
+
->setScope($scope)
|
29 |
+
->setScopeId($scopeId)
|
30 |
+
->setPath('carriers/i-parcel/name')
|
31 |
+
->setValue(serialize($data))
|
32 |
+
->save();
|
33 |
+
}
|
34 |
+
}
|
35 |
+
} else {
|
36 |
+
$data = array(
|
37 |
+
'_'.str_replace('.', '_', microtime(true)) => array(
|
38 |
+
'service_id' => 115,
|
39 |
+
'title' => 'UPS i-parcel Saver'
|
40 |
+
)
|
41 |
+
);
|
42 |
+
Mage::getModel('core/config_data')
|
43 |
+
->setScope('default')
|
44 |
+
->setScopeId(0)
|
45 |
+
->setPath('carriers/i-parcel/name')
|
46 |
+
->setValue(serialize($data))
|
47 |
+
->save();
|
48 |
}
|
49 |
|
50 |
$installer->endSetup();
|
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.4.1.6-2.4.1.7.php
CHANGED
@@ -4,27 +4,26 @@ $connection = $installer->getConnection();
|
|
4 |
$data = Mage::getModel('shippingip/parcel')->getCollection()->toArray()['items'];
|
5 |
|
6 |
$installer->startSetup();
|
7 |
-
if ($connection->isTableExists($installer->getTable('shippingip/parcel'))){
|
8 |
-
|
9 |
}
|
10 |
$table = $installer->getConnection()
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
$installer->getConnection()->createTable($table);
|
27 |
$installer->getConnection()->addKey($installer->getTable('shippingip/parcel'), 'IDX_ORDER', 'order_id', 'UNIQUE');
|
28 |
-
$installer->getConnection()->addConstraint('FK_IPARCEL_PARCEL_ORDER_ID'
|
29 |
$installer->endSetup();
|
30 |
-
?>
|
4 |
$data = Mage::getModel('shippingip/parcel')->getCollection()->toArray()['items'];
|
5 |
|
6 |
$installer->startSetup();
|
7 |
+
if ($connection->isTableExists($installer->getTable('shippingip/parcel'))) {
|
8 |
+
$connection->dropTable($installer->getTable('shippingip/parcel'));
|
9 |
}
|
10 |
$table = $installer->getConnection()
|
11 |
+
->newTable($installer->getTable('shippingip/parcel'))
|
12 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
13 |
+
'identity' => true,
|
14 |
+
'unsigned' => true,
|
15 |
+
'nullable' => false,
|
16 |
+
'primary' => true
|
17 |
+
), 'Id')
|
18 |
+
->addColumn('parcel_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
19 |
+
'unsigned' => true,
|
20 |
+
'nullable' => false,
|
21 |
+
), 'Order Id')
|
22 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
23 |
+
'unsigned' => true,
|
24 |
+
'nullable' => false,
|
25 |
+
), 'Order Id');
|
26 |
$installer->getConnection()->createTable($table);
|
27 |
$installer->getConnection()->addKey($installer->getTable('shippingip/parcel'), 'IDX_ORDER', 'order_id', 'UNIQUE');
|
28 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_PARCEL_ORDER_ID', $installer->getTable('shippingip/parcel'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
|
29 |
$installer->endSetup();
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>iparcel_connect</name>
|
4 |
-
<version>2.4.
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
@@ -9,10 +9,28 @@
|
|
9 |
<summary>Enable your store to sell internationally, immediately!</summary>
|
10 |
<description>Enable your store to sell internationally, immediately!</description>
|
11 |
<notes>Notes</notes>
|
12 |
-
<authors
|
13 |
-
|
14 |
-
|
15 |
-
<contents><target name="magecommunity"><dir name="Iparcel"><dir name="Shipping"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Checkitems"><file name="Button.php" hash="3fd84bf9d108bf6bd685a903dc9f481c"/></dir><dir name="Mapping"><file name="Button.php" hash="c258c70a783f5175bf5d89234fde422e"/></dir></dir><dir name="Iparcel"><file name="Dashboard.php" hash="70f5cab243fd7a076c9adaf7c0e38757"/></dir><dir name="Logs"><file name="Grid.php" hash="07fdafbd7dcb42768e6c4632a6c550fe"/></dir><file name="Logs.php" hash="a165e882e3dd9d4f567b9548db6d4c4c"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="25eb21505aa91e8d21b2bf85e984ba85"/></dir><dir name="Invoice"><file name="Totals.php" hash="f1ca6fe7b9e4c269f4ad423a9489f11b"/></dir><dir name="Shipment"><dir name="View"><file name="Form.php" hash="0ab9ba2136fcf58898ae6a09315992f3"/><file name="Tracking.php" hash="ce269e77cd33f323c7df5655431f13de"/></dir></dir><file name="Totals.php" hash="3b3bd8e9cfe1c25fd200f2934203a4f8"/></dir></dir><dir name="Salesrule"><dir name="Rule"><file name="Sync.php" hash="0c112e8012b1552e777210896681fe7c"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Method.php" hash="858c611f2d01a6a208a1d75d3240b3e0"/></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="a7ecf1aa9ce6f630ba9a96bf51bb6350"/></dir><file name="Product.php" hash="741377869da5089c3dc5210e570812d5"/></dir><dir name="Catalogsearch"><dir name="Advanced"><file name="Result.php" hash="f3d479b8ecfb6d96864146dd91d145ff"/></dir><file name="Result.php" hash="3e9a1bcc973274b206fc8cac0c2be07c"/></dir><file name="Cpf.php" hash="b27d012e7d72d94065511865e3704898"/><dir name="Html"><dir name="Head"><file name="Iparcel.php" hash="affbc0197df7e2f278acd400da1ec730"/><file name="Jquery.php" hash="94178a9604c79ded9227b0d621bbfe98"/><file name="Post.php" hash="94e5cfa14a18cd92ec89c893943e53db"/></dir></dir><dir name="Payment"><file name="Info.php" hash="38ca3568e92ea58efb09b44931b865b9"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="65a60642a34b8a07647fe6ded1535a08"/></dir><dir name="Invoice"><file name="Totals.php" hash="01dd4224a342ece4b764637383f55b8c"/></dir><file name="Totals.php" hash="47581971cad89781df29a37c6542f8d5"/></dir></dir><dir name="Tax"><dir name="Checkout"><file name="Tax.php" hash="9717acf9b3620061f1e2a01aa792ffb7"/></dir></dir></dir><dir name="Helper"><dir name="Api"><file name="External.php" hash="6b7c3bba0a703f941710824daf4f8e94"/></dir><file name="Api.php" hash="ce21c2f6adfed8b6ef77b08c48d92e0a"/><file name="Data.php" hash="03ebb38af475053fb0e0e92df1cf4c97"/><file name="International.php" hash="debd553b925ca6fb50aacc35775e9d8d"/><dir name="Sales"><file name="Data.php" hash="d2b61bc5609092860d5fabb889559272"/></dir><file name="String.php" hash="e22caeea60053038641e250a9dd0cf98"/><file name="Tax.php" hash="0f2b7b5cbd8c53f1204def64c87a77c9"/></dir><dir name="Model"><dir name="Api"><dir name="External"><dir name="Sales"><file name="Order.php" hash="7bcd03808d57aec7c4bea0ddd9275ea6"/></dir></dir><file name="Log.php" hash="712fca81d0ed3ef7a7d022ffab173b36"/></dir><dir name="Carrier"><file name="Iparcel.php" hash="41893e4f6f80fcc4cc7a0a86ecc2091e"/></dir><dir name="Catalog"><file name="Mapping.php" hash="238bf4f34621014b5c92d542916d7fe8"/><dir name="Product"><file name="Observer.php" hash="8b2e34f1afd45f8e5d1863d25f2b6fa0"/></dir></dir><dir name="Config"><dir name="Catalog"><file name="Mapping.php" hash="fb840497ebb561ae48aecc26d01cf1b9"/></dir><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="453e2a3aa27dc715a18043aaa4efda27"/><file name="Weekday.php" hash="48657e67f0ed06663219e81f67ab25b9"/></dir><dir name="Time"><file name="Hour.php" hash="4b245127d92ae776623f59ed0e0f9558"/><file name="Minute.php" hash="727b1bcae3a74683e367844fd3291b52"/></dir></dir><file name="Guid.php" hash="d8dab34428e6b73b28027b04827ad3f1"/><dir name="Script"><file name="Js.php" hash="1836896d995d93b96508290409d341c3"/></dir></dir><dir name="Cpf"><file name="Order.php" hash="0e4e23b32211a22378a92c49b9f92369"/><file name="Quote.php" hash="83512346a79c739d7654e67d159ff884"/></dir><file name="Cpf.php" hash="e4df52c78f87931b7dc17269a8407f8a"/><file name="Parcel.php" hash="49cd6442d3605cd100840d7d3d18ca7b"/><dir name="Payment"><file name="Iparcel.php" hash="4a1f0f56d5c0c331d16f0b13d9fa1a91"/></dir><dir name="Resource"><dir name="Cpf"><file name="Collection.php" hash="9eaa178f4ad4a1c1bb6a1349e31fff9f"/><dir name="Order"><file name="Collection.php" hash="80f857487b8eecfa9d8aa3802b5e7880"/></dir><file name="Order.php" hash="28a4c0b6e0f077a81cd84e75eb414f3c"/><dir name="Quote"><file name="Collection.php" hash="63f11a1f00016ca3de879e6f1da5c3a5"/></dir><file name="Quote.php" hash="acc75e3e583ac3082cefd0edddd1af6d"/></dir><file name="Cpf.php" hash="20cc2a00effa23d63989afc72fb2cfef"/><dir name="Parcel"><file name="Collection.php" hash="ce9cdf56464a1233e7d86ecc419318bd"/></dir><file name="Parcel.php" hash="79d5849f24a92bd0d7b7993d2cf8b22e"/><file name="Setup.php" hash="5d7fcf77d90c05abe170fa1666bed876"/><dir name="Tax"><dir name="Totals"><file name="Collection.php" hash="fad71177f9fc5c18a51659216781c8a6"/></dir><file name="Totals.php" hash="3673353ccaffa6b03b700cd793093c59"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Observer.php" hash="515d5d4574da00770ce02d3f6062f725"/><dir name="Shipment"><file name="Observer.php" hash="dc34d8c8fffe57ca4ff4b92efa128adb"/></dir></dir><file name="Order.php" hash="dfa017ef6c15c5083c91eb62172b9476"/><dir name="Quote"><file name="Observer.php" hash="978329f9fe6776da26a75424633ea30c"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Mapping"><dir name="Configurable"><file name="Price.php" hash="6fdb4fa44c6dd50b7dceae729b49ac4f"/></dir><file name="Mode.php" hash="37d29183ddd30a4da6727836a01b4f3e"/></dir><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="05da459a04e7565aeaacd582ce1f1a6a"/></dir><file name="Attribute.php" hash="f9b5953fadafc676014e78755abcb3d0"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="81e4d5b013a56c3a82ce2ae885b63318"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="95eef49f59423c0ae2df2f20d7a56c2d"/></dir></dir><dir name="Tax"><file name="Mode.php" hash="cc06ac85e4e99776853e90acc8fd8fa4"/></dir></dir></dir></dir><dir name="Tax"><file name="Calculation.php" hash="dc7b1dbcbc1eda9f9fb9c2862facd0c6"/><dir name="Totals"><file name="Abstract.php" hash="6e0a14e0b298a02f7d68d7a9b0c855d0"/><dir name="Duty"><file name="Creditmemo.php" hash="0e444b977f39602a0fddf7fc6d97e2b9"/><file name="Invoice.php" hash="3801efca779d34904a7ad019767afcca"/><file name="Quote.php" hash="02d80af457f1663a598b7f0f16ba8611"/></dir><dir name="Tax"><file name="Creditmemo.php" hash="d56d7de09d71496eaa57a74d215f504a"/><file name="Invoice.php" hash="9acc37b2ec8615910246f19eb435a566"/><file name="Quote.php" hash="9a23878f8478b9c595404a1fcbd9e2db"/></dir><dir name="Taxduty"><file name="Creditmemo.php" hash="947113f2b6d4c6381ac19e17ea438928"/><file name="Invoice.php" hash="ee1374d7fa9b7219a1cfd6dffcf7f2c8"/><file name="Quote.php" hash="aad5e0e2624c4bed26a5db6ddc25a0f5"/></dir></dir><file name="Totals.php" hash="f0e3be01e88a0123e189e2e36aec351c"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="e52eb2deb7b12d04f2a939e2d8c76baf"/><dir name="Sync"><file name="AjaxController.php" hash="5f4a48c904796bb8e705f190cc410a8c"/></dir><file name="SyncController.php" hash="bcb67a0a9cf037ecfa0e24f9c501dfb9"/></dir><file name="AjaxController.php" hash="fe0a406a495b770b31141b0000310f47"/><file name="DevController.php" hash="0fda14a147d0275217c5ba551279c4c8"/><file name="InternationalController.php" hash="54c7d62aa8acea6c4c308ddfc9726f63"/><file name="OrderController.php" hash="b81c0b085ec9205c6697ed727d38bf02"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c341465d8c67fa8a4f16efe48d939917"/><file name="config.xml" hash="a979b977e11b19ac9555e4aeb2062040"/><file name="system.xml" hash="4a010dc3a2c18b775bbf6f234478aeda"/></dir><dir name="sql"><dir name="shippingip_setup"><file name="mysql4-install-0.2.0.php" hash="38e0aaa7ab303df1e1cfab49d4ae6ab5"/><file name="mysql4-install-0.3.0.php" hash="38e0aaa7ab303df1e1cfab49d4ae6ab5"/><file name="mysql4-install-2.3.4.2.php" hash="cee98377d2b270582d6d626789f5a946"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="b52a574e73039d731d06510a24ad28e2"/><file name="mysql4-upgrade-0.3.0-0.3.1.php" hash="ee096cbfd164ac5d9e18ff0c417b01b5"/><file name="mysql4-upgrade-0.3.1-0.3.2.php" hash="2d0f66de3a04d7f0f4dc5a6f51dbc4ed"/><file name="mysql4-upgrade-0.3.2-2.0.0.php" hash="745afe83a490a7373300b7c6f8229109"/><file name="mysql4-upgrade-2.0.0-2.3.4.2.php" hash="3859c1e7610e198b1b526d2ce62d3ddc"/><file name="mysql4-upgrade-2.3.4.2-2.3.4.4.php" hash="0d43090401db3b53c7bb350557edc983"/><file name="mysql4-upgrade-2.3.4.3-2.3.4.4.php" hash="0d43090401db3b53c7bb350557edc983"/><file name="mysql4-upgrade-2.4.0.3-2.4.1.0.php" hash="0c28db225fad487e27272e3705c3939b"/><file name="mysql4-upgrade-2.4.1.17-2.4.3.0.php" hash="5a52e858264095224622ec62d18b0248"/><file name="mysql4-upgrade-2.4.1.6-2.4.1.7.php" hash="58035fa4f607f41295362f026c7c02d9"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="externalsales.xml" hash="8e47661893cbd491d14332af3cb5fdd3"/></dir><dir name="template"><dir name="iparcel"><dir name="sales"><dir name="order"><dir name="shipment"><dir name="view"><file name="tracking.phtml" hash="8e7db62fb7a6afdf4ecac2046cb143bc"/></dir></dir></dir></dir><dir name="sync"><dir name="ajax"><file name="catalog.phtml" hash="38b9ea2cc01467c8221ed2540a63062a"/><file name="checkitems.phtml" hash="b0ed24b77d2ccd04c0c48209bac7d2e1"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="externalshipping.xml" hash="7010ac3511fa4895e4d6ee341ff8eaca"/></dir><dir name="template"><dir name="shippingip"><file name="cpf.phtml" hash="c5ce5632e329af430265d1a069f1549b"/><dir name="html"><dir name="head"><file name="iparcel.phtml" hash="2c6ebcb17c00043066afa773c97563bf"/><file name="jquery.phtml" hash="9c7eb5b39de8e0a7821607fa5985e888"/><file name="post.phtml" hash="997d566fa62b8d7a575422d3434d2eb0"/></dir></dir><dir name="post"><file name="list.phtml" hash="8807f5a2dfd7efb9d18367aaf6bcf164"/></dir><file name="post.phtml" hash="06a01a4e559474c66956c247cbd0acf3"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iparcel_Shipping.xml" hash="82c0c0b16f4647a662536274f17f5d18"/></dir></target><target name="mageweb"><dir name="js"><dir name="iparcel"><dir name="adminhtml"><file name="label.js" hash="4078e7d784a59362c7d3b53be80507fe"/><file name="sync.js" hash="f50716af0dde3aa6ce2d030f37ab9e0b"/></dir><file name="cpf.js" hash="5cf13252eae4218a80548fa01b0f6d02"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="ea60539f64dae3763c13c930df0454ca"/><file name="post.js" hash="27c649cb11499bbb7139f7d157282bd6"/></dir></dir></target><target name="magemedia"><dir name="font"><file name="code128.ttf" hash="8ffedc82f9b9a02f4016f502ab30117e"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iparcel"><file name="ajaxSync.css" hash="c622b9e4b77589bc0f3c0555124d2751"/></dir></dir></dir></dir></target></contents>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
<compatible/>
|
17 |
-
<dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>iparcel_connect</name>
|
4 |
+
<version>2.4.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>Enable your store to sell internationally, immediately!</summary>
|
10 |
<description>Enable your store to sell internationally, immediately!</description>
|
11 |
<notes>Notes</notes>
|
12 |
+
<authors>
|
13 |
+
<author>
|
14 |
+
<name>Patryk Grudniewski</name>
|
15 |
+
<user>pgrudniewski</user>
|
16 |
+
<email>patryk.grudniewski@sabiosystem.com</email>
|
17 |
+
</author>
|
18 |
+
<author>
|
19 |
+
<name>Maciej Jarmula</name>
|
20 |
+
<user>mjarmula</user>
|
21 |
+
<email>maciej.jarmula@sabiosystem.com</email>
|
22 |
+
</author>
|
23 |
+
</authors>
|
24 |
+
<date>2015-10-21</date>
|
25 |
+
<time>17:51:16</time>
|
26 |
+
<contents><target name="mageweb"><dir name="app"><dir name="code"><dir name="community"><dir name="Iparcel"><dir name="Shipping"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Checkitems"><file name="Button.php" hash="15a3e00fc5e8dacbc7d48456d44228c2"/></dir><dir name="Mapping"><file name="Button.php" hash="90e5992a865cfe508f45497e7bb4fe23"/></dir></dir><dir name="Iparcel"><file name="Dashboard.php" hash="2a3e19b84692ce10618bcce2bce55752"/></dir><dir name="Logs"><file name="Grid.php" hash="7e23ac946a85c14f8640a551bd5fd333"/></dir><file name="Logs.php" hash="95a043d5ac014ec0ea1b1dd410f0978d"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="860e5a537a30fefee9870386afa7e647"/></dir><dir name="Invoice"><file name="Totals.php" hash="4f5cd1680099b4deb5fefd2668aa4ce8"/></dir><dir name="Shipment"><dir name="View"><file name="Form.php" hash="1ba8bace9160f09d83744a218bc42650"/><file name="Tracking.php" hash="918c93bc535447b1b79900d05265f83e"/></dir></dir><file name="Totals.php" hash="faa0ae754492b004585ab1592fd72688"/></dir></dir><dir name="Salesrule"><dir name="Rule"><file name="Sync.php" hash="f8336ddb37885707d9c05ba62640a418"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Method.php" hash="e2adb858a292118fbfe9d8f61791bb49"/></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="4f023d8aac69c37399a42af4abca89ad"/></dir><file name="Product.php" hash="575e131da76d888f1b23d3f38ff9be1d"/></dir><dir name="Catalogsearch"><dir name="Advanced"><file name="Result.php" hash="5dae8b0b2887d6c7df56b4150fcca21f"/></dir><file name="Result.php" hash="fb38a46e7df874188f25bcc7ab9d721a"/></dir><file name="Cpf.php" hash="ecc152d72f74381e3bc7d8d3ca8e7055"/><dir name="Html"><dir name="Head"><file name="Iparcel.php" hash="8f82d5c95ce6e45baf2143fe115194d2"/><file name="Jquery.php" hash="0b0c70b6c86af9e38a435e790c32f87f"/><file name="Post.php" hash="861b6f298f5ede0f1806e4422a002e13"/></dir></dir><dir name="Payment"><file name="Info.php" hash="fcb621af11db8f45a5c865aef92dda37"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="6a8e2d307c3a8a9e136b6e3abd11bae0"/></dir><dir name="Invoice"><file name="Totals.php" hash="09b0712477a6f89c619118e5795b3d4b"/></dir><file name="Totals.php" hash="4088cc4c881f968764dda62ed5eeec7e"/></dir></dir><dir name="Tax"><dir name="Checkout"><file name="Tax.php" hash="790d7b3167765b2826885e0600bfa964"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="7cc5f8b4a703b339653d05e214518c0f"/><file name="SyncController.php" hash="9e2d01d1719e08e348fb0bcf7dba5df2"/><dir name="Sync"><file name="AjaxController.php" hash="3dbacef2220ebb7afbdf3a59dbac7801"/></dir></dir><file name="AjaxController.php" hash="600a78f19c76e94000158352b5ed627d"/><file name="DevController.php" hash="174f6a367ad59439ff7eff7044c66324"/><file name="InternationalController.php" hash="6f6e2687b5cb871bab9309aec1b230af"/><file name="OrderController.php" hash="c42301c3665a6e3095541447e75ac834"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c341465d8c67fa8a4f16efe48d939917"/><file name="config.xml" hash="607e529e0637adb915e44ba68c70c694"/><file name="system.xml" hash="4a010dc3a2c18b775bbf6f234478aeda"/></dir><dir name="Helper"><dir name="Api"><file name="External.php" hash="259d44d670c91e4ba19fa82107e9337f"/></dir><file name="Api.php" hash="c9d585b611c6b3d60f94ea5a2b02b891"/><file name="Data.php" hash="bf96a75c39a2e93d083a702c06795b8c"/><file name="International.php" hash="9ea0c45aa697496eec2fd411e20edb8a"/><file name="String.php" hash="3bcda32c783dcb62d12d978c0ce5bd23"/><file name="Tax.php" hash="1b34958c290947247f70646270ff56fb"/><dir name="Sales"><file name="Data.php" hash="eebca4999dbeb54302af61a2416f3dca"/></dir></dir><dir name="Model"><dir name="Api"><dir name="External"><dir name="Sales"><file name="Order.php" hash="9bf1b29363d4b5184d1230ccb5903e4e"/></dir></dir><file name="Log.php" hash="e834aee91e19a55600360b12d19c8f12"/></dir><dir name="Carrier"><file name="Iparcel.php" hash="ff69da346758a078246f4f26f3504c85"/></dir><dir name="Catalog"><file name="Mapping.php" hash="9edc722ff3faa465db1de3834743298e"/><dir name="Product"><file name="Observer.php" hash="73b75b6029515f57f09cfd768ec978b6"/></dir></dir><dir name="Config"><dir name="Catalog"><file name="Mapping.php" hash="347fd7caa1d5c62df7f6366f67fde54f"/></dir><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="4c5ce3f7664f13d529e11ebabdad9448"/><file name="Weekday.php" hash="0b620fdb69deec5d78583b7be22f058b"/></dir><dir name="Time"><file name="Hour.php" hash="1b5430f68d727417537bb5c69c6b128f"/><file name="Minute.php" hash="1321c21cb9147c9f3e2d312b5446677e"/></dir></dir><file name="Guid.php" hash="d1a7ff7ab39a8676df027e3c2056597f"/><dir name="Script"><file name="Js.php" hash="228cab50d4b3a2c6bb2662d2ad75b8e5"/></dir></dir><dir name="Cpf"><file name="Order.php" hash="995d84e6bd09b5c47e493dd2d6482dea"/><file name="Quote.php" hash="79c8b66a495b658d2777e6ef5fa2cb48"/></dir><file name="Cpf.php" hash="e0dcb99dbbbc730c01383c21be7916bf"/><file name="Parcel.php" hash="8ca68a8744fb2321274939f3664ba509"/><dir name="Payment"><file name="Iparcel.php" hash="68c472a7cf149f7c53154caf89b46228"/></dir><dir name="Resource"><dir name="Cpf"><file name="Collection.php" hash="dc9b9c280af0ab82e2bd5477868dc5a5"/><file name="Order.php" hash="cb44d1288ceae39cc54044d613523a3a"/><file name="Quote.php" hash="0184e6c0aef69ac12791b1b9ed4e7b77"/><dir name="Order"><file name="Collection.php" hash="fc0f9a60092fd2093ac02bc7e9a5da59"/></dir><dir name="Quote"><file name="Collection.php" hash="efa8636bf62c4059ee49b8efdd082177"/></dir></dir><file name="Cpf.php" hash="8574900614953d733ce64408bc960c17"/><file name="Parcel.php" hash="14e7ae8f8cdf6a63fee885bd91661361"/><file name="Setup.php" hash="5c9293a1ca48034ff86f091beabe461b"/><dir name="Parcel"><file name="Collection.php" hash="3ded0db6b72b53901487fe5210268386"/></dir><dir name="Tax"><dir name="Totals"><file name="Collection.php" hash="e51135362027c8b18ce850a7833b4a96"/></dir><file name="Totals.php" hash="dae8465f9ca720672b950d4635153d07"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Observer.php" hash="d5f14a318e9bd2fa9416ad78d6288097"/><dir name="Shipment"><file name="Observer.php" hash="fa818d0782c860bf3e13f2f14d97f683"/></dir></dir><file name="Order.php" hash="ef00fa7cb5e6ddcc8f6544e3df776378"/><dir name="Quote"><file name="Observer.php" hash="d7d58ffb4441fa2cf76c5c98ab7ae7a8"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Mapping"><dir name="Configurable"><file name="Price.php" hash="178306a97aafb7e717938ab92c98035f"/></dir><file name="Mode.php" hash="003514d0c14291b6ec59d97555aa0991"/></dir><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="17109b32710e636b9bdc879982a5d0d3"/></dir><file name="Attribute.php" hash="1deed1a6723034b7ad06cc73ce297398"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="4b2c5b300e1c16879278858d6030d644"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="c25d8254cb63325bb96ca898321d33b2"/></dir></dir><dir name="Tax"><file name="Mode.php" hash="ca23108b89c655f865f1383543ece982"/></dir></dir></dir></dir><dir name="Tax"><file name="Calculation.php" hash="b9dcfddc9a756d26b113b5bc102f768a"/><file name="Totals.php" hash="71438be80c8eec389117a4ef74a90645"/><dir name="Totals"><file name="Abstract.php" hash="2dd86336b3857ba09e3983577e425858"/><dir name="Duty"><file name="Creditmemo.php" hash="e6c309335650ab3367f083d6aeb1b063"/><file name="Invoice.php" hash="97fb7063feaebad3ba0d8e28c015c84c"/><file name="Quote.php" hash="6d9fe68106b9283a919b2b90b1c5f059"/></dir><dir name="Tax"><file name="Creditmemo.php" hash="8fb2059eb74629260352eb449b906a24"/><file name="Invoice.php" hash="3b7f4eea0548dcc71a3f57edddb6e1ed"/><file name="Quote.php" hash="999679f2a74e3b68e2d55ec4244be4ec"/></dir><dir name="Taxduty"><file name="Creditmemo.php" hash="ec4c696fded4179fce6831f48e998afa"/><file name="Invoice.php" hash="4ff5c20b92018d46143eb8ba6dbc925c"/><file name="Quote.php" hash="8856b399c49c8dfd1c8a0953dea4379f"/></dir></dir></dir></dir><dir name="sql"><dir name="shippingip_setup"><file name="mysql4-install-0.2.0.php" hash="0444109a77906bdf7cd48305a94b9af9"/><file name="mysql4-install-0.3.0.php" hash="0444109a77906bdf7cd48305a94b9af9"/><file name="mysql4-install-2.3.4.2.php" hash="95a02156352063f5ca992a1b01d6c19f"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="52a232b3e60be6ba2ec8ecd6a7b49db7"/><file name="mysql4-upgrade-0.3.0-0.3.1.php" hash="423a0f3b34346514a5edf1798246b6ca"/><file name="mysql4-upgrade-0.3.1-0.3.2.php" hash="881e48b8921cb3cbcd2348092ae8da13"/><file name="mysql4-upgrade-0.3.2-2.0.0.php" hash="1ec688052256ff2217c80369e75c9f76"/><file name="mysql4-upgrade-2.0.0-2.3.4.2.php" hash="850c05b3c300c8fb8449393e0d1b97e7"/><file name="mysql4-upgrade-2.3.4.2-2.3.4.4.php" hash="378ad84572e259d6bce61470ca0b9571"/><file name="mysql4-upgrade-2.3.4.3-2.3.4.4.php" hash="378ad84572e259d6bce61470ca0b9571"/><file name="mysql4-upgrade-2.4.0.3-2.4.1.0.php" hash="672903f59d4711306875a24f4dd5a27a"/><file name="mysql4-upgrade-2.4.1.17-2.4.3.0.php" hash="0fe7df3bf25ab47206508176961595b4"/><file name="mysql4-upgrade-2.4.1.6-2.4.1.7.php" hash="440fd8f5d25a092dea5b5b60076bf809"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="iparcel"><dir name="sales"><dir name="order"><dir name="shipment"><dir name="view"><file name="tracking.phtml" hash="8e7db62fb7a6afdf4ecac2046cb143bc"/></dir></dir></dir></dir><dir name="sync"><dir name="ajax"><file name="catalog.phtml" hash="38b9ea2cc01467c8221ed2540a63062a"/><file name="checkitems.phtml" hash="b0ed24b77d2ccd04c0c48209bac7d2e1"/></dir></dir></dir></dir><dir name="layout"><file name="externalsales.xml" hash="8e47661893cbd491d14332af3cb5fdd3"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="shippingip"><file name="cpf.phtml" hash="c5ce5632e329af430265d1a069f1549b"/><file name="post.phtml" hash="06a01a4e559474c66956c247cbd0acf3"/><dir name="html"><dir name="head"><file name="iparcel.phtml" hash="2c6ebcb17c00043066afa773c97563bf"/><file name="jquery.phtml" hash="9c7eb5b39de8e0a7821607fa5985e888"/><file name="post.phtml" hash="997d566fa62b8d7a575422d3434d2eb0"/></dir></dir><dir name="post"><file name="list.phtml" hash="8807f5a2dfd7efb9d18367aaf6bcf164"/></dir></dir></dir><dir name="layout"><file name="externalshipping.xml" hash="7010ac3511fa4895e4d6ee341ff8eaca"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Iparcel_Shipping.xml" hash="82c0c0b16f4647a662536274f17f5d18"/></dir></dir></dir><dir name="var"><dir name="connect"><file name="iparcel_connect.xml" hash="d212a8922aadf484676e74a880ad86eb"/></dir></dir><dir name="js"><dir name="iparcel"><dir name="adminhtml"><file name="label.js" hash="4078e7d784a59362c7d3b53be80507fe"/><file name="sync.js" hash="f50716af0dde3aa6ce2d030f37ab9e0b"/></dir><file name="cpf.js" hash="5cf13252eae4218a80548fa01b0f6d02"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="ea60539f64dae3763c13c930df0454ca"/><file name="post.js" hash="27c649cb11499bbb7139f7d157282bd6"/></dir></dir><dir name="media"><dir name="font"><file name="code128.ttf" hash="8ffedc82f9b9a02f4016f502ab30117e"/></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iparcel"><file name="ajaxSync.css" hash="c622b9e4b77589bc0f3c0555124d2751"/></dir></dir></dir></dir></dir></target></contents>
|
27 |
<compatible/>
|
28 |
+
<dependencies>
|
29 |
+
<required>
|
30 |
+
<php>
|
31 |
+
<min>5.3.0</min>
|
32 |
+
<max>7.0.0</max>
|
33 |
+
</php>
|
34 |
+
</required>
|
35 |
+
</dependencies>
|
36 |
</package>
|
var/connect/iparcel_connect.xml
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<_>
|
2 |
+
<form_key>q6cgAdub4vJMpmAk</form_key>
|
3 |
+
<name>iparcel_connect</name>
|
4 |
+
<channel>community</channel>
|
5 |
+
<version_ids>
|
6 |
+
<version_ids>2</version_ids>
|
7 |
+
</version_ids>
|
8 |
+
<summary>Enable your store to sell internationally, immediately!</summary>
|
9 |
+
<description>Enable your store to sell internationally, immediately!</description>
|
10 |
+
<license>GPL</license>
|
11 |
+
<license_uri/>
|
12 |
+
<version>2.4.3.1</version>
|
13 |
+
<stability>stable</stability>
|
14 |
+
<notes>Notes</notes>
|
15 |
+
<authors>
|
16 |
+
<name>
|
17 |
+
<name>Patryk Grudniewski</name>
|
18 |
+
<name>Maciej Jarmula</name>
|
19 |
+
</name>
|
20 |
+
<user>
|
21 |
+
<user>pgrudniewski</user>
|
22 |
+
<user>mjarmula</user>
|
23 |
+
</user>
|
24 |
+
<email>
|
25 |
+
<email>patryk.grudniewski@sabiosystem.com</email>
|
26 |
+
<email>maciej.jarmula@sabiosystem.com</email>
|
27 |
+
</email>
|
28 |
+
</authors>
|
29 |
+
<depends_php_min>5.3.0</depends_php_min>
|
30 |
+
<depends_php_max>6.0.0</depends_php_max>
|
31 |
+
<depends>
|
32 |
+
<package>
|
33 |
+
<name>
|
34 |
+
<name/>
|
35 |
+
</name>
|
36 |
+
<channel>
|
37 |
+
<channel/>
|
38 |
+
</channel>
|
39 |
+
<min>
|
40 |
+
<min/>
|
41 |
+
</min>
|
42 |
+
<max>
|
43 |
+
<max/>
|
44 |
+
</max>
|
45 |
+
<files>
|
46 |
+
<files> </files>
|
47 |
+
</files>
|
48 |
+
</package>
|
49 |
+
<extension>
|
50 |
+
<name>
|
51 |
+
<name>Core</name>
|
52 |
+
</name>
|
53 |
+
<min>
|
54 |
+
<min/>
|
55 |
+
</min>
|
56 |
+
<max>
|
57 |
+
<max/>
|
58 |
+
</max>
|
59 |
+
</extension>
|
60 |
+
</depends>
|
61 |
+
<contents>
|
62 |
+
<target>
|
63 |
+
<target>magelocal</target>
|
64 |
+
<target>magecommunity</target>
|
65 |
+
<target>magedesign</target>
|
66 |
+
<target>magedesign</target>
|
67 |
+
<target>magedesign</target>
|
68 |
+
<target>magedesign</target>
|
69 |
+
<target>mageetc</target>
|
70 |
+
<target>mageweb</target>
|
71 |
+
<target>magemedia</target>
|
72 |
+
<target>mageskin</target>
|
73 |
+
</target>
|
74 |
+
<path>
|
75 |
+
<path/>
|
76 |
+
<path>Iparcel/Shipping</path>
|
77 |
+
<path>adminhtml/default/default/layout/externalsales.xml</path>
|
78 |
+
<path>adminhtml/default/default/template/iparcel</path>
|
79 |
+
<path>frontend/base/default/layout/externalshipping.xml</path>
|
80 |
+
<path>frontend/base/default/template/shippingip</path>
|
81 |
+
<path>modules/Iparcel_Shipping.xml</path>
|
82 |
+
<path>js/iparcel</path>
|
83 |
+
<path>font/code128.ttf</path>
|
84 |
+
<path>adminhtml/default/default/iparcel</path>
|
85 |
+
</path>
|
86 |
+
<type>
|
87 |
+
<type>file</type>
|
88 |
+
<type>dir</type>
|
89 |
+
<type>file</type>
|
90 |
+
<type>dir</type>
|
91 |
+
<type>file</type>
|
92 |
+
<type>dir</type>
|
93 |
+
<type>file</type>
|
94 |
+
<type>dir</type>
|
95 |
+
<type>file</type>
|
96 |
+
<type>dir</type>
|
97 |
+
</type>
|
98 |
+
<include>
|
99 |
+
<include/>
|
100 |
+
<include/>
|
101 |
+
<include/>
|
102 |
+
<include/>
|
103 |
+
<include/>
|
104 |
+
<include/>
|
105 |
+
<include/>
|
106 |
+
<include/>
|
107 |
+
<include/>
|
108 |
+
<include/>
|
109 |
+
</include>
|
110 |
+
<ignore>
|
111 |
+
<ignore/>
|
112 |
+
<ignore/>
|
113 |
+
<ignore/>
|
114 |
+
<ignore/>
|
115 |
+
<ignore/>
|
116 |
+
<ignore/>
|
117 |
+
<ignore/>
|
118 |
+
<ignore/>
|
119 |
+
<ignore/>
|
120 |
+
<ignore/>
|
121 |
+
</ignore>
|
122 |
+
</contents>
|
123 |
+
</_>
|