iparcel_connect - Version 3.0.1

Version Notes

Notes

Download this release

Release Info

Developer Bobby Burden
Extension iparcel_connect
Version 3.0.1
Comparing to
See all releases


Code changes from version 3.0.0 to 3.0.1

Files changed (70) hide show
  1. app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Logs.php +10 -4
  2. app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Logs/Grid.php +3 -23
  3. app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Shipment/Split.php +43 -0
  4. app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Shipment/Split/Form.php +30 -0
  5. app/code/community/Iparcel/All/Block/Adminhtml/System/Config/Form/Field/Method.php +27 -0
  6. app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Catalog/Product.php +2 -2
  7. app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Catalog/Product/List.php +3 -3
  8. app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Catalogsearch/Advanced/Result.php +10 -3
  9. app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Catalogsearch/Result.php +10 -3
  10. app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Html/Head/Iparcel.php +2 -2
  11. app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Html/Head/Jquery.php +2 -2
  12. app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Html/Head/Post.php +3 -3
  13. app/code/community/Iparcel/All/Block/Sales/Order/Totals/Abstract.php +30 -0
  14. app/code/community/Iparcel/All/Block/Sales/Order/Totals/Duty.php +32 -0
  15. app/code/community/Iparcel/All/Block/Sales/Order/Totals/Tax.php +32 -0
  16. app/code/community/Iparcel/All/Helper/Api.php +414 -0
  17. app/code/community/Iparcel/All/Helper/Data.php +256 -0
  18. app/code/community/Iparcel/All/Helper/International.php +62 -0
  19. app/code/community/Iparcel/All/Model/Api/Quote.php +51 -0
  20. app/code/community/Iparcel/All/Model/Carrier/Iparcel.php +163 -0
  21. app/code/community/Iparcel/{GlobaleCommerce → All}/Model/Config/Script/Js.php +2 -2
  22. app/code/community/Iparcel/All/Model/Log.php +3 -148
  23. app/code/community/Iparcel/All/Model/Observer.php +213 -0
  24. app/code/community/Iparcel/All/Model/Order/Creditmemo/Total/Duty.php +23 -0
  25. app/code/community/Iparcel/All/Model/Order/Creditmemo/Total/Tax.php +24 -0
  26. app/code/community/Iparcel/All/Model/Order/Invoice/Total/Duty.php +23 -0
  27. app/code/community/Iparcel/All/Model/Order/Invoice/Total/Tax.php +23 -0
  28. app/code/community/Iparcel/All/Model/Payment/Iparcel.php +16 -0
  29. app/code/community/Iparcel/All/Model/Quote/Address/Total/Abstract.php +26 -0
  30. app/code/community/Iparcel/All/Model/Quote/Address/Total/Collector.php +52 -0
  31. app/code/community/Iparcel/All/Model/Quote/Address/Total/Duty.php +75 -0
  32. app/code/community/Iparcel/All/Model/Quote/Address/Total/Tax.php +100 -0
  33. app/code/community/Iparcel/All/Model/Resource/Api/Quote.php +18 -0
  34. app/code/community/Iparcel/All/Model/Resource/Log.php +18 -0
  35. app/code/community/Iparcel/All/Model/Resource/Log/Collection.php +29 -0
  36. app/code/community/Iparcel/All/Model/Resource/Mysql4/Setup.php +11 -0
  37. app/code/community/Iparcel/All/Model/Tax/Quote/Shipping.php +51 -0
  38. app/code/community/Iparcel/All/Model/Tax/Quote/Subtotal.php +51 -0
  39. app/code/community/Iparcel/All/Model/Tax/Quote/Tax.php +53 -0
  40. app/code/community/Iparcel/All/controllers/Adminhtml/Iparcel/LogController.php +39 -3
  41. app/code/community/Iparcel/All/controllers/Adminhtml/Iparcel/Shipment/SplitController.php +52 -0
  42. app/code/community/Iparcel/All/controllers/Adminhtml/Iparcel/ShipmentController.php +56 -0
  43. app/code/community/Iparcel/{GlobaleCommerce → All}/controllers/AjaxController.php +7 -2
  44. app/code/community/Iparcel/{GlobaleCommerce → All}/controllers/InternationalController.php +6 -6
  45. app/code/community/Iparcel/All/etc/config.xml +165 -1
  46. app/code/community/Iparcel/All/etc/system.xml +255 -0
  47. app/code/community/Iparcel/All/sql/iparcel_setup/mysql4-upgrade-1.0.0-1.1.0.php +61 -0
  48. app/code/community/Iparcel/All/sql/iparcel_setup/mysql4-upgrade-1.1.0-1.1.1.php +25 -0
  49. app/code/community/Iparcel/All/sql/iparcel_setup/mysql4-upgrade-1.1.1-1.2.0.php +19 -0
  50. app/code/community/Iparcel/GlobaleCommerce/Helper/Data.php +1 -41
  51. app/code/community/Iparcel/GlobaleCommerce/Helper/International.php +1 -52
  52. app/code/community/Iparcel/GlobaleCommerce/Model/Api/External/Sales/Order.php +3 -0
  53. app/code/community/Iparcel/GlobaleCommerce/Model/Observer.php +2 -3
  54. app/code/community/Iparcel/GlobaleCommerce/controllers/OrderController.php +12 -1
  55. app/code/community/Iparcel/GlobaleCommerce/etc/config.xml +1 -6
  56. app/code/community/Iparcel/GlobaleCommerce/etc/system.xml +2 -59
  57. app/design/adminhtml/default/default/layout/iparcel.xml +63 -0
  58. app/design/adminhtml/default/default/template/iparcel/order/totals/duty.phtml +9 -0
  59. app/design/adminhtml/default/default/template/iparcel/order/totals/tax.phtml +9 -0
  60. app/design/frontend/base/default/layout/externalshipping.xml +9 -46
  61. app/design/frontend/base/default/layout/iparcel.xml +102 -0
  62. app/design/frontend/base/default/template/{ipglobalecommerce → iparcel}/html/head/iparcel.phtml +1 -1
  63. app/design/frontend/base/default/template/{ipglobalecommerce → iparcel}/html/head/jquery.phtml +0 -0
  64. app/design/frontend/base/default/template/{ipglobalecommerce → iparcel}/html/head/post.phtml +0 -0
  65. app/design/frontend/base/default/template/{ipglobalecommerce → iparcel}/post.phtml +0 -0
  66. app/design/frontend/base/default/template/{ipglobalecommerce → iparcel}/post/list.phtml +1 -1
  67. app/locale/en_US/iparcel.csv +5 -0
  68. js/iparcel/adminhtml/shipping-methods.js +23 -0
  69. js/iparcel/post.js +5 -2
  70. package.xml +4 -4
app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Logs.php CHANGED
@@ -2,9 +2,9 @@
2
  /**
3
  * Adminhtml i-parcel logs grid container block
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
  class Iparcel_All_Block_Adminhtml_Iparcel_Logs extends Mage_Adminhtml_Block_Widget_Grid_Container
10
  {
@@ -30,7 +30,13 @@ class Iparcel_All_Block_Adminhtml_Iparcel_Logs extends Mage_Adminhtml_Block_Widg
30
 
31
  $this->_addButton('clear', array(
32
  'label' => $this->__('Clear'),
33
- 'onclick' => 'setLocation(\''.$this->getUrl('*/*/clear').'\')'
 
 
 
 
 
 
34
  ));
35
 
36
  return parent::_prepareLayout();
2
  /**
3
  * Adminhtml i-parcel logs grid container block
4
  *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
  class Iparcel_All_Block_Adminhtml_Iparcel_Logs extends Mage_Adminhtml_Block_Widget_Grid_Container
10
  {
30
 
31
  $this->_addButton('clear', array(
32
  'label' => $this->__('Clear'),
33
+ 'class' => 'delete',
34
+ 'onclick' => 'confirmSetLocation(\'Are you sure you want to clear all log entries?\', \''.$this->getUrl('*/*/clear').'\')'
35
+ ));
36
+
37
+ $this->_addButton('download', array(
38
+ 'label' => $this->__('Download Log'),
39
+ 'onclick' => 'setLocation(\''.$this->getUrl('*/*/download').'\')'
40
  ));
41
 
42
  return parent::_prepareLayout();
app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Logs/Grid.php CHANGED
@@ -8,16 +8,6 @@
8
  */
9
  class Iparcel_All_Block_Adminhtml_Iparcel_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
  *
@@ -25,7 +15,7 @@ class Iparcel_All_Block_Adminhtml_Iparcel_Logs_Grid extends Mage_Adminhtml_Block
25
  */
26
  protected function _prepareCollection()
27
  {
28
- $collection = Mage::getModel('iparcel/log')->getJson();
29
  $this->setCollection($collection);
30
 
31
  return parent::_prepareCollection();
@@ -38,9 +28,9 @@ class Iparcel_All_Block_Adminhtml_Iparcel_Logs_Grid extends Mage_Adminhtml_Block
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(
@@ -59,14 +49,4 @@ class Iparcel_All_Block_Adminhtml_Iparcel_Logs_Grid extends Mage_Adminhtml_Block
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
  }
8
  */
9
  class Iparcel_All_Block_Adminhtml_Iparcel_Logs_Grid extends Mage_Adminhtml_Block_Widget_Grid
10
  {
 
 
 
 
 
 
 
 
 
 
11
  /**
12
  * Prepare grid collection object
13
  *
15
  */
16
  protected function _prepareCollection()
17
  {
18
+ $collection = Mage::getModel('iparcel/log')->getCollection();
19
  $this->setCollection($collection);
20
 
21
  return parent::_prepareCollection();
28
  */
29
  protected function _prepareColumns()
30
  {
31
+ $this->addColumn('created_at', array(
32
  'header' => $this->__('Timestamp'),
33
+ 'index' => 'created_at',
34
  'width' => '200px'
35
  ));
36
  $this->addColumn('controller', array(
49
 
50
  return parent::_prepareColumns();
51
  }
 
 
 
 
 
 
 
 
 
 
52
  }
app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Shipment/Split.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block for splitting shipments
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Block_Adminhtml_Iplogistics_Shipment_Split extends Mage_Adminhtml_Block_Widget_Form_Container
10
+ {
11
+ public function __construct()
12
+ {
13
+ $this->_objectId = 'shipment_id';
14
+ $this->_controller = 'iparcel_shipment';
15
+ $this->_mode = 'create';
16
+
17
+ parent::__construct();
18
+
19
+ $this->_removeButton('save');
20
+ $this->_removeButton('delete');
21
+ }
22
+
23
+ /**
24
+ * Retrieve shipment model instance
25
+ *
26
+ * @return Mage_Sales_Model_Order_Shipment
27
+ */
28
+ public function getShipment()
29
+ {
30
+ return Mage::registry('current_shipment');
31
+ }
32
+
33
+ public function getHeaderText()
34
+ {
35
+ $header = Mage::helper('iparcel')->__('Split Shipment #%s', $this->getShipment()->getIncrementId());
36
+ return $header;
37
+ }
38
+
39
+ public function getBackUrl()
40
+ {
41
+ return $this->getUrl('*/sales_order_shipment/view', array('shipment_id'=>$this->getShipment()->getId()));
42
+ }
43
+ }
app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Shipment/Split/Form.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block for splitting shipments form
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Block_Adminhtml_Iplogistics_Shipment_Split_Form extends Mage_Adminhtml_Block_Sales_Order_Abstract
10
+ {
11
+ /**
12
+ * Retrieve shipment model instance
13
+ *
14
+ * @return Mage_Sales_Model_Order_Shipment
15
+ */
16
+ public function getShipment()
17
+ {
18
+ return Mage::registry('current_shipment');
19
+ }
20
+
21
+ public function getItemsHtml()
22
+ {
23
+ return $this->getChildHtml('shipment_items');
24
+ }
25
+
26
+ public function getSaveUrl()
27
+ {
28
+ return $this->getUrl('*/iparcel_shipment_split/save', array('shipment' => $this->getShipment()));
29
+ }
30
+ }
app/code/community/Iparcel/All/Block/Adminhtml/System/Config/Form/Field/Method.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Form Field for Methods Names
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Block_Adminhtml_System_Config_Form_Field_Method extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
10
+ {
11
+ public function __construct()
12
+ {
13
+ $this->addColumn('service_id', array(
14
+ 'label' => $this->__('Service Level ID'),
15
+ 'style' => 'width:85px'
16
+ ));
17
+ $this->addColumn('title', array(
18
+ 'label' => $this->__('Method Title'),
19
+ 'style' => 'width:120px'
20
+ ));
21
+
22
+ $this->_addAfter = false;
23
+ $this->_addButtonLabel = $this->__('Add Description');
24
+
25
+ parent::__construct();
26
+ }
27
+ }
app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Catalog/Product.php RENAMED
@@ -3,10 +3,10 @@
3
  * Product for i-parcel shipping extension
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_GlobaleCommerce_Block_Catalog_Product extends Mage_Catalog_Block_Product_View
10
  {
11
  /**
12
  * Retrieve qty for product
3
  * Product for i-parcel shipping extension
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Block_Catalog_Product extends Mage_Catalog_Block_Product_View
10
  {
11
  /**
12
  * Retrieve qty for product
app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Catalog/Product/List.php RENAMED
@@ -3,10 +3,10 @@
3
  * Product list for i-parcel shipping extension
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_GlobaleCommerce_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List
10
  {
11
  /**
12
  * Retrieve loaded category collection
@@ -45,7 +45,7 @@ class Iparcel_GlobaleCommerce_Block_Catalog_Product_List extends Mage_Catalog_Bl
45
  }
46
  $this->_productCollection = $layer->getProductCollection();
47
 
48
- $helper = Mage::helper('ipglobalecommerce/international');
49
  // if international customer enabled and it is international customer
50
  if ($helper->checkEnabled() && $helper->getInternational()) {
51
  // add international visibility attribute to filter
3
  * Product list for i-parcel shipping extension
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List
10
  {
11
  /**
12
  * Retrieve loaded category collection
45
  }
46
  $this->_productCollection = $layer->getProductCollection();
47
 
48
+ $helper = Mage::helper('iparcel/international');
49
  // if international customer enabled and it is international customer
50
  if ($helper->checkEnabled() && $helper->getInternational()) {
51
  // add international visibility attribute to filter
app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Catalogsearch/Advanced/Result.php RENAMED
@@ -1,5 +1,12 @@
1
  <?php
2
- class Iparcel_GlobaleCommerce_Block_Catalogsearch_Advanced_Result extends Mage_CatalogSearch_Block_Advanced_Result
 
 
 
 
 
 
 
3
  {
4
  protected $_productCollection;
5
 
@@ -8,7 +15,7 @@ class Iparcel_GlobaleCommerce_Block_Catalogsearch_Advanced_Result extends Mage_C
8
  if (is_null($this->_productCollection)) {
9
  $this->_productCollection = $this->getSearchModel()->getProductCollection();
10
 
11
- $helper = Mage::helper('ipglobalecommerce/international');
12
  // if international customer enabled and it is international customer
13
  if ($helper->checkEnabled() && $helper->getInternational()) {
14
  // add international visibility attribute to filter
@@ -33,4 +40,4 @@ class Iparcel_GlobaleCommerce_Block_Catalogsearch_Advanced_Result extends Mage_C
33
  {
34
  return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
35
  }
36
- }
1
  <?php
2
+ /**
3
+ * CatalogSearch list for i-parcel extension
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Block_Catalogsearch_Advanced_Result extends Mage_CatalogSearch_Block_Advanced_Result
10
  {
11
  protected $_productCollection;
12
 
15
  if (is_null($this->_productCollection)) {
16
  $this->_productCollection = $this->getSearchModel()->getProductCollection();
17
 
18
+ $helper = Mage::helper('iparcel/international');
19
  // if international customer enabled and it is international customer
20
  if ($helper->checkEnabled() && $helper->getInternational()) {
21
  // add international visibility attribute to filter
40
  {
41
  return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
42
  }
43
+ }
app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Catalogsearch/Result.php RENAMED
@@ -1,12 +1,19 @@
1
  <?php
2
- class Iparcel_GlobaleCommerce_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('ipglobalecommerce/international');
10
  // if international customer enabled and it is international customer
11
  if ($helper->checkEnabled() && $helper->getInternational()) {
12
  // add international visibility attribute to filter
@@ -32,4 +39,4 @@ class Iparcel_GlobaleCommerce_Block_Catalogsearch_Result extends Mage_CatalogSea
32
  {
33
  return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
34
  }
35
- }
1
  <?php
2
+ /**
3
+ * CatalogSearch list for i-parcel extension
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Block_Catalogsearch_Result extends Mage_CatalogSearch_Block_Result
10
  {
11
  protected function _getProductCollection()
12
  {
13
  if (is_null($this->_productCollection)) {
14
  $this->_productCollection = $this->getListBlock()->getLoadedProductCollection();
15
 
16
+ $helper = Mage::helper('iparcel/international');
17
  // if international customer enabled and it is international customer
18
  if ($helper->checkEnabled() && $helper->getInternational()) {
19
  // add international visibility attribute to filter
39
  {
40
  return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
41
  }
42
+ }
app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Html/Head/Iparcel.php RENAMED
@@ -3,10 +3,10 @@
3
  * i-parcel frontend scripts block
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_GlobaleCommerce_Block_Html_Head_Iparcel extends Mage_Core_Block_Template
10
  {
11
  /**
12
  * Checking if frontend scripts are enabled
3
  * i-parcel frontend scripts block
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Block_Html_Head_Iparcel extends Mage_Core_Block_Template
10
  {
11
  /**
12
  * Checking if frontend scripts are enabled
app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Html/Head/Jquery.php RENAMED
@@ -3,10 +3,10 @@
3
  * i-parcel jQuery block
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_GlobaleCommerce_Block_Html_Head_Jquery extends Mage_Core_Block_Template
10
  {
11
  /**
12
  * Checking if i-parcel's jQuery is enabled
3
  * i-parcel jQuery block
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Block_Html_Head_Jquery extends Mage_Core_Block_Template
10
  {
11
  /**
12
  * Checking if i-parcel's jQuery is enabled
app/code/community/Iparcel/{GlobaleCommerce → All}/Block/Html/Head/Post.php RENAMED
@@ -3,10 +3,10 @@
3
  * i-parcel custom post script block
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_GlobaleCommerce_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
@@ -18,7 +18,7 @@ class Iparcel_GlobaleCommerce_Block_Html_Head_Post extends Mage_Core_Block_Templ
18
  $postScripts = array('iparcel/post.js');
19
  $file = Mage::getStoreConfig('iparcel/scripts/post');
20
  if ($file) {
21
- $postScripts[] = Mage::getModel('ipglobalecommerce/config_script_js')->getUploadDir('post') . $file;
22
  }
23
  return $postScripts;
24
  }
3
  * i-parcel custom post script block
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_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
18
  $postScripts = array('iparcel/post.js');
19
  $file = Mage::getStoreConfig('iparcel/scripts/post');
20
  if ($file) {
21
+ $postScripts[] = Mage::getModel('iparcel/config_script_js')->getUploadDir('post') . $file;
22
  }
23
  return $postScripts;
24
  }
app/code/community/Iparcel/All/Block/Sales/Order/Totals/Abstract.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel model for shipping duty display to frontend order views
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Block_Sales_Order_Totals_Abstract extends Mage_Core_Block_Template
10
+ {
11
+ /**
12
+ * Returns Magento Order
13
+ *
14
+ * @return Mage_Sales_Model_Order
15
+ */
16
+ public function getOrder()
17
+ {
18
+ return $this->getParentBlock()->getOrder();
19
+ }
20
+
21
+ /**
22
+ * Get totals source object
23
+ *
24
+ * @return Mage_Sales_Model_Order
25
+ */
26
+ public function getSource()
27
+ {
28
+ return $this->getParentBlock()->getSource();
29
+ }
30
+ }
app/code/community/Iparcel/All/Block/Sales/Order/Totals/Duty.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel model for shipping duty display to frontend order views
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Block_Sales_Order_Totals_Duty extends Iparcel_All_Block_Sales_Order_Totals_Abstract
10
+ {
11
+ /**
12
+ * Find and display duty for current order/credit memo
13
+ *
14
+ * @return Iparcel_All_Block_Sales_Order_Totals_Duty
15
+ */
16
+ public function initTotals()
17
+ {
18
+ if ((float) $this->getOrder()->getBaseIparcelDutyAmount()) {
19
+ $source = $this->getSource();
20
+ $value = $source->getIparcelDutyAmount();
21
+
22
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
23
+ 'code' => 'iparcel_duty',
24
+ 'strong' => false,
25
+ 'label' => Mage::helper('iparcel')->getDutyLabel(),
26
+ 'value' => $value
27
+ )));
28
+ }
29
+
30
+ return $this;
31
+ }
32
+ }
app/code/community/Iparcel/All/Block/Sales/Order/Totals/Tax.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel model for shipping tax display to frontend order views
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Block_Sales_Order_Totals_Tax extends Iparcel_All_Block_Sales_Order_Totals_Abstract
10
+ {
11
+ /**
12
+ * Find and display tax for current order/credit memo
13
+ *
14
+ * @return Iparcel_All_Block_Sales_Order_Totals_Duty
15
+ */
16
+ public function initTotals()
17
+ {
18
+ if ((float) $this->getOrder()->getBaseIparcelTaxAmount()) {
19
+ $source = $this->getSource();
20
+ $value = $source->getIparcelTaxAmount();
21
+
22
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
23
+ 'code' => 'iparcel_tax',
24
+ 'strong' => false,
25
+ 'label' => Mage::helper('iparcel')->getTaxLabel(),
26
+ 'value' => $value
27
+ )));
28
+ }
29
+
30
+ return $this;
31
+ }
32
+ }
app/code/community/Iparcel/All/Helper/Api.php CHANGED
@@ -8,9 +8,21 @@
8
  */
9
  class Iparcel_All_Helper_Api
10
  {
 
 
 
 
 
 
11
  /** @var string URL for the SubmitCatalog endpoint */
12
  protected $_submitCatalog = 'https://webservices.i-parcel.com/api/SubmitCatalog';
13
 
 
 
 
 
 
 
14
  /**
15
  * Send POST requests to the REST API
16
  *
@@ -74,6 +86,175 @@ class Iparcel_All_Helper_Api
74
  );
75
  }
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  /**
78
  * Send SubmitCatalog request
79
  *
@@ -111,6 +292,239 @@ class Iparcel_All_Helper_Api
111
  return $numberToUpload;
112
  }
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  /**
115
  * Prepare product collection for SubmitCatalog calls
116
  *
8
  */
9
  class Iparcel_All_Helper_Api
10
  {
11
+ /** @var string URL for the Cancel endpoint */
12
+ protected $_cancel = 'https://webservices.i-parcel.com/api/Cancel';
13
+
14
+ /** @var string URL for the Split endpoint */
15
+ protected $_split = 'https://webservices.i-parcel.com/api/Split';
16
+
17
  /** @var string URL for the SubmitCatalog endpoint */
18
  protected $_submitCatalog = 'https://webservices.i-parcel.com/api/SubmitCatalog';
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 Quote endpoint */
24
+ protected $_quote = 'https://webservices.i-parcel.com/api/Quote';
25
+
26
  /**
27
  * Send POST requests to the REST API
28
  *
86
  );
87
  }
88
 
89
+ /**
90
+ * Cancels shipments via the Web Service API
91
+ *
92
+ * @param Mage_Sales_Model_Order_Shipment $shipment
93
+ * @return bool
94
+ */
95
+ public function cancelShipment(Mage_Sales_Model_Order_Shipment $shipment)
96
+ {
97
+ $json = array();
98
+ $json['TrackingNumber'] = Mage::helper('iparcel')->getTrackingNumber($shipment);
99
+ $json['UserNotes'] = '';
100
+ $json['Key'] = Mage::helper('iparcel')->getGuid();
101
+
102
+ $response = $this->_restJSON($json, $this->_cancel);
103
+
104
+ $log = Mage::getModel('iparcel/log');
105
+ $log->setRequest(json_encode($json));
106
+ $log->setResponse($response);
107
+ $log->setController('Cancel Shipment');
108
+ $log->save();
109
+
110
+ $response = json_decode($response);
111
+
112
+ if ($response->Code != 1) {
113
+ Mage::throwException(
114
+ 'Failed when canceling shipment: ' . $response->Message
115
+ );
116
+ } else {
117
+ Mage::getModel('sales/order_shipment_api')->addComment(
118
+ $shipment->getIncrementId(),
119
+ 'Shipment canceled',
120
+ false,
121
+ false
122
+ );
123
+ }
124
+
125
+ return true;
126
+ }
127
+
128
+ /**
129
+ * Cancels all shipments of an order
130
+ *
131
+ * @param Mage_Sales_Model_Order $order
132
+ * @return bool
133
+ */
134
+ public function cancelShipmentsByOrder(Mage_Sales_Model_Order $order)
135
+ {
136
+ if (!Mage::helper('iparcel')->isIparcelOrder($order)) {
137
+ return true;
138
+ }
139
+
140
+ $shipmentsCollection = $order->getShipmentsCollection();
141
+
142
+ foreach ($shipmentsCollection as $shipment) {
143
+ $this->cancelShipment($shipment);
144
+ }
145
+
146
+ return true;
147
+ }
148
+
149
+
150
+ /**
151
+ * Send Quote request
152
+ *
153
+ * Takes the passed Rate Request and transforms it into data that can
154
+ * be passed to the API. It then submits the request as JSON to the
155
+ * Quote API endpoint.
156
+ *
157
+ * @param Mage_Shipping_Model_Rate_Request $request Magento Shipping Rate Request
158
+ * @return stdClass Response from the Quote API
159
+ */
160
+ public function quote(Mage_Shipping_Model_Rate_Request $request)
161
+ {
162
+ // log init
163
+ $log = Mage::getModel('iparcel/log');
164
+ /* var $log Iparcel_All_Model_Api_Log */
165
+ $log->setController('Quote');
166
+ $quote = Mage::getModel('checkout/cart')->getQuote();
167
+ /* var $quote Mage_Sales_Model_Quote */
168
+ $shippingAddress = $quote->getShippingAddress();
169
+ /* var $shippingAddress Mage_Sales_Model_Quote_Address */
170
+ $billingAddress = $quote->getBillingAddress();
171
+ /* var $billingAddress Mage_Sales_Model_Quote_Address */
172
+ $json = array();
173
+ $addressInfo = array();
174
+ $billingStreet = $billingAddress->getStreet();
175
+ $billing = array();
176
+ $billing['City'] = $billingAddress->getCity();
177
+ $billing['CountryCode'] = $billingAddress->getCountryId();
178
+ $billing['Email'] = $quote->getCustomerEmail();
179
+ $billing['FirstName'] = $billingAddress->getFirstname();
180
+ $billing['LastName'] = $billingAddress->getLastname();
181
+ $billing['Phone'] = $billingAddress->getTelephone();
182
+ $billing['PostCode'] = $billingAddress->getPostcode();
183
+ $billing['Region'] = $billingAddress->getRegion();
184
+ for ($i=0; $i<count($billingStreet); $i++) {
185
+ $billing['Street'.($i+1)] = $billingStreet[$i];
186
+ }
187
+ $addressInfo['Billing'] = $billing;
188
+ $shippingStreet = explode("\n", $request->getDestStreet());
189
+ $shipping = array();
190
+ $shipping['City'] = $request->getDestCity();
191
+ $shipping['CountryCode'] = $request->getDestCountryId();
192
+ $shipping['Email'] = $quote->getCustomerEmail();
193
+ $shipping['FirstName'] = $shippingAddress->getFirstname();
194
+ $shipping['LastName'] = $shippingAddress->getLastname();
195
+ $shipping['Phone'] = $shippingAddress->getTelephone();
196
+ $shipping['PostCode'] = $request->getDestPostcode();
197
+ $shipping['Region'] = $request->getDestRegionCode();
198
+ foreach($shippingStreet as $key => $value) {
199
+ $shipping['Street' . ($key + 1)] = $value;
200
+ }
201
+ $addressInfo['Shipping'] = $shipping;
202
+ $addressInfo['ControlNumber'] = $quote->getCpf();
203
+ $json['AddressInfo'] = $addressInfo;
204
+ $json['CurrencyCode'] = $request->getPackageCurrency()->getCurrencyCode();
205
+ $json['DDP'] = true;
206
+ $itemsList = array();
207
+ foreach ($request->getAllItems() as $item) {
208
+ /* var $item Mage_Sales_Model_Quote_Item */
209
+ $itemProduct = Mage::getModel('catalog/product')->load($item->getProductId());
210
+ /* var $itemProduct Mage_Catalog_Model_Product */
211
+ //get item price
212
+ $itemPrice = (float)$item->getFinalPrice() ?: (float)$item->getPrice();
213
+ // if not price and item has parent (is configurable)
214
+ if (!$itemPrice && ($parent=$item->getParentItem())) {
215
+ // get parent price
216
+ $itemPrice = (float)$parent->getFinalPrice() ?: (float)$parent->getPrice();
217
+ }
218
+ // if still not price
219
+ if (!$itemPrice) {
220
+ // get product price
221
+ $itemPrice = (float)$item->getProduct()->getPrice();
222
+ }
223
+ // if product isn't virtual and is configurable or downloadable
224
+ if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(), array('configurable','downloadable'))) {
225
+ // add line item node
226
+ $lineItem = array();
227
+ $lineItem['SKU'] = $item->getSku();
228
+ $lineItem['CustWeightLbs'] = (float)$item->getWeight();
229
+ $lineItem['ValueUSD'] = $itemPrice;
230
+ $lineItem['CustLengthInches'] = (float)$item->getLength();
231
+ $lineItem['CustWidthInches'] = (float)$item->getWidth();
232
+ $lineItem['CustHeightInches'] = (float)$item->getHeight();
233
+ $lineItem['Quantity'] = $item->getTotalQty();
234
+ $lineItem['ValueShopperCurrency'] = $itemPrice;
235
+ $lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
236
+ $itemsList[] = $lineItem;
237
+ }
238
+ }
239
+ $json['ItemDetailsList'] = $itemsList;
240
+ // Get discounts
241
+ $totals = $quote->getTotals();
242
+ $discount = 0;
243
+ if (isset($totals['discount']) && $totals['discount']->getValue()) {
244
+ $discount = -1 * $totals['discount']->getValue();
245
+ }
246
+ $json['OtherDiscount'] = $discount;
247
+ $json['OtherDiscountCurrency'] = $quote->getQuoteCurrencyCode();
248
+ $json['ParcelID'] = 0;
249
+ $json['SessionID'] = '';
250
+ $json['key'] = Mage::helper('iparcel')->getGuid();
251
+ $log->setRequest(json_encode($json));
252
+ $response = $this->_restJSON($json, $this->_quote);
253
+ $log->setResponse($response);
254
+ $log->save();
255
+ return json_decode($response);
256
+ }
257
+
258
  /**
259
  * Send SubmitCatalog request
260
  *
292
  return $numberToUpload;
293
  }
294
 
295
+ /**
296
+ * Send Submit Parcel request
297
+ *
298
+ * Takes the passed Shipment and transforms it into data that can be passed
299
+ * to the API. It then submits the request as JSON to the SubmitParcel API
300
+ * endpoint.
301
+ *
302
+ * @param Mage_Sales_Model_Order_Shipment $shipment Magento shipment to be acknowledged as parcel
303
+ * @return stdClass Response from the SubmitParcel API
304
+ */
305
+ public function submitParcel(Mage_Sales_Model_Order_Shipment $shipment)
306
+ {
307
+ $order = $shipment->getOrder();
308
+ // init log
309
+ $log = Mage::getModel('iparcel/log');
310
+ /* var $log Iparcel_All_Model_Api_Log */
311
+ $log->setController('Submit Parcel');
312
+ $shippingAddress = $order->getShippingAddress();
313
+ /* var $shippingAddress Mage_Sales_Model_Quote_Address */
314
+ $billingAddress = $order->getBillingAddress();
315
+ /* var $billingAddress Mage_Sales_Model_Quote_Address */
316
+ $json = array();
317
+ $addressInfo = array();
318
+ $billingStreet = $billingAddress->getStreet();
319
+ $billing = array();
320
+ $billing['City'] = $billingAddress->getCity();
321
+ $billing['CountryCode'] = $billingAddress->getCountryId();
322
+ $billing['Email'] = $order->getCustomerEmail();
323
+ $billing['FirstName'] = $billingAddress->getFirstname();
324
+ $billing['LastName'] = $billingAddress->getLastname();
325
+ $billing['Phone'] = $billingAddress->getTelephone();
326
+ $billing['PostCode'] = $billingAddress->getPostcode();
327
+ $billing['Region'] = $billingAddress->getRegion();
328
+ $billing['Street1'] = $billingStreet[0];
329
+ if (array_key_exists(1, $billingStreet)) {
330
+ $billing['Street2'] = $billingStreet[1];
331
+ }
332
+ $addressInfo['Billing'] = $billing;
333
+ $shippingStreet = $shippingAddress->getStreet();
334
+ $shipping = array();
335
+ $shipping['City'] = $shippingAddress->getCity();
336
+ $shipping['CountryCode'] = $shippingAddress->getCountryId();
337
+ $shipping['Email'] = $order->getCustomerEmail();
338
+ $shipping['FirstName'] = $shippingAddress->getFirstname();
339
+ $shipping['LastName'] = $shippingAddress->getLastname();
340
+ $shipping['Phone'] = $shippingAddress->getTelephone();
341
+ $shipping['PostCode'] = $shippingAddress->getPostcode();
342
+ $shipping['Region'] = $shippingAddress->getRegion();
343
+ $shipping['Street1'] = $shippingStreet[0];
344
+ if (array_key_exists(1, $shippingStreet)) {
345
+ $shipping['Street2'] = $shippingStreet[1];
346
+ }
347
+ $addressInfo['Shipping'] = $shipping;
348
+ $addressInfo['ControlNumber'] = $order->getCpf();
349
+ $json['AddressInfo'] = $addressInfo;
350
+ $json['CurrencyCode'] = $order->getOrderCurrencyCode();
351
+ $json['DDP'] = true;
352
+ $shipmentItems = $shipment->getAllItems();
353
+ $itemsList = array();
354
+ foreach ($shipmentItems as $item) {
355
+ /** @var $item Mage_Sales_Model_Order_Shipment_Item */
356
+ // Check for a configurable product -- the simple should be loaded
357
+ /** @var $itemProduct Mage_Catalog_Model_Product */
358
+ $orderItem = $item->getOrderItem();
359
+ if ($orderItem->getProductType() == "configurable") {
360
+ $itemProduct = $orderItem->getChildrenItems();
361
+ $itemProduct = $itemProduct[0];
362
+ } else {
363
+ $itemProduct = Mage::getModel('catalog/product')->load($item->getOrderItem()->getProductId());
364
+ }
365
+ //get item price
366
+ $itemPrice = (float)$item->getFinalPrice() ?: (float)$item->getPrice();
367
+ // if not price and item has parent (is configurable)
368
+ if (!$itemPrice && ($parent=$item->getParentItem())) {
369
+ // get parent price
370
+ $itemPrice = (float)$parent->getFinalPrice() ?: (float)$parent->getPrice();
371
+ }
372
+ // if still not price
373
+ if (!$itemPrice) {
374
+ // get product price
375
+ $itemPrice = (float)$item->getProduct()->getPrice();
376
+ }
377
+ // if product isn't virtual and is configurable or downloadable
378
+ if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(), array('configurable','downloadable'))) {
379
+ // add line item node
380
+ $lineItem = array();
381
+ $lineItem['SKU'] = $item->getSku();
382
+ $lineItem['CustWeightLbs'] = (float)$item->getWeight();
383
+ $lineItem['ValueUSD'] = $itemPrice;
384
+ $lineItem['CustLengthInches'] = (float)$item->getLength();
385
+ $lineItem['CustWidthInches'] = (float)$item->getWidth();
386
+ $lineItem['CustHeightInches'] = (float)$item->getHeight();
387
+ $lineItem['Quantity'] = (float)$item->getQty();
388
+ $lineItem['ValueShopperCurrency'] = $itemPrice;
389
+ $lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
390
+ $itemsList[] = $lineItem;
391
+ }
392
+ }
393
+ $json['ItemDetailsList'] = $itemsList;
394
+ // if order_reference is set add it to request
395
+ if (Mage::getStoreConfig('carriers/iparcel/order_reference')) {
396
+ $json['OrderReference'] = $order->getIncrementId();
397
+ }
398
+ // Get discounts
399
+ $orderDiscountAmount = $order->getData('discount_amount');
400
+ $discount = 0;
401
+ if ($orderDiscountAmount != 0) {
402
+ $discount = -1 * $orderDiscountAmount;
403
+ }
404
+ // Get ServiceLevelID
405
+ $method = $order->getShippingMethod();
406
+ /* var $method string */
407
+ $method = explode('_', $method);
408
+ /* var $method array */
409
+ array_shift($method);
410
+ $serviceLevelId = implode('_', $method);
411
+ /* var $serviceLevelId string */
412
+ $json['OtherDiscount'] = $discount;
413
+ $json['OtherDiscountCurrency'] = $order->getOrderCurrencyCode();
414
+ $json['ServiceLevel'] = $serviceLevelId;
415
+ $json['SessionID'] = '';
416
+ $json['key'] = Mage::helper('iparcel')->getGuid();
417
+ $log->setRequest(json_encode($json));
418
+ $response = $this->_restJSON($json, $this->_submitParcel);
419
+ $log->setResponse($response);
420
+ $log->save();
421
+ return json_decode($response);
422
+ }
423
+
424
+ /**
425
+ * Split a shipment via web service API
426
+ *
427
+ * @param Mage_Sales_Model_Order_Shipment $shipment
428
+ * @param array $itemCollection Items to split into separate shipment
429
+ * @return Object
430
+ */
431
+ public function splitShipment(Mage_Sales_Model_Order_Shipment $shipment, $itemCollection)
432
+ {
433
+ if (count($itemCollection) < 1) {
434
+ Mage::throwException(
435
+ 'Failed when splitting shipment: Item count must be greater than 0'
436
+ );
437
+ }
438
+
439
+ $json = array();
440
+ $json['TrackingNumber'] = Mage::helper('iparcel')->getTrackingNumber($shipment);
441
+ $json['SkuList'] = array();
442
+ $json['Key'] = Mage::helper('iparcel')->getGuid();
443
+
444
+ $items = array();
445
+ foreach ($itemCollection as $item) {
446
+ $items['Sku'] = $item['sku'];
447
+ $items['Quantity'] = $item['qty'];
448
+ $json['SkuList'][] = $items;
449
+ }
450
+
451
+ $response = $this->_restJSON($json, $this->_split);
452
+
453
+ $log = Mage::getModel('iparcel/log');
454
+ $log->setController('Split Shipment');
455
+ $log->setRequest(json_encode($json));
456
+ $log->setResponse($response);
457
+ $log->save();
458
+
459
+ $response = json_decode($response);
460
+
461
+ if (is_array($response) && count($response) == 2) {
462
+ // Delete old shipment, create two new ones.
463
+
464
+ $order = $shipment->getOrder();
465
+ $orderItems = $order->getAllItems();
466
+
467
+ // Split the order items into two arrays, one for each new shipment
468
+ $firstItems = array();
469
+ $secondItems = array();
470
+ foreach($orderItems as $orderItem) {
471
+ foreach($itemCollection as $item) {
472
+ if ($orderItem->getSku() == $item['sku']) {
473
+ $firstItems[$orderItem->getId()] = $item['qty'];
474
+ $secondItems[$orderItem->getId()] = $orderItem->getQtyOrdered() - $item['qty'];
475
+ } else {
476
+ $secondItems[$orderItem->getId()] = $orderItem->getQtyOrdered();
477
+ }
478
+ }
479
+ }
480
+
481
+ // Delete the original shipment
482
+ $shipment->delete();
483
+ $items = $order->getAllVisibleItems();
484
+ foreach($items as $item){
485
+ $item->setQtyShipped(0);
486
+ $item->save();
487
+ }
488
+
489
+ Mage::register('iparcel_skip_auto_submit', true);
490
+ // Create a new shipment for each set of items
491
+ $firstShipment = Mage::getModel('sales/order_shipment_api')->create(
492
+ $order->getIncrementId(),
493
+ $firstItems,
494
+ null,
495
+ false,
496
+ false
497
+ );
498
+ Mage::getModel('sales/order_shipment_api')->addTrack(
499
+ $firstShipment,
500
+ $order->getShippingCarrier()->getCarrierCode(),
501
+ 'I-Parcel',
502
+ $response[0]
503
+ );
504
+
505
+ $secondShipment = Mage::getModel('sales/order_shipment_api')->create(
506
+ $order->getIncrementId(),
507
+ $secondItems,
508
+ null,
509
+ false,
510
+ false
511
+ );
512
+ Mage::getModel('sales/order_shipment_api')->addTrack(
513
+ $secondShipment,
514
+ $order->getShippingCarrier()->getCarrierCode(),
515
+ 'I-Parcel',
516
+ $response[1]
517
+ );
518
+ Mage::unregister('iparcel_skip_auto_submit');
519
+ } else {
520
+ Mage::throwException(
521
+ 'Failed when splitting shipment.'
522
+ );
523
+ }
524
+
525
+ return true;
526
+ }
527
+
528
  /**
529
  * Prepare product collection for SubmitCatalog calls
530
  *
app/code/community/Iparcel/All/Helper/Data.php CHANGED
@@ -27,4 +27,260 @@ class Iparcel_All_Helper_Data extends Mage_Core_Helper_Abstract
27
  {
28
  return Mage::getStoreConfig('iparcel/config/custid');
29
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
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
+
41
+ /**
42
+ * Escape quotation mark in strings for inclusion in JavaScript objects
43
+ *
44
+ * @param string $string String to escape
45
+ * @return string
46
+ */
47
+ public function jsEscape($string = '')
48
+ {
49
+ return addcslashes($string, "\"");
50
+ }
51
+
52
+ /**
53
+ * Finds the tracking number of a Magento shipment
54
+ *
55
+ * @param Mage_Sales_Model_Order_Shipment $shipment
56
+ * @return string
57
+ */
58
+ public function getTrackingNumber(Mage_Sales_Model_Order_Shipment $shipment)
59
+ {
60
+ $trackingNumber = '';
61
+ $tracks = $shipment->getAllTracks();
62
+
63
+ if (array_key_exists(0, $tracks)) {
64
+ $trackingNumber = $tracks[0]->getTrackNumber();
65
+ }
66
+
67
+ return $trackingNumber;
68
+ }
69
+
70
+ /**
71
+ * Determines if the current shipping rate request is International.
72
+ *
73
+ * "International" is determined by the store's Shipping Settings "Origin"
74
+ * country. This can be overridden in the i-parcel Shipping Method settings.
75
+ *
76
+ * @param Mage_Shipping_Model_Rate_Request $request
77
+ * @return boolean
78
+ */
79
+ public function getIsInternational(Mage_Shipping_Model_Rate_Request $request)
80
+ {
81
+ $isInternational = false;
82
+ $originCountryId = $this->_getOriginCountry();
83
+ $destinationCountryId = $request->getDestCountryId();
84
+ if ($originCountryId !== $destinationCountryId) {
85
+ $isInternational = true;
86
+ }
87
+ return $isInternational;
88
+ }
89
+
90
+ /**
91
+ * Determines if an order is an i-parcel order
92
+ *
93
+ * @param Mage_Sales_Model_Order $order
94
+ * @return bool
95
+ */
96
+ public function isIparcelOrder(Mage_Sales_Model_Order $order)
97
+ {
98
+ $iparcelCarrier = Mage::getModel('iparcel/carrier_iparcel');
99
+ if ($order->getShippingCarrier()->getCarrierCode() == $iparcelCarrier->getCarrierCode()) {
100
+ return true;
101
+ }
102
+ return false;
103
+ }
104
+
105
+ /**
106
+ * Returns the admin URL to cancel a shipment
107
+ *
108
+ * @param string $shipment ID of shipment to cancel.
109
+ * @return string
110
+ */
111
+ public function getShipmentCancelUrl($shipment)
112
+ {
113
+ return Mage::helper('adminhtml')->getUrl(
114
+ 'adminhtml/iparcel_shipment/cancel',
115
+ array('shipment' => $shipment)
116
+ );
117
+ }
118
+ /**
119
+ * Returns the admin URL to split a shipment
120
+ *
121
+ * @param string $shipment ID of shipment to split.
122
+ * @return string
123
+ */
124
+ public function getShipmentSplitUrl($shipment)
125
+ {
126
+ return Mage::helper('adminhtml')->getUrl(
127
+ 'adminhtml/iparcel_shipment/split',
128
+ array('shipment' => $shipment)
129
+ );
130
+ }
131
+ /**
132
+ * Returns the total count of all items on a shipment
133
+ *
134
+ * @param $shipment Shipment ID or Mage_Sales_Model_Order_Shipment object to count
135
+ * @return string
136
+ */
137
+ public function getShipmentItemCount($shipment)
138
+ {
139
+ if (!is_object($shipment)) {
140
+ $shipment = Mage::getModel('sales/order_shipment')->load($shipment);
141
+ }
142
+ $qty = 0;
143
+ $items = $shipment->getAllItems();
144
+ foreach ($items as $item) {
145
+ $qty += $item->getQty();
146
+ }
147
+ return $qty;
148
+ }
149
+
150
+
151
+ /**
152
+ * Retrieve Service Levels from the database
153
+ *
154
+ * @return array Array of [ServiceLevel] => Title
155
+ */
156
+ public function getServiceLevels()
157
+ {
158
+ $serviceLevels = unserialize(Mage::getStoreConfig('carriers/iparcel/name'));
159
+ $formatted = array();
160
+ foreach ($serviceLevels as $level) {
161
+ $formatted[$level['service_id']] = $level['title'];
162
+ }
163
+ return $formatted;
164
+ }
165
+
166
+ /**
167
+ * Finds the Origin country as configured in the Magento admin.
168
+ *
169
+ * @return string Two-letter Country Code
170
+ */
171
+ private function _getOriginCountry()
172
+ {
173
+ // If the admin has chose to select a different "origin" country
174
+ if (Mage::getStoreConfig('carriers/iparcel/choose_domestic')) {
175
+ return Mage::getStoreConfig('carriers/iparcel/origin_country_id');
176
+ }
177
+ return Mage::getStoreConfig('shipping/origin/country_id');
178
+ }
179
+
180
+ /**
181
+ * Helper method to find the value of the tax intercepting mode
182
+ *
183
+ * @return boolean
184
+ */
185
+ public function getDisplayTaxAndDutyCumulatively()
186
+ {
187
+ return Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_All_Model_System_Config_Source_Tax_Mode::CUMULATIVELY;
188
+ }
189
+ /**
190
+ * Helper method to find the value of the tax intercepting mode
191
+ *
192
+ * @return boolean
193
+ */
194
+ public function getDisplayTaxAndDutySeparately()
195
+ {
196
+ return Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_All_Model_System_Config_Source_Tax_Mode::SEPARATELY;
197
+ }
198
+ /**
199
+ * Return the Admin user created "Tax" Label
200
+ *
201
+ * @return string
202
+ */
203
+ public function getTaxLabel()
204
+ {
205
+ $taxLabel = Mage::getStoreConfig('iparcel/tax/tax_label');
206
+ if ($taxLabel == '') {
207
+ return Mage::helper('iparcel')->__('Tax');
208
+ } else {
209
+ return $taxLabel;
210
+ }
211
+ }
212
+ /**
213
+ * Return the Admin user created "Duty" Label
214
+ *
215
+ * @return string
216
+ */
217
+ public function getDutyLabel()
218
+ {
219
+ $dutyLabel = Mage::getStoreConfig('iparcel/tax/duty_label');
220
+ if ($dutyLabel == '') {
221
+ return Mage::helper('iparcel')->__('Duty');
222
+ } else {
223
+ return $dutyLabel;
224
+ }
225
+ }
226
+ /**
227
+ * Return the Admin user created "Tax And Duty" Label
228
+ *
229
+ * @return string
230
+ */
231
+ public function getTaxAndDutyLabel()
232
+ {
233
+ $taxAndDutyLabel = Mage::getStoreConfig('iparcel/tax/tax_duty_label');
234
+ if ($taxAndDutyLabel == '') {
235
+ return Mage::helper('iparcel')->__('Tax & Duty');
236
+ } else {
237
+ return $taxAndDutyLabel;
238
+ }
239
+ }
240
+
241
+ /**
242
+ * Returns the installed status of Iparcel_CartHandoff
243
+ *
244
+ * @return bool
245
+ */
246
+ public function isCartHandoffInstalled()
247
+ {
248
+ return $this->_isExtensionInstalled('Iparcel_CartHandoff');
249
+ }
250
+
251
+ /**
252
+ * Returns the installed status of Iparcel_GlobaleCommerce
253
+ *
254
+ * @return bool
255
+ */
256
+ public function isGlobaleCommerceInstalled()
257
+ {
258
+ return $this->_isExtensionInstalled('Iparcel_GlobaleCommerce');
259
+ }
260
+
261
+ /**
262
+ * Returns the installed status of Iparcel_Logistics
263
+ *
264
+ * @return bool
265
+ */
266
+ public function isLogisticsInstalled()
267
+ {
268
+ return $this->_isExtensionInstalled('Iparcel_Logistics');
269
+ }
270
+
271
+ /**
272
+ * Finds if an extension is installed
273
+ *
274
+ * @param string $name
275
+ * @return bool
276
+ */
277
+ private function _isExtensionInstalled($name)
278
+ {
279
+ if ($name == '') {
280
+ return false;
281
+ }
282
+
283
+ $allExtensions = Mage::app()->getConfig()->getNode('modules')->asArray();
284
+ return array_key_exists($name, $allExtensions);
285
+ }
286
  }
app/code/community/Iparcel/All/Helper/International.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel international customer helper
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_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/All/Model/Api/Quote.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Model for retrieving stored shipping quotes from the database
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Api_Quote extends Mage_Core_Model_Abstract
10
+ {
11
+ /**
12
+ * Initialize resource model
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('iparcel/api_quote');
17
+ }
18
+
19
+ /**
20
+ * Loads quote from database by Magento Quote ID
21
+ *
22
+ * @param int $quote_id
23
+ * @return Iparcel_All_Model_Api_Quote
24
+ */
25
+ public function loadByQuoteId($quote_id)
26
+ {
27
+ $this->load($quote_id, 'quote_id');
28
+ return $this;
29
+ }
30
+
31
+ /**
32
+ * Setter for serviceLevels
33
+ *
34
+ * @param array serviceLevels
35
+ * @return Iparcel_All_Model_Api_Quote
36
+ */
37
+ public function setServiceLevels($serviceLevels)
38
+ {
39
+ $this->setData('service_levels', serialize($serviceLevels));
40
+ }
41
+
42
+ /**
43
+ * Getter for serviceLevels
44
+ *
45
+ * @return array
46
+ */
47
+ public function getServiceLevels()
48
+ {
49
+ return unserialize($this->getData('service_levels'));
50
+ }
51
+ }
app/code/community/Iparcel/All/Model/Carrier/Iparcel.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel shipping method model
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
10
+ {
11
+ protected $_code = 'iparcel';
12
+
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 Tracking 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->getConfigData('title'),
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('iparcel')->__('Default box'));
58
+ }
59
+
60
+ /**
61
+ * Collect shipping rates for i-parcel shipping
62
+ * refactor: add result check, add intermediate storage for parcel_id
63
+ *
64
+ * @param Mage_Shipping_Model_Rate_Request $request
65
+ * @return Mage_Shipping_Model_Rate_Result|bool
66
+ */
67
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
68
+ {
69
+ try {
70
+ /** @var boolean $internationalOrder */
71
+ $internationalOrder = Mage::helper('iparcel')->getIsInternational($request);
72
+ if ($internationalOrder && Mage::getStoreConfig('carriers/iparcel/active')) {
73
+ /** @var array $iparcel Tax & Duty totals */
74
+ $iparcelTaxAndDuty = array();
75
+ /** @var Mage_Shipping_Model_Rate_Result $result*/
76
+ $result = Mage::getModel('shipping/rate_result');
77
+ // Get Allowed Methods
78
+ /** @var array $allowed_methods Shipping method allowed via admin config "names" */
79
+ $allowed_methods = $this->getAllowedMethods();
80
+ /** @var stdClass $quote */
81
+ $quote = Mage::helper('iparcel/api')->quote($request);
82
+ $iparcelTaxAndDuty['parcel_id'] = $quote->ParcelID;
83
+ $serviceLevel = new stdClass;
84
+ if (isset($quote->ServiceLevels)) {
85
+ $serviceLevel = $quote->ServiceLevels;
86
+ }
87
+ // Handling serviceLevels results and set up the shipping method
88
+ foreach ($serviceLevel as $ci) {
89
+ // setting up values
90
+ $servicename = @$ci->ServiceLevelID;
91
+ $duty = (float)@$ci->DutyCompanyCurrency;
92
+ $tax = (float)@$ci->TaxCompanyCurrency;
93
+ $shipping = (float)@$ci->ShippingChargeCompanyCurrency;
94
+ $tax_flag = Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_All_Model_System_Config_Source_Tax_Mode::DISABLED
95
+ || $request->getDestCountryId() == $request->getCountryId();
96
+ // true if tax intercepting is disabled
97
+ $total = $tax_flag ? (float)($duty + $tax + $shipping) : (float)$shipping;
98
+ if (!isset($allowed_methods[$servicename])) {
99
+ continue;
100
+ }
101
+ $shiplabel = $allowed_methods[$servicename];
102
+ $title = $shiplabel;
103
+ if ($tax_flag) {
104
+ $title = Mage::helper('iparcel')->__(
105
+ '%s (Shipping Price: %s Duty: %s Tax: %s)',
106
+ $shiplabel,
107
+ $this->_formatPrice($shipping),
108
+ $this->_formatPrice($duty),
109
+ $this->_formatPrice($tax)
110
+ );
111
+ }
112
+ $method = Mage::getModel('shipping/rate_result_method');
113
+ $method->setCarrier($this->_code);
114
+ $method->setCarrierTitle($this->getConfigData('title'));
115
+ $method->setMethod($servicename);
116
+ $method->setMethodTitle($title);
117
+ $method->setPrice($total);
118
+ $method->setCost($total);
119
+ // append method to result
120
+ $result->append($method);
121
+ $iparcelTaxAndDuty['service_levels'][$this->_code . '_' . $servicename] = array(
122
+ 'duty' => $duty,
123
+ 'tax' => $tax
124
+ );
125
+ }
126
+ // Store the shipping quote
127
+ $quoteId = Mage::getModel('checkout/cart')->getQuote()->getId();
128
+ $quote = Mage::getModel('iparcel/api_quote');
129
+ $quote->loadByQuoteId($quoteId);
130
+ $quote->setQuoteId($quoteId);
131
+ $quote->setParcelId($iparcelTaxAndDuty['parcel_id']);
132
+ $quote->setServiceLevels($iparcelTaxAndDuty['service_levels']);
133
+ $quote->save();
134
+ return $result;
135
+ }
136
+ } catch (Exception $e) {
137
+ Mage::logException($e);
138
+ }
139
+ return false;
140
+ }
141
+
142
+
143
+ public function getMethodsNames()
144
+ {
145
+ $names = array();
146
+ $raw = $this->getConfigData('name');
147
+ $raw = unserialize($raw);
148
+ foreach ($raw as $method) {
149
+ $names[$method['service_id']] = $method['title'];
150
+ }
151
+ return $names;
152
+ }
153
+
154
+ /**
155
+ * Get Allowed Shipping Methods
156
+ *
157
+ * @return array
158
+ */
159
+ public function getAllowedMethods()
160
+ {
161
+ return $this->getMethodsNames();
162
+ }
163
+ }
app/code/community/Iparcel/{GlobaleCommerce → All}/Model/Config/Script/Js.php RENAMED
@@ -3,10 +3,10 @@
3
  * Backend model for JavaScript file config field
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_GlobaleCommerce_Model_Config_Script_Js extends Mage_Adminhtml_Model_System_Config_Backend_File
10
  {
11
  const UPLOAD_ROOT = 'js';
12
  const UPLOAD_DIR = 'iparcel_custom';
3
  * Backend model for JavaScript file config field
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Model_Config_Script_Js extends Mage_Adminhtml_Model_System_Config_Backend_File
10
  {
11
  const UPLOAD_ROOT = 'js';
12
  const UPLOAD_DIR = 'iparcel_custom';
app/code/community/Iparcel/All/Model/Log.php CHANGED
@@ -6,158 +6,13 @@
6
  * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_All_Model_Log extends Varien_Object
10
  {
11
- const LOG_FILENAME = "iparcel.log";
12
- const MAX_LOG_SIZE = 10;
13
-
14
- protected $_jsonData;
15
-
16
  /**
17
- * Internal constructor
18
  */
19
  protected function _construct()
20
  {
21
- $this->setLogFilename(Mage::getBaseDir('log').'/'.self::LOG_FILENAME);
22
- $this->setJson($this->_read());
23
- }
24
-
25
- /**
26
- * Read log file method
27
- *
28
- * @return Varien_Data_Collection
29
- */
30
- protected function _read()
31
- {
32
- $response = new Varien_Data_Collection();
33
-
34
- if (!file_exists($this->getLogFilename())) {
35
- $this->_jsonData = array();
36
- return $response;
37
- }
38
-
39
- $file = fopen($this->getLogFilename(), "r");
40
- $this->_jsonData = json_decode(fread($file, filesize($this->getLogFilename())), true);
41
- fclose($file);
42
-
43
- if (!is_array($this->_jsonData)) {
44
- if (!$this->_clear()) {
45
- Mage::throwException(Mage::helper('iparcel')->__('Access Forbidden for i-parcel log file'));
46
- }
47
- $this->_jsonData = array();
48
- return $response;
49
- }
50
-
51
- // for each json log node append Varien Object to Varien Data Collection
52
- foreach ($this->_jsonData['logs'] as $log) {
53
- $_log = new Varien_Object(array(
54
- 'timestamp' => $log['Timestamp'],
55
- 'controller' => $log['Controller'],
56
- 'response' => $log['Response'],
57
- 'request' => $log['Request']
58
- ));
59
- $response->addItem($_log);
60
- }
61
- return $response;
62
- }
63
-
64
- /**
65
- * Internal save method
66
- *
67
- * @return bool
68
- */
69
- protected function _save()
70
- {
71
- try {
72
- $file = fopen($this->getLogFilename(), 'w');
73
- fwrite($file, json_encode($this->_jsonData));
74
- fclose($file);
75
- return true;
76
- } catch (Exception $e) {
77
- return false;
78
- }
79
- }
80
-
81
- /**
82
- * Internal create JSON file method
83
- *
84
- * @return bool
85
- */
86
- protected function _create()
87
- {
88
- $this->_jsonData['created'] = $this->getTimestamp();
89
- $this->_jsonData['edited'] = $this->getTimestamp();
90
- $this->_jsonData['logs'] = array();
91
-
92
- $this->_appendLog();
93
- return $this->_save();
94
- }
95
-
96
- /**
97
- * Internal append XML to file method
98
- *
99
- * @return bool
100
- */
101
- protected function _append()
102
- {
103
- $this->_jsonData['edited'] = $this->getTimestamp();
104
-
105
- $this->_appendLog();
106
- return $this->_save();
107
- }
108
-
109
- /**
110
- * Internal clear XML file method
111
- *
112
- * @return bool
113
- */
114
- protected function _clear()
115
- {
116
- return unlink($this->getLogFilename());
117
- }
118
-
119
- /**
120
- * Internal append log nodes to SimpleXMLExtended object
121
- */
122
- protected function _appendLog()
123
- {
124
- $log = array();
125
- $log['Timestamp'] = $this->getTimestamp();
126
- $log['Controller'] = $this->getController();
127
- $log['Request'] = $this->getRequest();
128
- $log['Response'] = $this->getResponse();
129
-
130
- $this->_jsonData['logs'][] = $log;
131
- if (self::MAX_LOG_SIZE < count($this->_jsonData['logs'])) {
132
- array_shift($this->_jsonData['logs']);
133
- }
134
- }
135
-
136
- /**
137
- * Save log file method
138
- *
139
- * @return bool
140
- */
141
- public function save()
142
- {
143
- $this->setTimestamp(date('d/m/Y h:i:sA T'));
144
- $_request = $this->getRequest();
145
- $_response = $this->getResponse();
146
- $_controller = $this->getController();
147
- if (!($_request !== null && $_response !== null && $_controller)) {
148
- Mage::throwException(Mage::helper('iparcel')->__('Log data is not filled'));
149
- }
150
- // append if file exists, if not create new
151
- return file_exists($this->getLogFilename()) ? $this->_append() : $this->_create();
152
- }
153
-
154
- /**
155
- * Clear log file method
156
- *
157
- * @return bool
158
- */
159
- public function clear()
160
- {
161
- return $this->_clear();
162
  }
163
  }
6
  * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Model_Log extends Mage_Core_Model_Abstract
10
  {
 
 
 
 
 
11
  /**
12
+ * Initialize resource model
13
  */
14
  protected function _construct()
15
  {
16
+ $this->_init('iparcel/log');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
  }
app/code/community/Iparcel/All/Model/Observer.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Observer class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Observer
10
+ {
11
+ /**
12
+ * Handles triggering the submitParcel call for the shipment.
13
+ *
14
+ * @param $observer
15
+ */
16
+ public function shipment_save_after($observer)
17
+ {
18
+ // if autotrack is enabled then order can be tracked when shipped
19
+ if (Mage::getStoreConfigFlag('carriers/iparcel/autotrack')) {
20
+ // If we are splitting shipments, skip automatic submission.
21
+ if (Mage::registry('iparcel_skip_auto_submit')) {
22
+ return true;
23
+ }
24
+
25
+ // Check the shipment to make sure we don't already have a tracking
26
+ // number attached
27
+ $shipment = $observer->getShipment();
28
+ $shipmentTracks = Mage::getModel('sales/order_shipment_api')->info(
29
+ $shipment->getIncrementId()
30
+ );
31
+
32
+ if (count($shipmentTracks['tracks'])) {
33
+ return;
34
+ }
35
+
36
+ $order = $observer->getShipment()->getOrder();
37
+ if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() == 'iparcel') {
38
+ $api = Mage::helper('iparcel/api');
39
+ $response = $api->submitParcel($shipment);
40
+
41
+ // Find the name of the Service Level as defined in the Admin
42
+ $serviceLevels = Mage::helper('iparcel')->getServiceLevels();
43
+ $responseServiceLevelId = $response->ServiceLevels[0][0]->ServiceLevelID;
44
+ $serviceLevelTitle = 'I-Parcel';
45
+ if (array_key_exists($responseServiceLevelId, $serviceLevels)) {
46
+ $serviceLevelTitle = $serviceLevels[$responseServiceLevelId];
47
+ }
48
+
49
+ // Add tracking number from submitParcel response
50
+ Mage::getModel('sales/order_shipment_api')->addTrack(
51
+ $shipment->getIncrementId(),
52
+ $order->getShippingCarrier()->getCarrierCode(),
53
+ $serviceLevelTitle,
54
+ $response->CarrierTrackingNumber
55
+ );
56
+ }
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Handles shipment creation if `autoship` is enabled
62
+ *
63
+ * @param $observer
64
+ */
65
+ public function order_place_after($observer)
66
+ {
67
+ /** @var Mage_Sales_Model_Order $order */
68
+ $order = $observer->getOrder();
69
+
70
+ if (Mage::registry('iparcel_skip_auto_create_shipment')) {
71
+ return true;
72
+ }
73
+
74
+ if (!$order->getQuote()) {
75
+ return;
76
+ }
77
+ // if it's i-parcel shipping method
78
+ if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() != 'iparcel') {
79
+ return;
80
+ }
81
+
82
+ // if autoship is enabled and order can be shipped
83
+ if (Mage::getStoreConfigFlag('carriers/iparcel/autoship')) {
84
+ if ($order->canShip()) {
85
+ $converter = Mage::getModel('sales/convert_order');
86
+ /* var $converter Mage_Sales_Model_Convert_Order */
87
+ $shipment = $converter->toShipment($order);
88
+ /* var $shipment Mage_Sales_Model_Order_Shipment */
89
+ foreach ($order->getAllItems() as $orderItem) {
90
+ /* var $orderItem Mage_Sales_Model_Order_Item */
91
+ // continue if it is virtual or there is no quantity to ship
92
+ if (!$orderItem->getQtyToShip()) {
93
+ continue;
94
+ }
95
+ if ($order->getIsVirtual()) {
96
+ continue;
97
+ }
98
+ $item = $converter->itemToShipmentItem($orderItem);
99
+ /* var $item Mage_Sales_Model_Order_Shipment_Item */
100
+ $item->setQty($orderItem->getQtyToShip());
101
+ $shipment->addItem($item);
102
+ }
103
+ $shipment->register();
104
+ $shipment->getOrder()->setIsInProcess(true);
105
+ $transactionSave = Mage::getModel('core/resource_transaction')
106
+ ->addObject($shipment)
107
+ ->addObject($order);
108
+ /* var $transactionSave Mage_Core_Model_Resource_Transaction */
109
+ $transactionSave->save();
110
+ $shipment->save();
111
+ $shipment->sendEmail();
112
+ }
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Cancels shipments for i-parcel orders if they are canceled.
118
+ *
119
+ * @param $observer
120
+ */
121
+ public function order_cancel_after($observer)
122
+ {
123
+ $order = $observer->getOrder();
124
+
125
+ Mage::helper('iparcel/api')->cancelShipmentsByOrder($order);
126
+ }
127
+
128
+ /**
129
+ * Add observer to add "Cancel Shipment" button to shipment view
130
+ *
131
+ * @param $observer
132
+ * @return bool
133
+ */
134
+ public function core_block_abstract_to_html_before($observer)
135
+ {
136
+ $block = $observer->getEvent()->getData('block');
137
+ $helper = Mage::helper('iparcel');
138
+
139
+ if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Shipment_View) {
140
+ $order = $block->getShipment()->getOrder();
141
+ $cancelUrl = $helper->getShipmentCancelUrl($block->getShipment()->getId());
142
+ $splitUrl = $helper->getShipmentSplitUrl($block->getShipment()->getId());
143
+
144
+ if ($helper->isIparcelOrder($order)) {
145
+ $confirmationMessage = $helper->__('Are you sure you want to cancel this shipment?');
146
+
147
+ $block->addButton(
148
+ 'shipment_cancel',
149
+ array(
150
+ 'label' => $helper->__('Cancel'),
151
+ 'onclick' => 'deleteConfirm(\'' . $confirmationMessage . '\', \'' . $cancelUrl . '\')'
152
+ )
153
+ );
154
+
155
+ $block->addButton(
156
+ 'shipment_split',
157
+ array(
158
+ 'label' => $helper->__('Split'),
159
+ 'onclick' => 'setLocation(\'' . $splitUrl . '\')',
160
+ 'class' => 'go'
161
+ )
162
+ );
163
+ }
164
+ }
165
+
166
+ return true;
167
+ }
168
+
169
+ /**
170
+ * Adds the "tax" and "duty" line item to PayPal API requests
171
+ *
172
+ * @param Varien_Event_Observer $observer
173
+ */
174
+ public function paypal_prepare_line_items(Varien_Event_Observer $observer)
175
+ {
176
+ try {
177
+ $cart = $observer->getEvent()->getPaypalCart();
178
+ $shippingAddress = $cart->getSalesEntity()->getShippingAddress();
179
+ $totalAbstract = Mage::getModel('iparcel/quote_address_total_abstract');
180
+ if (!is_object($shippingAddress)) {
181
+ return;
182
+ }
183
+
184
+ $iparcelTax = 0;
185
+ $iparcelDuty = 0;
186
+
187
+ if ($totalAbstract->isIparcelShipping($shippingAddress)) {
188
+ $iparcelTax = $shippingAddress->getIparcelTaxAmount();
189
+ $iparcelDuty = $shippingAddress->getIparcelDutyAmount();
190
+ } else {
191
+ $carrier = $cart->getSalesEntity()->getShippingCarrier();
192
+
193
+ if (is_object($carrier) && $carrier->getCarrierCode() == 'iparcel') {
194
+ $iparcelTax = $cart->getSalesEntity()->getIparcelTaxAmount();
195
+ $iparcelDuty = $cart->getSalesEntity()->getIparcelDutyAmount();
196
+ }
197
+ }
198
+
199
+ if ($iparcelTax > 0) {
200
+ $cart->addItem('Tax', 1, $iparcelTax, 'tax');
201
+ }
202
+
203
+ if ($iparcelDuty > 0) {
204
+ $cart->addItem('Duty', 1, $iparcelDuty, 'duty');
205
+ }
206
+ } catch (Exception $e) {
207
+ Mage::log('Unable to add i-parcel Tax/Duty to PayPal Order.');
208
+ Mage::log($e->getMessage());
209
+ }
210
+
211
+ return true;
212
+ }
213
+ }
app/code/community/Iparcel/All/Model/Order/Creditmemo/Total/Duty.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel model for displaying duty total on credit memos
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Order_Creditmemo_Total_Duty extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
10
+ {
11
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
12
+ {
13
+ $order = $creditmemo->getOrder();
14
+ $dutyAmount = $order->getIparcelDutyAmount();
15
+ $baseDutyAmount = $order->getBaseIparcelDutyAmount();
16
+
17
+ $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $dutyAmount);
18
+ $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseDutyAmount);
19
+
20
+ $creditmemo->setIparcelDutyAmount($dutyAmount);
21
+ $creditmemo->setBaseIparcelDutyAmount($baseDutyAmount);
22
+ }
23
+ }
app/code/community/Iparcel/All/Model/Order/Creditmemo/Total/Tax.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel model for displaying tax total on credit memos
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Order_Creditmemo_Total_Tax extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
10
+ {
11
+
12
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
13
+ {
14
+ $order = $creditmemo->getOrder();
15
+ $taxAmount = $order->getIparcelTaxAmount();
16
+ $baseTaxAmount = $order->getBaseIparcelTaxAmount();
17
+
18
+ $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $taxAmount);
19
+ $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseTaxAmount);
20
+
21
+ $creditmemo->setIparcelTaxAmount($taxAmount);
22
+ $creditmemo->setBaseIparcelTaxAmount($baseTaxAmount);
23
+ }
24
+ }
app/code/community/Iparcel/All/Model/Order/Invoice/Total/Duty.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel model for displaying duty total on invoices
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Order_Invoice_Total_Duty extends Mage_Sales_Model_Order_Invoice_Total_Abstract
10
+ {
11
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
12
+ {
13
+ $order = $invoice->getOrder();
14
+ $dutyAmount = $order->getIparcelDutyAmount();
15
+ $baseDutyAmount = $order->getBaseIparcelDutyAmount();
16
+
17
+ $invoice->setGrandTotal($invoice->getGrandTotal() + $dutyAmount);
18
+ $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseDutyAmount);
19
+
20
+ $invoice->setIparcelDutyAmount($dutyAmount);
21
+ $invoice->setBaseIparcelDutyAmount($baseDutyAmount);
22
+ }
23
+ }
app/code/community/Iparcel/All/Model/Order/Invoice/Total/Tax.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel model for displaying tax total on invoices
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Order_Invoice_Total_Tax extends Mage_Sales_Model_Order_Invoice_Total_Abstract
10
+ {
11
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
12
+ {
13
+ $order = $invoice->getOrder();
14
+ $taxAmount = $order->getIparcelTaxAmount();
15
+ $baseTaxAmount = $order->getBaseIparcelTaxAmount();
16
+
17
+ $invoice->setGrandTotal($invoice->getGrandTotal() + $taxAmount);
18
+ $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTaxAmount);
19
+
20
+ $invoice->setIparcelTaxAmount($taxAmount);
21
+ $invoice->setBaseIparcelTaxAmount($baseTaxAmount);
22
+ }
23
+ }
app/code/community/Iparcel/All/Model/Payment/Iparcel.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class for i-parcel external sales API payment method
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Payment_Iparcel extends Mage_Payment_Model_Method_Abstract
10
+ {
11
+ protected $_code = 'iparcel';
12
+ protected $_canUseCheckout = false;
13
+ protected $_canUseForMultishipping = false;
14
+ protected $_canUseInternal = false;
15
+ protected $_canCapture = true;
16
+ }
app/code/community/Iparcel/All/Model/Quote/Address/Total/Abstract.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Abstract model for i-parcel Quote Address totals
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Quote_Address_Total_Abstract extends Mage_Sales_Model_Quote_Address_Total_Abstract
10
+ {
11
+ /**
12
+ * Determines if the address is using an i-parcel shipping method
13
+ *
14
+ * @param Mage_Sales_Model_Quote_Address $address
15
+ * @return boolean
16
+ */
17
+ public function isIparcelShipping($address)
18
+ {
19
+ $shippingMethod = $address->getShippingMethod();
20
+ $shippingMethod = explode('_', $shippingMethod);
21
+ if ($shippingMethod[0] == 'iparcel') {
22
+ return true;
23
+ }
24
+ return false;
25
+ }
26
+ }
app/code/community/Iparcel/All/Model/Quote/Address/Total/Collector.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class to reorder Magento's total collectors
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Quote_Address_Total_Collector extends Mage_Sales_Model_Quote_Address_Total_Collector
10
+ {
11
+ public function getCollectors()
12
+ {
13
+ if (Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_All_Model_System_Config_Source_Tax_Mode::DISABLED) {
14
+ return parent::getCollectors();
15
+ }
16
+
17
+ $collectors = parent::getCollectors();
18
+
19
+ $totals = array(
20
+ 'iparcel_tax',
21
+ 'iparcel_duty',
22
+ 'grand_total',
23
+ 'reward',
24
+ 'giftcardaccount',
25
+ 'customerbalance'
26
+ );
27
+
28
+ foreach ($totals as $total) {
29
+ $collectors = $this->_moveIndexToEnd($total, $collectors);
30
+ }
31
+
32
+ return $collectors;
33
+ }
34
+
35
+ /**
36
+ * Move index of array to the end of the array
37
+ *
38
+ * @param mixed $index
39
+ * @param array $array
40
+ * @return array
41
+ */
42
+ private function _moveIndexToEnd($index, $array)
43
+ {
44
+ if (isset($array[$index])) {
45
+ $temp = $array[$index];
46
+ unset($array[$index]);
47
+ $array[$index] = $temp;
48
+ }
49
+
50
+ return $array;
51
+ }
52
+ }
app/code/community/Iparcel/All/Model/Quote/Address/Total/Duty.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel model for shipping duty
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Quote_Address_Total_Duty extends Iparcel_All_Model_Quote_Address_Total_Abstract
10
+ {
11
+ public function __construct()
12
+ {
13
+ $this->setCode('iparcel_duty');
14
+ }
15
+
16
+ /**
17
+ * Used each time collectTotals is invoked to find the duty rate
18
+ *
19
+ * @param Mage_Sales_Model_Quote_Address $address
20
+ * @return Iparcel_All_Model_Total_Duty
21
+ */
22
+ public function collect(Mage_Sales_Model_Quote_Address $address)
23
+ {
24
+ if ($address->getAddressType() != 'shipping') {
25
+ return;
26
+ }
27
+
28
+ if (Mage::helper('iparcel')->getDisplayTaxAndDutyCumulatively()
29
+ || Mage::helper('iparcel')->getDisplayTaxAndDutySeparately()) {
30
+ parent::collect($address);
31
+
32
+ $dutyAndTaxes = Mage::registry('iparcel_duty_and_taxes');
33
+ $duty = $dutyAndTaxes['service_levels'][$address->getShippingMethod()]['duty'];
34
+
35
+ $this->_setBaseAmount($duty);
36
+ $this->_setAmount(
37
+ $address->getQuote()->getStore()->convertPrice($duty, false)
38
+ );
39
+ }
40
+ return $this;
41
+ }
42
+
43
+ /**
44
+ * Display the duty rate
45
+ *
46
+ * @param Mage_Sales_Model_Quote_Address $address
47
+ * @return Iparcel_All_Model_Total_Duty
48
+ */
49
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
50
+ {
51
+ if ($address->getAddressType() != 'shipping'
52
+ || $this->isIparcelShipping($address) == false) {
53
+ return;
54
+ }
55
+
56
+ $duty = $address->getIparcelDutyAmount();
57
+
58
+ // If we should show the tax and duty cumulatively
59
+ if (Mage::helper('iparcel')->getDisplayTaxAndDutyCumulatively()
60
+ && ($duty != null || $address->getIparcelTaxAmount() != null)) {
61
+ $address->addTotal(array(
62
+ 'code' => $this->getCode(),
63
+ 'title' => Mage::helper('iparcel')->getTaxAndDutyLabel(),
64
+ 'value' => $duty + $address->getIparcelTaxAmount()
65
+ ));
66
+ } elseif (Mage::helper('iparcel')->getDisplayTaxAndDutySeparately()
67
+ && $duty != null) {
68
+ $address->addTotal(array(
69
+ 'code' => $this->getCode(),
70
+ 'title' => Mage::helper('iparcel')->getDutyLabel(),
71
+ 'value' => $duty
72
+ ));
73
+ }
74
+ }
75
+ }
app/code/community/Iparcel/All/Model/Quote/Address/Total/Tax.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel model for shipping tax
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Quote_Address_Total_Tax extends Iparcel_All_Model_Quote_Address_Total_Abstract
10
+ {
11
+ public function __construct()
12
+ {
13
+ $this->setCode('iparcel_tax');
14
+ }
15
+
16
+ /**
17
+ * Used each time collectTotals is invoked to find the duty rate
18
+ *
19
+ * @param Mage_Sales_Model_Quote_Address $address
20
+ * @return Iparcel_All_Model_Total_Tax
21
+ */
22
+ public function collect(Mage_Sales_Model_Quote_Address $address)
23
+ {
24
+ if ($address->getAddressType() != 'shipping') {
25
+ return;
26
+ }
27
+
28
+ if ($this->isIparcelShipping($address) &&
29
+ (Mage::helper('iparcel')->getDisplayTaxAndDutyCumulatively()
30
+ || Mage::helper('iparcel')->getDisplayTaxAndDutySeparately())) {
31
+ parent::collect($address);
32
+
33
+ $tax = null;
34
+
35
+ $quote = Mage::getModel('iparcel/api_quote');
36
+ $quote->loadByQuoteId($address->getQuote()->getId());
37
+
38
+ /**
39
+ * Load data from stored shipping quote.
40
+ */
41
+ if ($quote->getId()) {
42
+ $dutyAndTaxes = array(
43
+ 'parcel_id' => $quote->getParcelId(),
44
+ 'service_levels' => $quote->getServiceLevels()
45
+ );
46
+ /**
47
+ * Catch an error caused by unserialize returning `false`
48
+ * if the data stored in the databse is invalid
49
+ */
50
+ if ($dutyAndTaxes['service_levels'] == false) {
51
+ Mage::throwException('Failed to set shipping rates tax and duty.');
52
+ }
53
+ Mage::register('iparcel_duty_and_taxes', $dutyAndTaxes);
54
+ }
55
+
56
+ $tax = $dutyAndTaxes['service_levels'][$address->getShippingMethod()]['tax'];
57
+
58
+ $this->_setBaseAmount($tax);
59
+ $this->_setAmount(
60
+ $address->getQuote()->getStore()->convertPrice($tax, false)
61
+ );
62
+
63
+ /**
64
+ * If this is an i-parcel shipped order, we have to remove Magento's
65
+ * calculated tax, to allow i-parcel's to be the only tax calculated
66
+ */
67
+ $address->setTaxAmount(0);
68
+ $address->setBaseTaxAmount(0);
69
+
70
+ return $this;
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Display the duty rate
76
+ *
77
+ * @param Mage_Sales_Model_Quote_Address $address
78
+ * @return Iparcel_All_Model_Total_Tax
79
+ */
80
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
81
+ {
82
+ if ($address->getAddressType() != 'shipping') {
83
+ return;
84
+ }
85
+
86
+ /**
87
+ * We only display the tax if the duty and tax are displayed seperately.
88
+ * Otherwise, the Duty model will handle displaying the combined total.
89
+ */
90
+ if ($this->isIparcelShipping($address)
91
+ && Mage::helper('iparcel')->getDisplayTaxAndDutySeparately()
92
+ && $address->getIparcelTaxAmount() != null) {
93
+ $address->addTotal(array(
94
+ 'code' => $this->getCode(),
95
+ 'title' => Mage::helper('iparcel')->getTaxLabel(),
96
+ 'value' => $address->getIparcelTaxAmount()
97
+ ));
98
+ }
99
+ }
100
+ }
app/code/community/Iparcel/All/Model/Resource/Api/Quote.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Model for Iparcel_All_Model_Api_Quote class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Resource_Api_Quote extends Mage_Core_Model_Resource_Db_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('iparcel/api_quote', 'id');
17
+ }
18
+ }
app/code/community/Iparcel/All/Model/Resource/Log.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Model for Iparcel_All_Model_Log class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Resource_Log extends Mage_Core_Model_Resource_Db_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('iparcel/log', 'id');
17
+ }
18
+ }
app/code/community/Iparcel/All/Model/Resource/Log/Collection.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Collection model for log resource
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Resource_Log_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
+ {
11
+ protected function _construct()
12
+ {
13
+ $this->_init('iparcel/log');
14
+ }
15
+
16
+ /**
17
+ * Deletes all items in the collection
18
+ *
19
+ * @return self
20
+ */
21
+ public function deleteAllItems()
22
+ {
23
+ foreach ($this->getItems() as $item) {
24
+ $item->delete();
25
+ }
26
+
27
+ return $this;
28
+ }
29
+ }
app/code/community/Iparcel/All/Model/Resource/Mysql4/Setup.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Setup Resource class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Resource_Mysql4_Setup extends Mage_Core_Model_Resource_Setup
10
+ {
11
+ }
app/code/community/Iparcel/All/Model/Tax/Quote/Shipping.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class to override Magento's tax rate
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Tax_Quote_Shipping extends Mage_Tax_Model_Sales_Total_Quote_Shipping
10
+ {
11
+ /**
12
+ * Returns i-parcel's quote address abstract class
13
+ *
14
+ * @return Iparcel_All_Model_Quote_Address_Total_Abstract
15
+ */
16
+ private function _getAbstract()
17
+ {
18
+ $model = new Iparcel_All_Model_Quote_Address_Total_Abstract;
19
+ return $model;
20
+ }
21
+ /**
22
+ * Prevent's Magento's tax calculation if i-parcel shipping method is used
23
+ *
24
+ * @param Mage_Sales_Model_Quote_Address $address
25
+ * @return object
26
+ */
27
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
28
+ {
29
+ if ($this->_getAbstract()->isIparcelShipping($address) &&
30
+ Mage::getStoreConfig('iparcel/tax/mode') != Iparcel_All_Model_System_Config_Source_Tax_Mode::DISABLED) {
31
+ return;
32
+ } else {
33
+ return parent::fetch($address);
34
+ }
35
+ }
36
+ /**
37
+ * Prevent's Magento's tax display if i-parcel shipping method is used
38
+ *
39
+ * @param Mage_Sales_Model_Quote_Address $address
40
+ * @return object
41
+ */
42
+ public function collect(Mage_Sales_Model_Quote_Address $address)
43
+ {
44
+ if ($this->_getAbstract()->isIparcelShipping($address) &&
45
+ Mage::getStoreConfig('iparcel/tax/mode') != Iparcel_All_Model_System_Config_Source_Tax_Mode::DISABLED) {
46
+ return;
47
+ } else {
48
+ return parent::collect($address);
49
+ }
50
+ }
51
+ }
app/code/community/Iparcel/All/Model/Tax/Quote/Subtotal.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class to override Magento's tax rate
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Tax_Quote_Subtotal extends Mage_Tax_Model_Sales_Total_Quote_Subtotal
10
+ {
11
+ /**
12
+ * Returns i-parcel's quote address abstract class
13
+ *
14
+ * @return Iparcel_All_Model_Quote_Address_Total_Abstract
15
+ */
16
+ private function _getAbstract()
17
+ {
18
+ $model = new Iparcel_All_Model_Quote_Address_Total_Abstract;
19
+ return $model;
20
+ }
21
+
22
+ /**
23
+ * Prevent's Magento's tax calculation if i-parcel shipping method is used
24
+ *
25
+ * @param Mage_Sales_Model_Quote_Address $address
26
+ * @return object
27
+ */
28
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
29
+ {
30
+ if ($this->_getAbstract()->isIparcelShipping($address)) {
31
+ return;
32
+ } else {
33
+ return parent::fetch($address);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Prevent's Magento's tax display if i-parcel shipping method is used
39
+ *
40
+ * @param Mage_Sales_Model_Quote_Address $address
41
+ * @return object
42
+ */
43
+ public function collect(Mage_Sales_Model_Quote_Address $address)
44
+ {
45
+ if ($this->_getAbstract()->isIparcelShipping($address)) {
46
+ return;
47
+ } else {
48
+ return parent::collect($address);
49
+ }
50
+ }
51
+ }
app/code/community/Iparcel/All/Model/Tax/Quote/Tax.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class to override Magento's tax rate
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Tax_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_Tax
10
+ {
11
+ /**
12
+ * Returns i-parcel's quote address abstract class
13
+ *
14
+ * @return Iparcel_All_Model_Quote_Address_Total_Abstract
15
+ */
16
+ private function _getAbstract()
17
+ {
18
+ $model = new Iparcel_All_Model_Quote_Address_Total_Abstract;
19
+ return $model;
20
+ }
21
+
22
+ /**
23
+ * Prevent's Magento's tax calculation if i-parcel shipping method is used
24
+ *
25
+ * @param Mage_Sales_Model_Quote_Address $address
26
+ * @return object
27
+ */
28
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
29
+ {
30
+ if ($this->_getAbstract()->isIparcelShipping($address)
31
+ && Mage::getStoreConfig('iparcel/tax/mode') != Iparcel_All_Model_System_Config_Source_Tax_Mode::DISABLED) {
32
+ return;
33
+ } else {
34
+ return parent::fetch($address);
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Prevent's Magento's tax display if i-parcel shipping method is used
40
+ *
41
+ * @param Mage_Sales_Model_Quote_Address $address
42
+ * @return object
43
+ */
44
+ public function collect(Mage_Sales_Model_Quote_Address $address)
45
+ {
46
+ if ($this->_getAbstract()->isIparcelShipping($address)
47
+ && Mage::getStoreConfig('iparcel/tax/mode') != Iparcel_All_Model_System_Config_Source_Tax_Mode::DISABLED) {
48
+ return;
49
+ } else {
50
+ return parent::collect($address);
51
+ }
52
+ }
53
+ }
app/code/community/Iparcel/All/controllers/Adminhtml/Iparcel/LogController.php CHANGED
@@ -36,9 +36,45 @@ class Iparcel_All_Adminhtml_Iparcel_LogController extends Mage_Adminhtml_Control
36
  */
37
  public function clearAction()
38
  {
39
- if (Mage::getModel('iparcel/log')->clear() === false) {
40
- Mage::getSingleton('core/session')->addError($this->__('Unable to write to the log file.'));
41
- }
42
  $this->_redirect('*/*/index');
43
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
36
  */
37
  public function clearAction()
38
  {
39
+ $collection = Mage::getModel('iparcel/log')->getCollection();
40
+ $collection->deleteAllItems();
41
+
42
  $this->_redirect('*/*/index');
43
  }
44
+
45
+ /**
46
+ * Downloads CSV of i-parcel log table without file system write
47
+ */
48
+ public function downloadAction()
49
+ {
50
+ $this->getResponse()->clearHeaders();
51
+ $this->getResponse()->setHeader('Content-Type', 'text/csv', true);
52
+ $this->getResponse()->setHeader('Content-Disposition', 'attachment;filename="iparcel-log.csv";', true);
53
+ $this->getResponse()->setHeader('Content-Transfer-Encoding', 'binary', true);
54
+
55
+ $fh = fopen('php://memory', 'rw');
56
+
57
+ $collection = Mage::getModel('iparcel/log')->getCollection();
58
+ $csv = "ID, Timestamp, \"API Controller\", Request, Response\n";
59
+
60
+ foreach ($collection as $item) {
61
+ $line = array(
62
+ $item->getId(),
63
+ $item->getCreatedAt(),
64
+ $item->getController(),
65
+ $item->getRequest(),
66
+ $item->getResponse()
67
+ );
68
+
69
+ fputcsv($fh, $line, ',');
70
+ rewind($fh);
71
+ $csv .= fgets($fh);
72
+ rewind($fh);
73
+ }
74
+
75
+ fclose($fh);
76
+ $this->getResponse()->setBody($csv);
77
+
78
+ return;
79
+ }
80
  }
app/code/community/Iparcel/All/controllers/Adminhtml/Iparcel/Shipment/SplitController.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin Shipment split controller
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Adminhtml_Iparcel_Shipment_SplitController extends Mage_Adminhtml_Controller_Action
10
+ {
11
+ /**
12
+ * Save a split shipment
13
+ *
14
+ * @return bool
15
+ */
16
+ public function saveAction()
17
+ {
18
+ $params = $this->getRequest()->getParams();
19
+ $shipment = Mage::getModel('sales/order_shipment')->load($params['shipment']['info']['shipment_id']);
20
+ $shipmentItems = $params['shipment']['items'];
21
+
22
+ $itemsCollection = array();
23
+ foreach($shipmentItems as $itemId => $itemQty) {
24
+ if ($itemQty < 1) {
25
+ continue;
26
+ }
27
+
28
+ $orderItem = $shipment->getOrder()->getItemById($itemId);
29
+ $itemsCollection[] = array(
30
+ 'sku' => $orderItem->getSku(),
31
+ 'qty' => $itemQty
32
+ );
33
+ }
34
+
35
+ try {
36
+ if (Mage::helper('iparcel/api')->splitShipment($shipment, $itemsCollection)) {
37
+ Mage::getSingleton('adminhtml/session')->addSuccess('Shipment successfully split');
38
+ }
39
+ } catch (Exception $e) {
40
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
41
+ $this->_redirect('adminhtml/sales_order_shipment/view', array(
42
+ 'shipment_id' => $shipment->getId()
43
+ ));
44
+ return true;
45
+ }
46
+
47
+ $this->_redirect('adminhtml/sales_order/view', array(
48
+ 'order_id' => $shipment->getOrder()->getId()
49
+ ));
50
+ return true;
51
+ }
52
+ }
app/code/community/Iparcel/All/controllers/Adminhtml/Iparcel/ShipmentController.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin Shipment management controller
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Adminhtml_Iparcel_ShipmentController extends Mage_Adminhtml_Controller_Action
10
+ {
11
+ /**
12
+ * Cancel's a shipment from i-parcel
13
+ *
14
+ * @return bool
15
+ */
16
+ public function cancelAction()
17
+ {
18
+ $params = $this->getRequest()->getParams();
19
+ if (array_key_exists('shipment', $params)) {
20
+ $shipment = Mage::getModel('sales/order_shipment')->load($params['shipment']);
21
+ if (Mage::helper('iparcel/api')->cancelShipment($shipment)) {
22
+ Mage::getSingleton('adminhtml/session')->addSuccess('Shipment canceled');
23
+ }
24
+ }
25
+
26
+ $this->_redirectReferer();
27
+ return true;
28
+ }
29
+
30
+ /**
31
+ * Display the split shipment block
32
+ *
33
+ * @return bool
34
+ */
35
+ public function splitAction()
36
+ {
37
+ $params = $this->getRequest()->getParams();
38
+
39
+ if (array_key_exists('shipment', $params)) {
40
+
41
+ if (Mage::helper('iparcel')->getShipmentItemCount($params['shipment']) > 1) {
42
+ Mage::register('current_shipment', Mage::getModel('sales/order_shipment')->load($params['shipment']));
43
+ $this->loadLayout()->renderLayout();
44
+ } else {
45
+ Mage::getSingleton('adminhtml/session')->addError('Shipment must have multiple items to split.');
46
+ $this->_redirectReferer();
47
+ return true;
48
+ }
49
+
50
+ } else {
51
+ $this->_redirectReferer();
52
+ }
53
+
54
+ return true;
55
+ }
56
+ }
app/code/community/Iparcel/{GlobaleCommerce → All}/controllers/AjaxController.php RENAMED
@@ -3,10 +3,10 @@
3
  * i-parcel frontend ajax controller
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_GlobaleCommerce_AjaxController extends Mage_Core_Controller_Front_Action
10
  {
11
  /**
12
  * Configurable products action for post script
@@ -19,6 +19,11 @@ class Iparcel_GlobaleCommerce_AjaxController extends Mage_Core_Controller_Front_
19
  // var $product Mage_Catalog_Model_Product
20
  $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
21
 
 
 
 
 
 
22
  /**
23
  * If we are dealing with a simple product, we just need to worry about
24
  * custom options.
3
  * i-parcel frontend ajax controller
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_AjaxController extends Mage_Core_Controller_Front_Action
10
  {
11
  /**
12
  * Configurable products action for post script
19
  // var $product Mage_Catalog_Model_Product
20
  $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
21
 
22
+ // Return an empty response if no product matches the given SKU
23
+ if ($product == false) {
24
+ return;
25
+ }
26
+
27
  /**
28
  * If we are dealing with a simple product, we just need to worry about
29
  * custom options.
app/code/community/Iparcel/{GlobaleCommerce → All}/controllers/InternationalController.php RENAMED
@@ -3,10 +3,10 @@
3
  * i-parcel International Customer controller
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_GlobaleCommerce_InternationalController extends Mage_Core_Controller_Front_Action
10
  {
11
  /**
12
  * Preparing headers for external ajax
@@ -24,11 +24,11 @@ class Iparcel_GlobaleCommerce_InternationalController extends Mage_Core_Controll
24
  public function enableAction()
25
  {
26
  $this->_prepareHeaders();
27
- $current = Mage::helper('ipglobalecommerce/international')->getInternational();
28
  if ($current) {
29
  echo 'false';
30
  } else {
31
- Mage::helper('ipglobalecommerce/international')->setInternational(true);
32
  echo 'true';
33
  }
34
  }
@@ -39,9 +39,9 @@ class Iparcel_GlobaleCommerce_InternationalController extends Mage_Core_Controll
39
  public function disableAction()
40
  {
41
  $this->_prepareHeaders();
42
- $current = Mage::helper('ipglobalecommerce/international')->getInternational();
43
  if ($current) {
44
- Mage::helper('ipglobalecommerce/international')->setInternational(false);
45
  echo 'true';
46
  } else {
47
  echo 'false';
3
  * i-parcel International Customer controller
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_InternationalController extends Mage_Core_Controller_Front_Action
10
  {
11
  /**
12
  * Preparing headers for external ajax
24
  public function enableAction()
25
  {
26
  $this->_prepareHeaders();
27
+ $current = Mage::helper('iparcel/international')->getInternational();
28
  if ($current) {
29
  echo 'false';
30
  } else {
31
+ Mage::helper('iparcel/international')->setInternational(true);
32
  echo 'true';
33
  }
34
  }
39
  public function disableAction()
40
  {
41
  $this->_prepareHeaders();
42
+ $current = Mage::helper('iparcel/international')->getInternational();
43
  if ($current) {
44
+ Mage::helper('iparcel/international')->setInternational(false);
45
  echo 'true';
46
  } else {
47
  echo 'false';
app/code/community/Iparcel/All/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Iparcel_All>
5
- <version>1.0.0</version>
6
  </Iparcel_All>
7
  </modules>
8
  <frontend>
@@ -15,6 +15,22 @@
15
  </args>
16
  </iparcel>
17
  </routers>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  </frontend>
19
  <crontab>
20
  <jobs>
@@ -30,13 +46,53 @@
30
  <models>
31
  <iparcel>
32
  <class>Iparcel_All_Model</class>
 
33
  </iparcel>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  </models>
35
  <blocks>
36
  <iparcel>
37
  <class>Iparcel_All_Block</class>
38
  </iparcel>
 
 
 
 
 
39
  </blocks>
 
 
 
 
 
 
 
 
 
 
 
40
  <helpers>
41
  <iparcel>
42
  <class>Iparcel_All_Helper</class>
@@ -70,7 +126,102 @@
70
  </iparcel_catalog_product_observer>
71
  </observers>
72
  </catalog_product_delete_before>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  </events>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  </global>
75
  <adminhtml>
76
  <layout>
@@ -115,6 +266,12 @@
115
  </routers>
116
  </admin>
117
  <default>
 
 
 
 
 
 
118
  <catalog_mapping>
119
  <config>
120
  <auto_upload>0</auto_upload>
@@ -127,5 +284,12 @@
127
  <price>1</price>
128
  </attributes>
129
  </catalog_mapping>
 
 
 
 
 
 
 
130
  </default>
131
  </config>
2
  <config>
3
  <modules>
4
  <Iparcel_All>
5
+ <version>1.2.0</version>
6
  </Iparcel_All>
7
  </modules>
8
  <frontend>
15
  </args>
16
  </iparcel>
17
  </routers>
18
+ <layout>
19
+ <updates>
20
+ <iparcel>
21
+ <file>iparcel.xml</file>
22
+ </iparcel>
23
+ </updates>
24
+ </layout>
25
+ <translate>
26
+ <modules>
27
+ <iparcel>
28
+ <files>
29
+ <default>iparcel.csv</default>
30
+ </files>
31
+ </iparcel>
32
+ </modules>
33
+ </translate>
34
  </frontend>
35
  <crontab>
36
  <jobs>
46
  <models>
47
  <iparcel>
48
  <class>Iparcel_All_Model</class>
49
+ <resourceModel>iparcel_resource</resourceModel>
50
  </iparcel>
51
+ <iparcel_resource>
52
+ <class>Iparcel_All_Model_Resource</class>
53
+ <entities>
54
+ <api_quote>
55
+ <table>iparcel_all_api_quote</table>
56
+ </api_quote>
57
+ <log>
58
+ <table>iparcel_all_log</table>
59
+ </log>
60
+ </entities>
61
+ </iparcel_resource>
62
+ <sales>
63
+ <rewrite>
64
+ <quote_address_total_collector>Iparcel_All_Model_Quote_Address_Total_Collector</quote_address_total_collector>
65
+ </rewrite>
66
+ </sales>
67
+ <tax>
68
+ <rewrite>
69
+ <sales_total_quote_shipping>Iparcel_All_Model_Tax_Quote_Shipping</sales_total_quote_shipping>
70
+ <sales_total_quote_subtotal>Iparcel_All_Model_Tax_Quote_Subtotal</sales_total_quote_subtotal>
71
+ <sales_total_quote_tax>Iparcel_All_Model_Tax_Quote_Tax</sales_total_quote_tax>
72
+ </rewrite>
73
+ </tax>
74
  </models>
75
  <blocks>
76
  <iparcel>
77
  <class>Iparcel_All_Block</class>
78
  </iparcel>
79
+ <catalog>
80
+ <rewrite>
81
+ <product_list>Iparcel_All_Block_Catalog_Product_List</product_list>
82
+ </rewrite>
83
+ </catalog>
84
  </blocks>
85
+ <resources>
86
+ <iparcel_setup>
87
+ <setup>
88
+ <module>Iparcel_All</module>
89
+ <class>Iparcel_All_Model_Resource_Mysql4_Setup</class>
90
+ </setup>
91
+ <connection>
92
+ <use>core_setup</use>
93
+ </connection>
94
+ </iparcel_setup>
95
+ </resources>
96
  <helpers>
97
  <iparcel>
98
  <class>Iparcel_All_Helper</class>
126
  </iparcel_catalog_product_observer>
127
  </observers>
128
  </catalog_product_delete_before>
129
+ <sales_order_shipment_save_after>
130
+ <observers>
131
+ <iparcel_shipment_save_after>
132
+ <type>singleton</type>
133
+ <class>Iparcel_All_Model_Observer</class>
134
+ <method>shipment_save_after</method>
135
+ </iparcel_shipment_save_after>
136
+ </observers>
137
+ </sales_order_shipment_save_after>
138
+ <sales_order_place_after>
139
+ <observers>
140
+ <iparcel_order_place_after>
141
+ <type>singleton</type>
142
+ <class>Iparcel_All_Model_Observer</class>
143
+ <method>order_place_after</method>
144
+ </iparcel_order_place_after>
145
+ </observers>
146
+ </sales_order_place_after>
147
+ <order_cancel_after>
148
+ <observers>
149
+ <iparcel_order_cancel_after>
150
+ <type>singleton</type>
151
+ <class>Iparcel_All_Model_Observer</class>
152
+ <method>order_cancel_after</method>
153
+ </iparcel_order_cancel_after>
154
+ </observers>
155
+ </order_cancel_after>
156
+ <core_block_abstract_to_html_before>
157
+ <observers>
158
+ <iparcel_core_block_abstract_to_html_before>
159
+ <type>singleton</type>
160
+ <class>Iparcel_All_Model_Observer</class>
161
+ <method>core_block_abstract_to_html_before</method>
162
+ </iparcel_core_block_abstract_to_html_before>
163
+ </observers>
164
+ </core_block_abstract_to_html_before>
165
+ <paypal_prepare_line_items>
166
+ <observers>
167
+ <iparcel_paypal_prepare_line_item>
168
+ <type>singleton</type>
169
+ <class>Iparcel_All_Model_Observer</class>
170
+ <method>paypal_prepare_line_items</method>
171
+ </iparcel_paypal_prepare_line_item>
172
+ </observers>
173
+ </paypal_prepare_line_items>
174
  </events>
175
+ <sales>
176
+ <quote>
177
+ <totals>
178
+ <iparcel_tax>
179
+ <class>iparcel/quote_address_total_tax</class>
180
+ <before>grand_total</before>
181
+ <after>shipping</after>
182
+ </iparcel_tax>
183
+ <iparcel_duty>
184
+ <class>iparcel/quote_address_total_duty</class>
185
+ <before>grand_total</before>
186
+ <after>iparcel_tax</after>
187
+ </iparcel_duty>
188
+ </totals>
189
+ </quote>
190
+ <order_invoice>
191
+ <totals>
192
+ <iparcel_tax>
193
+ <class>iparcel/order_invoice_total_tax</class>
194
+ </iparcel_tax>
195
+ <iparcel_duty>
196
+ <class>iparcel/order_invoice_total_duty</class>
197
+ </iparcel_duty>
198
+ </totals>
199
+ </order_invoice>
200
+ <order_creditmemo>
201
+ <totals>
202
+ <iparcel_tax>
203
+ <class>iparcel/order_creditmemo_total_tax</class>
204
+ </iparcel_tax>
205
+ <iparcel_duty>
206
+ <class>iparcel/order_creditmemo_total_duty</class>
207
+ </iparcel_duty>
208
+ </totals>
209
+ </order_creditmemo>
210
+ </sales>
211
+ <fieldsets>
212
+ <sales_convert_quote_address>
213
+ <base_iparcel_duty_amount><to_order>*</to_order></base_iparcel_duty_amount>
214
+ <iparcel_duty_amount><to_order>*</to_order></iparcel_duty_amount>
215
+ <base_iparcel_tax_amount><to_order>*</to_order></base_iparcel_tax_amount>
216
+ <iparcel_tax_amount><to_order>*</to_order></iparcel_tax_amount>
217
+ </sales_convert_quote_address>
218
+ <sales_convert_order>
219
+ <base_iparcel_duty_amount><to_invoice>*</to_invoice><to_cm>*</to_cm></base_iparcel_duty_amount>
220
+ <iparcel_duty_amount><to_invoice>*</to_invoice><to_cm>*</to_cm></iparcel_duty_amount>
221
+ <base_iparcel_tax_amount><to_invoice>*</to_invoice><to_cm>*</to_cm></base_iparcel_tax_amount>
222
+ <iparcel_tax_amount><to_invoice>*</to_invoice><to_cm>*</to_cm></iparcel_tax_amount>
223
+ </sales_convert_order>
224
+ </fieldsets>
225
  </global>
226
  <adminhtml>
227
  <layout>
266
  </routers>
267
  </admin>
268
  <default>
269
+ <payment>
270
+ <iparcel>
271
+ <active>1</active>
272
+ <model>iparcel/payment_iparcel</model>
273
+ </iparcel>
274
+ </payment>
275
  <catalog_mapping>
276
  <config>
277
  <auto_upload>0</auto_upload>
284
  <price>1</price>
285
  </attributes>
286
  </catalog_mapping>
287
+ <carriers>
288
+ <iparcel>
289
+ <title>UPS i-Parcel</title>
290
+ <model>iparcel/carrier_iparcel</model>
291
+ <autotrack>1</autotrack>
292
+ </iparcel>
293
+ </carriers>
294
  </default>
295
  </config>
app/code/community/Iparcel/All/etc/system.xml CHANGED
@@ -6,7 +6,142 @@
6
  <sort_order>500</sort_order>
7
  </i-parcel>
8
  </tabs>
 
 
 
 
 
 
 
 
 
 
 
9
  <sections>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  <iparcel>
11
  <label>Configuration</label>
12
  <tab>i-parcel</tab>
@@ -54,6 +189,126 @@
54
  </dashboard>
55
  </fields>
56
  </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  </groups>
58
  </iparcel>
59
  <catalog_mapping>
6
  <sort_order>500</sort_order>
7
  </i-parcel>
8
  </tabs>
9
+ <payment>
10
+ <groups>
11
+ <iparcel translate="label" module="iparcel">
12
+ <label>i-parcel</label>
13
+ <sort_order>9999</sort_order>
14
+ <show_in_default>0</show_in_default>
15
+ <show_in_website>0</show_in_website>
16
+ <show_in_store>0</show_in_store>
17
+ </iparcel>
18
+ </groups>
19
+ </payment>
20
  <sections>
21
+ <carriers>
22
+ <groups>
23
+ <iparcel translate="label">
24
+ <label>i-parcel</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>99</sort_order>
27
+ <show_in_default>0</show_in_default>
28
+ <show_in_website>0</show_in_website>
29
+ <show_in_store>0</show_in_store>
30
+ <fields>
31
+ <active translate="label">
32
+ <label>Enabled</label>
33
+ <frontend_type>select</frontend_type>
34
+ <source_model>adminhtml/system_config_source_yesno</source_model>
35
+ <sort_order>1</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ </active>
40
+ <title>
41
+ <label>Title</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>100</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ </title>
48
+ <name>
49
+ <label>Allowed Services</label>
50
+ <frontend_model>iparcel/adminhtml_system_config_form_field_method</frontend_model>
51
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
52
+ <sort_order>102</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </name>
57
+ <whitelabelpay>
58
+ <label>Name of Displayed Payment Method</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>105</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </whitelabelpay>
65
+ <choose_domestic>
66
+ <label>Use alternate country of origin for Domestic orders</label>
67
+ <frontend_type>select</frontend_type>
68
+ <source_model>adminhtml/system_config_source_yesno</source_model>
69
+ <tooltip>If "Yes", you can choose an origin country that differs from the country selected in "Shipping Settings".</tooltip>
70
+ <sort_order>120</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </choose_domestic>
75
+ <origin_country_id>
76
+ <label>Country of Origin</label>
77
+ <frontend_type>select</frontend_type>
78
+ <source_model>adminhtml/system_config_source_country</source_model>
79
+ <tooltip>If the user's destination country differs from this origin country, the i-parcel Shipping Method will be available.</tooltip>
80
+ <sort_order>130</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </origin_country_id>
85
+ <autoship>
86
+ <label>Auto Generate Shipment</label>
87
+ <frontend_type>select</frontend_type>
88
+ <source_model>adminhtml/system_config_source_yesno</source_model>
89
+ <sort_order>160</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </autoship>
94
+ <autotrack>
95
+ <label>Auto Generate Tracking on Shipping</label>
96
+ <frontend_type>select</frontend_type>
97
+ <source_model>adminhtml/system_config_source_yesno</source_model>
98
+ <tooltip>Set to No if you submit parcel tracking via API and use fulfilment system to create shipment</tooltip>
99
+ <sort_order>165</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </autotrack>
104
+ <prefix>
105
+ <label>Completed Orders Use Different Order Prefix (Blank for None)</label>
106
+ <frontend_type>text</frontend_type>
107
+ <sort_order>170</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ </prefix>
112
+ <order_reference>
113
+ <label>Send Order Number as Reference</label>
114
+ <frontend_type>select</frontend_type>
115
+ <source_model>adminhtml/system_config_source_yesno</source_model>
116
+ <sort_order>180</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ </order_reference>
121
+ <sallowspecific translate="label">
122
+ <label>Ship to Applicable Countries</label>
123
+ <frontend_type>select</frontend_type>
124
+ <sort_order>140</sort_order>
125
+ <frontend_class>shipping-applicable-country</frontend_class>
126
+ <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>0</show_in_store>
130
+ </sallowspecific>
131
+ <specificcountry translate="label">
132
+ <label>Ship to Specific Countries</label>
133
+ <frontend_type>multiselect</frontend_type>
134
+ <sort_order>150</sort_order>
135
+ <source_model>adminhtml/system_config_source_country</source_model>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
+ <show_in_store>0</show_in_store>
139
+ <can_be_empty>1</can_be_empty>
140
+ </specificcountry>
141
+ </fields>
142
+ </iparcel>
143
+ </groups>
144
+ </carriers>
145
  <iparcel>
146
  <label>Configuration</label>
147
  <tab>i-parcel</tab>
189
  </dashboard>
190
  </fields>
191
  </config>
192
+ <scripts translate="label">
193
+ <label>Scripts</label>
194
+ <frontend_type>text</frontend_type>
195
+ <sort_order>5</sort_order>
196
+ <show_in_default>0</show_in_default>
197
+ <show_in_website>0</show_in_website>
198
+ <show_in_store>0</show_in_store>
199
+ <fields>
200
+ <scripts translate="label">
201
+ <label>Enable Frontend Scripts</label>
202
+ <frontend_type>select</frontend_type>
203
+ <source_model>adminhtml/system_config_source_yesno</source_model>
204
+ <sort_order>5</sort_order>
205
+ <show_in_default>1</show_in_default>
206
+ <show_in_website>1</show_in_website>
207
+ <show_in_store>0</show_in_store>
208
+ </scripts>
209
+ <jquery translate="label">
210
+ <label>Enable jQuery</label>
211
+ <comment>Set it to "no" if you're using another jQuery library</comment>
212
+ <frontend_type>select</frontend_type>
213
+ <source_model>adminhtml/system_config_source_yesno</source_model>
214
+ <sort_order>10</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>0</show_in_website>
217
+ <show_in_store>0</show_in_store>
218
+ </jquery>
219
+ <post translate="label">
220
+ <label>Custom POST scripts</label>
221
+ <frontend_type>file</frontend_type>
222
+ <backend_model>iparcel/config_script_js</backend_model>
223
+ <sort_order>15</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>1</show_in_website>
226
+ <show_in_store>1</show_in_store>
227
+ </post>
228
+ </fields>
229
+ </scripts>
230
+ <international_customer translate="label">
231
+ <label>International Customer</label>
232
+ <frontend_type>text</frontend_type>
233
+ <sort_order>10</sort_order>
234
+ <show_in_default>0</show_in_default>
235
+ <show_in_website>0</show_in_website>
236
+ <show_in_store>0</show_in_store>
237
+ <fields>
238
+ <enable translate="label">
239
+ <label>Enabled</label>
240
+ <frontend_type>select</frontend_type>
241
+ <source_model>adminhtml/system_config_source_yesno</source_model>
242
+ <sort_order>0</sort_order>
243
+ <show_in_default>1</show_in_default>
244
+ <show_in_website>1</show_in_website>
245
+ <show_in_store>1</show_in_store>
246
+ </enable>
247
+ <visibility translate="label">
248
+ <label>Catalog product visibility attribute</label>
249
+ <frontend_type>select</frontend_type>
250
+ <source_model>iparcel/system_config_source_catalog_product_attribute_boolean</source_model>
251
+ <sort_order>1</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ <tooltip>If chosen attribute has value 'true' catalog product will be visible for international customer</tooltip>
256
+ </visibility>
257
+ </fields>
258
+ </international_customer>
259
+ <tax translate="label">
260
+ <label>Tax Intercepting</label>
261
+ <frontend_type>text</frontend_type>
262
+ <sort_order>15</sort_order>
263
+ <show_in_default>0</show_in_default>
264
+ <show_in_website>0</show_in_website>
265
+ <show_in_store>0</show_in_store>
266
+ <expanded>1</expanded>
267
+ <fields>
268
+ <mode translate="label">
269
+ <label>Mode</label>
270
+ <frontend_type>select</frontend_type>
271
+ <source_model>iparcel/system_config_source_tax_mode</source_model>
272
+ <sort_order>0</sort_order>
273
+ <show_in_default>1</show_in_default>
274
+ <show_in_website>1</show_in_website>
275
+ <show_in_store>1</show_in_store>
276
+ </mode>
277
+ <tax_duty_label translate="label">
278
+ <label><![CDATA[Tax&Duty Label]]></label>
279
+ <frontend_type>text</frontend_type>
280
+ <sort_order>5</sort_order>
281
+ <show_in_default>1</show_in_default>
282
+ <show_in_website>1</show_in_website>
283
+ <show_in_store>1</show_in_store>
284
+ <depends>
285
+ <mode>1</mode>
286
+ </depends>
287
+ </tax_duty_label>
288
+ <tax_label translate="label">
289
+ <label>Tax Label</label>
290
+ <frontend_type>text</frontend_type>
291
+ <sort_order>10</sort_order>
292
+ <show_in_default>1</show_in_default>
293
+ <show_in_website>1</show_in_website>
294
+ <show_in_store>1</show_in_store>
295
+ <depends>
296
+ <mode>2</mode>
297
+ </depends>
298
+ </tax_label>
299
+ <duty_label translate="label">
300
+ <label>Duty Label</label>
301
+ <frontend_type>text</frontend_type>
302
+ <sort_order>15</sort_order>
303
+ <show_in_default>1</show_in_default>
304
+ <show_in_website>1</show_in_website>
305
+ <show_in_store>1</show_in_store>
306
+ <depends>
307
+ <mode>2</mode>
308
+ </depends>
309
+ </duty_label>
310
+ </fields>
311
+ </tax>
312
  </groups>
313
  </iparcel>
314
  <catalog_mapping>
app/code/community/Iparcel/All/sql/iparcel_setup/mysql4-upgrade-1.0.0-1.1.0.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ // Create a table to store tax & duty calculations
7
+ $installer->run("
8
+ DROP TABLE IF EXISTS {$this->getTable('iparcel/api_quote')};
9
+ CREATE TABLE {$this->getTable('iparcel/api_quote')} (
10
+ `id` int(11) unsigned NOT NULL auto_increment,
11
+ `quote_id` varchar(255) NOT NULL,
12
+ `parcel_id` varchar(255) NOT NULL,
13
+ `service_levels` TEXT NOT NULL,
14
+ PRIMARY KEY (`id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
+ ");
17
+
18
+ // Add service levels
19
+ $data = array(
20
+ array(
21
+ 'service_id' => 112,
22
+ 'title' => 'UPS i-Parcel Express'
23
+ ),
24
+ array(
25
+ 'service_id' => 115,
26
+ 'title' => 'UPS i-Parcel Select'
27
+ ),
28
+ array(
29
+ 'service_id' => 119,
30
+ 'title' => 'UPS i-Parcel Saver'
31
+ ),
32
+ array(
33
+ 'service_id' => 211,
34
+ 'title' => 'UPS Standard'
35
+ ),
36
+ array(
37
+ 'service_id' => 208,
38
+ 'title' => 'UPS Expedited'
39
+ ),
40
+ array(
41
+ 'service_id' => 265,
42
+ 'title' => 'UPS Saver'
43
+ ),
44
+ array(
45
+ 'service_id' => 207,
46
+ 'title' => 'UPS Express'
47
+ ),
48
+ array(
49
+ 'service_id' => 254,
50
+ 'title' => 'UPS Express Plus'
51
+ )
52
+ );
53
+
54
+ Mage::getModel('core/config_data')
55
+ ->setScope('default')
56
+ ->setScopeId(0)
57
+ ->setPath('carriers/iparcel/name')
58
+ ->setValue(serialize($data))
59
+ ->save();
60
+
61
+ $installer->endSetup();
app/code/community/Iparcel/All/sql/iparcel_setup/mysql4-upgrade-1.1.0-1.1.1.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = new Mage_Sales_Model_Resource_Setup('core_setup');
4
+
5
+ // Setup attributes for handling tax and duty for i-parcel shipped orders
6
+ $entities = array(
7
+ 'quote_address',
8
+ 'order',
9
+ 'invoice',
10
+ 'creditmemo'
11
+ );
12
+ $options = array(
13
+ 'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL,
14
+ 'visible' => true,
15
+ 'required' => false
16
+ );
17
+
18
+ foreach ($entities as $entity) {
19
+ $installer->addAttribute($entity, 'base_iparcel_duty_amount', $options);
20
+ $installer->addAttribute($entity, 'iparcel_duty_amount', $options);
21
+ $installer->addAttribute($entity, 'base_iparcel_tax_amount', $options);
22
+ $installer->addAttribute($entity, 'iparcel_tax_amount', $options);
23
+ }
24
+
25
+ $installer->endSetup();
app/code/community/Iparcel/All/sql/iparcel_setup/mysql4-upgrade-1.1.1-1.2.0.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ // Setup log table
7
+ $installer->run("
8
+ DROP TABLE IF EXISTS {$this->getTable('iparcel/log')};
9
+ CREATE TABLE {$this->getTable('iparcel/log')} (
10
+ `id` int(11) unsigned NOT NULL auto_increment,
11
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
12
+ `controller` varchar(255) NOT NULL,
13
+ `request` TEXT NOT NULL,
14
+ `response` TEXT NOT NULL,
15
+ PRIMARY KEY (`id`)
16
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
17
+ ");
18
+
19
+ $installer->endSetup();
app/code/community/Iparcel/GlobaleCommerce/Helper/Data.php CHANGED
@@ -6,46 +6,6 @@
6
  * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_GlobaleCommerce_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
-
41
- /**
42
- * Escape quotation mark in strings for inclusion in JavaScript objects
43
- *
44
- * @param string $string String to escape
45
- * @return string
46
- */
47
- public function jsEscape($string = '')
48
- {
49
- return addcslashes($string, "\"");
50
- }
51
  }
6
  * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Helper_Data extends Iparcel_All_Helper_Data
10
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
app/code/community/Iparcel/GlobaleCommerce/Helper/International.php CHANGED
@@ -6,57 +6,6 @@
6
  * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_GlobaleCommerce_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
  }
6
  * @package Iparcel_GlobaleCommerce
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Helper_International extends Iparcel_All_Helper_International
10
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
app/code/community/Iparcel/GlobaleCommerce/Model/Api/External/Sales/Order.php CHANGED
@@ -241,6 +241,9 @@ class Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order extends Mage_Core_M
241
  ->addAttributeToFilter('sku', $product['sku'])
242
  ->addAttributeToSelect('*')
243
  ->getFirstItem();
 
 
 
244
  /* var $_product Mage_Catalog_Model_Product */
245
  $_product->load($_product->getId());
246
  $_products[$_product->getId()] = array(
241
  ->addAttributeToFilter('sku', $product['sku'])
242
  ->addAttributeToSelect('*')
243
  ->getFirstItem();
244
+ if(!$_product || !$_product->getData()) {
245
+ Mage::throwException("Product SKU not found: \"" . $product['sku'] . "\"");
246
+ }
247
  /* var $_product Mage_Catalog_Model_Product */
248
  $_product->load($_product->getId());
249
  $_products[$_product->getId()] = array(
app/code/community/Iparcel/GlobaleCommerce/Model/Observer.php CHANGED
@@ -54,15 +54,14 @@ class Iparcel_GlobaleCommerce_Model_Observer
54
  if (!$cacheStatus || !file_exists($this->_filePath)) {
55
  file_put_contents($this->_filePath, $dynamicOrderString);
56
  }
57
- include $this->_filePath;
58
 
59
- //to avoid file content is changed by anyone
60
  $fileContent = file_get_contents($this->_filePath);
61
  if ($fileContent != $dynamicOrderString) {
62
  file_put_contents($this->_filePath, $dynamicOrderString);
63
- include $this->_filePath;
64
  }
65
 
 
 
66
  Mage::getConfig()->setNode('global/models/sales/rewrite/order', $iparcelOrderClass);
67
  $this->_eventFlag = false;
68
  }
54
  if (!$cacheStatus || !file_exists($this->_filePath)) {
55
  file_put_contents($this->_filePath, $dynamicOrderString);
56
  }
 
57
 
 
58
  $fileContent = file_get_contents($this->_filePath);
59
  if ($fileContent != $dynamicOrderString) {
60
  file_put_contents($this->_filePath, $dynamicOrderString);
 
61
  }
62
 
63
+ include $this->_filePath;
64
+
65
  Mage::getConfig()->setNode('global/models/sales/rewrite/order', $iparcelOrderClass);
66
  $this->_eventFlag = false;
67
  }
app/code/community/Iparcel/GlobaleCommerce/controllers/OrderController.php CHANGED
@@ -134,7 +134,18 @@ class Iparcel_GlobaleCommerce_OrderController extends Mage_Core_Controller_Front
134
  $model->save();
135
  }
136
  } catch (Mage_Core_Exception $e) {
137
- echo $e->getMessage();
 
 
 
 
 
 
 
 
 
 
 
138
  }
139
  }
140
 
134
  $model->save();
135
  }
136
  } catch (Mage_Core_Exception $e) {
137
+ /** @var Iparcel_All_Model_Log $log */
138
+ $log = Mage::getModel('iparcel/log');
139
+ $log->setRequest($this->_checkRequest())
140
+ ->setResponse($e->getMessage())
141
+ ->setController('Add Order')
142
+ ->save();
143
+
144
+ $this->getResponse()->setHeader('Content-Type', '', true)
145
+ ->setHttpResponseCode(500)
146
+ ->setBody($e->getMessage())
147
+ ->sendResponse();
148
+ return;
149
  }
150
  }
151
 
app/code/community/Iparcel/GlobaleCommerce/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Iparcel_GlobaleCommerce>
5
- <version>3.0.0</version>
6
  </Iparcel_GlobaleCommerce>
7
  </modules>
8
  <frontend>
@@ -231,11 +231,6 @@
231
  <sales_order_shipment_view_tracking>Iparcel_GlobaleCommerce_Block_Adminhtml_Sales_Order_Shipment_View_Tracking</sales_order_shipment_view_tracking>
232
  </rewrite>
233
  </adminhtml>
234
- <catalog>
235
- <rewrite>
236
- <product_list>Iparcel_GlobaleCommerce_Block_Catalog_Product_List</product_list>
237
- </rewrite>
238
- </catalog>
239
  <ipglobalecommerce>
240
  <class>Iparcel_GlobaleCommerce_Block</class>
241
  </ipglobalecommerce>
2
  <config>
3
  <modules>
4
  <Iparcel_GlobaleCommerce>
5
+ <version>3.0.1</version>
6
  </Iparcel_GlobaleCommerce>
7
  </modules>
8
  <frontend>
231
  <sales_order_shipment_view_tracking>Iparcel_GlobaleCommerce_Block_Adminhtml_Sales_Order_Shipment_View_Tracking</sales_order_shipment_view_tracking>
232
  </rewrite>
233
  </adminhtml>
 
 
 
 
 
234
  <ipglobalecommerce>
235
  <class>Iparcel_GlobaleCommerce_Block</class>
236
  </ipglobalecommerce>
app/code/community/Iparcel/GlobaleCommerce/etc/system.xml CHANGED
@@ -27,72 +27,15 @@
27
  <show_in_website>1</show_in_website>
28
  <show_in_store>0</show_in_store>
29
  <groups>
30
- <scripts translate="label">
31
- <label>Scripts</label>
32
- <frontend_type>text</frontend_type>
33
- <sort_order>5</sort_order>
34
  <show_in_default>1</show_in_default>
35
  <show_in_website>1</show_in_website>
36
- <show_in_store>0</show_in_store>
37
- <fields>
38
- <scripts translate="label">
39
- <label>Enable Frontend Scripts</label>
40
- <frontend_type>select</frontend_type>
41
- <source_model>adminhtml/system_config_source_yesno</source_model>
42
- <sort_order>5</sort_order>
43
- <show_in_default>1</show_in_default>
44
- <show_in_website>1</show_in_website>
45
- <show_in_store>0</show_in_store>
46
- </scripts>
47
- <jquery translate="label">
48
- <label>Enable jQuery</label>
49
- <comment>Set it to "no" if you're using another jQuery library</comment>
50
- <frontend_type>select</frontend_type>
51
- <source_model>adminhtml/system_config_source_yesno</source_model>
52
- <sort_order>10</sort_order>
53
- <show_in_default>1</show_in_default>
54
- <show_in_website>0</show_in_website>
55
- <show_in_store>0</show_in_store>
56
- </jquery>
57
- <post translate="label">
58
- <label>Custom POST scripts</label>
59
- <frontend_type>file</frontend_type>
60
- <backend_model>ipglobalecommerce/config_script_js</backend_model>
61
- <sort_order>15</sort_order>
62
- <show_in_default>1</show_in_default>
63
- <show_in_website>1</show_in_website>
64
- <show_in_store>1</show_in_store>
65
- </post>
66
- </fields>
67
  </scripts>
68
  <international_customer translate="label">
69
- <label>International Customer</label>
70
- <frontend_type>text</frontend_type>
71
- <sort_order>10</sort_order>
72
  <show_in_default>1</show_in_default>
73
  <show_in_website>1</show_in_website>
74
  <show_in_store>1</show_in_store>
75
- <fields>
76
- <enable translate="label">
77
- <label>Enabled</label>
78
- <frontend_type>select</frontend_type>
79
- <source_model>adminhtml/system_config_source_yesno</source_model>
80
- <sort_order>0</sort_order>
81
- <show_in_default>1</show_in_default>
82
- <show_in_website>1</show_in_website>
83
- <show_in_store>1</show_in_store>
84
- </enable>
85
- <visibility translate="label">
86
- <label>Catalog product visibility attribute</label>
87
- <frontend_type>select</frontend_type>
88
- <source_model>ipglobalecommerce/system_config_source_catalog_product_attribute_boolean</source_model>
89
- <sort_order>1</sort_order>
90
- <show_in_default>1</show_in_default>
91
- <show_in_website>1</show_in_website>
92
- <show_in_store>1</show_in_store>
93
- <tooltip>If chosen attribute has value 'true' catalog product will be visible for international customer</tooltip>
94
- </visibility>
95
- </fields>
96
  </international_customer>
97
  </groups>
98
  </iparcel>
27
  <show_in_website>1</show_in_website>
28
  <show_in_store>0</show_in_store>
29
  <groups>
30
+ <scripts>
 
 
 
31
  <show_in_default>1</show_in_default>
32
  <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  </scripts>
35
  <international_customer translate="label">
 
 
 
36
  <show_in_default>1</show_in_default>
37
  <show_in_website>1</show_in_website>
38
  <show_in_store>1</show_in_store>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  </international_customer>
40
  </groups>
41
  </iparcel>
app/design/adminhtml/default/default/layout/iparcel.xml CHANGED
@@ -1,9 +1,29 @@
1
  <layout>
 
 
 
 
 
 
 
2
  <adminhtml_iparcel_log_index>
3
  <reference name="content">
4
  <block type="iparcel/adminhtml_iparcel_logs" name="iparcel.logs" as="logs" />
5
  </reference>
6
  </adminhtml_iparcel_log_index>
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  <adminhtml_iparcel_sync_ajax>
8
  <block type="adminhtml/page" name="root" output="toHtml" template="page.phtml">
9
  <block type="adminhtml/page_head" name="head" as="head" template="page/head.phtml">
@@ -30,4 +50,47 @@
30
  <block type="core/template" name="checkitems.sync" template="iparcel/sync/ajax/checkitems.phtml" />
31
  </reference>
32
  </adminhtml_iparcel_sync_ajax_checkitems>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  </layout>
1
  <layout>
2
+ <adminhtml_system_config_edit>
3
+ <reference name="head">
4
+ <action method="addJs">
5
+ <name>iparcel/adminhtml/shipping-methods.js</name>
6
+ </action>
7
+ </reference>
8
+ </adminhtml_system_config_edit>
9
  <adminhtml_iparcel_log_index>
10
  <reference name="content">
11
  <block type="iparcel/adminhtml_iparcel_logs" name="iparcel.logs" as="logs" />
12
  </reference>
13
  </adminhtml_iparcel_log_index>
14
+ <adminhtml_iparcel_shipment_split>
15
+ <reference name="content">
16
+ <block type="iparcel/adminhtml_iparcel_shipment_split" name="iparcel_shipment_split">
17
+ <block type="iparcel/adminhtml_iparcel_shipment_split_form" name="form" template="iparcel/shipment/split/form.phtml">
18
+ <block type="adminhtml/sales_order_shipment_create_items" name="shipment_items" template="iparcel/shipment/split/items.phtml">
19
+ <action method="addItemRender"><type>default</type><block>adminhtml/sales_items_renderer_default</block><template>iparcel/shipment/split/renderer/default.phtml</template></action>
20
+ <action method="addColumnRender"><column>qty</column><block>adminhtml/sales_items_column_qty</block><template>sales/items/column/qty.phtml</template></action>
21
+ <action method="addColumnRender"><column>name</column><block>adminhtml/sales_items_column_name</block><template>sales/items/column/name.phtml</template></action>
22
+ </block>
23
+ </block>
24
+ </block>
25
+ </reference>
26
+ </adminhtml_iparcel_shipment_split>
27
  <adminhtml_iparcel_sync_ajax>
28
  <block type="adminhtml/page" name="root" output="toHtml" template="page.phtml">
29
  <block type="adminhtml/page_head" name="head" as="head" template="page/head.phtml">
50
  <block type="core/template" name="checkitems.sync" template="iparcel/sync/ajax/checkitems.phtml" />
51
  </reference>
52
  </adminhtml_iparcel_sync_ajax_checkitems>
53
+
54
+ <adminhtml_sales_order_view>
55
+ <reference name="order_totals">
56
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_duty" template="iparcel/order/totals/duty.phtml"></block>
57
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_tax" template="iparcel/order/totals/tax.phtml"></block>
58
+ </reference>
59
+ </adminhtml_sales_order_view>
60
+ <adminhtml_sales_order_invoice_new>
61
+ <reference name="invoice_totals">
62
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_duty" template="iparcel/order/totals/duty.phtml"></block>
63
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_tax" template="iparcel/order/totals/tax.phtml"></block>
64
+ </reference>
65
+ </adminhtml_sales_order_invoice_new>
66
+ <adminhtml_sales_order_invoice_updateqty>
67
+ <reference name="invoice_totals">
68
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_duty" template="iparcel/order/totals/duty.phtml"></block>
69
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_tax" template="iparcel/order/totals/tax.phtml"></block>
70
+ </reference>
71
+ </adminhtml_sales_order_invoice_updateqty>
72
+ <adminhtml_sales_order_invoice_view>
73
+ <reference name="invoice_totals">
74
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_duty" template="iparcel/order/totals/duty.phtml"></block>
75
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_tax" template="iparcel/order/totals/tax.phtml"></block>
76
+ </reference>
77
+ </adminhtml_sales_order_invoice_view>
78
+ <adminhtml_sales_order_creditmemo_new>
79
+ <reference name="creditmemo_totals">
80
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_duty" template="iparcel/order/totals/duty.phtml"></block>
81
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_tax" template="iparcel/order/totals/tax.phtml"></block>
82
+ </reference>
83
+ </adminhtml_sales_order_creditmemo_new>
84
+ <adminhtml_sales_order_creditmemo_updateqty>
85
+ <reference name="creditmemo_totals">
86
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_duty" template="iparcel/order/totals/duty.phtml"></block>
87
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_tax" template="iparcel/order/totals/tax.phtml"></block>
88
+ </reference>
89
+ </adminhtml_sales_order_creditmemo_updateqty>
90
+ <adminhtml_sales_order_creditmemo_view>
91
+ <reference name="creditmemo_totals">
92
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_duty" template="iparcel/order/totals/duty.phtml"></block>
93
+ <block type="adminhtml/sales_order_totals_item" name="iparcel_order_totals_tax" template="iparcel/order/totals/tax.phtml"></block>
94
+ </reference>
95
+ </adminhtml_sales_order_creditmemo_view>
96
  </layout>
app/design/adminhtml/default/default/template/iparcel/order/totals/duty.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php $this->setPriceDataObject($this->getSource()) ?>
2
+ <?php if ((float) $this->getSource()->getIparcelDutyAmount()): ?>
3
+ <tr>
4
+ <td class="label"><?php echo Mage::helper('iparcel')->getDutyLabel(); ?></td>
5
+ <td>
6
+ <?php echo $this->displayPrices($this->getSource()->getBaseIparcelDutyAmount(), $this->getSource()->getIparcelDutyAmount()); ?>
7
+ </td>
8
+ </tr>
9
+ <?php endif; ?>
app/design/adminhtml/default/default/template/iparcel/order/totals/tax.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php $this->setPriceDataObject($this->getSource()) ?>
2
+ <?php if ((float) $this->getSource()->getIparcelTaxAmount()): ?>
3
+ <tr>
4
+ <td class="label"><?php echo Mage::helper('iparcel')->getTaxLabel(); ?></td>
5
+ <td>
6
+ <?php echo $this->displayPrices($this->getSource()->getBaseIparcelTaxAmount(), $this->getSource()->getIparcelTaxAmount()); ?>
7
+ </td>
8
+ </tr>
9
+ <?php endif; ?>
app/design/frontend/base/default/layout/externalshipping.xml CHANGED
@@ -1,46 +1,9 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <layout version="0.1.0">
3
- <default>
4
- <reference name="head">
5
- <block type="ipglobalecommerce/html_head_jquery" name="jquery" template="ipglobalecommerce/html/head/jquery.phtml" />
6
- <block type="ipglobalecommerce/html_head_iparcel" name="html.head.iparcel" template="ipglobalecommerce/html/head/iparcel.phtml" />
7
- </reference>
8
- </default>
9
- <catalog_product_view>
10
- <reference name="head">
11
- <action method="addJs"><script>iparcel/lib.js</script></action>
12
- <block type="ipglobalecommerce/html_head_post" name="iparcel_post" template="ipglobalecommerce/html/head/post.phtml" />
13
- <block type="ipglobalecommerce/catalog_product" name="ipglobalecommerce_sku" template="ipglobalecommerce/post.phtml" />
14
- </reference>
15
- </catalog_product_view>
16
- <catalog_category_view>
17
- <reference name="head">
18
- <action method="addJs"><script>iparcel/lib.js</script></action>
19
- <block type="ipglobalecommerce/html_head_post" name="iparcel_post" template="ipglobalecommerce/html/head/post.phtml" />
20
- <block type="ipglobalecommerce/catalog_product_list" name="ipglobalecommerce_sku.list" template="ipglobalecommerce/post/list.phtml" />
21
- </reference>
22
- </catalog_category_view>
23
- <catalogsearch_result_index>
24
- <reference name="head">
25
- <action method="addJs"><script>iparcel/lib.js</script></action>
26
- <block type="ipglobalecommerce/html_head_post" name="iparcel_post" template="ipglobalecommerce/html/head/post.phtml" />
27
- <block type="ipglobalecommerce/catalogsearch_result" name="ipglobalecommerce_sku.list" template="ipglobalecommerce/post/list.phtml">
28
- <block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml"/>
29
- <action method="setListCollection"/>
30
- </block>
31
- </reference>
32
- </catalogsearch_result_index>
33
- <catalogsearch_advanced_result>
34
- <reference name="head">
35
- <action method="addJs"><script>iparcel/lib.js</script></action>
36
- <block type="ipglobalecommerce/html_head_post" name="iparcel_post" template="ipglobalecommerce/html/head/post.phtml" />
37
- <block type="ipglobalecommerce/catalogsearch_advanced_result" name="ipglobalecommerce_sku.list" template="ipglobalecommerce/post/list.phtml" />
38
- </reference>
39
- </catalogsearch_advanced_result>
40
- <checkout_onepage_index>
41
- <reference name="head">
42
- <action method="addJs"><script>iparcel/cpf.js</script></action>
43
- <block type="ipglobalecommerce/cpf" name="ipglobalecommerce_cpf" template="ipglobalecommerce/cpf.phtml" />
44
- </reference>
45
- </checkout_onepage_index>
46
- </layout>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout version="0.1.0">
3
+ <checkout_onepage_index>
4
+ <reference name="head">
5
+ <action method="addJs"><script>iparcel/cpf.js</script></action>
6
+ <block type="ipglobalecommerce/cpf" name="ipglobalecommerce_cpf" template="ipglobalecommerce/cpf.phtml" />
7
+ </reference>
8
+ </checkout_onepage_index>
9
+ </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/layout/iparcel.xml ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <block type="iparcel/html_head_jquery" name="jquery" template="iparcel/html/head/jquery.phtml" />
6
+ <block type="iparcel/html_head_iparcel" name="html.head.iparcel" template="iparcel/html/head/iparcel.phtml" />
7
+ </reference>
8
+ </default>
9
+ <catalog_product_view>
10
+ <reference name="head">
11
+ <action method="addJs"><script>iparcel/lib.js</script></action>
12
+ <block type="iparcel/html_head_post" name="iparcel_post" template="iparcel/html/head/post.phtml" />
13
+ <block type="iparcel/catalog_product" name="iparcel_sku" template="iparcel/post.phtml" />
14
+ </reference>
15
+ </catalog_product_view>
16
+ <catalog_category_view>
17
+ <reference name="head">
18
+ <action method="addJs"><script>iparcel/lib.js</script></action>
19
+ <block type="iparcel/html_head_post" name="iparcel_post" template="iparcel/html/head/post.phtml" />
20
+ <block type="iparcel/catalog_product_list" name="iparcel_sku.list" template="iparcel/post/list.phtml" />
21
+ </reference>
22
+ </catalog_category_view>
23
+ <catalogsearch_result_index>
24
+ <reference name="head">
25
+ <action method="addJs"><script>iparcel/lib.js</script></action>
26
+ <block type="iparcel/html_head_post" name="iparcel_post" template="iparcel/html/head/post.phtml" />
27
+ <block type="iparcel/catalogsearch_result" name="iparcel_sku.list" template="iparcel/post/list.phtml">
28
+ <block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml"/>
29
+ <action method="setListCollection"/>
30
+ </block>
31
+ </reference>
32
+ </catalogsearch_result_index>
33
+ <catalogsearch_advanced_result>
34
+ <reference name="head">
35
+ <action method="addJs"><script>iparcel/lib.js</script></action>
36
+ <block type="iparcel/html_head_post" name="iparcel_post" template="iparcel/html/head/post.phtml" />
37
+ <block type="iparcel/catalogsearch_advanced_result" name="iparcel_sku.list" template="iparcel/post/list.phtml" />
38
+ </reference>
39
+ </catalogsearch_advanced_result>
40
+ <sales_order_view>
41
+ <reference name="order_totals">
42
+ <block type="iparcel/sales_order_totals_duty" name="iparcel_sales_order_totals_duty"></block>
43
+ <block type="iparcel/sales_order_totals_tax" name="iparcel_sales_order_totals_tax"></block>
44
+ </reference>
45
+ </sales_order_view>
46
+
47
+ <sales_order_print>
48
+ <reference name="order_totals">
49
+ <block type="iparcel/sales_order_totals_duty" name="iparcel_sales_order_totals_duty"></block>
50
+ <block type="iparcel/sales_order_totals_tax" name="iparcel_sales_order_totals_tax"></block>
51
+ </reference>
52
+ </sales_order_print>
53
+
54
+ <sales_email_order_items>
55
+ <reference name="order_totals">
56
+ <block type="iparcel/sales_order_totals_duty" name="iparcel_sales_order_totals_duty"></block>
57
+ <block type="iparcel/sales_order_totals_tax" name="iparcel_sales_order_totals_tax"></block>
58
+ </reference>
59
+ </sales_email_order_items>
60
+
61
+ <sales_order_invoice>
62
+ <reference name="invoice_totals">
63
+ <block type="iparcel/sales_order_totals_duty" name="iparcel_sales_order_totals_duty"></block>
64
+ <block type="iparcel/sales_order_totals_tax" name="iparcel_sales_order_totals_tax"></block>
65
+ </reference>
66
+ </sales_order_invoice>
67
+
68
+ <sales_order_printinvoice>
69
+ <reference name="invoice_totals">
70
+ <block type="iparcel/sales_order_totals_duty" name="iparcel_sales_order_totals_duty"></block>
71
+ <block type="iparcel/sales_order_totals_tax" name="iparcel_sales_order_totals_tax"></block>
72
+ </reference>
73
+ </sales_order_printinvoice>
74
+
75
+ <sales_email_order_invoice_items>
76
+ <reference name="invoice_totals">
77
+ <block type="iparcel/sales_order_totals_duty" name="iparcel_sales_order_totals_duty"></block>
78
+ <block type="iparcel/sales_order_totals_tax" name="iparcel_sales_order_totals_tax"></block>
79
+ </reference>
80
+ </sales_email_order_invoice_items>
81
+
82
+ <sales_order_creditmemo>
83
+ <reference name="creditmemo_totals">
84
+ <block type="iparcel/sales_order_totals_duty" name="iparcel_sales_order_totals_duty"></block>
85
+ <block type="iparcel/sales_order_totals_tax" name="iparcel_sales_order_totals_tax"></block>
86
+ </reference>
87
+ </sales_order_creditmemo>
88
+
89
+ <sales_order_printcreditmemo>
90
+ <reference name="creditmemo_totals">
91
+ <block type="iparcel/sales_order_totals_duty" name="iparcel_sales_order_totals_duty"></block>
92
+ <block type="iparcel/sales_order_totals_tax" name="iparcel_sales_order_totals_tax"></block>
93
+ </reference>
94
+ </sales_order_printcreditmemo>
95
+
96
+ <sales_email_order_creditmemo_items>
97
+ <reference name="creditmemo_totals">
98
+ <block type="iparcel/sales_order_totals_duty" name="iparcel_sales_order_totals_duty"></block>
99
+ <block type="iparcel/sales_order_totals_tax" name="iparcel_sales_order_totals_tax"></block>
100
+ </reference>
101
+ </sales_email_order_creditmemo_items>
102
+ </layout>
app/design/frontend/base/default/template/{ipglobalecommerce → iparcel}/html/head/iparcel.phtml RENAMED
@@ -5,7 +5,7 @@
5
  * @author Bobby Burden <bburden@i-parcel.com>
6
  * @class Iparcel_GlobaleCommerce_Block_Html_Head_Jquery
7
  */
8
- $helper = Mage::helper('ipglobalecommerce');
9
  ?>
10
  <?php if($this->getFlag()): ?>
11
  <script type="text/javascript" src="<?php echo $helper->getScriptUrl(); ?>JavaScript/Merchant/<?php echo $helper->getCustomerId(); ?>/1"></script>
5
  * @author Bobby Burden <bburden@i-parcel.com>
6
  * @class Iparcel_GlobaleCommerce_Block_Html_Head_Jquery
7
  */
8
+ $helper = Mage::helper('iparcel');
9
  ?>
10
  <?php if($this->getFlag()): ?>
11
  <script type="text/javascript" src="<?php echo $helper->getScriptUrl(); ?>JavaScript/Merchant/<?php echo $helper->getCustomerId(); ?>/1"></script>
app/design/frontend/base/default/template/{ipglobalecommerce → iparcel}/html/head/jquery.phtml RENAMED
File without changes
app/design/frontend/base/default/template/{ipglobalecommerce → iparcel}/html/head/post.phtml RENAMED
File without changes
app/design/frontend/base/default/template/{ipglobalecommerce → iparcel}/post.phtml RENAMED
File without changes
app/design/frontend/base/default/template/{ipglobalecommerce → iparcel}/post/list.phtml RENAMED
@@ -8,7 +8,7 @@
8
  ?>
9
  <?php
10
  $_productCollection = $this->getLoadedProductCollection();
11
- $helper = Mage::helper('ipglobalecommerce')
12
  ?>
13
  <script type="text/javascript">
14
  iparcelPost.sku_list({
8
  ?>
9
  <?php
10
  $_productCollection = $this->getLoadedProductCollection();
11
+ $helper = Mage::helper('iparcel')
12
  ?>
13
  <script type="text/javascript">
14
  iparcelPost.sku_list({
app/locale/en_US/iparcel.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ "%s (Shipping Price: %s Duty: %s Tax: %s)","%s (Shipping Price: %s Duty: %s Tax: %s)"
2
+ "Tax","Tax"
3
+ "Duty","Duty"
4
+ "Tax & Duty","Tax & Duty"
5
+ "Default box","Default box"
js/iparcel/adminhtml/shipping-methods.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Controls toggling the "enabled" state of the "Country of Origin" in the
3
+ * i-parcel Shipping Method.
4
+ */
5
+
6
+ toggleCountryOfOrigin = function($altEnabled, $corObject) {
7
+ if ($altEnabled.value == '1') {
8
+ $corObject.enable();
9
+ } else {
10
+ $corObject.disable();
11
+ }
12
+ }
13
+
14
+ document.observe('dom:loaded', function(event) {
15
+ $alternateEnabledObject = $$('#carriers_i-parcel_choose_domestic').first();
16
+ $countryOfOriginObject = $$('#carriers_i-parcel_origin_country_id').first();
17
+ if (typeof($alternateEnabledObject) === 'object') {
18
+ toggleCountryOfOrigin($alternateEnabledObject, $countryOfOriginObject);
19
+ $alternateEnabledObject.observe('change', function(event) {
20
+ toggleCountryOfOrigin($(this), $countryOfOriginObject)
21
+ });
22
+ }
23
+ });
js/iparcel/post.js CHANGED
@@ -13,7 +13,7 @@ var iparcelPost = {
13
  if (url.indexOf(':') == 0) {
14
  url = url.substring(1,url.length);
15
  }
16
- this.url = url+'shippingip/ajax/configurable';
17
  $jip(document).ready(function(){
18
  var $sku = $jip("<div/>");
19
  $sku.css("display","none");
@@ -147,7 +147,10 @@ var iparcelPost = {
147
  });
148
  },
149
  append: function(item,name){
150
- $jip('.item .product-name a:contains('+name+')').closest('.item').append(item);
 
 
 
151
  }
152
  };
153
 
13
  if (url.indexOf(':') == 0) {
14
  url = url.substring(1,url.length);
15
  }
16
+ this.url = url+'iparcel/ajax/configurable';
17
  $jip(document).ready(function(){
18
  var $sku = $jip("<div/>");
19
  $sku.css("display","none");
147
  });
148
  },
149
  append: function(item,name){
150
+ var $item = $jip('.item .product-name a').filter(function () {
151
+ return $jip(this).text() == name;
152
+ });
153
+ $item.closest('.item').append(item);
154
  }
155
  };
156
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>iparcel_connect</name>
4
- <version>3.0.0</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
@@ -16,9 +16,9 @@
16
  <email>bburden@i-parcel.com</email>
17
  </author>
18
  </authors>
19
- <date>2016-01-07</date>
20
- <time>19:55:44</time>
21
- <contents><target name="mageweb"><dir name="app"><dir name="code"><dir name="community"><dir name="Iparcel"><dir name="GlobaleCommerce"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="List.php" hash="d8a3ba239e08f51164c13a566481d1b6"/></dir><file name="Product.php" hash="41c6b5f1f2b62113ec39c0bba7ca2532"/></dir><dir name="Catalogsearch"><dir name="Advanced"><file name="Result.php" hash="095ac5afca951e27438d987337513396"/></dir><file name="Result.php" hash="aff0bef86d124d28afb03f6422a0b33a"/></dir><file name="Cpf.php" hash="084f9bd9599539adcfb3684b9b2aca46"/><dir name="Html"><dir name="Head"><file name="Iparcel.php" hash="a7ce4facc447e654ca5e7a9c12f25965"/><file name="Jquery.php" hash="02b3bf8e3baf5c9f980db126eca127b7"/><file name="Post.php" hash="7df44931ff175b16bcfa5581fcff4630"/></dir></dir><dir name="Payment"><file name="Info.php" hash="cbc97ba5326777dfc1192409be1de364"/></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="8a63474674b4095f74c96496c7a04568"/><file name="DevController.php" hash="e72f322908f4435fe39fc7a8c6d7ad07"/><file name="InternationalController.php" hash="c912b25067bc6cdecb4d311678282f8c"/><file name="OrderController.php" hash="9d2dbd6e06d195413136ac63438f75b8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="13d82fdb42fad3c9ccf2d474cf287797"/><file name="config.xml" hash="52588acf2cdac811e310da6a36163e67"/><file name="system.xml" hash="c7adba42d3bae64c3e136d867aeef324"/></dir><dir name="Helper"><dir name="Api"><file name="External.php" hash="f1e2229ea753fdafccb5d9ca396b5279"/></dir><file name="Api.php" hash="e79a2fa92b3a5898cc9915e1cd80c522"/><file name="Data.php" hash="24420111635eac988d9fb2508f12d103"/><file name="International.php" hash="a6ac1ff2c8fdba4b1e9dc64b0a359ce1"/><file name="String.php" hash="13620129b7a2d8aa3dfaabaa8a17526e"/><dir name="Sales"><file name="Data.php" hash="6f7f15b86012d9e5e6b48cccdbbac7f1"/></dir></dir><dir name="Model"><dir name="Api"><dir name="External"><dir name="Sales"><file name="Order.php" hash="8c95a20cf245822d40252266c85535b9"/></dir></dir></dir><dir name="Carrier"><file name="Iparcel.php" hash="f604116aa5bc81dcd7ff2de9ad648fbf"/></dir><dir name="Config"><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="d136367488f51687b4a8f1205ed1db39"/><file name="Weekday.php" hash="cfb1d0a381d74207ca5f567bdb6a6ae0"/></dir><dir name="Time"><file name="Hour.php" hash="7ee959e67a3100d60aefd31d4b626bba"/><file name="Minute.php" hash="f8376b241ad8a8e6bf35c82d75109b71"/></dir></dir><dir name="Script"><file name="Js.php" hash="964762664a28b177f1569127f6953531"/></dir></dir><dir name="Cpf"><file name="Order.php" hash="51bf749b00a9b51e2f6f39a7e9734d86"/><file name="Quote.php" hash="6af90f0a33e0c02ba041bb6ff5882d7d"/></dir><file name="Cpf.php" hash="650bbe60bae37b3e43d8686378a2282b"/><file name="Observer.php" hash="656be56c06a117d75348876454e2d81a"/><file name="Parcel.php" hash="e9325c49bc67983c075b5bba76bc243a"/><dir name="Payment"><file name="Iparcel.php" hash="958572bf836c478161a371beb1c86139"/></dir><dir name="Resource"><dir name="Api"><file name="Order.php" hash="2daf80f9a3be2c687b1ae3d9561c4305"/></dir><dir name="Cpf"><file name="Collection.php" hash="ac85f294739a7a892f60a63ca9dc8217"/><file name="Order.php" hash="e8391efb37ceecba5c6c73a2ff474b91"/><file name="Quote.php" hash="0a4687a32ebc264888e2eb21e885d938"/><dir name="Order"><file name="Collection.php" hash="7f8406d9e4a901183b36c8d0e85c1b87"/></dir><dir name="Quote"><file name="Collection.php" hash="08f0e8427111a34878ed8b711f13b5cf"/></dir></dir><file name="Cpf.php" hash="8e459e3535510675d9d7a1867d244008"/><file name="Parcel.php" hash="389b267d69b196454fbc97e9287cbca5"/><file name="Setup.php" hash="4752a060c3cf972f30d503b3d7f7ce70"/><dir name="Parcel"><file name="Collection.php" hash="3009eb727415705ae5f83739c007804c"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Observer.php" hash="22e58f9e21b4ca3cd41f611bdd479a57"/></dir><dir name="Quote"><file name="Observer.php" hash="b9ac9f1f2323765b482dd4970ed2c7e8"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="e783073c99cc876c670d90655fb068c8"/></dir><file name="Attribute.php" hash="e3e9e3ab353ad864c40b1b7a682f169f"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="8f636058187564cb7d9c2b9a0a94b10b"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="484e68457cc656585665aca1300a4d4e"/></dir></dir></dir></dir></dir></dir><dir name="sql"><dir name="ipglobalecommerce_setup"><file name="mysql4-install-0.2.0.php" hash="a2d77ada0a1ed47fc9983cc3dfbb6c52"/><file name="mysql4-install-0.3.0.php" hash="a2d77ada0a1ed47fc9983cc3dfbb6c52"/><file name="mysql4-install-2.3.4.2.php" hash="deaea497fbb845739102375833116f90"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="d08b88d172a58246d27cfe8b1b25b353"/><file name="mysql4-upgrade-0.3.1-0.3.2.php" hash="55d56591823e441d4f5f8c34c4067922"/><file name="mysql4-upgrade-0.3.2-2.0.0.php" hash="d78bde958b23787eb243a2f0ab3814eb"/><file name="mysql4-upgrade-2.0.0-2.3.4.2.php" hash="caa9c9b26eb98a662e62d28adf1475f4"/><file name="mysql4-upgrade-2.4.0.3-2.4.1.0.php" hash="e67007d6ccc67dbcfb226c5601f8c8f0"/><file name="mysql4-upgrade-2.4.1.17-2.4.3.0.php" hash="aaca3b01138aedeaee8edc1cc231736f"/><file name="mysql4-upgrade-2.4.1.6-2.4.1.7.php" hash="fe16b8c574899d242e8b07889c823605"/><file name="mysql4-upgrade-2.4.6-2.4.7.php" hash="27d32d4c780813ef93de0b3512235af2"/></dir></dir></dir><dir name="All"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Mapping"><file name="Button.php" hash="dfdaf5a2fbf824a10fccc952fdccf567"/></dir></dir><dir name="Iparcel"><file name="Dashboard.php" hash="ec9dddd10368136f1bdfe79fddd4500c"/><file name="Logs.php" hash="be8765472a9d2adc54473fe1df677921"/><dir name="Logs"><file name="Grid.php" hash="d78e239ba695619627c114cb52d38646"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Iparcel"><file name="LogController.php" hash="b30163b1c1b06b76c778b815cb0485d9"/><file name="SyncController.php" hash="9378f5db27d059bbb36ff1e71bd38d32"/><dir name="Sync"><file name="AjaxController.php" hash="671afecdeaed8f4c80a85d78605cd6da"/></dir></dir></dir><file name="InfoController.php" hash="6543b1e9803489e507d2470f8e3e408b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="50bc0bee93b5612763321eae11cfdc51"/><file name="config.xml" hash="713a6455fd9ba664fa6fbe4de0f28e76"/><file name="system.xml" hash="809d4deab49bffad6a6820c05bad49f6"/></dir><dir name="Helper"><file name="Api.php" hash="aa9c589ecf90b26c4ed2684ac8fd68a1"/><file name="Data.php" hash="4cfb227c77a5597bb21ba1ab1cbc65bd"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><file name="Observer.php" hash="d16d89cea8eea6352a7d9b1193cd9512"/></dir></dir><file name="Cron.php" hash="670d37cd6cdbe60aa69fad8eb0a0759e"/><file name="Log.php" hash="0209908a304c4940fe20b961b3d82c6c"/><dir name="System"><dir name="Config"><dir name="Catalog"><file name="Mapping.php" hash="8895678aa59e49226509d2b4709c5f43"/></dir><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="baec5b8a27c5b037529ba935aae0370a"/><file name="Weekday.php" hash="173edc075325d932f8dad6d4674b8153"/></dir><dir name="Time"><file name="Hour.php" hash="ddad98b85290d9b13ec9f65fbe8a10b3"/><file name="Minute.php" hash="4a76af0057d60e8ff0ff7fedc1d50575"/></dir></dir><file name="Guid.php" hash="311c7f8072f02a6be9e25b6411298c5c"/><dir name="Script"><file name="Js.php" hash="3e3f23b38ecdc361bf6ff6cee1871e92"/></dir><dir name="Source"><dir name="Catalog"><dir name="Mapping"><dir name="Configurable"><file name="Price.php" hash="f9116fd446914467e7fb31bed5a6dd0b"/></dir><file name="Mode.php" hash="36140a050ea65ff23d45264fa67e1a2b"/></dir><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="ca1883122659f1b48890ecd46a1590ee"/></dir><file name="Attribute.php" hash="8ca9c929cda497400865751ffba991e6"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="143c26f9661e5dc995ff064e333a2018"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="f1e414c08c43ebb2fcc6ccf5b41a2ff2"/></dir></dir><dir name="Tax"><file name="Mode.php" hash="fb09f17b54ef8ffa22580741cc66ac14"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="ipglobalecommerce"><file name="cpf.phtml" hash="6f7835f5df6f6baabaf6a136a372469a"/><file name="post.phtml" hash="3827cab2dba981556aeb8ec915ab03cc"/><dir name="html"><dir name="head"><file name="iparcel.phtml" hash="214dcb4c389c8824ead711e2ac6bcc5a"/><file name="jquery.phtml" hash="c287cb0aa4ddd1f04f27cb5df605a27d"/><file name="post.phtml" hash="1a53e744668b250175ba275b4260050b"/></dir></dir><dir name="post"><file name="list.phtml" hash="aa2b9741d323fe17e623458e2bc2ca4d"/></dir></dir></dir><dir name="layout"><file name="externalshipping.xml" hash="02880d015510abead594b4b7ad6884e1"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="externalsales.xml" hash="990ecce7258a8f6586d41efde1f29e13"/><file name="iparcel.xml" hash="c75b2082a2d5ceb3e507843ca793ea05"/></dir><dir name="template"><dir name="iparcel"><dir name="sync"><dir name="ajax"><file name="catalog.phtml" hash="4959462a90a5c2b6c01ba722b73e8f58"/><file name="checkitems.phtml" hash="c19b0e4fd0feddedbc2cef3b2f4ce79b"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Iparcel_GlobaleCommerce.xml" hash="0dc1ebffdd8d16f0da230acdf7c76901"/><file name="Iparcel_All.xml" hash="89e4b47a6ac9aa0b82f70b1539d587ea"/></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="39bf27f07ff782dcde65480d4ff04496"/><file name="label.js" hash="39bf27f07ff782dcde65480d4ff04496"/><file name="label.js" hash="39bf27f07ff782dcde65480d4ff04496"/><file name="label.js" hash="39bf27f07ff782dcde65480d4ff04496"/><file name="label.js" hash="39bf27f07ff782dcde65480d4ff04496"/><file name="sync.js" hash="bcfc390768020ce3e532f594c8f6df81"/></dir><file name="cpf.js" hash="92443ee9633827b535044aebbdaeef87"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="29d52bf315386c3c8a9b7a7d6e277dfc"/><file name="post.js" hash="2782875f94fa97e434c6cb587526e4d9"/><file name="cpf.js" hash="92443ee9633827b535044aebbdaeef87"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="29d52bf315386c3c8a9b7a7d6e277dfc"/><file name="post.js" hash="2782875f94fa97e434c6cb587526e4d9"/><file name="cpf.js" hash="92443ee9633827b535044aebbdaeef87"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="29d52bf315386c3c8a9b7a7d6e277dfc"/><file name="post.js" hash="2782875f94fa97e434c6cb587526e4d9"/><file name="cpf.js" hash="92443ee9633827b535044aebbdaeef87"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="29d52bf315386c3c8a9b7a7d6e277dfc"/><file name="post.js" hash="2782875f94fa97e434c6cb587526e4d9"/></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iparcel"><dir name="font"><file name="code128.ttf" hash=""/><file name="code128.ttf" hash=""/></dir><file name="ajaxSync.css" hash="c622b9e4b77589bc0f3c0555124d2751"/></dir></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies>
24
  <required>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>iparcel_connect</name>
4
+ <version>3.0.1</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
16
  <email>bburden@i-parcel.com</email>
17
  </author>
18
  </authors>
19
+ <date>2016-03-23</date>
20
+ <time>18:43:18</time>
21
+ <contents><target name="mageweb"><dir name="app"><dir name="code"><dir name="community"><dir name="Iparcel"><dir name="GlobaleCommerce"><dir name="Block"><file name="Cpf.php" hash="084f9bd9599539adcfb3684b9b2aca46"/><dir name="Payment"><file name="Info.php" hash="cbc97ba5326777dfc1192409be1de364"/></dir></dir><dir name="controllers"><file name="DevController.php" hash="e72f322908f4435fe39fc7a8c6d7ad07"/><file name="OrderController.php" hash="d44583efd9e552bf8ce0e019444981fc"/></dir><dir name="etc"><file name="adminhtml.xml" hash="13d82fdb42fad3c9ccf2d474cf287797"/><file name="config.xml" hash="e5059418e24fb645084e3dc1a6f1ab63"/><file name="system.xml" hash="ddbee53439e5fa8cab0ea696ad05001f"/></dir><dir name="Helper"><dir name="Api"><file name="External.php" hash="f1e2229ea753fdafccb5d9ca396b5279"/></dir><file name="Api.php" hash="e79a2fa92b3a5898cc9915e1cd80c522"/><file name="Data.php" hash="33cac3c2511b7e3a3bb045db60863a8c"/><file name="International.php" hash="c9c061f40810ea5a17833caa508336cd"/><file name="String.php" hash="13620129b7a2d8aa3dfaabaa8a17526e"/><dir name="Sales"><file name="Data.php" hash="6f7f15b86012d9e5e6b48cccdbbac7f1"/></dir></dir><dir name="Model"><dir name="Api"><dir name="External"><dir name="Sales"><file name="Order.php" hash="1655ba26a73b140e32433ad7ab69f9bd"/></dir></dir></dir><dir name="Carrier"><file name="Iparcel.php" hash="f604116aa5bc81dcd7ff2de9ad648fbf"/></dir><dir name="Config"><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="d136367488f51687b4a8f1205ed1db39"/><file name="Weekday.php" hash="cfb1d0a381d74207ca5f567bdb6a6ae0"/></dir><dir name="Time"><file name="Hour.php" hash="7ee959e67a3100d60aefd31d4b626bba"/><file name="Minute.php" hash="f8376b241ad8a8e6bf35c82d75109b71"/></dir></dir></dir><dir name="Cpf"><file name="Order.php" hash="51bf749b00a9b51e2f6f39a7e9734d86"/><file name="Quote.php" hash="6af90f0a33e0c02ba041bb6ff5882d7d"/></dir><file name="Cpf.php" hash="650bbe60bae37b3e43d8686378a2282b"/><file name="Observer.php" hash="cd565b3dc11533c598891631e4d266a0"/><file name="Parcel.php" hash="e9325c49bc67983c075b5bba76bc243a"/><dir name="Payment"><file name="Iparcel.php" hash="958572bf836c478161a371beb1c86139"/></dir><dir name="Resource"><dir name="Api"><file name="Order.php" hash="2daf80f9a3be2c687b1ae3d9561c4305"/></dir><dir name="Cpf"><file name="Collection.php" hash="ac85f294739a7a892f60a63ca9dc8217"/><file name="Order.php" hash="e8391efb37ceecba5c6c73a2ff474b91"/><file name="Quote.php" hash="0a4687a32ebc264888e2eb21e885d938"/><dir name="Order"><file name="Collection.php" hash="7f8406d9e4a901183b36c8d0e85c1b87"/></dir><dir name="Quote"><file name="Collection.php" hash="08f0e8427111a34878ed8b711f13b5cf"/></dir></dir><file name="Cpf.php" hash="8e459e3535510675d9d7a1867d244008"/><file name="Parcel.php" hash="389b267d69b196454fbc97e9287cbca5"/><file name="Setup.php" hash="4752a060c3cf972f30d503b3d7f7ce70"/><dir name="Parcel"><file name="Collection.php" hash="3009eb727415705ae5f83739c007804c"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Observer.php" hash="22e58f9e21b4ca3cd41f611bdd479a57"/></dir><dir name="Quote"><file name="Observer.php" hash="b9ac9f1f2323765b482dd4970ed2c7e8"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="e783073c99cc876c670d90655fb068c8"/></dir><file name="Attribute.php" hash="e3e9e3ab353ad864c40b1b7a682f169f"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="8f636058187564cb7d9c2b9a0a94b10b"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="484e68457cc656585665aca1300a4d4e"/></dir></dir></dir></dir></dir></dir><dir name="sql"><dir name="ipglobalecommerce_setup"><file name="mysql4-install-0.2.0.php" hash="a2d77ada0a1ed47fc9983cc3dfbb6c52"/><file name="mysql4-install-0.3.0.php" hash="a2d77ada0a1ed47fc9983cc3dfbb6c52"/><file name="mysql4-install-2.3.4.2.php" hash="deaea497fbb845739102375833116f90"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="d08b88d172a58246d27cfe8b1b25b353"/><file name="mysql4-upgrade-0.3.1-0.3.2.php" hash="55d56591823e441d4f5f8c34c4067922"/><file name="mysql4-upgrade-0.3.2-2.0.0.php" hash="d78bde958b23787eb243a2f0ab3814eb"/><file name="mysql4-upgrade-2.0.0-2.3.4.2.php" hash="caa9c9b26eb98a662e62d28adf1475f4"/><file name="mysql4-upgrade-2.4.0.3-2.4.1.0.php" hash="e67007d6ccc67dbcfb226c5601f8c8f0"/><file name="mysql4-upgrade-2.4.1.17-2.4.3.0.php" hash="aaca3b01138aedeaee8edc1cc231736f"/><file name="mysql4-upgrade-2.4.1.6-2.4.1.7.php" hash="fe16b8c574899d242e8b07889c823605"/><file name="mysql4-upgrade-2.4.6-2.4.7.php" hash="27d32d4c780813ef93de0b3512235af2"/></dir></dir></dir><dir name="All"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Mapping"><file name="Button.php" hash="dfdaf5a2fbf824a10fccc952fdccf567"/></dir></dir><dir name="Iparcel"><file name="Dashboard.php" hash="ec9dddd10368136f1bdfe79fddd4500c"/><file name="Logs.php" hash="5823bbc2a78666972dd02d5fd3e9d05d"/><dir name="Logs"><file name="Grid.php" hash="9c472c78640c8aecb5de4b638372e6f5"/></dir><dir name="Shipment"><dir name="Split"><file name="Form.php" hash="db44693b1eda47cb1d87b8a69ac9a5a0"/></dir><file name="Split.php" hash="4cb66f91987f842c699bd2d6c42f2249"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Method.php" hash="935a3d4adad09d6c049cd6bb4cefb8db"/></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="2969af5eed8a1179579fa182e20cd59e"/></dir><file name="Product.php" hash="71a865c01574fd10ee0ffa7475cee378"/></dir><dir name="Catalogsearch"><dir name="Advanced"><file name="Result.php" hash="ad5a157444b80a284e0f9e7a91187b55"/></dir><file name="Result.php" hash="33e4ab0994bde9ba5dd87ade63869bee"/></dir><dir name="Html"><dir name="Head"><file name="Iparcel.php" hash="dd1737d041e9357269fa35b27dbef0bd"/><file name="Jquery.php" hash="3fd23960111c32d5696cc3de63e41b6e"/><file name="Post.php" hash="793d578cf82fb3ba83e1edc87b79ff95"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Totals"><file name="Abstract.php" hash="71cdfdce9a538b2f78b83b7b5eac8b19"/><file name="Duty.php" hash="f8ae79b70c6b5ba41c7acac9be5d84c0"/><file name="Tax.php" hash="1cfee0fccb1feede23f3cdc22f57c903"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Iparcel"><file name="LogController.php" hash="94e2095979140ad6d7c149080be30d38"/><file name="ShipmentController.php" hash="a9b8896d816b7612e1dc0638a2f8b740"/><file name="SyncController.php" hash="9378f5db27d059bbb36ff1e71bd38d32"/><dir name="Shipment"><file name="SplitController.php" hash="6a294947cf9399e42e90c890a6da2caa"/></dir><dir name="Sync"><file name="AjaxController.php" hash="671afecdeaed8f4c80a85d78605cd6da"/></dir></dir></dir><file name="AjaxController.php" hash="f6b0573eefbb21d7ac863fd029783b3c"/><file name="InfoController.php" hash="6543b1e9803489e507d2470f8e3e408b"/><file name="InternationalController.php" hash="75fc93febe96e328d5927665c33d40d1"/></dir><dir name="etc"><file name="adminhtml.xml" hash="50bc0bee93b5612763321eae11cfdc51"/><file name="config.xml" hash="6f430fb7d7fc681166befb1327119d03"/><file name="system.xml" hash="9f7bf4587539cad7a1b36ac8a01a8b3f"/></dir><dir name="Helper"><file name="Api.php" hash="3eca6912a64291d429075786c9baa2d4"/><file name="Data.php" hash="2cfab466ee3907bb8fe9173b144aca59"/><file name="International.php" hash="7bba0cd23188eaa3f99ed3d32ffccd14"/></dir><dir name="Model"><dir name="Api"><file name="Quote.php" hash="2e938bda13d007e73f8c2238aff76fa1"/></dir><dir name="Carrier"><file name="Iparcel.php" hash="ad65fdc9f7f2264e9704b0f17d89dd34"/></dir><dir name="Catalog"><dir name="Product"><file name="Observer.php" hash="d16d89cea8eea6352a7d9b1193cd9512"/></dir></dir><dir name="Config"><dir name="Script"><file name="Js.php" hash="100822286c5326c82cbc5d4ff3cf4c39"/></dir></dir><file name="Cron.php" hash="670d37cd6cdbe60aa69fad8eb0a0759e"/><file name="Log.php" hash="8c87e5f356f8ca77a186430dda106097"/><file name="Observer.php" hash="ad3c34320671927263e673e18c798a34"/><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Duty.php" hash="33b91a5b8fa32293bfe0eab4460b04f9"/><file name="Tax.php" hash="7cd4046231eb8cb9031ae160720390da"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Duty.php" hash="5a4010994ea502afe88632ddd2699c63"/><file name="Tax.php" hash="c4c95aaaae9662860dd635238150aa46"/></dir></dir></dir><dir name="Payment"><file name="Iparcel.php" hash="30ad607409d5ed225e233638ecbff39c"/></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Abstract.php" hash="a3af320e934f50651e09bfd15b86ffea"/><file name="Collector.php" hash="f99413fe415c342d5c0d582caa767ad1"/><file name="Duty.php" hash="6ef16c8b2038d5c90b4b9c7d00825da2"/><file name="Tax.php" hash="e1d1391f6e17d97e0ca1eeeaa8c1959c"/></dir></dir></dir><dir name="Resource"><dir name="Api"><file name="Quote.php" hash="84d032b89c5df67ef24a112ad7846302"/></dir><dir name="Log"><file name="Collection.php" hash="7cb78be07207a599eff71c1e18ba0b7a"/></dir><file name="Log.php" hash="d14c2eb8314456a18adadbb52856e0b5"/><dir name="Mysql4"><file name="Setup.php" hash="9f9cf4b5934b70bd00b394beacb245f7"/></dir></dir><dir name="System"><dir name="Config"><dir name="Catalog"><file name="Mapping.php" hash="8895678aa59e49226509d2b4709c5f43"/></dir><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="baec5b8a27c5b037529ba935aae0370a"/><file name="Weekday.php" hash="173edc075325d932f8dad6d4674b8153"/></dir><dir name="Time"><file name="Hour.php" hash="ddad98b85290d9b13ec9f65fbe8a10b3"/><file name="Minute.php" hash="4a76af0057d60e8ff0ff7fedc1d50575"/></dir></dir><file name="Guid.php" hash="311c7f8072f02a6be9e25b6411298c5c"/><dir name="Script"><file name="Js.php" hash="3e3f23b38ecdc361bf6ff6cee1871e92"/></dir><dir name="Source"><dir name="Catalog"><dir name="Mapping"><dir name="Configurable"><file name="Price.php" hash="f9116fd446914467e7fb31bed5a6dd0b"/></dir><file name="Mode.php" hash="36140a050ea65ff23d45264fa67e1a2b"/></dir><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="ca1883122659f1b48890ecd46a1590ee"/></dir><file name="Attribute.php" hash="8ca9c929cda497400865751ffba991e6"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="143c26f9661e5dc995ff064e333a2018"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="f1e414c08c43ebb2fcc6ccf5b41a2ff2"/></dir></dir><dir name="Tax"><file name="Mode.php" hash="fb09f17b54ef8ffa22580741cc66ac14"/></dir></dir></dir></dir><dir name="Tax"><dir name="Quote"><file name="Shipping.php" hash="5d76b072c657035cf3d7713fa6672f1f"/><file name="Subtotal.php" hash="cbd2e41f3bdc74134590a675d93d4bfb"/><file name="Tax.php" hash="ffc8d78a8d0442690c49b60f909c8e48"/></dir></dir></dir><dir name="sql"><dir name="iparcel_setup"><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="4df6e3a3f2adf96eeb6ccdac213e3f1e"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="cfb9fbc137e7e551dfaece00ac6bb2f4"/><file name="mysql4-upgrade-1.1.1-1.2.0.php" hash="1f04c5c71a6a79aaf74810e87670d998"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="ipglobalecommerce"><file name="cpf.phtml" hash="6f7835f5df6f6baabaf6a136a372469a"/></dir><dir name="iparcel"><dir name="html"><dir name="head"><file name="iparcel.phtml" hash="07091c9914189cfef06af8cc6e41855c"/><file name="jquery.phtml" hash="c287cb0aa4ddd1f04f27cb5df605a27d"/><file name="post.phtml" hash="1a53e744668b250175ba275b4260050b"/><file name="iparcel.phtml" hash="07091c9914189cfef06af8cc6e41855c"/><file name="jquery.phtml" hash="c287cb0aa4ddd1f04f27cb5df605a27d"/><file name="post.phtml" hash="1a53e744668b250175ba275b4260050b"/></dir></dir><dir name="post"><file name="list.phtml" hash="20e5d7d7f82e1f8d951a1509921eb3bf"/><file name="list.phtml" hash="20e5d7d7f82e1f8d951a1509921eb3bf"/></dir><file name="post.phtml" hash="3827cab2dba981556aeb8ec915ab03cc"/></dir></dir><dir name="layout"><file name="externalshipping.xml" hash="3d6f4472442849cdb356ce9a8c33da65"/><file name="iparcel.xml" hash="55aec816cb242fe44aab3a2e0d9de0ba"/><file name="iparcel.xml" hash="55aec816cb242fe44aab3a2e0d9de0ba"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="externalsales.xml" hash="990ecce7258a8f6586d41efde1f29e13"/><file name="iparcel.xml" hash="7f877536f54051b41ccef5666a2f24cc"/></dir><dir name="template"><dir name="iparcel"><dir name="order"><dir name="totals"><file name="duty.phtml" hash="7af41c6d47dafeb890a520d8e6e39910"/><file name="tax.phtml" hash="25bffd2b58554cf28e5f4abe4b4e1e7c"/></dir></dir><dir name="sync"><dir name="ajax"><file name="catalog.phtml" hash="4959462a90a5c2b6c01ba722b73e8f58"/><file name="checkitems.phtml" hash="c19b0e4fd0feddedbc2cef3b2f4ce79b"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Iparcel_GlobaleCommerce.xml" hash="0dc1ebffdd8d16f0da230acdf7c76901"/><file name="Iparcel_All.xml" hash="89e4b47a6ac9aa0b82f70b1539d587ea"/></dir></dir><dir name="locale"><dir name="en_US"><file name="iparcel.csv" hash="cbcb75a490376ca0b63c8c66622c1656"/></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="39bf27f07ff782dcde65480d4ff04496"/><file name="label.js" hash="39bf27f07ff782dcde65480d4ff04496"/><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/><file name="sync.js" hash="bcfc390768020ce3e532f594c8f6df81"/><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/><file name="sync.js" hash="bcfc390768020ce3e532f594c8f6df81"/><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/><file name="sync.js" hash="bcfc390768020ce3e532f594c8f6df81"/><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/><file name="sync.js" hash="bcfc390768020ce3e532f594c8f6df81"/><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/><file name="sync.js" hash="bcfc390768020ce3e532f594c8f6df81"/></dir><file name="cpf.js" hash="92443ee9633827b535044aebbdaeef87"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="29d52bf315386c3c8a9b7a7d6e277dfc"/><file name="post.js" hash="c710697e3d4905a6a707222728485047"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="29d52bf315386c3c8a9b7a7d6e277dfc"/><file name="post.js" hash="c710697e3d4905a6a707222728485047"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="29d52bf315386c3c8a9b7a7d6e277dfc"/><file name="post.js" hash="c710697e3d4905a6a707222728485047"/></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iparcel"><dir name="font"><file name="code128.ttf" hash=""/></dir><file name="ajaxSync.css" hash="c622b9e4b77589bc0f3c0555124d2751"/></dir></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies>
24
  <required>