iparcel_connect - Version 3.0.0

Version Notes

Notes

Download this release

Release Info

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


Code changes from version 2.4.11 to 3.0.0

Files changed (166) hide show
  1. app/code/community/Iparcel/All/Block/Adminhtml/Catalog/Mapping/Button.php +31 -0
  2. app/code/community/Iparcel/{Shipping → All}/Block/Adminhtml/Iparcel/Dashboard.php +4 -7
  3. app/code/community/Iparcel/{Shipping/Block/Adminhtml → All/Block/Adminhtml/Iparcel}/Logs.php +6 -7
  4. app/code/community/Iparcel/{Shipping/Block/Adminhtml → All/Block/Adminhtml/Iparcel}/Logs/Grid.php +5 -5
  5. app/code/community/Iparcel/All/Helper/Api.php +411 -0
  6. app/code/community/Iparcel/All/Helper/Data.php +30 -0
  7. app/code/community/Iparcel/{Shipping → All}/Model/Catalog/Product/Observer.php +7 -7
  8. app/code/community/Iparcel/All/Model/Cron.php +24 -0
  9. app/code/community/Iparcel/{Shipping/Model/Api → All/Model}/Log.php +23 -34
  10. app/code/community/Iparcel/{Shipping/Model → All/Model/System}/Config/Catalog/Mapping.php +7 -6
  11. app/code/community/Iparcel/All/Model/System/Config/Data/Date/Monthday.php +23 -0
  12. app/code/community/Iparcel/All/Model/System/Config/Data/Date/Weekday.php +23 -0
  13. app/code/community/Iparcel/All/Model/System/Config/Data/Time/Hour.php +23 -0
  14. app/code/community/Iparcel/All/Model/System/Config/Data/Time/Minute.php +23 -0
  15. app/code/community/Iparcel/{Shipping/Model → All/Model/System}/Config/Guid.php +5 -5
  16. app/code/community/Iparcel/{Shipping/Model → All/Model/System}/Config/Script/Js.php +3 -3
  17. app/code/community/Iparcel/{Shipping → All}/Model/System/Config/Source/Catalog/Mapping/Configurable/Price.php +5 -5
  18. app/code/community/Iparcel/{Shipping → All}/Model/System/Config/Source/Catalog/Mapping/Mode.php +6 -6
  19. app/code/community/Iparcel/All/Model/System/Config/Source/Catalog/Product/Attribute.php +31 -0
  20. app/code/community/Iparcel/All/Model/System/Config/Source/Catalog/Product/Attribute/Boolean.php +33 -0
  21. app/code/community/Iparcel/{Shipping → All}/Model/System/Config/Source/Date/Weekday.php +4 -4
  22. app/code/community/Iparcel/{Shipping → All}/Model/System/Config/Source/Sales/Order/Status.php +6 -6
  23. app/code/community/Iparcel/{Shipping → All}/Model/System/Config/Source/Tax/Mode.php +6 -6
  24. app/code/community/Iparcel/{Shipping/controllers/Adminhtml/Shippingip → All/controllers/Adminhtml/Iparcel}/LogController.php +7 -8
  25. app/code/community/Iparcel/{Shipping/controllers/Adminhtml/Shippingip → All/controllers/Adminhtml/Iparcel}/Sync/AjaxController.php +11 -11
  26. app/code/community/Iparcel/{Shipping/controllers/Adminhtml/Shippingip → All/controllers/Adminhtml/Iparcel}/SyncController.php +4 -4
  27. app/code/community/Iparcel/All/controllers/InfoController.php +48 -0
  28. app/code/community/Iparcel/All/etc/adminhtml.xml +32 -0
  29. app/code/community/Iparcel/All/etc/config.xml +131 -0
  30. app/code/community/Iparcel/All/etc/system.xml +289 -0
  31. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Catalog/Product.php +5 -5
  32. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Catalog/Product/List.php +5 -5
  33. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Catalogsearch/Advanced/Result.php +3 -3
  34. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Catalogsearch/Result.php +3 -3
  35. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Cpf.php +4 -4
  36. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Html/Head/Iparcel.php +4 -4
  37. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Html/Head/Jquery.php +4 -4
  38. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Html/Head/Post.php +5 -5
  39. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Payment/Info.php +4 -4
  40. app/code/community/Iparcel/GlobaleCommerce/Helper/Api.php +66 -0
  41. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Helper/Api/External.php +3 -3
  42. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Helper/Data.php +5 -5
  43. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Helper/International.php +3 -3
  44. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Helper/Sales/Data.php +3 -3
  45. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Helper/String.php +4 -4
  46. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Api/External/Sales/Order.php +93 -18
  47. app/code/community/Iparcel/GlobaleCommerce/Model/Carrier/Iparcel.php +111 -0
  48. app/code/community/Iparcel/GlobaleCommerce/Model/Config/Data/Date/Monthday.php +23 -0
  49. app/code/community/Iparcel/GlobaleCommerce/Model/Config/Data/Date/Weekday.php +23 -0
  50. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Config/Data/Time/Hour.php +4 -4
  51. app/code/community/Iparcel/GlobaleCommerce/Model/Config/Data/Time/Minute.php +23 -0
  52. app/code/community/Iparcel/GlobaleCommerce/Model/Config/Script/Js.php +94 -0
  53. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Cpf.php +5 -5
  54. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Cpf/Order.php +5 -5
  55. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Cpf/Quote.php +5 -5
  56. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Observer.php +6 -7
  57. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Parcel.php +5 -5
  58. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Payment/Iparcel.php +4 -4
  59. app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Api/Order.php +18 -0
  60. app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf.php +18 -0
  61. app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf/Collection.php +18 -0
  62. app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf/Order.php +18 -0
  63. app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf/Order/Collection.php +18 -0
  64. app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf/Quote.php +18 -0
  65. app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf/Quote/Collection.php +18 -0
  66. app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Parcel.php +18 -0
  67. app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Parcel/Collection.php +18 -0
  68. app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Setup.php +11 -0
  69. app/code/community/Iparcel/GlobaleCommerce/Model/Sales/Order/Observer.php +161 -0
  70. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Sales/Quote/Observer.php +7 -7
  71. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/System/Config/Source/Catalog/Product/Attribute.php +3 -3
  72. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/System/Config/Source/Catalog/Product/Attribute/Boolean.php +3 -3
  73. app/code/community/Iparcel/GlobaleCommerce/Model/System/Config/Source/Date/Weekday.php +30 -0
  74. app/code/community/Iparcel/GlobaleCommerce/Model/System/Config/Source/Sales/Order/Status.php +24 -0
  75. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/controllers/AjaxController.php +4 -6
  76. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/controllers/DevController.php +4 -13
  77. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/controllers/InternationalController.php +8 -8
  78. app/code/community/Iparcel/{Shipping → GlobaleCommerce}/controllers/OrderController.php +17 -15
  79. app/code/community/Iparcel/GlobaleCommerce/etc/adminhtml.xml +14 -0
  80. app/code/community/Iparcel/GlobaleCommerce/etc/config.xml +284 -0
  81. app/code/community/Iparcel/GlobaleCommerce/etc/system.xml +148 -0
  82. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-install-0.2.0.php +5 -5
  83. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-install-0.3.0.php +5 -5
  84. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-install-2.3.4.2.php +12 -40
  85. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-0.2.0-0.3.0.php +6 -6
  86. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-0.3.1-0.3.2.php +5 -5
  87. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-0.3.2-2.0.0.php +9 -9
  88. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-2.0.0-2.3.4.2.php +3 -3
  89. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-2.4.0.3-2.4.1.0.php +5 -5
  90. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-2.4.1.17-2.4.3.0.php +1 -1
  91. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-2.4.1.6-2.4.1.7.php +7 -7
  92. app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-2.4.6-2.4.7.php +3 -3
  93. app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Checkitems/Button.php +0 -31
  94. app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Mapping/Button.php +0 -31
  95. app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php +0 -24
  96. app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Invoice/Totals.php +0 -24
  97. app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Form.php +0 -24
  98. app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Tracking.php +0 -24
  99. app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Totals.php +0 -25
  100. app/code/community/Iparcel/Shipping/Block/Adminhtml/Salesrule/Rule/Sync.php +0 -31
  101. app/code/community/Iparcel/Shipping/Block/Adminhtml/System/Config/Form/Field/Method.php +0 -20
  102. app/code/community/Iparcel/Shipping/Block/Sales/Order/Creditmemo/Totals.php +0 -24
  103. app/code/community/Iparcel/Shipping/Block/Sales/Order/Invoice/Totals.php +0 -23
  104. app/code/community/Iparcel/Shipping/Block/Sales/Order/Totals.php +0 -24
  105. app/code/community/Iparcel/Shipping/Block/Tax/Checkout/Tax.php +0 -24
  106. app/code/community/Iparcel/Shipping/Helper/Api.php +0 -818
  107. app/code/community/Iparcel/Shipping/Helper/Tax.php +0 -48
  108. app/code/community/Iparcel/Shipping/Model/Carrier/Iparcel.php +0 -227
  109. app/code/community/Iparcel/Shipping/Model/Catalog/Mapping.php +0 -19
  110. app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Monthday.php +0 -23
  111. app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Weekday.php +0 -23
  112. app/code/community/Iparcel/Shipping/Model/Config/Data/Time/Minute.php +0 -23
  113. app/code/community/Iparcel/Shipping/Model/Resource/Api/Order.php +0 -18
  114. app/code/community/Iparcel/Shipping/Model/Resource/Cpf.php +0 -18
  115. app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Collection.php +0 -18
  116. app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order.php +0 -18
  117. app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order/Collection.php +0 -18
  118. app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote.php +0 -18
  119. app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote/Collection.php +0 -18
  120. app/code/community/Iparcel/Shipping/Model/Resource/Parcel.php +0 -18
  121. app/code/community/Iparcel/Shipping/Model/Resource/Parcel/Collection.php +0 -18
  122. app/code/community/Iparcel/Shipping/Model/Resource/Setup.php +0 -11
  123. app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals.php +0 -18
  124. app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals/Collection.php +0 -18
  125. app/code/community/Iparcel/Shipping/Model/Sales/Order/Observer.php +0 -267
  126. app/code/community/Iparcel/Shipping/Model/Sales/Order/Shipment/Observer.php +0 -81
  127. app/code/community/Iparcel/Shipping/Model/Tax/Calculation.php +0 -64
  128. app/code/community/Iparcel/Shipping/Model/Tax/Totals.php +0 -32
  129. app/code/community/Iparcel/Shipping/Model/Tax/Totals/Abstract.php +0 -124
  130. app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Creditmemo.php +0 -28
  131. app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Invoice.php +0 -28
  132. app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Quote.php +0 -64
  133. app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Creditmemo.php +0 -28
  134. app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Invoice.php +0 -28
  135. app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Quote.php +0 -64
  136. app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Creditmemo.php +0 -28
  137. app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Invoice.php +0 -28
  138. app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Quote.php +0 -66
  139. app/code/community/Iparcel/Shipping/etc/adminhtml.xml +0 -46
  140. app/code/community/Iparcel/Shipping/etc/config.xml +0 -463
  141. app/code/community/Iparcel/Shipping/etc/system.xml +0 -616
  142. app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.0-0.3.1.php +0 -31
  143. app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.2-2.3.4.4.php +0 -7
  144. app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.3-2.3.4.4.php +0 -7
  145. app/design/adminhtml/default/default/layout/externalsales.xml +5 -36
  146. app/design/adminhtml/default/default/layout/iparcel.xml +33 -0
  147. app/design/adminhtml/default/default/template/iparcel/sales/order/shipment/view/tracking.phtml +0 -41
  148. app/design/adminhtml/default/default/template/iparcel/sync/ajax/catalog.phtml +4 -4
  149. app/design/adminhtml/default/default/template/iparcel/sync/ajax/checkitems.phtml +4 -4
  150. app/design/frontend/base/default/layout/externalshipping.xml +37 -37
  151. app/design/frontend/base/default/template/ipglobalecommerce/cpf.phtml +11 -0
  152. app/design/frontend/base/default/template/ipglobalecommerce/html/head/iparcel.phtml +14 -0
  153. app/design/frontend/base/default/template/{shippingip → ipglobalecommerce}/html/head/jquery.phtml +4 -4
  154. app/design/frontend/base/default/template/{shippingip → ipglobalecommerce}/html/head/post.phtml +5 -4
  155. app/design/frontend/base/default/template/ipglobalecommerce/post.phtml +11 -0
  156. app/design/frontend/base/default/template/ipglobalecommerce/post/list.phtml +24 -0
  157. app/design/frontend/base/default/template/shippingip/cpf.phtml +0 -11
  158. app/design/frontend/base/default/template/shippingip/html/head/iparcel.phtml +0 -14
  159. app/design/frontend/base/default/template/shippingip/post.phtml +0 -11
  160. app/design/frontend/base/default/template/shippingip/post/list.phtml +0 -24
  161. app/etc/modules/Iparcel_All.xml +9 -0
  162. app/etc/modules/{Iparcel_Shipping.xml → Iparcel_GlobaleCommerce.xml} +2 -2
  163. js/iparcel/adminhtml/sync.js +7 -0
  164. js/iparcel/post.js +2 -2
  165. package.xml +4 -4
  166. skin/adminhtml/default/default/iparcel/font/code128.ttf +0 -0
app/code/community/Iparcel/All/Block/Adminhtml/Catalog/Mapping/Button.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Frontend Model Class for catalog_mapping/upload/upload config button
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Block_Adminhtml_Catalog_Mapping_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
10
+ {
11
+
12
+ /**
13
+ * Get Button Html
14
+ *
15
+ * @param Varien_Data_Form_Element_Abstract $element
16
+ * @return string
17
+ */
18
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
+ {
20
+ $url = Mage::helper('adminhtml')->getUrl("adminhtml/iparcel_sync_ajax/catalog");
21
+
22
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
23
+ ->setType('button')
24
+ ->setClass('scalable')
25
+ ->setLabel('Upload Now')
26
+ ->setOnClick("window.location.href='" . $url . "'")
27
+ ->toHtml();
28
+
29
+ return $html;
30
+ }
31
+ }
app/code/community/Iparcel/{Shipping → All}/Block/Adminhtml/Iparcel/Dashboard.php RENAMED
@@ -2,13 +2,12 @@
2
  /**
3
  * Frontend Model Class for carriers/i-parcel/additionalfields config button
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Block_Adminhtml_Iparcel_Dashboard extends Mage_Adminhtml_Block_System_Config_Form_Field
10
  {
11
-
12
  /**
13
  * Get Button Html
14
  *
@@ -18,14 +17,12 @@ class Iparcel_Shipping_Block_Adminhtml_Iparcel_Dashboard extends Mage_Adminhtml_
18
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
  {
20
  $url = 'http://globalaccess.i-parcel.com';
21
-
22
  $html = $this->getLayout()->createBlock('adminhtml/widget_button')
23
  ->setType('button')
24
  ->setClass('scalable')
25
  ->setLabel('Go to i-parcel Dashboard')
26
  ->setOnClick("window.location.href='" . $url . "'")
27
  ->toHtml();
28
-
29
  return $html;
30
  }
31
  }
2
  /**
3
  * Frontend Model Class for carriers/i-parcel/additionalfields config button
4
  *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Block_Adminhtml_Iparcel_Dashboard extends Mage_Adminhtml_Block_System_Config_Form_Field
10
  {
 
11
  /**
12
  * Get Button Html
13
  *
17
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
18
  {
19
  $url = 'http://globalaccess.i-parcel.com';
 
20
  $html = $this->getLayout()->createBlock('adminhtml/widget_button')
21
  ->setType('button')
22
  ->setClass('scalable')
23
  ->setLabel('Go to i-parcel Dashboard')
24
  ->setOnClick("window.location.href='" . $url . "'")
25
  ->toHtml();
 
26
  return $html;
27
  }
28
  }
app/code/community/Iparcel/{Shipping/Block/Adminhtml → All/Block/Adminhtml/Iparcel}/Logs.php RENAMED
@@ -6,24 +6,23 @@
6
  * @package Iparcel_Shipping
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Block_Adminhtml_Logs extends Mage_Adminhtml_Block_Widget_Grid_Container
10
  {
11
  /**
12
  * Initialize factory instance
13
  */
14
  public function __construct()
15
  {
16
- $this->_blockGroup = 'shippingip';
17
- $this->_controller = 'adminhtml_logs';
18
- $this->_headerText = $this->__('Logs');
19
-
20
  parent::__construct();
21
  }
22
 
23
  /**
24
- * Preparing child blocks for each added button ,removing add button, adding clear button
25
  *
26
- * @return Iparcel_Shipping_Block_Adminhtml_Logs
27
  */
28
  protected function _prepareLayout()
29
  {
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
  {
11
  /**
12
  * Initialize factory instance
13
  */
14
  public function __construct()
15
  {
16
+ $this->_blockGroup = 'iparcel';
17
+ $this->_controller = 'adminhtml_iparcel_logs';
18
+ $this->_headerText = $this->__('i-parcel Logs');
 
19
  parent::__construct();
20
  }
21
 
22
  /**
23
+ * Preparing child blocks for each added button, removing add button, adding clear button
24
  *
25
+ * @return Iparcel_All_Block_Adminhtml_Logs
26
  */
27
  protected function _prepareLayout()
28
  {
app/code/community/Iparcel/{Shipping/Block/Adminhtml → All/Block/Adminhtml/Iparcel}/Logs/Grid.php RENAMED
@@ -3,10 +3,10 @@
3
  * Iparcel Logs Adminhtml Grid Block
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Block_Adminhtml_Logs_Grid extends Mage_Adminhtml_Block_Widget_Grid
10
  {
11
  /**
12
  * Internal constructor, that is called from real constructor
@@ -21,11 +21,11 @@ class Iparcel_Shipping_Block_Adminhtml_Logs_Grid extends Mage_Adminhtml_Block_Wi
21
  /**
22
  * Prepare grid collection object
23
  *
24
- * @return Iparcel_Shipping_Block_Adminhtml_Logs_Grid
25
  */
26
  protected function _prepareCollection()
27
  {
28
- $collection = Mage::getModel('shippingip/api_log')->getJson();
29
  $this->setCollection($collection);
30
 
31
  return parent::_prepareCollection();
@@ -34,7 +34,7 @@ class Iparcel_Shipping_Block_Adminhtml_Logs_Grid extends Mage_Adminhtml_Block_Wi
34
  /**
35
  * Prepare grid columns
36
  *
37
- * @return Iparcel_Shipping_Block_Adminhtml_Logs_Grid
38
  */
39
  protected function _prepareColumns()
40
  {
3
  * Iparcel Logs Adminhtml Grid 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_Grid extends Mage_Adminhtml_Block_Widget_Grid
10
  {
11
  /**
12
  * Internal constructor, that is called from real constructor
21
  /**
22
  * Prepare grid collection object
23
  *
24
+ * @return Iparcel_All_Block_Adminhtml_Logs_Grid
25
  */
26
  protected function _prepareCollection()
27
  {
28
+ $collection = Mage::getModel('iparcel/log')->getJson();
29
  $this->setCollection($collection);
30
 
31
  return parent::_prepareCollection();
34
  /**
35
  * Prepare grid columns
36
  *
37
+ * @return Iparcel_All_Block_Adminhtml_Logs_Grid
38
  */
39
  protected function _prepareColumns()
40
  {
app/code/community/Iparcel/All/Helper/Api.php ADDED
@@ -0,0 +1,411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * I-parcel shared API helper
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @authoer Bobby Burden <bburden@i-parcel.com>
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
+ *
17
+ * @param string $post POST Data to send
18
+ * @param string $url REST API URL to send POST data to
19
+ * @param array $header Array of headers to attach to the request
20
+ * @return string Response from the POST request
21
+ */
22
+ protected function _rest($post, $url, array $header)
23
+ {
24
+ $curl = curl_init($url);
25
+
26
+ $timeout = 15;
27
+ if ($timeout) {
28
+ curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
29
+ }
30
+
31
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
32
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
33
+ curl_setopt($curl, CURLOPT_POST, true);
34
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
35
+ curl_setopt($curl, CURLOPT_POSTFIELDS, "$post");
36
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
37
+
38
+ $response = curl_exec($curl);
39
+
40
+ curl_close($curl);
41
+
42
+ return $response;
43
+ }
44
+
45
+ /**
46
+ * Send REST XML requests
47
+ *
48
+ * Wrapper for _rest() that sends a SimpleXMLElement object to the API.
49
+ *
50
+ * @param SimpleXMLElement $xml XML to send
51
+ * @param string $url REST API URL to send POST data to
52
+ * @return string Response from the POST request
53
+ */
54
+ protected function _restXML($xml, $url)
55
+ {
56
+ return $this->_rest($xml->asXml, $url, array('Content-Type: text/xml'));
57
+ }
58
+
59
+ /**
60
+ * Send REST JSON requests
61
+ *
62
+ * Wrapper for _rest() that sends the passed data as JSON to the API.
63
+ *
64
+ * @param string $json Data to be JSON encoded and sent to the API
65
+ * @param string $url REST API URL to send POST data to
66
+ * @return string Response from the POST request
67
+ */
68
+ protected function _restJSON($json, $url)
69
+ {
70
+ return $this->_rest(
71
+ json_encode($json),
72
+ $url,
73
+ array('Content-Type: text/json')
74
+ );
75
+ }
76
+
77
+ /**
78
+ * Send SubmitCatalog request
79
+ *
80
+ * Takes the passed Product Collection and transforms it into data that can
81
+ * be passed to the API. It then submits the request as JSON to the
82
+ * SubmitCatalog API endpoint.
83
+ *
84
+ * @param Varien_Data_Collection $productCollection A Magento Product collection
85
+ * @return int The amount of products uploaded to the API
86
+ */
87
+ public function submitCatalog(Varien_Data_Collection $productCollection)
88
+ {
89
+ // init log
90
+ /** @var Iparcel_All_Model_Log $log */
91
+ $log = Mage::getModel('iparcel/log');
92
+ $log->setController('Submit Catalog');
93
+
94
+ $items = $this->prepareProductsForSubmitCatalog($productCollection);
95
+
96
+ $log->setRequest(json_encode($items));
97
+
98
+ $numberToUpload = count($items['SKUs']);
99
+
100
+ if ($numberToUpload > 0) {
101
+ $response = $this->_restJSON($items, $this->_submitCatalog);
102
+
103
+ $log->setResponse($response);
104
+ $log->save();
105
+
106
+ if (!preg_match('/.*Success.*/', $response)) {
107
+ $numberToUpload = -1;
108
+ }
109
+ }
110
+
111
+ return $numberToUpload;
112
+ }
113
+
114
+ /**
115
+ * Prepare product collection for SubmitCatalog calls
116
+ *
117
+ * This function takes a Magento product collection and extracts the
118
+ * necessary information to send it to the SubmitCatalog API endpoint.
119
+ *
120
+ * @param Varien_Data_Collection $products Products to prepare
121
+ * @return array Prepared array of products and product information
122
+ */
123
+ public function prepareProductsForSubmitCatalog(Varien_Data_Collection $products)
124
+ {
125
+ /** @var Mage_Eav_Model_Entity_Attribute $hsCode */
126
+ $hsCode = Mage::getModel('eav/entity_attribute')->load(Mage::getStoreConfig('catalog_mapping/attributes/hscodeus'));
127
+ /** @var Mage_Eav_Model_Entity_Attribute $shipAlone */
128
+ $shipAlone = Mage::getModel('eav/entity_attribute')->load(Mage::getStoreConfig('catalog_mapping/attributes/shipalone'));
129
+
130
+ $items = array();
131
+ $items['key'] = Mage::helper('iparcel')->getGuid();
132
+
133
+ $skus = $items['SKUs'] = array();
134
+
135
+ foreach ($products as $product) {
136
+ /** @var Mage_Catalog_Model_Product $product */
137
+ $product = Mage::getModel('catalog/product')->load($product->getId());
138
+
139
+ $sku = $product->getSku() ?: '';
140
+ $name = $product->getName() ?: '';
141
+ if (empty($sku) || empty($name)) {
142
+ continue;
143
+ }
144
+
145
+ $item = array();
146
+
147
+ $item['SKU'] = $sku;
148
+ $item['ProductName'] = $name;
149
+
150
+ for ($i = 1; $i <= 6; $i++) {
151
+ $_attribute = Mage::getModel('eav/entity_attribute')
152
+ ->load(Mage::getStoreConfig(sprintf('catalog_mapping/attributes/attribute%d', $i)));
153
+
154
+ // if attribute exists
155
+ $productAttribute = null;
156
+ if ($_attribute !== null) {
157
+ // and has attribute_code
158
+ if ($code = $_attribute->getAttributeCode()) {
159
+ // then productAttribute value is product's attribute_text (if exists) or product's data (if not)
160
+ $productAttribute = strip_tags($product->getAttributeText($code) ?: $product->getData($code));
161
+ }
162
+ }
163
+ $item["Attribute$i"] = (string)substr($productAttribute, 0, 255);
164
+ }
165
+
166
+ $price = null;
167
+ // if it's simple product and config is to get parent's price
168
+ if ($product->getTypeId() == 'simple' && Mage::getStoreConfig('catalog_mapping/attributes/price') == Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Configurable_Price::CONFIGURABLE) {
169
+ // get parentIds
170
+ $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId()) ?: Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
171
+ // get price
172
+ $price = $parentIds ? Mage::getModel('catalog/product')->load($parentIds[0])->getPrice() : $product->getPrice();
173
+ }
174
+ // if there's no price
175
+ if (!$price) {
176
+ //get current product's price
177
+ $price = $product->getPrice();
178
+ }
179
+
180
+ $item['CountryOfOrigin'] = (string)$product->getCountryOfManufacture();
181
+ $item['CurrentPrice'] = (float)$price;
182
+ $item['Delete'] = $product->getIsDeleted() ? true : false;
183
+ $item['HSCodeCA'] = '';
184
+
185
+ if ($code = $hsCode->getAttributeCode()) {
186
+ $item['HSCodeUS'] = trim($product->getAttributeText($code)) ?: $product->getData($code);
187
+ } else {
188
+ $item['HSCodeUS'] = '';
189
+ }
190
+
191
+ $item['Height'] = (float)$product->getHeight();
192
+ $item['Length'] = (float)$product->getLength();
193
+ $item['ProductURL'] = $product->getUrlPath();
194
+ $item['SKN'] = '';
195
+ if ($code = $shipAlone->getAttributeCode()) {
196
+ $item['ShipAlone'] = $product->getAttributeText($code) == 'Yes' ? true : false;
197
+ }
198
+ $item['Width'] = (float)$product->getWidth();
199
+ $item['Weight'] = (float)$product->getWeight();
200
+
201
+ // Detect and handle a Simple Product with Custom Options
202
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $product->getHasOptions()) {
203
+ // loop through each of the sorted products with custom options
204
+ // and build out custom option and option type based skus
205
+ foreach ($this->_findSimpleProductVariants($product) as $customOptionProduct) {
206
+ $customOptionSku = "";
207
+ $customOptionPriceMarkup = 0;
208
+ $customOptionName = "";
209
+ foreach ($customOptionProduct as $o) {
210
+ $customOptionSku .= "_" . $o["sku"];
211
+ $customOptionPriceMarkup += $o["price"];
212
+ $customOptionName .= " - " . $o["title"];
213
+ }
214
+ if ($customOptionSku != '') {
215
+ $item['SKU'] = $sku . "_" . $customOptionSku;
216
+ } else {
217
+ $item['SKU'] = $sku;
218
+ }
219
+ $item['CurrentPrice'] = (float)( $price + $customOptionPriceMarkup );
220
+ //append the product name with the custom option
221
+ $item['ProductName'] = $name . $customOptionName;
222
+ $items['SKUs'][] = $item;
223
+ }
224
+ } else {
225
+ $items['SKUs'][] = $item;
226
+ }
227
+
228
+ }
229
+
230
+ return $items;
231
+ }
232
+
233
+ /**
234
+ * Performs the work of handling Simple Products with Custom Options
235
+ *
236
+ * @param Mage_Catalog_Model_Product $product Product with Options
237
+ * @return array Options array with all product variations
238
+ */
239
+ private function _findSimpleProductVariants($product)
240
+ {
241
+ // get product options collection object
242
+ $options = Mage::getModel('catalog/product_option')
243
+ ->getCollection()
244
+ ->addProductToFilter($product->getId())
245
+ ->addPriceToResult(0)
246
+ ->addValuesToResult();
247
+
248
+ // array indeces for products and product options
249
+ $optCount = 0;
250
+ $optTypeCount = 0;
251
+
252
+ // arrays for sorted products, sorting key/value lookups
253
+ $sorted = array();
254
+ $productOptions = array();
255
+ $productSorting = array();
256
+
257
+ foreach ($options as $option) {
258
+ // array for products custom options
259
+ $customOptions = array();
260
+ $optSortOrder = $option["sort_order"];
261
+ $optSortKey = 0;
262
+ /**
263
+ * If this option has no values (text field, text area, etc.) just
264
+ * build a sku for the option ID, otherwise, build out each value as
265
+ * well.
266
+ */
267
+ if (count($option->getValues()) == 0) {
268
+ $productOption = $product->getOptions();
269
+ $productOption = $productOption[$option->getId()];
270
+ $customOption = array();
271
+ $customOption["sku"] = $option->getId();
272
+ $customOption["price"] = $option->getPrice();
273
+ $customOption["title"] = $productOption->getTitle();;
274
+ $customOption["sort_order"] = $option->getSortOrder();
275
+ if (get_class($option) == 'MageWorx_CustomOptions_Model_Catalog_Product_Option') {
276
+ $customOption['required'] = $option->getIsRequire(true);
277
+ } else {
278
+ $customOption['required'] = $option->getIsRequire();
279
+ }
280
+ $customOptions[$optTypeCount] = $customOption;
281
+ $optTypeCount++;
282
+ } else {
283
+ foreach ($option->getValues() as $values) {
284
+ $customOption = array();
285
+ // create the sku portion with custom option id and option type id.. 1_2 -> Size_Large
286
+ $customOption["sku"] = $values["option_id"] . "-" . $values["option_type_id"];
287
+ $customOption["price"] = $values["price"];
288
+ $customOption["title"] = $values["title"];
289
+ $customOption["sort_order"] = $values["sort_order"];
290
+ /**
291
+ * Add `required` bit. Used later to build SKU variations.
292
+ * If this store uses Mageworx_CustomOptions, act as if we are
293
+ * on a product page
294
+ */
295
+ if (get_class($option) == 'MageWorx_CustomOptions_Model_Catalog_Product_Option') {
296
+ $customOption['required'] = $option->getIsRequire(true);
297
+ } else {
298
+ $customOption['required'] = $option->getIsRequire();
299
+ }
300
+ // add custom option type to collection
301
+ $customOptions[$optTypeCount] = $customOption;
302
+ $optTypeCount++;
303
+ }
304
+ }
305
+ // maintain index to sort order relationship
306
+ $productSorting[$optCount] = $optSortOrder;
307
+ // add custom option type collection to options collections
308
+ $customOptionProducts[$optCount] = $customOptions;
309
+ $optCount++;
310
+ }
311
+ // sort by array sort_order value while maintaining array index
312
+ asort($productSorting);
313
+ $sortCount = 0;
314
+
315
+ // iterate sorted indeces and build sorted array of products
316
+ foreach ($productSorting as $k => $v) {
317
+ $sorted[$sortCount] = $customOptionProducts[$k];
318
+ $sortCount++;
319
+ }
320
+
321
+ return $this->_findVariations($sorted);
322
+ }
323
+
324
+ /**
325
+ * Given an array of options, returns all of the valid option variations
326
+ *
327
+ * @param array $options Array of option arrays (sku, price, title, sort_order, required)
328
+ * @return array Array of arrays, representing the possible option variations
329
+ */
330
+ private function _findVariations($options)
331
+ {
332
+ // filter out empty values
333
+ $options = array_filter($options);
334
+ $result = array(array());
335
+ $optionalProductOptions = array();
336
+ $requiredOptions = true;
337
+
338
+ // Remove the optional product options
339
+ foreach ($options as $key => $option) {
340
+ foreach ($option as $product) {
341
+ if ($product['required'] == false) {
342
+ $optionalProductOptions[$key][$product['sku']] = $product;
343
+ unset($options[$key]);
344
+ }
345
+ }
346
+ }
347
+
348
+ // Add all variations of the required options to the $result array
349
+ foreach ($options as $key => $values) {
350
+ $append = array();
351
+ foreach ($result as $product) {
352
+ foreach ($values as $item) {
353
+ $product[$key] = $item;
354
+ $append[] = $product;
355
+ }
356
+ }
357
+ $result = $append;
358
+ }
359
+
360
+ // Check for any required options
361
+ if (count($result[0]) != 0 || count($result) == 1) {
362
+ $requiredOptions = false;
363
+ }
364
+
365
+ // Add a new product to the $result array for each variation of optional
366
+ // product options + the existing required options.
367
+ foreach ($result as $productConfiguration) {
368
+ foreach ($optionalProductOptions as $option) {
369
+ foreach ($option as $product) {
370
+ $newVariation = $productConfiguration;
371
+ $newVariation[] = $product;
372
+ $result[] = $newVariation;
373
+ }
374
+ }
375
+ }
376
+
377
+ // If there were no required options, add all variations of optional
378
+ // product options
379
+ if ($requiredOptions == false && count($optionalProductOptions) > 1) {
380
+ $allOptionals = array();
381
+ foreach ($optionalProductOptions as $key => $option) {
382
+ $allOptionals[] = array_shift($option);
383
+ }
384
+ $result[] = $allOptionals;
385
+ }
386
+
387
+ return $result;
388
+ }
389
+
390
+ /**
391
+ * Set the URLs for API Calls.
392
+ *
393
+ * Useful for setting the API endpoint URLs to controlled URLs for testing.
394
+ *
395
+ * @param array $urls Array of URLs to set as [var_name] => 'value'
396
+ * @return boolean True on success
397
+ */
398
+ public function setUrls($urls)
399
+ {
400
+ try {
401
+ foreach ($urls as $name => $url) {
402
+ $this->{$name} = $url;
403
+ }
404
+ } catch (Exception $e) {
405
+ Mage::log($e->getMessage());
406
+ return false;
407
+ }
408
+
409
+ return true;
410
+ }
411
+ }
app/code/community/Iparcel/All/Helper/Data.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * General Helper for Iparcel_All
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Helper_Data extends Mage_Core_Helper_Abstract
10
+ {
11
+ /**
12
+ * Get GUID key
13
+ *
14
+ * @return string
15
+ */
16
+ public function getGuid()
17
+ {
18
+ return Mage::getStoreConfig('iparcel/config/userid');
19
+ }
20
+
21
+ /**
22
+ * Get Customer ID
23
+ *
24
+ * @return string
25
+ */
26
+ public function getCustomerId()
27
+ {
28
+ return Mage::getStoreConfig('iparcel/config/custid');
29
+ }
30
+ }
app/code/community/Iparcel/{Shipping → All}/Model/Catalog/Product/Observer.php RENAMED
@@ -3,10 +3,10 @@
3
  * Catalog_Product observer class
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Catalog_Product_Observer
10
  {
11
  /**
12
  * Checking if catalog upload on product save is enabled
@@ -15,7 +15,7 @@ class Iparcel_Shipping_Model_Catalog_Product_Observer
15
  */
16
  protected function _isEnabled()
17
  {
18
- return Mage::getStoreConfig('catalog_mapping/config/auto_upload') == Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode::ON_UPDATE;
19
  }
20
 
21
  /**
@@ -27,7 +27,7 @@ class Iparcel_Shipping_Model_Catalog_Product_Observer
27
  $product = $observer->getProduct();
28
  $productCollection = new Varien_Data_Collection();
29
  $productCollection->addItem($product);
30
- Mage::helper('shippingip/api')->submitCatalog($productCollection);
31
  }
32
  }
33
 
@@ -47,7 +47,7 @@ class Iparcel_Shipping_Model_Catalog_Product_Observer
47
  }
48
  $productCollection->addItem($product);
49
  }
50
- Mage::helper('shippingip/api')->submitCatalog($productCollection);
51
  }
52
  }
53
 
@@ -61,7 +61,7 @@ class Iparcel_Shipping_Model_Catalog_Product_Observer
61
  $product->setIsDeleted(true);
62
  $productCollection = new Varien_Data_Collection();
63
  $productCollection->addItem($product);
64
- Mage::helper('shippingip/api')->submitCatalog($productCollection);
65
  }
66
  }
67
  }
3
  * Catalog_Product observer class
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Model_Catalog_Product_Observer
10
  {
11
  /**
12
  * Checking if catalog upload on product save is enabled
15
  */
16
  protected function _isEnabled()
17
  {
18
+ return Mage::getStoreConfig('catalog_mapping/config/auto_upload') == Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Mode::ON_UPDATE;
19
  }
20
 
21
  /**
27
  $product = $observer->getProduct();
28
  $productCollection = new Varien_Data_Collection();
29
  $productCollection->addItem($product);
30
+ Mage::helper('iparcel/api')->submitCatalog($productCollection);
31
  }
32
  }
33
 
47
  }
48
  $productCollection->addItem($product);
49
  }
50
+ Mage::helper('iparcel/api')->submitCatalog($productCollection);
51
  }
52
  }
53
 
61
  $product->setIsDeleted(true);
62
  $productCollection = new Varien_Data_Collection();
63
  $productCollection->addItem($product);
64
+ Mage::helper('iparcel/api')->submitCatalog($productCollection);
65
  }
66
  }
67
  }
app/code/community/Iparcel/All/Model/Cron.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Model for managing Cron jobs
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_Cron
10
+ {
11
+ /**
12
+ * Performs Catalog Mapping via cronjobs
13
+ *
14
+ */
15
+ public function catalogMapping()
16
+ {
17
+ // Only run the cronjob if auto_upload is set to CRON
18
+ $cronSettingValue = Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Mode::CRON;
19
+ if (Mage::getStoreConfig('catalog_mapping/config/auto_upload') == $cronSettingValue) {
20
+ $productCollection = Mage::getModel('catalog/product')->getCollection();
21
+ Mage::helper('iparcel/api')->submitCatalog($productCollection);
22
+ }
23
+ }
24
+ }
app/code/community/Iparcel/{Shipping/Model/Api → All/Model}/Log.php RENAMED
@@ -3,15 +3,16 @@
3
  * i-parcel XML log model
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Api_Log extends Varien_Object
10
  {
11
  const LOG_FILENAME = "iparcel.log";
12
  const MAX_LOG_SIZE = 10;
13
 
14
  protected $_jsonData;
 
15
  /**
16
  * Internal constructor
17
  */
@@ -35,28 +36,28 @@ class Iparcel_Shipping_Model_Api_Log extends Varien_Object
35
  return $response;
36
  }
37
 
38
- $logFilesize = filesize($this->getLogFilename());
39
- if ($logFilesize > 0) {
40
- $file = fopen($this->getLogFilename(), "r");
41
- $this->_jsonData = json_decode(fread($file, filesize($this->getLogFilename())), true);
42
- fclose($file);
43
- } else {
 
 
44
  $this->_jsonData = array();
 
45
  }
46
 
47
  // for each json log node append Varien Object to Varien Data Collection
48
- if (array_key_exists('logs', $this->_jsonData)) {
49
- foreach ($this->_jsonData['logs'] as $log) {
50
- $_log = new Varien_Object(array(
51
- 'timestamp' => $log['Timestamp'],
52
- 'controller' => $log['Controller'],
53
- 'response' => $log['Response'],
54
- 'request' => $log['Request']
55
- ));
56
- $response->addItem($_log);
57
- }
58
  }
59
-
60
  return $response;
61
  }
62
 
@@ -112,13 +113,7 @@ class Iparcel_Shipping_Model_Api_Log extends Varien_Object
112
  */
113
  protected function _clear()
114
  {
115
- $file = fopen($this->getLogFilename(), 'w');
116
- if ($file === false) {
117
- return false;
118
- }
119
- fclose($file);
120
-
121
- return true;
122
  }
123
 
124
  /**
@@ -150,7 +145,7 @@ class Iparcel_Shipping_Model_Api_Log extends Varien_Object
150
  $_response = $this->getResponse();
151
  $_controller = $this->getController();
152
  if (!($_request !== null && $_response !== null && $_controller)) {
153
- Mage::throwException(Mage::helper('shippingip')->__('Log data is not filled'));
154
  }
155
  // append if file exists, if not create new
156
  return file_exists($this->getLogFilename()) ? $this->_append() : $this->_create();
@@ -163,12 +158,6 @@ class Iparcel_Shipping_Model_Api_Log extends Varien_Object
163
  */
164
  public function clear()
165
  {
166
- $response = $this->_clear();
167
-
168
- if ($response === false) {
169
- return false;
170
- }
171
-
172
- return true;
173
  }
174
  }
3
  * i-parcel XML log model
4
  *
5
  * @category Iparcel
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
  */
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
 
113
  */
114
  protected function _clear()
115
  {
116
+ return unlink($this->getLogFilename());
 
 
 
 
 
 
117
  }
118
 
119
  /**
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();
158
  */
159
  public function clear()
160
  {
161
+ return $this->_clear();
 
 
 
 
 
 
162
  }
163
  }
app/code/community/Iparcel/{Shipping/Model → All/Model/System}/Config/Catalog/Mapping.php RENAMED
@@ -3,10 +3,10 @@
3
  * Backend model of auto catalog updates config field
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Config_Catalog_Mapping extends Mage_Core_Model_Config_Data
10
  {
11
  const CRON_STRING_PATH = 'crontab/jobs/iparcel_catalog_mapping/schedule/cron_expr';
12
 
@@ -26,22 +26,23 @@ class Iparcel_Shipping_Model_Config_Catalog_Mapping extends Mage_Core_Model_Conf
26
  */
27
  protected function _afterSave()
28
  {
29
- if ($this->getValue() == Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode::CRON) {
30
  $params = Mage::app()->getRequest()->getParams();
31
  $params = $params["groups"]["config"]["fields"];
32
  /* var $params array */
33
 
34
  $freq = $params['cron_frequency']['value'];
35
  $cron_expr = array();
 
36
  $cron_expr[3] = '*';
 
37
  switch ($freq) {
38
  case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY:
39
  $cron_expr[2] = $params['cron_monthday']['value'];
40
- $cron_expr[4] = '*';
41
  break;
42
  case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY:
43
  $cron_expr[4] = $params['cron_weekday']['value'];
44
- $cron_expr[2] = '*';
45
  }
46
  $cron_expr[0] = $params['cron_minute']['value'];
47
  $cron_expr[1] = $params['cron_hour']['value'];
3
  * Backend model of auto catalog updates config field
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Model_System_Config_Catalog_Mapping extends Mage_Core_Model_Config_Data
10
  {
11
  const CRON_STRING_PATH = 'crontab/jobs/iparcel_catalog_mapping/schedule/cron_expr';
12
 
26
  */
27
  protected function _afterSave()
28
  {
29
+ if ($this->getValue() == Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Mode::CRON) {
30
  $params = Mage::app()->getRequest()->getParams();
31
  $params = $params["groups"]["config"]["fields"];
32
  /* var $params array */
33
 
34
  $freq = $params['cron_frequency']['value'];
35
  $cron_expr = array();
36
+ $cron_expr[2] = '*';
37
  $cron_expr[3] = '*';
38
+ $cron_expr[4] = '*';
39
  switch ($freq) {
40
  case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY:
41
  $cron_expr[2] = $params['cron_monthday']['value'];
 
42
  break;
43
  case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY:
44
  $cron_expr[4] = $params['cron_weekday']['value'];
45
+ break;
46
  }
47
  $cron_expr[0] = $params['cron_minute']['value'];
48
  $cron_expr[1] = $params['cron_hour']['value'];
app/code/community/Iparcel/All/Model/System/Config/Data/Date/Monthday.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Backend model for monthday config field
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_System_Config_Data_Date_Monthday extends Mage_Core_Model_Config_Data
10
+ {
11
+ /**
12
+ * Saving monthday if proper value
13
+ */
14
+ public function save()
15
+ {
16
+ $_monthday = $this->getValue();
17
+ if (is_numeric($_monthday) && $_monthday<=31 && $_monthday>0) {
18
+ return parent::save();
19
+ } else {
20
+ Mage::throwException(Mage::helper('iparcel')->__('Wrong day of month'));
21
+ }
22
+ }
23
+ }
app/code/community/Iparcel/All/Model/System/Config/Data/Date/Weekday.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Backend model for weekday config field
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_System_Config_Data_Date_Weekday extends Mage_Core_Model_Config_Data
10
+ {
11
+ /**
12
+ * Validate before saving
13
+ */
14
+ public function save()
15
+ {
16
+ $_weekday = $this->getValue();
17
+ if (is_numeric($_weekday) && $_weekday<=7 && $_weekday>0) {
18
+ return parent::save();
19
+ } else {
20
+ Mage::throwException(Mage::helper('iparcel')->__('Wrong day of week'));
21
+ }
22
+ }
23
+ }
app/code/community/Iparcel/All/Model/System/Config/Data/Time/Hour.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Backend model for time hour config field
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_System_Config_Data_Time_Hour extends Mage_Core_Model_Config_Data
10
+ {
11
+ /**
12
+ * Validate before saving
13
+ */
14
+ public function save()
15
+ {
16
+ $_hour = $this->getValue();
17
+ if (is_numeric($_hour) && $_hour<24 && $_hour>=0) {
18
+ return parent::save();
19
+ } else {
20
+ Mage::throwException(Mage::helper('iparcel')->__('Wrong hour'));
21
+ }
22
+ }
23
+ }
app/code/community/Iparcel/All/Model/System/Config/Data/Time/Minute.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Backend model for time minute config field
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_System_Config_Data_Time_Minute extends Mage_Core_Model_Config_Data
10
+ {
11
+ /**
12
+ * Validate before saving
13
+ */
14
+ public function save()
15
+ {
16
+ $_minute = $this->getValue();
17
+ if (is_numeric($_minute) && $_minute<60 && $_minute>=0) {
18
+ return parent::save();
19
+ } else {
20
+ Mage::throwException(Mage::helper('iparcel')->__('Wrong minute'));
21
+ }
22
+ }
23
+ }
app/code/community/Iparcel/{Shipping/Model → All/Model/System}/Config/Guid.php RENAMED
@@ -2,13 +2,13 @@
2
  /** Backend model for i-parcel GUID config field
3
  *
4
  * @category Iparcel
5
- * @package Iparcel_Shipping
6
- * @author Bobby Burden <bburden@i-parcel.com>
7
  */
8
- class Iparcel_Shipping_Model_Config_Guid extends Mage_Core_Model_Config_Data
9
  {
10
  /**
11
- * Saving config if proper value
12
  */
13
  public function save()
14
  {
@@ -16,7 +16,7 @@ class Iparcel_Shipping_Model_Config_Guid extends Mage_Core_Model_Config_Data
16
  if (preg_match('/^[0-9A-Z]{8}-([0-9A-Z]{4}-){3}[0-9A-Z]{12}$/i', $_guid)) {
17
  return parent::save();
18
  } else {
19
- Mage::throwException(Mage::helper('shippingip')->__('Wrong GUID'));
20
  }
21
  }
22
  }
2
  /** Backend model for i-parcel GUID config field
3
  *
4
  * @category Iparcel
5
+ * @package Iparcel_All
6
+ * @author Bobby Burden <bburden@i-parcel.com>
7
  */
8
+ class Iparcel_All_Model_System_Config_Guid extends Mage_Core_Model_Config_Data
9
  {
10
  /**
11
+ * Validates and saves GUID
12
  */
13
  public function save()
14
  {
16
  if (preg_match('/^[0-9A-Z]{8}-([0-9A-Z]{4}-){3}[0-9A-Z]{12}$/i', $_guid)) {
17
  return parent::save();
18
  } else {
19
+ Mage::throwException(Mage::helper('iparcel')->__('Wrong GUID'));
20
  }
21
  }
22
  }
app/code/community/Iparcel/{Shipping/Model → All/Model/System}/Config/Script/Js.php RENAMED
@@ -3,10 +3,10 @@
3
  * Backend model for JavaScript file config field
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Config_Script_Js extends Mage_Adminhtml_Model_System_Config_Backend_File
10
  {
11
  const UPLOAD_ROOT = 'js';
12
  const UPLOAD_DIR = 'iparcel_custom';
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_System_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/{Shipping → All}/Model/System/Config/Source/Catalog/Mapping/Configurable/Price.php RENAMED
@@ -3,10 +3,10 @@
3
  * Source model for catalog_mapping/attributes/price config field
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Configurable_Price
10
  {
11
  const CONFIGURABLE = "0";
12
  const SIMPLE = "1";
@@ -19,8 +19,8 @@ class Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Configurable_P
19
  public function toOptionArray()
20
  {
21
  return array(
22
- array('value' => self::CONFIGURABLE, 'label' => Mage::helper('shippingip')->__("Parent product's price")),
23
- array('value' => self::SIMPLE, 'label' => Mage::helper('shippingip')->__("Default"))
24
  );
25
  }
26
  }
3
  * Source model for catalog_mapping/attributes/price config field
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Configurable_Price
10
  {
11
  const CONFIGURABLE = "0";
12
  const SIMPLE = "1";
19
  public function toOptionArray()
20
  {
21
  return array(
22
+ array('value' => self::CONFIGURABLE, 'label' => Mage::helper('iparcel')->__("Parent product's price")),
23
+ array('value' => self::SIMPLE, 'label' => Mage::helper('iparcel')->__("Default"))
24
  );
25
  }
26
  }
app/code/community/Iparcel/{Shipping → All}/Model/System/Config/Source/Catalog/Mapping/Mode.php RENAMED
@@ -3,10 +3,10 @@
3
  * Source model for catalog_mapping/config/auto_upload config field
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode
10
  {
11
  const DISABLED = "0";
12
  const ON_UPDATE = "1";
@@ -20,9 +20,9 @@ class Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode
20
  public function toOptionArray()
21
  {
22
  return array(
23
- array('value' => self::DISABLED, 'label' => Mage::helper('shippingip')->__('Disabled')),
24
- array('value' => self::ON_UPDATE, 'label' => Mage::helper('shippingip')->__('On product save')),
25
- array('value' => self::CRON, 'label' => Mage::helper('shippingip')->__('Cron job'))
26
  );
27
  }
28
  }
3
  * Source model for catalog_mapping/config/auto_upload config field
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_Al
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Mode
10
  {
11
  const DISABLED = "0";
12
  const ON_UPDATE = "1";
20
  public function toOptionArray()
21
  {
22
  return array(
23
+ array('value' => self::DISABLED, 'label' => Mage::helper('iparcel')->__('Disabled')),
24
+ array('value' => self::ON_UPDATE, 'label' => Mage::helper('iparcel')->__('On product save')),
25
+ array('value' => self::CRON, 'label' => Mage::helper('iparcel')->__('Cron job'))
26
  );
27
  }
28
  }
app/code/community/Iparcel/All/Model/System/Config/Source/Catalog/Product/Attribute.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Source model class for backend config fields with product atributes list
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_Shipping
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_System_Config_Source_Catalog_Product_Attribute
10
+ {
11
+ /**
12
+ * Options list
13
+ *
14
+ * @return array
15
+ */
16
+ public function toOptionArray()
17
+ {
18
+ /** @var Mage_Catalog_Model_Resource_Product_Attribute_Collecton $_attributeCollection */
19
+ $_attributeCollection = Mage::getResourceModel('catalog/product_attribute_collection')->addVisibleFilter();
20
+ $attributeCollection = array(array('value' => 0, 'label' => '<empty>'));
21
+
22
+ foreach ($_attributeCollection as $_attribute) {
23
+ $label = $_attribute->getFrontendLabel();
24
+ $attributeCollection[] = array(
25
+ 'value' => $_attribute->getAttributeId(),
26
+ 'label' => (empty($label)) ? Mage::helper('catalog')->__($_attribute->getAttributeCode()) : Mage::helper('catalog')->__($label)
27
+ );
28
+ }
29
+ return $attributeCollection;
30
+ }
31
+ }
app/code/community/Iparcel/All/Model/System/Config/Source/Catalog/Product/Attribute/Boolean.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Source model class for backend config fields with boolean product atributes
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Model_System_Config_Source_Catalog_Product_Attribute_Boolean
10
+ {
11
+ /**
12
+ * Options list
13
+ *
14
+ * @return array
15
+ */
16
+ public function toOptionArray()
17
+ {
18
+ /** @var Mage_Catalog_Model_Resource_Product_Attribute_Collection $_attributeCollection */
19
+ $_attributeCollection = Mage::getResourceModel('catalog/product_attribute_collection')
20
+ ->addVisibleFilter()
21
+ ->addFieldToFilter('frontend_input', 'boolean');
22
+ $attributeCollection = array(array('value' => 0, 'label' => '<empty>'));
23
+
24
+ foreach ($_attributeCollection as $_attribute) {
25
+ $label = $_attribute->getFrontendLabel();
26
+ $attributeCollection[] = array(
27
+ 'value' => $_attribute->getAttributeId(),
28
+ 'label' => (empty($label)) ? Mage::helper('catalog')->__($_attribute->getAttributeCode()) : Mage::helper('catalog')->__($label)
29
+ );
30
+ }
31
+ return $attributeCollection;
32
+ }
33
+ }
app/code/community/Iparcel/{Shipping → All}/Model/System/Config/Source/Date/Weekday.php RENAMED
@@ -3,10 +3,10 @@
3
  * Source model for catalog_mapping/config/cron_weekday config field
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_System_Config_Source_Date_Weekday
10
  {
11
  /**
12
  * Options list
@@ -21,7 +21,7 @@ class Iparcel_Shipping_Model_System_Config_Source_Date_Weekday
21
  $dayofweek = date('N', $time);
22
  $array[$dayofweek] = array(
23
  'value' => $dayofweek,
24
- 'label' => Mage::helper('shippingip')->__(date('l', $time))
25
  );
26
  }
27
  ksort($array, SORT_NUMERIC);
3
  * Source model for catalog_mapping/config/cron_weekday config field
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_Shipping
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Model_System_Config_Source_Date_Weekday
10
  {
11
  /**
12
  * Options list
21
  $dayofweek = date('N', $time);
22
  $array[$dayofweek] = array(
23
  'value' => $dayofweek,
24
+ 'label' => Mage::helper('iparcel')->__(date('l', $time))
25
  );
26
  }
27
  ksort($array, SORT_NUMERIC);
app/code/community/Iparcel/{Shipping → All}/Model/System/Config/Source/Sales/Order/Status.php RENAMED
@@ -3,10 +3,10 @@
3
  * Source model class for external_api/sales/order_status config field
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_System_Config_Source_Sales_Order_Status
10
  {
11
  /**
12
  * Options list
@@ -16,9 +16,9 @@ class Iparcel_Shipping_Model_System_Config_Source_Sales_Order_Status
16
  public function toOptionArray()
17
  {
18
  return array(
19
- array('value' => Mage_Sales_Model_Order::STATE_COMPLETE, 'label' => Mage::helper('shippingip')->__('Complete')),
20
- array('value' => 'pending', 'label' => Mage::helper('shippingip')->__('Pending')),
21
- array('value' => Mage_Sales_Model_Order::STATE_PROCESSING, 'label' => Mage::helper('shippingip')->__('Processing'))
22
  );
23
  }
24
  }
3
  * Source model class for external_api/sales/order_status config field
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Model_System_Config_Source_Sales_Order_Status
10
  {
11
  /**
12
  * Options list
16
  public function toOptionArray()
17
  {
18
  return array(
19
+ array('value' => Mage_Sales_Model_Order::STATE_COMPLETE, 'label' => Mage::helper('iparcel')->__('Complete')),
20
+ array('value' => 'pending', 'label' => Mage::helper('iparcel')->__('Pending')),
21
+ array('value' => Mage_Sales_Model_Order::STATE_PROCESSING, 'label' => Mage::helper('iparcel')->__('Processing'))
22
  );
23
  }
24
  }
app/code/community/Iparcel/{Shipping → All}/Model/System/Config/Source/Tax/Mode.php RENAMED
@@ -3,10 +3,10 @@
3
  * Source model for iparcel/tax/mode config field
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_System_Config_Source_Tax_Mode
10
  {
11
  const DISABLED = "0";
12
  const CUMULATIVELY = "1";
@@ -20,9 +20,9 @@ class Iparcel_Shipping_Model_System_Config_Source_Tax_Mode
20
  public function toOptionArray()
21
  {
22
  return array(
23
- array('value' => self::DISABLED, 'label' => Mage::helper('shippingip')->__('Disabled')),
24
- array('value' => self::CUMULATIVELY, 'label' => Mage::helper('shippingip')->__('Enabled - Tax and Duty cumulatively')),
25
- array('value' => self::SEPARATELY, 'label' => Mage::helper('shippingip')->__('Enabled - Tax and Duty separately'))
26
  );
27
  }
28
  }
3
  * Source model for iparcel/tax/mode config field
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Model_System_Config_Source_Tax_Mode
10
  {
11
  const DISABLED = "0";
12
  const CUMULATIVELY = "1";
20
  public function toOptionArray()
21
  {
22
  return array(
23
+ array('value' => self::DISABLED, 'label' => Mage::helper('iparcel')->__('Disabled')),
24
+ array('value' => self::CUMULATIVELY, 'label' => Mage::helper('iparcel')->__('Enabled - Tax and Duty cumulatively')),
25
+ array('value' => self::SEPARATELY, 'label' => Mage::helper('iparcel')->__('Enabled - Tax and Duty separately'))
26
  );
27
  }
28
  }
app/code/community/Iparcel/{Shipping/controllers/Adminhtml/Shippingip → All/controllers/Adminhtml/Iparcel}/LogController.php RENAMED
@@ -3,23 +3,22 @@
3
  * Adminhtml i-parcel logs controller
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Adminhtml_Shippingip_LogController extends Mage_Adminhtml_Controller_Action
10
  {
11
  /**
12
  * Init adminhtml response
13
  *
14
- * @return Iparcel_Shipping_Adminhtml_LogController
15
  */
16
  protected function _init()
17
  {
18
  $this->loadLayout()
19
  ->_setActiveMenu('iparcel/log')
20
- ->_title($this->__('Logs'))->_title($this->__('i-parcel Shipping'))
21
- ->_addBreadcrumb($this->__('Logs'), $this->__('Logs'))
22
- ->_addBreadcrumb($this->__('i-parcel Shipping'), $this->__('iparcel Shipping'));
23
  return $this;
24
  }
25
 
@@ -37,7 +36,7 @@ class Iparcel_Shipping_Adminhtml_Shippingip_LogController extends Mage_Adminhtml
37
  */
38
  public function clearAction()
39
  {
40
- if (Mage::getModel('shippingip/api_log')->clear() === false) {
41
  Mage::getSingleton('core/session')->addError($this->__('Unable to write to the log file.'));
42
  }
43
  $this->_redirect('*/*/index');
3
  * Adminhtml i-parcel logs controller
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Adminhtml_Iparcel_LogController extends Mage_Adminhtml_Controller_Action
10
  {
11
  /**
12
  * Init adminhtml response
13
  *
14
+ * @return Iparcel_All_Adminhtml_Iparcel_LogController
15
  */
16
  protected function _init()
17
  {
18
  $this->loadLayout()
19
  ->_setActiveMenu('iparcel/log')
20
+ ->_title($this->__('Logs'))->_title($this->__('i-parcel'))
21
+ ->_addBreadcrumb($this->__('Logs'), $this->__('Logs'));
 
22
  return $this;
23
  }
24
 
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');
app/code/community/Iparcel/{Shipping/controllers/Adminhtml/Shippingip → All/controllers/Adminhtml/Iparcel}/Sync/AjaxController.php RENAMED
@@ -3,23 +3,23 @@
3
  * Ajax Sync Controller
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Adminhtml_Shippingip_Sync_AjaxController extends Mage_Adminhtml_Controller_Action
10
  {
11
  /**
12
  * Preparing handles for controller
13
  *
14
  * @params array $handles
15
- * @return Iparcel_Shipping_Adminhtml_Sync_AjaxController
16
  */
17
  protected function _setupHandles(array $handles)
18
  {
19
  $update = $this->getLayout()->getUpdate();
20
  /* @var $update Mage_Core_Model_Layout_Update */
21
  $update->resetHandles();
22
- $update->addHandle('adminhtml_shippingip_sync_ajax');
23
  foreach ($handles as $handle) {
24
  if (is_string($handle)) {
25
  $update->addHandle($handle);
@@ -76,7 +76,7 @@ class Iparcel_Shipping_Adminhtml_Shippingip_Sync_AjaxController extends Mage_Adm
76
  {
77
  $page = $params['page'];
78
  $step = $params['step'];
79
-
80
  $offset = Mage::getStoreConfig('catalog_mapping/upload/offset');
81
  $page += floor($offset/$step);
82
 
@@ -85,8 +85,8 @@ class Iparcel_Shipping_Adminhtml_Shippingip_Sync_AjaxController extends Mage_Adm
85
  ->setPageSize($step)
86
  ->setCurPage($page);
87
  /* var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
88
-
89
- $n = Mage::helper('shippingip/api')->submitCatalog($productCollection);
90
 
91
  if ($n != -1) {
92
  return array(
@@ -118,7 +118,7 @@ class Iparcel_Shipping_Adminhtml_Shippingip_Sync_AjaxController extends Mage_Adm
118
  ->setCurPage($page);
119
  /* var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
120
 
121
- $n = Mage::helper('shippingip/api')->checkItems($productCollection);
122
 
123
  if ($n != -1) {
124
  return array(
@@ -151,7 +151,7 @@ class Iparcel_Shipping_Adminhtml_Shippingip_Sync_AjaxController extends Mage_Adm
151
  }
152
  } else {
153
  // show layout if not
154
- $this->_setupHandles(array('adminhtml_shippingip_sync_ajax_catalog'))
155
  ->renderLayout();
156
  }
157
  }
@@ -174,7 +174,7 @@ class Iparcel_Shipping_Adminhtml_Shippingip_Sync_AjaxController extends Mage_Adm
174
  }
175
  } else {
176
  // show layout if not
177
- $this->_setupHandles(array('adminhtml_shippingip_sync_ajax_checkitems'))
178
  ->renderLayout();
179
  }
180
  }
3
  * Ajax Sync Controller
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_Shipping
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Adminhtml_Iparcel_Sync_AjaxController extends Mage_Adminhtml_Controller_Action
10
  {
11
  /**
12
  * Preparing handles for controller
13
  *
14
  * @params array $handles
15
+ * @return Iparcel_All_Adminhtml_Iparcel_Sync_AjaxController
16
  */
17
  protected function _setupHandles(array $handles)
18
  {
19
  $update = $this->getLayout()->getUpdate();
20
  /* @var $update Mage_Core_Model_Layout_Update */
21
  $update->resetHandles();
22
+ $update->addHandle('adminhtml_iparcel_sync_ajax');
23
  foreach ($handles as $handle) {
24
  if (is_string($handle)) {
25
  $update->addHandle($handle);
76
  {
77
  $page = $params['page'];
78
  $step = $params['step'];
79
+
80
  $offset = Mage::getStoreConfig('catalog_mapping/upload/offset');
81
  $page += floor($offset/$step);
82
 
85
  ->setPageSize($step)
86
  ->setCurPage($page);
87
  /* var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
88
+
89
+ $n = Mage::helper('iparcel/api')->submitCatalog($productCollection);
90
 
91
  if ($n != -1) {
92
  return array(
118
  ->setCurPage($page);
119
  /* var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
120
 
121
+ $n = Mage::helper('iparcel/api')->checkItems($productCollection);
122
 
123
  if ($n != -1) {
124
  return array(
151
  }
152
  } else {
153
  // show layout if not
154
+ $this->_setupHandles(array('adminhtml_iparcel_sync_ajax_catalog'))
155
  ->renderLayout();
156
  }
157
  }
174
  }
175
  } else {
176
  // show layout if not
177
+ $this->_setupHandles(array('adminhtml_iparcel_sync_ajax_checkitems'))
178
  ->renderLayout();
179
  }
180
  }
app/code/community/Iparcel/{Shipping/controllers/Adminhtml/Shippingip → All/controllers/Adminhtml/Iparcel}/SyncController.php RENAMED
@@ -3,16 +3,16 @@
3
  * Adminhtml i-parcel sync controller
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Adminhtml_Shippingip_SyncController extends Mage_Adminhtml_Controller_Action
10
  {
11
  public function salesruleAction()
12
  {
13
  $_salesRuleCollection = Mage::getResourceModel('salesrule/rule_collection');
14
  /* var $_salesRuleCollection Mage_SalesRule_Model_Resource_Rule_Collection */
15
- Mage::helper('shippingip/api')->salesRule($_salesRuleCollection);
16
  $this->_redirectReferer();
17
  }
18
  }
3
  * Adminhtml i-parcel sync controller
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Adminhtml_Iparcel_SyncController extends Mage_Adminhtml_Controller_Action
10
  {
11
  public function salesruleAction()
12
  {
13
  $_salesRuleCollection = Mage::getResourceModel('salesrule/rule_collection');
14
  /* var $_salesRuleCollection Mage_SalesRule_Model_Resource_Rule_Collection */
15
+ Mage::helper('iparcel/api')->salesRule($_salesRuleCollection);
16
  $this->_redirectReferer();
17
  }
18
  }
app/code/community/Iparcel/All/controllers/InfoController.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Controller to display extension information
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_InfoController extends Mage_Core_Controller_Front_Action
10
+ {
11
+ /**
12
+ * Format and display extension information
13
+ */
14
+ public function indexAction()
15
+ {
16
+ $versions = $this->_gatherExtensionVersions();
17
+
18
+ foreach ($versions as $key => $version) {
19
+ print "<b>$key</b>: $version<br />";
20
+ }
21
+ }
22
+
23
+ /**
24
+ * Gathers extension versions for any installed i-parcel extensions
25
+ *
26
+ * @return array
27
+ */
28
+ private function _gatherExtensionVersions()
29
+ {
30
+ $extensions = array(
31
+ 'Iparcel_All' => 0,
32
+ 'Iparcel_GlobaleCommerce' => 0,
33
+ 'Iparcel_Logistics' => 0
34
+ );
35
+
36
+ $allExtensions = Mage::app()->getConfig()->getNode('modules')->asArray();
37
+
38
+ foreach ($extensions as $key => &$version) {
39
+ if (array_key_exists($key, $allExtensions)) {
40
+ $version = $allExtensions[$key]['version'];
41
+ } else {
42
+ unset($extensions[$key]);
43
+ }
44
+ }
45
+
46
+ return $extensions;
47
+ }
48
+ }
app/code/community/Iparcel/All/etc/adminhtml.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <iparcel translate="title" module="iparcel">
5
+ <title>i-parcel</title>
6
+ <sort_order>9999</sort_order>
7
+ <children>
8
+ <config translate="title" module="iparcel">
9
+ <title>Configuration</title>
10
+ <sort_order>0</sort_order>
11
+ <action>adminhtml/system_config/edit/section/iparcel</action>
12
+ </config>
13
+ <sync translate="title" module="iparcel">
14
+ <title>Synchronization</title>
15
+ <sort_order>5</sort_order>
16
+ <children>
17
+ <catalog_mapping translate="title" module="iparcel">
18
+ <title>Catalog Mapping</title>
19
+ <sort_order>5</sort_order>
20
+ <action>adminhtml/system_config/edit/section/catalog_mapping</action>
21
+ </catalog_mapping>
22
+ </children>
23
+ </sync>
24
+ <log>
25
+ <title>Logs</title>
26
+ <sort_order>20</sort_order>
27
+ <action>adminhtml/iparcel_log/index</action>
28
+ </log>
29
+ </children>
30
+ </iparcel>
31
+ </menu>
32
+ </config>
app/code/community/Iparcel/All/etc/config.xml ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Iparcel_All>
5
+ <version>1.0.0</version>
6
+ </Iparcel_All>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <iparcel>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Iparcel_All</module>
14
+ <frontName>iparcel</frontName>
15
+ </args>
16
+ </iparcel>
17
+ </routers>
18
+ </frontend>
19
+ <crontab>
20
+ <jobs>
21
+ <iparcel_catalog_mapping>
22
+ <schedule><cron_expr>0 0 1 1 *</cron_expr></schedule>
23
+ <run>
24
+ <model>iparcel/cron::catalogMapping</model>
25
+ </run>
26
+ </iparcel_catalog_mapping>
27
+ </jobs>
28
+ </crontab>
29
+ <global>
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>
43
+ </iparcel>
44
+ </helpers>
45
+ <events>
46
+ <catalog_product_save_after>
47
+ <observers>
48
+ <iparcel_catalog_product_observer>
49
+ <type>singleton</type>
50
+ <class>Iparcel_All_Model_Catalog_Product_Observer</class>
51
+ <method>product_save</method>
52
+ </iparcel_catalog_product_observer>
53
+ </observers>
54
+ </catalog_product_save_after>
55
+ <catalog_product_attribute_update_before>
56
+ <observers>
57
+ <iparcel_catalog_product_observer>
58
+ <type>singleton</type>
59
+ <class>Iparcel_All_Model_Catalog_Product_Observer</class>
60
+ <method>product_massUpdate</method>
61
+ </iparcel_catalog_product_observer>
62
+ </observers>
63
+ </catalog_product_attribute_update_before>
64
+ <catalog_product_delete_before>
65
+ <observers>
66
+ <iparcel_catalog_product_observer>
67
+ <type>singleton</type>
68
+ <class>Iparcel_All_Model_Catalog_Product_Observer</class>
69
+ <method>product_delete</method>
70
+ </iparcel_catalog_product_observer>
71
+ </observers>
72
+ </catalog_product_delete_before>
73
+ </events>
74
+ </global>
75
+ <adminhtml>
76
+ <layout>
77
+ <updates>
78
+ <iparcel>
79
+ <file>iparcel.xml</file>
80
+ </iparcel>
81
+ </updates>
82
+ </layout>
83
+ <acl>
84
+ <resources>
85
+ <admin>
86
+ <children>
87
+ <system>
88
+ <children>
89
+ <config>
90
+ <children>
91
+ <iparcel>
92
+ <title>i-parcel Configuration</title>
93
+ </iparcel>
94
+ <catalog_mapping>
95
+ <title>i-parcel Catalog Mapping</title>
96
+ </catalog_mapping>
97
+ </children>
98
+ </config>
99
+ </children>
100
+ </system>
101
+ </children>
102
+ </admin>
103
+ </resources>
104
+ </acl>
105
+ </adminhtml>
106
+ <admin>
107
+ <routers>
108
+ <adminhtml>
109
+ <args>
110
+ <modules>
111
+ <iparcel after="Mage_Adminhtml">Iparcel_All_Adminhtml</iparcel>
112
+ </modules>
113
+ </args>
114
+ </adminhtml>
115
+ </routers>
116
+ </admin>
117
+ <default>
118
+ <catalog_mapping>
119
+ <config>
120
+ <auto_upload>0</auto_upload>
121
+ </config>
122
+ <upload>
123
+ <step>100</step>
124
+ <offset>0</offset>
125
+ </upload>
126
+ <attributes>
127
+ <price>1</price>
128
+ </attributes>
129
+ </catalog_mapping>
130
+ </default>
131
+ </config>
app/code/community/Iparcel/All/etc/system.xml ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <i-parcel translate="label" module="iparcel">
5
+ <label>i-parcel</label>
6
+ <sort_order>500</sort_order>
7
+ </i-parcel>
8
+ </tabs>
9
+ <sections>
10
+ <iparcel>
11
+ <label>Configuration</label>
12
+ <tab>i-parcel</tab>
13
+ <frontent_type>text</frontent_type>
14
+ <sort_order>100</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>0</show_in_store>
18
+ <groups>
19
+ <config translate="label">
20
+ <label>General</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>0</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>0</show_in_store>
26
+ <expanded>1</expanded>
27
+ <fields>
28
+ <custid translate="label">
29
+ <label>Company ID</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>2</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>0</show_in_store>
35
+ <tooltip>This is the Company ID provided by i-parcel.</tooltip>
36
+ </custid>
37
+ <userid translate="label">
38
+ <label>Web Service Key (GUID)</label>
39
+ <backend_model>iparcel/system_config_guid</backend_model>
40
+ <sort_order>3</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>0</show_in_store>
44
+ <tooltip>This is Web Service Key provided by i-parcel.</tooltip>
45
+ </userid>
46
+ <dashboard>
47
+ <label>Dashboard</label>
48
+ <frontend_type>button</frontend_type>
49
+ <frontend_model>iparcel/adminhtml_iparcel_dashboard</frontend_model>
50
+ <sort_order>115</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </dashboard>
55
+ </fields>
56
+ </config>
57
+ </groups>
58
+ </iparcel>
59
+ <catalog_mapping>
60
+ <label>Catalog Mapping</label>
61
+ <tab>i-parcel</tab>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>110</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>0</show_in_store>
67
+ <groups>
68
+ <config translate="label">
69
+ <label>Configuration</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>0</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ <expanded>1</expanded>
76
+ <fields>
77
+ <auto_upload translate="label">
78
+ <label>Auto Catalog Updates</label>
79
+ <frontend_type>select</frontend_type>
80
+ <source_model>iparcel/system_config_source_catalog_mapping_mode</source_model>
81
+ <backend_model>iparcel/system_config_catalog_mapping</backend_model>
82
+ <sort_order>5</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>0</show_in_store>
86
+ </auto_upload>
87
+ <cron_frequency translate="label">
88
+ <label>Frequency</label>
89
+ <frontend_type>select</frontend_type>
90
+ <source_model>adminhtml/system_config_source_cron_frequency</source_model>
91
+ <sort_order>99</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>0</show_in_store>
95
+ <depends>
96
+ <auto_upload>2</auto_upload>
97
+ </depends>
98
+ </cron_frequency>
99
+ <cron_hour translate="label">
100
+ <label>Hour</label>
101
+ <frontend_type>text</frontend_type>
102
+ <sort_order>100</sort_order>
103
+ <backend_model>iparcel/system_config_data_time_hour</backend_model>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>0</show_in_store>
107
+ <depends>
108
+ <auto_upload>2</auto_upload>
109
+ </depends>
110
+ </cron_hour>
111
+ <cron_minute translate="label">
112
+ <label>Minute</label>
113
+ <frontend_type>text</frontend_type>
114
+ <sort_order>101</sort_order>
115
+ <backend_model>iparcel/system_config_data_time_minute</backend_model>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
+ <show_in_store>0</show_in_store>
119
+ <depends>
120
+ <auto_upload>2</auto_upload>
121
+ </depends>
122
+ </cron_minute>
123
+ <cron_monthday translate="label">
124
+ <label>Day of Month</label>
125
+ <frontend_type>text</frontend_type>
126
+ <sort_order>103</sort_order>
127
+ <backend_model>iparcel/system_config_data_date_monthday</backend_model>
128
+ <show_in_default>1</show_in_default>
129
+ <show_in_website>1</show_in_website>
130
+ <show_in_store>0</show_in_store>
131
+ <depends>
132
+ <auto_upload>2</auto_upload>
133
+ <cron_frequency>M</cron_frequency>
134
+ </depends>
135
+ </cron_monthday>
136
+ <cron_weekday translate="label">
137
+ <label>Day of Week</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>iparcel/system_config_source_date_weekday</source_model>
140
+ <sort_order>102</sort_order>
141
+ <backend_model>iparcel/system_config_data_date_weekday</backend_model>
142
+ <show_in_default>1</show_in_default>
143
+ <show_in_website>1</show_in_website>
144
+ <show_in_store>0</show_in_store>
145
+ <depends>
146
+ <auto_upload>2</auto_upload>
147
+ <cron_frequency>W</cron_frequency>
148
+ </depends>
149
+ </cron_weekday>
150
+ </fields>
151
+ </config>
152
+ <upload translate="label">
153
+ <label>Upload</label>
154
+ <frontend_type>text</frontend_type>
155
+ <sort_order>0</sort_order>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>1</show_in_website>
158
+ <show_in_store>0</show_in_store>
159
+ <expanded>1</expanded>
160
+ <fields>
161
+ <upload translate="label">
162
+ <label>Upload Catalog</label>
163
+ <frontend_type>button</frontend_type>
164
+ <frontend_model>iparcel/adminhtml_catalog_mapping_button</frontend_model>
165
+ <sort_order>1</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>0</show_in_store>
169
+ <tooltip>If this button is pressed, the catalog will be uploaded to i-parcel.</tooltip>
170
+ <comment>This may take some time</comment>
171
+ </upload>
172
+ <step translate="label">
173
+ <label>Upload Step Size</label>
174
+ <frontend_type>text</frontend_type>
175
+ <sort_order>10</sort_order>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>0</show_in_website>
178
+ <show_in_store>0</show_in_store>
179
+ <validate>validate-number validate-greater-than-zero</validate>
180
+ </step>
181
+ <offset translate="label">
182
+ <label>Upload offset</label>
183
+ <frontend_type>text</frontend_type>
184
+ <sort_order>20</sort_order>
185
+ <show_in_default>1</show_in_default>
186
+ <show_in_website>0</show_in_website>
187
+ <show_in_store>0</show_in_store>
188
+ <validate>validate-number validate-zero-or-greater</validate>
189
+ </offset>
190
+ </fields>
191
+ </upload>
192
+ <attributes translate="label">
193
+ <label>Catalog Mapping Attributes</label>
194
+ <frontend_type>text</frontend_type>
195
+ <sort_order>5</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>0</show_in_website>
198
+ <show_in_store>0</show_in_store>
199
+ <expanded>1</expanded>
200
+ <fields>
201
+ <attribute1 translate="label">
202
+ <label>Attribute 1</label>
203
+ <frontend_type>select</frontend_type>
204
+ <source_model>iparcel/system_config_source_catalog_product_attribute</source_model>
205
+ <sort_order>6</sort_order>
206
+ <show_in_default>1</show_in_default>
207
+ <show_in_website>1</show_in_website>
208
+ <show_in_store>0</show_in_store>
209
+ </attribute1>
210
+ <attribute2 translate="label">
211
+ <label>Attribute 2</label>
212
+ <frontend_type>select</frontend_type>
213
+ <source_model>iparcel/system_config_source_catalog_product_attribute</source_model>
214
+ <sort_order>11</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>0</show_in_store>
218
+ </attribute2>
219
+ <attribute3 translate="label">
220
+ <label>Attribute 3</label>
221
+ <frontend_type>select</frontend_type>
222
+ <source_model>iparcel/system_config_source_catalog_product_attribute</source_model>
223
+ <sort_order>16</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>1</show_in_website>
226
+ <show_in_store>0</show_in_store>
227
+ </attribute3>
228
+ <attribute4 translate="label">
229
+ <label>Attribute 4</label>
230
+ <frontend_type>select</frontend_type>
231
+ <source_model>iparcel/system_config_source_catalog_product_attribute</source_model>
232
+ <sort_order>21</sort_order>
233
+ <show_in_default>1</show_in_default>
234
+ <show_in_website>1</show_in_website>
235
+ <show_in_store>0</show_in_store>
236
+ </attribute4>
237
+ <attribute5 translate="label">
238
+ <label>Attribute 5</label>
239
+ <frontend_type>select</frontend_type>
240
+ <source_model>iparcel/system_config_source_catalog_product_attribute</source_model>
241
+ <sort_order>26</sort_order>
242
+ <show_in_default>1</show_in_default>
243
+ <show_in_website>1</show_in_website>
244
+ <show_in_store>0</show_in_store>
245
+ </attribute5>
246
+ <attribute6 translate="label">
247
+ <label>Attribute 6</label>
248
+ <frontend_type>select</frontend_type>
249
+ <source_model>iparcel/system_config_source_catalog_product_attribute</source_model>
250
+ <sort_order>31</sort_order>
251
+ <show_in_default>1</show_in_default>
252
+ <show_in_website>1</show_in_website>
253
+ <show_in_store>0</show_in_store>
254
+ </attribute6>
255
+ <hscodeus translate="label">
256
+ <label>HS Code</label>
257
+ <frontend_type>select</frontend_type>
258
+ <source_model>iparcel/system_config_source_catalog_product_attribute</source_model>
259
+ <sort_order>36</sort_order>
260
+ <show_in_default>1</show_in_default>
261
+ <show_in_website>1</show_in_website>
262
+ <show_in_store>0</show_in_store>
263
+ </hscodeus>
264
+ <shipalone translate="label">
265
+ <label>Ship Alone</label>
266
+ <frontend_type>select</frontend_type>
267
+ <source_model>iparcel/system_config_source_catalog_product_attribute_boolean</source_model>
268
+ <sort_order>41</sort_order>
269
+ <show_in_default>1</show_in_default>
270
+ <show_in_website>1</show_in_website>
271
+ <show_in_store>0</show_in_store>
272
+ <comment>Only boolean attributes</comment>
273
+ </shipalone>
274
+ <price translate="label">
275
+ <label>Price Type</label>
276
+ <frontend_type>select</frontend_type>
277
+ <source_model>iparcel/system_config_source_catalog_mapping_configurable_price</source_model>
278
+ <sort_order>46</sort_order>
279
+ <show_in_default>1</show_in_default>
280
+ <show_in_website>1</show_in_website>
281
+ <show_in_store>0</show_in_store>
282
+ <comment>Price type for configurable products</comment>
283
+ </price>
284
+ </fields>
285
+ </attributes>
286
+ </groups>
287
+ </catalog_mapping>
288
+ </sections>
289
+ </config>
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Catalog/Product.php RENAMED
@@ -2,17 +2,17 @@
2
  /**
3
  * Product for i-parcel shipping extension
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Block_Catalog_Product extends Mage_Catalog_Block_Product_View
10
  {
11
  /**
12
  * Retrieve qty for product
13
  *
14
  * @param Mage_Catalog_Model_Product $product
15
- * $return float
16
  */
17
  public function getStock()
18
  {
2
  /**
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
13
  *
14
  * @param Mage_Catalog_Model_Product $product
15
+ * @return float
16
  */
17
  public function getStock()
18
  {
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Catalog/Product/List.php RENAMED
@@ -2,11 +2,11 @@
2
  /**
3
  * Product list for i-parcel shipping extension
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List
10
  {
11
  /**
12
  * Retrieve loaded category collection
@@ -45,7 +45,7 @@ class Iparcel_Shipping_Block_Catalog_Product_List extends Mage_Catalog_Block_Pro
45
  }
46
  $this->_productCollection = $layer->getProductCollection();
47
 
48
- $helper = Mage::helper('shippingip/international');
49
  // if international customer enabled and it is international customer
50
  if ($helper->checkEnabled() && $helper->getInternational()) {
51
  // add international visibility attribute to filter
2
  /**
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
  }
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
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Catalogsearch/Advanced/Result.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Iparcel_Shipping_Block_Catalogsearch_Advanced_Result extends Mage_CatalogSearch_Block_Advanced_Result
3
  {
4
  protected $_productCollection;
5
 
@@ -8,7 +8,7 @@ class Iparcel_Shipping_Block_Catalogsearch_Advanced_Result extends Mage_CatalogS
8
  if (is_null($this->_productCollection)) {
9
  $this->_productCollection = $this->getSearchModel()->getProductCollection();
10
 
11
- $helper = Mage::helper('shippingip/international');
12
  // if international customer enabled and it is international customer
13
  if ($helper->checkEnabled() && $helper->getInternational()) {
14
  // add international visibility attribute to filter
@@ -33,4 +33,4 @@ class Iparcel_Shipping_Block_Catalogsearch_Advanced_Result extends Mage_CatalogS
33
  {
34
  return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
35
  }
36
- }
1
  <?php
2
+ class Iparcel_GlobaleCommerce_Block_Catalogsearch_Advanced_Result extends Mage_CatalogSearch_Block_Advanced_Result
3
  {
4
  protected $_productCollection;
5
 
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
  {
34
  return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
35
  }
36
+ }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Catalogsearch/Result.php RENAMED
@@ -1,12 +1,12 @@
1
  <?php
2
- class Iparcel_Shipping_Block_Catalogsearch_Result extends Mage_CatalogSearch_Block_Result
3
  {
4
  protected function _getProductCollection()
5
  {
6
  if (is_null($this->_productCollection)) {
7
  $this->_productCollection = $this->getListBlock()->getLoadedProductCollection();
8
 
9
- $helper = Mage::helper('shippingip/international');
10
  // if international customer enabled and it is international customer
11
  if ($helper->checkEnabled() && $helper->getInternational()) {
12
  // add international visibility attribute to filter
@@ -32,4 +32,4 @@ class Iparcel_Shipping_Block_Catalogsearch_Result extends Mage_CatalogSearch_Blo
32
  {
33
  return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
34
  }
35
- }
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
  {
33
  return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
34
  }
35
+ }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Cpf.php RENAMED
@@ -3,10 +3,10 @@
3
  * i-parcel cpf block
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Block_Cpf extends Mage_Core_Block_Template
10
  {
11
  /**
12
  * Geting formated array with cpfs list
@@ -15,7 +15,7 @@ class Iparcel_Shipping_Block_Cpf extends Mage_Core_Block_Template
15
  */
16
  public function getCpf()
17
  {
18
- $cpfCollection = Mage::getModel('shippingip/cpf')->getCollection();
19
  $response = array();
20
  foreach ($cpfCollection as $cpf) {
21
  $response[$cpf->getCountryCode()] = array(
3
  * i-parcel cpf block
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Block_Cpf extends Mage_Core_Block_Template
10
  {
11
  /**
12
  * Geting formated array with cpfs list
15
  */
16
  public function getCpf()
17
  {
18
+ $cpfCollection = Mage::getModel('ipglobalecommerce/cpf')->getCollection();
19
  $response = array();
20
  foreach ($cpfCollection as $cpf) {
21
  $response[$cpf->getCountryCode()] = array(
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Html/Head/Iparcel.php RENAMED
@@ -2,11 +2,11 @@
2
  /**
3
  * i-parcel frontend scripts block
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Block_Html_Head_Iparcel extends Mage_Core_Block_Template
10
  {
11
  /**
12
  * Checking if frontend scripts are enabled
2
  /**
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
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Html/Head/Jquery.php RENAMED
@@ -2,11 +2,11 @@
2
  /**
3
  * i-parcel jQuery block
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Block_Html_Head_Jquery extends Mage_Core_Block_Template
10
  {
11
  /**
12
  * Checking if i-parcel's jQuery is enabled
2
  /**
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
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Html/Head/Post.php RENAMED
@@ -2,11 +2,11 @@
2
  /**
3
  * i-parcel custom post script block
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Block_Html_Head_Post extends Mage_Core_Block_Template
10
  {
11
  /**
12
  * Checking if there's store config for custom post script, if yes returning script directory, if not returning default directory
@@ -18,7 +18,7 @@ class Iparcel_Shipping_Block_Html_Head_Post extends Mage_Core_Block_Template
18
  $postScripts = array('iparcel/post.js');
19
  $file = Mage::getStoreConfig('iparcel/scripts/post');
20
  if ($file) {
21
- $postScripts[] = Mage::getModel('shippingip/config_script_js')->getUploadDir('post') . $file;
22
  }
23
  return $postScripts;
24
  }
2
  /**
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
  $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
  }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Block/Payment/Info.php RENAMED
@@ -2,11 +2,11 @@
2
  /**
3
  * i-parcel payment method info block
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Block_Payment_Info extends Mage_Payment_Block_Info
10
  {
11
  /**
12
  * Prepare information specific to current payment method
2
  /**
3
  * i-parcel payment method info block
4
  *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Block_Payment_Info extends Mage_Payment_Block_Info
10
  {
11
  /**
12
  * Prepare information specific to current payment method
app/code/community/Iparcel/GlobaleCommerce/Helper/Api.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * I-parcel sending API helper
4
+ *
5
+ * This helper facilitates the connection to the API web service documented
6
+ * here: http://webservices.i-parcel.com/Help
7
+ *
8
+ * @category Iparcel
9
+ * @package Iparcel_GlobaleCommerce
10
+ * @author Bobby Burden <bburden@i-parcel.com>
11
+ */
12
+ class Iparcel_GlobaleCommerce_Helper_Api extends Iparcel_All_Helper_Api
13
+ {
14
+ /**
15
+ * Send Sales Rule request
16
+ *
17
+ * Takes the passed SalesRules and transforms it into data that can be
18
+ * passed to the API. It then submits the request as JSON to the
19
+ * SalesRule API endpoint.
20
+ *
21
+ * @param Mage_SalesRule_Model_Resource_Rule_Collection Collection of SalesRules to submit
22
+ * @return string Response from the SalesRule request
23
+ */
24
+ public function salesRule(Mage_SalesRule_Model_Resource_Rule_Collection $_collection)
25
+ {
26
+ $log = Mage::getModel('iparcel/log');
27
+ $log->setController('Sales Rule');
28
+
29
+ $json = array();
30
+ $json['key'] = Mage::helper('ipglobalecommerce')->getGuid();
31
+ $json['ItemDetailsList'] = array();
32
+
33
+ foreach ($_collection as $_rule) {
34
+ /* var $_rule Mage_SalesRule_Model_Rule */
35
+ $item = array();
36
+ $item['Name'] = $_rule->getName();
37
+ $item['FormDate'] = $_rule->getFromDate();
38
+ $item['ToDate'] = $_rule->getToDate();
39
+ $item['IsActive'] = $_rule->getIsActive();
40
+ $item['StopRulesProcessing'] = $_rule->getStopRulesProcessing();
41
+ $item['SimpleAction'] = $_rule->getSimpleAction();
42
+ $item['DiscountAmount'] = $_rule->getDiscountAmount();
43
+ $item['DiscountQty'] = $_rule->getDiscountQty();
44
+ $item['DiscountStep'] = $_rule->getDiscountStep();
45
+ $item['SimpleFreeShipping'] = $_rule->getSimpleFreeShipping();
46
+ $item['ApplyToShipping'] = $_rule->getApplyToShipping();
47
+ $item['TimesUsed'] = $_rule->getTimesUsed();
48
+ $item['CouponType'] = $_rule->getCouponType();
49
+
50
+ $item['Conditions'] = unserialize($_rule->getConditionsSerialized());
51
+ $item['Actions'] = unserialize($_rule->getActionsSerialized());
52
+
53
+ $json['ItemDetailsList'][] = $item;
54
+ }
55
+
56
+ $log->setRequest(json_encode($json));
57
+
58
+ // FIXME: This API Call is no longer used. Should it be removed?
59
+ $response = $this->_restJSON($json, null);
60
+
61
+ $log->setResponse($response);
62
+ $log->save();
63
+
64
+ return json_decode($response);
65
+ }
66
+ }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Helper/Api/External.php RENAMED
@@ -3,10 +3,10 @@
3
  * External API Helper
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Helper_Api_External
10
  {
11
  /*
12
  * var $_allowedAddr array
3
  * External API Helper
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Helper_Api_External
10
  {
11
  /*
12
  * var $_allowedAddr array
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Helper/Data.php RENAMED
@@ -1,12 +1,12 @@
1
  <?php
2
  /**
3
- * Iparcel_Shipping default data Helper
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Helper_Data extends Mage_Core_Helper_Abstract
10
  {
11
  /**
12
  * Getting GUID key
1
  <?php
2
  /**
3
+ * Iparcel_GlobaleCommerce default data Helper
4
  *
5
+ * @category Iparcel
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
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Helper/International.php RENAMED
@@ -3,10 +3,10 @@
3
  * i-parcel international customer helper
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Helper_International
10
  {
11
  /**
12
  * Get international flag from customer session
3
  * i-parcel international customer helper
4
  *
5
  * @category Iparcel
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
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Helper/Sales/Data.php RENAMED
@@ -3,10 +3,10 @@
3
  * Sales module base helper extended with i-parcel orders surpressing emails
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Helper_Sales_Data extends Mage_Sales_Helper_Data
10
  {
11
  /**
12
  * Check allow to send new order confirmation email
3
  * Sales module base helper extended with i-parcel orders surpressing emails
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Helper_Sales_Data extends Mage_Sales_Helper_Data
10
  {
11
  /**
12
  * Check allow to send new order confirmation email
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Helper/String.php RENAMED
@@ -3,10 +3,10 @@
3
  * i-parcel shipping helper for strings
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Helper_String
10
  {
11
  /**
12
  * Checking if string has integer value
@@ -14,7 +14,7 @@ class Iparcel_Shipping_Helper_String
14
  * @param string $str
15
  * @return bool
16
  */
17
- public function isInteger(string $str)
18
  {
19
  return (int)$str == $str;
20
  }
3
  * i-parcel shipping helper for strings
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Helper_String
10
  {
11
  /**
12
  * Checking if string has integer value
14
  * @param string $str
15
  * @return bool
16
  */
17
+ public function isInteger($str)
18
  {
19
  return (int)$str == $str;
20
  }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Api/External/Sales/Order.php RENAMED
@@ -3,23 +3,23 @@
3
  * i-parcel External Sales API processing model
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Abstract
10
  {
11
  /**
12
  * Initialize resource model
13
  */
14
  protected function _construct()
15
  {
16
- $this->_init('shippingip/api_order');
17
  }
18
 
19
  /**
20
  * Initialize adminhtml quote session
21
  *
22
- * @return Iparcel_Shipping_Model_Api_External_Sales_Order
23
  */
24
  protected function _initSession()
25
  {
@@ -40,7 +40,7 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
40
  /**
41
  * Processing quote
42
  *
43
- * @return Iparcel_Shipping_Model_Api_External_Sales_Order
44
  */
45
  protected function _processQuote()
46
  {
@@ -69,7 +69,7 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
69
  * Customer setter
70
  *
71
  * @param array $user, int $websiteId
72
- * @return Iparcel_Shipping_Model_Api_External_Sales_Order
73
  */
74
  public function setCustomer($user, $websiteId)
75
  {
@@ -101,7 +101,7 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
101
  * Customer Billing Address setter
102
  *
103
  * @param array $_address
104
- * @return Iparcel_Shipping_Model_Api_External_Sales_Order
105
  */
106
  public function setCustomerBillingAddress($_address)
107
  {
@@ -131,7 +131,7 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
131
  /**
132
  * Setting default billing address for customer
133
  *
134
- * @return Iparcel_Shipping_Model_Api_External_Sales_Order
135
  */
136
  public function setDefaultCustomerBillingAddress()
137
  {
@@ -166,7 +166,7 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
166
  * Customer Shipping Address setter
167
  *
168
  * @param array $_address
169
- * @return Iparcel_Shipping_Model_Api_External_Sales_Order
170
  */
171
  public function setCustomerShippingAddress($_address)
172
  {
@@ -196,7 +196,7 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
196
  /**
197
  * Setting default shipping address for customer
198
  *
199
- * @return Iparcel_Shipping_Model_Api_External_Sales_Order
200
  */
201
  public function setDefaultCustomerShippingAddress()
202
  {
@@ -230,7 +230,7 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
230
  /** Order data setter
231
  *
232
  * @param array $data
233
- * @return Iparcel_Shipping_Model_Api_External_Sales_Order
234
  */
235
  public function setOrderData($data)
236
  {
@@ -320,7 +320,7 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
320
  'telephone' => $_customerShippingAddress->getTelephone(),
321
  'fax' => ''
322
  ),
323
- 'shipping_method' => 'i-parcel_auto',
324
  'comment' => array(
325
  'customer_note' => 'This order has been programmatically created via I-Parcel extension'
326
  ),
@@ -395,13 +395,13 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
395
  // generate shipping rate
396
  $ship = Mage::getModel('shipping/rate_result_method');
397
  /* var $ship Mage_Shipping_Model_Rate_Result_Method */
398
- $ship->setCarrier('i-parcel');
399
  $ship->setCarrierTitle('i-parcel');
400
  $ship->setMethod('auto');
401
  $ship->setMethodTitle('Auto');
402
  $ship->setPrice($shippingCosts);
403
  $ship->setCost($shippingCosts);
404
- $ship->setMethodDescription(Mage::getStoreConfig('carriers/i-parcel/whitelabelship').': '.Mage::getStoreConfig('carriers/i-parcel/backend_name'));
405
 
406
  // import order's post data and shipping rate
407
  $_orderCreator->importPostData($orderData['order'])
@@ -442,12 +442,15 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
442
  $_order->setStoreCurrencyCode($currency);
443
  $_order->setOrderCurrencyCode($currency);
444
  $_order->setTaxAmount($tax);
 
445
  $_order->setSubtotal($subtotal);
446
  $_order->setGrandTotal($grandtotal);
447
- $_order->setBaseGrandTotal($grandtotal-$tax);
448
  $_order->save();
449
  $_order->sendNewOrderEmail();
450
 
 
 
451
  Mage::getSingleton('adminhtml/session_quote')->clear();
452
  Mage::unregister('rule_data');
453
 
@@ -484,11 +487,72 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
484
  return $invoice;
485
  }
486
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  /**
488
  * Setter for tracking number
489
  *
490
  * @param string $number
491
- * @return Iparcel_Shipping_Model_Api_External_Sales_Order
492
  */
493
  public function setTrackingNumber($number)
494
  {
@@ -500,11 +564,22 @@ class Iparcel_Shipping_Model_Api_External_Sales_Order extends Mage_Core_Model_Ab
500
  * Load an Order by Tracking Number
501
  *
502
  * @param string $trackingNumber
503
- * @return Iparcel_Shipping_Model_Api_External_Sales_Order
504
  */
505
  public function loadByTrackingNumber($trackingNumber)
506
  {
507
  $this->load($trackingNumber, 'tracking_number');
508
  return $this;
509
  }
 
 
 
 
 
 
 
 
 
 
 
510
  }
3
  * i-parcel External Sales API processing model
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order extends Mage_Core_Model_Abstract
10
  {
11
  /**
12
  * Initialize resource model
13
  */
14
  protected function _construct()
15
  {
16
+ $this->_init('ipglobalecommerce/api_order');
17
  }
18
 
19
  /**
20
  * Initialize adminhtml quote session
21
  *
22
+ * @return Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order
23
  */
24
  protected function _initSession()
25
  {
40
  /**
41
  * Processing quote
42
  *
43
+ * @return Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order
44
  */
45
  protected function _processQuote()
46
  {
69
  * Customer setter
70
  *
71
  * @param array $user, int $websiteId
72
+ * @return Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order
73
  */
74
  public function setCustomer($user, $websiteId)
75
  {
101
  * Customer Billing Address setter
102
  *
103
  * @param array $_address
104
+ * @return Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order
105
  */
106
  public function setCustomerBillingAddress($_address)
107
  {
131
  /**
132
  * Setting default billing address for customer
133
  *
134
+ * @return Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order
135
  */
136
  public function setDefaultCustomerBillingAddress()
137
  {
166
  * Customer Shipping Address setter
167
  *
168
  * @param array $_address
169
+ * @return Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order
170
  */
171
  public function setCustomerShippingAddress($_address)
172
  {
196
  /**
197
  * Setting default shipping address for customer
198
  *
199
+ * @return Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order
200
  */
201
  public function setDefaultCustomerShippingAddress()
202
  {
230
  /** Order data setter
231
  *
232
  * @param array $data
233
+ * @return Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order
234
  */
235
  public function setOrderData($data)
236
  {
320
  'telephone' => $_customerShippingAddress->getTelephone(),
321
  'fax' => ''
322
  ),
323
+ 'shipping_method' => $this->getCarrierCode() . '_auto',
324
  'comment' => array(
325
  'customer_note' => 'This order has been programmatically created via I-Parcel extension'
326
  ),
395
  // generate shipping rate
396
  $ship = Mage::getModel('shipping/rate_result_method');
397
  /* var $ship Mage_Shipping_Model_Rate_Result_Method */
398
+ $ship->setCarrier($this->getCarrierCode());
399
  $ship->setCarrierTitle('i-parcel');
400
  $ship->setMethod('auto');
401
  $ship->setMethodTitle('Auto');
402
  $ship->setPrice($shippingCosts);
403
  $ship->setCost($shippingCosts);
404
+ $ship->setMethodDescription('i-parcel Global eCommerce');
405
 
406
  // import order's post data and shipping rate
407
  $_orderCreator->importPostData($orderData['order'])
442
  $_order->setStoreCurrencyCode($currency);
443
  $_order->setOrderCurrencyCode($currency);
444
  $_order->setTaxAmount($tax);
445
+ $_order->setBaseTaxAmount($tax);
446
  $_order->setSubtotal($subtotal);
447
  $_order->setGrandTotal($grandtotal);
448
+ $_order->setBaseGrandTotal($grandtotal);
449
  $_order->save();
450
  $_order->sendNewOrderEmail();
451
 
452
+ $this->createShipment($_order);
453
+
454
  Mage::getSingleton('adminhtml/session_quote')->clear();
455
  Mage::unregister('rule_data');
456
 
487
  return $invoice;
488
  }
489
 
490
+ /**
491
+ * Create shipment for order, and add tracking number
492
+ *
493
+ * @param Mage_Sales_Model_Order $order
494
+ * @return bool
495
+ */
496
+ public function createShipment(Mage_Sales_Model_Order $order)
497
+ {
498
+ if ($order->canShip() == false) {
499
+ return false;
500
+ }
501
+
502
+ $converter = Mage::getModel('sales/convert_order');
503
+ $shipment = $converter->toShipment($order);
504
+
505
+ foreach ($order->getAllItems() as $orderItem) {
506
+ /** @var Mage_Sales_Model_Order_Item $orderItem */
507
+ // continue if it is virtual or there is no quantity to ship
508
+ if (!$orderItem->getQtyToShip()) {
509
+ continue;
510
+ }
511
+ if ($order->getIsVirtual()) {
512
+ continue;
513
+ }
514
+
515
+ /** @var Mage_Sales_Model_Order_Shipment_Item $item */
516
+ $item = $converter->itemToShipmentItem($orderItem);
517
+ $item->setQty($orderItem->getQtyToShip());
518
+ $shipment->addItem($item);
519
+ }
520
+
521
+ $shipment->register();
522
+ $order->setIsInProcess(true);
523
+
524
+ try {
525
+ /** @var Mage_Core_Model_Resource_Transaction $transactionSave */
526
+ $transactionSave = Mage::getModel('core/resource_transaction')
527
+ ->addObject($shipment)
528
+ ->addObject($order);
529
+ $transactionSave->save();
530
+ $shipment->save();
531
+ $shipment->sendEmail();
532
+ } catch (Exception $e) {
533
+ return false;
534
+ }
535
+
536
+ // Add tracking number to shipment
537
+ $track = Mage::getModel('sales/order_shipment_track')
538
+ ->setShipment($shipment);
539
+
540
+ $carrier = Mage::getModel('ipglobalecommerce/carrier_iparcel');
541
+
542
+ $track->setData('title', 'i-parcel Global eCommerce');
543
+ $track->setData('number', $this->getTrackingNumber());
544
+ $track->setData('carrier_code', $carrier->getCarrierCode());
545
+ $track->setData('order_id', $order->getId());
546
+ $track->save();
547
+
548
+ return true;
549
+ }
550
+
551
  /**
552
  * Setter for tracking number
553
  *
554
  * @param string $number
555
+ * @return Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order
556
  */
557
  public function setTrackingNumber($number)
558
  {
564
  * Load an Order by Tracking Number
565
  *
566
  * @param string $trackingNumber
567
+ * @return Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order
568
  */
569
  public function loadByTrackingNumber($trackingNumber)
570
  {
571
  $this->load($trackingNumber, 'tracking_number');
572
  return $this;
573
  }
574
+
575
+ /**
576
+ * Returns the carrier code for inserted orders
577
+ *
578
+ * @return string
579
+ */
580
+ public function getCarrierCode()
581
+ {
582
+ $carrier = Mage::getModel('ipglobalecommerce/carrier_iparcel');
583
+ return $carrier->getCarrierCode();
584
+ }
585
  }
app/code/community/Iparcel/GlobaleCommerce/Model/Carrier/Iparcel.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel shipping method model
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
10
+ {
11
+ protected $_code = 'i-parcel-globalecommerce';
12
+ protected $_carrier = 'i-parcel-globalecommerce';
13
+ protected $_isFixed = true;
14
+ protected $_trackingUrl = 'https://tracking.i-parcel.com/secure/track.aspx?track=';
15
+
16
+ /**
17
+ * Check if carrier has shipping label option available
18
+ *
19
+ * @return bool
20
+ */
21
+ public function isShippingLabelsAvailable()
22
+ {
23
+ return true;
24
+ }
25
+
26
+ /**
27
+ * Check if carrier has shipping tracking option available
28
+ *
29
+ * @return bool
30
+ */
31
+ public function isTrackingAvailable()
32
+ {
33
+ return true;
34
+ }
35
+
36
+ /**
37
+ * Get info for track order page
38
+ *
39
+ * @param string $number
40
+ * @return Varien_Object
41
+ */
42
+ public function getTrackingInfo($number)
43
+ {
44
+ return new Varien_Object(array(
45
+ 'tracking' => $number,
46
+ 'carrier_title' => $this->_carrier,
47
+ 'url' => $this->_trackingUrl.$number
48
+ ));
49
+ }
50
+
51
+ /**
52
+ * Do request to shipment
53
+ *
54
+ * @param Mage_Shipping_Model_Shipment_Request $request
55
+ * @return Varien_Object
56
+ */
57
+ public function requestToShipment(Mage_Shipping_Model_Shipment_Request $request)
58
+ {
59
+ $shipping = $request->getOrderShipment();
60
+ /* var $shipping Mage_Sales_Model_Order_Shipment */
61
+ $tracking = $shipping->getAllTracks();
62
+ if (empty($tracking)) {
63
+ Mage::throwException('Invalid Request To Shipment Call');
64
+ }
65
+ $tracking = $tracking[0];
66
+ /* var $tracking Mage_Sales_Model_Order_Shipment_Track */
67
+ // prepare label PDF
68
+ $pdf = new Zend_Pdf();
69
+ $number = $tracking->getNumber();
70
+ $pdfPage = $pdf->pages[] = new Zend_Pdf_Page(('162:75'));
71
+ $barcodeFont = Zend_Pdf_Font::fontWithPath(
72
+ Mage::getBaseDir('skin') . '/adminhtml/default/default/iparcel/font/code128.ttf'
73
+ );
74
+ $courier = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
75
+ $pdfPage->setFont($courier, 10);
76
+ $pdfPage->drawText($number, 15, 10);
77
+ $pdfPage->setFont($barcodeFont, 40);
78
+ $pdfPage->drawText($number, 15, 25);
79
+ $info = array();
80
+ $info[] = array(
81
+ 'label_content' => $pdf->render(),
82
+ 'tracking_number' => $number
83
+ );
84
+ // prepare response
85
+ $response = new Varien_Object();
86
+ $response->setTrackingNumer($number);
87
+ $response->setInfo($info);
88
+ return $response;
89
+ }
90
+
91
+ /**
92
+ * Always returns true. This is only used for inserted orders.
93
+ *
94
+ * @param Mage_Shipping_Model_Rate_Request $request
95
+ * @return Mage_Shipping_Model_Rate_Result|bool
96
+ */
97
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
98
+ {
99
+ return true;
100
+ }
101
+
102
+ /**
103
+ * Returns false to prevent the method from being visible to customers.
104
+ *
105
+ * @return array
106
+ */
107
+ public function getAllowedMethods()
108
+ {
109
+ return false;
110
+ }
111
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Config/Data/Date/Monthday.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Backend model for monthday 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_Data_Date_Monthday extends Mage_Core_Model_Config_Data
10
+ {
11
+ /**
12
+ * Saving monthday if proper value
13
+ */
14
+ public function save()
15
+ {
16
+ $_monthday = $this->getValue();
17
+ if (Mage::helper('ipglobalecommerce/string')->isInteger($_monthday) && $_monthday<=31 && $_monthday>0) {
18
+ return parent::save();
19
+ } else {
20
+ Mage::throwException(Mage::helper('ipglobalecommerce')->__('Wrong day of month'));
21
+ }
22
+ }
23
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Config/Data/Date/Weekday.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Backend model for weekday 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_Data_Date_Weekday extends Mage_Core_Model_Config_Data
10
+ {
11
+ /**
12
+ * Saving weekday if proper value
13
+ */
14
+ public function save()
15
+ {
16
+ $_weekday = $this->getValue();
17
+ if (Mage::helper('ipglobalecommerce/string')->isInteger($_weekday) && $_weekday<=7 && $_weekday>0) {
18
+ return parent::save();
19
+ } else {
20
+ Mage::throwException(Mage::helper('ipglobalecommerce')->__('Wrong day of week'));
21
+ }
22
+ }
23
+ }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Config/Data/Time/Hour.php RENAMED
@@ -3,10 +3,10 @@
3
  * Backend model for time hour config field
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Config_Data_Time_Hour extends Mage_Core_Model_Config_Data
10
  {
11
  /**
12
  * Saving hour if proper value
@@ -14,10 +14,10 @@ class Iparcel_Shipping_Model_Config_Data_Time_Hour extends Mage_Core_Model_Confi
14
  public function save()
15
  {
16
  $_hour = $this->getValue();
17
- if (Mage::helper('shippingip/string')->isInteger($_hour) && $_hour<24 && $_hour>=0) {
18
  return parent::save();
19
  } else {
20
- Mage::throwException(Mage::helper('shippingip')->__('Wrong hour'));
21
  }
22
  }
23
  }
3
  * Backend model for time hour 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_Data_Time_Hour extends Mage_Core_Model_Config_Data
10
  {
11
  /**
12
  * Saving hour if proper value
14
  public function save()
15
  {
16
  $_hour = $this->getValue();
17
+ if (Mage::helper('ipglobalecommerce/string')->isInteger($_hour) && $_hour<24 && $_hour>=0) {
18
  return parent::save();
19
  } else {
20
+ Mage::throwException(Mage::helper('ipglobalecommerce')->__('Wrong hour'));
21
  }
22
  }
23
  }
app/code/community/Iparcel/GlobaleCommerce/Model/Config/Data/Time/Minute.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Backend model for time minute 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_Data_Time_Minute extends Mage_Core_Model_Config_Data
10
+ {
11
+ /**
12
+ * Saving minute if proper value
13
+ */
14
+ public function save()
15
+ {
16
+ $_minute = $this->getValue();
17
+ if (Mage::helper('ipglobalecommerce/string')->isInteger($_minute) && $_minute<60 && $_minute>=0) {
18
+ return parent::save();
19
+ } else {
20
+ Mage::throwException(Mage::helper('ipglobalecommerce')->__('Wrong minute'));
21
+ }
22
+ }
23
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Config/Script/Js.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
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';
13
+
14
+ /**
15
+ * Method called before config save
16
+ * Unlinking old or deleted file
17
+ */
18
+ protected function _beforeSave()
19
+ {
20
+ $uploadDir = $this->_getUploadDir();
21
+
22
+ $file = $uploadDir.'/'.$this->getValue();
23
+
24
+ // if it's delete action and file exists
25
+ if ($delete && file_exists($file)) {
26
+ unlink($file);
27
+ }
28
+
29
+ // if it's set new action and old file exists
30
+ $file = $uploadDir.'/'. $_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
31
+ if (file_exists($file)) {
32
+ unlink($file);
33
+ }
34
+ parent::_beforeSave();
35
+ }
36
+
37
+ /**
38
+ * Getting directory where scripts are uploaded
39
+ *
40
+ * @param string $field
41
+ * @return string
42
+ */
43
+ public function getUploadDir($field)
44
+ {
45
+ $uploadDir = self::UPLOAD_DIR;
46
+
47
+ $uploadDir = $uploadDir.'/'.$field. '/';
48
+ return $uploadDir;
49
+ }
50
+
51
+ /**
52
+ * Getting directory wher to upload
53
+ *
54
+ * @return string
55
+ */
56
+ protected function _getUploadDir()
57
+ {
58
+ $uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT);
59
+ $uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR.'/'.$this->getField());
60
+
61
+ $uploadDir = $uploadRoot .'/'. $uploadDir;
62
+ return $uploadDir;
63
+ }
64
+
65
+ /**
66
+ * Returning if scope info should be added
67
+ *
68
+ * @return bool
69
+ */
70
+ protected function _addWhetherScopeInfo()
71
+ {
72
+ return true;
73
+ }
74
+
75
+ /**
76
+ * Returning array of proper extensions
77
+ *
78
+ * @return array
79
+ */
80
+ protected function _getAllowedExtensions()
81
+ {
82
+ return array('js');
83
+ }
84
+
85
+ /**
86
+ * Getting upload root directory
87
+ *
88
+ * @return string
89
+ */
90
+ protected function _getUploadRoot($token)
91
+ {
92
+ return Mage::getBaseDir()."/$token";
93
+ }
94
+ }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Cpf.php RENAMED
@@ -3,17 +3,17 @@
3
  * Db model for cpfs' types
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Cpf extends Mage_Core_Model_Abstract
10
  {
11
  /**
12
  * Initializing model in internal constructor
13
  */
14
  protected function _construct()
15
  {
16
- $this->_init('shippingip/cpf');
17
  }
18
 
19
  /**
@@ -28,7 +28,7 @@ class Iparcel_Shipping_Model_Cpf extends Mage_Core_Model_Abstract
28
  * Load CPF by country code
29
  *
30
  * @param string $code, string $attributes
31
- * @return Iparcel_Shipping_Model_Cpf
32
  */
33
  public function loadByCountryCode($code, $attributes = '*')
34
  {
3
  * Db model for cpfs' types
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Model_Cpf extends Mage_Core_Model_Abstract
10
  {
11
  /**
12
  * Initializing model in internal constructor
13
  */
14
  protected function _construct()
15
  {
16
+ $this->_init('ipglobalecommerce/cpf');
17
  }
18
 
19
  /**
28
  * Load CPF by country code
29
  *
30
  * @param string $code, string $attributes
31
+ * @return Iparcel_GlobaleCommerce_Model_Cpf
32
  */
33
  public function loadByCountryCode($code, $attributes = '*')
34
  {
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Cpf/Order.php RENAMED
@@ -3,24 +3,24 @@
3
  * Db model for order's cpfs' values
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Cpf_Order extends Mage_Core_Model_Abstract
10
  {
11
  /**
12
  * Initializing model in internal constructor
13
  */
14
  protected function _construct()
15
  {
16
- $this->_init('shippingip/cpf_order');
17
  }
18
 
19
  /**
20
  * Load CPF by order_id
21
  *
22
  * @param int $orderId, string $fields='*'
23
- * @return Iparcel_Shipping_Model_Cpf_Order
24
  */
25
  public function loadByOrderId($orderId, $fields = '*')
26
  {
3
  * Db model for order's cpfs' values
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Model_Cpf_Order extends Mage_Core_Model_Abstract
10
  {
11
  /**
12
  * Initializing model in internal constructor
13
  */
14
  protected function _construct()
15
  {
16
+ $this->_init('ipglobalecommerce/cpf_order');
17
  }
18
 
19
  /**
20
  * Load CPF by order_id
21
  *
22
  * @param int $orderId, string $fields='*'
23
+ * @return Iparcel_GlobaleCommerce_Model_Cpf_Order
24
  */
25
  public function loadByOrderId($orderId, $fields = '*')
26
  {
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Cpf/Quote.php RENAMED
@@ -3,24 +3,24 @@
3
  * Db model for quote's cpfs' values
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Cpf_Quote extends Mage_Core_Model_Abstract
10
  {
11
  /**
12
  * Initializing model in internal constructor
13
  */
14
  protected function _construct()
15
  {
16
- $this->_init('shippingip/cpf_quote');
17
  }
18
 
19
  /**
20
  * Load CPF by quote_id
21
  *
22
  * @param int $quoteId, string $fields='*'
23
- * @return Iparcel_Shipping_Model_Cpf_Quote
24
  */
25
  public function loadByQuoteId($quoteId, $fields = '*')
26
  {
3
  * Db model for quote's cpfs' values
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Model_Cpf_Quote extends Mage_Core_Model_Abstract
10
  {
11
  /**
12
  * Initializing model in internal constructor
13
  */
14
  protected function _construct()
15
  {
16
+ $this->_init('ipglobalecommerce/cpf_quote');
17
  }
18
 
19
  /**
20
  * Load CPF by quote_id
21
  *
22
  * @param int $quoteId, string $fields='*'
23
+ * @return Iparcel_GlobaleCommerce_Model_Cpf_Quote
24
  */
25
  public function loadByQuoteId($quoteId, $fields = '*')
26
  {
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Observer.php RENAMED
@@ -1,21 +1,20 @@
1
  <?php
2
  /**
3
  * @category Iparcel
4
- * @package Iparcel_Shipping
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
  */
7
- class Iparcel_Shipping_Model_Observer
8
  {
9
  const MAGE_ORDER_MODEL = 'Mage_Sales_Model_Order';
10
- const IPARCEL_ORDER_MODEL = 'Iparcel_Shipping_Model_Sales_Order';
11
- const IPARCEL_DYNAMIC_ORDER_MODEL = 'Iparcel_Shipping_Model_Sales_Order_Extend';
12
 
13
  protected $_eventFlag = true;
14
  protected $_filePath = null;
15
 
16
  public function __construct()
17
  {
18
- $this->_filePath = Mage::getBaseDir('cache') . DS . self::IPARCEL_DYNAMIC_ORDER_MODEL . '.php';
19
  }
20
 
21
  /**
@@ -80,7 +79,7 @@ class Iparcel_Shipping_Model_Observer
80
  }
81
 
82
  /**
83
- * Remove Iparcel_Shipping_Model_Sales_Order_Extend file when flush or refresh cache
84
  */
85
  public function removeExtendFile($observer)
86
  {
1
  <?php
2
  /**
3
  * @category Iparcel
4
+ * @package Iparcel_GlobaleCommerce
5
+ * @author Bobby Burden <bburden@i-parcel.com>
6
  */
7
+ class Iparcel_GlobaleCommerce_Model_Observer
8
  {
9
  const MAGE_ORDER_MODEL = 'Mage_Sales_Model_Order';
10
+ const IPARCEL_ORDER_MODEL = 'Iparcel_GlobaleCommerce_Model_Sales_Order';
 
11
 
12
  protected $_eventFlag = true;
13
  protected $_filePath = null;
14
 
15
  public function __construct()
16
  {
17
+ $this->_filePath = Mage::getBaseDir('cache') . DS . self::IPARCEL_ORDER_MODEL . '.php';
18
  }
19
 
20
  /**
79
  }
80
 
81
  /**
82
+ * Remove Iparcel_GlobaleCommerce_Model_Sales_Order_Extend file when flush or refresh cache
83
  */
84
  public function removeExtendFile($observer)
85
  {
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Parcel.php RENAMED
@@ -3,24 +3,24 @@
3
  * Db model for cpfs' types
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Parcel extends Mage_Core_Model_Abstract
10
  {
11
  /**
12
  * Initializing model in internal constructor
13
  */
14
  protected function _construct()
15
  {
16
- $this->_init('shippingip/parcel');
17
  }
18
 
19
  /**
20
  * Load Parcel by Order ID
21
  *
22
  * @param string $orderId, string $attributes
23
- * @return Iparcel_Shipping_Model_Cpf
24
  */
25
  public function loadByOrderId($orderId, $attributes = '*')
26
  {
3
  * Db model for cpfs' types
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Model_Parcel extends Mage_Core_Model_Abstract
10
  {
11
  /**
12
  * Initializing model in internal constructor
13
  */
14
  protected function _construct()
15
  {
16
+ $this->_init('ipglobalecommerce/parcel');
17
  }
18
 
19
  /**
20
  * Load Parcel by Order ID
21
  *
22
  * @param string $orderId, string $attributes
23
+ * @return Iparcel_GlobaleCommerce_Model_Cpf
24
  */
25
  public function loadByOrderId($orderId, $attributes = '*')
26
  {
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Payment/Iparcel.php RENAMED
@@ -3,13 +3,13 @@
3
  * Class for i-parcel external sales API payment method
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Payment_Iparcel extends Mage_Payment_Model_Method_Abstract
10
  {
11
  protected $_code = 'iparcel';
12
- protected $_infoBlockType = 'shippingip/payment_info';
13
  protected $_canUseCheckout = false;
14
  protected $_canUseForMultishipping = false;
15
  protected $_canUseInternal = false;
3
  * Class for i-parcel external sales API payment method
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Model_Payment_Iparcel extends Mage_Payment_Model_Method_Abstract
10
  {
11
  protected $_code = 'iparcel';
12
+ protected $_infoBlockType = 'ipglobalecommerce/payment_info';
13
  protected $_canUseCheckout = false;
14
  protected $_canUseForMultishipping = false;
15
  protected $_canUseInternal = false;
app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Api/Order.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Model for Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Resource_Api_Order extends Mage_Core_Model_Resource_Db_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('ipglobalecommerce/api_order', 'id');
17
+ }
18
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Model for Iparcel_GlobaleCommerce_Model_Cpf class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Resource_Cpf extends Mage_Core_Model_Resource_Db_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('ipglobalecommerce/cpf', 'id');
17
+ }
18
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf/Collection.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Collection Model for Iparcel_GlobaleCommerce_Model_Cpf class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Resource_Cpf_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource Collection
13
+ */
14
+ public function _construct()
15
+ {
16
+ $this->_init('ipglobalecommerce/cpf');
17
+ }
18
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf/Order.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Model for Iparcel_GlobaleCommerce_Model_Cpf_Order class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Resource_Cpf_Order extends Mage_Core_Model_Resource_Db_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('ipglobalecommerce/cpf_order', 'id');
17
+ }
18
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf/Order/Collection.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Collection Model for Iparcel_GlobaleCommerce_Model_Cpf_Order class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Resource_Cpf_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource Collection
13
+ */
14
+ public function _construct()
15
+ {
16
+ $this->_init('ipglobalecommerce/cpf_order');
17
+ }
18
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf/Quote.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Model for Iparcel_GlobaleCommerce_Model_Cpf_Quote class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Resource_Cpf_Quote extends Mage_Core_Model_Resource_Db_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('ipglobalecommerce/cpf_quote', 'id');
17
+ }
18
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Cpf/Quote/Collection.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Collection Model for Iparcel_GlobaleCommerce_Model_Cpf_Quote class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Resource_Cpf_Quote_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource Collection
13
+ */
14
+ public function _construct()
15
+ {
16
+ $this->_init('ipglobalecommerce/cpf_quote');
17
+ }
18
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Parcel.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Model for Iparcel_GlobaleCommerce_Model_Cpf class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Resource_Parcel extends Mage_Core_Model_Resource_Db_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('ipglobalecommerce/parcel', 'id');
17
+ }
18
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Parcel/Collection.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resource Collection Model for Iparcel_GlobaleCommerce_Model_Cpf class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Resource_Parcel_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
+ {
11
+ /**
12
+ * Initializing Resource Collection
13
+ */
14
+ public function _construct()
15
+ {
16
+ $this->_init('ipglobalecommerce/parcel');
17
+ }
18
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Resource/Setup.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Setup Resource class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
10
+ {
11
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/Sales/Order/Observer.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sales_Order observer class
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_Sales_Order_Observer
10
+ {
11
+ /**
12
+ * Initializing CPF
13
+ *
14
+ * @param Mage_Sales_Model_Order $order
15
+ */
16
+ protected function _initCpf($order)
17
+ {
18
+ $cpf = Mage::getModel('ipglobalecommerce/cpf_order')->loadByOrderId($order->getId());
19
+ /* var $cpf Iparcel_GlobaleCommerce_Model_Cpf_Order */
20
+ if ($cpf->getId()) {
21
+ $order->setCpf($cpf->getValue());
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Initializing Parcel
27
+ *
28
+ * @param Mage_Sales_Model_Order $order
29
+ */
30
+ protected function _initParcel($order)
31
+ {
32
+ $parcel = Mage::getModel('ipglobalecommerce/parcel')->loadByOrderId($order->getId());
33
+ if ($parcel->getParcelId()) {
34
+ $order->setParcel($parcel->getParcelId());
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Searching for traching number in order comments
40
+ *
41
+ * @param Mage_Sales_Model_Order $order
42
+ * @return Mage_Sales_Model_Order_Status_History
43
+ */
44
+ protected function _searchForTrackingNumber($order)
45
+ {
46
+ foreach ($order->getStatusHistoryCollection() as $status) {
47
+ /* var $status Mage_Sales_Model_Order_Status_History */
48
+ if (preg_match('/^i-parcel tracking number: ([0-9A-Z]+)$/', $status->getComment()) == 1) {
49
+ return $status;
50
+ }
51
+ }
52
+ return null;
53
+ }
54
+
55
+ /**
56
+ * Creating CPF for an order
57
+ *
58
+ * @param Mage_Sales_Model_Order $order
59
+ */
60
+ protected function _createCpf($order)
61
+ {
62
+ if ($quote = $order->getQuote()) {
63
+ /* var $quote Mage_Sales_Model_Quote */
64
+ $cpf = Mage::getModel('ipglobalecommerce/cpf_order')->loadByOrderId($order->getId());
65
+ /* var $cpf Iparcel_GlobaleCommerce_Model_Cpf_Order */
66
+ // create CPF for order if quote has CPF
67
+ if ($quote->getCpf()) {
68
+ $cpf->setOrderId($order->getId());
69
+ $cpf->setValue($quote->getCpf());
70
+ $cpf->save();
71
+ } elseif ($cpf->getId()) {
72
+ $cpf->delete();
73
+ }
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Creating Parcel for an order
79
+ *
80
+ * @param Mage_Sales_Model_Order $order
81
+ */
82
+ protected function _createParcel($order, $parcel_id)
83
+ {
84
+ $parcel = Mage::getModel('ipglobalecommerce/parcel')
85
+ ->setOrderId($order->getId())
86
+ ->setParcelId($parcel_id);
87
+ $parcel->save();
88
+ }
89
+
90
+ /**
91
+ * Setting order prefix for an order
92
+ *
93
+ * @param Mage_Sales_Model_Order $order
94
+ */
95
+ protected function _setOrderPrefix($order)
96
+ {
97
+ // if prefix is specified and shipping carrier is i-parcel
98
+ if (Mage::getStoreConfig('carriers/i-parcel/prefix') && $order->getShippingCarrier()->getCarrierCode() == 'i-parcel') {
99
+ // and there's no prefix at the beginning
100
+ if (strpos($order->getIncrementId(), Mage::getStoreConfig('carriers/i-parcel/prefix')) !== 0) {
101
+ // add prefix at the beginning of increment ID
102
+ $order->setIncrementId(Mage::getStoreConfig('carriers/i-parcel/prefix').$order->getIncrementId());
103
+ }
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Handling external sales API orders
109
+ * Setting choosen order status
110
+ *
111
+ * @param Mage_Sales_Model_Order $order
112
+ */
113
+ protected function _handleExternal($order)
114
+ {
115
+ // if external sale is registered and choosen order status is not STATE_COMPLETE
116
+ if (Mage::registry('isExternalSale') && ($status=Mage::getStoreConfig('external_api/sales/order_status')) != Mage_Sales_Model_Order::STATE_COMPLETE) {
117
+ // set new state
118
+ $order->setState($status, $status);
119
+ }
120
+ }
121
+
122
+ /**
123
+ * sales_order_save_before event handler
124
+ */
125
+ public function before_save($observer)
126
+ {
127
+ $order = $observer->getOrder();
128
+ $this->_setOrderPrefix($order);
129
+ $this->_handleExternal($order);
130
+ }
131
+
132
+ /**
133
+ * sales_order_save_after event handler
134
+ */
135
+ public function after_save($observer)
136
+ {
137
+ $order = $observer->getOrder();
138
+ $this->_createCpf($order);
139
+ }
140
+
141
+ /**
142
+ * sales_order_load_after event handler
143
+ */
144
+ public function after_load($observer)
145
+ {
146
+ $order = $observer->getOrder();
147
+ $this->_initCpf($order);
148
+ $this->_initParcel($order);
149
+ }
150
+
151
+ /**
152
+ * sales_order_place_after event handler
153
+ * @param Varien_Event_Observer $observer
154
+ */
155
+ public function after_place(Varien_Event_Observer $observer)
156
+ {
157
+ /** @var Mage_Sales_Model_Order $order */
158
+ $order = $observer->getOrder();
159
+ $this->_createParcel($order, Mage::getSingleton('checkout/session')->getParcelId());
160
+ }
161
+ }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/Sales/Quote/Observer.php RENAMED
@@ -3,10 +3,10 @@
3
  * Sales_Quote observer class
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_Sales_Quote_Observer
10
  {
11
  /**
12
  * sales_quote_save_before event handler
@@ -35,8 +35,8 @@ class Iparcel_Shipping_Model_Sales_Quote_Observer
35
  $quote = $observer->getQuote();
36
  /* var $quote Mage_Sales_Model_Quote */
37
  // creating CPF for quote
38
- $cpf = Mage::getModel('shippingip/cpf_quote')->loadByQuoteId($quote->getId());
39
- /* var $cpf Iparcel_Shipping_Model_Cpf_Quote */
40
  if ($quote->getCpf() !== null) {
41
  $cpf->setQuoteId($quote->getId());
42
  $cpf->setValue($quote->getCpf());
@@ -54,8 +54,8 @@ class Iparcel_Shipping_Model_Sales_Quote_Observer
54
  $quote = $observer->getQuote();
55
  /* var $quote Mage_Sales_Model_Quote */
56
  // appending existing cpf to loaded quote
57
- $cpf = Mage::getModel('shippingip/cpf_quote')->loadByQuoteId($quote->getId());
58
- /* var $cpf Iparcel_Shipping_Model_Cpf_Quote */
59
  if ($cpf->getId()) {
60
  $quote->setCpf($cpf->getValue());
61
  }
3
  * Sales_Quote observer class
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Model_Sales_Quote_Observer
10
  {
11
  /**
12
  * sales_quote_save_before event handler
35
  $quote = $observer->getQuote();
36
  /* var $quote Mage_Sales_Model_Quote */
37
  // creating CPF for quote
38
+ $cpf = Mage::getModel('ipglobalecommerce/cpf_quote')->loadByQuoteId($quote->getId());
39
+ /* var $cpf Iparcel_GlobaleCommerce_Model_Cpf_Quote */
40
  if ($quote->getCpf() !== null) {
41
  $cpf->setQuoteId($quote->getId());
42
  $cpf->setValue($quote->getCpf());
54
  $quote = $observer->getQuote();
55
  /* var $quote Mage_Sales_Model_Quote */
56
  // appending existing cpf to loaded quote
57
+ $cpf = Mage::getModel('ipglobalecommerce/cpf_quote')->loadByQuoteId($quote->getId());
58
+ /* var $cpf Iparcel_GlobaleCommerce_Model_Cpf_Quote */
59
  if ($cpf->getId()) {
60
  $quote->setCpf($cpf->getValue());
61
  }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/System/Config/Source/Catalog/Product/Attribute.php RENAMED
@@ -3,10 +3,10 @@
3
  * Source model class for backend config fields with product atributes list
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_System_Config_Source_Catalog_Product_Attribute
10
  {
11
  /**
12
  * Options list
3
  * Source model class for backend config fields with product atributes list
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Model_System_Config_Source_Catalog_Product_Attribute
10
  {
11
  /**
12
  * Options list
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/Model/System/Config/Source/Catalog/Product/Attribute/Boolean.php RENAMED
@@ -3,10 +3,10 @@
3
  * Source model class for backend config fields with boolean product atributes
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_Model_System_Config_Source_Catalog_Product_Attribute_Boolean
10
  {
11
  /**
12
  * Options list
3
  * Source model class for backend config fields with boolean product atributes
4
  *
5
  * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_Model_System_Config_Source_Catalog_Product_Attribute_Boolean
10
  {
11
  /**
12
  * Options list
app/code/community/Iparcel/GlobaleCommerce/Model/System/Config/Source/Date/Weekday.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Source model for catalog_mapping/config/cron_weekday config field
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_System_Config_Source_Date_Weekday
10
+ {
11
+ /**
12
+ * Options list
13
+ *
14
+ * @return array
15
+ */
16
+ public function toOptionArray()
17
+ {
18
+ $array = array();
19
+ for ($i=1; $i<8; $i++) {
20
+ $time = mktime(0, 0, 0, 1, $i, 1970);
21
+ $dayofweek = date('N', $time);
22
+ $array[$dayofweek] = array(
23
+ 'value' => $dayofweek,
24
+ 'label' => Mage::helper('ipglobalecommerce')->__(date('l', $time))
25
+ );
26
+ }
27
+ ksort($array, SORT_NUMERIC);
28
+ return $array;
29
+ }
30
+ }
app/code/community/Iparcel/GlobaleCommerce/Model/System/Config/Source/Sales/Order/Status.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Source model class for external_api/sales/order_status config field
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_GlobaleCommerce_Model_System_Config_Source_Sales_Order_Status
10
+ {
11
+ /**
12
+ * Options list
13
+ *
14
+ * @return array
15
+ */
16
+ public function toOptionArray()
17
+ {
18
+ return array(
19
+ array('value' => Mage_Sales_Model_Order::STATE_COMPLETE, 'label' => Mage::helper('ipglobalecommerce')->__('Complete')),
20
+ array('value' => 'pending', 'label' => Mage::helper('ipglobalecommerce')->__('Pending')),
21
+ array('value' => Mage_Sales_Model_Order::STATE_PROCESSING, 'label' => Mage::helper('ipglobalecommerce')->__('Processing'))
22
+ );
23
+ }
24
+ }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/controllers/AjaxController.php RENAMED
@@ -3,10 +3,10 @@
3
  * i-parcel frontend ajax controller
4
  *
5
  * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_AjaxController extends Mage_Core_Controller_Front_Action
10
  {
11
  /**
12
  * Configurable products action for post script
@@ -46,9 +46,7 @@ class Iparcel_Shipping_AjaxController extends Mage_Core_Controller_Front_Action
46
  }
47
  }
48
 
49
- if (is_object($child)) {
50
- $sku = $child->getSku();
51
- }
52
 
53
  } else {
54
  /**
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
46
  }
47
  }
48
 
49
+ $sku = $child->getSku();
 
 
50
 
51
  } else {
52
  /**
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/controllers/DevController.php RENAMED
@@ -2,11 +2,11 @@
2
  /**
3
  * External Ajax request controller
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_DevController extends Mage_Core_Controller_Front_Action
10
  {
11
  /**
12
  * Preparing headers for external ajax
@@ -81,13 +81,4 @@ class Iparcel_Shipping_DevController extends Mage_Core_Controller_Front_Action
81
  echo $e->getMessage();
82
  }
83
  }
84
-
85
- public function orderAction()
86
- {
87
- $requestString = 'user[email]=tester@i-parcel.com&user[firstname]=Stefan&user[lastname]=eCom-Test&user[password]=nopassword&user[address][new]=1&user[address][firstname]=Stefan&user[address][lastname]=eCom-Test&user[address][street]=25 Test St &user[address][city]=York&user[address][region_id]=PA&user[address][postcode]=555555&user[address][country_id]=GB&user[address][telephone]=555-555-5555&key=63288480-915F-4DBD-9913-AD710742AC9E&tax=78.36&shipping=24.72&currency=USD&tracking[email]=tester@i-parcel.com&tracking[number]=1205535867US&orders[0][sku]=hdb008&orders[0][qty]=1&orders[0][price]=240.00';
88
-
89
- parse_str($requestString, $data);
90
-
91
- $this->_forward('add', 'order', 'shippingip', $data);
92
- }
93
  }
2
  /**
3
  * External Ajax request controller
4
  *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_DevController extends Mage_Core_Controller_Front_Action
10
  {
11
  /**
12
  * Preparing headers for external ajax
81
  echo $e->getMessage();
82
  }
83
  }
 
 
 
 
 
 
 
 
 
84
  }
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/controllers/InternationalController.php RENAMED
@@ -2,11 +2,11 @@
2
  /**
3
  * i-parcel International Customer controller
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_InternationalController extends Mage_Core_Controller_Front_Action
10
  {
11
  /**
12
  * Preparing headers for external ajax
@@ -24,11 +24,11 @@ class Iparcel_Shipping_InternationalController extends Mage_Core_Controller_Fron
24
  public function enableAction()
25
  {
26
  $this->_prepareHeaders();
27
- $current = Mage::helper('shippingip/international')->getInternational();
28
  if ($current) {
29
  echo 'false';
30
  } else {
31
- Mage::helper('shippingip/international')->setInternational(true);
32
  echo 'true';
33
  }
34
  }
@@ -39,9 +39,9 @@ class Iparcel_Shipping_InternationalController extends Mage_Core_Controller_Fron
39
  public function disableAction()
40
  {
41
  $this->_prepareHeaders();
42
- $current = Mage::helper('shippingip/international')->getInternational();
43
  if ($current) {
44
- Mage::helper('shippingip/international')->setInternational(false);
45
  echo 'true';
46
  } else {
47
  echo 'false';
2
  /**
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
  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
  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';
app/code/community/Iparcel/{Shipping → GlobaleCommerce}/controllers/OrderController.php RENAMED
@@ -2,11 +2,11 @@
2
  /**
3
  * External API order controller
4
  *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_Shipping_OrderController extends Mage_Core_Controller_Front_Action
10
  {
11
  /**
12
  * Checking if external sales API is enabled
@@ -37,11 +37,11 @@ class Iparcel_Shipping_OrderController extends Mage_Core_Controller_Front_Action
37
  Mage::throwException('Wrong HTTP request');
38
  }
39
  // checking if POST GUID key is correct
40
- if (strcasecmp($request->getPost('key'), Mage::helper('shippingip')->getGuid())) {
41
  Mage::throwException('Wrong GUID key');
42
  }
43
  // checking if request IP is allowed
44
- if (!Mage::helper('shippingip/api_external')->isAllowed()) {
45
  Mage::throwException('Access Forbidden');
46
  }
47
  return $request;
@@ -70,8 +70,8 @@ class Iparcel_Shipping_OrderController extends Mage_Core_Controller_Front_Action
70
  $currency = $request->getPost('currency');
71
  $tracking = $request->getPost('tracking');
72
 
73
- /** @var Iparcel_Shipping_Model_Api_External_Sales_Order $model */
74
- $model = Mage::getModel('shippingip/api_external_sales_order');
75
 
76
  // Make sure that an order doesn't already exist for this request
77
  $model->loadByTrackingNumber($tracking['number']);
@@ -211,14 +211,16 @@ class Iparcel_Shipping_OrderController extends Mage_Core_Controller_Front_Action
211
  * Split the SKU options into an array of:
212
  * [optionID] => optionValueID
213
  */
214
- $optionsValues = preg_split('/_/', $splitSku[1]);
215
- foreach($optionsValues as $key => $optionValue) {
216
- unset($optionsValues[$key]);
217
- $split = preg_split('/-/', $optionValue);
218
- $optionsValues[$split[0]] = $split[1];
219
- }
 
220
 
221
- $order['options'] = $optionsValues;
 
222
  }
223
 
224
  return $orders;
2
  /**
3
  * External API order controller
4
  *
5
+ * @category Iparcel
6
+ * @package Iparcel_GlobaleCommerce
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_GlobaleCommerce_OrderController extends Mage_Core_Controller_Front_Action
10
  {
11
  /**
12
  * Checking if external sales API is enabled
37
  Mage::throwException('Wrong HTTP request');
38
  }
39
  // checking if POST GUID key is correct
40
+ if (strcasecmp($request->getPost('key'), Mage::helper('ipglobalecommerce')->getGuid())) {
41
  Mage::throwException('Wrong GUID key');
42
  }
43
  // checking if request IP is allowed
44
+ if (!Mage::helper('ipglobalecommerce/api_external')->isAllowed()) {
45
  Mage::throwException('Access Forbidden');
46
  }
47
  return $request;
70
  $currency = $request->getPost('currency');
71
  $tracking = $request->getPost('tracking');
72
 
73
+ /** @var Iparcel_GlobaleCommerce_Model_Api_External_Sales_Order $model */
74
+ $model = Mage::getModel('ipglobalecommerce/api_external_sales_order');
75
 
76
  // Make sure that an order doesn't already exist for this request
77
  $model->loadByTrackingNumber($tracking['number']);
211
  * Split the SKU options into an array of:
212
  * [optionID] => optionValueID
213
  */
214
+ if (count($splitSku) > 1) {
215
+ $optionsValues = preg_split('/_/', $splitSku[1]);
216
+ foreach($optionsValues as $key => $optionValue) {
217
+ unset($optionsValues[$key]);
218
+ $split = preg_split('/-/', $optionValue);
219
+ $optionsValues[$split[0]] = $split[1];
220
+ }
221
 
222
+ $order['options'] = $optionsValues;
223
+ }
224
  }
225
 
226
  return $orders;
app/code/community/Iparcel/GlobaleCommerce/etc/adminhtml.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <menu>
3
+ <iparcel>
4
+ <title>i-parcel</title>
5
+ <children>
6
+ <external_api translate="title" module="ipglobalecommerce">
7
+ <title>External API</title>
8
+ <sort_order>15</sort_order>
9
+ <action>adminhtml/system_config/edit/section/external_api</action>
10
+ </external_api>
11
+ </children>
12
+ </iparcel>
13
+ </menu>
14
+ </config>
app/code/community/Iparcel/GlobaleCommerce/etc/config.xml ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Iparcel_GlobaleCommerce>
5
+ <version>3.0.0</version>
6
+ </Iparcel_GlobaleCommerce>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <ipglobalecommerce>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Iparcel_GlobaleCommerce</module>
14
+ <frontName>ipglobalecommerce</frontName>
15
+ </args>
16
+ </ipglobalecommerce>
17
+ <shippingip>
18
+ <use>standard</use>
19
+ <args>
20
+ <module>Iparcel_GlobaleCommerce</module>
21
+ <frontName>shippingip</frontName>
22
+ </args>
23
+ </shippingip>
24
+ </routers>
25
+ <layout>
26
+ <updates>
27
+ <ipglobalecommerce>
28
+ <file>externalshipping.xml</file>
29
+ </ipglobalecommerce>
30
+ </updates>
31
+ </layout>
32
+ </frontend>
33
+ <admin>
34
+ <routers>
35
+ <adminhtml>
36
+ <args>
37
+ <modules>
38
+ <ipglobalecommerce after="Mage_Adminhtml">Iparcel_GlobaleCommerce_Adminhtml</ipglobalecommerce>
39
+ </modules>
40
+ </args>
41
+ </adminhtml>
42
+ </routers>
43
+ </admin>
44
+ <adminhtml>
45
+ <layout>
46
+ <updates>
47
+ <ipglobalecommerce>
48
+ <file>externalsales.xml</file>
49
+ </ipglobalecommerce>
50
+ </updates>
51
+ </layout>
52
+ <acl>
53
+ <resources>
54
+ <admin>
55
+ <children>
56
+ <system>
57
+ <children>
58
+ <config>
59
+ <children>
60
+ <salesrules>
61
+ <title>i-parcel Sales Rules Synchronization</title>
62
+ </salesrules>
63
+ <external_api>
64
+ <title>i-parcel External API</title>
65
+ </external_api>
66
+ <iparcel>
67
+ <title>i-parcel Configuration</title>
68
+ </iparcel>
69
+ </children>
70
+ </config>
71
+ </children>
72
+ </system>
73
+ </children>
74
+ </admin>
75
+ </resources>
76
+ </acl>
77
+ </adminhtml>
78
+ <global>
79
+ <models>
80
+ <ipglobalecommerce>
81
+ <class>Iparcel_GlobaleCommerce_Model</class>
82
+ <resourceModel>ipglobalecommerce_resource</resourceModel>
83
+ </ipglobalecommerce>
84
+ <ipglobalecommerce_resource>
85
+ <class>Iparcel_GlobaleCommerce_Model_Resource</class>
86
+ <entities>
87
+ <api_order>
88
+ <table>iparcel_shipping_api_order</table>
89
+ </api_order>
90
+ <cpf>
91
+ <table>iparcel_shipping_cpf</table>
92
+ </cpf>
93
+ <cpf_order>
94
+ <table>iparcel_shipping_cpf_order</table>
95
+ </cpf_order>
96
+ <cpf_quote>
97
+ <table>iparcel_shipping_cpf_quote</table>
98
+ </cpf_quote>
99
+ <parcel>
100
+ <table>iparcel_shipping_parcel</table>
101
+ </parcel>
102
+ </entities>
103
+ </ipglobalecommerce_resource>
104
+ </models>
105
+ <events>
106
+ <sales_order_load_after>
107
+ <observers>
108
+ <iparcel_sales_order_load_after_observer>
109
+ <type>singleton</type>
110
+ <class>Iparcel_GlobaleCommerce_Model_Sales_Order_Observer</class>
111
+ <method>after_load</method>
112
+ </iparcel_sales_order_load_after_observer>
113
+ </observers>
114
+ </sales_order_load_after>
115
+ <sales_order_place_after>
116
+ <observers>
117
+ <iparcel_sales_order_place_after_observer>
118
+ <type>singleton</type>
119
+ <class>Iparcel_GlobaleCommerce_Model_Sales_Order_Observer</class>
120
+ <method>after_place</method>
121
+ </iparcel_sales_order_place_after_observer>
122
+ </observers>
123
+ </sales_order_place_after>
124
+ <sales_order_save_before>
125
+ <observers>
126
+ <iparcel_sales_order_save_before_observer>
127
+ <type>singleton</type>
128
+ <class>Iparcel_GlobaleCommerce_Model_Sales_Order_Observer</class>
129
+ <method>before_save</method>
130
+ </iparcel_sales_order_save_before_observer>
131
+ </observers>
132
+ </sales_order_save_before>
133
+ <sales_order_save_after>
134
+ <observers>
135
+ <iparcel_sales_order_save_after_observer>
136
+ <type>singleton</type>
137
+ <class>Iparcel_GlobaleCommerce_Model_Sales_Order_Observer</class>
138
+ <method>after_save</method>
139
+ </iparcel_sales_order_save_after_observer>
140
+ </observers>
141
+ </sales_order_save_after>
142
+ <sales_quote_load_after>
143
+ <observers>
144
+ <iparcel_sales_quote_load_after_observer>
145
+ <type>singleton</type>
146
+ <class>Iparcel_GlobaleCommerce_Model_Sales_Quote_Observer</class>
147
+ <method>after_load</method>
148
+ </iparcel_sales_quote_load_after_observer>
149
+ </observers>
150
+ </sales_quote_load_after>
151
+ <sales_quote_save_after>
152
+ <observers>
153
+ <iparcel_sales_quote_save_after_observer>
154
+ <type>singleton</type>
155
+ <class>Iparcel_GlobaleCommerce_Model_Sales_Quote_Observer</class>
156
+ <method>after_save</method>
157
+ </iparcel_sales_quote_save_after_observer>
158
+ </observers>
159
+ </sales_quote_save_after>
160
+ <sales_quote_save_before>
161
+ <observers>
162
+ <iparcel_sales_quote_save_before_observer>
163
+ <type>singleton</type>
164
+ <class>Iparcel_GlobaleCommerce_Model_Sales_Quote_Observer</class>
165
+ <method>before_save</method>
166
+ </iparcel_sales_quote_save_before_observer>
167
+ </observers>
168
+ </sales_quote_save_before>
169
+ <model_load_before>
170
+ <observers>
171
+ <iparcel_model_load_before_observer>
172
+ <type>singleton</type>
173
+ <class>Iparcel_GlobaleCommerce_Model_Observer</class>
174
+ <method>createCheckState</method>
175
+ </iparcel_model_load_before_observer>
176
+ </observers>
177
+ </model_load_before>
178
+ <adminhtml_cache_refresh_type>
179
+ <observers>
180
+ <iparcel_adminhtml_cache_refresh_type_observer>
181
+ <type>singleton</type>
182
+ <class>Iparcel_GlobaleCommerce_Model_Observer</class>
183
+ <method>removeExtendFile</method>
184
+ </iparcel_adminhtml_cache_refresh_type_observer>
185
+ </observers>
186
+ </adminhtml_cache_refresh_type>
187
+ <adminhtml_cache_flush_all>
188
+ <observers>
189
+ <iparcel_adminhtml_cache_flush_all_observer>
190
+ <type>singleton</type>
191
+ <class>Iparcel_GlobaleCommerce_Model_Observer</class>
192
+ <method>removeExtendFile</method>
193
+ </iparcel_adminhtml_cache_flush_all_observer>
194
+ </observers>
195
+ </adminhtml_cache_flush_all>
196
+ <adminhtml_cache_flush_system>
197
+ <observers>
198
+ <iparcel_adminhtml_cache_flush_system_observer>
199
+ <type>singleton</type>
200
+ <class>Iparcel_GlobaleCommerce_Model_Observer</class>
201
+ <method>removeExtendFile</method>
202
+ </iparcel_adminhtml_cache_flush_system_observer>
203
+ </observers>
204
+ </adminhtml_cache_flush_system>
205
+ </events>
206
+ <resources>
207
+ <ipglobalecommerce_setup>
208
+ <setup>
209
+ <module>Iparcel_GlobaleCommerce</module>
210
+ <class>Iparcel_GlobaleCommerce_Model_Resource_Setup</class>
211
+ </setup>
212
+ <connection>
213
+ <use>core_setup</use>
214
+ </connection>
215
+ </ipglobalecommerce_setup>
216
+ <ipglobalecommerce_write>
217
+ <connection>
218
+ <use>core_write</use>
219
+ </connection>
220
+ </ipglobalecommerce_write>
221
+ <ipglobalecommerce_read>
222
+ <connection>
223
+ <use>core_read</use>
224
+ </connection>
225
+ </ipglobalecommerce_read>
226
+ </resources>
227
+ <blocks>
228
+ <adminhtml>
229
+ <rewrite>
230
+ <sales_order_shipment_view_form>Iparcel_GlobaleCommerce_Block_Adminhtml_Sales_Order_Shipment_View_Form</sales_order_shipment_view_form>
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>
242
+ </blocks>
243
+ <helpers>
244
+ <ipglobalecommerce>
245
+ <class>Iparcel_GlobaleCommerce_Helper</class>
246
+ </ipglobalecommerce>
247
+ <sales>
248
+ <rewrite>
249
+ <data>Iparcel_GlobaleCommerce_Helper_Sales_Data</data>
250
+ </rewrite>
251
+ </sales>
252
+ </helpers>
253
+ </global>
254
+ <default>
255
+ <payment>
256
+ <iparcel>
257
+ <active>1</active>
258
+ <model>ipglobalecommerce/payment_iparcel</model>
259
+ </iparcel>
260
+ </payment>
261
+ <iparcel>
262
+ <config>
263
+ <submit_parcel>1</submit_parcel>
264
+ <timeout>3</timeout>
265
+ </config>
266
+ <scripts>
267
+ <jquery>0</jquery>
268
+ <scripts>0</scripts>
269
+ </scripts>
270
+ </iparcel>
271
+ <external_api>
272
+ <sales>
273
+ <enabled>1</enabled>
274
+ <transactional_emails>0</transactional_emails>
275
+ <order_status>complete</order_status>
276
+ </sales>
277
+ </external_api>
278
+ <dev>
279
+ <i-parcel>
280
+ <debug>0</debug>
281
+ </i-parcel>
282
+ </dev>
283
+ </default>
284
+ </config>
app/code/community/Iparcel/GlobaleCommerce/etc/system.xml ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <i-parcel translate="label" module="ipglobalecommerce">
5
+ <label>i-parcel</label>
6
+ <sort_order>500</sort_order>
7
+ </i-parcel>
8
+ </tabs>
9
+ <sections>
10
+ <payment>
11
+ <groups>
12
+ <iparcel translate="label" module="ipglobalecommerce">
13
+ <label>i-parcel</label>
14
+ <sort_order>9999</sort_order>
15
+ <show_in_default>0</show_in_default>
16
+ <show_in_website>0</show_in_website>
17
+ <show_in_store>0</show_in_store>
18
+ </iparcel>
19
+ </groups>
20
+ </payment>
21
+ <iparcel>
22
+ <label>Configuration</label>
23
+ <tab>i-parcel</tab>
24
+ <frontent_type>text</frontent_type>
25
+ <sort_order>100</sort_order>
26
+ <show_in_default>1</show_in_default>
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>
99
+ <external_api>
100
+ <label>External API</label>
101
+ <tab>i-parcel</tab>
102
+ <frontend_type>text</frontend_type>
103
+ <sort_order>120</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>0</show_in_website>
106
+ <show_in_store>0</show_in_store>
107
+ <groups>
108
+ <sales translate="label">
109
+ <label>Sales</label>
110
+ <frontend_type>text</frontend_type>
111
+ <sort_order>0</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ <fields>
116
+ <enabled>
117
+ <label>Enable External Sales API</label>
118
+ <frontend_type>select</frontend_type>
119
+ <source_model>adminhtml/system_config_source_yesno</source_model>
120
+ <sort_order>0</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </enabled>
125
+ <transactional_emails>
126
+ <label>Suppress Transactional e-mails</label>
127
+ <frontend_type>select</frontend_type>
128
+ <source_model>adminhtml/system_config_source_yesno</source_model>
129
+ <sort_order>5</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>1</show_in_store>
133
+ </transactional_emails>
134
+ <order_status>
135
+ <label>New Order Status</label>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>ipglobalecommerce/system_config_source_sales_order_status</source_model>
138
+ <sort_order>114</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ </order_status>
143
+ </fields>
144
+ </sales>
145
+ </groups>
146
+ </external_api>
147
+ </sections>
148
+ </config>
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-install-0.2.0.php RENAMED
@@ -1,9 +1,9 @@
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) !== true) {
5
  $table = $installer->getConnection()
6
- ->newTable($installer->getTable('shippingip/api_order'))
7
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
@@ -19,7 +19,7 @@ if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/
19
  'default' => 1
20
  ), 'Transactional Emails Enabled');
21
  $installer->getConnection()->createTable($table);
22
- $installer->getConnection()->addKey($installer->getTable('shippingip/api_order'), 'IDX_ORDER', 'order_id');
23
- $installer->getConnection()->addConstraint('FK_IPARCEL_API_ORDER_ID', $installer->getTable('shippingip/api_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
24
  }
25
- $installer->endSetup();
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
+ if ($installer->getConnection()->isTableExists($installer->getTable('ipglobalecommerce/api_order')) !== true) {
5
  $table = $installer->getConnection()
6
+ ->newTable($installer->getTable('ipglobalecommerce/api_order'))
7
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
19
  'default' => 1
20
  ), 'Transactional Emails Enabled');
21
  $installer->getConnection()->createTable($table);
22
+ $installer->getConnection()->addKey($installer->getTable('ipglobalecommerce/api_order'), 'IDX_ORDER', 'order_id');
23
+ $installer->getConnection()->addConstraint('FK_IPARCEL_API_ORDER_ID', $installer->getTable('ipglobalecommerce/api_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
24
  }
25
+ $installer->endSetup();
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-install-0.3.0.php RENAMED
@@ -1,9 +1,9 @@
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) !== true) {
5
  $table = $installer->getConnection()
6
- ->newTable($installer->getTable('shippingip/api_order'))
7
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
@@ -19,7 +19,7 @@ if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/
19
  'default' => 1
20
  ), 'Transactional Emails Enabled');
21
  $installer->getConnection()->createTable($table);
22
- $installer->getConnection()->addKey($installer->getTable('shippingip/api_order'), 'IDX_ORDER', 'order_id');
23
- $installer->getConnection()->addConstraint('FK_IPARCEL_API_ORDER_ID', $installer->getTable('shippingip/api_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
24
  }
25
- $installer->endSetup();
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
+ if ($installer->getConnection()->isTableExists($installer->getTable('ipglobalecommerce/api_order')) !== true) {
5
  $table = $installer->getConnection()
6
+ ->newTable($installer->getTable('ipglobalecommerce/api_order'))
7
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
19
  'default' => 1
20
  ), 'Transactional Emails Enabled');
21
  $installer->getConnection()->createTable($table);
22
+ $installer->getConnection()->addKey($installer->getTable('ipglobalecommerce/api_order'), 'IDX_ORDER', 'order_id');
23
+ $installer->getConnection()->addConstraint('FK_IPARCEL_API_ORDER_ID', $installer->getTable('ipglobalecommerce/api_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
24
  }
25
+ $installer->endSetup();
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-install-2.3.4.2.php RENAMED
@@ -1,37 +1,9 @@
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/tax_totals')) !== true) {
5
  $table = $installer->getConnection()
6
- ->newTable($installer->getTable('shippingip/tax_totals'))
7
- ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
- 'identity' => true,
9
- 'unsigned' => true,
10
- 'nullable' => false,
11
- 'primary' => true
12
- ), 'Id')
13
- ->addColumn('tax', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
14
- 'nullable' => false
15
- ), 'Tax')
16
- ->addColumn('duty', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
17
- 'nullable' => true
18
- ), 'Duty')
19
- ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
20
- 'unsigned' => true,
21
- 'nullable' => false
22
- ), 'Order Id')
23
- ->addColumn('mode', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array(
24
- 'nullable' => false,
25
- 'default' => 0
26
- ), 'Mode');
27
- $installer->getConnection()->createTable($table);
28
- $installer->getConnection()->addKey($installer->getTable('shippingip/tax_totals'), 'IDX_ORDER', 'order_id');
29
- $installer->getConnection()->addConstraint('FK_IPARCEL_TOTALS_ORDER_ID', $installer->getTable('shippingip/tax_totals'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
30
- }
31
-
32
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf')) !== true) {
33
- $table = $installer->getConnection()
34
- ->newTable($installer->getTable('shippingip/cpf'))
35
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
36
  'identity' => true,
37
  'unsigned' => true,
@@ -51,19 +23,19 @@ if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/
51
  ), 'Required');
52
  $installer->getConnection()->createTable($table);
53
 
54
- $cpf = Mage::getModel('shippingip/cpf');
55
  $cpf->setCountryCode('BR');
56
  $cpf->setName('CPF');
57
  $cpf->save();
58
- $cpf = Mage::getModel('shippingip/cpf');
59
  $cpf->setCountryCode('KR');
60
  $cpf->setName('Control Number');
61
  $cpf->save();
62
  }
63
 
64
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_order')) !== true) {
65
  $table = $installer->getConnection()
66
- ->newTable($installer->getTable('shippingip/cpf_order'))
67
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
68
  'identity' => true,
69
  'unsigned' => true,
@@ -80,12 +52,12 @@ if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/
80
  'nullable' => false,
81
  ), 'Value');
82
  $installer->getConnection()->createTable($table);
83
- $installer->getConnection()->addKey($installer->getTable('shippingip/cpf_order'), 'IDX_ORDER', 'order_id');
84
- $installer->getConnection()->addConstraint('FK_IPARCEL_CPF_ORDER_ID', $installer->getTable('shippingip/cpf_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
85
  }
86
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_quote')) !== true) {
87
  $table = $installer->getConnection()
88
- ->newTable($installer->getTable('shippingip/cpf_quote'))
89
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
90
  'identity' => true,
91
  'unsigned' => true,
@@ -102,8 +74,8 @@ if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/
102
  'nullable' => false,
103
  ), 'Value');
104
  $installer->getConnection()->createTable($table);
105
- $installer->getConnection()->addKey($installer->getTable('shippingip/cpf_quote'), 'IDX_QUOTE', 'quote_id');
106
- $installer->getConnection()->addConstraint('FK_IPARCEL_CPF_QUOTE_ID', $installer->getTable('shippingip/cpf_quote'), 'quote_id', $installer->getTable('sales/quote'), 'entity_id');
107
  }
108
 
109
  $installer->endSetup();
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
+ if ($installer->getConnection()->isTableExists($installer->getTable('ipglobalecommerce/cpf')) !== true) {
5
  $table = $installer->getConnection()
6
+ ->newTable($installer->getTable('ipglobalecommerce/cpf'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
23
  ), 'Required');
24
  $installer->getConnection()->createTable($table);
25
 
26
+ $cpf = Mage::getModel('ipglobalecommerce/cpf');
27
  $cpf->setCountryCode('BR');
28
  $cpf->setName('CPF');
29
  $cpf->save();
30
+ $cpf = Mage::getModel('ipglobalecommerce/cpf');
31
  $cpf->setCountryCode('KR');
32
  $cpf->setName('Control Number');
33
  $cpf->save();
34
  }
35
 
36
+ if ($installer->getConnection()->isTableExists($installer->getTable('ipglobalecommerce/cpf_order')) !== true) {
37
  $table = $installer->getConnection()
38
+ ->newTable($installer->getTable('ipglobalecommerce/cpf_order'))
39
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
40
  'identity' => true,
41
  'unsigned' => true,
52
  'nullable' => false,
53
  ), 'Value');
54
  $installer->getConnection()->createTable($table);
55
+ $installer->getConnection()->addKey($installer->getTable('ipglobalecommerce/cpf_order'), 'IDX_ORDER', 'order_id');
56
+ $installer->getConnection()->addConstraint('FK_IPARCEL_CPF_ORDER_ID', $installer->getTable('ipglobalecommerce/cpf_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
57
  }
58
+ if ($installer->getConnection()->isTableExists($installer->getTable('ipglobalecommerce/cpf_quote')) !== true) {
59
  $table = $installer->getConnection()
60
+ ->newTable($installer->getTable('ipglobalecommerce/cpf_quote'))
61
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
62
  'identity' => true,
63
  'unsigned' => true,
74
  'nullable' => false,
75
  ), 'Value');
76
  $installer->getConnection()->createTable($table);
77
+ $installer->getConnection()->addKey($installer->getTable('ipglobalecommerce/cpf_quote'), 'IDX_QUOTE', 'quote_id');
78
+ $installer->getConnection()->addConstraint('FK_IPARCEL_CPF_QUOTE_ID', $installer->getTable('ipglobalecommerce/cpf_quote'), 'quote_id', $installer->getTable('sales/quote'), 'entity_id');
79
  }
80
 
81
  $installer->endSetup();
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-0.2.0-0.3.0.php RENAMED
@@ -5,11 +5,11 @@ $resource = Mage::getSingleton('core/resource');
5
  $config = Mage::getModel('core/config');
6
  $readConnection = $resource->getConnection('core_read');
7
  $query = 'SELECT `path`, `value` FROM '.$resource->getTableName('core/config_data')." WHERE
8
- `path` LIKE '%iparcel/catalog_mapping%' OR
9
- `path` LIKE '%sales/external%' OR
10
- `path` LIKE '%iparcel/config%' OR
11
- `path` LIKE '%carriers/i-parcel/custid' OR
12
- `path` LIKE '%carriers/i-parcel/userid'";
13
  foreach ($readConnection->fetchAll($query) as $variable) {
14
  $uri = explode('/', $variable['path']);
15
  switch ($variable['path']) {
@@ -41,4 +41,4 @@ foreach ($readConnection->fetchAll($query) as $variable) {
41
  break;
42
  }
43
  }
44
- $installer->endSetup();
5
  $config = Mage::getModel('core/config');
6
  $readConnection = $resource->getConnection('core_read');
7
  $query = 'SELECT `path`, `value` FROM '.$resource->getTableName('core/config_data')." WHERE
8
+ `path` LIKE '%iparcel/catalog_mapping%' OR
9
+ `path` LIKE '%sales/external%' OR
10
+ `path` LIKE '%iparcel/config%' OR
11
+ `path` LIKE '%carriers/i-parcel/custid' OR
12
+ `path` LIKE '%carriers/i-parcel/userid'";
13
  foreach ($readConnection->fetchAll($query) as $variable) {
14
  $uri = explode('/', $variable['path']);
15
  switch ($variable['path']) {
41
  break;
42
  }
43
  }
44
+ $installer->endSetup();
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-0.3.1-0.3.2.php RENAMED
@@ -1,9 +1,9 @@
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf')) !== true) {
5
  $table = $installer->getConnection()
6
- ->newTable($installer->getTable('shippingip/cpf'))
7
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
@@ -23,14 +23,14 @@ if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/
23
  ), 'Required');
24
  $installer->getConnection()->createTable($table);
25
 
26
- $cpf = Mage::getModel('shippingip/cpf');
27
  $cpf->setCountryCode('BR');
28
  $cpf->setName('CPF');
29
  $cpf->save();
30
- $cpf = Mage::getModel('shippingip/cpf');
31
  $cpf->setCountryCode('KR');
32
  $cpf->setName('Control Number');
33
  $cpf->save();
34
  }
35
 
36
- $installer->endSetup();
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
+ if ($installer->getConnection()->isTableExists($installer->getTable('ipglobalecommerce/cpf')) !== true) {
5
  $table = $installer->getConnection()
6
+ ->newTable($installer->getTable('ipglobalecommerce/cpf'))
7
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
23
  ), 'Required');
24
  $installer->getConnection()->createTable($table);
25
 
26
+ $cpf = Mage::getModel('ipglobalecommerce/cpf');
27
  $cpf->setCountryCode('BR');
28
  $cpf->setName('CPF');
29
  $cpf->save();
30
+ $cpf = Mage::getModel('ipglobalecommerce/cpf');
31
  $cpf->setCountryCode('KR');
32
  $cpf->setName('Control Number');
33
  $cpf->save();
34
  }
35
 
36
+ $installer->endSetup();
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-0.3.2-2.0.0.php RENAMED
@@ -1,9 +1,9 @@
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_order')) !== true) {
5
  $table = $installer->getConnection()
6
- ->newTable($installer->getTable('shippingip/cpf_order'))
7
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
@@ -20,12 +20,12 @@ if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/
20
  'nullable' => false,
21
  ), 'Value');
22
  $installer->getConnection()->createTable($table);
23
- $installer->getConnection()->addKey($installer->getTable('shippingip/cpf_order'), 'IDX_ORDER', 'order_id');
24
- $installer->getConnection()->addConstraint('FK_IPARCEL_CPF_ORDER_ID', $installer->getTable('shippingip/cpf_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
25
  }
26
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_quote')) !== true) {
27
  $table = $installer->getConnection()
28
- ->newTable($installer->getTable('shippingip/cpf_quote'))
29
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
30
  'identity' => true,
31
  'unsigned' => true,
@@ -42,7 +42,7 @@ if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/
42
  'nullable' => false,
43
  ), 'Value');
44
  $installer->getConnection()->createTable($table);
45
- $installer->getConnection()->addKey($installer->getTable('shippingip/cpf_quote'), 'IDX_QUOTE', 'quote_id');
46
- $installer->getConnection()->addConstraint('FK_IPARCEL_CPF_QUOTE_ID', $installer->getTable('shippingip/cpf_quote'), 'quote_id', $installer->getTable('sales/quote'), 'entity_id');
47
  }
48
- $installer->endSetup();
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
+ if ($installer->getConnection()->isTableExists($installer->getTable('ipglobalecommerce/cpf_order')) !== true) {
5
  $table = $installer->getConnection()
6
+ ->newTable($installer->getTable('ipglobalecommerce/cpf_order'))
7
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
20
  'nullable' => false,
21
  ), 'Value');
22
  $installer->getConnection()->createTable($table);
23
+ $installer->getConnection()->addKey($installer->getTable('ipglobalecommerce/cpf_order'), 'IDX_ORDER', 'order_id');
24
+ $installer->getConnection()->addConstraint('FK_IPARCEL_CPF_ORDER_ID', $installer->getTable('ipglobalecommerce/cpf_order'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
25
  }
26
+ if ($installer->getConnection()->isTableExists($installer->getTable('ipglobalecommerce/cpf_quote')) !== true) {
27
  $table = $installer->getConnection()
28
+ ->newTable($installer->getTable('ipglobalecommerce/cpf_quote'))
29
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
30
  'identity' => true,
31
  'unsigned' => true,
42
  'nullable' => false,
43
  ), 'Value');
44
  $installer->getConnection()->createTable($table);
45
+ $installer->getConnection()->addKey($installer->getTable('ipglobalecommerce/cpf_quote'), 'IDX_QUOTE', 'quote_id');
46
+ $installer->getConnection()->addConstraint('FK_IPARCEL_CPF_QUOTE_ID', $installer->getTable('ipglobalecommerce/cpf_quote'), 'quote_id', $installer->getTable('sales/quote'), 'entity_id');
47
  }
48
+ $installer->endSetup();
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-2.0.0-2.3.4.2.php RENAMED
@@ -1,7 +1,7 @@
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) === true) {
5
- $installer->getConnection()->dropTable($installer->getTable('shippingip/api_order'));
6
  }
7
- $installer->endSetup();
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
+ if ($installer->getConnection()->isTableExists($installer->getTable('ipglobalecommerce/api_order')) === true) {
5
+ $installer->getConnection()->dropTable($installer->getTable('ipglobalecommerce/api_order'));
6
  }
7
+ $installer->endSetup();
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-2.4.0.3-2.4.1.0.php RENAMED
@@ -1,9 +1,9 @@
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/parcel')) !== true) {
5
  $table = $installer->getConnection()
6
- ->newTable($installer->getTable('shippingip/parcel'))
7
  ->addColumn('parcel_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
@@ -15,7 +15,7 @@ if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/
15
  'nullable' => false,
16
  ), 'Order Id');
17
  $installer->getConnection()->createTable($table);
18
- $installer->getConnection()->addKey($installer->getTable('shippingip/parcel'), 'IDX_ORDER', 'order_id', 'UNIQUE');
19
- $installer->getConnection()->addConstraint('FK_IPARCEL_PARCEL_ORDER_ID', $installer->getTable('shippingip/parcel'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
20
  }
21
- $installer->endSetup();
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
+ if ($installer->getConnection()->isTableExists($installer->getTable('ipglobalecommerce/parcel')) !== true) {
5
  $table = $installer->getConnection()
6
+ ->newTable($installer->getTable('ipglobalecommerce/parcel'))
7
  ->addColumn('parcel_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
  'identity' => true,
9
  'unsigned' => true,
15
  'nullable' => false,
16
  ), 'Order Id');
17
  $installer->getConnection()->createTable($table);
18
+ $installer->getConnection()->addKey($installer->getTable('ipglobalecommerce/parcel'), 'IDX_ORDER', 'order_id', 'UNIQUE');
19
+ $installer->getConnection()->addConstraint('FK_IPARCEL_PARCEL_ORDER_ID', $installer->getTable('ipglobalecommerce/parcel'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
20
  }
21
+ $installer->endSetup();
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-2.4.1.17-2.4.3.0.php RENAMED
@@ -47,4 +47,4 @@ if ($config_data_collection->getSize()) {
47
  ->save();
48
  }
49
 
50
- $installer->endSetup();
47
  ->save();
48
  }
49
 
50
+ $installer->endSetup();
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-2.4.1.6-2.4.1.7.php RENAMED
@@ -1,15 +1,15 @@
1
  <?php
2
  $installer = $this;
3
  $connection = $installer->getConnection();
4
- $data = Mage::getModel('shippingip/parcel')->getCollection()->toArray();
5
  $data = $data['items'];
6
 
7
  $installer->startSetup();
8
- if ($connection->isTableExists($installer->getTable('shippingip/parcel'))) {
9
- $connection->dropTable($installer->getTable('shippingip/parcel'));
10
  }
11
  $table = $installer->getConnection()
12
- ->newTable($installer->getTable('shippingip/parcel'))
13
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
14
  'identity' => true,
15
  'unsigned' => true,
@@ -25,6 +25,6 @@ $table = $installer->getConnection()
25
  'nullable' => false,
26
  ), 'Order Id');
27
  $installer->getConnection()->createTable($table);
28
- $installer->getConnection()->addKey($installer->getTable('shippingip/parcel'), 'IDX_ORDER', 'order_id', 'UNIQUE');
29
- $installer->getConnection()->addConstraint('FK_IPARCEL_PARCEL_ORDER_ID', $installer->getTable('shippingip/parcel'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
30
- $installer->endSetup();
1
  <?php
2
  $installer = $this;
3
  $connection = $installer->getConnection();
4
+ $data = Mage::getModel('ipglobalecommerce/parcel')->getCollection()->toArray();
5
  $data = $data['items'];
6
 
7
  $installer->startSetup();
8
+ if ($connection->isTableExists($installer->getTable('ipglobalecommerce/parcel'))) {
9
+ $connection->dropTable($installer->getTable('ipglobalecommerce/parcel'));
10
  }
11
  $table = $installer->getConnection()
12
+ ->newTable($installer->getTable('ipglobalecommerce/parcel'))
13
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
14
  'identity' => true,
15
  'unsigned' => true,
25
  'nullable' => false,
26
  ), 'Order Id');
27
  $installer->getConnection()->createTable($table);
28
+ $installer->getConnection()->addKey($installer->getTable('ipglobalecommerce/parcel'), 'IDX_ORDER', 'order_id', 'UNIQUE');
29
+ $installer->getConnection()->addConstraint('FK_IPARCEL_PARCEL_ORDER_ID', $installer->getTable('ipglobalecommerce/parcel'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
30
+ $installer->endSetup();
app/code/community/Iparcel/{Shipping/sql/shippingip_setup → GlobaleCommerce/sql/ipglobalecommerce_setup}/mysql4-upgrade-2.4.6-2.4.7.php RENAMED
@@ -10,8 +10,8 @@ $installer->startSetup();
10
  * duplicate Magento orders.
11
  */
12
  $installer->run("
13
- DROP TABLE IF EXISTS {$this->getTable('shippingip/api_order')};
14
- CREATE TABLE {$this->getTable('shippingip/api_order')} (
15
  `id` int(11) unsigned NOT NULL auto_increment,
16
  `tracking_number` varchar(255) NOT NULL,
17
  `order_increment_id` varchar(255) NOT NULL,
@@ -19,4 +19,4 @@ CREATE TABLE {$this->getTable('shippingip/api_order')} (
19
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
20
  ");
21
 
22
- $installer->endSetup();
10
  * duplicate Magento orders.
11
  */
12
  $installer->run("
13
+ DROP TABLE IF EXISTS {$this->getTable('ipglobalecommerce/api_order')};
14
+ CREATE TABLE {$this->getTable('ipglobalecommerce/api_order')} (
15
  `id` int(11) unsigned NOT NULL auto_increment,
16
  `tracking_number` varchar(255) NOT NULL,
17
  `order_increment_id` varchar(255) NOT NULL,
19
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
20
  ");
21
 
22
+ $installer->endSetup();
app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Checkitems/Button.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /**
3
- * Frontend Model Class for catalog_mapping/check_items/check_items config button
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Block_Adminhtml_Catalog_Checkitems_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
10
- {
11
-
12
- /**
13
- * Get Button Html
14
- *
15
- * @param Varien_Data_Form_Element_Abstract $element
16
- * @return string
17
- */
18
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
- {
20
- $url = Mage::helper('adminhtml')->getUrl("adminhtml/shippingip_sync_ajax/checkitems");
21
-
22
- $html = $this->getLayout()->createBlock('adminhtml/widget_button')
23
- ->setType('button')
24
- ->setClass('scalable')
25
- ->setLabel('Populate now')
26
- ->setOnClick("window.location.href='" . $url . "'")
27
- ->toHtml();
28
-
29
- return $html;
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Mapping/Button.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /**
3
- * Frontend Model Class for catalog_mapping/upload/upload config button
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Block_Adminhtml_Catalog_Mapping_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
10
- {
11
-
12
- /**
13
- * Get Button Html
14
- *
15
- * @param Varien_Data_Form_Element_Abstract $element
16
- * @return string
17
- */
18
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
- {
20
- $url = Mage::helper('adminhtml')->getUrl("adminhtml/shippingip_sync_ajax/catalog");
21
-
22
- $html = $this->getLayout()->createBlock('adminhtml/widget_button')
23
- ->setType('button')
24
- ->setClass('scalable')
25
- ->setLabel('Upload Now')
26
- ->setOnClick("window.location.href='" . $url . "'")
27
- ->toHtml();
28
-
29
- return $html;
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Iparcel order creditmemo shipping tax&duty totals block
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Creditmemo_Totals extends Mage_Adminhtml_Block_Sales_Order_Creditmemo_Totals
10
- {
11
- /**
12
- * Initialize creditmemo totals array
13
- *
14
- * @return Iparcel_Shipping_Block_Adminhtml_Sales_Order_Creditmemo_Totals
15
- */
16
- protected function _initTotals()
17
- {
18
- parent::_initTotals();
19
- foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total) {
20
- $this->addTotal($total, array('shipping','tax'));
21
- }
22
- return $this;
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Invoice/Totals.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Iparcel order invoice shipping tax&duty totals block
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Invoice_Totals extends Mage_Adminhtml_Block_Sales_Order_Invoice_Totals
10
- {
11
- /**
12
- * Initialize order totals array
13
- *
14
- * @return Iparcel_Shipping_Block_Adminhtml_Sales_Order_Invoice_Totals
15
- */
16
- protected function _initTotals()
17
- {
18
- parent::_initTotals();
19
- foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total) {
20
- $this->addTotal($total, array('shipping','tax'));
21
- }
22
- return $this;
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Form.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Shipment view form
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Form extends Mage_Adminhtml_Block_Sales_Order_Shipment_View_Form
10
- {
11
- /**
12
- * Get create label button html
13
- *
14
- * @return string
15
- */
16
- public function getCreateLabelButton()
17
- {
18
- if ($this->getShipment()->getOrder()->getShippingCarrier()->getCarrierCode() == "i-parcel") {
19
- return null;
20
- } else {
21
- return parent::getCreateLabelButton();
22
- }
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Tracking.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Shipment tracking control form
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Tracking extends Mage_Adminhtml_Block_Sales_Order_Shipment_View_Tracking
10
- {
11
- /**
12
- * Get relevant path to template
13
- *
14
- * @return string
15
- */
16
- public function getTemplate()
17
- {
18
- if ($this->getShipment()->getOrder()->getShippingMethod(true)->getCarrierCode() == 'i-parcel') {
19
- return 'iparcel/sales/order/shipment/view/tracking.phtml';
20
- } else {
21
- return parent::getTemplate();
22
- }
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Totals.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
- /**
3
- * Iparcel order shipping tax&duty totals block
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Totals extends Mage_Adminhtml_Block_Sales_Order_Totals
10
- {
11
- /**
12
- * Initialize order totals array
13
- *
14
- * @return Iparcel_Shipping_Block_Adminhtml_Sales_Order_Totals
15
- */
16
- protected function _initTotals()
17
- {
18
- parent::_initTotals();
19
- $totalCollection = Mage::helper('shippingip/tax')->getTotal($this->getOrder());
20
- foreach ($totalCollection as $total) {
21
- $this->addTotal($total, array('shipping','tax'));
22
- }
23
- return $this;
24
- }
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Adminhtml/Salesrule/Rule/Sync.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /**
3
- * Frontend Model Class for salesrules/upload/sync config button
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Block_Adminhtml_Salesrule_Rule_Sync extends Mage_Adminhtml_Block_System_Config_Form_Field
10
- {
11
-
12
- /**
13
- * Get Button Html
14
- *
15
- * @param Varien_Data_Form_Element_Abstract $element
16
- * @return string
17
- */
18
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
- {
20
- $url = Mage::helper('adminhtml')->getUrl("adminhtml/shippingip_sync/salesrule");
21
-
22
- $html = $this->getLayout()->createBlock('adminhtml/widget_button')
23
- ->setType('button')
24
- ->setClass('scalable')
25
- ->setLabel('Synchronize')
26
- ->setOnClick("window.location.href='" . $url . "'")
27
- ->toHtml();
28
-
29
- return $html;
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Adminhtml/System/Config/Form/Field/Method.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- class Iparcel_Shipping_Block_Adminhtml_System_Config_Form_Field_Method extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
3
- {
4
- public function __construct()
5
- {
6
- $this->addColumn('service_id', array(
7
- 'label' => $this->__('Service Level ID'),
8
- 'style' => 'width:85px'
9
- ));
10
- $this->addColumn('title', array(
11
- 'label' => $this->__('Method Title'),
12
- 'style' => 'width:120px'
13
- ));
14
-
15
- $this->_addAfter = false;
16
- $this->_addButtonLabel = $this->__('Add Description');
17
-
18
- parent::__construct();
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Sales/Order/Creditmemo/Totals.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Block for i-parcel tax&duty creditmemo totals
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Block_Sales_Order_Creditmemo_Totals extends Mage_Sales_Block_Order_Creditmemo_Totals
10
- {
11
- /**
12
- * Initialize order totals array
13
- *
14
- * @return Iparcel_Shipping_Block_Sales_Order_Creditmemo_Totals
15
- */
16
- protected function _initTotals()
17
- {
18
- parent::_initTotals();
19
- foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total) {
20
- $this->addTotal($total, array('shipping','tax'));
21
- }
22
- return $this;
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Sales/Order/Invoice/Totals.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /* i-parcel shipping tax&duty invoice totals block
3
- *
4
- * @category Iparcel
5
- * @package Iparcel_Shipping
6
- * @author Bobby Burden <bburden@i-parcel.com>
7
- */
8
- class Iparcel_Shipping_Block_Sales_Order_Invoice_Totals extends Mage_Sales_Block_Order_Invoice_Totals
9
- {
10
- /**
11
- * Initialize order totals array
12
- *
13
- * @return Iparcel_Shipping_Block_Sales_Order_Invoice_Totals
14
- */
15
- protected function _initTotals()
16
- {
17
- parent::_initTotals();
18
- foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total) {
19
- $this->addTotal($total, array('shipping','tax'));
20
- }
21
- return $this;
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Sales/Order/Totals.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * i-parcel shipping tax&duty order totals block
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Block_Sales_Order_Totals extends Mage_Sales_Block_Order_Totals
10
- {
11
- /**
12
- * Initialize order totals array
13
- *
14
- * @return Iparce-Shipping_Block_Sales_Order_Totals
15
- */
16
- protected function _initTotals()
17
- {
18
- parent::_initTotals();
19
- foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total) {
20
- $this->addTotal($total, array('shipping','tax'));
21
- }
22
- return $this;
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Block/Tax/Checkout/Tax.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- class Iparcel_Shipping_Block_Tax_Checkout_Tax extends Mage_Tax_Block_Checkout_Tax
3
- {
4
- protected function _toHtml()
5
- {
6
- /* var $shippingAddress Mage_Sales_Model_Quote_Address */
7
- $shippingAddress = $this->getQuote()->getShippingAddress();
8
- if ($shippingAddress->getId()) {
9
- $shippingMethod = explode('_', $shippingAddress->getShippingMethod());
10
- $carrier = $shippingMethod[0];
11
- $carrier_flag = ($carrier == 'i-parcel');
12
- $domestic_flag = ($shippingAddress->getCountryId() == Mage::getStoreConfig('general/store_information/merchant_country'));
13
- } else {
14
- $carrier_flag = false;
15
- $domestic_flag = false;
16
- }
17
-
18
- $iparcel_tax_intercept = Mage::getStoreConfigFlag('iparcel/tax/mode');
19
-
20
- if (!$iparcel_tax_intercept || !$carrier_flag || $domestic_flag) {
21
- return parent::_toHtml();
22
- }
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Helper/Api.php DELETED
@@ -1,818 +0,0 @@
1
- <?php
2
- /**
3
- * I-parcel sending API helper
4
- *
5
- * This helper facilitates the connection to the API web service documented
6
- * here: http://webservices.i-parcel.com/Help
7
- *
8
- * @category Iparcel
9
- * @package Iparcel_Shipping
10
- * @author Bobby Burden <bburden@i-parcel.com>
11
- */
12
- class Iparcel_Shipping_Helper_Api
13
- {
14
- /** @var string URL for the SubmitCatalog endpoint */
15
- protected $_submitCatalog = 'https://webservices.i-parcel.com/api/SubmitCatalog';
16
-
17
- /** @var string URL for the Quote endpoint */
18
- protected $_quote = 'https://webservices.i-parcel.com/api/Quote';
19
-
20
- /** @var string URL for the SubmitParcel endpoint */
21
- protected $_submitParcel = 'https://webservices.i-parcel.com/api/SubmitParcel';
22
-
23
- /** @var string URL for the CheckItems endpoint */
24
- protected $_checkItems = 'https://webservices.i-parcel.com/api/CheckItems';
25
-
26
- /**
27
- * Send POST requests to the REST API
28
- *
29
- * @param string $post POST Data to send
30
- * @param string $url REST API URL to send POST data to
31
- * @param array $header Array of headers to attach to the request
32
- * @return string Response from the POST request
33
- */
34
- protected function _rest($post, $url, array $header)
35
- {
36
- $curl = curl_init($url);
37
-
38
- $timeout = 15;
39
- if ($timeout) {
40
- curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
41
- }
42
-
43
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
44
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
45
- curl_setopt($curl, CURLOPT_POST, true);
46
- curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
47
- curl_setopt($curl, CURLOPT_POSTFIELDS, "$post");
48
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
49
-
50
- $response = curl_exec($curl);
51
-
52
- curl_close($curl);
53
-
54
- return $response;
55
- }
56
-
57
- /**
58
- * Send REST XML requests
59
- *
60
- * Wrapper for _rest() that sends a SimpleXMLElement object to the API.
61
- *
62
- * @param SimpleXMLElement $xml XML to send
63
- * @param string $url REST API URL to send POST data to
64
- * @return string Response from the POST request
65
- */
66
- protected function _restXML($xml, $url)
67
- {
68
- return $this->_rest($xml->asXml, $url, array('Content-Type: text/xml'));
69
- }
70
-
71
- /**
72
- * Send REST JSON requests
73
- *
74
- * Wrapper for _rest() that sends the passed data as JSON to the API.
75
- *
76
- * @param string $json Data to be JSON encoded and sent to the API
77
- * @param string $url REST API URL to send POST data to
78
- * @return string Response from the POST request
79
- */
80
- protected function _restJSON($json, $url)
81
- {
82
- return $this->_rest(
83
- json_encode($json),
84
- $url,
85
- array('Content-Type: text/json')
86
- );
87
- }
88
-
89
- /**
90
- * Send SubmitCatalog request
91
- *
92
- * Takes the passed Product Collection and transforms it into data that can
93
- * be passed to the API. It then submits the request as JSON to the
94
- * SubmitCatalog API endpoint.
95
- *
96
- * @param Varien_Data_Collection $productCollection A Magento Product collection
97
- * @return int The amount of products uploaded to the API
98
- */
99
- public function submitCatalog(Varien_Data_Collection $productCollection)
100
- {
101
- //init log
102
- $log = Mage::getModel('shippingip/api_log');
103
- /* var $log Iparcel_Shipping_Model_Api_Log */
104
- $log->setController('Submit Catalog');
105
-
106
- $items = $this->prepareProductsForSubmitCatalog($productCollection);
107
-
108
- $log->setRequest(json_encode($items));
109
-
110
- $numberToUpload = count($items['SKUs']);
111
-
112
- if ($numberToUpload > 0) {
113
- $response = $this->_restJSON($items, $this->_submitCatalog);
114
-
115
- $log->setResponse($response);
116
- $log->save();
117
-
118
- if (!preg_match('/.*Success.*/', $response)) {
119
- $numberToUpload = -1;
120
- }
121
- }
122
-
123
- return $numberToUpload;
124
- }
125
-
126
- /**
127
- * Prepare product collection for SubmitCatalog calls
128
- *
129
- * This function takes a Magento product collection and extracts the
130
- * necessary information to send it to the SubmitCatalog API endpoint.
131
- *
132
- * @param Varien_Data_Collection $products Products to prepare
133
- * @return array Prepared array of products and product information
134
- */
135
- public function prepareProductsForSubmitCatalog(Varien_Data_Collection $products)
136
- {
137
- $hsCode = Mage::getModel('eav/entity_attribute')->load(Mage::getStoreConfig('catalog_mapping/attributes/hscodeus'));
138
- /* var $hsCode Mage_Eav_Model_Entity_Attribute */
139
- $shipAlone = Mage::getModel('eav/entity_attribute')->load(Mage::getStoreConfig('catalog_mapping/attributes/shipalone'));
140
- /* var $shipAlone Mage_Eav_Model_Entity_Attribute */
141
-
142
- $items = array();
143
- $items['key'] = Mage::helper('shippingip')->getGuid();
144
-
145
- $skus = $items['SKUs'] = array();
146
-
147
- foreach ($products as $product) {
148
- $product = Mage::getModel('catalog/product')->load($product->getId());
149
- /* var $product Mage_Catalog_Model_Product */
150
-
151
- $sku = $product->getSku() ?: '';
152
- $name = $product->getName() ?: '';
153
- if (empty($sku) || empty($name)) {
154
- continue;
155
- }
156
-
157
- $item = array();
158
-
159
- $item['SKU'] = $sku;
160
- $item['ProductName'] = $name;
161
-
162
- for ($i = 1; $i <= 6; $i++) {
163
- $_attribute = Mage::getModel('eav/entity_attribute')
164
- ->load(Mage::getStoreConfig(sprintf('catalog_mapping/attributes/attribute%d', $i)));
165
- /* var $_attributeCollection[] Mage_Eav_Model_Entity_Attribute */
166
- // if attribute exists
167
- $productAttribute = null;
168
- if ($_attribute !== null) {
169
- // and has attribute_code
170
- if ($code = $_attribute->getAttributeCode()) {
171
- // then productAttribute value is product's attribute_text (if exists) or product's data (if not)
172
- $productAttribute = strip_tags($product->getAttributeText($code) ?: $product->getData($code));
173
- }
174
- }
175
- $item["Attribute$i"] = (string)substr($productAttribute, 0, 255);
176
- }
177
-
178
- $price = null;
179
- // if it's simple product and config is to get parent's price
180
- if ($product->getTypeId() == 'simple' && Mage::getStoreConfig('catalog_mapping/attributes/price') == Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Configurable_Price::CONFIGURABLE) {
181
- // get parentIds
182
- $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId()) ?: Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
183
- // get price
184
- $price = $parentIds ? Mage::getModel('catalog/product')->load($parentIds[0])->getPrice() : $product->getPrice();
185
- }
186
- // if there's no price
187
- if (!$price) {
188
- //get current product's price
189
- $price = $product->getPrice();
190
- }
191
-
192
- $item['CountryOfOrigin'] = (string)$product->getCountryOfManufacture();
193
- $item['CurrentPrice'] = (float)$price;
194
- $item['Delete'] = $product->getIsDeleted() ? true : false;
195
- $item['HSCodeCA'] = '';
196
-
197
- if ($code = $hsCode->getAttributeCode()) {
198
- $item['HSCodeUS'] = trim($product->getAttributeText($code)) ?: $product->getData($code);
199
- } else {
200
- $item['HSCodeUS'] = '';
201
- }
202
-
203
- $item['Height'] = (float)$product->getHeight();
204
- $item['Length'] = (float)$product->getLength();
205
- $item['ProductURL'] = $product->getProductUrl();
206
- $item['SKN'] = '';
207
- if ($code = $shipAlone->getAttributeCode()) {
208
- $item['ShipAlone'] = $product->getAttributeText($code) == 'Yes' ? true : false;
209
- }
210
- $item['Width'] = (float)$product->getWidth();
211
- $item['Weight'] = (float)$product->getWeight();
212
-
213
- // Detect and handle a Simple Product with Custom Options
214
- if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $product->getHasOptions()) {
215
- // loop through each of the sorted products with custom options
216
- // and build out custom option and option type based skus
217
- foreach ($this->_findSimpleProductVariants($product) as $customOptionProduct) {
218
- $customOptionSku = "";
219
- $customOptionPriceMarkup = 0;
220
- $customOptionName = "";
221
- foreach ($customOptionProduct as $o) {
222
- $customOptionSku .= "_" . $o["sku"];
223
- $customOptionPriceMarkup += $o["price"];
224
- $customOptionName .= " - " . $o["title"];
225
- }
226
- if ($customOptionSku != '') {
227
- $item['SKU'] = $sku . "_" . $customOptionSku;
228
- } else {
229
- $item['SKU'] = $sku;
230
- }
231
- $item['CurrentPrice'] = (float)( $price + $customOptionPriceMarkup );
232
- //append the product name with the custom option
233
- $item['ProductName'] = $name . $customOptionName;
234
- $items['SKUs'][] = $item;
235
- }
236
- } else {
237
- $items['SKUs'][] = $item;
238
- }
239
-
240
- }
241
-
242
- return $items;
243
- }
244
-
245
- /**
246
- * Send Quote request
247
- *
248
- * Takes the passed Rate Request and transforms it into data that can
249
- * be passed to the API. It then submits the request as JSON to the
250
- * Quote API endpoint.
251
- *
252
- * @param Mage_Shipping_Model_Rate_Request $request Magento Shipping Rate Request
253
- * @return stdClass Response from the Quote API
254
- */
255
- public function quote(Mage_Shipping_Model_Rate_Request $request)
256
- {
257
- // log init
258
- $log = Mage::getModel('shippingip/api_log');
259
- /* var $log Iparcel_Shipping_Model_Api_Log */
260
- $log->setController('Quote');
261
-
262
- $quote = Mage::getModel('checkout/cart')->getQuote();
263
- /* var $quote Mage_Sales_Model_Quote */
264
- $shippingAddress = $quote->getShippingAddress();
265
- /* var $shippingAddress Mage_Sales_Model_Quote_Address */
266
- $billingAddress = $quote->getBillingAddress();
267
- /* var $billingAddress Mage_Sales_Model_Quote_Address */
268
-
269
- $json = array();
270
- $addressInfo = array();
271
-
272
- $billingStreet = $billingAddress->getStreet();
273
-
274
- $billing = array();
275
- $billing['City'] = $billingAddress->getCity();
276
- $billing['CountryCode'] = $billingAddress->getCountryId();
277
- $billing['Email'] = $quote->getCustomerEmail();
278
- $billing['FirstName'] = $billingAddress->getFirstname();
279
- $billing['LastName'] = $billingAddress->getLastname();
280
- $billing['Phone'] = $billingAddress->getTelephone();
281
- $billing['PostCode'] = $billingAddress->getPostcode();
282
- $billing['Region'] = $billingAddress->getRegion();
283
- for ($i=0; $i<count($billingStreet); $i++) {
284
- $billing['Street'.($i+1)] = $billingStreet[$i];
285
- }
286
-
287
- $addressInfo['Billing'] = $billing;
288
-
289
- $shippingStreet = $shippingAddress->getStreet();
290
-
291
- $shipping = array();
292
-
293
- $shipping['City'] = $shippingAddress->getCity();
294
- $shipping['CountryCode'] = $shippingAddress->getCountryId();
295
- $shipping['Email'] = $quote->getCustomerEmail();
296
- $shipping['FirstName'] = $shippingAddress->getFirstname();
297
- $shipping['LastName'] = $shippingAddress->getLastname();
298
- $shipping['Phone'] = $shippingAddress->getTelephone();
299
- $shipping['PostCode'] = $shippingAddress->getPostcode();
300
- $shipping['Region'] = $shippingAddress->getRegion();
301
- for ($i=0; $i<count($shippingStreet); $i++) {
302
- $shipping['Street'.($i+1)] = $billingStreet[$i];
303
- }
304
-
305
- $addressInfo['Shipping'] = $shipping;
306
-
307
- $addressInfo['ControlNumber'] = $quote->getCpf();
308
-
309
- $json['AddressInfo'] = $addressInfo;
310
-
311
- $json['CurrencyCode'] = $quote->getQuoteCurrencyCode();
312
- $json['DDP'] = true;
313
-
314
- $itemsList = array();
315
-
316
- foreach ($request->getAllItems() as $item) {
317
- /* var $item Mage_Sales_Model_Quote_Item */
318
-
319
- $itemProduct = Mage::getModel('catalog/product')->load($item->getProductId());
320
- /* var $itemProduct Mage_Catalog_Model_Product */
321
-
322
- //get item price
323
- $itemPrice = (float)$item->getFinalPrice() ?: (float)$item->getPrice();
324
- // if not price and item has parent (is configurable)
325
- if (!$itemPrice && ($parent=$item->getParentItem())) {
326
- // get parent price
327
- $itemPrice = (float)$parent->getFinalPrice() ?: (float)$parent->getPrice();
328
- }
329
- // if still not price
330
- if (!$itemPrice) {
331
- // get product price
332
- $itemPrice = (float)$item->getProduct()->getPrice();
333
- }
334
-
335
- // if product isn't virtual and is configurable or downloadable
336
- if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(), array('configurable','downloadable'))) {
337
- // add line item node
338
- $lineItem = array();
339
-
340
- $lineItem['Quantity'] = $item->getTotalQty();
341
- $lineItem['SKU'] = $item->getSku();
342
- $lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
343
- $lineItem['ValueShopperCurrency'] = $itemPrice;
344
- $lineItem['ValueUSD'] = $itemPrice;
345
-
346
- $itemsList[] = $lineItem;
347
- }
348
- }
349
-
350
- $json['ItemDetailsList'] = $itemsList;
351
-
352
- // Get discounts
353
- $totals = $quote->getTotals();
354
- $discount = 0;
355
- if (isset($totals['discount']) && $totals['discount']->getValue()) {
356
- $discount = -1 * $totals['discount']->getValue();
357
- }
358
-
359
- $json['OtherDiscount'] = $discount;
360
- $json['OtherDiscountCurrency'] = $quote->getQuoteCurrencyCode();
361
- $json['ParcelID'] = 0;
362
- $json['ServiceLevel'] = 115;
363
- $json['SessionID'] = '';
364
- $json['key'] = Mage::helper('shippingip')->getGuid();
365
-
366
- $log->setRequest(json_encode($json));
367
-
368
- $response = $this->_restJSON($json, $this->_quote);
369
-
370
- $log->setResponse($response);
371
- $log->save();
372
-
373
- return json_decode($response);
374
- }
375
-
376
- /**
377
- * Send Submit Parcel request
378
- *
379
- * Takes the passed Order and transforms it into data that can be passed to
380
- * the API. It then submits the request as JSON to the SubmitParcel API
381
- * endpoint.
382
- *
383
- * @param Mage_Sales_Model_Order $order Magento Order to be acknowledged as parcel
384
- * @return stdClass Response from the SubmitParcel API
385
- */
386
- public function submitParcel(Mage_Sales_Model_Order $order)
387
- {
388
- // init log
389
- $log = Mage::getModel('shippingip/api_log');
390
- /* var $log Iparcel_Shipping_Model_Api_Log */
391
- $log->setController('Submit Parcel');
392
-
393
- $quote = $order->getQuote();
394
- /* var $quote Mage_Sales_Model_Quote */
395
- $shippingAddress = $quote->getShippingAddress();
396
- /* var $shippingAddress Mage_Sales_Model_Quote_Address */
397
- $billingAddress = $quote->getBillingAddress();
398
- /* var $billingAddress Mage_Sales_Model_Quote_Address */
399
-
400
- $json = array();
401
-
402
- $addressInfo = array();
403
-
404
- $billingStreet = $billingAddress->getStreet();
405
-
406
- $billing = array();
407
-
408
- $billing['City'] = $billingAddress->getCity();
409
- $billing['CountryCode'] = $billingAddress->getCountryId();
410
- $billing['Email'] = $quote->getCustomerEmail();
411
- $billing['FirstName'] = $billingAddress->getFirstname();
412
- $billing['LastName'] = $billingAddress->getLastname();
413
- $billing['Phone'] = $billingAddress->getTelephone();
414
- $billing['PostCode'] = $billingAddress->getPostcode();
415
- $billing['Region'] = $billingAddress->getRegion();
416
- $billing['Street1'] = $billingStreet[0];
417
- $billing['Street2'] = $billingStreet[1];
418
-
419
- $addressInfo['Billing'] = $billing;
420
-
421
- $shippingStreet = $shippingAddress->getStreet();
422
-
423
- $shipping = array();
424
-
425
- $shipping['City'] = $shippingAddress->getCity();
426
- $shipping['CountryCode'] = $shippingAddress->getCountryId();
427
- $shipping['Email'] = $quote->getCustomerEmail();
428
- $shipping['FirstName'] = $shippingAddress->getFirstname();
429
- $shipping['LastName'] = $shippingAddress->getLastname();
430
- $shipping['Phone'] = $shippingAddress->getTelephone();
431
- $shipping['PostCode'] = $shippingAddress->getPostcode();
432
- $shipping['Region'] = $shippingAddress->getRegion();
433
- $shipping['Street1'] = $shippingStreet[0];
434
- $shipping['Street2'] = $shippingStreet[1];
435
-
436
- $addressInfo['Shipping'] = $shipping;
437
-
438
- $addressInfo['ControlNumber'] = $order->getCpf();
439
-
440
- $json['AddressInfo'] = $addressInfo;
441
-
442
- $json['CurrencyCode'] = $quote->getQuoteCurrencyCode();
443
- $json['DDP'] = true;
444
-
445
- $itemsList = array();
446
- foreach ($order->getAllItems() as $item) {
447
- /* var $item Mage_Sales_Model_Order_Item */
448
- $itemProduct = Mage::getModel('catalog/product')->load($item->getProductId());
449
- /* var $itemProduct Mage_Catalog_Model_Product */
450
-
451
- //get item price
452
- $itemPrice = (float)$item->getFinalPrice() ?: (float)$item->getPrice();
453
- // if not price and item has parent (is configurable)
454
- if (!$itemPrice && ($parent=$item->getParentItem())) {
455
- // get parent price
456
- $itemPrice = (float)$parent->getFinalPrice() ?: (float)$parent->getPrice();
457
- }
458
- // if still not price
459
- if (!$itemPrice) {
460
- // get product price
461
- $itemPrice = (float)$item->getProduct()->getPrice();
462
- }
463
-
464
- // if product isn't virtual and is configurable or downloadable
465
- if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(), array('configurable','downloadable'))) {
466
- // add line item node
467
- $lineItem = array();
468
-
469
- $lineItem['Quantity'] = $item->getQtyOrdered();
470
- $lineItem['SKU'] = $item->getSku();
471
- $lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
472
- $lineItem['ValueShopperCurrency'] = $itemPrice;
473
- $lineItem['ValueUSD'] = $itemPrice;
474
-
475
- $itemsList[] = $lineItem;
476
- }
477
- }
478
-
479
- $json['ItemDetailsList'] = $itemsList;
480
-
481
- // if order_reference is set add it to request
482
- if (Mage::getStoreConfig('carriers/i-parcel/order_reference')) {
483
- $json['OrderReference'] = $order->getIncrementId();
484
- }
485
-
486
- // Get discounts
487
- $totals = $quote->getTotals();
488
- $discount = 0;
489
- if (isset($totals['discount']) && $totals['discount']->getValue()) {
490
- $discount = -1 * $totals['discount']->getValue();
491
- }
492
-
493
- // Get ServiceLevelID
494
- $method = $order->getShippingMethod();
495
- /* var $method string */
496
- $method = explode('_', $method);
497
- /* var $method array */
498
- array_shift($method);
499
- $serviceLevelId = implode('_', $method);
500
- /* var $serviceLevelId string */
501
-
502
- $json['OtherDiscount'] = $discount;
503
- $json['OtherDiscountCurrency'] = $quote->getQuoteCurrencyCode();
504
- $json['ParcelID'] = Mage::getSingleton('checkout/session')->getParcelId();
505
- $json['ServiceLevel'] = $serviceLevelId;
506
- $json['SessionID'] = '';
507
- $json['key'] = Mage::helper('shippingip')->getGuid();
508
-
509
- $log->setRequest(json_encode($json));
510
-
511
- $response = $this->_restJSON($json, $this->_submitParcel);
512
-
513
- $log->setResponse($response);
514
- $log->save();
515
-
516
- return json_decode($response);
517
- }
518
-
519
- /**
520
- * Send Check Items request
521
- *
522
- * Takes the passed Product Collection and transforms it into data that can
523
- * be passed to the API. It then submits the request as JSON to the
524
- * CheckItems API endpoint.
525
- *
526
- * @param Varien_Data_Collection $collection A Magento Product collection
527
- * @return int The amount of items confirmed valid by the API
528
- */
529
- public function checkItems(Varien_Data_Collection $collection)
530
- {
531
- //init log
532
- $log = Mage::getModel('shippingip/api_log');
533
- /* var $log Iparcel_Shipping_Model_Api_Log */
534
- $log->setController('Check Items');
535
-
536
- $json = array();
537
-
538
- $json['SessionID'] = 'SESSION';
539
- $json['ItemDetailsList'] = array();
540
-
541
- foreach ($collection as $product) {
542
- /* var $product Mage_Catalog_Model_Product */
543
- if (!$product->getSku()) {
544
- continue;
545
- }
546
- $item = array();
547
- $item['SKU'] = $product->getSku();
548
- $item['Quantity'] = 1;
549
- $item['itemStyle'] = null;
550
-
551
- $json['ItemDetailsList'][] = $item;
552
- }
553
-
554
- $json['AddressInfo'] = array();
555
-
556
- $json['AddressInfo']['Billing'] = array();
557
- $json['AddressInfo']['Shipping'] = array();
558
-
559
- $json['AddressInfo']['Shipping']['CountryCode'] = "CA";
560
- $json['AddressInfo']['Shipping']['PostCode'] = "A1A1A1";
561
-
562
- $json['CurrencyCode'] = "CAN";
563
- $json['DDP'] = true;
564
- $json['Insurance'] = false;
565
- $json['ServiceLevel'] = 115;
566
- $json['key'] = Mage::helper('shippingip')->getGuid();
567
-
568
- $log->setRequest(json_encode($json));
569
-
570
- $response = $this->_restJSON($json, $this->_checkItems);
571
-
572
- $log->setResponse($response);
573
- $log->save();
574
-
575
- $response = json_decode($response);
576
- if ($response->ItemDetailsList) {
577
- return count($response->ItemDetailsList);
578
- } else {
579
- return 0;
580
- }
581
- }
582
-
583
- /**
584
- * Send Sales Rule request
585
- *
586
- * Takes the passed SalesRules and transforms it into data that can be
587
- * passed to the API. It then submits the request as JSON to the
588
- * SalesRule API endpoint.
589
- *
590
- * @param Mage_SalesRule_Model_Resource_Rule_Collection Collection of SalesRules to submit
591
- * @return string Response from the SalesRule request
592
- */
593
- public function salesRule(Mage_SalesRule_Model_Resource_Rule_Collection $_collection)
594
- {
595
- $log = Mage::getModel('shippingip/api_log');
596
- /* var $log Iparcel_Shipping_Model_Api_Log */
597
- $log->setController('Sales Rule');
598
-
599
- $json = array();
600
- $json['key'] = Mage::helper('shippingip')->getGuid();
601
- $json['ItemDetailsList'] = array();
602
-
603
- foreach ($_collection as $_rule) {
604
- /* var $_rule Mage_SalesRule_Model_Rule */
605
- $item = array();
606
- $item['Name'] = $_rule->getName();
607
- $item['FormDate'] = $_rule->getFromDate();
608
- $item['ToDate'] = $_rule->getToDate();
609
- $item['IsActive'] = $_rule->getIsActive();
610
- $item['StopRulesProcessing'] = $_rule->getStopRulesProcessing();
611
- $item['SimpleAction'] = $_rule->getSimpleAction();
612
- $item['DiscountAmount'] = $_rule->getDiscountAmount();
613
- $item['DiscountQty'] = $_rule->getDiscountQty();
614
- $item['DiscountStep'] = $_rule->getDiscountStep();
615
- $item['SimpleFreeShipping'] = $_rule->getSimpleFreeShipping();
616
- $item['ApplyToShipping'] = $_rule->getApplyToShipping();
617
- $item['TimesUsed'] = $_rule->getTimesUsed();
618
- $item['CouponType'] = $_rule->getCouponType();
619
-
620
- $item['Conditions'] = unserialize($_rule->getConditionsSerialized());
621
- $item['Actions'] = unserialize($_rule->getActionsSerialized());
622
-
623
- $json['ItemDetailsList'][] = $item;
624
- }
625
-
626
- $log->setRequest(json_encode($json));
627
-
628
- // FIXME: This API Call is no longer used. Should it be removed?
629
- $response = $this->_restJSON($json, null);
630
-
631
- $log->setResponse($response);
632
- $log->save();
633
-
634
- return json_decode($response);
635
- }
636
-
637
- /**
638
- * Set the URLs for API Calls.
639
- *
640
- * Useful for setting the API endpoint URLs to controlled URLs for testing.
641
- *
642
- * @param array $urls Array of URLs to set as [var_name] => 'value'
643
- * @return boolean True on success
644
- */
645
- public function setUrls($urls)
646
- {
647
- try {
648
- foreach ($urls as $name => $url) {
649
- $this->{$name} = $url;
650
- }
651
- } catch (Exception $e) {
652
- Mage::log($e->getMessage());
653
- return false;
654
- }
655
-
656
- return true;
657
- }
658
-
659
- /**
660
- * Performs the work of handling Simple Products with Custom Options
661
- *
662
- * @param Mage_Catalog_Model_Product $product Product with Options
663
- * @return array Options array with all product variations
664
- */
665
- private function _findSimpleProductVariants($product)
666
- {
667
- // get product options collection object
668
- $options = Mage::getModel('catalog/product_option')
669
- ->getCollection()
670
- ->addProductToFilter($product->getId())
671
- ->addPriceToResult(0)
672
- ->addValuesToResult();
673
-
674
- // array indeces for products and product options
675
- $optCount = 0;
676
- $optTypeCount = 0;
677
-
678
- // arrays for sorted products, sorting key/value lookups
679
- $sorted = array();
680
- $productOptions = array();
681
- $productSorting = array();
682
-
683
- foreach ($options as $option) {
684
- // array for products custom options
685
- $customOptions = array();
686
- $optSortOrder = $option["sort_order"];
687
- $optSortKey = 0;
688
-
689
- /**
690
- * If this option has no values (text field, text area, etc.) just
691
- * build a sku for the option ID, otherwise, build out each value as
692
- * well.
693
- */
694
- if (count($option->getValues()) == 0) {
695
- $productOption = $product->getOptions();
696
- $productOption = $productOption[$option->getId()];
697
-
698
- $customOption = array();
699
-
700
- $customOption["sku"] = $option->getId();
701
- $customOption["price"] = $option->getPrice();
702
- $customOption["title"] = $productOption->getTitle();;
703
- $customOption["sort_order"] = $option->getSortOrder();
704
- if (get_class($option) == 'MageWorx_CustomOptions_Model_Catalog_Product_Option') {
705
- $customOption['required'] = $option->getIsRequire(true);
706
- } else {
707
- $customOption['required'] = $option->getIsRequire();
708
- }
709
- $customOptions[$optTypeCount] = $customOption;
710
- $optTypeCount++;
711
- } else {
712
- foreach ($option->getValues() as $values) {
713
- $customOption = array();
714
- // create the sku portion with custom option id and option type id.. 1_2 -> Size_Large
715
- $customOption["sku"] = $values["option_id"] . "-" . $values["option_type_id"];
716
- $customOption["price"] = $values["price"];
717
- $customOption["title"] = $values["title"];
718
- $customOption["sort_order"] = $values["sort_order"];
719
- /**
720
- * Add `required` bit. Used later to build SKU variations.
721
- * If this store uses Mageworx_CustomOptions, act as if we are
722
- * on a product page
723
- */
724
- if (get_class($option) == 'MageWorx_CustomOptions_Model_Catalog_Product_Option') {
725
- $customOption['required'] = $option->getIsRequire(true);
726
- } else {
727
- $customOption['required'] = $option->getIsRequire();
728
- }
729
- // add custom option type to collection
730
- $customOptions[$optTypeCount] = $customOption;
731
- $optTypeCount++;
732
- }
733
- }
734
- // maintain index to sort order relationship
735
- $productSorting[$optCount] = $optSortOrder;
736
- // add custom option type collection to options collections
737
- $customOptionProducts[$optCount] = $customOptions;
738
- $optCount++;
739
- }
740
- // sort by array sort_order value while maintaining array index
741
- asort($productSorting);
742
- $sortCount = 0;
743
-
744
- // iterate sorted indeces and build sorted array of products
745
- foreach ($productSorting as $k => $v) {
746
- $sorted[$sortCount] = $customOptionProducts[$k];
747
- $sortCount++;
748
- }
749
-
750
- return $this->_findVariations($sorted);
751
- }
752
-
753
- /**
754
- * Given an array of options, returns all of the valid option variations
755
- *
756
- * @param array $options Array of option arrays (sku, price, title, sort_order, required)
757
- * @return array Array of arrays, representing the possible option variations
758
- */
759
- private function _findVariations($options)
760
- {
761
- // filter out empty values
762
- $options = array_filter($options);
763
- $result = array(array());
764
- $optionalProductOptions = array();
765
- $requiredOptions = true;
766
-
767
- // Remove the optional product options
768
- foreach ($options as $key => $option) {
769
- foreach ($option as $product) {
770
- if ($product['required'] == false) {
771
- $optionalProductOptions[$key][$product['sku']] = $product;
772
- unset($options[$key]);
773
- }
774
- }
775
- }
776
-
777
- // Add all variations of the required options to the $result array
778
- foreach ($options as $key => $values) {
779
- $append = array();
780
- foreach ($result as $product) {
781
- foreach ($values as $item) {
782
- $product[$key] = $item;
783
- $append[] = $product;
784
- }
785
- }
786
- $result = $append;
787
- }
788
-
789
- // Check for any required options
790
- if (count($result[0]) != 0 || count($result) == 1) {
791
- $requiredOptions = false;
792
- }
793
-
794
- // Add a new product to the $result array for each variation of optional
795
- // product options + the existing required options.
796
- foreach ($result as $productConfiguration) {
797
- foreach ($optionalProductOptions as $option) {
798
- foreach ($option as $product) {
799
- $newVariation = $productConfiguration;
800
- $newVariation[] = $product;
801
- $result[] = $newVariation;
802
- }
803
- }
804
- }
805
-
806
- // If there were no required options, add all variations of optional
807
- // product options
808
- if ($requiredOptions == false && count($optionalProductOptions) > 1) {
809
- $allOptionals = array();
810
- foreach ($optionalProductOptions as $key => $option) {
811
- $allOptionals[] = array_shift($option);
812
- }
813
- $result[] = $allOptionals;
814
- }
815
-
816
- return $result;
817
- }
818
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Helper/Tax.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
- /**
3
- * i-parcel helper for shipping tax&duty
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Helper_Tax extends Mage_Core_Helper_Abstract
10
- {
11
- /**
12
- * Getting shipping tax&duty totals for order
13
- *
14
- * @param Mage_Sales_Model_Order $order
15
- * @return Varien_Data_Connection
16
- */
17
- public function getTotal(Mage_Sales_Model_Order $order)
18
- {
19
- $taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($order->getId());
20
- /* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
21
- $collection = new Varien_Data_Collection();
22
- switch ($taxduty->getMode()) {
23
- case '2':
24
- $collection->addItem(new Varien_Object(array(
25
- 'code' => 'shippingip_duty',
26
- 'value' => $taxduty->getDuty(),
27
- 'base_value' => $taxduty->getDuty(),
28
- 'label' => Mage::getStoreConfig('iparcel/tax/duty_label')
29
- )));
30
- $collection->addItem(new Varien_Object(array(
31
- 'code' => 'shippingip_tax',
32
- 'value' => $taxduty->getTax(),
33
- 'base_value' => $taxduty->getTax(),
34
- 'label' => Mage::getStoreConfig('iparcel/tax/tax_label')
35
- )));
36
- break;
37
- case '1':
38
- $collection->addItem(new Varien_Object(array(
39
- 'code' => 'shippingip_tax',
40
- 'value' => $taxduty->getTax()+$taxduty->getDuty(),
41
- 'base_value' => $taxduty->getTax()+$taxduty->getDuty(),
42
- 'label' => Mage::getStoreConfig('iparcel/tax/tax_duty_label')
43
- )));
44
- break;
45
- }
46
- return $collection;
47
- }
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Carrier/Iparcel.php DELETED
@@ -1,227 +0,0 @@
1
- <?php
2
- /**
3
- * i-parcel shipping method model
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
10
- {
11
- protected $_code = 'i-parcel';
12
- protected $_carrier = 'i-parcel';
13
- protected $_trackingUrl = 'https://tracking.i-parcel.com/secure/track.aspx?track=';
14
-
15
- /**
16
- * Check if carrier has shipping label option available
17
- *
18
- * @return bool
19
- */
20
- public function isShippingLabelsAvailable()
21
- {
22
- return true;
23
- }
24
-
25
- /**
26
- * Check if carrier has shipping tracking option available
27
- *
28
- * @return bool
29
- */
30
- public function isTrackingAvailable()
31
- {
32
- return true;
33
- }
34
-
35
- /**
36
- * Get info for track order page
37
- *
38
- * @param string $number
39
- * @return Varien_Object
40
- */
41
- public function getTrackingInfo($number)
42
- {
43
- return new Varien_Object(array(
44
- 'tracking' => $number,
45
- 'carrier_title' => $this->_carrier,
46
- 'url' => $this->_trackingUrl.$number
47
- ));
48
- }
49
-
50
- /**
51
- * Return container types of carrier
52
- *
53
- * @return array
54
- */
55
- public function getContainerTypes(Varien_Object $params = null)
56
- {
57
- return array('DEFAULT' => Mage::helper('shippingip')->__('Default box'));
58
- }
59
-
60
- /**
61
- * Do request to shipment
62
- *
63
- * @param Mage_Shipping_Model_Shipment_Request $request
64
- * @return Varien_Object
65
- */
66
- public function requestToShipment(Mage_Shipping_Model_Shipment_Request $request)
67
- {
68
- $shipping = $request->getOrderShipment();
69
- /* var $shipping Mage_Sales_Model_Order_Shipment */
70
- $tracking = $shipping->getAllTracks();
71
- if (empty($tracking)) {
72
- Mage::throwException('Invalid Request To Shipment Call');
73
- }
74
- $tracking = $tracking[0];
75
- /* var $tracking Mage_Sales_Model_Order_Shipment_Track */
76
-
77
- // prepare label PDF
78
- $pdf = new Zend_Pdf();
79
- $number = $tracking->getNumber();
80
- $pdfPage = $pdf->pages[] = new Zend_Pdf_Page(('162:75'));
81
- $barcodeFont = Zend_Pdf_Font::fontWithPath(
82
- Mage::getBaseDir('skin') . '/adminhtml/default/default/iparcel/font/code128.ttf'
83
- );
84
- $courier = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
85
- $pdfPage->setFont($courier, 10);
86
- $pdfPage->drawText($number, 15, 10);
87
- $pdfPage->setFont($barcodeFont, 40);
88
- $pdfPage->drawText($number, 15, 25);
89
-
90
- $info = array();
91
- $info[] = array(
92
- 'label_content' => $pdf->render(),
93
- 'tracking_number' => $number
94
- );
95
-
96
- // prepare response
97
- $response = new Varien_Object();
98
- $response->setTrackingNumer($number);
99
- $response->setInfo($info);
100
-
101
- return $response;
102
- }
103
-
104
- /**
105
- * Collect shipping rates for i-parcel shipping
106
- * refactor: add result check, add intermediate storage for parcel_id
107
- *
108
- * @param Mage_Shipping_Model_Rate_Request $request
109
- * @return Mage_Shipping_Model_Rate_Result|bool
110
- */
111
- public function collectRates(Mage_Shipping_Model_Rate_Request $request)
112
- {
113
- try {
114
- if (Mage::getStoreConfig('carriers/i-parcel/active')) {
115
- $iparcel = array();
116
- // array for tax&duty totals
117
-
118
- $result = Mage::getModel('shipping/rate_result');
119
- /*var $result Mage_Shipping_Model_Rate_Result */
120
-
121
- $quote = Mage::helper('shippingip/api')->quote($request);
122
- /* var $quote stdClass */
123
-
124
- $serviceLevel = isset($quote->ServiceLevels) ? $quote->ServiceLevels : (object)array();
125
-
126
- // Load shipping methods names
127
- $methods_names = $this->getMethodsNames();
128
- /* var $methods_names array */
129
-
130
- // Handling serviceLevels results and set up the shipping method
131
- foreach ($serviceLevel as $ci) {
132
- // setting up values
133
- $servicename = @$ci->ServiceLevelID;
134
-
135
- $duty = (float)@$ci->DutyCompanyCurrency;
136
- $tax = (float)@$ci->TaxCompanyCurrency;
137
- $shipping = (float)@$ci->ShippingChargeCompanyCurrency;
138
-
139
- $tax_flag = Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::DISABLED
140
- || $request->getDestCountryId() == $request->getCountryId();
141
- // true if tax intercepting is disabled
142
-
143
- $total = $tax_flag ? (float)($duty + $tax + $shipping) : (float)$shipping;
144
- if (!isset($methods_names[$servicename])) {
145
- continue;
146
- }
147
- $shiplabel = $methods_names[$servicename];
148
- $title = $tax_flag ?
149
- Mage::helper('shippingip')
150
- ->__(
151
- '%s (Shipping Price: %s Duty: %s Tax: %s)',
152
- $shiplabel,
153
- $this->_formatPrice($shipping),
154
- $this->_formatPrice($duty),
155
- $this->_formatPrice($tax)
156
- ) :
157
- $shiplabel;
158
-
159
- $method = Mage::getModel('shipping/rate_result_method');
160
- $method->setCarrier('i-parcel');
161
- $method->setCarrierTitle('i-parcel');
162
- $method->setMethod($servicename);
163
- $method->setMethodTitle($title);
164
- $method->setPrice($total);
165
- $method->setCost($total);
166
- $method->setPriceOriginal($total);
167
- $method->setPriceDuty($duty);
168
- $method->setPriceTax($tax);
169
- $method->setPriceInsurance($total);
170
- $method->setPackageWeight($request->getPackageWeight());
171
-
172
- // append method to result
173
- $result->append($method);
174
-
175
- $iparcel['i-parcel_' . $servicename] = array(
176
- 'duty' => $duty,
177
- 'tax' => $tax
178
- );
179
- }
180
- Mage::unregister('iparcel');
181
- Mage::register('iparcel', $iparcel);
182
- return $result;
183
- }
184
- } catch (Exception $e) {
185
- Mage::logException($e);
186
- }
187
- return false;
188
- }
189
-
190
- public function getMethodsNames()
191
- {
192
- $names = array();
193
- $raw = Mage::getStoreConfig('carriers/i-parcel/name');
194
-
195
- $raw = unserialize($raw);
196
-
197
- foreach ($raw as $method) {
198
- $names[$method['service_id']] = $method['title'];
199
- }
200
-
201
- return $names;
202
- }
203
-
204
- /**
205
- * @param float|int $price
206
- * @return string
207
- */
208
- protected function _formatPrice($price)
209
- {
210
- /** @var Mage_Core_Helper_Data $helper */
211
- $helper = Mage::helper('core');
212
- return $helper->formatPrice($price, false);
213
- }
214
-
215
- /**
216
- * Get Allowed Shipping Methods
217
- *
218
- * @return array
219
- */
220
- public function getAllowedMethods()
221
- {
222
- return array(
223
- 'i-parcel' => $this->_carrier,
224
- 'auto' => 'Auto'
225
- );
226
- }
227
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Catalog/Mapping.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
- /**
3
- * Model for catalog mapping cron
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Catalog_Mapping
10
- {
11
- /**
12
- * Method called by cron
13
- */
14
- public function sync()
15
- {
16
- $productCollection = Mage::getModel('catalog/product')->getCollection();
17
- Mage::helper('shippingip/api')->submitCatalog($productCollection);
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Monthday.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * Backend model for monthday config field
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Config_Data_Date_Monthday extends Mage_Core_Model_Config_Data
10
- {
11
- /**
12
- * Saving monthday if proper value
13
- */
14
- public function save()
15
- {
16
- $_monthday = $this->getValue();
17
- if (Mage::helper('shippingip/string')->isInteger($_monthday) && $_monthday<=31 && $_monthday>0) {
18
- return parent::save();
19
- } else {
20
- Mage::throwException(Mage::helper('shippingip')->__('Wrong day of month'));
21
- }
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Weekday.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * Backend model for weekday config field
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Config_Data_Date_Weekday extends Mage_Core_Model_Config_Data
10
- {
11
- /**
12
- * Saving weekday if proper value
13
- */
14
- public function save()
15
- {
16
- $_weekday = $this->getValue();
17
- if (Mage::helper('shippingip/string')->isInteger($_weekday) && $_weekday<=7 && $_weekday>0) {
18
- return parent::save();
19
- } else {
20
- Mage::throwException(Mage::helper('shippingip')->__('Wrong day of week'));
21
- }
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Config/Data/Time/Minute.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * Backend model for time minute config field
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Config_Data_Time_Minute extends Mage_Core_Model_Config_Data
10
- {
11
- /**
12
- * Saving minute if proper value
13
- */
14
- public function save()
15
- {
16
- $_minute = $this->getValue();
17
- if (Mage::helper('shippingip/string')->isInteger($_minute) && $_minute<60 && $_minute>=0) {
18
- return parent::save();
19
- } else {
20
- Mage::throwException(Mage::helper('shippingip')->__('Wrong minute'));
21
- }
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Api/Order.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Model for Iparcel_Shipping_Model_Api_External_Sales_Order class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Api_Order extends Mage_Core_Model_Resource_Db_Abstract
10
- {
11
- /**
12
- * Initializing Resource
13
- */
14
- protected function _construct()
15
- {
16
- $this->_init('shippingip/api_order', 'id');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Cpf.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Model for Iparcel_Shipping_Model_Cpf class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Cpf extends Mage_Core_Model_Resource_Db_Abstract
10
- {
11
- /**
12
- * Initializing Resource
13
- */
14
- protected function _construct()
15
- {
16
- $this->_init('shippingip/cpf', 'id');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Collection.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Collection Model for Iparcel_Shipping_Model_Cpf class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Cpf_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
- {
11
- /**
12
- * Initializing Resource Collection
13
- */
14
- public function _construct()
15
- {
16
- $this->_init('shippingip/cpf');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Model for Iparcel_Shipping_Model_Cpf_Order class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Cpf_Order extends Mage_Core_Model_Resource_Db_Abstract
10
- {
11
- /**
12
- * Initializing Resource
13
- */
14
- protected function _construct()
15
- {
16
- $this->_init('shippingip/cpf_order', 'id');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order/Collection.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Collection Model for Iparcel_Shipping_Model_Cpf_Order class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Cpf_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
- {
11
- /**
12
- * Initializing Resource Collection
13
- */
14
- public function _construct()
15
- {
16
- $this->_init('shippingip/cpf_order');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Model for Iparcel_Shipping_Model_Cpf_Quote class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Cpf_Quote extends Mage_Core_Model_Resource_Db_Abstract
10
- {
11
- /**
12
- * Initializing Resource
13
- */
14
- protected function _construct()
15
- {
16
- $this->_init('shippingip/cpf_quote', 'id');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote/Collection.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Collection Model for Iparcel_Shipping_Model_Cpf_Quote class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Cpf_Quote_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
- {
11
- /**
12
- * Initializing Resource Collection
13
- */
14
- public function _construct()
15
- {
16
- $this->_init('shippingip/cpf_quote');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Parcel.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Model for Iparcel_Shipping_Model_Cpf class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Parcel extends Mage_Core_Model_Resource_Db_Abstract
10
- {
11
- /**
12
- * Initializing Resource
13
- */
14
- protected function _construct()
15
- {
16
- $this->_init('shippingip/parcel', 'id');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Parcel/Collection.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Collection Model for Iparcel_Shipping_Model_Cpf class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Parcel_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
- {
11
- /**
12
- * Initializing Resource Collection
13
- */
14
- public function _construct()
15
- {
16
- $this->_init('shippingip/parcel');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Setup.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- /**
3
- * Setup Resource class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
10
- {
11
- }
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Model for Iparcel_Shipping_Model_Tax_Totals class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Tax_Totals extends Mage_Core_Model_Resource_Db_Abstract
10
- {
11
- /**
12
- * Initializing Resource
13
- */
14
- protected function _construct()
15
- {
16
- $this->_init('shippingip/tax_totals', 'id');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals/Collection.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Resource Collection Model for Iparcel_Shipping_Model_Tax_Totals class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Resource_Tax_Totals_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
10
- {
11
- /**
12
- * Initializing Resource Collection
13
- */
14
- protected function _construct()
15
- {
16
- $this->_init('shippingip/tax_totals');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Sales/Order/Observer.php DELETED
@@ -1,267 +0,0 @@
1
- <?php
2
- /**
3
- * Sales_Order observer class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Sales_Order_Observer
10
- {
11
- /**
12
- * Initializing CPF
13
- *
14
- * @param Mage_Sales_Model_Order $order
15
- */
16
- protected function _initCpf($order)
17
- {
18
- $cpf = Mage::getModel('shippingip/cpf_order')->loadByOrderId($order->getId());
19
- /* var $cpf Iparcel_Shippingip_Model_Cpf_Order */
20
- if ($cpf->getId()) {
21
- $order->setCpf($cpf->getValue());
22
- }
23
- }
24
-
25
- /**
26
- * Initializing Parcel
27
- *
28
- * @param Mage_Sales_Model_Order $order
29
- */
30
- protected function _initParcel($order)
31
- {
32
- $parcel = Mage::getModel('shippingip/parcel')->loadByOrderId($order->getId());
33
- if ($parcel->getParcelId()) {
34
- $order->setParcel($parcel->getParcelId());
35
- }
36
- }
37
-
38
- /**
39
- * Searching for traching number in order comments
40
- *
41
- * @param Mage_Sales_Model_Order $order
42
- * @return Mage_Sales_Model_Order_Status_History
43
- */
44
- protected function _searchForTrackingNumber($order)
45
- {
46
- foreach ($order->getStatusHistoryCollection() as $status) {
47
- /* var $status Mage_Sales_Model_Order_Status_History */
48
- if (preg_match('/^i-parcel tracking number: ([0-9A-Z]+)$/', $status->getComment()) == 1) {
49
- return $status;
50
- }
51
- }
52
- return null;
53
- }
54
-
55
- /**
56
- * Creating shipment for an order
57
- *
58
- * @param Mage_Sales_Model_Order $order
59
- */
60
- protected function _createShipment($order)
61
- {
62
- if (!$order->getQuote()) {
63
- return;
64
- }
65
- // if it's i-parcel shipping method
66
- if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() != 'i-parcel') {
67
- return;
68
- }
69
- if (!Mage::registry('isExternalSale') && Mage::getStoreConfigFlag('iparcel/config/submit_parcel')) {
70
- /* var $submitParcel stdClass */
71
- $submitParcel = Mage::helper('shippingip/api')->submitParcel($order);
72
- if ($submitParcel && isset($submitParcel->ParcelID)) {
73
- Mage::getSingleton('checkout/session')->setParcelId($submitParcel->ParcelID);
74
- }
75
- }
76
- $tracking = Mage::getSingleton('checkout/session')->getTrackingNumber();
77
- if (!$tracking && isset($submitParcel)) {
78
- $tracking = @$submitParcel->CarrierTrackingNumber;
79
- }
80
- /* var $tracking string */
81
- if ($tracking && !$this->_searchForTrackingNumber($order)) {
82
- $order->addStatusHistoryComment('i-parcel tracking number: '.$tracking);
83
- }
84
- // if autoship is enabled and order can be shipped
85
- if (Mage::getStoreConfigFlag('carriers/i-parcel/autoship')) {
86
- if ($order->canShip()) {
87
- $converter = Mage::getModel('sales/convert_order');
88
- /* var $converter Mage_Sales_Model_Convert_Order */
89
- $shipment = $converter->toShipment($order);
90
- /* var $shipment Mage_Sales_Model_Order_Shipment */
91
- foreach ($order->getAllItems() as $orderItem) {
92
- /* var $orderItem Mage_Sales_Model_Order_Item */
93
- // continue if it is virtual or there is no quantity to ship
94
- if (!$orderItem->getQtyToShip()) {
95
- continue;
96
- }
97
- if ($order->getIsVirtual()) {
98
- continue;
99
- }
100
- $item = $converter->itemToShipmentItem($orderItem);
101
- /* var $item Mage_Sales_Model_Order_Shipment_Item */
102
- $item->setQty($orderItem->getQtyToShip());
103
- $shipment->addItem($item);
104
- }
105
- $shipment->register();
106
- $shipment->getOrder()->setIsInProcess(true);
107
- $transactionSave = Mage::getModel('core/resource_transaction')
108
- ->addObject($shipment)
109
- ->addObject($order);
110
- /* var $transactionSave Mage_Core_Model_Resource_Transaction */
111
- $transactionSave->save();
112
- $shipment->save();
113
- $shipment->sendEmail();
114
- }
115
- }
116
- }
117
-
118
- /**
119
- * Creating CPF for an order
120
- *
121
- * @param Mage_Sales_Model_Order $order
122
- */
123
- protected function _createCpf($order)
124
- {
125
- if ($quote = $order->getQuote()) {
126
- /* var $quote Mage_Sales_Model_Quote */
127
- $cpf = Mage::getModel('shippingip/cpf_order')->loadByOrderId($order->getId());
128
- /* var $cpf Iparcel_Shipping_Model_Cpf_Order */
129
- // create CPF for order if quote has CPF
130
- if ($quote->getCpf()) {
131
- $cpf->setOrderId($order->getId());
132
- $cpf->setValue($quote->getCpf());
133
- $cpf->save();
134
- } elseif ($cpf->getId()) {
135
- $cpf->delete();
136
- }
137
- }
138
- }
139
-
140
- /**
141
- * Creating Parcel for an order
142
- *
143
- * @param Mage_Sales_Model_Order $order
144
- */
145
- protected function _createParcel($order, $parcel_id)
146
- {
147
- $parcel = Mage::getModel('shippingip/parcel')
148
- ->setOrderId($order->getId())
149
- ->setParcelId($parcel_id);
150
- $parcel->save();
151
- }
152
-
153
- /**
154
- * Saving Shipping Tax&Duty Totals
155
- *
156
- * @param Mage_Sales_Model_Order $order
157
- */
158
- protected function _saveTaxDuty($order)
159
- {
160
- $session = Mage::getSingleton('checkout/session');
161
- /* var $custSess Mage_Customer_Model_Session */
162
- $_taxduty = $session->getTaxDutyTotal();
163
- /* var $_taxduty array */
164
- $session->unsTaxDutyTotal();
165
- if ($_taxduty && $order->getShippingCarrier()->getCarrierCode() == 'i-parcel') {
166
- try {
167
- $taxduty = Mage::getModel('shippingip/tax_totals');
168
- $taxduty->setMode($_taxduty['mode']);
169
- $taxduty->setOrderId($order->getId());
170
- $taxduty->setTax($_taxduty['tax']);
171
- $taxduty->setDuty($_taxduty['duty']);
172
- $taxduty->save();
173
- } catch (Exception $e) {
174
- Mage::logException($e);
175
- }
176
- }
177
- }
178
-
179
- /**
180
- * Processing Shipping Tax&Duty Totals
181
- * Setting correct order grand_total
182
- *
183
- * @param Mage_Sales_Model_Order $order
184
- */
185
- protected function _processTaxDuty($order)
186
- {
187
- $_taxduty = Mage::getSingleton('checkout/session')->getTaxDutyTotal();
188
- /* var $_taxduty array */
189
- $order->setBaseGrandTotal($order->getBaseGrandTotal()+$_taxduty['tax']+$_taxduty['duty']);
190
- $order->setGrandTotal($order->getGrandTotal()+$_taxduty['tax']+$_taxduty['duty']);
191
- }
192
-
193
- /**
194
- * Setting order prefix for an order
195
- *
196
- * @param Mage_Sales_Model_Order $order
197
- */
198
- protected function _setOrderPrefix($order)
199
- {
200
- // if prefix is specified and shipping carrier is i-parcel
201
- if (Mage::getStoreConfig('carriers/i-parcel/prefix') && $order->getShippingCarrier()->getCarrierCode() == 'i-parcel') {
202
- // and there's no prefix at the beginning
203
- if (strpos($order->getIncrementId(), Mage::getStoreConfig('carriers/i-parcel/prefix')) !== 0) {
204
- // add prefix at the beginning of increment ID
205
- $order->setIncrementId(Mage::getStoreConfig('carriers/i-parcel/prefix').$order->getIncrementId());
206
- }
207
- }
208
- }
209
-
210
- /**
211
- * Handling external sales API orders
212
- * Setting choosen order status
213
- *
214
- * @param Mage_Sales_Model_Order $order
215
- */
216
- protected function _handleExternal($order)
217
- {
218
- // if external sale is registered and choosen order status is not STATE_COMPLETE
219
- if (Mage::registry('isExternalSale') && ($status=Mage::getStoreConfig('external_api/sales/order_status')) != Mage_Sales_Model_Order::STATE_COMPLETE) {
220
- // set new state
221
- $order->setState($status, $status);
222
- }
223
- }
224
-
225
- /**
226
- * sales_order_save_before event handler
227
- */
228
- public function before_save($observer)
229
- {
230
- $order = $observer->getOrder();
231
- $this->_setOrderPrefix($order);
232
- $this->_processTaxDuty($order);
233
- $this->_handleExternal($order);
234
- }
235
-
236
- /**
237
- * sales_order_save_after event handler
238
- */
239
- public function after_save($observer)
240
- {
241
- $order = $observer->getOrder();
242
- $this->_saveTaxDuty($order);
243
- $this->_createCpf($order);
244
- }
245
-
246
- /**
247
- * sales_order_load_after event handler
248
- */
249
- public function after_load($observer)
250
- {
251
- $order = $observer->getOrder();
252
- $this->_initCpf($order);
253
- $this->_initParcel($order);
254
- }
255
-
256
- /**
257
- * sales_order_place_after event handler
258
- * @param Varien_Event_Observer $observer
259
- */
260
- public function after_place(Varien_Event_Observer $observer)
261
- {
262
- /** @var Mage_Sales_Model_Order $order */
263
- $order = $observer->getOrder();
264
- $this->_createShipment($order);
265
- $this->_createParcel($order, Mage::getSingleton('checkout/session')->getParcelId());
266
- }
267
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Sales/Order/Shipment/Observer.php DELETED
@@ -1,81 +0,0 @@
1
- <?php
2
- /**
3
- * Sales_Order_Shipment observer class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Sales_Order_Shipment_Observer
10
- {
11
- /**
12
- * Getting tracking number from order's comments
13
- *
14
- * @param Mage_Sales_Model_Order $order
15
- * @return string
16
- */
17
- protected function _getTrackingNumber($order)
18
- {
19
- $trackingNumber = '';
20
- foreach ($order->getStatusHistoryCollection() as $status) {
21
- preg_replace_callback('/^i-parcel tracking number: ([0-9A-Z]+)$/', function ($matches) use (&$trackingNumber) {
22
- $trackingNumber = $matches[1];
23
- }, $status->getComment());
24
- }
25
- return $trackingNumber;
26
- }
27
-
28
- /**
29
- * Creating shipping label
30
- *
31
- * @param Mage_Sales_Model_Order_Shipment $shipment
32
- */
33
- protected function _createShippingLabel($shipment)
34
- {
35
- $request = Mage::getModel('shipping/shipment_request');
36
- /* var $request Mage_Shipping_Model_Shipment_Request */
37
- $request->setOrderShipment($shipment);
38
- $response = $shipment->getOrder()->getShippingCarrier()->requestToShipment($request);
39
- $info = $response->getInfo();
40
- $pdfContent = $info[0]['label_content'];
41
-
42
- // parse PDF content
43
- $outputPdf = new Zend_Pdf();
44
- $outputPdf = Zend_Pdf::parse($pdfContent);
45
- $shipment->setShippingLabel($outputPdf->render());
46
- }
47
-
48
- /**
49
- * Creating tracking
50
- *
51
- * @param Mage_Sales_Model_Order_Shipment $shipment
52
- */
53
- protected function _createTracking($shipment)
54
- {
55
- // do nothing if shipment has any tracks
56
- if (count($shipment->getAllTracks())) {
57
- return;
58
- }
59
- $trackingNumber = $this->_getTrackingNumber($shipment->getOrder());
60
- if ($trackingNumber != '') {
61
- $tracking = Mage::getModel('sales/order_shipment_track')
62
- ->setNumber($trackingNumber)
63
- ->setCarrierCode('i-parcel')
64
- ->setTitle('i-parcel');
65
- /* var $tracking Mage_Sales_Model_Order_Shipment_Track */
66
- $shipment->addTrack($tracking);
67
- $this->_createShippingLabel($shipment);
68
- }
69
- }
70
-
71
- /**
72
- * sales_order_shipment_save_before event handler
73
- */
74
- public function before_save($observer)
75
- {
76
- $shipment = $observer->getShipment();
77
- if ($shipment->getOrder()->getShippingCarrier() && $shipment->getOrder()->getShippingCarrier()->getCarrierCode() == 'i-parcel') {
78
- $this->_createTracking($shipment);
79
- }
80
- }
81
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Calculation.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
- /**
3
- * i-parcel's rewritement of tax/calculation class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Calculation extends Mage_Tax_Model_Calculation
10
- {
11
- /**
12
- * Get calculation tax rate by specific request
13
- *
14
- * @param Varien_Object $request
15
- * @return float
16
- */
17
- public function getRate($request)
18
- {
19
- if (!$request->getCountryId() || !$request->getCustomerClassId() || !$request->getProductClassId()) {
20
- return 0;
21
- }
22
- /** @var Mage_Sales_Model_Quote $quote Current session's quote */
23
- $quote = Mage::getSingleton('checkout/session')->getQuote();
24
-
25
- $shippingMethod = explode('_', $quote->getShippingAddress()->getShippingMethod());
26
- // if no quote go to parent
27
- // if i-parcel tax&duty intercepting is disabled go to parent
28
- // if quote is virtual go to parent
29
- // if not domestic shipping go to parent
30
- if (!$quote->getId()
31
- || Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::DISABLED
32
- || $quote->isVirtual()
33
- || $shippingMethod[0] != 'i-parcel'
34
- || Mage::getStoreConfig('general/store_information/merchant_country') == $request->getCountryId()) {
35
- return parent::getRate($request);
36
- }
37
- $method = $quote->getShippingAddress()->getShippingMethod();
38
- $method = explode('_', $method);
39
- // if not i-parcel shipping go to parent
40
- if ($method[0] != 'i-parcel') {
41
- return parent::getRate($request);
42
- }
43
-
44
- /* var $totals array */
45
- $totals = $quote->getTotals();
46
- if (isset($totals['tax'])) {
47
- $totals['tax']->setValue(0);
48
- }
49
-
50
- // set tax rate value to 0
51
- $cacheKey = $this->_getRequestCacheKey($request);
52
- /* var $cacheKey string */
53
- if (!isset($this->_rateCache[$cacheKey])) {
54
- $this->unsCalculationProcess();
55
- $this->unsEventModuleId();
56
- $this->setRateValue(0);
57
- Mage::dispatchEvent('tax_rate_data_fetch', array('request'=>$request));
58
- $this->setCalculationProcess($this->_formCalculationProcess());
59
- $this->_rateCache[$cacheKey] = $this->getRateValue();
60
- $this->_rateCalculationProcess[$cacheKey] = $this->getCalculationProcess();
61
- }
62
- return $this->_rateCache[$cacheKey];
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
- /**
3
- * Db model for i-parcel's tax intercepting
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Totals extends Mage_Core_Model_Abstract
10
- {
11
- /**
12
- * Initializing model in internal constructor
13
- */
14
- protected function _construct()
15
- {
16
- $this->_init('shippingip/tax_totals');
17
- }
18
-
19
- /**
20
- * Load totals by order_id
21
- *
22
- * @param int $orderId, string $fields='*'
23
- * @return Iparcel_Shipping_Model_Tax_Totals
24
- */
25
- public function loadByOrderId($orderId, $attributes = '*')
26
- {
27
- $collection = $this->getResourceCollection()
28
- ->addFieldToSelect($attributes)
29
- ->addFieldToFilter('order_id', $orderId);
30
- return $collection->getFirstItem();
31
- }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Abstract.php DELETED
@@ -1,124 +0,0 @@
1
- <?php
2
- /**
3
- * Abstract class for i-parcel shipping tax&duty tax and totals
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- abstract class Iparcel_Shipping_Model_Tax_Totals_Abstract extends Mage_Sales_Model_Quote_Address_Total_Abstract
10
- {
11
- protected $_tax;
12
- protected $_duty;
13
-
14
- /**
15
- * Those constants have to be redefined in derived class
16
- */
17
- const XPATH_LABEL = null;
18
- const TOTAL_CODE = null;
19
-
20
- /**
21
- * Checking if current total is enabled
22
- *
23
- * @return bool
24
- */
25
- abstract protected function _isEnabled();
26
-
27
- /**
28
- * Adding amount to total
29
- */
30
- abstract protected function _addAmountToTotal();
31
-
32
- /**
33
- * Checking if shipping is domestic
34
- * @param Mage_Sales_Model_Quote_Address $address
35
- * @return bool
36
- */
37
- protected function _isDomestic($address)
38
- {
39
- return Mage::getStoreConfig('general/store_information/merchant_country') == $address->getCountryId();
40
- }
41
-
42
- /**
43
- * Getting mode od i-parcel shipping tax&duty
44
- *
45
- * @return string
46
- */
47
- protected function _getMode()
48
- {
49
- return Mage::getStoreConfig('iparcel/tax/mode');
50
- }
51
-
52
- /**
53
- * Getting label for current total
54
- *
55
- * @return string
56
- */
57
- protected function _getLabel()
58
- {
59
- return Mage::getStoreConfig($this::XPATH_LABEL);
60
- }
61
-
62
- /**
63
- * Setting total code in constructor
64
- */
65
- public function __construct()
66
- {
67
- $this->setCode($this::TOTAL_CODE);
68
- }
69
-
70
- /**
71
- * Collect totals process.
72
- *
73
- * @param Mage_Sales_Model_Quote_Address $address
74
- * @return Iparcel_Shipping_Model_Tax_Totals_Abstract
75
- */
76
- public function collect(Mage_Sales_Model_Quote_Address $address)
77
- {
78
- parent::collect($address);
79
- if ($this->_isEnabled() && !$this->_isDomestic($address)) {
80
- $quote = $address->getQuote();
81
- /* var $quote Mage_Sales_Model_Quote */
82
- // return if it's virtual quote
83
- if ($quote->isVirtual()) {
84
- return $this;
85
- }
86
- // we need shipping address
87
- if (($address->getAddressType() == 'billing')) {
88
- $address = $address->getQuote()->getShippingAddress();
89
- }
90
- $this->_setAddress($address);
91
- $_tax = 0;
92
- $_duty = 0;
93
- $_shipping = $address->getShippingMethod();
94
- /* var $_shipping string */
95
- $tax = Mage::registry('iparcel');
96
- /* var $tax array */
97
- if (isset($tax[$_shipping])) {
98
- $tax = $tax[$_shipping];
99
- $rates = $address->getShippingRatesCollection();
100
- /* var $rates Mage_Eav_Model_Entity_Collection_Abstract */
101
- foreach ($rates as $rate) {
102
- /* var $rate Mage_Sales_Model_Quote_Address_Rate */
103
- if (($name = $rate->getCarrier().'_'.$rate->getMethod()) == $_shipping) {
104
- $_tax = $tax['tax'];
105
- $_duty = $tax['duty'];
106
- }
107
- }
108
- }
109
- $this->_tax = $_tax;
110
- $this->_duty = $_duty;
111
- $this->_addAmountToTotal();
112
- $address->setShippingipTotalTax($_tax);
113
- $address->setShippingipTotalDuty($_duty);
114
- if ($_tax+$_duty) {
115
- Mage::getSingleton('checkout/session')->setTaxDutyTotal(array(
116
- 'mode' => $this->_getMode(),
117
- 'tax' => $_tax,
118
- 'duty' => $_duty
119
- ));
120
- }
121
- }
122
- return $this;
123
- }
124
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Creditmemo.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Shipping duty tax for creditmemo total class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Totals_Duty_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
10
- {
11
- /**
12
- * Collect credit memo subtotal
13
- *
14
- * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
15
- * @return Iparcel_Shipping_Model_Tax_Totals_Duty_Creditmemo
16
- */
17
- public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
18
- {
19
- $taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($creditmemo->getOrder()->getId());
20
- /* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
21
- if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY) {
22
- $amount = $taxduty->getDuty();
23
- $creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$amount);
24
- $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$amount);
25
- }
26
- return $this;
27
- }
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Invoice.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Shipping duty tax for invoice total class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Totals_Duty_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract
10
- {
11
- /**
12
- * Collect invoice subtotal
13
- *
14
- * @param Mage_Sales_Model_Order_Invoice $invoice
15
- * @return Iparcel_Shipping_Model_Tax_Totals_Duty_Invoice
16
- */
17
- public function collect(Mage_Sales_Model_Order_Invoice $invoice)
18
- {
19
- $taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($invoice->getOrder()->getId());
20
- /* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
21
- if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY) {
22
- $amount = $taxduty->getDuty();
23
- $invoice->setGrandTotal($invoice->getGrandTotal()+$amount);
24
- $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$amount);
25
- }
26
- return $this;
27
- }
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Quote.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
- /**
3
- * Shipping duty tax for quote total class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Totals_Duty_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract
10
- {
11
- const XPATH_LABEL = 'iparcel/tax/duty_label';
12
- const TOTAL_CODE = 'shippingip_total_duty';
13
-
14
- /**
15
- * Checking if current total is enabled
16
- *
17
- * @return bool
18
- */
19
- protected function _isEnabled()
20
- {
21
- return $this->_getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY;
22
- }
23
-
24
- /**
25
- * Adding amount to total
26
- */
27
- protected function _addAmountToTotal()
28
- {
29
- $this->_addAmount($this->_duty);
30
- $this->_addBaseAmount($this->_duty);
31
- }
32
-
33
- /**
34
- * Fetching current total to quote
35
- *
36
- * @param Mage_Sales_Model_Quote_Address $address
37
- * @return Iparcel_Shipping_Model_Tax_Totals_Duty_Quote
38
- */
39
- public function fetch(Mage_Sales_Model_Quote_Address $address)
40
- {
41
- if ($this->_isEnabled() && !$this->_isDomestic($address)) {
42
- $quote = $address->getQuote();
43
- /* var $quote Mage_Sales_Model_Quote */
44
- // do nothing if it's virtual quote
45
- if ($quote->isVirtual()) {
46
- return $this;
47
- }
48
- // shipping address needed (it's shipping depended tax)
49
- if (($address->getAddressType() == 'billing')) {
50
- $address = $address->getQuote()->getShippingAddress();
51
- }
52
- $this->_setAddress($address);
53
- $_duty = $address->getShippingipTotalDuty();
54
- if ($_duty) {
55
- $address->addTotal(array(
56
- 'code' => $this->getCode(),
57
- 'title' => $this->_getLabel(),
58
- 'value' => $_duty
59
- ));
60
- }
61
- }
62
- return $this;
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Creditmemo.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Shipping tax tax for creditmemo total class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Totals_Tax_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
10
- {
11
- /**
12
- * Collect credit memo subtotal
13
- *
14
- * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
15
- * @return Iparcel_Shipping_Model_Tax_Totals_Tax_Creditmemo
16
- */
17
- public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
18
- {
19
- $taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($creditmemo->getOrder()->getId());
20
- /* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
21
- if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY) {
22
- $amount = $taxduty->getTax();
23
- $creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$amount);
24
- $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$amount);
25
- }
26
- return $this;
27
- }
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Invoice.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Shipping tax tax for invoice total class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Totals_Tax_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract
10
- {
11
- /**
12
- * Collect invoice subtotal
13
- *
14
- * @param Mage_Sales_Model_Order_Invoice $invoice
15
- * @return Iparcel_Shipping_Model_Tax_Totals_Tax_Invoice
16
- */
17
- public function collect(Mage_Sales_Model_Order_Invoice $invoice)
18
- {
19
- $taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($invoice->getOrder()->getId());
20
- /* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
21
- if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY) {
22
- $amount = $taxduty->getTax();
23
- $invoice->setGrandTotal($invoice->getGrandTotal()+$amount);
24
- $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$amount);
25
- }
26
- return $this;
27
- }
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Quote.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
- /**
3
- * Shipping tax tax for quote total class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Totals_Tax_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract
10
- {
11
- const XPATH_LABEL = 'iparcel/tax/tax_label';
12
- const TOTAL_CODE = 'shippingip_total_tax';
13
-
14
- /**
15
- * Checking if current total is enabled
16
- *
17
- * @return bool
18
- */
19
- protected function _isEnabled()
20
- {
21
- return $this->_getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY;
22
- }
23
-
24
- /**
25
- * Adding amount to total
26
- */
27
- protected function _addAmountToTotal()
28
- {
29
- $this->_addAmount($this->_tax);
30
- $this->_addBaseAmount($this->_tax);
31
- }
32
-
33
- /**
34
- * Fetching current total to quote
35
- *
36
- * @param Mage_Sales_Model_Quote_Address $address
37
- * @return Iparcel_Shipping_Model_Tax_Totals_Tax_Quote
38
- */
39
- public function fetch(Mage_Sales_Model_Quote_Address $address)
40
- {
41
- if ($this->_isEnabled() && !$this->_isDomestic($address)) {
42
- $quote = $address->getQuote();
43
- /* var $quote Mage_Sales_Model_Quote */
44
- // do nothing if it's virtual quote
45
- if ($quote->isVirtual()) {
46
- return $this;
47
- }
48
- // shipping address needed (it's shipping depended tax)
49
- if (($address->getAddressType() == 'billing')) {
50
- $address = $address->getQuote()->getShippingAddress();
51
- }
52
- $this->_setAddress($address);
53
- $_tax = $address->getShippingipTotalTax();
54
- if ($_tax) {
55
- $address->addTotal(array(
56
- 'code' => $this->getCode(),
57
- 'title' => $this->_getLabel(),
58
- 'value' => $_tax
59
- ));
60
- }
61
- }
62
- return $this;
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Creditmemo.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Shipping tax&duty tax for creditmemo total class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
10
- {
11
- /**
12
- * Collect credit memo subtotal
13
- *
14
- * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
15
- * @return Iparcel_Shipping_Model_Tax_Totals_Taxduty_Creditmemo
16
- */
17
- public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
18
- {
19
- $taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($creditmemo->getOrder()->getId());
20
- /* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
21
- if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::CUMULATIVELY) {
22
- $amount = $taxduty->getTax()+$taxduty->getDuty();
23
- $creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$amount);
24
- $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$amount);
25
- }
26
- return $this;
27
- }
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Invoice.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Shipping tax&duty tax for invoice total class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract
10
- {
11
- /**
12
- * Collect invoice subtotal
13
- *
14
- * @param Mage_Sales_Model_Order_Invoice $invoice
15
- * @return Iparcel_Shipping_Model_Tax_Totals_Taxduty_Invoice
16
- */
17
- public function collect(Mage_Sales_Model_Order_Invoice $invoice)
18
- {
19
- $taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($invoice->getOrder()->getId());
20
- /* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
21
- if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::CUMULATIVELY) {
22
- $amount = $taxduty->getTax()+$taxduty->getDuty();
23
- $invoice->setGrandTotal($invoice->getGrandTotal()+$amount);
24
- $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$amount);
25
- }
26
- return $this;
27
- }
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Quote.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
- /**
3
- * Shipping tax&duty tax for quote total class
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_Shipping
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract
10
- {
11
- const TOTAL_CODE = 'shippingip_total_taxduty';
12
- const XPATH_LABEL = 'iparcel/tax/tax_duty_label';
13
-
14
- /**
15
- * Checking if current total is enabled
16
- *
17
- * @return bool
18
- */
19
- protected function _isEnabled()
20
- {
21
- return $this->_getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::CUMULATIVELY;
22
- }
23
-
24
- /**
25
- * Adding amount to total
26
- */
27
- protected function _addAmountToTotal()
28
- {
29
- $this->_addAmount($this->_tax+$this->_duty);
30
- $this->_addBaseAmount($this->_tax+$this->_duty);
31
- }
32
-
33
- /**
34
- * Fetching current total to quote
35
- *
36
- * @param Mage_Sales_Model_Quote_Address $address
37
- * @return Iparcel_Shipping_Model_Tax_Totals_Taxduty_Quote
38
- */
39
- public function fetch(Mage_Sales_Model_Quote_Address $address)
40
- {
41
- if ($this->_isEnabled() && !$this->_isDomestic($address)) {
42
- $quote = $address->getQuote();
43
- /* var $quote Mage_Sales_Model_Quote */
44
- // do nothing if it's virtual quote
45
- if ($quote->isVirtual()) {
46
- return $this;
47
- }
48
- // shipping address needed (it's shipping depended tax)
49
- if (($address->getAddressType() == 'billing')) {
50
- $address = $address->getQuote()->getShippingAddress();
51
- }
52
- $this->_setAddress($address);
53
- $_tax = $address->getShippingipTotalTax();
54
- $_duty = $address->getShippingipTotalDuty();
55
- if ($_tax+$_duty) {
56
- $address->addTotal(array(
57
- 'code' => $this->getCode(),
58
- 'title' => $this->_getLabel(),
59
- 'value' => $_tax+$_duty
60
- ));
61
-
62
- }
63
- }
64
- return $this;
65
- }
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/etc/adminhtml.xml DELETED
@@ -1,46 +0,0 @@
1
- <config>
2
- <menu>
3
- <iparcel translate="title" module="shippingip">
4
- <title>i-parcel</title>
5
- <sort_order>999</sort_order>
6
- <children>
7
- <config translate="title" module="shippingip">
8
- <title>Configuration</title>
9
- <sort_order>0</sort_order>
10
- <action>adminhtml/system_config/edit/section/iparcel</action>
11
- </config>
12
- <sync translate="title" module="shippingip">
13
- <title>Synchronization</title>
14
- <sort_order>5</sort_order>
15
- <children>
16
- <catalog_mapping translate="title" module="shippingip">
17
- <title>Catalog Mapping</title>
18
- <sort_order>5</sort_order>
19
- <action>adminhtml/system_config/edit/section/catalog_mapping</action>
20
- </catalog_mapping>
21
- <!--<salesrules translate="title" module="shippingip">-->
22
- <!--<title>Sales Rules</title>-->
23
- <!--<sort_order>10</sort_order>-->
24
- <!--<action>adminhtml/system_config/edit/section/salesrules</action>-->
25
- <!--</salesrules>-->
26
- </children>
27
- </sync>
28
- <shipping translate="title" module="shippingip">
29
- <title>Shipping Methods</title>
30
- <sort_order>10</sort_order>
31
- <action>adminhtml/system_config/edit/section/carriers</action>
32
- </shipping>
33
- <external_api translate="title" module="shippingip">
34
- <title>External API</title>
35
- <sort_order>15</sort_order>
36
- <action>adminhtml/system_config/edit/section/external_api</action>
37
- </external_api>
38
- <log>
39
- <title>Logs</title>
40
- <sort_order>20</sort_order>
41
- <action>adminhtml/shippingip_log/index</action>
42
- </log>
43
- </children>
44
- </iparcel>
45
- </menu>
46
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/etc/config.xml DELETED
@@ -1,463 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Iparcel_Shipping>
5
- <version>2.4.11</version>
6
- </Iparcel_Shipping>
7
- </modules>
8
- <crontab>
9
- <jobs>
10
- <iparcel_catalog_mapping>
11
- <run>
12
- <model>shippingip/catalog_mapping::sync</model>
13
- </run>
14
- </iparcel_catalog_mapping>
15
- </jobs>
16
- </crontab>
17
- <frontend>
18
- <routers>
19
- <ship>
20
- <use>standard</use>
21
- <args>
22
- <module>Iparcel_Shipping</module>
23
- <frontName>shippingip</frontName>
24
- </args>
25
- </ship>
26
- </routers>
27
- <layout>
28
- <updates>
29
- <shippingip>
30
- <file>externalshipping.xml</file>
31
- </shippingip>
32
- </updates>
33
- </layout>
34
- </frontend>
35
- <admin>
36
- <routers>
37
- <adminhtml>
38
- <args>
39
- <modules>
40
- <shippingip after="Mage_Adminhtml">Iparcel_Shipping_Adminhtml</shippingip>
41
- </modules>
42
- </args>
43
- </adminhtml>
44
- </routers>
45
- </admin>
46
- <adminhtml>
47
- <layout>
48
- <updates>
49
- <shippingip>
50
- <file>externalsales.xml</file>
51
- </shippingip>
52
- </updates>
53
- </layout>
54
- <acl>
55
- <resources>
56
- <admin>
57
- <children>
58
- <system>
59
- <children>
60
- <config>
61
- <children>
62
- <catalog_mapping>
63
- <title>i-parcel Catalog Mapping</title>
64
- </catalog_mapping>
65
- <salesrules>
66
- <title>i-parcel Sales Rules Synchronization</title>
67
- </salesrules>
68
- <external_api>
69
- <title>i-parcel External API</title>
70
- </external_api>
71
- <iparcel>
72
- <title>i-parcel Configuration</title>
73
- </iparcel>
74
- </children>
75
- </config>
76
- </children>
77
- </system>
78
- </children>
79
- </admin>
80
- </resources>
81
- </acl>
82
- </adminhtml>
83
- <global>
84
- <models>
85
- <shippingip>
86
- <class>Iparcel_Shipping_Model</class>
87
- <resourceModel>shippingip_resource</resourceModel>
88
- </shippingip>
89
- <shippingip_resource>
90
- <class>Iparcel_Shipping_Model_Resource</class>
91
- <entities>
92
- <api_order>
93
- <table>iparcel_shipping_api_order</table>
94
- </api_order>
95
- <cpf>
96
- <table>iparcel_shipping_cpf</table>
97
- </cpf>
98
- <cpf_order>
99
- <table>iparcel_shipping_cpf_order</table>
100
- </cpf_order>
101
- <cpf_quote>
102
- <table>iparcel_shipping_cpf_quote</table>
103
- </cpf_quote>
104
- <parcel>
105
- <table>iparcel_shipping_parcel</table>
106
- </parcel>
107
- <tax_totals>
108
- <table>iparcel_shipping_tax_totals</table>
109
- </tax_totals>
110
- </entities>
111
- </shippingip_resource>
112
- <tax>
113
- <rewrite>
114
- <calculation>Iparcel_Shipping_Model_Tax_Calculation</calculation>
115
- </rewrite>
116
- </tax>
117
- </models>
118
- <events>
119
- <catalog_product_save_after>
120
- <observers>
121
- <iparcel_catalog_product_observer>
122
- <type>singleton</type>
123
- <class>Iparcel_Shipping_Model_Catalog_Product_Observer</class>
124
- <method>product_save</method>
125
- </iparcel_catalog_product_observer>
126
- </observers>
127
- </catalog_product_save_after>
128
- <catalog_product_attribute_update_before>
129
- <observers>
130
- <iparcel_catalog_product_observer>
131
- <type>singleton</type>
132
- <class>Iparcel_Shipping_Model_Catalog_Product_Observer</class>
133
- <method>product_massUpdate</method>
134
- </iparcel_catalog_product_observer>
135
- </observers>
136
- </catalog_product_attribute_update_before>
137
- <catalog_product_delete_before>
138
- <observers>
139
- <iparcel_catalog_product_observer>
140
- <type>singleton</type>
141
- <class>Iparcel_Shipping_Model_Catalog_Product_Observer</class>
142
- <method>product_delete</method>
143
- </iparcel_catalog_product_observer>
144
- </observers>
145
- </catalog_product_delete_before>
146
- <sales_order_load_after>
147
- <observers>
148
- <iparcel_sales_order_load_after_observer>
149
- <type>singleton</type>
150
- <class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
151
- <method>after_load</method>
152
- </iparcel_sales_order_load_after_observer>
153
- </observers>
154
- </sales_order_load_after>
155
- <sales_order_place_after>
156
- <observers>
157
- <iparcel_sales_order_place_after_observer>
158
- <type>singleton</type>
159
- <class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
160
- <method>after_place</method>
161
- </iparcel_sales_order_place_after_observer>
162
- </observers>
163
- </sales_order_place_after>
164
- <sales_order_save_before>
165
- <observers>
166
- <iparcel_sales_order_save_before_observer>
167
- <type>singleton</type>
168
- <class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
169
- <method>before_save</method>
170
- </iparcel_sales_order_save_before_observer>
171
- </observers>
172
- </sales_order_save_before>
173
- <sales_order_save_after>
174
- <observers>
175
- <iparcel_sales_order_save_after_observer>
176
- <type>singleton</type>
177
- <class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
178
- <method>after_save</method>
179
- </iparcel_sales_order_save_after_observer>
180
- </observers>
181
- </sales_order_save_after>
182
- <sales_order_shipment_save_before>
183
- <observers>
184
- <iparcel_sales_order_shipment_save_before_observer>
185
- <type>singleton</type>
186
- <class>Iparcel_Shipping_Model_Sales_Order_Shipment_Observer</class>
187
- <method>before_save</method>
188
- </iparcel_sales_order_shipment_save_before_observer>
189
- </observers>
190
- </sales_order_shipment_save_before>
191
- <sales_quote_load_after>
192
- <observers>
193
- <iparcel_sales_quote_load_after_observer>
194
- <type>singleton</type>
195
- <class>Iparcel_Shipping_Model_Sales_Quote_Observer</class>
196
- <method>after_load</method>
197
- </iparcel_sales_quote_load_after_observer>
198
- </observers>
199
- </sales_quote_load_after>
200
- <sales_quote_save_after>
201
- <observers>
202
- <iparcel_sales_quote_save_after_observer>
203
- <type>singleton</type>
204
- <class>Iparcel_Shipping_Model_Sales_Quote_Observer</class>
205
- <method>after_save</method>
206
- </iparcel_sales_quote_save_after_observer>
207
- </observers>
208
- </sales_quote_save_after>
209
- <sales_quote_save_before>
210
- <observers>
211
- <iparcel_sales_quote_save_before_observer>
212
- <type>singleton</type>
213
- <class>Iparcel_Shipping_Model_Sales_Quote_Observer</class>
214
- <method>before_save</method>
215
- </iparcel_sales_quote_save_before_observer>
216
- </observers>
217
- </sales_quote_save_before>
218
- <model_load_before>
219
- <observers>
220
- <iparcel_model_load_before_observer>
221
- <type>singleton</type>
222
- <class>Iparcel_Shipping_Model_Observer</class>
223
- <method>createCheckState</method>
224
- </iparcel_model_load_before_observer>
225
- </observers>
226
- </model_load_before>
227
- <adminhtml_cache_refresh_type>
228
- <observers>
229
- <iparcel_adminhtml_cache_refresh_type_observer>
230
- <type>singleton</type>
231
- <class>Iparcel_Shipping_Model_Observer</class>
232
- <method>removeExtendFile</method>
233
- </iparcel_adminhtml_cache_refresh_type_observer>
234
- </observers>
235
- </adminhtml_cache_refresh_type>
236
- <adminhtml_cache_flush_all>
237
- <observers>
238
- <iparcel_adminhtml_cache_flush_all_observer>
239
- <type>singleton</type>
240
- <class>Iparcel_Shipping_Model_Observer</class>
241
- <method>removeExtendFile</method>
242
- </iparcel_adminhtml_cache_flush_all_observer>
243
- </observers>
244
- </adminhtml_cache_flush_all>
245
- <adminhtml_cache_flush_system>
246
- <observers>
247
- <iparcel_adminhtml_cache_flush_system_observer>
248
- <type>singleton</type>
249
- <class>Iparcel_Shipping_Model_Observer</class>
250
- <method>removeExtendFile</method>
251
- </iparcel_adminhtml_cache_flush_system_observer>
252
- </observers>
253
- </adminhtml_cache_flush_system>
254
- </events>
255
- <resources>
256
- <shippingip_setup>
257
- <setup>
258
- <module>Iparcel_Shipping</module>
259
- <class>Iparcel_Shipping_Model_Resource_Setup</class>
260
- </setup>
261
- <connection>
262
- <use>core_setup</use>
263
- </connection>
264
- </shippingip_setup>
265
- <shippingip_write>
266
- <connection>
267
- <use>core_write</use>
268
- </connection>
269
- </shippingip_write>
270
- <shippingip_read>
271
- <connection>
272
- <use>core_read</use>
273
- </connection>
274
- </shippingip_read>
275
- </resources>
276
- <blocks>
277
- <adminhtml>
278
- <rewrite>
279
- <sales_order_shipment_view_form>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Form</sales_order_shipment_view_form>
280
- <sales_order_shipment_view_tracking>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Tracking</sales_order_shipment_view_tracking>
281
- <sales_order_totals>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Totals</sales_order_totals>
282
- <sales_order_invoice_totals>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Invoice_Totals</sales_order_invoice_totals>
283
- <sales_order_creditmemo_totals>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Creditmemo_Totals</sales_order_creditmemo_totals>
284
- </rewrite>
285
- </adminhtml>
286
- <catalog>
287
- <rewrite>
288
- <product_list>Iparcel_Shipping_Block_Catalog_Product_List</product_list>
289
- </rewrite>
290
- </catalog>
291
- <sales>
292
- <rewrite>
293
- <order_totals>Iparcel_Shipping_Block_Sales_Order_Totals</order_totals>
294
- <order_invoice_totals>Iparcel_Shipping_Block_Sales_Order_Invoice_Totals</order_invoice_totals>
295
- <order_creditmemo_totals>Iparcel_Shipping_Block_Sales_Order_Creditmemo_Totals</order_creditmemo_totals>
296
- </rewrite>
297
- </sales>
298
- <shippingip>
299
- <class>Iparcel_Shipping_Block</class>
300
- </shippingip>
301
- <tax>
302
- <rewrite>
303
- <checkout_tax>Iparcel_Shipping_Block_Tax_Checkout_Tax</checkout_tax>
304
- </rewrite>
305
- </tax>
306
- </blocks>
307
- <helpers>
308
- <shippingip>
309
- <class>Iparcel_Shipping_Helper</class>
310
- </shippingip>
311
- <sales>
312
- <rewrite>
313
- <data>Iparcel_Shipping_Helper_Sales_Data</data>
314
- </rewrite>
315
- </sales>
316
- </helpers>
317
- <sales>
318
- <quote>
319
- <totals>
320
- <shippingip_totals_taxduty>
321
- <class>shippingip/tax_totals_taxduty_quote</class>
322
- <after>tax</after>
323
- <before>grand_total</before>
324
- </shippingip_totals_taxduty>
325
- <shippingip_totals_tax>
326
- <class>shippingip/tax_totals_tax_quote</class>
327
- <after>tax</after>
328
- <before>grand_total</before>
329
- </shippingip_totals_tax>
330
- <shippingip_totals_duty>
331
- <class>shippingip/tax_totals_duty_quote</class>
332
- <after>tax</after>
333
- <before>grand_total</before>
334
- </shippingip_totals_duty>
335
- </totals>
336
- </quote>
337
- <order_invoice>
338
- <totals>
339
- <shippingip_totals_taxduty>
340
- <class>shippingip/tax_totals_taxduty_invoice</class>
341
- <after>shipping</after>
342
- <before>grand_total</before>
343
- </shippingip_totals_taxduty>
344
- <shippingip_totals_tax>
345
- <class>shippingip/tax_totals_tax_invoice</class>
346
- <after>shipping</after>
347
- <before>grand_total</before>
348
- </shippingip_totals_tax>
349
- <shippingip_totals_duty>
350
- <class>shippingip/tax_totals_duty_invoice</class>
351
- <after>shipping</after>
352
- <before>grand_total</before>
353
- </shippingip_totals_duty>
354
- <discount>
355
- <after>nominal,subtotal,msrp,freeshipping,tax_subtotal,weee</after>
356
- <before>shipping</before>
357
- </discount>
358
- <shipping>
359
- <after>discount</after>
360
- <before>tax_shipping</before>
361
- </shipping>
362
- <tax_shipping>
363
- <after>shipping</after>
364
- <before>tax</before>
365
- </tax_shipping>
366
- <tax>
367
- <after>tax_shipping</after>
368
- <before>grand_total</before>
369
- </tax>
370
- </totals>
371
- </order_invoice>
372
- <order_creditmemo>
373
- <totals>
374
- <shippingip_totals_taxduty>
375
- <class>shippingip/tax_totals_taxduty_creditmemo</class>
376
- <after>shipping</after>
377
- <before>grand_total</before>
378
- </shippingip_totals_taxduty>
379
- <shippingip_totals_tax>
380
- <class>shippingip/tax_totals_tax_creditmemo</class>
381
- <after>shipping</after>
382
- <before>grand_total</before>
383
- </shippingip_totals_tax>
384
- <shippingip_totals_duty>
385
- <class>shippingip/tax_totals_duty_creditmemo</class>
386
- <after>shipping</after>
387
- <before>grand_total</before>
388
- </shippingip_totals_duty>
389
- </totals>
390
- </order_creditmemo>
391
- </sales>
392
- </global>
393
- <default>
394
- <carriers>
395
- <i-parcel>
396
- <active>1</active>
397
- <model>shippingip/carrier_iparcel</model>
398
- <title>I-Parcel</title>
399
- <sort_order>10</sort_order>
400
- <sallowspecific>0</sallowspecific>
401
- <username>custtest</username>
402
- <password>custtest</password>
403
- <autoship>1</autoship>
404
- <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
405
- <whitelabelpay>i-parcel</whitelabelpay>
406
- <whitelabelship>i-parcel</whitelabelship>
407
- </i-parcel>
408
- </carriers>
409
- <payment>
410
- <iparcel>
411
- <active>1</active>
412
- <model>shippingip/payment_iparcel</model>
413
- </iparcel>
414
- </payment>
415
- <iparcel>
416
- <config>
417
- <submit_parcel>1</submit_parcel>
418
- <timeout>3</timeout>
419
- </config>
420
- <scripts>
421
- <jquery>0</jquery>
422
- <scripts>0</scripts>
423
- </scripts>
424
- <tax>
425
- <mode>0</mode>
426
- <tax_duty_label><![CDATA[Tax&Duty]]></tax_duty_label>
427
- <tax_label>Tax</tax_label>
428
- <duty_label>Duty</duty_label>
429
- </tax>
430
- </iparcel>
431
- <external_api>
432
- <sales>
433
- <enabled>1</enabled>
434
- <transactional_emails>0</transactional_emails>
435
- <order_status>complete</order_status>
436
- </sales>
437
- </external_api>
438
- <sales>
439
- <totals_sort>
440
- <shippingip_total_taxduty>35</shippingip_total_taxduty>
441
- <shippingip_total_tax>36</shippingip_total_tax>
442
- <shippingip_total_duty>37</shippingip_total_duty>
443
- </totals_sort>
444
- </sales>
445
- <dev>
446
- <i-parcel>
447
- <debug>0</debug>
448
- </i-parcel>
449
- </dev>
450
- <catalog_mapping>
451
- <config>
452
- <auto_upload>0</auto_upload>
453
- </config>
454
- <upload>
455
- <step>100</step>
456
- <offset>0</offset>
457
- </upload>
458
- <attributes>
459
- <price>1</price>
460
- </attributes>
461
- </catalog_mapping>
462
- </default>
463
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/etc/system.xml DELETED
@@ -1,616 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <tabs>
4
- <i-parcel translate="label" module="shippingip">
5
- <label>i-parcel</label>
6
- <sort_order>500</sort_order>
7
- </i-parcel>
8
- </tabs>
9
- <sections>
10
- <carriers>
11
- <groups>
12
- <i-parcel translate="label">
13
- <label>i-parcel</label>
14
- <frontend_type>text</frontend_type>
15
- <sort_order>99</sort_order>
16
- <show_in_default>1</show_in_default>
17
- <show_in_website>1</show_in_website>
18
- <show_in_store>1</show_in_store>
19
- <fields>
20
- <active translate="label">
21
- <label>Enabled</label>
22
- <frontend_type>select</frontend_type>
23
- <source_model>adminhtml/system_config_source_yesno</source_model>
24
- <sort_order>1</sort_order>
25
- <show_in_default>1</show_in_default>
26
- <show_in_website>1</show_in_website>
27
- <show_in_store>1</show_in_store>
28
- </active>
29
- <title>
30
- <label>Title</label>
31
- <frontend_type>text</frontend_type>
32
- <sort_order>100</sort_order>
33
- <show_in_default>1</show_in_default>
34
- <show_in_website>1</show_in_website>
35
- <show_in_store>1</show_in_store>
36
- </title>
37
- <name>
38
- <label>Methods Names</label>
39
- <frontend_model>shippingip/adminhtml_system_config_form_field_method</frontend_model>
40
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
41
- <sort_order>102</sort_order>
42
- <show_in_default>1</show_in_default>
43
- <show_in_website>1</show_in_website>
44
- <show_in_store>1</show_in_store>
45
- </name>
46
- <whitelabelpay>
47
- <label>Name of Displayed Payment Method</label>
48
- <frontend_type>text</frontend_type>
49
- <sort_order>105</sort_order>
50
- <show_in_default>1</show_in_default>
51
- <show_in_website>1</show_in_website>
52
- <show_in_store>1</show_in_store>
53
- </whitelabelpay>
54
- <autoship>
55
- <label>Auto Generate Shipment</label>
56
- <frontend_type>select</frontend_type>
57
- <source_model>adminhtml/system_config_source_yesno</source_model>
58
- <sort_order>108</sort_order>
59
- <show_in_default>1</show_in_default>
60
- <show_in_website>1</show_in_website>
61
- <show_in_store>1</show_in_store>
62
- </autoship>
63
- <prefix>
64
- <label>Completed Orders Use Different Order Prefix (Blank for None)</label>
65
- <frontend_type>text</frontend_type>
66
- <sort_order>111</sort_order>
67
- <show_in_default>1</show_in_default>
68
- <show_in_website>1</show_in_website>
69
- <show_in_store>1</show_in_store>
70
- </prefix>
71
- <order_reference>
72
- <label>Send Order Number as Reference</label>
73
- <frontend_type>select</frontend_type>
74
- <source_model>adminhtml/system_config_source_yesno</source_model>
75
- <sort_order>112</sort_order>
76
- <show_in_default>1</show_in_default>
77
- <show_in_website>1</show_in_website>
78
- <show_in_store>1</show_in_store>
79
- </order_reference>
80
- <additionalfields>
81
- <label>Dashboard</label>
82
- <frontend_type>button</frontend_type>
83
- <frontend_model>shippingip/adminhtml_iparcel_dashboard</frontend_model>
84
- <sort_order>115</sort_order>
85
- <show_in_default>1</show_in_default>
86
- <show_in_website>1</show_in_website>
87
- <show_in_store>1</show_in_store>
88
- </additionalfields>
89
- <sallowspecific translate="label">
90
- <label>Ship to Applicable Countries</label>
91
- <frontend_type>select</frontend_type>
92
- <sort_order>106</sort_order>
93
- <frontend_class>shipping-applicable-country</frontend_class>
94
- <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
95
- <show_in_default>1</show_in_default>
96
- <show_in_website>1</show_in_website>
97
- <show_in_store>0</show_in_store>
98
- </sallowspecific>
99
- <specificcountry translate="label">
100
- <label>Ship to Specific Countries</label>
101
- <frontend_type>multiselect</frontend_type>
102
- <sort_order>107</sort_order>
103
- <source_model>adminhtml/system_config_source_country</source_model>
104
- <show_in_default>1</show_in_default>
105
- <show_in_website>1</show_in_website>
106
- <show_in_store>0</show_in_store>
107
- <can_be_empty>1</can_be_empty>
108
- </specificcountry>
109
- </fields>
110
- </i-parcel>
111
- </groups>
112
- </carriers>
113
- <payment>
114
- <groups>
115
- <iparcel translate="label" module="shippingip">
116
- <label>i-parcel</label>
117
- <sort_order>9999</sort_order>
118
- <show_in_default>0</show_in_default>
119
- <show_in_website>0</show_in_website>
120
- <show_in_store>0</show_in_store>
121
- </iparcel>
122
- </groups>
123
- </payment>
124
- <iparcel>
125
- <label>Configuration</label>
126
- <tab>i-parcel</tab>
127
- <frontent_type>text</frontent_type>
128
- <sort_order>100</sort_order>
129
- <show_in_default>1</show_in_default>
130
- <show_in_website>1</show_in_website>
131
- <show_in_store>0</show_in_store>
132
- <groups>
133
- <config translate="label">
134
- <label>General</label>
135
- <frontend_type>text</frontend_type>
136
- <sort_order>0</sort_order>
137
- <show_in_default>1</show_in_default>
138
- <show_in_website>1</show_in_website>
139
- <show_in_store>0</show_in_store>
140
- <fields>
141
- <custid translate="label">
142
- <label>Company ID</label>
143
- <frontend_type>text</frontend_type>
144
- <sort_order>2</sort_order>
145
- <show_in_default>1</show_in_default>
146
- <show_in_website>1</show_in_website>
147
- <show_in_store>0</show_in_store>
148
- <tooltip>This is the Company ID provided by i-parcel.</tooltip>
149
- </custid>
150
- <userid translate="label">
151
- <label>Web Service Key (GUID)</label>
152
- <backend_model>shippingip/config_guid</backend_model>
153
- <sort_order>3</sort_order>
154
- <show_in_default>1</show_in_default>
155
- <show_in_website>1</show_in_website>
156
- <show_in_store>0</show_in_store>
157
- <tooltip>This is Web Service Key provided by i-parcel.</tooltip>
158
- </userid>
159
- <submit_parcel translate="label">
160
- <label>Submit Parcel on Checkout</label>
161
- <frontend_type>select</frontend_type>
162
- <source_model>adminhtml/system_config_source_yesno</source_model>
163
- <sort_order>10</sort_order>
164
- <show_in_default>1</show_in_default>
165
- <show_in_website>1</show_in_website>
166
- <show_in_store>0</show_in_store>
167
- </submit_parcel>
168
- </fields>
169
- </config>
170
- <scripts translate="label">
171
- <label>Scripts</label>
172
- <frontend_type>text</frontend_type>
173
- <sort_order>5</sort_order>
174
- <show_in_default>1</show_in_default>
175
- <show_in_website>1</show_in_website>
176
- <show_in_store>0</show_in_store>
177
- <fields>
178
- <scripts translate="label">
179
- <label>Enable Frontend Scripts</label>
180
- <frontend_type>select</frontend_type>
181
- <source_model>adminhtml/system_config_source_yesno</source_model>
182
- <sort_order>5</sort_order>
183
- <show_in_default>1</show_in_default>
184
- <show_in_website>1</show_in_website>
185
- <show_in_store>0</show_in_store>
186
- </scripts>
187
- <jquery translate="label">
188
- <label>Enable jQuery</label>
189
- <comment>Set it to "no" if you're using another jQuery library</comment>
190
- <frontend_type>select</frontend_type>
191
- <source_model>adminhtml/system_config_source_yesno</source_model>
192
- <sort_order>10</sort_order>
193
- <show_in_default>1</show_in_default>
194
- <show_in_website>0</show_in_website>
195
- <show_in_store>0</show_in_store>
196
- </jquery>
197
- <post translate="label">
198
- <label>Custom POST scripts</label>
199
- <frontend_type>file</frontend_type>
200
- <backend_model>shippingip/config_script_js</backend_model>
201
- <sort_order>15</sort_order>
202
- <show_in_default>1</show_in_default>
203
- <show_in_website>1</show_in_website>
204
- <show_in_store>1</show_in_store>
205
- </post>
206
- </fields>
207
- </scripts>
208
- <international_customer translate="label">
209
- <label>International Customer</label>
210
- <frontend_type>text</frontend_type>
211
- <sort_order>10</sort_order>
212
- <show_in_default>1</show_in_default>
213
- <show_in_website>1</show_in_website>
214
- <show_in_store>1</show_in_store>
215
- <fields>
216
- <enable translate="label">
217
- <label>Enabled</label>
218
- <frontend_type>select</frontend_type>
219
- <source_model>adminhtml/system_config_source_yesno</source_model>
220
- <sort_order>0</sort_order>
221
- <show_in_default>1</show_in_default>
222
- <show_in_website>1</show_in_website>
223
- <show_in_store>1</show_in_store>
224
- </enable>
225
- <visibility translate="label">
226
- <label>Catalog product visibility attribute</label>
227
- <frontend_type>select</frontend_type>
228
- <source_model>shippingip/system_config_source_catalog_product_attribute_boolean</source_model>
229
- <sort_order>1</sort_order>
230
- <show_in_default>1</show_in_default>
231
- <show_in_website>1</show_in_website>
232
- <show_in_store>1</show_in_store>
233
- <tooltip>If chosen attribute has value 'true' catalog product will be visible for international customer</tooltip>
234
- </visibility>
235
- </fields>
236
- </international_customer>
237
- <tax translate="label">
238
- <label>Tax Intercepting</label>
239
- <frontend_type>text</frontend_type>
240
- <sort_order>15</sort_order>
241
- <show_in_default>1</show_in_default>
242
- <show_in_website>1</show_in_website>
243
- <show_in_store>1</show_in_store>
244
- <fields>
245
- <mode translate="label">
246
- <label>Mode</label>
247
- <frontend_type>select</frontend_type>
248
- <source_model>shippingip/system_config_source_tax_mode</source_model>
249
- <sort_order>0</sort_order>
250
- <show_in_default>1</show_in_default>
251
- <show_in_website>1</show_in_website>
252
- <show_in_store>1</show_in_store>
253
- </mode>
254
- <tax_duty_label translate="label">
255
- <label><![CDATA[Tax&Duty Label]]></label>
256
- <frontend_type>text</frontend_type>
257
- <sort_order>5</sort_order>
258
- <show_in_default>1</show_in_default>
259
- <show_in_website>1</show_in_website>
260
- <show_in_store>1</show_in_store>
261
- <depends>
262
- <mode>1</mode>
263
- </depends>
264
- </tax_duty_label>
265
- <tax_label translate="label">
266
- <label>Tax Label</label>
267
- <frontend_type>text</frontend_type>
268
- <sort_order>10</sort_order>
269
- <show_in_default>1</show_in_default>
270
- <show_in_website>1</show_in_website>
271
- <show_in_store>1</show_in_store>
272
- <depends>
273
- <mode>2</mode>
274
- </depends>
275
- </tax_label>
276
- <duty_label translate="label">
277
- <label>Duty Label</label>
278
- <frontend_type>text</frontend_type>
279
- <sort_order>15</sort_order>
280
- <show_in_default>1</show_in_default>
281
- <show_in_website>1</show_in_website>
282
- <show_in_store>1</show_in_store>
283
- <depends>
284
- <mode>2</mode>
285
- </depends>
286
- </duty_label>
287
- </fields>
288
- </tax>
289
- </groups>
290
- </iparcel>
291
- <catalog_mapping>
292
- <label>Catalog Mapping</label>
293
- <tab>i-parcel</tab>
294
- <frontend_type>text</frontend_type>
295
- <sort_order>110</sort_order>
296
- <show_in_default>1</show_in_default>
297
- <show_in_website>1</show_in_website>
298
- <show_in_store>0</show_in_store>
299
- <groups>
300
- <config translate="label">
301
- <label>Configuration</label>
302
- <frontend_type>text</frontend_type>
303
- <sort_order>0</sort_order>
304
- <show_in_default>1</show_in_default>
305
- <show_in_website>1</show_in_website>
306
- <show_in_store>0</show_in_store>
307
- <fields>
308
- <auto_upload translate="label">
309
- <label>Auto Catalog Updates</label>
310
- <frontend_type>select</frontend_type>
311
- <source_model>shippingip/system_config_source_catalog_mapping_mode</source_model>
312
- <backend_model>shippingip/config_catalog_mapping</backend_model>
313
- <sort_order>5</sort_order>
314
- <show_in_default>1</show_in_default>
315
- <show_in_website>1</show_in_website>
316
- <show_in_store>0</show_in_store>
317
- </auto_upload>
318
- <cron_frequency translate="label">
319
- <label>Frequency</label>
320
- <frontend_type>select</frontend_type>
321
- <source_model>adminhtml/system_config_source_cron_frequency</source_model>
322
- <sort_order>99</sort_order>
323
- <show_in_default>1</show_in_default>
324
- <show_in_website>1</show_in_website>
325
- <show_in_store>0</show_in_store>
326
- <depends>
327
- <auto_upload>2</auto_upload>
328
- </depends>
329
- </cron_frequency>
330
- <cron_hour translate="label">
331
- <label>Hour</label>
332
- <frontend_type>text</frontend_type>
333
- <sort_order>100</sort_order>
334
- <backend_model>shippingip/config_data_time_hour</backend_model>
335
- <show_in_default>1</show_in_default>
336
- <show_in_website>1</show_in_website>
337
- <show_in_store>0</show_in_store>
338
- <depends>
339
- <auto_upload>2</auto_upload>
340
- </depends>
341
- </cron_hour>
342
- <cron_minute translate="label">
343
- <label>Minute</label>
344
- <frontend_type>text</frontend_type>
345
- <sort_order>101</sort_order>
346
- <backend_model>shippingip/config_data_time_minute</backend_model>
347
- <show_in_default>1</show_in_default>
348
- <show_in_website>1</show_in_website>
349
- <show_in_store>0</show_in_store>
350
- <depends>
351
- <auto_upload>2</auto_upload>
352
- </depends>
353
- </cron_minute>
354
- <cron_monthday translate="label">
355
- <label>Day of Month</label>
356
- <frontend_type>text</frontend_type>
357
- <sort_order>103</sort_order>
358
- <backend_model>shippingip/config_data_date_monthday</backend_model>
359
- <show_in_default>1</show_in_default>
360
- <show_in_website>1</show_in_website>
361
- <show_in_store>0</show_in_store>
362
- <depends>
363
- <auto_upload>2</auto_upload>
364
- <cron_frequency>M</cron_frequency>
365
- </depends>
366
- </cron_monthday>
367
- <cron_weekday translate="label">
368
- <label>Day of Week</label>
369
- <frontend_type>select</frontend_type>
370
- <source_model>shippingip/system_config_source_date_weekday</source_model>
371
- <sort_order>102</sort_order>
372
- <backend_model>shippingip/config_data_date_weekday</backend_model>
373
- <show_in_default>1</show_in_default>
374
- <show_in_website>1</show_in_website>
375
- <show_in_store>0</show_in_store>
376
- <depends>
377
- <auto_upload>2</auto_upload>
378
- <cron_frequency>W</cron_frequency>
379
- </depends>
380
- </cron_weekday>
381
- </fields>
382
- </config>
383
- <upload translate="label">
384
- <label>Upload</label>
385
- <frontend_type>text</frontend_type>
386
- <sort_order>0</sort_order>
387
- <show_in_default>1</show_in_default>
388
- <show_in_website>1</show_in_website>
389
- <show_in_store>0</show_in_store>
390
- <fields>
391
- <upload translate="label">
392
- <label>Upload Catalog</label>
393
- <frontend_type>button</frontend_type>
394
- <frontend_model>shippingip/adminhtml_catalog_mapping_button</frontend_model>
395
- <sort_order>1</sort_order>
396
- <show_in_default>1</show_in_default>
397
- <show_in_website>1</show_in_website>
398
- <show_in_store>0</show_in_store>
399
- <tooltip>If this button is pressed, the catalog will be uploaded to i-parcel.</tooltip>
400
- <comment>This may take some time</comment>
401
- </upload>
402
- <step translate="label">
403
- <label>Upload Step Size</label>
404
- <frontend_type>text</frontend_type>
405
- <sort_order>10</sort_order>
406
- <show_in_default>1</show_in_default>
407
- <show_in_website>0</show_in_website>
408
- <show_in_store>0</show_in_store>
409
- <validate>validate-number validate-greater-than-zero</validate>
410
- </step>
411
- <offset translate="label">
412
- <label>Upload offset</label>
413
- <frontend_type>text</frontend_type>
414
- <sort_order>20</sort_order>
415
- <show_in_default>1</show_in_default>
416
- <show_in_website>0</show_in_website>
417
- <show_in_store>0</show_in_store>
418
- <validate>validate-number validate-zero-or-greater</validate>
419
- </offset>
420
- </fields>
421
- </upload>
422
- <!--<check_items translate="label">-->
423
- <!--<label>Populate cache</label>-->
424
- <!--<frontend_type>text</frontend_type>-->
425
- <!--<sort_order>2</sort_order>-->
426
- <!--<show_in_default>1</show_in_default>-->
427
- <!--<show_in_website>1</show_in_website>-->
428
- <!--<show_in_store>0</show_in_store>-->
429
- <!--<fields>-->
430
- <!--<check_items translate="label">-->
431
- <!--<label>Populate Catalog Items</label>-->
432
- <!--<frontend_type>button</frontend_type>-->
433
- <!--<frontend_model>shippingip/adminhtml_catalog_checkitems_button</frontend_model>-->
434
- <!--<sort_order>10</sort_order>-->
435
- <!--<show_in_default>1</show_in_default>-->
436
- <!--<show_in_website>1</show_in_website>-->
437
- <!--<show_in_store>0</show_in_store>-->
438
- <!--<comment>This may take some time</comment>-->
439
- <!--</check_items>-->
440
- <!--</fields>-->
441
- <!--</check_items>-->
442
- <attributes translate="label">
443
- <label>Catalog Mapping Attributes</label>
444
- <frontend_type>text</frontend_type>
445
- <sort_order>5</sort_order>
446
- <show_in_default>1</show_in_default>
447
- <show_in_website>0</show_in_website>
448
- <show_in_store>0</show_in_store>
449
- <fields>
450
- <attribute1 translate="label">
451
- <label>Attribute 1</label>
452
- <frontend_type>select</frontend_type>
453
- <source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
454
- <sort_order>6</sort_order>
455
- <show_in_default>1</show_in_default>
456
- <show_in_website>1</show_in_website>
457
- <show_in_store>0</show_in_store>
458
- </attribute1>
459
- <attribute2 translate="label">
460
- <label>Attribute 2</label>
461
- <frontend_type>select</frontend_type>
462
- <source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
463
- <sort_order>11</sort_order>
464
- <show_in_default>1</show_in_default>
465
- <show_in_website>1</show_in_website>
466
- <show_in_store>0</show_in_store>
467
- </attribute2>
468
- <attribute3 translate="label">
469
- <label>Attribute 3</label>
470
- <frontend_type>select</frontend_type>
471
- <source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
472
- <sort_order>16</sort_order>
473
- <show_in_default>1</show_in_default>
474
- <show_in_website>1</show_in_website>
475
- <show_in_store>0</show_in_store>
476
- </attribute3>
477
- <attribute4 translate="label">
478
- <label>Attribute 4</label>
479
- <frontend_type>select</frontend_type>
480
- <source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
481
- <sort_order>21</sort_order>
482
- <show_in_default>1</show_in_default>
483
- <show_in_website>1</show_in_website>
484
- <show_in_store>0</show_in_store>
485
- </attribute4>
486
- <attribute5 translate="label">
487
- <label>Attribute 5</label>
488
- <frontend_type>select</frontend_type>
489
- <source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
490
- <sort_order>26</sort_order>
491
- <show_in_default>1</show_in_default>
492
- <show_in_website>1</show_in_website>
493
- <show_in_store>0</show_in_store>
494
- </attribute5>
495
- <attribute6 translate="label">
496
- <label>Attribute 6</label>
497
- <frontend_type>select</frontend_type>
498
- <source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
499
- <sort_order>31</sort_order>
500
- <show_in_default>1</show_in_default>
501
- <show_in_website>1</show_in_website>
502
- <show_in_store>0</show_in_store>
503
- </attribute6>
504
- <hscodeus translate="label">
505
- <label>HS Code</label>
506
- <frontend_type>select</frontend_type>
507
- <source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
508
- <sort_order>36</sort_order>
509
- <show_in_default>1</show_in_default>
510
- <show_in_website>1</show_in_website>
511
- <show_in_store>0</show_in_store>
512
- </hscodeus>
513
- <shipalone translate="label">
514
- <label>Ship Alone</label>
515
- <frontend_type>select</frontend_type>
516
- <source_model>shippingip/system_config_source_catalog_product_attribute_boolean</source_model>
517
- <sort_order>41</sort_order>
518
- <show_in_default>1</show_in_default>
519
- <show_in_website>1</show_in_website>
520
- <show_in_store>0</show_in_store>
521
- <comment>Only boolean attributes</comment>
522
- </shipalone>
523
- <price translate="label">
524
- <label>Price Type</label>
525
- <frontend_type>select</frontend_type>
526
- <source_model>shippingip/system_config_source_catalog_mapping_configurable_price</source_model>
527
- <sort_order>46</sort_order>
528
- <show_in_default>1</show_in_default>
529
- <show_in_website>1</show_in_website>
530
- <show_in_store>0</show_in_store>
531
- <comment>Price type for configurable products</comment>
532
- </price>
533
- </fields>
534
- </attributes>
535
- </groups>
536
- </catalog_mapping>
537
- <external_api>
538
- <label>External API</label>
539
- <tab>i-parcel</tab>
540
- <frontend_type>text</frontend_type>
541
- <sort_order>120</sort_order>
542
- <show_in_default>1</show_in_default>
543
- <show_in_website>0</show_in_website>
544
- <show_in_store>0</show_in_store>
545
- <groups>
546
- <sales translate="label">
547
- <label>Sales</label>
548
- <frontend_type>text</frontend_type>
549
- <sort_order>0</sort_order>
550
- <show_in_default>1</show_in_default>
551
- <show_in_website>1</show_in_website>
552
- <show_in_store>1</show_in_store>
553
- <fields>
554
- <enabled>
555
- <label>Enable External Sales API</label>
556
- <frontend_type>select</frontend_type>
557
- <source_model>adminhtml/system_config_source_yesno</source_model>
558
- <sort_order>0</sort_order>
559
- <show_in_default>1</show_in_default>
560
- <show_in_website>1</show_in_website>
561
- <show_in_store>1</show_in_store>
562
- </enabled>
563
- <transactional_emails>
564
- <label>Suppress Transactional e-mails</label>
565
- <frontend_type>select</frontend_type>
566
- <source_model>adminhtml/system_config_source_yesno</source_model>
567
- <sort_order>5</sort_order>
568
- <show_in_default>1</show_in_default>
569
- <show_in_website>1</show_in_website>
570
- <show_in_store>1</show_in_store>
571
- </transactional_emails>
572
- <order_status>
573
- <label>New Order Status</label>
574
- <frontend_type>select</frontend_type>
575
- <source_model>shippingip/system_config_source_sales_order_status</source_model>
576
- <sort_order>114</sort_order>
577
- <show_in_default>1</show_in_default>
578
- <show_in_website>1</show_in_website>
579
- <show_in_store>1</show_in_store>
580
- </order_status>
581
- </fields>
582
- </sales>
583
- </groups>
584
- </external_api>
585
- <!--<salesrules>-->
586
- <!--<label>Sales Rules Synchronization</label>-->
587
- <!--<tab>i-parcel</tab>-->
588
- <!--<frontend_type>text</frontend_type>-->
589
- <!--<sort_order>7</sort_order>-->
590
- <!--<show_in_default>1</show_in_default>-->
591
- <!--<show_in_website>1</show_in_website>-->
592
- <!--<show_in_store>0</show_in_store>-->
593
- <!--<groups>-->
594
- <!--<upload>-->
595
- <!--<label>Upload</label>-->
596
- <!--<frontend_type>text</frontend_type>-->
597
- <!--<sort_order>10</sort_order>-->
598
- <!--<show_in_default>1</show_in_default>-->
599
- <!--<show_in_website>1</show_in_website>-->
600
- <!--<show_in_store>0</show_in_store>-->
601
- <!--<fields>-->
602
- <!--<sync>-->
603
- <!--<label>Synchronize SalesRules</label>-->
604
- <!--<frontend_type>button</frontend_type>-->
605
- <!--<frontend_model>shippingip/adminhtml_salesrule_rule_sync</frontend_model>-->
606
- <!--<sort_order>1</sort_order>-->
607
- <!--<show_in_default>1</show_in_default>-->
608
- <!--<show_in_website>1</show_in_website>-->
609
- <!--<show_in_store>0</show_in_store>-->
610
- <!--</sync>-->
611
- <!--</fields>-->
612
- <!--</upload>-->
613
- <!--</groups>-->
614
- <!--</salesrules>-->
615
- </sections>
616
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.0-0.3.1.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
- if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/tax_totals')) !== true) {
5
- $table = $installer->getConnection()
6
- ->newTable($installer->getTable('shippingip/tax_totals'))
7
- ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
8
- 'identity' => true,
9
- 'unsigned' => true,
10
- 'nullable' => false,
11
- 'primary' => true
12
- ), 'Id')
13
- ->addColumn('tax', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
14
- 'nullable' => false
15
- ), 'Tax')
16
- ->addColumn('duty', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
17
- 'nullable' => true
18
- ), 'Duty')
19
- ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
20
- 'unsigned' => true,
21
- 'nullable' => false
22
- ), 'Order Id')
23
- ->addColumn('mode', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array(
24
- 'nullable' => false,
25
- 'default' => 0
26
- ), 'Mode');
27
- $installer->getConnection()->createTable($table);
28
- $installer->getConnection()->addKey($installer->getTable('shippingip/tax_totals'), 'IDX_ORDER', 'order_id');
29
- $installer->getConnection()->addConstraint('FK_IPARCEL_TOTALS_ORDER_ID', $installer->getTable('shippingip/tax_totals'), 'order_id', $installer->getTable('sales/order'), 'entity_id');
30
- }
31
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.2-2.3.4.4.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
- if (file_exists(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME)) {
5
- unlink(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME);
6
- }
7
- $installer->endSetup();
 
 
 
 
 
 
 
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.3-2.3.4.4.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
- if (file_exists(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME)) {
5
- unlink(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME);
6
- }
7
- $installer->endSetup();
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/externalsales.xml CHANGED
@@ -1,38 +1,7 @@
1
  <layout>
2
- <adminhtml_sales_order_shipment_view>
3
- <reference name="head">
4
- <action method="addJs"><script>iparcel/adminhtml/label.js</script></action>
5
- </reference>
6
- </adminhtml_sales_order_shipment_view>
7
- <adminhtml_shippingip_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">
10
- <action method="addJs"><script>iparcel/jQuery.js</script></action>
11
- <action method="addJs"><script>iparcel/adminhtml/sync.js</script></action>
12
- <action method="addCss"><stylesheet>iparcel/ajaxSync.css</stylesheet></action>
13
- </block>
14
- <block type="core/text_list" name="content" as="content" />
15
- </block>
16
- </adminhtml_shippingip_sync_ajax>
17
- <adminhtml_shippingip_sync_ajax_catalog>
18
- <reference name="head">
19
- <action method="setTitle"><title>i-parcel Catalog Upload</title></action>
20
- </reference>
21
- <reference name="content">
22
- <block type="core/template" name="catalog.sync" template="iparcel/sync/ajax/catalog.phtml"/>
23
- </reference>
24
- </adminhtml_shippingip_sync_ajax_catalog>
25
- <adminhtml_shippingip_sync_ajax_checkitems>
26
- <reference name="head">
27
- <action method="setTitle"><title>i-parcel Check Items</title></action>
28
- </reference>
29
- <reference name="content">
30
- <block type="core/template" name="checkitems.sync" template="iparcel/sync/ajax/checkitems.phtml" />
31
- </reference>
32
- </adminhtml_shippingip_sync_ajax_checkitems>
33
- <adminhtml_shippingip_log_index>
34
- <reference name="content">
35
- <block type="shippingip/adminhtml_logs" name="iparcel.logs" as="logs" />
36
- </reference>
37
- </adminhtml_shippingip_log_index>
38
  </layout>
1
  <layout>
2
+ <adminhtml_sales_order_shipment_view>
3
+ <reference name="head">
4
+ <action method="addJs"><script>iparcel/adminhtml/label.js</script></action>
5
+ </reference>
6
+ </adminhtml_sales_order_shipment_view>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  </layout>
app/design/adminhtml/default/default/layout/iparcel.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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">
10
+ <action method="addJs"><script>iparcel/jQuery.js</script></action>
11
+ <action method="addJs"><script>iparcel/adminhtml/sync.js</script></action>
12
+ <action method="addCss"><stylesheet>iparcel/ajaxSync.css</stylesheet></action>
13
+ </block>
14
+ <block type="core/text_list" name="content" as="content" />
15
+ </block>
16
+ </adminhtml_iparcel_sync_ajax>
17
+ <adminhtml_iparcel_sync_ajax_catalog>
18
+ <reference name="head">
19
+ <action method="setTitle"><title>i-parcel Catalog Upload</title></action>
20
+ </reference>
21
+ <reference name="content">
22
+ <block type="core/template" name="catalog.sync" template="iparcel/sync/ajax/catalog.phtml"/>
23
+ </reference>
24
+ </adminhtml_iparcel_sync_ajax_catalog>
25
+ <adminhtml_iparcel_sync_ajax_checkitems>
26
+ <reference name="head">
27
+ <action method="setTitle"><title>i-parcel Check Items</title></action>
28
+ </reference>
29
+ <reference name="content">
30
+ <block type="core/template" name="checkitems.sync" template="iparcel/sync/ajax/checkitems.phtml" />
31
+ </reference>
32
+ </adminhtml_iparcel_sync_ajax_checkitems>
33
+ </layout>
app/design/adminhtml/default/default/template/iparcel/sales/order/shipment/view/tracking.phtml DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- /**
3
- * @category design
4
- * @package Iparcel_Shipping
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Tracking
7
- */
8
- ?>
9
- <div class="field-row grid" id="shipment_tracking_info">
10
- <table cellspacing="0" class="data">
11
- <col width="100" />
12
- <col />
13
- <col />
14
- <col width="80" />
15
- <thead>
16
- <tr class="headings">
17
- <th><?php echo Mage::helper('sales')->__('Carrier') ?></th>
18
- <th><?php echo Mage::helper('sales')->__('Title') ?></th>
19
- <th><?php echo Mage::helper('sales')->__('Number') ?></th>
20
- </tr>
21
- </thead>
22
- <?php if($_tracks = $this->getShipment()->getAllTracks()): ?>
23
- <tbody>
24
- <?php $i=0;foreach ($_tracks as $_track):$i++ ?>
25
- <tr class="<?php echo ($i%2==0)?'even':'odd' ?>">
26
- <td><?php echo $this->escapeHtml($this->getCarrierTitle($_track->getCarrierCode())) ?></td>
27
- <td><?php echo $this->escapeHtml($_track->getTitle()) ?></td>
28
- <td>
29
- <?php if ($_track->isCustom()): ?>
30
- <?php echo $this->escapeHtml($_track->getNumber()) ?>
31
- <?php else: ?>
32
- <a href="#" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_track) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')"><?php echo $this->escapeHtml($_track->getNumber()) ?></a>
33
- <div id="shipment_tracking_info_response_<?php echo $_track->getId() ?>"></div>
34
- <?php endif; ?>
35
- </td>
36
- </tr>
37
- <?php endforeach; ?>
38
- </tbody>
39
- <?php endif; ?>
40
- </table>
41
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/iparcel/sync/ajax/catalog.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * @category design
4
- * @package Iparcel_Shipping
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Mage_Core_Block_Template
7
  */
8
  ?>
9
  <div id="starting">
@@ -17,5 +17,5 @@
17
  <p>There was <span>0</span> errors when uploading catalog</p>
18
  </div>
19
  <script type="text/javascript">
20
- var sync = new iparcelSync.sync('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/shippingip_sync_ajax/catalog') ?>?isAjax=true', <?php echo Mage::getStoreConfig('catalog_mapping/upload/step'); ?>);
21
  </script>
1
  <?php
2
  /**
3
  * @category design
4
+ * @package Iparcel_All
5
+ * @author Bobby Burden <bburden@i-parcel.com>
6
+ * @class Mage_Core_Block_Template
7
  */
8
  ?>
9
  <div id="starting">
17
  <p>There was <span>0</span> errors when uploading catalog</p>
18
  </div>
19
  <script type="text/javascript">
20
+ var sync = new iparcelSync.sync('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/iparcel_sync_ajax/catalog') ?>?isAjax=true', <?php echo Mage::getStoreConfig('catalog_mapping/upload/step'); ?>);
21
  </script>
app/design/adminhtml/default/default/template/iparcel/sync/ajax/checkitems.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * @category design
4
- * @package Iparcel_Shipping
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Mage_Core_Block_Template
7
  */
8
  ?>
9
  <div id="starting">
@@ -17,5 +17,5 @@
17
  <p>There was <span>0</span> errors when checking items</p>
18
  </div>
19
  <script type="text/javascript">
20
- var sync = new iparcelSync.sync('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/shippingip_sync_ajax/checkitems') ?>?isAjax=true', 1);
21
  </script>
1
  <?php
2
  /**
3
  * @category design
4
+ * @package Iparcel_All
5
+ * @author Bobby Burden <bburden@i-parcel.com>
6
+ * @class Mage_Core_Block_Template
7
  */
8
  ?>
9
  <div id="starting">
17
  <p>There was <span>0</span> errors when checking items</p>
18
  </div>
19
  <script type="text/javascript">
20
+ var sync = new iparcelSync.sync('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/iparcel_sync_ajax/checkitems') ?>?isAjax=true', 1);
21
  </script>
app/design/frontend/base/default/layout/externalshipping.xml CHANGED
@@ -1,46 +1,46 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <layout version="0.1.0">
3
- <default>
4
- <reference name="head">
5
- <block type="shippingip/html_head_jquery" name="jquery" template="shippingip/html/head/jquery.phtml" />
6
- <block type="shippingip/html_head_iparcel" name="html.head.iparcel" template="shippingip/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="shippingip/html_head_post" name="iparcel_post" template="shippingip/html/head/post.phtml" />
13
- <block type="shippingip/catalog_product" name="shippingip_sku" template="shippingip/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="shippingip/html_head_post" name="iparcel_post" template="shippingip/html/head/post.phtml" />
20
- <block type="shippingip/catalog_product_list" name="shippingip_sku.list" template="shippingip/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="shippingip/html_head_post" name="iparcel_post" template="shippingip/html/head/post.phtml" />
27
- <block type="shippingip/catalogsearch_result" name="shippingip_sku.list" template="shippingip/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="shippingip/html_head_post" name="iparcel_post" template="shippingip/html/head/post.phtml" />
37
- <block type="shippingip/catalogsearch_advanced_result" name="shippingip_sku.list" template="shippingip/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="shippingip/cpf" name="shippingip_cpf" template="shippingip/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
+ <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>
app/design/frontend/base/default/template/ipglobalecommerce/cpf.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category design
4
+ * @package Iparcel_GlobaleCommerce
5
+ * @author Bobby Burden <bburden@i-parcel.com>
6
+ * @class Iparcel_GlobaleCommerce_Block_Cpf
7
+ */
8
+ ?>
9
+ <script type="text/javascript">
10
+ iparcel.cpf(<?php echo json_encode($this->getCpf()); ?>);
11
+ </script>
app/design/frontend/base/default/template/ipglobalecommerce/html/head/iparcel.phtml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category design
4
+ * @package Iparcel_GlobaleCommerce
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>
12
+ <script type="text/javascript">var ipar_is_mage = true;</script>
13
+ <link rel="stylesheet" type="text/css" href="<?php echo $helper->getScriptUrl(); ?>CSS/Merchant/<?php echo $helper->getCustomerId(); ?>/1" />
14
+ <?php endif; ?>
app/design/frontend/base/default/template/{shippingip → ipglobalecommerce}/html/head/jquery.phtml RENAMED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
- * @category design
4
- * @package Iparcel_Shipping
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Iparcel_Shipping_Block_Html_Head_Jquery
7
  */
8
  ?>
9
  <?php if($this->getFlag()): ?>
1
  <?php
2
  /**
3
+ * @category design
4
+ * @package Iparcel_GlobaleCommerce
5
+ * @author Bobby Burden <bburden@i-parcel.com>
6
+ * @class Iparcel_GlobaleCommerce_Block_Html_Head_Jquery
7
  */
8
  ?>
9
  <?php if($this->getFlag()): ?>
app/design/frontend/base/default/template/{shippingip → ipglobalecommerce}/html/head/post.phtml RENAMED
@@ -1,11 +1,12 @@
1
  <?php
2
  /**
3
- * @category design
4
- * @package Iparcel_Shipping
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Iparcel_Shipping_Block_Html_Head_Post
7
  */
8
  ?>
 
9
  <?php foreach($this->getScript() as $script):?>
10
  <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS).$script; ?>"></script>
11
  <?php endforeach;?>
1
  <?php
2
  /**
3
+ * @category design
4
+ * @package Iparcel_GlobaleCommerce
5
+ * @author Bobby Burden <bburden@i-parcel.com>
6
+ * @class Iparcel_GlobaleCommerce_Block_Html_Head_Post
7
  */
8
  ?>
9
+
10
  <?php foreach($this->getScript() as $script):?>
11
  <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS).$script; ?>"></script>
12
  <?php endforeach;?>
app/design/frontend/base/default/template/ipglobalecommerce/post.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category design
4
+ * @package Iparcel_GlobaleCommerce
5
+ * @author Bobby Burden <bburden@i-parcel.com>
6
+ * @class Iparcel_GlobaleCommerce_Block_Catalog_Product
7
+ */
8
+ ?>
9
+ <script type="text/javascript">
10
+ iparcelPost.single('<?php echo $this->getProduct()->getSku(); ?>', '<?php echo substr(Mage::getBaseUrl(),5); ?>', '<?php echo $this->getStock(); ?>');
11
+ </script>
app/design/frontend/base/default/template/ipglobalecommerce/post/list.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category design
4
+ * @package Iparcel_GlobaleCommerce
5
+ * @author Bobby Burden <bburden@i-parcel.com>
6
+ * @class Iparcel_GlobaleCommerce_Block_Catalog_Product_List
7
+ */
8
+ ?>
9
+ <?php
10
+ $_productCollection = $this->getLoadedProductCollection();
11
+ $helper = Mage::helper('ipglobalecommerce')
12
+ ?>
13
+ <script type="text/javascript">
14
+ iparcelPost.sku_list({
15
+ <?php foreach ($_productCollection as $_product): ?>
16
+ "<?php echo $helper->jsEscape($_product->getSku()); ?>": "<?php echo $helper->jsEscape($_product->getName()); ?>",
17
+ <?php endforeach; ?>
18
+ });
19
+ iparcelPost.stock_list({
20
+ <?php foreach ($_productCollection as $_product): ?>
21
+ "<?php echo $helper->jsEscape($_product->getName()); ?>": "<?php echo $this->getStock($_product); ?>",
22
+ <?php endforeach; ?>
23
+ });
24
+ </script>
app/design/frontend/base/default/template/shippingip/cpf.phtml DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- /**
3
- * @category design
4
- * @package Iparcel_Shipping
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Iparcel_Shipping_Block_Cpf
7
- */
8
- ?>
9
- <script type="text/javascript">
10
- iparcel.cpf(<?php echo json_encode($this->getCpf()); ?>);
11
- </script>
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/shippingip/html/head/iparcel.phtml DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
- /**
3
- * @category design
4
- * @package Iparcel_Shipping
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Iparcel_Shipping_Block_Html_Head_Jquery
7
- */
8
- $helper = Mage::helper('shippingip');
9
- ?>
10
- <?php if($this->getFlag()): ?>
11
- <script type="text/javascript" src="<?php echo $helper->getScriptUrl(); ?>JavaScript/Merchant/<?php echo Mage::helper('shippingip')->getCustomerId(); ?>/1"></script>
12
- <script type="text/javascript">var ipar_is_mage = true;</script>
13
- <link rel="stylesheet" type="text/css" href="<?php echo $helper->getScriptUrl(); ?>CSS/Merchant/<?php echo Mage::helper('shippingip')->getCustomerId(); ?>/1" />
14
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/shippingip/post.phtml DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- /**
3
- * @category design
4
- * @package Iparcel_Shipping
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Iparcel_Shipping_Block_Catalog_Product
7
- */
8
- ?>
9
- <script type="text/javascript">
10
- iparcelPost.single('<?php echo $this->getProduct()->getSku(); ?>', '<?php echo substr(Mage::getBaseUrl(),5); ?>', '<?php echo $this->getStock(); ?>');
11
- </script>
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/shippingip/post/list.phtml DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * @category design
4
- * @package Iparcel_Shipping
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Iparcel_Shipping_Block_Catalog_Product_List
7
- */
8
- ?>
9
- <?php
10
- $_productCollection = $this->getLoadedProductCollection();
11
- $helper = Mage::helper('shippingip')
12
- ?>
13
- <script type="text/javascript">
14
- iparcelPost.sku_list({
15
- <?php foreach ($_productCollection as $_product): ?>
16
- "<?php echo $helper->jsEscape($_product->getSku()); ?>": "<?php echo $helper->jsEscape($_product->getName()); ?>",
17
- <?php endforeach; ?>
18
- });
19
- iparcelPost.stock_list({
20
- <?php foreach ($_productCollection as $_product): ?>
21
- "<?php echo $helper->jsEscape($_product->getName()); ?>": "<?php echo $this->getStock($_product); ?>",
22
- <?php endforeach; ?>
23
- });
24
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Iparcel_All.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Iparcel_All>
5
+ <codePool>community</codePool>
6
+ <active>true</active>
7
+ </Iparcel_All>
8
+ </modules>
9
+ </config>
app/etc/modules/{Iparcel_Shipping.xml → Iparcel_GlobaleCommerce.xml} RENAMED
@@ -1,9 +1,9 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
- <Iparcel_Shipping>
5
  <codePool>community</codePool>
6
  <active>true</active>
7
- </Iparcel_Shipping>
8
  </modules>
9
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
+ <Iparcel_GlobaleCommerce>
5
  <codePool>community</codePool>
6
  <active>true</active>
7
+ </Iparcel_GlobaleCommerce>
8
  </modules>
9
  </config>
js/iparcel/adminhtml/sync.js CHANGED
@@ -1,3 +1,10 @@
 
 
 
 
 
 
 
1
  var iparcelSync = {
2
  item: null,
3
  sync: null,
1
+ /**
2
+ * js lib for i-parcel's ajax sync
3
+ *
4
+ * @category Iparcel
5
+ * @package Iparcel_All
6
+ * @author Bobby Burden <bburden@i-parcel.com>
7
+ */
8
  var iparcelSync = {
9
  item: null,
10
  sync: null,
js/iparcel/post.js CHANGED
@@ -91,8 +91,8 @@ var iparcelPost = {
91
  var $this = $jip(this);
92
  var super_attribute = '';
93
  $jip('.super-attribute-select, .product-custom-option').each(function () {
94
- var $this = $jip(this);
95
- super_attribute += $this.attr('name') + '=' + $this.val() + '&';
96
  });
97
  iparcelMage.ajax.post(iparcelPost.sku, super_attribute, iparcelPost.url);
98
  },
91
  var $this = $jip(this);
92
  var super_attribute = '';
93
  $jip('.super-attribute-select, .product-custom-option').each(function () {
94
+ var $this = $jip(this);
95
+ super_attribute += $this.attr('name') + '=' + $this.val() + '&';
96
  });
97
  iparcelMage.ajax.post(iparcelPost.sku, super_attribute, iparcelPost.url);
98
  },
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>iparcel_connect</name>
4
- <version>2.4.11</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-05</date>
20
- <time>21:49:59</time>
21
- <contents><target name="mageweb"><dir name="app"><dir name="code"><dir name="community"><dir name="Iparcel"><dir name="Shipping"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Checkitems"><file name="Button.php" hash="b91ff14cf069bde0963320bf0409d7d6"/></dir><dir name="Mapping"><file name="Button.php" hash="ca949264be1a2946447a81405c21d5a8"/></dir></dir><dir name="Iparcel"><file name="Dashboard.php" hash="6c823eb6595c464638285ff3fb9e04b0"/></dir><dir name="Logs"><file name="Grid.php" hash="3fc2f3f7993571f3dac855abe59fec01"/></dir><file name="Logs.php" hash="c81ac5f1c6efe608b1a1a1ff8a1b409a"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="c0739e3ca186ce2b6b67613491e197e9"/></dir><dir name="Invoice"><file name="Totals.php" hash="05b24de84077924bb37251d8ef73bf44"/></dir><dir name="Shipment"><dir name="View"><file name="Form.php" hash="229b14530784faaacf094126d726b4ae"/><file name="Tracking.php" hash="9efac22323af23771e29338dbb18135c"/></dir></dir><file name="Totals.php" hash="51b2043c49739ffccec082970b49b605"/></dir></dir><dir name="Salesrule"><dir name="Rule"><file name="Sync.php" hash="becdb480a9ec80561e8f244e7902316a"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Method.php" hash="e2adb858a292118fbfe9d8f61791bb49"/></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="3a784eec9e2837f8b0fccb53661a0333"/></dir><file name="Product.php" hash="6c6f146ecd1d7fc3c89615d74ad8c89e"/></dir><dir name="Catalogsearch"><dir name="Advanced"><file name="Result.php" hash="5dae8b0b2887d6c7df56b4150fcca21f"/></dir><file name="Result.php" hash="fb38a46e7df874188f25bcc7ab9d721a"/></dir><file name="Cpf.php" hash="ef6c85747d762858fc24ca2c1f579bfc"/><dir name="Html"><dir name="Head"><file name="Iparcel.php" hash="76c22656af05546abf19e94793889b19"/><file name="Jquery.php" hash="80b6b653516ae72e77a0ec5c28e88a41"/><file name="Post.php" hash="6dd772f2984d5f7e8063966ff73b9cf4"/></dir></dir><dir name="Payment"><file name="Info.php" hash="41b3173f2374995d1f1f132d93abcaa3"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="7b9c9c4c16badf3e0bf46ac4c0066927"/></dir><dir name="Invoice"><file name="Totals.php" hash="b0d49b76ee38ad36a924488f58d1dcd7"/></dir><file name="Totals.php" hash="065dd4ff8742134a6248f1679c7f0472"/></dir></dir><dir name="Tax"><dir name="Checkout"><file name="Tax.php" hash="790d7b3167765b2826885e0600bfa964"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Shippingip"><file name="LogController.php" hash="a86bc09065a0d4f329dbc52a224f0bab"/><file name="SyncController.php" hash="8df4ee930dbe5f5dd5cc70f64525a58d"/><dir name="Sync"><file name="AjaxController.php" hash="d25880fc0332e62c696335f61d02e7f9"/></dir></dir></dir><file name="AjaxController.php" hash="ea68c0cbe7bf48c3fcca818194e456b9"/><file name="DevController.php" hash="1b4aebebe545026dac11c63acfcad75b"/><file name="InternationalController.php" hash="9b7116f44fa3b6ea22a5e6ad3659c9c7"/><file name="OrderController.php" hash="2541e958c7d4a68ffd9647cce103ffcb"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d7c09b8f804f5095d28b91732f58fcea"/><file name="config.xml" hash="3c6c0045f5603a40c95c78050032b426"/><file name="system.xml" hash="fff364173aeee0963e55182734efeaf2"/></dir><dir name="Helper"><dir name="Api"><file name="External.php" hash="093ecd77863b24db8bf58a5d9c82e1c8"/></dir><file name="Api.php" hash="68b988357bad510bb4e70fb9f543927f"/><file name="Data.php" hash="771195d6c90602e9bf829785ada02690"/><file name="International.php" hash="a42c46ee707b1037f3d010d420e9d7e5"/><file name="String.php" hash="2147e64a80e4e3b896ab1b1444d3ac03"/><file name="Tax.php" hash="9c33601ec3da9d70cd23e6bebbfc1b7a"/><dir name="Sales"><file name="Data.php" hash="9f55c4116ed7fa91638bb6dd2a29c463"/></dir></dir><dir name="Model"><dir name="Api"><dir name="External"><dir name="Sales"><file name="Order.php" hash="99c3a95369e9ca5bdf25a1034d87c393"/></dir></dir><file name="Log.php" hash="9dea214fe8d337a6cee6d4b04c4b0823"/></dir><dir name="Carrier"><file name="Iparcel.php" hash="02a146cc99fc627a7363fc4cb32af105"/></dir><dir name="Catalog"><file name="Mapping.php" hash="f670a14b28323ba224b67192b108ec03"/><dir name="Product"><file name="Observer.php" hash="9fdd35d79826f4bb18e8393dab2e0c59"/></dir></dir><dir name="Config"><dir name="Catalog"><file name="Mapping.php" hash="552a5fbd97d0ce11134f801f88ada779"/></dir><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="b40792549a861293215c8d40994d30c6"/><file name="Weekday.php" hash="7653b7ad1dc90d26b21e4b0127926286"/></dir><dir name="Time"><file name="Hour.php" hash="de16a76a5aa33e66d2fd5b8267dc62b1"/><file name="Minute.php" hash="2e9aae74986f7d45aab08b532ca833a7"/></dir></dir><file name="Guid.php" hash="7e13d4a22e3a0b1af0de90aff0bb0bb7"/><dir name="Script"><file name="Js.php" hash="38f7acaa80052a3cdbfc7b814e85c571"/></dir></dir><dir name="Cpf"><file name="Order.php" hash="768e3e071e4649dbfe0ce0460620f420"/><file name="Quote.php" hash="d99fbc197e1173ac2920ee2b5f202abe"/></dir><file name="Cpf.php" hash="a33b9f7d9f63b694221aec37a395e299"/><file name="Observer.php" hash="5bdc7709bb74556eeb2798689927ced4"/><file name="Parcel.php" hash="b36e0c21c0ec91c9a9bd7529dcb101fa"/><dir name="Payment"><file name="Iparcel.php" hash="6fb1c3167b2e14bdf9325e438a1a5faf"/></dir><dir name="Resource"><dir name="Api"><file name="Order.php" hash="3a95182d84c1584a9c3c5c6bca4c5005"/></dir><dir name="Cpf"><file name="Collection.php" hash="7caf21860e5fac87ebb845c8a6e8ef5d"/><file name="Order.php" hash="c79c0deae8e9166b76e4b53f1f360a23"/><file name="Quote.php" hash="f4d92ef99b16523c1baebfee42519622"/><dir name="Order"><file name="Collection.php" hash="b6452433e36b3394d1c518604d7aec6f"/></dir><dir name="Quote"><file name="Collection.php" hash="31c3e33f029bc4757284bd53489ef7b2"/></dir></dir><file name="Cpf.php" hash="32288ab0de32f9f90b643a05f12cc4c6"/><file name="Parcel.php" hash="57585af5ae851db90999a4ed4ea0b1bd"/><file name="Setup.php" hash="18f16dddafb414ca0dbcc5a9202cb0dc"/><dir name="Parcel"><file name="Collection.php" hash="641c3a3b4c8b63b8380d9d0a92cf1deb"/></dir><dir name="Tax"><dir name="Totals"><file name="Collection.php" hash="e6164a325bdff1b7a6451c1ca01416b3"/></dir><file name="Totals.php" hash="11d9457fc4b52f18ccc1ab3f6e677598"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Observer.php" hash="44bec26acd06ef693e6e233a52eb64d7"/><dir name="Shipment"><file name="Observer.php" hash="3388ef509f3b0d7a5bc702872dd1e455"/></dir></dir><dir name="Quote"><file name="Observer.php" hash="9883bcc92ad348a4c45d356b7301f295"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Mapping"><dir name="Configurable"><file name="Price.php" hash="d9a6e4417ee1135af58849e19945d8bf"/></dir><file name="Mode.php" hash="0b1c595182ffac855717776fc3e24490"/></dir><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="c352d8179613dbc6e7f08e0811442dd0"/></dir><file name="Attribute.php" hash="5353c9a5a8bcc834228b8df5210eb08e"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="f4341285b79feb4b3063b113889a9f7a"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="26d444ae9644e78f040e580b6bb319f5"/></dir></dir><dir name="Tax"><file name="Mode.php" hash="291ad4eff21d0178200abd058787ebbe"/></dir></dir></dir></dir><dir name="Tax"><file name="Calculation.php" hash="9001dd79af61eed769faa2bbac629bf6"/><file name="Totals.php" hash="1d2af5b8fb0df1ccd5d7550cd55d3fcb"/><dir name="Totals"><file name="Abstract.php" hash="56dca2b3d7689b90d4ede5362bcc62bb"/><dir name="Duty"><file name="Creditmemo.php" hash="1ae6546a91bfe85c7c4c9c1b4e1d97c3"/><file name="Invoice.php" hash="eb7bfee47e0544973da092e56f26a5ab"/><file name="Quote.php" hash="9b7d1e47bc768ba85ac8c6f5ebc518ba"/></dir><dir name="Tax"><file name="Creditmemo.php" hash="4b16edce04ca034cbfba219def5dfe92"/><file name="Invoice.php" hash="681e224403795adf80e9025a454374b4"/><file name="Quote.php" hash="5f53caf617b69ae7f81696a8c57fe535"/></dir><dir name="Taxduty"><file name="Creditmemo.php" hash="8da554edc2d20ad794ea5c9eb3b5a957"/><file name="Invoice.php" hash="c787d7f5b24a908989cd2c40d1af5870"/><file name="Quote.php" hash="68bb998187ec3fdfaf1b2a638a09b5c3"/></dir></dir></dir></dir><dir name="sql"><dir name="shippingip_setup"><file name="mysql4-install-0.2.0.php" hash="0444109a77906bdf7cd48305a94b9af9"/><file name="mysql4-install-0.3.0.php" hash="0444109a77906bdf7cd48305a94b9af9"/><file name="mysql4-install-2.3.4.2.php" hash="95a02156352063f5ca992a1b01d6c19f"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="52a232b3e60be6ba2ec8ecd6a7b49db7"/><file name="mysql4-upgrade-0.3.0-0.3.1.php" hash="423a0f3b34346514a5edf1798246b6ca"/><file name="mysql4-upgrade-0.3.1-0.3.2.php" hash="881e48b8921cb3cbcd2348092ae8da13"/><file name="mysql4-upgrade-0.3.2-2.0.0.php" hash="1ec688052256ff2217c80369e75c9f76"/><file name="mysql4-upgrade-2.0.0-2.3.4.2.php" hash="850c05b3c300c8fb8449393e0d1b97e7"/><file name="mysql4-upgrade-2.3.4.2-2.3.4.4.php" hash="378ad84572e259d6bce61470ca0b9571"/><file name="mysql4-upgrade-2.3.4.3-2.3.4.4.php" hash="378ad84572e259d6bce61470ca0b9571"/><file name="mysql4-upgrade-2.4.0.3-2.4.1.0.php" hash="672903f59d4711306875a24f4dd5a27a"/><file name="mysql4-upgrade-2.4.1.17-2.4.3.0.php" hash="0fe7df3bf25ab47206508176961595b4"/><file name="mysql4-upgrade-2.4.1.6-2.4.1.7.php" hash="19fadcf9d5275eec31b192f4938ea3cd"/><file name="mysql4-upgrade-2.4.6-2.4.7.php" hash="743525067bd7a70135444328afb65961"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="iparcel"><dir name="sales"><dir name="order"><dir name="shipment"><dir name="view"><file name="tracking.phtml" hash="c8c306dd5222d236316416fc24e878e3"/></dir></dir></dir></dir><dir name="sync"><dir name="ajax"><file name="catalog.phtml" hash="48865e1197957ebfaedfcd404112b31f"/><file name="checkitems.phtml" hash="91b8a960a7e6c14d83d282cfa1ae0541"/></dir></dir></dir></dir><dir name="layout"><file name="externalsales.xml" hash="cec9963a1742a676b73824eab850b2d0"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="shippingip"><file name="cpf.phtml" hash="a447be164b935badb27ec5030bd6fdbc"/><file name="post.phtml" hash="ae6ee4b40efe875771dd39048b3f3a3a"/><dir name="html"><dir name="head"><file name="iparcel.phtml" hash="24dd2314962ab204aba21f37bb43ebc0"/><file name="jquery.phtml" hash="69e3266c61fbf24c4f876fbfd4283b80"/><file name="post.phtml" hash="faab1b60f4f35f135df23859f62b39ab"/></dir></dir><dir name="post"><file name="list.phtml" hash="fa484d152b7473b7af449118f2112f84"/></dir></dir></dir><dir name="layout"><file name="externalshipping.xml" hash="7010ac3511fa4895e4d6ee341ff8eaca"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Iparcel_Shipping.xml" hash="82c0c0b16f4647a662536274f17f5d18"/></dir></dir></dir><dir name="var"><dir name="connect"><file name="iparcel_connect.xml" hash="d212a8922aadf484676e74a880ad86eb"/></dir></dir><dir name="js"><dir name="iparcel"><dir name="adminhtml"><file name="label.js" hash="39bf27f07ff782dcde65480d4ff04496"/><file name="sync.js" hash="51f7ef4d8fb857589bbde1dc1e12d16f"/></dir><file name="cpf.js" hash="92443ee9633827b535044aebbdaeef87"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="29d52bf315386c3c8a9b7a7d6e277dfc"/><file name="post.js" hash="3e9c956d99fea2255ec8c016b4e9a5c9"/></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="8ffedc82f9b9a02f4016f502ab30117e"/><file name="code128.ttf" hash="8ffedc82f9b9a02f4016f502ab30117e"/></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.0</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-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>
skin/adminhtml/default/default/iparcel/font/code128.ttf DELETED
Binary file