Tritac_ChannelEngine - Version 4.6.0

Version Notes

* Add diagnostic information

Download this release

Release Info

Developer Christiaan de Ridder
Extension Tritac_ChannelEngine
Version 4.6.0
Comparing to
See all releases


Code changes from version 4.4.1 to 4.6.0

Files changed (200) hide show
  1. app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Feed.php +0 -55
  2. app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Form/Button.php +81 -0
  3. app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Form/Feed.php +41 -0
  4. app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Form/Link.php +49 -0
  5. app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Form/Version.php +47 -0
  6. app/code/community/Tritac/ChannelEngine/Block/Head.php +2 -0
  7. app/code/community/Tritac/ChannelEngine/Helper/Data.php +6 -1
  8. app/code/community/Tritac/ChannelEngine/Model/Observer.php +132 -57
  9. app/code/community/Tritac/ChannelEngine/controllers/Adminhtml/GenerateController.php +49 -10
  10. app/code/community/Tritac/ChannelEngine/etc/config.xml +1 -1
  11. app/code/community/Tritac/ChannelEngine/etc/system.xml +96 -31
  12. app/design/adminhtml/default/default/template/channelengine/system/config/{feed/generate_button.phtml → form/ajax_button.phtml} +9 -12
  13. lib/ChannelEngine/.gitignore +0 -2
  14. lib/ChannelEngine/composer.json +5 -0
  15. lib/ChannelEngine/composer.lock +71 -0
  16. lib/ChannelEngine/vendor/autoload.php +7 -0
  17. lib/ChannelEngine/vendor/channelengine/api-client/.gitignore +4 -0
  18. lib/ChannelEngine/vendor/channelengine/api-client/.php_cs +18 -0
  19. lib/ChannelEngine/vendor/channelengine/api-client/.travis.yml +10 -0
  20. lib/ChannelEngine/vendor/channelengine/api-client/README.md +176 -0
  21. lib/ChannelEngine/vendor/channelengine/api-client/api-client.sublime-project +9 -0
  22. lib/ChannelEngine/vendor/channelengine/api-client/autoload.php +54 -0
  23. lib/ChannelEngine/vendor/channelengine/api-client/composer.json +37 -0
  24. lib/ChannelEngine/vendor/channelengine/api-client/docs/Api/BackOrderApi.md +161 -0
  25. lib/ChannelEngine/vendor/channelengine/api-client/docs/Api/CancellationApi.md +110 -0
  26. lib/ChannelEngine/vendor/channelengine/api-client/docs/Api/ClientApi.md +59 -0
  27. lib/ChannelEngine/vendor/channelengine/api-client/docs/Api/OrderApi.md +263 -0
  28. lib/ChannelEngine/vendor/channelengine/api-client/docs/Api/ProductApi.md +361 -0
  29. lib/ChannelEngine/vendor/channelengine/api-client/docs/Api/ReturnApi.md +212 -0
  30. lib/ChannelEngine/vendor/channelengine/api-client/docs/Api/ShipmentApi.md +163 -0
  31. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ApiResponse.md +13 -0
  32. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/BackOrder.md +13 -0
  33. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/BackOrderLine.md +11 -0
  34. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelCancellationLineResponse.md +11 -0
  35. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelCancellationResponse.md +12 -0
  36. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelOfferResponse.md +12 -0
  37. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelOrderLineRequest.md +15 -0
  38. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelOrderRequest.md +23 -0
  39. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelProcessedChangesRequest.md +12 -0
  40. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelProductChangesResponse.md +12 -0
  41. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelProductResponse.md +30 -0
  42. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelReferencesRequest.md +11 -0
  43. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelReturnLineRequest.md +11 -0
  44. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelReturnLineResponse.md +11 -0
  45. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelReturnRequest.md +17 -0
  46. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelReturnResponse.md +17 -0
  47. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelShipmentLineResponse.md +11 -0
  48. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ChannelShipmentResponse.md +14 -0
  49. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/CollectionOfBackOrder.md +15 -0
  50. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/CollectionOfChannelCancellationResponse.md +15 -0
  51. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/CollectionOfChannelOfferResponse.md +15 -0
  52. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/CollectionOfChannelReturnResponse.md +15 -0
  53. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/CollectionOfChannelShipmentResponse.md +15 -0
  54. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/CollectionOfMerchantOrderResponse.md +15 -0
  55. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/CollectionOfMerchantReturnResponse.md +15 -0
  56. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/EntitiesAddressModels.md +21 -0
  57. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ExtraDataItem.md +13 -0
  58. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantCancellationLineRequest.md +11 -0
  59. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantCancellationRequest.md +13 -0
  60. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantOrderLineResponse.md +16 -0
  61. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantOrderResponse.md +26 -0
  62. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantProductRequest.md +29 -0
  63. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantProductResponse.md +29 -0
  64. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantReturnLineRequest.md +11 -0
  65. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantReturnLineResponse.md +11 -0
  66. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantReturnRequest.md +17 -0
  67. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantReturnResponse.md +16 -0
  68. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantShipmentLineRequest.md +11 -0
  69. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantShipmentRequest.md +15 -0
  70. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/MerchantShipmentTrackingRequest.md +12 -0
  71. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/OrderAcknowledgement.md +11 -0
  72. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ProductCreationResult.md +12 -0
  73. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/ProductMessage.md +13 -0
  74. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/SingleOfBackOrder.md +14 -0
  75. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/SingleOfChannelProductChangesResponse.md +14 -0
  76. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/SingleOfMerchantProductResponse.md +14 -0
  77. lib/ChannelEngine/vendor/channelengine/api-client/docs/Model/SingleOfProductCreationResult.md +14 -0
  78. lib/ChannelEngine/vendor/channelengine/api-client/git_push.sh +52 -0
  79. lib/ChannelEngine/vendor/channelengine/api-client/lib/Api/BackOrderApi.php +352 -0
  80. lib/ChannelEngine/vendor/channelengine/api-client/lib/Api/CancellationApi.php +262 -0
  81. lib/ChannelEngine/vendor/channelengine/api-client/lib/Api/ClientApi.php +179 -0
  82. lib/ChannelEngine/vendor/channelengine/api-client/lib/Api/OrderApi.php +531 -0
  83. lib/ChannelEngine/vendor/channelengine/api-client/lib/Api/ProductApi.php +688 -0
  84. lib/ChannelEngine/vendor/channelengine/api-client/lib/Api/ReturnApi.php +435 -0
  85. lib/ChannelEngine/vendor/channelengine/api-client/lib/Api/ShipmentApi.php +363 -0
  86. lib/ChannelEngine/vendor/channelengine/api-client/lib/ApiClient.php +367 -0
  87. lib/ChannelEngine/vendor/channelengine/api-client/lib/ApiException.php +121 -0
  88. lib/ChannelEngine/vendor/channelengine/api-client/lib/Configuration.php +703 -0
  89. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ApiResponse.php +307 -0
  90. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/BackOrder.php +388 -0
  91. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/BackOrderLine.php +288 -0
  92. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelCancellationLineResponse.php +267 -0
  93. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelCancellationResponse.php +293 -0
  94. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelOfferResponse.php +281 -0
  95. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelOrderLineRequest.php +435 -0
  96. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelOrderRequest.php +768 -0
  97. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelProcessedChangesRequest.php +281 -0
  98. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelProductChangesResponse.php +281 -0
  99. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelProductResponse.php +778 -0
  100. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelReferencesRequest.php +255 -0
  101. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelReturnLineRequest.php +267 -0
  102. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelReturnLineResponse.php +267 -0
  103. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelReturnRequest.php +508 -0
  104. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelReturnResponse.php +508 -0
  105. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelShipmentLineResponse.php +267 -0
  106. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ChannelShipmentResponse.php +408 -0
  107. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/CollectionOfBackOrder.php +359 -0
  108. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/CollectionOfChannelCancellationResponse.php +359 -0
  109. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/CollectionOfChannelOfferResponse.php +359 -0
  110. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/CollectionOfChannelReturnResponse.php +359 -0
  111. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/CollectionOfChannelShipmentResponse.php +359 -0
  112. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/CollectionOfMerchantOrderResponse.php +359 -0
  113. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/CollectionOfMerchantReturnResponse.php +359 -0
  114. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/EntitiesAddressModels.php +649 -0
  115. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ExtraDataItem.php +338 -0
  116. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantCancellationLineRequest.php +267 -0
  117. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantCancellationRequest.php +325 -0
  118. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantOrderLineResponse.php +461 -0
  119. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantOrderResponse.php +844 -0
  120. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantProductRequest.php +752 -0
  121. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantProductResponse.php +752 -0
  122. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantReturnLineRequest.php +267 -0
  123. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantReturnLineResponse.php +261 -0
  124. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantReturnRequest.php +508 -0
  125. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantReturnResponse.php +464 -0
  126. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantShipmentLineRequest.php +267 -0
  127. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantShipmentRequest.php +440 -0
  128. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/MerchantShipmentTrackingRequest.php +356 -0
  129. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/OrderAcknowledgement.php +288 -0
  130. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ProductCreationResult.php +281 -0
  131. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/ProductMessage.php +307 -0
  132. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/SingleOfBackOrder.php +333 -0
  133. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/SingleOfChannelProductChangesResponse.php +333 -0
  134. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/SingleOfMerchantProductResponse.php +333 -0
  135. lib/ChannelEngine/vendor/channelengine/api-client/lib/Model/SingleOfProductCreationResult.php +333 -0
  136. lib/ChannelEngine/vendor/channelengine/api-client/lib/ObjectSerializer.php +297 -0
  137. lib/ChannelEngine/vendor/channelengine/api-client/phpunit.xml.dist +21 -0
  138. lib/ChannelEngine/vendor/channelengine/api-client/test/Api/BackOrderApiTest.php +112 -0
  139. lib/ChannelEngine/vendor/channelengine/api-client/test/Api/CancellationApiTest.php +101 -0
  140. lib/ChannelEngine/vendor/channelengine/api-client/test/Api/ClientApiTest.php +90 -0
  141. lib/ChannelEngine/vendor/channelengine/api-client/test/Api/OrderApiTest.php +134 -0
  142. lib/ChannelEngine/vendor/channelengine/api-client/test/Api/ProductApiTest.php +156 -0
  143. lib/ChannelEngine/vendor/channelengine/api-client/test/Api/ReturnApiTest.php +123 -0
  144. lib/ChannelEngine/vendor/channelengine/api-client/test/Api/ShipmentApiTest.php +112 -0
  145. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ApiResponseTest.php +117 -0
  146. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/BackOrderLineTest.php +101 -0
  147. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/BackOrderTest.php +117 -0
  148. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelCancellationLineResponseTest.php +101 -0
  149. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelCancellationResponseTest.php +109 -0
  150. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelOfferResponseTest.php +109 -0
  151. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelOrderLineRequestTest.php +133 -0
  152. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelOrderRequestTest.php +197 -0
  153. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelProcessedChangesRequestTest.php +109 -0
  154. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelProductChangesResponseTest.php +109 -0
  155. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelProductResponseTest.php +253 -0
  156. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelReferencesRequestTest.php +101 -0
  157. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelReturnLineRequestTest.php +101 -0
  158. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelReturnLineResponseTest.php +101 -0
  159. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelReturnRequestTest.php +149 -0
  160. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelReturnResponseTest.php +149 -0
  161. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelShipmentLineResponseTest.php +101 -0
  162. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ChannelShipmentResponseTest.php +125 -0
  163. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/CollectionOfBackOrderTest.php +133 -0
  164. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/CollectionOfChannelCancellationResponseTest.php +133 -0
  165. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/CollectionOfChannelOfferResponseTest.php +133 -0
  166. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/CollectionOfChannelReturnResponseTest.php +133 -0
  167. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/CollectionOfChannelShipmentResponseTest.php +133 -0
  168. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/CollectionOfMerchantOrderResponseTest.php +133 -0
  169. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/CollectionOfMerchantReturnResponseTest.php +133 -0
  170. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/EntitiesAddressModelsTest.php +181 -0
  171. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ExtraDataItemTest.php +117 -0
  172. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantCancellationLineRequestTest.php +101 -0
  173. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantCancellationRequestTest.php +117 -0
  174. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantOrderLineResponseTest.php +141 -0
  175. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantOrderResponseTest.php +221 -0
  176. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantProductRequestTest.php +245 -0
  177. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantProductResponseTest.php +245 -0
  178. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantReturnLineRequestTest.php +101 -0
  179. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantReturnLineResponseTest.php +101 -0
  180. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantReturnRequestTest.php +149 -0
  181. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantReturnResponseTest.php +141 -0
  182. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantShipmentLineRequestTest.php +101 -0
  183. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantShipmentRequestTest.php +133 -0
  184. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/MerchantShipmentTrackingRequestTest.php +109 -0
  185. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/OrderAcknowledgementTest.php +101 -0
  186. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ProductCreationResultTest.php +109 -0
  187. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/ProductMessageTest.php +117 -0
  188. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/SingleOfBackOrderTest.php +125 -0
  189. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/SingleOfChannelProductChangesResponseTest.php +125 -0
  190. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/SingleOfMerchantProductResponseTest.php +125 -0
  191. lib/ChannelEngine/vendor/channelengine/api-client/test/Model/SingleOfProductCreationResultTest.php +125 -0
  192. lib/ChannelEngine/vendor/composer/ClassLoader.php +445 -0
  193. lib/ChannelEngine/vendor/composer/LICENSE +21 -0
  194. lib/ChannelEngine/vendor/composer/autoload_classmap.php +9 -0
  195. lib/ChannelEngine/vendor/composer/autoload_namespaces.php +9 -0
  196. lib/ChannelEngine/vendor/composer/autoload_psr4.php +10 -0
  197. lib/ChannelEngine/vendor/composer/autoload_real.php +52 -0
  198. lib/ChannelEngine/vendor/composer/autoload_static.php +31 -0
  199. lib/ChannelEngine/vendor/composer/installed.json +55 -0
  200. package.xml +5 -5
app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Feed.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
- /**
3
- * Adminhtml system "generate feed" button
4
- *
5
- * @category Tritac
6
- * @package Tritac_ChannelEngine
7
- */
8
- class Tritac_ChannelEngine_Block_Adminhtml_System_Config_Feed extends Mage_Adminhtml_Block_System_Config_Form_Field
9
- {
10
- /*
11
- * Set template
12
- */
13
- protected function _construct()
14
- {
15
- parent::_construct();
16
- $this->setTemplate('channelengine/system/config/feed/generate_button.phtml');
17
- }
18
-
19
- /**
20
- * Return element html
21
- *
22
- * @param Varien_Data_Form_Element_Abstract $element
23
- * @return string
24
- */
25
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
26
- {
27
- return $this->_toHtml();
28
- }
29
-
30
- /**
31
- * Return ajax url for button
32
- *
33
- * @return string
34
- */
35
- public function getAjaxUrl()
36
- {
37
- return Mage::helper('adminhtml')->getUrl('channelengine/adminhtml_generate/ajax');
38
- }
39
-
40
- /**
41
- * Generate button html
42
- *
43
- * @return string
44
- */
45
- public function getButtonHtml()
46
- {
47
- $button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
48
- 'id' => 'channelengine_generate_feed_button',
49
- 'label' => $this->helper('channelengine')->__('Generate Feed'),
50
- 'onclick' => 'javascript:generateFeed(); return false;'
51
- ));
52
-
53
- return $button->toHtml();
54
- }
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Form/Button.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adminhtml system "generate feed" button
4
+ *
5
+ * @category Tritac
6
+ * @package Tritac_ChannelEngine
7
+ */
8
+ class Tritac_ChannelEngine_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
9
+ {
10
+ /*
11
+ * Set template
12
+ */
13
+ private $data;
14
+ private $id;
15
+
16
+ protected function _construct()
17
+ {
18
+ parent::_construct();
19
+ $this->setTemplate('channelengine/system/config/form/ajax_button.phtml');
20
+ }
21
+
22
+ /**
23
+ * Return element html
24
+ *
25
+ * @param Varien_Data_Form_Element_Abstract $element
26
+ * @return string
27
+ */
28
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
29
+ {
30
+ $this->data = $element->getOriginalData();
31
+ $this->id = '_id_' . rand();
32
+ return $this->_toHtml();
33
+ }
34
+
35
+ /**
36
+ * Return ajax url for button
37
+ *
38
+ * @return string
39
+ */
40
+ public function getAjaxUrl()
41
+ {
42
+ $action = $this->data['ajax_action'];
43
+ return Mage::helper('adminhtml')->getUrl('channelengine/adminhtml_generate/' . $action);
44
+ }
45
+
46
+ public function getId()
47
+ {
48
+ return $this->id;
49
+ }
50
+
51
+ /**
52
+ * Generate button html
53
+ *
54
+ * @return string
55
+ */
56
+ public function getButtonHtml()
57
+ {
58
+ $label = $this->data['button_label'];
59
+
60
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
61
+ 'id' => $this->id,
62
+ 'label' => $label, //$this->helper('channelengine')->__('Generate Feed'),
63
+ 'onclick' => 'javascript:makeRequest'.$this->id .'(); return false;'
64
+ ));
65
+
66
+ return $button->toHtml();
67
+ }
68
+
69
+ /**
70
+ * Render element
71
+ *
72
+ * @param Varien_Data_Form_Element_Abstract $element
73
+ * @return string
74
+ */
75
+ public function render(Varien_Data_Form_Element_Abstract $element)
76
+ {
77
+ // Hide checkbox
78
+ $element->unsCanUseWebsiteValue()->unsCanUseDefaultValue()->unsScope();
79
+ return parent::render($element);
80
+ }
81
+ }
app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Form/Feed.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adminhtml system "generate feed" button
4
+ *
5
+ * @category Tritac
6
+ * @package Tritac_ChannelEngine
7
+ */
8
+ class Tritac_ChannelEngine_Block_Adminhtml_System_Config_Form_Feed extends Mage_Adminhtml_Block_System_Config_Form_Field
9
+ {
10
+ /*
11
+ * Set template
12
+ */
13
+ private $helper;
14
+
15
+ protected function _construct()
16
+ {
17
+ parent::_construct();
18
+ $this->helper = Mage::helper('channelengine');
19
+ }
20
+
21
+ /**
22
+ * Return element html
23
+ *
24
+ * @param Varien_Data_Form_Element_Abstract $element
25
+ * @return string
26
+ */
27
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
28
+ {
29
+ $value = "Please set your account name";
30
+ $disabled = "disabled";
31
+ $storeId= Mage::getSingleton('adminhtml/config_data')->getScopeId();
32
+ $config = $this->helper->getConfig($storeId);
33
+ $hasValue = $config && !empty($config['general']['tenant']);
34
+ if($hasValue) {
35
+ $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
36
+ $value = $baseUrl . "channelengine/" . $config['general']['tenant'] . "_products.xml";
37
+ $disabled = "";
38
+ }
39
+ return '<input type="text" class="input-text" value="'.$value.'" '.$disabled.'/>';
40
+ }
41
+ }
app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Form/Link.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adminhtml system href
4
+ *
5
+ * @category Tritac
6
+ * @package Tritac_ChannelEngine
7
+ */
8
+ class Tritac_ChannelEngine_Block_Adminhtml_System_Config_Form_Link extends Mage_Adminhtml_Block_System_Config_Form_Field
9
+ {
10
+ /*
11
+ * Set template
12
+ */
13
+ private $helper;
14
+ private $data;
15
+
16
+ protected function _construct()
17
+ {
18
+ parent::_construct();
19
+ $this->helper = Mage::helper('channelengine');
20
+ }
21
+
22
+ /**
23
+ * Return element html
24
+ *
25
+ * @param Varien_Data_Form_Element_Abstract $element
26
+ * @return string
27
+ */
28
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
29
+ {
30
+ $data = $element->getOriginalData();
31
+ $action = $data['link_action'];
32
+ $label = $data['link_label'];
33
+ $url = Mage::helper('adminhtml')->getUrl('channelengine/adminhtml_generate/' . $action);
34
+ return '<a type="text" href="'.$url.'" target="_blank">'.$label.'</a>';
35
+ }
36
+
37
+ /**
38
+ * Render element
39
+ *
40
+ * @param Varien_Data_Form_Element_Abstract $element
41
+ * @return string
42
+ */
43
+ public function render(Varien_Data_Form_Element_Abstract $element)
44
+ {
45
+ // Hide checkbox
46
+ $element->unsCanUseWebsiteValue()->unsCanUseDefaultValue()->unsScope();
47
+ return parent::render($element);
48
+ }
49
+ }
app/code/community/Tritac/ChannelEngine/Block/Adminhtml/System/Config/Form/Version.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adminhtml system href
4
+ *
5
+ * @category Tritac
6
+ * @package Tritac_ChannelEngine
7
+ */
8
+ class Tritac_ChannelEngine_Block_Adminhtml_System_Config_Form_Version extends Mage_Adminhtml_Block_System_Config_Form_Field
9
+ {
10
+ /*
11
+ * Set template
12
+ */
13
+ private $helper;
14
+ private $data;
15
+
16
+ protected function _construct()
17
+ {
18
+ parent::_construct();
19
+ $this->helper = Mage::helper('channelengine');
20
+ }
21
+
22
+ /**
23
+ * Return element html
24
+ *
25
+ * @param Varien_Data_Form_Element_Abstract $element
26
+ * @return string
27
+ */
28
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
29
+ {
30
+ // Hide checkbox
31
+ $element->unsCanUseWebsiteValue();
32
+ return $this->helper->getExtensionVersion();
33
+ }
34
+
35
+ /**
36
+ * Render element
37
+ *
38
+ * @param Varien_Data_Form_Element_Abstract $element
39
+ * @return string
40
+ */
41
+ public function render(Varien_Data_Form_Element_Abstract $element)
42
+ {
43
+ // Hide checkbox
44
+ $element->unsCanUseWebsiteValue()->unsCanUseDefaultValue()->unsScope();
45
+ return parent::render($element);
46
+ }
47
+ }
app/code/community/Tritac/ChannelEngine/Block/Head.php CHANGED
@@ -6,6 +6,8 @@ class Tritac_ChannelEngine_Block_Head extends Mage_Core_Block_Template
6
  $storeId = Mage::app()->getStore()->getId();
7
  $config = Mage::helper('channelengine')->getGeneralConfig();
8
 
 
 
9
  return $config[$storeId]['tenant'];
10
  }
11
  }
6
  $storeId = Mage::app()->getStore()->getId();
7
  $config = Mage::helper('channelengine')->getGeneralConfig();
8
 
9
+ if(!isset($config[$storeId]) || empty($config[$storeId]['tenant'])) return false;
10
+
11
  return $config[$storeId]['tenant'];
12
  }
13
  }
app/code/community/Tritac/ChannelEngine/Helper/Data.php CHANGED
@@ -115,11 +115,16 @@ class Tritac_ChannelEngine_Helper_Data extends Mage_Core_Helper_Abstract {
115
  {
116
  $config = $this->getConfig($storeId);
117
 
118
- $weekdays = (int) $config['shipping']['expected_date'];
119
  if($weekdays <= 0)
120
  $weekdays = $this->_defaultTimeToShip;
121
 
122
  $expectedDate = date("Y-m-d", strtotime("{$weekdays} weekdays"));
123
  return new DateTime($expectedDate);
124
  }
 
 
 
 
 
125
  }
115
  {
116
  $config = $this->getConfig($storeId);
117
 
118
+ $weekdays = (int) $config['optional']['expected_date'];
119
  if($weekdays <= 0)
120
  $weekdays = $this->_defaultTimeToShip;
121
 
122
  $expectedDate = date("Y-m-d", strtotime("{$weekdays} weekdays"));
123
  return new DateTime($expectedDate);
124
  }
125
+
126
+ public function getExtensionVersion()
127
+ {
128
+ return (string) Mage::getConfig()->getNode()->modules->Tritac_ChannelEngine->version;
129
+ }
130
  }
app/code/community/Tritac/ChannelEngine/Model/Observer.php CHANGED
@@ -5,6 +5,7 @@
5
 
6
  use ChannelEngine\ApiClient\ApiClient;
7
  use ChannelEngine\ApiClient\Configuration;
 
8
 
9
  use ChannelEngine\ApiClient\Api\OrderApi;
10
  use ChannelEngine\ApiClient\Api\ShipmentApi;
@@ -19,6 +20,21 @@ use ChannelEngine\ApiClient\Model\MerchantShipmentLineRequest;
19
 
20
  class Tritac_ChannelEngine_Model_Observer
21
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  /**
23
  * API client
24
  *
@@ -40,8 +56,11 @@ class Tritac_ChannelEngine_Model_Observer
40
  */
41
  protected $_helper = null;
42
 
43
- const ATTRIBUTES_LIMIT = 30;
44
-
 
 
 
45
  private $_hasPostNL = false;
46
 
47
  /**
@@ -70,12 +89,33 @@ class Tritac_ChannelEngine_Model_Observer
70
  }
71
  }
72
 
73
- private function logApiError($storeId, $apiResponse)
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  {
75
- Mage::log(
76
- 'Failed to make ChannelEngine API call '. $storeId . "\r\n" .
77
- '['.$response->getStatusCode().'] ' . $response->getMessage()
78
- );
 
 
 
 
 
 
 
 
79
  }
80
 
81
  /**
@@ -94,11 +134,20 @@ class Tritac_ChannelEngine_Model_Observer
94
  foreach($this->_client as $storeId => $client)
95
  {
96
  $orderApi = new OrderApi($client);
 
97
 
98
- $response = $orderApi->orderGetNew();
99
- if(!$response->getSuccess())
 
 
 
 
 
 
 
 
100
  {
101
- $this->logApiError($storeId, $response);
102
  continue;
103
  }
104
 
@@ -168,8 +217,8 @@ class Tritac_ChannelEngine_Model_Observer
168
  "An order ({$order->getChannelName()} #{$order->getChannelOrderNo()}) could not be imported",
169
  "Failed add product to order: #{$productNo}. Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
170
  );
171
- Mage::logException($e);
172
- break;
173
  }
174
  }
175
 
@@ -247,7 +296,7 @@ class Tritac_ChannelEngine_Model_Observer
247
  "An order ({$order->getChannelName()} #{$order->getChannelOrderNo()}) could not be imported",
248
  "Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
249
  );
250
- Mage::logException($e);
251
  continue;
252
  }
253
 
@@ -255,7 +304,7 @@ class Tritac_ChannelEngine_Model_Observer
255
 
256
  if(!$magentoOrder->getIncrementId())
257
  {
258
- Mage::log("An order (#{$order->getId()}) could not be imported");
259
  continue;
260
  }
261
 
@@ -277,7 +326,6 @@ class Tritac_ChannelEngine_Model_Observer
277
  $os = $order->getChannelOrderSupport();
278
  $canShipPartiallyItem = ($os == MerchantOrderResponse::CHANNEL_ORDER_SUPPORT_SPLIT_ORDER_LINES);
279
  $canShipPartially = ($canShipPartiallyItem || $os == MerchantOrderResponse::CHANNEL_ORDER_SUPPORT_SPLIT_ORDERS);
280
-
281
 
282
  // Initialize new channel order
283
  $_channelOrder = Mage::getModel('channelengine/order');
@@ -296,26 +344,38 @@ class Tritac_ChannelEngine_Model_Observer
296
  ->addObject($invoice->getOrder())
297
  ->addObject($_channelOrder);
298
  $transactionSave->save();
 
 
 
 
 
 
 
 
 
 
 
299
 
300
 
 
 
301
  // Send order acknowledgement to CE.
302
  $ack = new OrderAcknowledgement();
303
  $ack->setMerchantOrderNo($magentoOrder->getId());
304
  $ack->setOrderId($order->getId());
305
- $orderApi->orderAcknowledge($ack);
306
 
 
 
 
 
 
307
  }
308
- catch (Exception $e)
309
  {
310
- Mage::getModel('adminnotification/inbox')->addCritical(
311
- "An invoice could not be created (order #{$magentoOrder->getIncrementId()}, {$order->getChannelName()} #{$order->getChannelOrderNo()})",
312
- "Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
313
- );
314
- Mage::logException($e);
315
  continue;
316
  }
317
-
318
- Mage::log("Order #{$magentoOrder->getIncrementId()} was imported successfully.");
319
  }
320
  }
321
 
@@ -382,22 +442,21 @@ class Tritac_ChannelEngine_Model_Observer
382
  {
383
  $ceShipmentUpdate = new MerchantShipmentTrackingRequest();
384
  $ceShipmentUpdate->setTrackTraceNo($ceShipment->getTrackTraceNo());
385
- $ceShipmentUpdate->setTrackTraceNo($ceShipment->getMethod());
386
 
387
  try
388
  {
389
  $response = $shipmentApi->shipmentUpdate($_shipment->getId(), $ceShipmentUpdate);
390
  if(!$response->getSuccess())
391
  {
392
- $this->logApiError($storeId, $response);
393
  Mage::getModel('adminnotification/inbox')->addCritical($errorTitle, $errorMessage);
394
  return false;
395
  }
396
  }
397
  catch(Exception $e)
398
  {
399
- //Mage::getModel('adminnotification/inbox')->addCritical($errorTitle, $errorMessage);
400
- Mage::logException($e);
401
  return false;
402
  }
403
 
@@ -431,24 +490,20 @@ class Tritac_ChannelEngine_Model_Observer
431
  try
432
  {
433
  $response = $shipmentApi->shipmentCreate($ceShipment);
434
-
435
  if(!$response->getSuccess())
436
  {
437
- $this->logApiError($storeId, $response);
438
  Mage::getModel('adminnotification/inbox')->addCritical($errorTitle, $errorMessage);
439
  return false;
440
  }
441
 
442
- $_channelShipment = Mage::getModel('channelengine/shipment')
443
- ->setShipmentId($_shipment->getId());
444
  $_channelShipment->save();
445
-
446
- Mage::log("Shipment #{$_shipment->getId()} was placed successfully.");
447
  }
448
  catch(Exception $e)
449
  {
450
- Mage::getModel('adminnotification/inbox')->addCritical($errorTitle, $errorMessage);
451
- Mage::logException($e);
452
  return false;
453
  }
454
 
@@ -468,14 +523,24 @@ class Tritac_ChannelEngine_Model_Observer
468
  {
469
  $returnApi = new ReturnApi($client);
470
  $lastUpdatedAt = new DateTime('-1 day');
471
- $response = $returnApi->returnGetDeclaredByChannel($lastUpdatedAt);
472
 
473
- if(!$response->getSuccess())
 
 
 
 
 
 
 
 
 
 
 
474
  {
475
- $this->logApiError($storeId, $response);
476
  continue;
477
  }
478
-
479
  if($response->getCount() == 0) continue;
480
 
481
  foreach($response->getContent() as $return)
@@ -556,6 +621,9 @@ class Tritac_ChannelEngine_Model_Observer
556
 
557
  $path = Mage::getBaseDir('media') . DS . 'channelengine' . DS;
558
  $storeConfig = $this->_helper->getConfig($_store->getId());
 
 
 
559
  $name = $storeConfig['general']['tenant'].'_products.xml';
560
  $file = $path . DS . $name;
561
  $date = date('c');
@@ -610,6 +678,7 @@ class Tritac_ChannelEngine_Model_Observer
610
  $attributesToSelect = array(
611
  'sku',
612
  'name',
 
613
  'description',
614
  'image',
615
  'url_key',
@@ -622,9 +691,11 @@ class Tritac_ChannelEngine_Model_Observer
622
  'msrp'
623
  );
624
 
625
- if(!empty($this->_config[$storeId]['feed']['gtin'])) $attributesToSelect[] = $this->_config[$storeId]['feed']['gtin'];
626
  $attributes = Mage::getResourceModel('catalog/product_attribute_collection');
627
 
 
 
628
  foreach($attributes as $attribute)
629
  {
630
  $code = $attribute->getAttributeCode();
@@ -634,7 +705,13 @@ class Tritac_ChannelEngine_Model_Observer
634
  // Only allow a subset of system attributes
635
  $isSystem = !$attribute->getIsUserDefined();
636
 
637
- if(!$isFlat && !$isRegular || in_array($code, $attributesToSelect)) continue;
 
 
 
 
 
 
638
 
639
  if($isSystem)
640
  {
@@ -642,13 +719,10 @@ class Tritac_ChannelEngine_Model_Observer
642
  continue;
643
  }
644
 
 
 
645
  $attributesToSelect[] = $code;
646
-
647
- $visibleAttributes[$code]['label'] = $attribute->getFrontendLabel();
648
- foreach($attribute->getSource()->getAllOptions(false) as $option)
649
- {
650
- $visibleAttributes[$code]['values'][$option['value']] = $option['label'];
651
- }
652
  }
653
 
654
  $collection->addAttributeToSelect($attributesToSelect, 'left')
@@ -674,7 +748,7 @@ class Tritac_ChannelEngine_Model_Observer
674
  array('category_id' => 'MAX(`ccp`.`category_id`)')
675
  )
676
  ->group('e.entity_id');
677
-
678
  Mage::getSingleton('core/resource_iterator')->walk(
679
  $collection->getSelect(),
680
  array(array($this, 'callbackGenerateFeed')),
@@ -722,10 +796,11 @@ class Tritac_ChannelEngine_Model_Observer
722
 
723
  $xml = $this->_getProductXml($parentData, $categoryArray, array('systemAttributes' => $systemAttributes, 'attributes' => $visibleAttributes));
724
 
725
- $_childProducts = Mage::getModel('catalog/product_type_configurable')
726
  ->getUsedProductCollection($_product)
727
- ->addAttributeToSelect($attributesToSelect)
728
- ->getItems();
 
729
 
730
 
731
  foreach($_childProducts as $_child) {
@@ -787,8 +862,8 @@ class Tritac_ChannelEngine_Model_Observer
787
  $xml = '';
788
 
789
  $product['store_id'] = $storeId;
790
- if(!empty($this->_config[$storeId]['feed']['gtin'])) {
791
- $product['gtin'] = $product[$this->_config[$storeId]['feed']['gtin']];
792
  }
793
 
794
  $specialPrice = $product['special_price'];
@@ -865,12 +940,12 @@ class Tritac_ChannelEngine_Model_Observer
865
  }
866
 
867
  // VAT and Shipping Time are pre configured in extension settings
868
- if(!empty($this->_config[$product['store_id']]['feed']['vat_rate'])) {
869
- $vat = $this->_config[$product['store_id']]['feed']['vat_rate'];
870
  $xml .= "<VAT><![CDATA[".$vat."]]></VAT>";
871
  }
872
 
873
- $shippingTime = ($product['qty'] > 0) ? $this->_config[$product['store_id']]['feed']['shipping_time'] : $this->_config[$product['store_id']]['feed']['shipping_time_oos'];
874
 
875
  if($shippingTime) {
876
  $xml .= "<ShippingTime><![CDATA[".$shippingTime."]]></ShippingTime>";
5
 
6
  use ChannelEngine\ApiClient\ApiClient;
7
  use ChannelEngine\ApiClient\Configuration;
8
+ use ChannelEngine\ApiClient\ApiException;
9
 
10
  use ChannelEngine\ApiClient\Api\OrderApi;
11
  use ChannelEngine\ApiClient\Api\ShipmentApi;
20
 
21
  class Tritac_ChannelEngine_Model_Observer
22
  {
23
+ /**
24
+ * To prevent exceeding the maximum number of allowed mySQL joins
25
+ * when not using the flat catalog.
26
+ *
27
+ * @var int
28
+ */
29
+ const ATTRIBUTES_LIMIT = 30;
30
+
31
+ /**
32
+ * The CE logfile path
33
+ *
34
+ * @var string
35
+ */
36
+ const LOGFILE = 'channelengine.log';
37
+
38
  /**
39
  * API client
40
  *
56
  */
57
  protected $_helper = null;
58
 
59
+ /**
60
+ * Whether this merchant uses the postNL extension
61
+ *
62
+ * @var bool
63
+ */
64
  private $_hasPostNL = false;
65
 
66
  /**
89
  }
90
  }
91
 
92
+ private function logApiError($response, $model = null)
93
+ {
94
+ $this->log(
95
+ 'API Call failed ['.$response->getStatusCode().'] ' . $response->getMessage() . PHP_EOL . print_r($model, true),
96
+ Zend_Log::ERR
97
+ );
98
+ }
99
+
100
+ private function log($message, $level = null)
101
+ {
102
+ Mage::log($message . PHP_EOL . '--------------------', $level, $file = self::LOGFILE, true);
103
+ }
104
+
105
+ private function logException($e, $model = null)
106
  {
107
+ if($e instanceof ApiException)
108
+ {
109
+ $message = $e->getMessage() . PHP_EOL .
110
+ print_r($e->getResponseBody(), true) .
111
+ print_r($e->getResponseHeaders(), true) .
112
+ print_r($model, true) .
113
+ $e->getTraceAsString();
114
+ $this->log($message, Zend_Log::ERR);
115
+ return;
116
+ }
117
+
118
+ $this->log($e->__toString(), Zend_Log::ERR);
119
  }
120
 
121
  /**
134
  foreach($this->_client as $storeId => $client)
135
  {
136
  $orderApi = new OrderApi($client);
137
+ $response = null;
138
 
139
+ try
140
+ {
141
+ $response = $orderApi->orderGetNew();
142
+ if(!$response->getSuccess())
143
+ {
144
+ $this->logApiError($response);
145
+ continue;
146
+ }
147
+ }
148
+ catch (Exception $e)
149
  {
150
+ $this->logException($e);
151
  continue;
152
  }
153
 
217
  "An order ({$order->getChannelName()} #{$order->getChannelOrderNo()}) could not be imported",
218
  "Failed add product to order: #{$productNo}. Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
219
  );
220
+ $this->logException($e);
221
+ continue 2;
222
  }
223
  }
224
 
296
  "An order ({$order->getChannelName()} #{$order->getChannelOrderNo()}) could not be imported",
297
  "Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
298
  );
299
+ $this->logException($e);
300
  continue;
301
  }
302
 
304
 
305
  if(!$magentoOrder->getIncrementId())
306
  {
307
+ $this->log("An order (#{$order->getId()}) could not be imported");
308
  continue;
309
  }
310
 
326
  $os = $order->getChannelOrderSupport();
327
  $canShipPartiallyItem = ($os == MerchantOrderResponse::CHANNEL_ORDER_SUPPORT_SPLIT_ORDER_LINES);
328
  $canShipPartially = ($canShipPartiallyItem || $os == MerchantOrderResponse::CHANNEL_ORDER_SUPPORT_SPLIT_ORDERS);
 
329
 
330
  // Initialize new channel order
331
  $_channelOrder = Mage::getModel('channelengine/order');
344
  ->addObject($invoice->getOrder())
345
  ->addObject($_channelOrder);
346
  $transactionSave->save();
347
+ }
348
+ catch (Exception $e)
349
+ {
350
+ Mage::getModel('adminnotification/inbox')->addCritical(
351
+ "An invoice could not be created (order #{$magentoOrder->getIncrementId()}, {$order->getChannelName()} #{$order->getChannelOrderNo()})",
352
+ "Reason: {$e->getMessage()} Please contact ChannelEngine support at <a href='mailto:support@channelengine.com'>support@channelengine.com</a> or +31(0)71-5288792"
353
+ );
354
+
355
+ $this->logException($e);
356
+ continue;
357
+ }
358
 
359
 
360
+ try
361
+ {
362
  // Send order acknowledgement to CE.
363
  $ack = new OrderAcknowledgement();
364
  $ack->setMerchantOrderNo($magentoOrder->getId());
365
  $ack->setOrderId($order->getId());
366
+ $response = $orderApi->orderAcknowledge($ack);
367
 
368
+ if(!$response->getSuccess())
369
+ {
370
+ $this->logApiError($response, $ack);
371
+ continue;
372
+ }
373
  }
374
+ catch(Exception $e)
375
  {
376
+ $this->logException($e);
 
 
 
 
377
  continue;
378
  }
 
 
379
  }
380
  }
381
 
442
  {
443
  $ceShipmentUpdate = new MerchantShipmentTrackingRequest();
444
  $ceShipmentUpdate->setTrackTraceNo($ceShipment->getTrackTraceNo());
445
+ $ceShipmentUpdate->setMethod($ceShipment->getMethod());
446
 
447
  try
448
  {
449
  $response = $shipmentApi->shipmentUpdate($_shipment->getId(), $ceShipmentUpdate);
450
  if(!$response->getSuccess())
451
  {
452
+ $this->logApiError($response, $ceShipmentUpdate);
453
  Mage::getModel('adminnotification/inbox')->addCritical($errorTitle, $errorMessage);
454
  return false;
455
  }
456
  }
457
  catch(Exception $e)
458
  {
459
+ $this->logException($e);
 
460
  return false;
461
  }
462
 
490
  try
491
  {
492
  $response = $shipmentApi->shipmentCreate($ceShipment);
 
493
  if(!$response->getSuccess())
494
  {
495
+ $this->logApiError($response, $ceShipment);
496
  Mage::getModel('adminnotification/inbox')->addCritical($errorTitle, $errorMessage);
497
  return false;
498
  }
499
 
500
+ $_channelShipment = Mage::getModel('channelengine/shipment')->setShipmentId($_shipment->getId());
 
501
  $_channelShipment->save();
 
 
502
  }
503
  catch(Exception $e)
504
  {
505
+ $this->logException($e);
506
+ Mage::getModel('adminnotification/inbox')->addCritical($errorTitle, $errorMessage);
507
  return false;
508
  }
509
 
523
  {
524
  $returnApi = new ReturnApi($client);
525
  $lastUpdatedAt = new DateTime('-1 day');
 
526
 
527
+ $response = null;
528
+
529
+ try
530
+ {
531
+ $response = $returnApi->returnGetDeclaredByChannel($lastUpdatedAt);
532
+ if(!$response->getSuccess())
533
+ {
534
+ $this->logApiError($response);
535
+ continue;
536
+ }
537
+ }
538
+ catch (Exception $e)
539
  {
540
+ $this->logException($e);
541
  continue;
542
  }
543
+
544
  if($response->getCount() == 0) continue;
545
 
546
  foreach($response->getContent() as $return)
621
 
622
  $path = Mage::getBaseDir('media') . DS . 'channelengine' . DS;
623
  $storeConfig = $this->_helper->getConfig($_store->getId());
624
+
625
+ if(!$this->_helper->checkGeneralConfig($_store->getId())) continue;
626
+
627
  $name = $storeConfig['general']['tenant'].'_products.xml';
628
  $file = $path . DS . $name;
629
  $date = date('c');
678
  $attributesToSelect = array(
679
  'sku',
680
  'name',
681
+ 'manufacturer',
682
  'description',
683
  'image',
684
  'url_key',
691
  'msrp'
692
  );
693
 
694
+ if(!empty($this->_config[$storeId]['general']['gtin'])) $attributesToSelect[] = $this->_config[$storeId]['general']['gtin'];
695
  $attributes = Mage::getResourceModel('catalog/product_attribute_collection');
696
 
697
+ $totalAttributes = count($attributesToSelect);
698
+
699
  foreach($attributes as $attribute)
700
  {
701
  $code = $attribute->getAttributeCode();
705
  // Only allow a subset of system attributes
706
  $isSystem = !$attribute->getIsUserDefined();
707
 
708
+ if(!$isFlat && !$isRegular || ($isRegular && $totalAttributes >= self::ATTRIBUTES_LIMIT)) continue;
709
+
710
+ $visibleAttributes[$code]['label'] = $attribute->getFrontendLabel();
711
+ foreach($attribute->getSource()->getAllOptions(false) as $option)
712
+ {
713
+ $visibleAttributes[$code]['values'][$option['value']] = $option['label'];
714
+ }
715
 
716
  if($isSystem)
717
  {
719
  continue;
720
  }
721
 
722
+ if(in_array($code, $attributesToSelect)) continue;
723
+
724
  $attributesToSelect[] = $code;
725
+ $totalAttributes++;
 
 
 
 
 
726
  }
727
 
728
  $collection->addAttributeToSelect($attributesToSelect, 'left')
748
  array('category_id' => 'MAX(`ccp`.`category_id`)')
749
  )
750
  ->group('e.entity_id');
751
+
752
  Mage::getSingleton('core/resource_iterator')->walk(
753
  $collection->getSelect(),
754
  array(array($this, 'callbackGenerateFeed')),
796
 
797
  $xml = $this->_getProductXml($parentData, $categoryArray, array('systemAttributes' => $systemAttributes, 'attributes' => $visibleAttributes));
798
 
799
+ $childProductCollection = Mage::getModel('catalog/product_type_configurable')
800
  ->getUsedProductCollection($_product)
801
+ ->addAttributeToSelect($attributesToSelect);
802
+
803
+ $_childProducts = $childProductCollection->getItems();
804
 
805
 
806
  foreach($_childProducts as $_child) {
862
  $xml = '';
863
 
864
  $product['store_id'] = $storeId;
865
+ if(!empty($this->_config[$storeId]['general']['gtin'])) {
866
+ $product['gtin'] = $product[$this->_config[$storeId]['general']['gtin']];
867
  }
868
 
869
  $specialPrice = $product['special_price'];
940
  }
941
 
942
  // VAT and Shipping Time are pre configured in extension settings
943
+ if(!empty($this->_config[$product['store_id']]['optional']['vat_rate'])) {
944
+ $vat = $this->_config[$product['store_id']]['optional']['vat_rate'];
945
  $xml .= "<VAT><![CDATA[".$vat."]]></VAT>";
946
  }
947
 
948
+ $shippingTime = ($product['qty'] > 0) ? $this->_config[$product['store_id']]['optional']['shipping_time'] : $this->_config[$product['store_id']]['optional']['shipping_time_oos'];
949
 
950
  if($shippingTime) {
951
  $xml .= "<ShippingTime><![CDATA[".$shippingTime."]]></ShippingTime>";
app/code/community/Tritac/ChannelEngine/controllers/Adminhtml/GenerateController.php CHANGED
@@ -1,27 +1,66 @@
1
  <?php
2
  class Tritac_ChannelEngine_Adminhtml_GenerateController extends Mage_Adminhtml_Controller_Action
3
  {
4
- public function ajaxAction()
5
  {
6
  $observer = Mage::getModel('channelengine/observer');
7
- $res = $this->getResponse();
8
- $res->setHeader('Content-type', 'application/json');
9
- if($observer->generateFeed()) $res->setBody(1);
 
 
 
10
  }
11
 
12
- public function importOrdersAction()
13
  {
14
  $observer = Mage::getModel('channelengine/observer');
15
- $res = $this->getResponse();
16
- $res->setHeader('Content-type', 'application/json');
17
- if($observer->fetchNewOrders()) $res->setBody(1);
 
 
 
18
  }
19
 
20
- public function importReturnsAction()
21
  {
22
  $observer = Mage::getModel('channelengine/observer');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  $res = $this->getResponse();
24
  $res->setHeader('Content-type', 'application/json');
25
- if($observer->fetchReturns()) $res->setBody(1);
 
 
 
26
  }
27
  }
1
  <?php
2
  class Tritac_ChannelEngine_Adminhtml_GenerateController extends Mage_Adminhtml_Controller_Action
3
  {
4
+ public function feedAction()
5
  {
6
  $observer = Mage::getModel('channelengine/observer');
7
+ $result = $observer->generateFeed();
8
+ if($result) {
9
+ $this->returnStatus(false, $result);
10
+ } else {
11
+ $this->returnStatus(true, $result);
12
+ }
13
  }
14
 
15
+ public function ordersAction()
16
  {
17
  $observer = Mage::getModel('channelengine/observer');
18
+ $result = $observer->fetchNewOrders();
19
+ if($result) {
20
+ $this->returnStatus(false, $result);
21
+ } else {
22
+ $this->returnStatus(true, $result);
23
+ }
24
  }
25
 
26
+ public function returnsAction()
27
  {
28
  $observer = Mage::getModel('channelengine/observer');
29
+ $result = $observer->fetchReturns();
30
+ if($result) {
31
+ $this->returnStatus(false, $result);
32
+ } else {
33
+ $this->returnStatus(true, $result);
34
+ }
35
+ }
36
+
37
+ public function logAction()
38
+ {
39
+ $logFile = Mage::getBaseDir('log') . '/' . 'channelengine.log';
40
+ if (!is_file($logFile) || !is_readable($logFile)) return;
41
+
42
+ $this->getResponse()
43
+ ->setHttpResponseCode(200)
44
+ ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
45
+ ->setHeader('Pragma', 'public', true)
46
+ ->setHeader('Content-type', 'application/force-download')
47
+ ->setHeader('Content-Length', filesize($logFile))
48
+ ->setHeader('Content-Disposition', 'attachment' . '; filename=' . basename($logFile));
49
+
50
+ $this->getResponse ()->clearBody();
51
+ $this->getResponse ()->sendHeaders();
52
+ readfile($logFile);
53
+
54
+ exit;
55
+ }
56
+
57
+ private function returnStatus($error, $message)
58
+ {
59
  $res = $this->getResponse();
60
  $res->setHeader('Content-type', 'application/json');
61
+
62
+ $body = json_encode(array('error' => $error, 'message' => $message));
63
+
64
+ $res->setBody($body);
65
  }
66
  }
app/code/community/Tritac/ChannelEngine/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Tritac_ChannelEngine>
5
- <version>4.4.1</version>
6
  </Tritac_ChannelEngine>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Tritac_ChannelEngine>
5
+ <version>4.6.0</version>
6
  </Tritac_ChannelEngine>
7
  </modules>
8
 
app/code/community/Tritac/ChannelEngine/etc/system.xml CHANGED
@@ -16,14 +16,18 @@
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <sort_order>1000</sort_order>
 
19
  <groups>
20
  <general translate="label">
21
  <label>General</label>
22
  <frontend_type>text</frontend_type>
23
- <show_in_default>0</show_in_default>
24
- <show_in_website>0</show_in_website>
25
  <show_in_store>1</show_in_store>
26
  <sort_order>1</sort_order>
 
 
 
27
  <fields>
28
  <api_key translate="label">
29
  <label>Api Key</label>
@@ -44,36 +48,39 @@
44
  <show_in_website>0</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  </tenant>
47
- </fields>
48
- </general>
49
- <shipping translate="label">
50
- <label>Shipping</label>
51
- <frontend_type>text</frontend_type>
52
- <show_in_default>1</show_in_default>
53
- <show_in_website>1</show_in_website>
54
- <show_in_store>1</show_in_store>
55
- <sort_order>2</sort_order>
56
- <fields>
57
- <expected_date translate="label">
58
- <label>Expected Shipping Period (For backorders)</label>
59
- <frontend_type>text</frontend_type>
60
  <comment>
61
- <![CDATA[<span class="notice">Please set the number of working days. Applies to order items with status "In Backorder"</span>]]>
62
  </comment>
63
- <sort_order>2</sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
64
  <show_in_default>1</show_in_default>
65
  <show_in_website>1</show_in_website>
66
  <show_in_store>1</show_in_store>
67
- </expected_date>
68
  </fields>
69
- </shipping>
70
- <feed translate="label">
71
- <label>Product Feed</label>
72
  <frontend_type>text</frontend_type>
73
  <show_in_default>1</show_in_default>
74
  <show_in_website>1</show_in_website>
75
  <show_in_store>1</show_in_store>
76
- <sort_order>3</sort_order>
77
  <fields>
78
  <vat_rate translate="label">
79
  <label>Default Vat Rate (%)</label>
@@ -105,33 +112,91 @@
105
  <show_in_website>1</show_in_website>
106
  <show_in_store>1</show_in_store>
107
  </shipping_time_oos>
108
- <gtin translate="label">
109
- <label>Product GTIN</label>
110
- <frontend_type>select</frontend_type>
111
- <source_model>channelengine/system_config_source_gtin</source_model>
112
  <comment>
113
- <![CDATA[<span class="notice">The attribute that contains the product GTIN (i.e. EAN, ISBN, UPC)</span>]]>
114
  </comment>
115
- <sort_order>4</sort_order>
116
  <show_in_default>1</show_in_default>
117
  <show_in_website>1</show_in_website>
118
  <show_in_store>1</show_in_store>
119
- </gtin>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  <generate_product_feed translate="button_label">
121
  <label>Generate product feed</label>
122
  <button_label>Generate Product Feed</button_label>
123
  <comment>
124
  <![CDATA[<span class="notice">You need to configure cronjobs on your server to generate feeds automatically</span>]]>
125
  </comment>
 
126
  <frontend_type>button</frontend_type>
127
- <frontend_model>channelengine/adminhtml_system_config_feed</frontend_model>
128
  <sort_order>5</sort_order>
129
  <show_in_default>1</show_in_default>
130
  <show_in_website>1</show_in_website>
131
  <show_in_store>1</show_in_store>
132
  </generate_product_feed>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  </fields>
134
- </feed>
135
  </groups>
136
  </channelengine>
137
  </sections>
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <sort_order>1000</sort_order>
19
+
20
  <groups>
21
  <general translate="label">
22
  <label>General</label>
23
  <frontend_type>text</frontend_type>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
  <show_in_store>1</show_in_store>
27
  <sort_order>1</sort_order>
28
+ <comment>
29
+ <![CDATA[Please set the your ChannelEngine account details per individual store view.]]>
30
+ </comment>
31
  <fields>
32
  <api_key translate="label">
33
  <label>Api Key</label>
48
  <show_in_website>0</show_in_website>
49
  <show_in_store>1</show_in_store>
50
  </tenant>
51
+ <feed_url translate="label">
52
+ <label>Feed URL</label>
53
+ <frontend_type>label</frontend_type>
54
+ <frontend_model>channelengine/adminhtml_system_config_form_feed</frontend_model>
 
 
 
 
 
 
 
 
 
55
  <comment>
56
+ <![CDATA[<span class="notice">This is the feed that can be imported into ChannelEngine</span>]]>
57
  </comment>
58
+ <sort_order>4</sort_order>
59
+ <show_in_default>0</show_in_default>
60
+ <show_in_website>0</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </feed_url>
63
+ <gtin translate="label">
64
+ <label>Product GTIN</label>
65
+ <frontend_type>select</frontend_type>
66
+ <source_model>channelengine/system_config_source_gtin</source_model>
67
+ <comment>
68
+ <![CDATA[<span class="notice">The attribute that contains the product GTIN (i.e. EAN, ISBN, UPC)</span>]]>
69
+ </comment>
70
+ <sort_order>5</sort_order>
71
  <show_in_default>1</show_in_default>
72
  <show_in_website>1</show_in_website>
73
  <show_in_store>1</show_in_store>
74
+ </gtin>
75
  </fields>
76
+ </general>
77
+ <optional translate="label">
78
+ <label>Optional settings</label>
79
  <frontend_type>text</frontend_type>
80
  <show_in_default>1</show_in_default>
81
  <show_in_website>1</show_in_website>
82
  <show_in_store>1</show_in_store>
83
+ <sort_order>2</sort_order>
84
  <fields>
85
  <vat_rate translate="label">
86
  <label>Default Vat Rate (%)</label>
112
  <show_in_website>1</show_in_website>
113
  <show_in_store>1</show_in_store>
114
  </shipping_time_oos>
115
+ <expected_date translate="label">
116
+ <label>Expected Shipping Period (For backorders)</label>
117
+ <frontend_type>text</frontend_type>
 
118
  <comment>
119
+ <![CDATA[<span class="notice">Please set the number of working days. Applies to order items with status "In Backorder"</span>]]>
120
  </comment>
121
+ <sort_order>5</sort_order>
122
  <show_in_default>1</show_in_default>
123
  <show_in_website>1</show_in_website>
124
  <show_in_store>1</show_in_store>
125
+ </expected_date>
126
+ </fields>
127
+ </optional>
128
+ <diagnostics>
129
+ <label>Diagnostics</label>
130
+ <frontend_type>text</frontend_type>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ <sort_order>3</sort_order>
135
+ <fields>
136
+ <log>
137
+ <label>Download Log</label>
138
+ <link_action>log</link_action>
139
+ <link_label>Download</link_label>
140
+ <frontend_type>label</frontend_type>
141
+ <frontend_model>channelengine/adminhtml_system_config_form_link</frontend_model>
142
+ <sort_order>5</sort_order>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>1</show_in_store>
146
+ </log>
147
+ <version>
148
+ <label>Version</label>
149
+ <frontend_type>note</frontend_type>
150
+ <frontend_model>channelengine/adminhtml_system_config_form_version</frontend_model>
151
+ <sort_order>5</sort_order>
152
+ <show_in_default>1</show_in_default>
153
+ <show_in_website>1</show_in_website>
154
+ <show_in_store>1</show_in_store>
155
+ </version>
156
  <generate_product_feed translate="button_label">
157
  <label>Generate product feed</label>
158
  <button_label>Generate Product Feed</button_label>
159
  <comment>
160
  <![CDATA[<span class="notice">You need to configure cronjobs on your server to generate feeds automatically</span>]]>
161
  </comment>
162
+ <ajax_action>feed</ajax_action>
163
  <frontend_type>button</frontend_type>
164
+ <frontend_model>channelengine/adminhtml_system_config_form_button</frontend_model>
165
  <sort_order>5</sort_order>
166
  <show_in_default>1</show_in_default>
167
  <show_in_website>1</show_in_website>
168
  <show_in_store>1</show_in_store>
169
  </generate_product_feed>
170
+ <import_orders translate="button_label">
171
+ <label>Import orders</label>
172
+ <button_label>Manually import orders</button_label>
173
+ <comment>
174
+ <![CDATA[<span class="notice">You need to configure cronjobs on your server to import orders automatically</span>]]>
175
+ </comment>
176
+ <ajax_action>orders</ajax_action>
177
+ <frontend_type>button</frontend_type>
178
+ <frontend_model>channelengine/adminhtml_system_config_form_button</frontend_model>
179
+ <sort_order>5</sort_order>
180
+ <show_in_default>1</show_in_default>
181
+ <show_in_website>1</show_in_website>
182
+ <show_in_store>1</show_in_store>
183
+ </import_orders>
184
+ <import_returns translate="button_label">
185
+ <label>Import returns</label>
186
+ <button_label>Manually import returns</button_label>
187
+ <comment>
188
+ <![CDATA[<span class="notice">You need to configure cronjobs on your server to import returns automatically</span>]]>
189
+ </comment>
190
+ <ajax_action>returns</ajax_action>
191
+ <frontend_type>button</frontend_type>
192
+ <frontend_model>channelengine/adminhtml_system_config_form_button</frontend_model>
193
+ <sort_order>5</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>1</show_in_store>
197
+ </import_returns>
198
  </fields>
199
+ </diagnostics>
200
  </groups>
201
  </channelengine>
202
  </sections>
app/design/adminhtml/default/default/template/channelengine/system/config/{feed/generate_button.phtml → form/ajax_button.phtml} RENAMED
@@ -5,35 +5,32 @@
5
  ?>
6
  <script type="text/javascript">
7
  //<![CDATA[
8
- function generateFeed() {
9
  var elem = $('<?php echo $this->getId() ?>');
10
-
 
11
  new Ajax.Request('<?php echo $this->getAjaxUrl() ?>', {
12
  onSuccess: function(response) {
13
- result = "<?php echo $this->__("Couldn't generate feed. See magento log.") ?>";
14
  try {
15
- response = response.responseText;
16
- if (response == 1) {
17
- result = '<?php echo $this->__("Product Feed was generated successfully") ?>';
18
  elem.removeClassName('fail').addClassName('success')
19
- } else if(response == 'redirect') {
20
- result = "<?php echo $this->__("Too many visible attributes.") ?>";
21
- window.location.reload();
22
  } else {
23
  elem.removeClassName('success').addClassName('fail')
24
  }
 
25
  } catch (e) {
26
  elem.removeClassName('success').addClassName('fail')
27
  }
28
- $('#generate_result').update(result);
29
  },
30
  onFailure: function(response) {
31
- result = "<?php echo $this->__("Couldn't generate feed. See magento log.") ?>";
32
  elem.removeClassName('success').addClassName('fail');
 
33
  }
34
  });
35
  }
36
  //]]>
37
  </script>
38
  <?php echo $this->getButtonHtml(); ?>
39
- <span id="generate_result"><?php echo $this->escapeHtml($this->getLabel()) ?></span>
5
  ?>
6
  <script type="text/javascript">
7
  //<![CDATA[
8
+ function makeRequest<?php echo $this->getId() ?>() {
9
  var elem = $('<?php echo $this->getId() ?>');
10
+ var resultElem = $('<?php echo 'ce_res_'. $this->getId() ?>')
11
+ var result = "<?php echo $this->__("Failed to run manual task. See magento log.") ?>";
12
  new Ajax.Request('<?php echo $this->getAjaxUrl() ?>', {
13
  onSuccess: function(response) {
 
14
  try {
15
+ response = response.responseText.evalJSON(true);
16
+ if (!response.error) {
 
17
  elem.removeClassName('fail').addClassName('success')
 
 
 
18
  } else {
19
  elem.removeClassName('success').addClassName('fail')
20
  }
21
+ result = response.message;
22
  } catch (e) {
23
  elem.removeClassName('success').addClassName('fail')
24
  }
25
+ resultElem.update(result);
26
  },
27
  onFailure: function(response) {
 
28
  elem.removeClassName('success').addClassName('fail');
29
+ resultElem.update(result);
30
  }
31
  });
32
  }
33
  //]]>
34
  </script>
35
  <?php echo $this->getButtonHtml(); ?>
36
+ <span id="ce_res<?php echo $this->getId() ?>"><?php echo $this->escapeHtml($this->getLabel()) ?></span>
lib/ChannelEngine/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- *
2
- !.gitignore
 
 
lib/ChannelEngine/composer.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ {
2
+ "require": {
3
+ "channelengine/api-client": "dev-master"
4
+ }
5
+ }
lib/ChannelEngine/composer.lock ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "37e634d92ddf2c628f9d962c5f848841",
8
+ "packages": [
9
+ {
10
+ "name": "channelengine/api-client",
11
+ "version": "dev-master",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/channelengine/api-client-php.git",
15
+ "reference": "063843e3c7576a507f7de661bb105ac2a9e57767"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/channelengine/api-client-php/zipball/063843e3c7576a507f7de661bb105ac2a9e57767",
20
+ "reference": "063843e3c7576a507f7de661bb105ac2a9e57767",
21
+ "shasum": ""
22
+ },
23
+ "require": {
24
+ "ext-curl": "*",
25
+ "ext-json": "*",
26
+ "ext-mbstring": "*",
27
+ "php": ">=5.4"
28
+ },
29
+ "require-dev": {
30
+ "friendsofphp/php-cs-fixer": "~1.12",
31
+ "phpunit/phpunit": "~4.8",
32
+ "satooshi/php-coveralls": "~1.0",
33
+ "squizlabs/php_codesniffer": "~2.6"
34
+ },
35
+ "type": "library",
36
+ "autoload": {
37
+ "psr-4": {
38
+ "ChannelEngine\\ApiClient\\": "lib/"
39
+ }
40
+ },
41
+ "notification-url": "https://packagist.org/downloads/",
42
+ "license": [
43
+ "proprietary"
44
+ ],
45
+ "authors": [
46
+ {
47
+ "name": "Swagger and contributors",
48
+ "homepage": "https://github.com/swagger-api/swagger-codegen"
49
+ }
50
+ ],
51
+ "homepage": "http://swagger.io",
52
+ "keywords": [
53
+ "api",
54
+ "php",
55
+ "sdk",
56
+ "swagger"
57
+ ],
58
+ "time": "2017-04-12 09:44:32"
59
+ }
60
+ ],
61
+ "packages-dev": [],
62
+ "aliases": [],
63
+ "minimum-stability": "stable",
64
+ "stability-flags": {
65
+ "channelengine/api-client": 20
66
+ },
67
+ "prefer-stable": false,
68
+ "prefer-lowest": false,
69
+ "platform": [],
70
+ "platform-dev": []
71
+ }
lib/ChannelEngine/vendor/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit117267288e7b25b85c8b9c4bc7264ba6::getLoader();
lib/ChannelEngine/vendor/channelengine/api-client/.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ composer.phar
2
+ vendor/
3
+ *.sublime-workspace
4
+ *.log
lib/ChannelEngine/vendor/channelengine/api-client/.php_cs ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return Symfony\CS\Config::create()
4
+ ->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
5
+ ->setUsingCache(true)
6
+ ->fixers(
7
+ [
8
+ 'ordered_use',
9
+ 'phpdoc_order',
10
+ 'short_array_syntax',
11
+ 'strict',
12
+ 'strict_param'
13
+ ]
14
+ )
15
+ ->finder(
16
+ Symfony\CS\Finder\DefaultFinder::create()
17
+ ->in(__DIR__)
18
+ );
lib/ChannelEngine/vendor/channelengine/api-client/.travis.yml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+ sudo: false
3
+ php:
4
+ - 5.4
5
+ - 5.5
6
+ - 5.6
7
+ - 7.0
8
+ - hhvm
9
+ before_install: "composer install"
10
+ script: "vendor/bin/phpunit"
lib/ChannelEngine/vendor/channelengine/api-client/README.md ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ChannelEngine
2
+ No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
3
+
4
+ This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
5
+
6
+ - API version: v2
7
+ - Package version: 2.1.0
8
+ - Build package: io.swagger.codegen.languages.PhpClientCodegen
9
+
10
+ ## Requirements
11
+
12
+ PHP 5.4.0 and later
13
+
14
+ ## Installation & Usage
15
+ ### Composer
16
+
17
+ To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`:
18
+
19
+ ```
20
+ {
21
+ "repositories": [
22
+ {
23
+ "type": "git",
24
+ "url": "https://github.com/channelengine/api-client.git"
25
+ }
26
+ ],
27
+ "require": {
28
+ "channelengine/api-client": "*@dev"
29
+ }
30
+ }
31
+ ```
32
+
33
+ Then run `composer install`
34
+
35
+ ### Manual Installation
36
+
37
+ Download the files and include `autoload.php`:
38
+
39
+ ```php
40
+ require_once('/path/to/ChannelEngine/autoload.php');
41
+ ```
42
+
43
+ ## Tests
44
+
45
+ To run the unit tests:
46
+
47
+ ```
48
+ composer install
49
+ ./vendor/bin/phpunit
50
+ ```
51
+
52
+ ## Getting Started
53
+
54
+ Please follow the [installation procedure](#installation--usage) and then run the following:
55
+
56
+ ```php
57
+ <?php
58
+ require_once(__DIR__ . '/vendor/autoload.php');
59
+
60
+ // Configure API key authorization: apikey
61
+ ChannelEngine\ApiClient\Configuration::getDefaultConfiguration()->setApiKey('apikey', 'YOUR_API_KEY');
62
+ // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
63
+ // ChannelEngine\ApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apikey', 'Bearer');
64
+
65
+ $api_instance = new ChannelEngine\ApiClient\Api\BackOrderApi();
66
+ $backOrder = new \ChannelEngine\ApiClient\Model\BackOrder(); // \ChannelEngine\ApiClient\Model\BackOrder | The Backorder to create
67
+
68
+ try {
69
+ $result = $api_instance->backOrderCreate($backOrder);
70
+ print_r($result);
71
+ } catch (Exception $e) {
72
+ echo 'Exception when calling BackOrderApi->backOrderCreate: ', $e->getMessage(), PHP_EOL;
73
+ }
74
+
75
+ ?>
76
+ ```
77
+
78
+ ## Documentation for API Endpoints
79
+
80
+ All URIs are relative to *http://dev.channelengine.local/api*
81
+
82
+ Class | Method | HTTP request | Description
83
+ ------------ | ------------- | ------------- | -------------
84
+ *BackOrderApi* | [**backOrderCreate**](docs/Api/BackOrderApi.md#backordercreate) | **POST** /v2/backorders | Merchant: Create Backorder
85
+ *BackOrderApi* | [**backOrderGet**](docs/Api/BackOrderApi.md#backorderget) | **GET** /v2/backorders/{merchantBackorderNo} | Merchant: Get Backorder
86
+ *BackOrderApi* | [**backOrderIndex**](docs/Api/BackOrderApi.md#backorderindex) | **GET** /v2/backorders | Get Backorders
87
+ *CancellationApi* | [**cancellationCreate**](docs/Api/CancellationApi.md#cancellationcreate) | **POST** /v2/cancellations | Merchant: Create Cancellation
88
+ *CancellationApi* | [**cancellationIndex**](docs/Api/CancellationApi.md#cancellationindex) | **GET** /v2/cancellations | Channel: Get Cancellations
89
+ *ClientApi* | [**clientGet**](docs/Api/ClientApi.md#clientget) | **GET** /v2/clients/{language} | Get API Client
90
+ *OrderApi* | [**orderAcknowledge**](docs/Api/OrderApi.md#orderacknowledge) | **POST** /v2/orders/acknowledge | Merchant: Acknowledge Order
91
+ *OrderApi* | [**orderCreate**](docs/Api/OrderApi.md#ordercreate) | **POST** /v2/orders | Channel: Create Order
92
+ *OrderApi* | [**orderGetNew**](docs/Api/OrderApi.md#ordergetnew) | **GET** /v2/orders/new | Merchant: Get New Orders
93
+ *OrderApi* | [**orderInvoice**](docs/Api/OrderApi.md#orderinvoice) | **GET** /v2/orders/{merchantOrderNo}/invoice | Merchant: Download Invoice
94
+ *OrderApi* | [**orderPackingSlip**](docs/Api/OrderApi.md#orderpackingslip) | **GET** /v2/orders/{merchantOrderNo}/packingslip | Merchant: Download Packing Slip
95
+ *ProductApi* | [**productAcknowledgeDataChanges**](docs/Api/ProductApi.md#productacknowledgedatachanges) | **POST** /v2/products/data | Channel: Acknowledge Product Data Changes
96
+ *ProductApi* | [**productAcknowledgeOfferChanges**](docs/Api/ProductApi.md#productacknowledgeofferchanges) | **POST** /v2/products/offers | Channel: Acknowledge Product Offer Changes
97
+ *ProductApi* | [**productCreate**](docs/Api/ProductApi.md#productcreate) | **POST** /v2/products | Merchant: Create Product
98
+ *ProductApi* | [**productDelete**](docs/Api/ProductApi.md#productdelete) | **DELETE** /v2/products/{merchantProductNo} | Merchant: Delete Product
99
+ *ProductApi* | [**productGetByMerchantProductNo**](docs/Api/ProductApi.md#productgetbymerchantproductno) | **GET** /v2/products/merchant/{merchantProductNo} | Merchant: Get Product
100
+ *ProductApi* | [**productGetDataChanges**](docs/Api/ProductApi.md#productgetdatachanges) | **GET** /v2/products/data | Channel: Get Product Data Changes
101
+ *ProductApi* | [**productGetOfferChanges**](docs/Api/ProductApi.md#productgetofferchanges) | **GET** /v2/products/offers | Channel: Get Product Offer Changes
102
+ *ReturnApi* | [**returnDeclareForChannel**](docs/Api/ReturnApi.md#returndeclareforchannel) | **POST** /v2/returns/channel | Channel: Create Return
103
+ *ReturnApi* | [**returnDeclareForMerchant**](docs/Api/ReturnApi.md#returndeclareformerchant) | **POST** /v2/returns/merchant | Merchant: Create Return
104
+ *ReturnApi* | [**returnGetDeclaredByChannel**](docs/Api/ReturnApi.md#returngetdeclaredbychannel) | **GET** /v2/returns/merchant | Merchant: Get Returns
105
+ *ReturnApi* | [**returnGetDeclaredByMerchant**](docs/Api/ReturnApi.md#returngetdeclaredbymerchant) | **GET** /v2/returns/channel | Channel: Get Returns
106
+ *ShipmentApi* | [**shipmentCreate**](docs/Api/ShipmentApi.md#shipmentcreate) | **POST** /v2/shipments | Merchant: Create Shipment
107
+ *ShipmentApi* | [**shipmentIndex**](docs/Api/ShipmentApi.md#shipmentindex) | **GET** /v2/shipments | Channel: Get Shipments
108
+ *ShipmentApi* | [**shipmentUpdate**](docs/Api/ShipmentApi.md#shipmentupdate) | **PUT** /v2/shipments/{merchantShipmentNo} | Merchant: Update Shipment
109
+
110
+
111
+ ## Documentation For Models
112
+
113
+ - [ApiResponse](docs/Model/ApiResponse.md)
114
+ - [BackOrder](docs/Model/BackOrder.md)
115
+ - [BackOrderLine](docs/Model/BackOrderLine.md)
116
+ - [ChannelCancellationLineResponse](docs/Model/ChannelCancellationLineResponse.md)
117
+ - [ChannelCancellationResponse](docs/Model/ChannelCancellationResponse.md)
118
+ - [ChannelOfferResponse](docs/Model/ChannelOfferResponse.md)
119
+ - [ChannelOrderLineRequest](docs/Model/ChannelOrderLineRequest.md)
120
+ - [ChannelOrderRequest](docs/Model/ChannelOrderRequest.md)
121
+ - [ChannelProcessedChangesRequest](docs/Model/ChannelProcessedChangesRequest.md)
122
+ - [ChannelProductChangesResponse](docs/Model/ChannelProductChangesResponse.md)
123
+ - [ChannelProductResponse](docs/Model/ChannelProductResponse.md)
124
+ - [ChannelReferencesRequest](docs/Model/ChannelReferencesRequest.md)
125
+ - [ChannelReturnLineRequest](docs/Model/ChannelReturnLineRequest.md)
126
+ - [ChannelReturnLineResponse](docs/Model/ChannelReturnLineResponse.md)
127
+ - [ChannelReturnRequest](docs/Model/ChannelReturnRequest.md)
128
+ - [ChannelReturnResponse](docs/Model/ChannelReturnResponse.md)
129
+ - [ChannelShipmentLineResponse](docs/Model/ChannelShipmentLineResponse.md)
130
+ - [ChannelShipmentResponse](docs/Model/ChannelShipmentResponse.md)
131
+ - [CollectionOfBackOrder](docs/Model/CollectionOfBackOrder.md)
132
+ - [CollectionOfChannelCancellationResponse](docs/Model/CollectionOfChannelCancellationResponse.md)
133
+ - [CollectionOfChannelOfferResponse](docs/Model/CollectionOfChannelOfferResponse.md)
134
+ - [CollectionOfChannelReturnResponse](docs/Model/CollectionOfChannelReturnResponse.md)
135
+ - [CollectionOfChannelShipmentResponse](docs/Model/CollectionOfChannelShipmentResponse.md)
136
+ - [CollectionOfMerchantOrderResponse](docs/Model/CollectionOfMerchantOrderResponse.md)
137
+ - [CollectionOfMerchantReturnResponse](docs/Model/CollectionOfMerchantReturnResponse.md)
138
+ - [EntitiesAddressModels](docs/Model/EntitiesAddressModels.md)
139
+ - [ExtraDataItem](docs/Model/ExtraDataItem.md)
140
+ - [MerchantCancellationLineRequest](docs/Model/MerchantCancellationLineRequest.md)
141
+ - [MerchantCancellationRequest](docs/Model/MerchantCancellationRequest.md)
142
+ - [MerchantOrderLineResponse](docs/Model/MerchantOrderLineResponse.md)
143
+ - [MerchantOrderResponse](docs/Model/MerchantOrderResponse.md)
144
+ - [MerchantProductRequest](docs/Model/MerchantProductRequest.md)
145
+ - [MerchantProductResponse](docs/Model/MerchantProductResponse.md)
146
+ - [MerchantReturnLineRequest](docs/Model/MerchantReturnLineRequest.md)
147
+ - [MerchantReturnLineResponse](docs/Model/MerchantReturnLineResponse.md)
148
+ - [MerchantReturnRequest](docs/Model/MerchantReturnRequest.md)
149
+ - [MerchantReturnResponse](docs/Model/MerchantReturnResponse.md)
150
+ - [MerchantShipmentLineRequest](docs/Model/MerchantShipmentLineRequest.md)
151
+ - [MerchantShipmentRequest](docs/Model/MerchantShipmentRequest.md)
152
+ - [MerchantShipmentTrackingRequest](docs/Model/MerchantShipmentTrackingRequest.md)
153
+ - [OrderAcknowledgement](docs/Model/OrderAcknowledgement.md)
154
+ - [ProductCreationResult](docs/Model/ProductCreationResult.md)
155
+ - [ProductMessage](docs/Model/ProductMessage.md)
156
+ - [SingleOfBackOrder](docs/Model/SingleOfBackOrder.md)
157
+ - [SingleOfChannelProductChangesResponse](docs/Model/SingleOfChannelProductChangesResponse.md)
158
+ - [SingleOfMerchantProductResponse](docs/Model/SingleOfMerchantProductResponse.md)
159
+ - [SingleOfProductCreationResult](docs/Model/SingleOfProductCreationResult.md)
160
+
161
+
162
+ ## Documentation For Authorization
163
+
164
+
165
+ ## apikey
166
+
167
+ - **Type**: API key
168
+ - **API key parameter name**: apikey
169
+ - **Location**: URL query string
170
+
171
+
172
+ ## Author
173
+
174
+
175
+
176
+
lib/ChannelEngine/vendor/channelengine/api-client/api-client.sublime-project ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "folders":
3
+ [
4
+ {
5
+ "follow_symlinks": true,
6
+ "path": "."
7
+ }
8
+ ]
9
+ }
lib/ChannelEngine/vendor/channelengine/api-client/autoload.php ADDED
@@ -0,0 +1,54 @@