d7db67d0d012350a01ce05c31f91754d - Version 2.12.1

Version Notes

* Pequenas Correções.

Para mais informações acesse:
https://github.com/AnyMarket/magento

Download this release

Release Info

Developer Anymarket
Extension d7db67d0d012350a01ce05c31f91754d
Version 2.12.1
Comparing to
See all releases


Code changes from version 2.10.1 to 2.12.1

Files changed (173) hide show
  1. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes.php +0 -0
  2. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit.php +0 -0
  3. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Form.php +0 -0
  4. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Form.php +0 -0
  5. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Stores.php +0 -0
  6. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tabs.php +0 -0
  7. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Grid.php +0 -0
  8. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands.php +0 -0
  9. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit.php +0 -0
  10. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Form.php +0 -0
  11. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tab/Form.php +0 -0
  12. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tab/Stores.php +0 -0
  13. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tabs.php +0 -0
  14. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Grid.php +0 -0
  15. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories.php +0 -0
  16. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit.php +0 -0
  17. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Form.php +0 -0
  18. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Form.php +0 -0
  19. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Stores.php +0 -0
  20. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tabs.php +0 -0
  21. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Grid.php +0 -0
  22. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog.php +0 -0
  23. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit.php +0 -0
  24. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Form.php +0 -0
  25. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Form.php +0 -0
  26. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Stores.php +0 -0
  27. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tabs.php +0 -0
  28. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Grid.php +0 -0
  29. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders.php +0 -0
  30. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit.php +0 -0
  31. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Form.php +0 -0
  32. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Form.php +0 -0
  33. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Stores.php +0 -0
  34. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tabs.php +0 -0
  35. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Grid.php +0 -0
  36. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts.php +0 -0
  37. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit.php +0 -0
  38. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Form.php +0 -0
  39. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Form.php +0 -0
  40. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Stores.php +0 -0
  41. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tabs.php +0 -0
  42. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Grid.php +0 -0
  43. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue.php +0 -0
  44. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit.php +0 -0
  45. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Form.php +0 -0
  46. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Form.php +0 -0
  47. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Stores.php +0 -0
  48. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tabs.php +0 -0
  49. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Grid.php +0 -0
  50. app/code/community/DB1/AnyMarket/Block/Adminhtml/System/Config/Form/Buttoncheckconfig.php +0 -0
  51. app/code/community/DB1/AnyMarket/Block/Adminhtml/System/Config/Form/Callback.php +0 -0
  52. app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusammg/Values.php +0 -0
  53. app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusmgam/Values.php +0 -0
  54. app/code/community/DB1/AnyMarket/Block/System/Config/Source/Products/Values.php +0 -0
  55. app/code/community/DB1/AnyMarket/Controller/Adminhtml/AnyMarket.php +0 -0
  56. app/code/community/DB1/AnyMarket/Helper/Brand.php +0 -0
  57. app/code/community/DB1/AnyMarket/Helper/Category.php +0 -0
  58. app/code/community/DB1/AnyMarket/Helper/Customergenerator.php +0 -0
  59. app/code/community/DB1/AnyMarket/Helper/Data.php +12 -3
  60. app/code/community/DB1/AnyMarket/Helper/Image.php +215 -152
  61. app/code/community/DB1/AnyMarket/Helper/Order.php +638 -509
  62. app/code/community/DB1/AnyMarket/Helper/Ordergenerator.php +2 -2
  63. app/code/community/DB1/AnyMarket/Helper/Product.php +84 -50
  64. app/code/community/DB1/AnyMarket/Helper/Productgenerator.php +64 -17
  65. app/code/community/DB1/AnyMarket/Helper/Queue.php +52 -19
  66. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketattributes.php +0 -0
  67. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketbrands.php +0 -0
  68. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketimage.php +60 -0
  69. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketlog.php +0 -0
  70. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketorders.php +0 -0
  71. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketproducts.php +0 -0
  72. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketqueue.php +0 -0
  73. app/code/community/DB1/AnyMarket/Model/Anymarketattributes.php +0 -0
  74. app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api.php +0 -0
  75. app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api/V2.php +0 -0
  76. app/code/community/DB1/AnyMarket/Model/Anymarketbrands.php +0 -0
  77. app/code/community/DB1/AnyMarket/Model/Anymarketbrands/Api.php +0 -0
  78. app/code/community/DB1/AnyMarket/Model/Anymarketbrands/Api/V2.php +0 -0
  79. app/code/community/DB1/AnyMarket/Model/Anymarketcategories.php +0 -0
  80. app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api.php +0 -0
  81. app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api/V2.php +0 -0
  82. app/code/community/DB1/AnyMarket/Model/Anymarketimage.php +84 -0
  83. app/code/community/DB1/AnyMarket/Model/Anymarketlog.php +4 -0
  84. app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api.php +0 -0
  85. app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api/V2.php +0 -0
  86. app/code/community/DB1/AnyMarket/Model/Anymarketorders.php +0 -0
  87. app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api.php +8 -1
  88. app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api/V2.php +0 -0
  89. app/code/community/DB1/AnyMarket/Model/Anymarketproducts.php +0 -0
  90. app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api.php +32 -18
  91. app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api/V2.php +0 -0
  92. app/code/community/DB1/AnyMarket/Model/Anymarketqueue.php +0 -0
  93. app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api.php +0 -0
  94. app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api/V2.php +0 -0
  95. app/code/community/DB1/AnyMarket/Model/Cron.php +2 -2
  96. app/code/community/DB1/AnyMarket/Model/Observer.php +90 -7
  97. app/code/community/DB1/AnyMarket/Model/PaymentMethod.php +0 -0
  98. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes.php +0 -0
  99. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes/Collection.php +0 -0
  100. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketbrands.php +0 -0
  101. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketbrands/Collection.php +0 -0
  102. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories.php +0 -0
  103. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories/Collection.php +0 -0
  104. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketimage.php +62 -0
  105. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketimage/Collection.php +110 -0
  106. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog.php +0 -0
  107. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog/Collection.php +0 -0
  108. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders.php +0 -0
  109. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders/Collection.php +0 -0
  110. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts.php +0 -0
  111. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts/Collection.php +0 -0
  112. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue.php +0 -0
  113. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue/Collection.php +0 -0
  114. app/code/community/DB1/AnyMarket/Model/Resource/Setup.php +0 -0
  115. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Group/Values.php +0 -0
  116. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Street/Values.php +0 -0
  117. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Values.php +0 -0
  118. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Booleantp/Values.php +0 -0
  119. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Price/Values.php +0 -0
  120. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Values.php +0 -0
  121. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Set/Values.php +0 -0
  122. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Categories/Values.php +0 -0
  123. app/code/community/DB1/AnyMarket/Model/System/Config/Source/General/Values.php +0 -0
  124. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Logs/Values.php +0 -0
  125. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Massunit/Values.php +0 -0
  126. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Measurementunit/Values.php +0 -0
  127. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Orders/Values.php +0 -0
  128. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Typesync/Order/Values.php +0 -0
  129. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketattributesController.php +0 -0
  130. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketbrandsController.php +0 -0
  131. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketcategoriesController.php +0 -0
  132. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketlogController.php +0 -0
  133. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketordersController.php +3 -3
  134. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketproductsController.php +0 -0
  135. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketqueueController.php +0 -0
  136. app/code/community/DB1/AnyMarket/controllers/Adminhtml/AnymarketController.php +0 -4
  137. app/code/community/DB1/AnyMarket/controllers/IndexController.php +73 -59
  138. app/code/community/DB1/AnyMarket/etc/adminhtml.xml +0 -0
  139. app/code/community/DB1/AnyMarket/etc/api.xml +0 -0
  140. app/code/community/DB1/AnyMarket/etc/config.xml +37 -18
  141. app/code/community/DB1/AnyMarket/etc/system.xml +29 -41
  142. app/code/community/DB1/AnyMarket/etc/wsdl.xml +0 -0
  143. app/code/community/DB1/AnyMarket/etc/wsi.xml +0 -0
  144. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-install-1.0.0.php +0 -0
  145. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.0.0-1.1.0.php +0 -0
  146. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.1.0-1.2.0.php +0 -0
  147. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.2.0-1.3.0.php +0 -0
  148. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.3.0-1.4.0.php +0 -0
  149. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.4.0-1.5.0.php +0 -0
  150. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.5.0-1.6.0.php +0 -0
  151. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.6.0-1.7.0.php +0 -0
  152. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.7.0-1.8.0.php +0 -0
  153. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.8.0-2.0.0.php +0 -0
  154. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.0.0-2.1.0.php +0 -0
  155. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.1.0-2.2.0.php +0 -0
  156. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.11.1-2.11.2.php +8 -0
  157. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.11.2-2.11.3.php +3 -0
  158. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.11.3-2.11.4.php +39 -0
  159. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.2.0-2.3.6.php +0 -0
  160. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.3.6-2.3.9.php +0 -0
  161. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.3.9-2.4.0.php +1 -1
  162. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.0-2.4.3.php +0 -0
  163. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.3-2.4.4.php +0 -0
  164. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.4-2.9.1.php +0 -0
  165. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.9.1-2.9.2.php +0 -0
  166. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.9.2-2.11.1.php +4 -0
  167. app/design/adminhtml/default/default/layout/db1_anymarket.xml +9 -0
  168. app/design/adminhtml/default/default/template/db1/anymarket/system/config/form/field/array_dropdown.phtml +0 -0
  169. app/design/adminhtml/default/default/template/db1/anymarket/system/config/form/field/button_check_configuration.phtml +0 -0
  170. app/etc/modules/DB1_AnyMarket.xml +0 -0
  171. app/locale/en_US/DB1_AnyMarket.csv +0 -0
  172. app/locale/pt_BR/DB1_AnyMarket.csv +0 -0
  173. package.xml +7 -7
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Stores.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tabs.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Grid.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tab/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tab/Stores.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Edit/Tabs.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketbrands/Grid.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Stores.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tabs.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Grid.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Stores.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tabs.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Grid.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Stores.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tabs.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Grid.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Stores.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tabs.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Grid.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Form.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Stores.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tabs.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Grid.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/System/Config/Form/Buttoncheckconfig.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/Adminhtml/System/Config/Form/Callback.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusammg/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusmgam/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Block/System/Config/Source/Products/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Controller/Adminhtml/AnyMarket.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Helper/Brand.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Helper/Category.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Helper/Customergenerator.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Helper/Data.php CHANGED
@@ -278,11 +278,20 @@ class DB1_AnyMarket_Helper_Data extends Mage_Core_Helper_Abstract
278
  $temp_array = array();
279
  $i = 0;
280
  $key_array = array();
 
281
 
282
  foreach($array as $val) {
283
- if (!in_array($val[$key], $key_array)) {
284
- $key_array[$i] = $val[$key];
285
- array_push($temp_array, $val);
 
 
 
 
 
 
 
 
286
  }
287
  $i++;
288
  }
278
  $temp_array = array();
279
  $i = 0;
280
  $key_array = array();
281
+ $var_array = array();
282
 
283
  foreach($array as $val) {
284
+ if( isset($val['variation']) ){
285
+ if (!in_array($val[$key], $key_array) || !in_array($val['variation'], $var_array) ) {
286
+ $key_array[$i] = $val[$key];
287
+ $var_array[$i] = $val['variation'];
288
+ array_push($temp_array, $val);
289
+ }
290
+ }else {
291
+ if (!in_array($val[$key], $key_array)) {
292
+ $key_array[$i] = $val[$key];
293
+ array_push($temp_array, $val);
294
+ }
295
  }
296
  $i++;
297
  }
app/code/community/DB1/AnyMarket/Helper/Image.php CHANGED
@@ -21,17 +21,13 @@ class DB1_AnyMarket_Helper_Image extends DB1_AnyMarket_Helper_Data
21
  $imgSize = filesize($g_image['path']);
22
  $processImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_transform_process_image_field', $storeID);
23
  if ($processImage == 0) {
24
- if (($infoImg[0] != "") && ((float)$infoImg[0] < 350 || (float)$infoImg[1] < 350 || $imgSize > 4100000)) {
25
- if ($exportImage == 0) {
26
- array_push($arrProd, 'Image_a (' . $g_image['url'] . ' - Sku: ' . $product->getSku() . ' - Width: ' . $infoImg[0] . ' - Height: ' . $infoImg[1] . ' - Size: ' . $imgSize . ')');
27
- } else {
28
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
29
- $anymarketlog->setLogDesc('Error on export image - ' . $g_image['url']);
30
- $anymarketlog->setLogId($product->getSku());
31
- $anymarketlog->setStatus("1");
32
- $anymarketlog->setStores(array($storeID));
33
- $anymarketlog->save();
34
- }
35
  } else {
36
  $urlImageImport = $g_image['url'];
37
  $defaultImage = $product->getImage();
@@ -104,9 +100,48 @@ class DB1_AnyMarket_Helper_Image extends DB1_AnyMarket_Helper_Data
104
  }
105
  }
106
 
107
- public function processImageToAdd($storeID, $imgProdMagentoURL){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
 
109
- return $imgProdMagentoURL;
 
 
 
 
110
  }
111
 
112
  /**
@@ -117,177 +152,205 @@ class DB1_AnyMarket_Helper_Image extends DB1_AnyMarket_Helper_Data
117
  * @param $product
118
  * @param $variation
119
  *
 
120
  */
121
  public function sendImageToAnyMarket($storeID, $product, $variation){
122
- if($product){
123
- $product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $product->getId() );
124
- $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
125
- $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
126
- $exportImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_export_image_field', $storeID);
127
- $transformToHttp = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_transform_http_image_field', $storeID);
128
 
129
- $headers = array(
130
- "Content-type: application/json",
131
- "gumgaToken: ".$TOKEN
132
- );
133
 
134
- if($product->getData('id_anymarket') != ''){
135
- $imgGetRet = $this->CallAPICurl("GET", $HOST."/v2/products/".$product->getData('id_anymarket')."/images", $headers, null);
136
- if($imgGetRet['error'] == '0'){
137
- $imgsProdAnymarket = $imgGetRet['return'];
138
 
139
- $arrAdd = array();
140
- $arrImgs = array();
 
141
 
142
- $processImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_transform_process_image_field', $storeID);
143
- $imgsProdMagento = $product->getMediaGalleryImages();
144
 
145
- if (count($imgsProdMagento) <= 0) {
146
- $productIMG = Mage::getModel('catalog/product')->load( $product->getId() );
147
- $imgsProdMagento = $productIMG->getMediaGalleryImages();
148
- }
149
 
150
- if (count($imgsProdMagento) > 0) {
151
- if( $processImage == 0 ) {
152
- foreach ($imgsProdMagento as $imgProdMagento) {
153
- $urlImage = $imgProdMagento->getData('url');
154
- $infoImg = getimagesize($urlImage);
155
- $imgSize = filesize($imgProdMagento->getData('path'));
156
- if (($infoImg[0] != "") && ((float)$infoImg[0] < 350 || (float)$infoImg[1] < 350 || $imgSize > 4100000)) {
157
- if ($exportImage == 0) {
158
- array_push($arrProd, 'Image_c (' . $urlImage . ' - Sku: ' . $product->getSku() . ' - Width: ' . $infoImg[0] . ' - Height: ' . $infoImg[1] . ' - Size: ' . $imgSize . ')');
159
- } else {
160
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
161
- $anymarketlog->setLogDesc('Error on export image - ' . $urlImage);
162
- $anymarketlog->setLogId($product->getSku());
163
- $anymarketlog->setStatus("1");
164
- $anymarketlog->setStores(array($storeID));
165
- $anymarketlog->save();
166
- }
167
- } else {
168
- $imgProdMagentoURL = $imgProdMagento->getData('url');
169
- if ($transformToHttp != 0) {
170
- $imgProdMagentoURL = str_replace("https", "http", $imgProdMagentoURL);
171
- }
172
- array_push($arrAdd, $imgProdMagentoURL);
173
- }
174
  }
175
- }else {
176
- $with = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_width_image_field', $storeID);
177
- $height = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_height_image_field', $storeID);
178
- foreach ($imgsProdMagento as $imgProdMagento) {
179
- if( ((int)$with > 0) && ((int)$height > 0) ){
180
- $thumbnail12 = Mage::helper('catalog/image')->init($product, 'image', $imgProdMagento->getFile())->resize($with, $height);
181
- }else{
182
- $thumbnail12 = Mage::helper('catalog/image')->init($product, 'image', $imgProdMagento->getFile());
183
- }
184
 
185
- $imgProdMagentoURL = str_replace('/webApps/migration/productapi/new/', '/', $thumbnail12);
186
- if ($transformToHttp != 0) {
187
- $imgProdMagentoURL = str_replace("https", "http", $imgProdMagentoURL);
188
- }
189
- array_push($arrAdd, $imgProdMagentoURL);
 
 
 
 
 
 
 
 
 
 
 
190
  }
 
191
  }
192
  }
 
 
 
 
 
193
 
194
- foreach ($imgsProdAnymarket as $imgProdAnymarket) {
195
- $exportImages = true;
196
- if ($variation) {
197
- if( !isset($imgProdAnymarket->variation) || $imgProdAnymarket->variation != $variation ){
198
- $exportImages = false;
 
199
  }
 
200
  }
201
 
202
- if( $exportImages ) {
203
- $imgRemove = $imgProdAnymarket->id;
204
- $imgDelRet = $this->CallAPICurl("DELETE", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/images/" . $imgRemove, $headers, null);
205
- if ($imgDelRet['error'] == '1') {
206
- $anymarketlogDel = Mage::getModel('db1_anymarket/anymarketlog');
207
 
208
- if (is_string($imgDelRet['return'])) {
209
- $anymarketlogDel->setLogDesc('Error on delete image in Anymarket (' . $imgRemove . ') - ' . $imgDelRet['return']);
210
- } else {
211
- $anymarketlogDel->setLogDesc('Error on delete image in Anymarket (' . $imgRemove . ') - ' . json_encode($imgDelRet['return']));
212
- }
 
 
 
213
 
214
- $anymarketlogDel->setLogJson('');
215
- $anymarketlogDel->setLogId($product->getSku());
216
- $anymarketlogDel->setStatus("1");
217
- $anymarketlogDel->setStores(array($storeID));
218
- $anymarketlogDel->save();
219
- } else {
220
- $anymarketlogDel = Mage::getModel('db1_anymarket/anymarketlog');
221
- $anymarketlogDel->setLogDesc('Deleted image from Anymarket ');
222
- $anymarketlogDel->setLogJson('');
223
- $anymarketlogDel->setLogId($product->getSku());
224
- $anymarketlogDel->setStatus("1");
225
- $anymarketlogDel->setStores(array($storeID));
226
- $anymarketlogDel->save();
 
 
 
 
 
 
 
227
  }
228
  }
 
 
 
229
 
 
 
230
  }
231
 
232
- // Add Image
233
- if( !empty($arrImgs) ){
234
- $returnProd['error'] = '1';
235
- $returnProd['json'] = '';
236
 
237
- $emptyFields = ' ';
238
- foreach ($arrImgs as $field) {
239
- $emptyFields .= $field.', ';
240
- }
241
 
242
- $returnProd['return'] = Mage::helper('db1_anymarket')->__('Product with inconsistency:').' '.$emptyFields;
243
- $this->saveLogsProds($storeID, "0", $returnProd, $product);
244
- }else {
245
- $defaultImage = $product->getImage();
246
- foreach ($arrAdd as $imgAdd) {
247
- $isMain = strpos($imgAdd, $defaultImage) === false ? false : true;
248
- if ($variation) {
249
- $JSONAdd = array(
250
- "url" => $imgAdd,
251
- "variation" => $variation,
252
- "main" => $isMain
253
- );
254
- } else {
255
- $JSONAdd = array(
256
- "url" => $imgAdd,
257
- "main" => $isMain
258
- );
259
- }
260
 
261
- $imgPostRet = $this->CallAPICurl("POST", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/images", $headers, $JSONAdd);
262
- if ($imgPostRet['error'] == '1') {
263
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
264
- $anymarketlog->setLogDesc('Error on export image (' . $product->getData('id_anymarket') . ') - ' . is_string($imgPostRet['return']) ? $imgPostRet['return'] : json_encode($imgPostRet['return']));
265
- $anymarketlog->setLogJson($imgPostRet['json']);
266
- $anymarketlog->setLogId($product->getSku());
267
- $anymarketlog->setStatus("1");
268
- $anymarketlog->setStores(array($storeID));
269
- $anymarketlog->save();
270
- } else {
271
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
272
- $anymarketlog->setLogDesc('Exported image (' . $imgAdd . ')');
273
- $anymarketlog->setLogJson($imgPostRet['json']);
274
- $anymarketlog->setLogId($product->getSku());
275
- $anymarketlog->setStatus("1");
276
- $anymarketlog->setStores(array($storeID));
277
- $anymarketlog->save();
278
- }
279
- }
 
 
 
 
 
 
280
  }
281
 
282
- }else{
283
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
284
- $anymarketlog->setLogDesc( 'Error on get images from Anymarket ('.$product->getData('id_anymarket').') ');
285
- $anymarketlog->setStatus("1");
286
- $anymarketlog->setStores(array($storeID));
287
- $anymarketlog->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  }
289
  }
 
 
 
 
 
 
 
290
  }
 
 
291
  }
292
 
293
  }
21
  $imgSize = filesize($g_image['path']);
22
  $processImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_transform_process_image_field', $storeID);
23
  if ($processImage == 0) {
24
+ if ($exportImage == 0 && ($infoImg[0] != "") && ((float)$infoImg[0] < 350 || (float)$infoImg[1] < 350 || $imgSize > 4100000)){
25
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
26
+ $anymarketlog->setLogDesc('Error on export image - ' . $g_image['url'] . ' - Width: ' . $infoImg[0] . ' - Height: ' . $infoImg[1] . ' - Size: ' . $imgSize );
27
+ $anymarketlog->setLogId($product->getSku());
28
+ $anymarketlog->setStatus("1");
29
+ $anymarketlog->setStores(array($storeID));
30
+ $anymarketlog->save();
 
 
 
 
31
  } else {
32
  $urlImageImport = $g_image['url'];
33
  $defaultImage = $product->getImage();
100
  }
101
  }
102
 
103
+ private function getMediaEntityGalleryDirect($valueId){
104
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
105
+ $sql = "SELECT * FROM `catalog_product_entity_media_gallery` WHERE `value_id`=".$valueId;
106
+ $rows = $connection->fetchAll($sql);
107
+
108
+ return count($rows) > 0;
109
+ }
110
+
111
+ private function deleteImageAnymarket($storeID, $HOST, $product, $headers, $imgRemove, $valueId){
112
+ if( $valueId != null && $this->getMediaEntityGalleryDirect($valueId) ){
113
+ return false;
114
+ }
115
+ $imgDelRet = $this->CallAPICurl("DELETE", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/images/" . $imgRemove, $headers, null);
116
+ if ($imgDelRet['error'] == '1') {
117
+ $anymarketlogDel = Mage::getModel('db1_anymarket/anymarketlog');
118
+
119
+ if (is_string($imgDelRet['return'])) {
120
+ $anymarketlogDel->setLogDesc('Error on delete image in Anymarket (' . $imgRemove . ') - ' . $imgDelRet['return']);
121
+ } else {
122
+ $anymarketlogDel->setLogDesc('Error on delete image in Anymarket (' . $imgRemove . ') - ' . json_encode($imgDelRet['return']));
123
+ }
124
+
125
+ $anymarketlogDel->setLogJson('');
126
+ $anymarketlogDel->setLogId($product->getSku());
127
+ $anymarketlogDel->setStatus("1");
128
+ $anymarketlogDel->setStores(array($storeID));
129
+ $anymarketlogDel->save();
130
+ } else {
131
+ $anymarketlogDel = Mage::getModel('db1_anymarket/anymarketlog');
132
+ $anymarketlogDel->setLogDesc('Deleted image from Anymarket ('.$imgRemove.')');
133
+ $anymarketlogDel->setLogJson('');
134
+ $anymarketlogDel->setLogId($product->getSku());
135
+ $anymarketlogDel->setStatus("1");
136
+ $anymarketlogDel->setStores(array($storeID));
137
+ $anymarketlogDel->save();
138
+
139
 
140
+ $anymarketCtrlImg = Mage::getModel('db1_anymarket/anymarketimage')->load($imgRemove, 'id_image');
141
+ if( $anymarketCtrlImg->getData('value_id') != "" || $anymarketCtrlImg->getData('value_id') != null ) {
142
+ $anymarketCtrlImg->delete();
143
+ }
144
+ }
145
  }
146
 
147
  /**
152
  * @param $product
153
  * @param $variation
154
  *
155
+ * @return boolean
156
  */
157
  public function sendImageToAnyMarket($storeID, $product, $variation){
158
+ if(!$product){
159
+ return false;
160
+ }
 
 
 
161
 
162
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
163
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
164
+ $exportImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_export_image_field', $storeID);
165
+ $transformToHttp = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_transform_http_image_field', $storeID);
166
 
167
+ $headers = array(
168
+ "Content-type: application/json",
169
+ "gumgaToken: ".$TOKEN
170
+ );
171
 
172
+ $imgGetRet = $this->CallAPICurl("GET", $HOST."/v2/products/".$product->getData('id_anymarket')."/images", $headers, null);
173
+ if($imgGetRet['error'] == '0'){
174
+ $imgsProdAnymarket = $imgGetRet['return'];
175
 
176
+ $arrAdd = array();
177
+ $arrImgs = array();
178
 
179
+ $processImage = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_transform_process_image_field', $storeID);
180
+ $imgsProdMagento = $product->getMediaGalleryImages();
 
 
181
 
182
+ if (count($imgsProdMagento) <= 0) {
183
+ $productIMG = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $product->getId() );
184
+ $imgsProdMagento = $productIMG->getMediaGalleryImages();
185
+ }
186
+
187
+ if (count($imgsProdMagento) > 0) {
188
+ if( $processImage == 0 ) {
189
+ foreach ($imgsProdMagento as $imgProdMagento) {
190
+ $loadedImagCtrl = Mage::getModel('db1_anymarket/anymarketimage')->load( $imgProdMagento->getData('value_id'), 'value_id');
191
+
192
+ if( $loadedImagCtrl->getData('value_id') != "" && $loadedImagCtrl->getData('value_id') != null ) {
193
+ $imgValDeleted = $this->CallAPICurl("GET", $HOST."/v2/products/".$product->getData('id_anymarket')."/images/".$loadedImagCtrl->getData('id_image'), $headers, null);
194
+
195
+ if($imgValDeleted['error'] == '1'){
196
+ $loadedImagCtrl->delete();
197
+ }else{
198
+ continue;
 
 
 
 
 
 
 
199
  }
 
 
 
 
 
 
 
 
 
200
 
201
+ }
202
+ $urlImage = $imgProdMagento->getData('url');
203
+ $infoImg = getimagesize($urlImage);
204
+ $imgSize = filesize($imgProdMagento->getData('path'));
205
+
206
+ if ($exportImage == 0 && ($infoImg[0] != "") && ((float)$infoImg[0] < 350 || (float)$infoImg[1] < 350 || $imgSize > 4100000)) {
207
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
208
+ $anymarketlog->setLogDesc('Error on export image - ' . $urlImage . ' - Width: ' . $infoImg[0] . ' - Height: ' . $infoImg[1] . ' - Size: ' . $imgSize );
209
+ $anymarketlog->setLogId($product->getSku());
210
+ $anymarketlog->setStatus("1");
211
+ $anymarketlog->setStores(array($storeID));
212
+ $anymarketlog->save();
213
+ } else {
214
+ $imgProdMagentoURL = $imgProdMagento->getData('url');
215
+ if ($transformToHttp != 0) {
216
+ $imgProdMagentoURL = str_replace("https", "http", $imgProdMagentoURL);
217
  }
218
+ array_push($arrAdd, array('URL' => $imgProdMagentoURL, 'ID' =>$imgProdMagento->getData('value_id') ));
219
  }
220
  }
221
+ }else {
222
+ $with = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_width_image_field', $storeID);
223
+ $height = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_height_image_field', $storeID);
224
+ foreach ($imgsProdMagento as $imgProdMagento) {
225
+ $loadedImagCtrl = Mage::getModel('db1_anymarket/anymarketimage')->load($imgProdMagento->getData('value_id'), 'value_id');
226
 
227
+ if( $loadedImagCtrl->getData('value_id') != "" && $loadedImagCtrl->getData('value_id') != null ) {
228
+ $imgValDeleted = $this->CallAPICurl("GET", $HOST."/v2/products/".$product->getData('id_anymarket')."/images/".$loadedImagCtrl->getData('id_image'), $headers, null);
229
+ if($imgValDeleted['error'] == '1'){
230
+ $loadedImagCtrl->delete();
231
+ }else{
232
+ continue;
233
  }
234
+
235
  }
236
 
237
+ if (((int)$with > 0) && ((int)$height > 0)) {
238
+ $thumbnail12 = Mage::helper('catalog/image')->init($product, 'image', $imgProdMagento->getFile())->resize($with, $height);
239
+ } else {
240
+ $thumbnail12 = Mage::helper('catalog/image')->init($product, 'image', $imgProdMagento->getFile());
241
+ }
242
 
243
+ $imgProdMagentoURL = str_replace('/webApps/migration/productapi/new/', '/', $thumbnail12);
244
+ if ($transformToHttp != 0) {
245
+ $imgProdMagentoURL = str_replace("https", "http", $imgProdMagentoURL);
246
+ }
247
+ array_push($arrAdd, array('URL' => $imgProdMagentoURL, 'ID' =>$imgProdMagento->getData('value_id') ));
248
+ }
249
+ }
250
+ }
251
 
252
+ //REMOVE IMAGE
253
+ foreach ($imgsProdAnymarket as $imgProdAnymarket) {
254
+ $exportImages = true;
255
+ if ($variation) {
256
+ if( !isset($imgProdAnymarket->variation) || $imgProdAnymarket->variation != $variation ){
257
+ $exportImages = false;
258
+ }
259
+ }
260
+
261
+ if( $exportImages ) {
262
+ $imgRemove = $imgProdAnymarket->id;
263
+ $loadedImagCtrl = Mage::getModel('db1_anymarket/anymarketimage')->load($imgRemove, 'id_image');
264
+
265
+ if( $loadedImagCtrl->getData('value_id') != "" || $loadedImagCtrl->getData('value_id') != null ) {
266
+ $deleteImage = true;
267
+ foreach ($imgsProdMagento as $imgProdMagento) {
268
+ $urlImage = $imgProdMagento->getData('value_id');
269
+ if( $urlImage == $loadedImagCtrl->getData('value_id') ){
270
+ $deleteImage = false;
271
+ break;
272
  }
273
  }
274
+ if($deleteImage){
275
+ $this->deleteImageAnymarket($storeID, $HOST, $product, $headers, $imgRemove, $loadedImagCtrl->getData('value_id'));
276
+ }
277
 
278
+ }else{
279
+ $this->deleteImageAnymarket($storeID, $HOST, $product, $headers, $imgRemove, null);
280
  }
281
 
282
+ }
 
 
 
283
 
284
+ }
 
 
 
285
 
286
+ // Add Image
287
+ if( !empty($arrImgs) ){
288
+ $returnProd['error'] = '1';
289
+ $returnProd['json'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
 
291
+ $emptyFields = ' ';
292
+ foreach ($arrImgs as $field) {
293
+ $emptyFields .= $field.', ';
294
+ }
295
+
296
+ $returnProd['return'] = Mage::helper('db1_anymarket')->__('Product with inconsistency:').' '.$emptyFields;
297
+ $this->saveLogsProds($storeID, "0", $returnProd, $product);
298
+ }else {
299
+ $defaultImage = $product->getImage();
300
+
301
+ foreach ($arrAdd as $imgAddArr) {
302
+ $imgAdd = $imgAddArr['URL'];
303
+
304
+ $isMain = strpos($imgAdd, $defaultImage) === false ? false : true;
305
+ if ($variation) {
306
+ $JSONAdd = array(
307
+ "url" => $imgAdd,
308
+ "variation" => $variation,
309
+ "main" => $isMain
310
+ );
311
+ } else {
312
+ $JSONAdd = array(
313
+ "url" => $imgAdd,
314
+ "main" => $isMain
315
+ );
316
  }
317
 
318
+ $imgPostRet = $this->CallAPICurl("POST", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/images", $headers, $JSONAdd);
319
+ if ($imgPostRet['error'] == '1') {
320
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
321
+ $anymarketlog->setLogDesc('Error on export image (' . $product->getData('id_anymarket') . ') - ' . is_string($imgPostRet['return']) ? $imgPostRet['return'] : json_encode($imgPostRet['return']));
322
+ $anymarketlog->setLogJson($imgPostRet['json']);
323
+ $anymarketlog->setLogId($product->getSku());
324
+ $anymarketlog->setStatus("1");
325
+ $anymarketlog->setStores(array($storeID));
326
+ $anymarketlog->save();
327
+ } else {
328
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
329
+ $anymarketlog->setLogDesc('Exported image (' . $imgAdd . ')');
330
+ $anymarketlog->setLogJson($imgPostRet['json']);
331
+ $anymarketlog->setLogId($product->getSku());
332
+ $anymarketlog->setStatus("1");
333
+ $anymarketlog->setStores(array($storeID));
334
+ $anymarketlog->save();
335
+
336
+ $retJson = $imgPostRet['return'];
337
+ $anymarketImage = Mage::getModel('db1_anymarket/anymarketimage');
338
+ $anymarketImage->setValueId( $imgAddArr['ID'] );
339
+ $anymarketImage->setIdImage( $retJson->id );
340
+ $anymarketImage->save();
341
+ }
342
  }
343
  }
344
+
345
+ }else{
346
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
347
+ $anymarketlog->setLogDesc( 'Error on get images from Anymarket ('.$product->getData('id_anymarket').') ');
348
+ $anymarketlog->setStatus("1");
349
+ $anymarketlog->setStores(array($storeID));
350
+ $anymarketlog->save();
351
  }
352
+
353
+
354
  }
355
 
356
  }
app/code/community/DB1/AnyMarket/Helper/Order.php CHANGED
@@ -9,7 +9,7 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
9
  * @param $OrderRowData
10
  * @return string
11
  */
12
- private function getStatusAnyMarketToMageOrderConfig($storeID, $OrderRowData){
13
  if($OrderRowData == null){
14
  $OrderRowData = "new";
15
  }
@@ -25,7 +25,6 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
25
  $OrderReturn = $StatusOrderRow['orderStatusMG'];
26
  $statuses = Mage::getModel('sales/order_status')->getCollection()->joinStates()
27
  ->addFieldToFilter('main_table.status',array('eq'=>$OrderReturn));
28
- //->addStatusFilter($OrderReturn);
29
 
30
  $StateReturn = $statuses->getFirstItem()->getData('state');
31
  break;
@@ -70,6 +69,78 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
70
  }
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * get status order MG to AM from configs
75
  *
@@ -223,10 +294,12 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
223
 
224
  $this->getSpecificOrderFromAnyMarket($order->id, $order->token, $storeID);
225
 
226
- $paramFeed = array(
227
- "token" => $order->token
228
- );
229
- $this->CallAPICurl("PUT", $HOST . "/rest/api/v2/orders/feeds/" . $order->id, $headers, $paramFeed);
 
 
230
  }
231
  }
232
  }
@@ -255,316 +328,312 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
255
  $IDOrderAnyMarket = $OrderJSON->marketPlaceId;
256
  $anymarketordersSpec = Mage::getModel('db1_anymarket/anymarketorders');
257
  $anymarketordersSpec->load($idSeqAnyMarket, 'nmo_id_seq_anymarket');
258
-
259
 
260
  if( ($anymarketordersSpec->getData('nmo_id_anymarket') == null) ||
261
  ($anymarketordersSpec->getData('nmo_status_int') == "Não integrado (AnyMarket)") ||
262
  ($anymarketordersSpec->getData('nmo_status_int') == "ERROR 01") ){
263
- $STATUSIMPORT = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_stauts_order_field', $storeID);
264
- if (strpos($STATUSIMPORT, $OrderJSON->status) !== false) {
265
- $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
266
- if($ConfigOrder == 1) {
267
- $statsConfig = $this->getStatusAnyMarketToMageOrderConfig($storeID, $OrderJSON->status);
268
- $statusMage = $statsConfig["status"];
269
-
270
- if (strpos($statusMage, 'ERROR:') === false) {
271
- //TRATA OS PRODUTOS
272
- $_products = array();
273
- $shippingDesc = array();
274
- foreach ($OrderJSON->items as $item) {
275
-
276
- if( isset($item->shippings) ) {
277
- foreach ($item->shippings as $shippItem) {
278
- if (!in_array($shippItem->shippingtype, $shippingDesc)) {
279
- array_push($shippingDesc, $shippItem->shippingtype);
280
- }
281
  }
282
  }
 
283
 
284
- $productLoaded = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $item->sku->partnerId);
285
- if ($productLoaded) {
286
- $arrayTMP = array(
287
- 'product' => $productLoaded->getId(),
288
- 'price' => $item->unit,
289
- 'qty' => $item->amount,
290
- );
291
-
292
- if($productLoaded->getTypeID() == "bundle") {
293
- $optionsBundle = Mage::helper('db1_anymarket/product')->getDetailsOfBundle($productLoaded);
294
-
295
- $boundOpt = array();
296
- $boundOptQty = array();
297
- foreach ($optionsBundle as $detProd) {
298
- $boundOpt[$detProd['option_id']] = $detProd['selection_id'];
299
- $boundOptQty[$detProd['option_id']] = $detProd['selection_qty'];
300
- }
301
-
302
- $arrayTMP['bundle_option'] = $boundOpt;
303
- $arrayTMP['bundle_option_qty'] = $boundOptQty;
304
  }
305
 
306
- array_push($_products, $arrayTMP);
307
- } else {
308
- if ($anymarketordersSpec->getData('nmo_id_anymarket') == null) {
309
- $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
310
- } else {
311
- $anymarketorders = $anymarketordersSpec;
312
- }
313
 
314
- $this->saveLogOrder('nmo_id_seq_anymarket',
315
- $idSeqAnyMarket,
316
- 'ERROR 01',
317
- Mage::helper('db1_anymarket')->__('Product is not registered') . ' (SKU: ' . $item->sku->partnerId . ')',
318
- $idSeqAnyMarket,
319
- $IDOrderAnyMarket,
320
- '',
321
- $storeID);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
 
323
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
324
- $anymarketlog->setLogDesc(Mage::helper('db1_anymarket')->__('Product is not registered') . ' (Order: ' . $idSeqAnyMarket . ', SKU : ' . $item->sku->partnerId . ')');
325
- $anymarketlog->setStores(array($storeID));
326
- $anymarketlog->setStatus("0");
327
- $anymarketlog->save();
328
-
329
- $this->addMessageInBox($storeID, Mage::helper('db1_anymarket')->__('Error on synchronize order.'),
330
- Mage::helper('db1_anymarket')->__('Error synchronizing order number: ') . "Anymarket(" . $IDOrderAnyMarket . ") <br/>" .
331
- Mage::helper('db1_anymarket')->__('Product is not registered') . ' (SKU: ' . $item->sku->partnerId . ')',
332
- '');
333
- $stateProds = false;
334
- break;
335
- }
336
  }
337
 
338
- //verifica se criou o produto
339
- if ($stateProds) {
340
- //TRATA O CLIENTE
341
- $document = null;
342
- if (isset($OrderJSON->buyer->document)) {
343
- $document = $OrderJSON->buyer->document;
344
- }
345
 
346
- if ($document != null) {
347
- try {
348
- $AttrToDoc = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_doc_type_field', $storeID));
349
- $groupCustomer = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_customer_group_field', $storeID);
350
 
351
- $email = $OrderJSON->buyer->email;
 
 
 
 
 
 
352
 
353
  $customer = Mage::getModel('customer/customer')
354
  ->getCollection()
355
  ->addFieldToFilter($AttrToDoc, $document)->load()->getFirstItem();
356
 
357
- //caso nao ache pelo CPF valida se nao tem mascara
358
  if(!$customer->getId()) {
359
- if (strlen($document) == 11) {
360
- $document = $this->Mask('###.###.###-##', $document);
361
- } else {
362
- $document = $this->Mask('##.###.###/####-##', $document);
363
- }
364
-
365
  $customer = Mage::getModel('customer/customer')
366
  ->getCollection()
367
- ->addFieldToFilter($AttrToDoc, $document)->load()->getFirstItem();
368
 
369
- //caso ainda nao encontrou valida se existe o email
370
- if(!$customer->getId()) {
371
- $customer = Mage::getModel('customer/customer')
372
- ->getCollection()
373
- ->addFieldToFilter('email', $email)->load()->getFirstItem();
374
-
375
- }
376
  }
 
377
 
378
- $AddressShipBill = null;
379
 
380
- $firstName = $OrderJSON->buyer->name;
381
- $lastName = 'Lastname';
382
- if ($firstName != '') {
383
- $nameComplete = explode(" ", $firstName);
384
 
385
- $lastNameP = array_slice($nameComplete, 1);
386
- $lastNameImp = implode(" ", $lastNameP);
387
 
388
- $firstName = array_shift($nameComplete);
389
- $lastName = $lastNameImp == '' ? 'Lastname' : $lastNameImp;
390
- }
391
 
392
- $addressFullData = $this->getCompleteAddressOrder($storeID, $OrderJSON);
393
- $regionCollection = Mage::getModel('directory/region')->getCollection();
394
- $regionName = (isset($OrderJSON->shipping->state)) ? $OrderJSON->shipping->state : 'Não especificado';
395
- $regionID = 0;
396
- foreach ($regionCollection as $key) {
397
- if( $key->getData('name') == $regionName){
398
- $regionID = $key->getData('region_id');
399
- break;
400
- }
401
  }
 
402
 
403
- $addressFullData = $this->getCompleteAddressOrder($storeID, $OrderJSON);
404
-
405
- if ($customer->getId() == null) {
406
- $_DataCustomer = array(
407
- 'account' => array(
408
- 'firstname' => $firstName,
409
- 'lastname' => $lastName,
410
- 'email' => $email,
411
- $AttrToDoc => $document,
412
- 'password' => 'a111111',
413
- 'default_billing' => '_item1',
414
- 'default_shipping' => '_item1',
415
- 'store_id' => $storeID,
416
- 'website_id' => Mage::app()->getWebsite()->getId(),
417
- 'group_id' => $groupCustomer,
418
- ),
419
- 'address' => array(
420
- '_item1' => array(
421
- 'firstname' => $firstName,
422
- 'lastname' => $lastName,
423
- 'street' => $addressFullData,
424
- 'city' => (isset($OrderJSON->shipping->city)) ? $OrderJSON->shipping->city : 'Não especificado',
425
- 'country_id' => 'BR',
426
- 'region_id' => $regionID,
427
- 'region' => (isset($OrderJSON->shipping->state)) ? $OrderJSON->shipping->state : 'Não especificado',
428
- 'postcode' => (isset($OrderJSON->shipping->zipCode)) ? $OrderJSON->shipping->zipCode : 'Não especificado',
429
- 'telephone' => $OrderJSON->buyer->phone,
430
- ),
431
- ),
432
- );
433
-
434
- $customerRet = Mage::helper('db1_anymarket/customergenerator')->createCustomer($_DataCustomer);
435
- $customer = $customerRet['customer'];
436
- $AddressShipBill = $customerRet['addr'];
437
- } else {
438
- //PERCORRE OS ENDERECOS PARA VER SE JA HA CADASTRADO O INFORMADO
439
- $needRegister = true;
440
- foreach ($customer->getAddresses() as $address) {
441
- $zipCodeOrder = (isset($OrderJSON->shipping->zipCode)) ? $OrderJSON->shipping->zipCode : 'Não especificado';
442
- $addressOrder = (isset($OrderJSON->shipping->address)) ? $OrderJSON->shipping->address : 'Frete não especificado.';
443
- if (($address->getData('postcode') == $zipCodeOrder) && ($address->getData('street') == $addressOrder)) {
444
- $AddressShipBill = $address;
445
- $needRegister = false;
446
- break;
447
- }
448
- }
449
-
450
- //CRIA O ENDERECO CASO NAO TENHA O INFORMADO
451
- if ($needRegister) {
452
- $address = Mage::getModel('customer/address');
453
-
454
- $addressData = array(
455
  'firstname' => $firstName,
456
  'lastname' => $lastName,
457
  'street' => $addressFullData,
458
  'city' => (isset($OrderJSON->shipping->city)) ? $OrderJSON->shipping->city : 'Não especificado',
459
  'country_id' => 'BR',
460
- 'region' => (isset($OrderJSON->shipping->state)) ? $OrderJSON->shipping->state : 'Não especificado',
461
  'region_id' => $regionID,
 
462
  'postcode' => (isset($OrderJSON->shipping->zipCode)) ? $OrderJSON->shipping->zipCode : 'Não especificado',
463
- 'telephone' => $OrderJSON->buyer->phone
464
- );
465
-
466
- $address->setIsDefaultBilling(1);
467
- $address->setIsDefaultShipping(1);
468
- $address->addData($addressData);
469
- $address->setPostIndex('_item1');
470
- $customer->addAddress($address);
471
- $customer->save();
 
 
 
 
 
 
 
 
 
472
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
473
 
 
 
 
 
 
 
474
  }
475
 
476
- $infoMetPag = 'ANYMARKET';
477
- $infoMetPagCom = array();
478
- if( isset($OrderJSON->payments) ) {
479
- foreach ($OrderJSON->payments as $payment) {
480
- $infoMetPag = $payment->method;
481
- if($payment->paymentMethodNormalized) {
482
- array_push($infoMetPagCom, $payment->paymentMethodNormalized." - Parcelas: ".$payment->installments);
483
- }
 
 
484
  }
485
  }
 
486
 
487
- //REFACTOR
488
- $OrderIDMage = $this->create_order($storeID, $anymarketordersSpec, $_products, $customer, $IDOrderAnyMarket, $idSeqAnyMarket, $infoMetPag, $AddressShipBill, $AddressShipBill, $OrderJSON->freight, implode(",", $shippingDesc) );
489
- $OrderCheck = Mage::getModel('sales/order')->loadByIncrementId($OrderIDMage);
490
 
491
- $this->changeFeedOrder($HOST, $headers, $idSeqAnyMarket, $tokenFeed);
492
 
493
- if ($OrderCheck->getId()) {
494
- $comment = '<b>Código do Pedido no Canal de Vendas: </b>'.$OrderJSON->marketPlaceNumber.'<br>';
495
- $comment .= '<b>Canal de Vendas: </b>'.$OrderJSON->marketPlace.'<br>';
496
 
497
- if( count($infoMetPagCom) > 0 ) {
498
- foreach ($infoMetPagCom as $iMetPag) {
499
- $comment .= '<b>Forma de Pagamento: </b>' . $iMetPag . '<br>';
500
- }
501
- }else{
502
- $comment .= '<b>Forma de Pagamento: </b>Inf. não disponibilizada pelo marketplace.<br>';
503
- }
504
 
505
- $addressComp = (isset($OrderJSON->shipping->address)) ? $OrderJSON->shipping->address : 'Não especificado';
506
- $comment .= '<b>Endereço Completo: </b>'.$addressComp;
507
-
508
- $OrderCheck->addStatusHistoryComment( $comment );
509
- $OrderCheck->setEmailSent(false);
510
- $OrderCheck->save();
511
 
 
 
512
 
513
- $this->changeStatusOrder($storeID, $OrderJSON, $OrderIDMage);
 
 
 
 
 
514
  }
515
- } catch (Exception $e) {
516
- $this->saveLogOrder('nmo_id_seq_anymarket',
517
- $idSeqAnyMarket,
518
- 'ERROR 01',
519
- 'System: ' . $e->getMessage(),
520
- $idSeqAnyMarket,
521
- $IDOrderAnyMarket,
522
- '',
523
- $storeID);
524
 
 
 
 
 
 
 
 
 
525
  }
526
- } else {
 
 
527
  $this->saveLogOrder('nmo_id_seq_anymarket',
528
  $idSeqAnyMarket,
529
- 'ERROR 01',
530
- Mage::helper('db1_anymarket')->__('Customer invalid or blank document.'),
531
  $idSeqAnyMarket,
532
  $IDOrderAnyMarket,
533
- '',
534
  $storeID);
535
 
536
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
537
- $anymarketlog->setLogDesc('Error on import Order: ' . Mage::helper('db1_anymarket')->__('Customer invalid or blank document.'));
538
- $anymarketlog->setStatus("0");
539
- $anymarketlog->setStores(array($storeID));
540
- $anymarketlog->save();
541
-
542
- $this->addMessageInBox($storeID, Mage::helper('db1_anymarket')->__('Error on synchronize order.'),
543
- Mage::helper('db1_anymarket')->__('Error synchronizing order number: ') . "Anymarket(" . $IDOrderAnyMarket . ") <br/>" .
544
- Mage::helper('db1_anymarket')->__('Customer invalid or blank document.'),
545
- '');
546
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
  }
548
- } else {
549
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
550
- $anymarketlog->setLogDesc($statusMage);
551
- $anymarketlog->setLogId($IDOrderAnyMarket);
552
- $anymarketlog->setStatus("0");
553
- $anymarketlog->save();
554
  }
 
555
 
556
- if ($tokenFeed != null) {
557
- $paramFeed = array(
558
- "token" => $tokenFeed
559
- );
560
 
561
- $this->CallAPICurl("PUT", $HOST . "/rest/api/v2/orders/feeds/" . $idSeqAnyMarket, $headers, $paramFeed);
562
- }
563
  }
564
  }
565
  }else{
566
- $STATUSIMPORT = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_stauts_order_field', $storeID);
567
- if (strpos($STATUSIMPORT, $OrderJSON->status) !== false) {
 
568
  if ($anymarketordersSpec->getData('nmo_id_order') != null) {
569
  $this->changeStatusOrder($storeID, $OrderJSON, $anymarketordersSpec->getData('nmo_id_order'));
570
  }
@@ -644,28 +713,13 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
644
  Mage::getSingleton('core/session')->setImportOrdersVariable('false');
645
  $order = Mage::getModel('sales/order')->loadByIncrementId( $IDOrderMagento );
646
 
647
- if( $order->getData('state') == $stateMage ){
648
  return false;
649
  }
650
 
651
  $createRegPay = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_create_reg_pay_field', $storeID);
652
  $itemsarray = null;
653
 
654
- if( $createRegPay == "1" && $StatusPedAnyMarket == 'PAID_WAITING_SHIP' ){
655
- if( $order->canInvoice() ){
656
- if( $this->checkIfCanCreateInvoice($order) ) {
657
- $orderItems = $order->getAllItems();
658
- foreach ($orderItems as $_eachItem) {
659
- $opid = $_eachItem->getId();
660
- $qty = $_eachItem->getQtyOrdered();
661
- $itemsarray[$opid] = $qty;
662
- }
663
- $nfeString = "Registro de Pagamento criado por Anymarket";
664
- Mage::getModel('sales/order_invoice_api')->create($order->getIncrementId(), $itemsarray, $nfeString, 0, 0);
665
- }
666
- }
667
- }
668
-
669
  if( isset($JSON->invoice) && $StatusPedAnyMarket == 'INVOICED' ){
670
  if( $order->canInvoice() ){
671
  if(isset($JSON->invoice->accessKey) ) {
@@ -730,28 +784,43 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
730
  }
731
  }
732
 
733
- if($statusMage != Mage_Sales_Model_Order::STATE_NEW){
734
- if($stateMage == Mage_Sales_Model_Order::STATE_COMPLETE){
735
- $history = $order->addStatusHistoryComment('Finalizado pelo AnyMarket.', false);
736
- $history->setIsCustomerNotified(false);
737
- }
738
- $order->setData('state', $stateMage);
739
- $order->setStatus($statusMage, true);
740
-
741
- if($stateMage == Mage_Sales_Model_Order::STATE_CANCELED) {
742
- foreach ($order->getAllItems() as $item) {
743
- $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct( $item->getProductId() );
744
- if ($stockItem->getManageStock()) {
745
- $stockItem->setData('qty', $stockItem->getQty() + $item->getQtyOrdered());
746
- }
747
- $stockItem->save();
748
 
749
- $item->setQtyCanceled($item->getQtyOrdered());
750
- $item->save();
 
 
 
751
  }
 
 
 
 
752
  }
 
 
753
 
754
- $order->save();
 
 
 
 
 
 
 
 
 
 
 
 
755
  }
756
 
757
  $this->saveLogOrder('nmo_id_anymarket',
@@ -770,12 +839,24 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
770
  $anymarketlog->save();
771
 
772
  Mage::getSingleton('core/session')->setImportOrdersVariable('true');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
773
  }else{
774
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
775
- $anymarketlog->setLogDesc( $statusMage );
776
- $anymarketlog->setLogId( $IDOrderMagento );
777
- $anymarketlog->setStatus("0");
778
- $anymarketlog->save();
779
  }
780
  }
781
 
@@ -794,19 +875,12 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
794
  $invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId( $inv->getIncrementId() );
795
  foreach ($invoice->getCommentsCollection() as $item) {
796
  $CommentCurr = $item->getComment();
797
-
798
- $nfeCount = strpos($CommentCurr, 'nfe:');
799
- $emissaoCount = strpos($CommentCurr, 'emiss');
800
- if( (strpos($CommentCurr, 'nfe:') !== false) && (strpos($CommentCurr, 'emiss') !== false) ) {
801
- $caracts = array("/", "-", ".");
802
- $nfeTmp = str_replace($caracts, "", $CommentCurr );
803
- $chaveAcID = substr( $nfeTmp, $nfeCount+4, 44);
804
- $nfeID = $chaveAcID;
805
-
806
- $date = substr( $CommentCurr, $emissaoCount+8, 19);
807
- $dateTmp = str_replace("/", "-", $date );
808
-
809
- $date = $this->formatDateTimeZone($dateTmp);
810
  }
811
  }
812
  }
@@ -816,75 +890,80 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
816
  foreach ($Order->getStatusHistoryCollection() as $item) {
817
  $CommentCurr = $item->getComment();
818
 
819
- $CommentCurr = str_replace(array(" ", "<b>", "</b>"), "", $CommentCurr );
820
- $CommentCurr = str_replace(array("<br>"), "<br/>", $CommentCurr );
821
- $chaveAcesso = strpos($CommentCurr, 'ChavedeAcesso:');
822
- if( (strpos($CommentCurr, 'ChavedeAcesso:') !== false) ) {
823
- $chaveAcID = substr( $CommentCurr, $chaveAcesso+14, 44);
824
-
825
- $notaFiscal = strpos($CommentCurr, 'Notafiscal:');
826
- if( (strpos($CommentCurr, 'Notafiscal:') !== false) ) {
827
- $endNF = strpos($CommentCurr, '<br/>');
828
- $nfeID = substr( $CommentCurr, $notaFiscal+11, $endNF-11);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829
 
830
- if( $nfeID == "" ){
831
- $nfeID = $chaveAcID;
 
 
832
  }
 
 
 
 
833
  }
834
-
835
- $dateTmp = new DateTime(str_replace("/", "-", $item->getData('created_at') ));
836
- $date = date_format($dateTmp, 'Y-m-d\TH:i:s\Z');
837
- break;
838
  }
839
  }
840
  }
841
 
842
- if( $chaveAcID == "" ) {
843
- if ($Order->hasShipments()){
844
- foreach ($Order->getShipmentsCollection() as $ship) {
845
- $shippment = Mage::getModel('sales/order_shipment')->loadByIncrementId( $ship->getIncrementId() );
846
- foreach ($shippment->getCommentsCollection() as $item) {
847
- $CommentCurr = $item->getComment();
848
-
849
- $nfeCount = strpos($CommentCurr, 'nfe:');
850
- $emissaoCount = strpos($CommentCurr, 'emiss');
851
- if( (strpos($CommentCurr, 'nfe:') !== false) && (strpos($CommentCurr, 'emiss') !== false) ) {
852
- $caracts = array("/", "-", ".");
853
- $nfeTmp = str_replace($caracts, "", $CommentCurr );
854
- $chaveAcID = substr( $nfeTmp, $nfeCount+4, 44);
855
- $nfeID = $chaveAcID;
856
-
857
- $date = substr( $CommentCurr, $emissaoCount+8, 19);
858
- $dateTmp = str_replace("/", "-", $date );
859
-
860
- $date = $this->formatDateTimeZone($dateTmp);
861
- }
862
  }
863
  }
864
  }
865
  }
866
-
867
- $retArr = array("number" => $nfeID, "date" => $date, "accessKey" => $chaveAcID);
868
- return $retArr;
869
  }
870
 
871
  /**
872
  * get tracking order
873
  *
874
- * * @param $storeID
875
  * @param $Order
876
  * @return array
877
  */
878
- public function getTrackingOrder($storeID, $Order){
879
  $TrackNum = '';
880
  $TrackTitle = '';
881
  $TrackCreate = '';
882
  $dateTrack = '';
883
-
884
  $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')
885
  ->setOrderFilter($Order)
886
  ->load();
887
  foreach ($shipmentCollection as $shipment){
 
888
  foreach($shipment->getAllTracks() as $tracknum){
889
  $TrackNum = $tracknum->getNumber();
890
  $TrackTitle = $tracknum->getTitle();
@@ -895,121 +974,150 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
895
  }
896
  }
897
 
898
- $days = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_estimate_date_field', $storeID);
 
 
 
899
 
900
- $days = ($days == "" || $days == null) ? 10 : $days;
901
- $stimatedDate = date('Y-m-d\TH:i:s\Z', strtotime("+".$days." days", strtotime($dateTrack)));
902
- return array("number" => $TrackNum,
903
- "carrier" => $TrackTitle,
904
- "date" => $dateTrack,
905
- "shippedDate" => $dateTrack,
906
- "url" => "",
907
- "estimateDate" => $stimatedDate);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
908
  }
909
 
910
  /**
911
  * update order in AM
912
  *
 
913
  * @param $Order
 
 
914
  */
915
- public function updateOrderAnyMarket($storeID, $Order){
916
- $ImportOrderSession = Mage::getSingleton('core/session')->getImportOrdersVariable();
917
- if( $ImportOrderSession != 'false' ) {
918
- $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
919
- $idOrder = $Order->getIncrementId();
920
- $status = $Order->getStatus();
921
- $anymarketorderupdt = Mage::getModel('db1_anymarket/anymarketorders')->load($idOrder, 'nmo_id_order');
922
 
923
- if( ($ConfigOrder == 0) ||
924
- ($anymarketorderupdt->getData('nmo_status_int') == 'Integrado') ||
925
- ($anymarketorderupdt->getData('nmo_status_int') == 'ERROR 02')){
 
926
 
927
- $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
928
- $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
 
 
929
 
930
- $headers = array(
931
- "Content-type: application/json",
932
- "Accept: */*",
933
- "gumgaToken: ".$TOKEN
934
- );
935
 
936
- if( ($anymarketorderupdt->getData('nmo_id_order') != null) && ($anymarketorderupdt->getData('nmo_id_anymarket') != null) ){
937
- $statuAM = $this->getStatusMageToAnyMarketOrderConfig($storeID, $status);
938
- if (strpos($statuAM, 'ERROR:') === false) {
939
- $params = array(
940
- "status" => $statuAM
941
- );
942
 
943
- $invoiceData = $this->getInvoiceOrder($Order);
944
- $trackingData = $this->getTrackingOrder($storeID, $Order);
 
945
 
946
- if ($invoiceData['number'] != '') {
947
- $params["invoice"] = $invoiceData;
948
- }
 
 
949
 
950
- if ($trackingData['number'] != '') {
951
- $params["tracking"] = $trackingData;
952
- }
953
 
954
- if( ($statuAM == "CONCLUDED" || $statuAM == "CANCELED" || $statuAM == "PAID_WAITING_SHIP" || $statuAM == "INVOICED" || $statuAM == "PAID_WAITING_DELIVERY" ) ||
955
- (isset($params["tracking"]) || isset($params["invoice"])) ){
956
- $IDOrderAnyMarket = $anymarketorderupdt->getData('nmo_id_seq_anymarket');
 
 
 
957
 
958
- $returnOrder = $this->CallAPICurl("PUT", $HOST."/v2/orders/".$IDOrderAnyMarket, $headers, $params);
 
 
 
959
 
960
- if($returnOrder['error'] == '1'){
961
- $anymarketorderupdt->setStatus("0");
962
- $anymarketorderupdt->setNmoStatusInt('ERROR 02');
963
- $anymarketorderupdt->setNmoDescError($returnOrder['return']);
964
- $anymarketorderupdt->setStores(array($storeID));
965
- $anymarketorderupdt->save();
966
- }
967
 
968
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
969
- $anymarketlog->setLogDesc( json_encode($returnOrder['return']) );
970
- $anymarketlog->setLogId( $idOrder );
971
- $anymarketlog->setLogJson( json_encode($returnOrder['json']) );
972
- $anymarketlog->setStores(array($storeID));
973
- $anymarketlog->setStatus("0");
974
- $anymarketlog->save();
975
- }else{
976
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
977
- $anymarketlog->setLogDesc( Mage::helper('db1_anymarket')->__('There was some error getting data Invoice or Tracking.') );
978
- $anymarketlog->setLogId( $idOrder );
979
- $anymarketlog->setLogJson('');
980
- $anymarketlog->setStores(array($storeID));
981
- $anymarketlog->setStatus("0");
982
- $anymarketlog->save();
983
- }
984
- }else{
985
- if($ConfigOrder == 0){
986
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
987
- $anymarketlog->setStatus("0");
988
- $anymarketlog->setLogDesc( $statuAM );
989
- $anymarketlog->setLogId( $idOrder );
990
- $anymarketlog->setStores(array($storeID));
991
- $anymarketlog->save();
992
- }
993
- }
994
- }else{
995
- $this->sendOrderToAnyMarket($storeID, $idOrder, $HOST, $TOKEN);
996
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
997
  }
998
- }
999
 
 
1000
  }
1001
 
1002
  /**
1003
  * send order to AM
1004
  *
1005
- * @param $idOrder
1006
- * @param $HOST
1007
- * @param $TOKEN
1008
  */
1009
- private function sendOrderToAnyMarket($storeID, $idOrder, $HOST, $TOKEN){
1010
  $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
1011
- if($ConfigOrder == 0 && $idOrder){
1012
- $Order = Mage::getModel('sales/order')->setStoreId($storeID)->loadByIncrementId( $idOrder );
 
 
1013
 
1014
  //TRATA OS ITEMS
1015
  $orderedItems = $Order->getAllVisibleItems();
@@ -1053,101 +1161,121 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
1053
  }
1054
 
1055
 
1056
- if( (strpos($statuAM, 'ERROR:') === false) && ($statuAM != '') ) {
1057
- $params = array(
1058
- 'marketPlaceId' => $idOrder,
1059
- "createdAt" => $this->formatDateTimeZone( $Order->getData('created_at') ),
1060
- "status" => $statuAM,
1061
- "marketPlace" => "ECOMMERCE",
1062
- "marketPlaceStatus" => $statuAM,
1063
- "marketPlaceUrl" => null,
1064
- "shipping" => array(
1065
- "city" => $shipping->getCity(),
1066
- "state" => $shipping->getRegion(),
1067
- "country" => $shipping->getCountry(),
1068
- "address" => $shipping->getStreetFull(),
1069
- "street" => $shipping->getStreet(1),
1070
- "number" => $shipping->getStreet(2),
1071
- "comment" => $shipping->getStreet(3),
1072
- "neighborhood" => $shipping->getStreet(4),
1073
- "zipCode" => $shipping->getPostcode()
1074
- ),
1075
- "buyer" => array(
1076
- "id" => 0,
1077
- "name" => $Order->getCustomerFirstname()." ".$Order->getCustomerLastname(),
1078
- "email" => $Order->getCustomerEmail(),
1079
- "document" => $docData,
1080
- "documentType" => $this->getDocumentType($docData),
1081
- "phone" => $shipping->getTelephone(),
1082
- ),
1083
- "items" => $orderedProductIds,
1084
- "payments" => array(
1085
- array(
1086
- "method" => $payment->getMethodInstance()->getTitle(),
1087
- "status" => "",
1088
- "value" => $Order->getBaseGrandTotal()
1089
- ),
1090
- ),
1091
- "discount" => floatval( $Order->getDiscountAmount() ) < 0 ? floatval( $Order->getDiscountAmount() )*-1 : $Order->getDiscountAmount(),
1092
- "freight" => $Order->getShippingAmount(),
1093
- "gross" => $Order->getBaseSubtotal(),
1094
- "total" => $Order->getBaseGrandTotal()
1095
- );
 
 
 
1096
 
1097
- $arrTracking = $this->getTrackingOrder($storeID, $Order);
1098
- $arrInvoice = $this->getInvoiceOrder($Order);
1099
 
1100
- if($arrTracking["number"] != ''){
1101
- $params["tracking"] = $arrTracking;
1102
- };
1103
 
1104
- if($arrInvoice["number"] != ''){
1105
- $params["invoice"] = $arrInvoice;
1106
- };
1107
 
1108
- $headers = array(
1109
- "Content-type: application/json",
1110
- "Accept: */*",
1111
- "gumgaToken: ".$TOKEN
1112
- );
1113
 
1114
- $returnOrder = $this->CallAPICurl("POST", $HOST."/v2/orders/", $headers, $params);
1115
 
1116
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
1117
- $anymarketlog->setLogDesc( json_encode($returnOrder['return']) );
1118
 
1119
- $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($idOrder, 'nmo_id_order');
1120
- $anymarketorders->setStatus("1");
1121
- $anymarketorders->setStores(array($storeID));
1122
- if($returnOrder['error'] == '1'){
 
1123
  $anymarketorders->setNmoStatusInt('ERROR 02');
1124
  $anymarketorders->setNmoDescError($returnOrder['return']);
1125
  }else{
1126
- $retOrderJSON = $returnOrder['return'];
1127
- $anymarketorders->setNmoStatusInt('Integrado');
1128
- $anymarketorders->setNmoDescError('');
1129
- $anymarketorders->setNmoIdAnymarket( $retOrderJSON->marketPlaceId );
1130
- $anymarketorders->setNmoIdSeqAnymarket( $retOrderJSON->id );
1131
-
1132
- $anymarketlog->setLogId( $retOrderJSON->marketPlaceId );
1133
- }
1134
 
1135
- $anymarketlog->setStores(array($storeID));
1136
- $anymarketlog->setLogJson( $returnOrder['json'] );
1137
- $anymarketlog->setStatus("0");
1138
- $anymarketlog->save();
1139
 
1140
- }else{
1141
- $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($idOrder, 'nmo_id_order');
1142
- $anymarketorders->setNmoStatusInt('ERROR 02');
1143
- $anymarketorders->setStores(array($storeID));
1144
- if($statuAM != ''){
1145
- $anymarketorders->setNmoDescError( $statuAM );
1146
- }else{
1147
- $anymarketorders->setNmoDescError( 'Status new não foi referenciado.' );
 
 
 
 
 
 
 
 
 
 
1148
  }
 
 
 
 
 
 
 
 
1149
  }
1150
 
 
 
 
 
 
1151
  $anymarketorders->setNmoIdOrder($idOrder);
1152
  $anymarketorders->save();
1153
  }
@@ -1162,7 +1290,6 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
1162
  public function listOrdersFromAnyMarketMagento($storeID){
1163
  $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
1164
  $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
1165
- $STATUSIMPORT = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_stauts_order_field', $storeID);
1166
 
1167
  $headers = array(
1168
  "Content-type: application/json",
@@ -1194,7 +1321,9 @@ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
1194
  foreach ($JsonReturn->content as $value) {
1195
  $IDOrderAnyMarket = $value->marketPlaceId;
1196
 
1197
- if (strpos($STATUSIMPORT, $value->status) !== false) {
 
 
1198
  $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->setStoreId($storeID);
1199
  $anymarketorders->load($IDOrderAnyMarket, 'nmo_id_anymarket');
1200
  if ($anymarketorders->getData('nmo_id_anymarket') == null || (is_array($anymarketorders->getData('store_id')) && !in_array($storeID, $anymarketorders->getData('store_id')))) {
9
  * @param $OrderRowData
10
  * @return string
11
  */
12
+ public function getStatusAnyMarketToMageOrderConfig($storeID, $OrderRowData){
13
  if($OrderRowData == null){
14
  $OrderRowData = "new";
15
  }
25
  $OrderReturn = $StatusOrderRow['orderStatusMG'];
26
  $statuses = Mage::getModel('sales/order_status')->getCollection()->joinStates()
27
  ->addFieldToFilter('main_table.status',array('eq'=>$OrderReturn));
 
28
 
29
  $StateReturn = $statuses->getFirstItem()->getData('state');
30
  break;
69
  }
70
  }
71
 
72
+ /**
73
+ * get estimated date from order comment
74
+ *
75
+ * @param $Order
76
+ * @return string
77
+ */
78
+ public function getEstimatedDateFromOrder( $Order ){
79
+ $estimatedDate = "";
80
+ foreach ($Order->getStatusHistoryCollection() as $item) {
81
+ $CommentCurr = $item->getComment();
82
+
83
+ $CommentCurr = str_replace(array("<br>"), "<br/>", $CommentCurr );
84
+ $iniEstimatedDate = strpos($CommentCurr, 'Entrega esperada para:');
85
+ if( $iniEstimatedDate !== false ) {
86
+ $estimatedDate = substr( $CommentCurr, $iniEstimatedDate+27, 19);
87
+ break;
88
+ }
89
+
90
+ }
91
+ return $estimatedDate;
92
+ }
93
+
94
+ /**
95
+ * get delivered date from order comment
96
+ *
97
+ * @param $Order
98
+ * @return string
99
+ */
100
+ public function getDeliveredDateFromOrder( $Order ){
101
+ $delivedDate = null;
102
+ foreach ($Order->getStatusHistoryCollection() as $item) {
103
+ $CommentCurr = strtolower($item->getComment());
104
+
105
+ $iniDelivedDate = strpos($CommentCurr, 'data de entrega:');
106
+ if( $iniDelivedDate !== false ) {
107
+ $delivedDate = substr( $CommentCurr, $iniDelivedDate+16, 19);
108
+ break;
109
+ }
110
+ }
111
+ return $delivedDate;
112
+ }
113
+
114
+ /**
115
+ * get estimated date from order comment
116
+ *
117
+ * @param $shipping
118
+ * @return string
119
+ */
120
+ public function getDatesFromShipping( $shipping ){
121
+ $estimatedDate = "";
122
+ $shippedDate = "";
123
+ foreach ($shipping->getCommentsCollection() as $item) {
124
+ $CommentCurr = strtolower($item->getComment());
125
+
126
+ $iniEstimatedDate = strpos($CommentCurr, 'data estimada de entrega:');
127
+ if ($iniEstimatedDate !== false) {
128
+ $estimatedDate = substr($CommentCurr, $iniEstimatedDate+30, 19);
129
+ }
130
+
131
+ $iniShippedDate = strpos($CommentCurr, 'data de entrega na transportadora:');
132
+ if ($iniShippedDate !== false) {
133
+ $shippedDate = substr($CommentCurr, $iniShippedDate + 39, 19);
134
+ }
135
+
136
+ }
137
+
138
+
139
+ $shippedDate = ($shippedDate != "") ? $this->formatDateTimeZone( str_replace("/", "-", $shippedDate ) ) : "";
140
+ $estimatedDate = ($estimatedDate != "") ? $this->formatDateTimeZone( str_replace("/", "-", $estimatedDate ) ) : "";
141
+ return array($estimatedDate, $shippedDate);
142
+ }
143
+
144
  /**
145
  * get status order MG to AM from configs
146
  *
294
 
295
  $this->getSpecificOrderFromAnyMarket($order->id, $order->token, $storeID);
296
 
297
+ if($order->token != 'notoken') {
298
+ $paramFeed = array(
299
+ "token" => $order->token
300
+ );
301
+ $this->CallAPICurl("PUT", $HOST . "/rest/api/v2/orders/feeds/" . $order->id, $headers, $paramFeed);
302
+ }
303
  }
304
  }
305
  }
328
  $IDOrderAnyMarket = $OrderJSON->marketPlaceId;
329
  $anymarketordersSpec = Mage::getModel('db1_anymarket/anymarketorders');
330
  $anymarketordersSpec->load($idSeqAnyMarket, 'nmo_id_seq_anymarket');
331
+ $OrderIDMage = '';
332
 
333
  if( ($anymarketordersSpec->getData('nmo_id_anymarket') == null) ||
334
  ($anymarketordersSpec->getData('nmo_status_int') == "Não integrado (AnyMarket)") ||
335
  ($anymarketordersSpec->getData('nmo_status_int') == "ERROR 01") ){
336
+
337
+ $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
338
+ if($ConfigOrder == 1) {
339
+ $statsConfig = $this->getStatusAnyMarketToMageOrderConfig($storeID, $OrderJSON->status);
340
+ $statusMage = $statsConfig["status"];
341
+
342
+ if (strpos($statusMage, 'ERROR:') === false) {
343
+ //TRATA OS PRODUTOS
344
+ $_products = array();
345
+ $shippingDesc = array();
346
+ foreach ($OrderJSON->items as $item) {
347
+
348
+ if( isset($item->shippings) ) {
349
+ foreach ($item->shippings as $shippItem) {
350
+ if (!in_array($shippItem->shippingtype, $shippingDesc)) {
351
+ array_push($shippingDesc, $shippItem->shippingtype);
 
 
352
  }
353
  }
354
+ }
355
 
356
+ $productLoaded = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $item->sku->partnerId);
357
+ if ($productLoaded) {
358
+ $arrayTMP = array(
359
+ 'product' => $productLoaded->getId(),
360
+ 'price' => $item->unit,
361
+ 'qty' => $item->amount,
362
+ );
363
+
364
+ if($productLoaded->getTypeID() == "bundle") {
365
+ $optionsBundle = Mage::helper('db1_anymarket/product')->getDetailsOfBundle($productLoaded);
366
+
367
+ $boundOpt = array();
368
+ $boundOptQty = array();
369
+ foreach ($optionsBundle as $detProd) {
370
+ $boundOpt[$detProd['option_id']] = $detProd['selection_id'];
371
+ $boundOptQty[$detProd['option_id']] = (float)$detProd['selection_qty'];
 
 
 
 
372
  }
373
 
374
+ $arrayTMP['bundle_option'] = $boundOpt;
375
+ $arrayTMP['bundle_option_qty'] = $boundOptQty;
376
+ }
 
 
 
 
377
 
378
+ array_push($_products, $arrayTMP);
379
+ } else {
380
+ $this->saveLogOrder('nmo_id_seq_anymarket',
381
+ $idSeqAnyMarket,
382
+ 'ERROR 01',
383
+ Mage::helper('db1_anymarket')->__('Product is not registered') . ' (SKU: ' . $item->sku->partnerId . ')',
384
+ $idSeqAnyMarket,
385
+ $IDOrderAnyMarket,
386
+ '',
387
+ $storeID);
388
+
389
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
390
+ $anymarketlog->setLogDesc(Mage::helper('db1_anymarket')->__('Product is not registered') . ' (Order: ' . $idSeqAnyMarket . ', SKU : ' . $item->sku->partnerId . ')');
391
+ $anymarketlog->setStores(array($storeID));
392
+ $anymarketlog->setStatus("0");
393
+ $anymarketlog->save();
394
+
395
+ $this->addMessageInBox($storeID, Mage::helper('db1_anymarket')->__('Error on synchronize order.'),
396
+ Mage::helper('db1_anymarket')->__('Error synchronizing order number: ') . "Anymarket(" . $IDOrderAnyMarket . ") <br/>" .
397
+ Mage::helper('db1_anymarket')->__('Product is not registered') . ' (SKU: ' . $item->sku->partnerId . ')',
398
+ '');
399
+ $stateProds = false;
400
+ break;
401
+ }
402
+ }
403
 
404
+ //verifica se criou o produto
405
+ if ($stateProds) {
406
+ //TRATA O CLIENTE
407
+ $document = null;
408
+ if (isset($OrderJSON->buyer->document)) {
409
+ $document = $OrderJSON->buyer->document;
 
 
 
 
 
 
 
410
  }
411
 
412
+ if ($document != null) {
413
+ try {
414
+ $AttrToDoc = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_doc_type_field', $storeID));
415
+ $groupCustomer = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_customer_group_field', $storeID);
 
 
 
416
 
417
+ $email = $OrderJSON->buyer->email;
418
+ $customer = Mage::getModel('customer/customer')
419
+ ->getCollection()
420
+ ->addFieldToFilter($AttrToDoc, $document)->load()->getFirstItem();
421
 
422
+ //caso nao ache pelo CPF valida se nao tem mascara
423
+ if(!$customer->getId()) {
424
+ if (strlen($document) == 11) {
425
+ $document = $this->Mask('###.###.###-##', $document);
426
+ } else {
427
+ $document = $this->Mask('##.###.###/####-##', $document);
428
+ }
429
 
430
  $customer = Mage::getModel('customer/customer')
431
  ->getCollection()
432
  ->addFieldToFilter($AttrToDoc, $document)->load()->getFirstItem();
433
 
434
+ //caso ainda nao encontrou valida se existe o email
435
  if(!$customer->getId()) {
 
 
 
 
 
 
436
  $customer = Mage::getModel('customer/customer')
437
  ->getCollection()
438
+ ->addFieldToFilter('email', $email)->load()->getFirstItem();
439
 
 
 
 
 
 
 
 
440
  }
441
+ }
442
 
443
+ $AddressShipBill = null;
444
 
445
+ $firstName = $OrderJSON->buyer->name;
446
+ $lastName = 'Lastname';
447
+ if ($firstName != '') {
448
+ $nameComplete = explode(" ", $firstName);
449
 
450
+ $lastNameP = array_slice($nameComplete, 1);
451
+ $lastNameImp = implode(" ", $lastNameP);
452
 
453
+ $firstName = array_shift($nameComplete);
454
+ $lastName = $lastNameImp == '' ? 'Lastname' : $lastNameImp;
455
+ }
456
 
457
+ $addressFullData = $this->getCompleteAddressOrder($storeID, $OrderJSON);
458
+ $regionCollection = Mage::getModel('directory/region')->getCollection();
459
+ $regionName = (isset($OrderJSON->shipping->state)) ? $OrderJSON->shipping->state : 'Não especificado';
460
+ $regionID = 0;
461
+ foreach ($regionCollection as $key) {
462
+ if( $key->getData('name') == $regionName){
463
+ $regionID = $key->getData('region_id');
464
+ break;
 
465
  }
466
+ }
467
 
468
+ $addressFullData = $this->getCompleteAddressOrder($storeID, $OrderJSON);
469
+
470
+ if ($customer->getId() == null) {
471
+ $_DataCustomer = array(
472
+ 'account' => array(
473
+ 'firstname' => $firstName,
474
+ 'lastname' => $lastName,
475
+ 'email' => $email,
476
+ $AttrToDoc => $document,
477
+ 'password' => 'a111111',
478
+ 'default_billing' => '_item1',
479
+ 'default_shipping' => '_item1',
480
+ 'store_id' => $storeID,
481
+ 'website_id' => Mage::app()->getWebsite()->getId(),
482
+ 'group_id' => $groupCustomer,
483
+ ),
484
+ 'address' => array(
485
+ '_item1' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  'firstname' => $firstName,
487
  'lastname' => $lastName,
488
  'street' => $addressFullData,
489
  'city' => (isset($OrderJSON->shipping->city)) ? $OrderJSON->shipping->city : 'Não especificado',
490
  'country_id' => 'BR',
 
491
  'region_id' => $regionID,
492
+ 'region' => (isset($OrderJSON->shipping->state)) ? $OrderJSON->shipping->state : 'Não especificado',
493
  'postcode' => (isset($OrderJSON->shipping->zipCode)) ? $OrderJSON->shipping->zipCode : 'Não especificado',
494
+ 'telephone' => $OrderJSON->buyer->phone,
495
+ ),
496
+ ),
497
+ );
498
+
499
+ $customerRet = Mage::helper('db1_anymarket/customergenerator')->createCustomer($_DataCustomer);
500
+ $customer = $customerRet['customer'];
501
+ $AddressShipBill = $customerRet['addr'];
502
+ } else {
503
+ //PERCORRE OS ENDERECOS PARA VER SE JA HA CADASTRADO O INFORMADO
504
+ $needRegister = true;
505
+ foreach ($customer->getAddresses() as $address) {
506
+ $zipCodeOrder = (isset($OrderJSON->shipping->zipCode)) ? $OrderJSON->shipping->zipCode : 'Não especificado';
507
+ $addressOrder = (isset($OrderJSON->shipping->address)) ? $OrderJSON->shipping->address : 'Frete não especificado.';
508
+ if (($address->getData('postcode') == $zipCodeOrder) && ($address->getData('street') == $addressOrder)) {
509
+ $AddressShipBill = $address;
510
+ $needRegister = false;
511
+ break;
512
  }
513
+ }
514
+
515
+ //CRIA O ENDERECO CASO NAO TENHA O INFORMADO
516
+ if ($needRegister) {
517
+ $address = Mage::getModel('customer/address');
518
+
519
+ $addressData = array(
520
+ 'firstname' => $firstName,
521
+ 'lastname' => $lastName,
522
+ 'street' => $addressFullData,
523
+ 'city' => (isset($OrderJSON->shipping->city)) ? $OrderJSON->shipping->city : 'Não especificado',
524
+ 'country_id' => 'BR',
525
+ 'region' => (isset($OrderJSON->shipping->state)) ? $OrderJSON->shipping->state : 'Não especificado',
526
+ 'region_id' => $regionID,
527
+ 'postcode' => (isset($OrderJSON->shipping->zipCode)) ? $OrderJSON->shipping->zipCode : 'Não especificado',
528
+ 'telephone' => $OrderJSON->buyer->phone
529
+ );
530
 
531
+ $address->setIsDefaultBilling(1);
532
+ $address->setIsDefaultShipping(1);
533
+ $address->addData($addressData);
534
+ $address->setPostIndex('_item1');
535
+ $customer->addAddress($address);
536
+ $customer->save();
537
  }
538
 
539
+ }
540
+
541
+ $infoMetPag = 'ANYMARKET';
542
+ $infoMetPagCom = array();
543
+ if( isset($OrderJSON->payments) ) {
544
+ foreach ($OrderJSON->payments as $payment) {
545
+ $infoMetPag = $payment->method;
546
+ if($payment->paymentMethodNormalized) {
547
+ $parcelas = isset($payment->installments) ? $payment->installments : '0';
548
+ array_push($infoMetPagCom, $payment->paymentMethodNormalized." - Parcelas: ".$parcelas );
549
  }
550
  }
551
+ }
552
 
553
+ $OrderIDMage = $this->create_order($storeID, $anymarketordersSpec, $_products, $customer, $IDOrderAnyMarket, $idSeqAnyMarket, $infoMetPag, $AddressShipBill, $AddressShipBill, $OrderJSON->freight, implode(",", $shippingDesc) );
554
+ $OrderCheck = Mage::getModel('sales/order')->loadByIncrementId($OrderIDMage);
 
555
 
556
+ $this->changeFeedOrder($HOST, $headers, $idSeqAnyMarket, $tokenFeed);
557
 
558
+ if ($OrderCheck->getId()) {
 
 
559
 
560
+ $comment = '<b>Código do Pedido no Canal de Vendas: </b>'.$OrderJSON->marketPlaceNumber.'<br>';
561
+ $comment .= '<b>Canal de Vendas: </b>'.$OrderJSON->marketPlace.'<br>';
 
 
 
 
 
562
 
563
+ if(isset($OrderJSON->shipping->promisedShippingTime)){
564
+ $dateTmpPromis = new DateTime($OrderJSON->shipping->promisedShippingTime);
565
+ $dateTmpPromis = date_format($dateTmpPromis, 'd/m/Y H:i:s');
 
 
 
566
 
567
+ $comment .= '<b>Entrega esperada para: </b>'.$dateTmpPromis.'<br>';
568
+ }
569
 
570
+ if( count($infoMetPagCom) > 0 ) {
571
+ foreach ($infoMetPagCom as $iMetPag) {
572
+ $comment .= '<b>Forma de Pagamento: </b>' . $iMetPag . '<br>';
573
+ }
574
+ }else{
575
+ $comment .= '<b>Forma de Pagamento: </b>Inf. não disponibilizada pelo marketplace.<br>';
576
  }
 
 
 
 
 
 
 
 
 
577
 
578
+ $addressComp = (isset($OrderJSON->shipping->address)) ? $OrderJSON->shipping->address : 'Não especificado';
579
+ $comment .= '<b>Endereço Completo: </b>'.$addressComp;
580
+
581
+ $OrderCheck->addStatusHistoryComment( $comment );
582
+ $OrderCheck->setEmailSent(false);
583
+ $OrderCheck->save();
584
+
585
+ $this->changeStatusOrder($storeID, $OrderJSON, $OrderIDMage);
586
  }
587
+ } catch (Exception $e) {
588
+ $orderCheckExcpt = Mage::getModel('sales/order')->loadByIncrementId($OrderIDMage);
589
+ $statusExpt = $orderCheckExcpt->getId() ? 'Integrado' : 'ERROR 01';
590
  $this->saveLogOrder('nmo_id_seq_anymarket',
591
  $idSeqAnyMarket,
592
+ $statusExpt,
593
+ 'System: ' . $e->getMessage(),
594
  $idSeqAnyMarket,
595
  $IDOrderAnyMarket,
596
+ $OrderIDMage,
597
  $storeID);
598
 
599
+ Mage::log($e, null, 'anymarket_exception.log');
 
 
 
 
 
 
 
 
 
600
  }
601
+ } else {
602
+ $this->saveLogOrder('nmo_id_seq_anymarket',
603
+ $idSeqAnyMarket,
604
+ 'ERROR 01',
605
+ Mage::helper('db1_anymarket')->__('Customer invalid or blank document.'),
606
+ $idSeqAnyMarket,
607
+ $IDOrderAnyMarket,
608
+ '',
609
+ $storeID);
610
+
611
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
612
+ $anymarketlog->setLogDesc('Error on import Order: ' . Mage::helper('db1_anymarket')->__('Customer invalid or blank document.'));
613
+ $anymarketlog->setStatus("0");
614
+ $anymarketlog->setStores(array($storeID));
615
+ $anymarketlog->save();
616
+
617
+ $this->addMessageInBox($storeID, Mage::helper('db1_anymarket')->__('Error on synchronize order.'),
618
+ Mage::helper('db1_anymarket')->__('Error synchronizing order number: ') . "Anymarket(" . $IDOrderAnyMarket . ") <br/>" .
619
+ Mage::helper('db1_anymarket')->__('Customer invalid or blank document.'),
620
+ '');
621
  }
 
 
 
 
 
 
622
  }
623
+ }
624
 
625
+ if ($tokenFeed != null && $tokenFeed != 'notoken') {
626
+ $paramFeed = array(
627
+ "token" => $tokenFeed
628
+ );
629
 
630
+ $this->CallAPICurl("PUT", $HOST . "/rest/api/v2/orders/feeds/" . $idSeqAnyMarket, $headers, $paramFeed);
 
631
  }
632
  }
633
  }else{
634
+ $statsConfig = $this->getStatusAnyMarketToMageOrderConfig($storeID, $OrderJSON->status);
635
+ $statusMage = $statsConfig["status"];
636
+ if (strpos($statusMage, 'ERROR:') === false) {
637
  if ($anymarketordersSpec->getData('nmo_id_order') != null) {
638
  $this->changeStatusOrder($storeID, $OrderJSON, $anymarketordersSpec->getData('nmo_id_order'));
639
  }
713
  Mage::getSingleton('core/session')->setImportOrdersVariable('false');
714
  $order = Mage::getModel('sales/order')->loadByIncrementId( $IDOrderMagento );
715
 
716
+ if( ($order->getData('state') == $stateMage) && ($order->getData('status') == $statusMage) ){
717
  return false;
718
  }
719
 
720
  $createRegPay = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_create_reg_pay_field', $storeID);
721
  $itemsarray = null;
722
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
723
  if( isset($JSON->invoice) && $StatusPedAnyMarket == 'INVOICED' ){
724
  if( $order->canInvoice() ){
725
  if(isset($JSON->invoice->accessKey) ) {
784
  }
785
  }
786
 
787
+ $order->setData('state', $stateMage);
788
+ $order->setStatus($statusMage, true);
789
+
790
+ if($stateMage == Mage_Sales_Model_Order::STATE_COMPLETE){
791
+ $history = $order->addStatusHistoryComment('Finalizado pelo AnyMarket.', false);
792
+ }else{
793
+ $history = $order->addStatusHistoryComment('', false);
794
+ }
795
+ $history->setIsCustomerNotified(false);
 
 
 
 
 
 
796
 
797
+ if($stateMage == Mage_Sales_Model_Order::STATE_CANCELED) {
798
+ foreach ($order->getAllItems() as $item) {
799
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct( $item->getProductId() );
800
+ if ($stockItem->getManageStock()) {
801
+ $stockItem->setData('qty', $stockItem->getQty() + $item->getQtyOrdered());
802
  }
803
+ $stockItem->save();
804
+
805
+ $item->setQtyCanceled($item->getQtyOrdered());
806
+ $item->save();
807
  }
808
+ }
809
+ $order->save();
810
 
811
+ if( $createRegPay == "1" && $StatusPedAnyMarket == 'PAID_WAITING_SHIP' ){
812
+ if( $order->canInvoice() ){
813
+ if( $this->checkIfCanCreateInvoice($order) ) {
814
+ $orderItems = $order->getAllItems();
815
+ foreach ($orderItems as $_eachItem) {
816
+ $opid = $_eachItem->getId();
817
+ $qty = $_eachItem->getQtyOrdered();
818
+ $itemsarray[$opid] = $qty;
819
+ }
820
+ $nfeString = "Registro de Pagamento criado por Anymarket";
821
+ Mage::getModel('sales/order_invoice_api')->create($order->getIncrementId(), $itemsarray, $nfeString, 0, 0);
822
+ }
823
+ }
824
  }
825
 
826
  $this->saveLogOrder('nmo_id_anymarket',
839
  $anymarketlog->save();
840
 
841
  Mage::getSingleton('core/session')->setImportOrdersVariable('true');
842
+ }
843
+ }
844
+
845
+ public function procInvoiceModelsToAnymarket($CommentCurr){
846
+ $nfeCount = strpos($CommentCurr, 'nfe:');
847
+ $emissaoCount = strpos($CommentCurr, 'emiss');
848
+ if( (strpos($CommentCurr, 'nfe:') !== false) && (strpos($CommentCurr, 'emiss') !== false) ) {
849
+ $caracts = array("/", "-", ".");
850
+ $nfeTmp = str_replace($caracts, "", $CommentCurr );
851
+ $chaveAcID = substr( $nfeTmp, $nfeCount+4, 44);
852
+
853
+ $date = substr( $CommentCurr, $emissaoCount+8, 19);
854
+ $dateTmp = str_replace("/", "-", $date );
855
+
856
+ $date = $this->formatDateTimeZone($dateTmp);
857
+ return array("key" => $chaveAcID, "date" => $date);
858
  }else{
859
+ return null;
 
 
 
 
860
  }
861
  }
862
 
875
  $invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId( $inv->getIncrementId() );
876
  foreach ($invoice->getCommentsCollection() as $item) {
877
  $CommentCurr = $item->getComment();
878
+ $invData = $this->procInvoiceModelsToAnymarket($CommentCurr);
879
+ if( $invData ){
880
+ $nfeID = $invData["key"];
881
+ $chaveAcID = $invData["key"];
882
+ $date = $invData["date"];
883
+ break;
 
 
 
 
 
 
 
884
  }
885
  }
886
  }
890
  foreach ($Order->getStatusHistoryCollection() as $item) {
891
  $CommentCurr = $item->getComment();
892
 
893
+ $invData = $this->procInvoiceModelsToAnymarket($CommentCurr);
894
+ if( $invData ){
895
+ $nfeID = $invData["key"];
896
+ $chaveAcID = $invData["key"];
897
+ $date = $invData["date"];
898
+ }else {
899
+ $CommentCurr = str_replace(array(" ", "<b>", "</b>"), "", $CommentCurr);
900
+ $CommentCurr = str_replace(array("<br>"), "<br/>", $CommentCurr);
901
+ $chaveAcesso = strpos($CommentCurr, 'ChavedeAcesso:');
902
+ if ((strpos($CommentCurr, 'ChavedeAcesso:') !== false)) {
903
+ $chaveAcID = substr($CommentCurr, $chaveAcesso + 14, 44);
904
+
905
+ $notaFiscal = strpos($CommentCurr, 'Notafiscal:');
906
+ if ((strpos($CommentCurr, 'Notafiscal:') !== false)) {
907
+ $endNF = strpos($CommentCurr, '<br/>');
908
+ $nfeID = substr($CommentCurr, $notaFiscal + 11, $endNF - 11);
909
+
910
+ if ($nfeID == "") {
911
+ $nfeID = $chaveAcID;
912
+ }
913
+ } else {
914
+ $notaFiscal = strpos($CommentCurr, 'NrNF-e');
915
+ if ($notaFiscal !== false) {
916
+ $endNF = strpos($CommentCurr, '<br/>');
917
+ $nfeID = substr($CommentCurr, $notaFiscal + 6, $endNF - 6);
918
 
919
+ if ($nfeID == "") {
920
+ $nfeID = $chaveAcID;
921
+ }
922
+ }
923
  }
924
+
925
+ $dateTmp = new DateTime(str_replace("/", "-", $item->getData('created_at')));
926
+ $date = date_format($dateTmp, 'Y-m-d\TH:i:s\Z');
927
+ break;
928
  }
 
 
 
 
929
  }
930
  }
931
  }
932
 
933
+ if( $chaveAcID == "" && $Order->hasShipments() ) {
934
+ foreach ($Order->getShipmentsCollection() as $ship) {
935
+ $shippment = Mage::getModel('sales/order_shipment')->loadByIncrementId( $ship->getIncrementId() );
936
+ foreach ($shippment->getCommentsCollection() as $item) {
937
+ $CommentCurr = $item->getComment();
938
+ $invData = $this->procInvoiceModelsToAnymarket($CommentCurr);
939
+ if( $invData ){
940
+ $nfeID = $invData["key"];
941
+ $chaveAcID = $invData["key"];
942
+ $date = $invData["date"];
 
 
 
 
 
 
 
 
 
 
943
  }
944
  }
945
  }
946
  }
947
+ return array("number" => $nfeID, "date" => $date, "accessKey" => $chaveAcID);
 
 
948
  }
949
 
950
  /**
951
  * get tracking order
952
  *
 
953
  * @param $Order
954
  * @return array
955
  */
956
+ public function getTrackingOrder($Order){
957
  $TrackNum = '';
958
  $TrackTitle = '';
959
  $TrackCreate = '';
960
  $dateTrack = '';
961
+ $datesRes = array("", "");
962
  $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')
963
  ->setOrderFilter($Order)
964
  ->load();
965
  foreach ($shipmentCollection as $shipment){
966
+ $datesRes = $this->getDatesFromShipping($shipment);
967
  foreach($shipment->getAllTracks() as $tracknum){
968
  $TrackNum = $tracknum->getNumber();
969
  $TrackTitle = $tracknum->getTitle();
974
  }
975
  }
976
 
977
+ $retArray = array("number" => $TrackNum,
978
+ "carrier" => $TrackTitle,
979
+ "date" => $dateTrack,
980
+ "url" => "");
981
 
982
+ $retArray["shippedDate"] = ($datesRes[1] != "") ? $datesRes[1] : $dateTrack;
983
+ if($datesRes[0] != "") {
984
+ $retArray["estimateDate"] = $datesRes[0];
985
+ }else{
986
+ $estFromOrder = $this->getEstimatedDateFromOrder($Order);
987
+ if($estFromOrder != ""){
988
+ $retArray["estimateDate"] = $estFromOrder;
989
+ }
990
+ }
991
+
992
+ $deliveredDate = $this->getDeliveredDateFromOrder( $Order );
993
+ if( $deliveredDate ){
994
+ $retArray['deliveredDate'] = $this->formatDateTimeZone(str_replace("/", "-", $deliveredDate ));
995
+ }
996
+
997
+ return $retArray;
998
+ }
999
+
1000
+ /**
1001
+ * update or create order in AM
1002
+ *
1003
+ * @param $Order
1004
+ */
1005
+ public function updateOrCreateOrderAnyMarket($storeID, $Order){
1006
+ $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
1007
+ $canUpdateOrder = $this->updateOrderAnymarket($storeID, $Order);
1008
+ if (!$canUpdateOrder && $ConfigOrder == 0) {
1009
+ $this->sendOrderToAnyMarket($storeID, $Order);
1010
+ }
1011
  }
1012
 
1013
  /**
1014
  * update order in AM
1015
  *
1016
+ * @param $storeID
1017
  * @param $Order
1018
+ *
1019
+ * @return bool
1020
  */
1021
+ public function updateOrderAnymarket($storeID, $Order){
1022
+ $idOrder = $Order->getIncrementId();
1023
+ $anymarketorderupdt = Mage::getModel('db1_anymarket/anymarketorders')->load($idOrder, 'nmo_id_order');
 
 
 
 
1024
 
1025
+ if($anymarketorderupdt->getData('nmo_id_seq_anymarket') == null ||
1026
+ $anymarketorderupdt->getData('nmo_id_seq_anymarket') == ""){
1027
+ return false;
1028
+ }
1029
 
1030
+ if( ($anymarketorderupdt->getData('nmo_status_int') != 'ERROR 02') &&
1031
+ ($anymarketorderupdt->getData('nmo_status_int') != 'Integrado')){
1032
+ return false;
1033
+ }
1034
 
1035
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
1036
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
 
 
 
1037
 
1038
+ $status = $Order->getStatus();
1039
+ $statuAM = $this->getStatusMageToAnyMarketOrderConfig($storeID, $status);
1040
+ if (strpos($statuAM, 'ERROR:') !== false) {
1041
+ return false;
1042
+ }
 
1043
 
1044
+ if($statuAM == "PENDING" ){
1045
+ return false;
1046
+ }
1047
 
1048
+ $headers = array(
1049
+ "Content-type: application/json",
1050
+ "Accept: */*",
1051
+ "gumgaToken: ".$TOKEN
1052
+ );
1053
 
1054
+ $params = array(
1055
+ "status" => $statuAM
1056
+ );
1057
 
1058
+ $invoiceData = $this->getInvoiceOrder($Order);
1059
+ if ($invoiceData['accessKey'] != '') {
1060
+ $params["invoice"] = $invoiceData;
1061
+ }else if($statuAM == "INVOICED"){
1062
+ return false;
1063
+ }
1064
 
1065
+ $trackingData = $this->getTrackingOrder($Order);
1066
+ if ($trackingData['number'] != '') {
1067
+ $params["tracking"] = $trackingData;
1068
+ }
1069
 
1070
+ if( isset( $params["tracking"] ) && $statuAM == "CONCLUDED" ){
1071
+ $deliveredDate = $params["tracking"];
1072
+ if( !isset($deliveredDate['deliveredDate']) ){
1073
+ return false;
1074
+ }
1075
+ }
 
1076
 
1077
+ if( isset($params["tracking"]) || isset($params["invoice"]) ){
1078
+ $IDOrderAnyMarket = $anymarketorderupdt->getData('nmo_id_seq_anymarket');
1079
+
1080
+ $returnOrder = $this->CallAPICurl("PUT", $HOST."/v2/orders/".$IDOrderAnyMarket, $headers, $params);
1081
+ if($returnOrder['error'] == '1'){
1082
+ $anymarketorderupdt->setStatus("0");
1083
+ $anymarketorderupdt->setNmoStatusInt('ERROR 02');
1084
+ $anymarketorderupdt->setNmoDescError($returnOrder['return']);
1085
+ $anymarketorderupdt->setStores(array($storeID));
1086
+ $anymarketorderupdt->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1087
  }
1088
+
1089
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
1090
+ $anymarketlog->setLogDesc( json_encode($returnOrder['return']) );
1091
+ $anymarketlog->setLogId( $idOrder );
1092
+ $anymarketlog->setLogJson( json_encode($returnOrder['json']) );
1093
+ $anymarketlog->setStores(array($storeID));
1094
+ $anymarketlog->setStatus("0");
1095
+ $anymarketlog->save();
1096
+ }else{
1097
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
1098
+ $anymarketlog->setLogDesc( Mage::helper('db1_anymarket')->__('There was some error getting data Invoice or Tracking.') );
1099
+ $anymarketlog->setLogId( $idOrder );
1100
+ $anymarketlog->setLogJson('');
1101
+ $anymarketlog->setStores(array($storeID));
1102
+ $anymarketlog->setStatus("0");
1103
+ $anymarketlog->save();
1104
  }
 
1105
 
1106
+ return true;
1107
  }
1108
 
1109
  /**
1110
  * send order to AM
1111
  *
1112
+ * @param $storeID
1113
+ * @param $Order
 
1114
  */
1115
+ public function sendOrderToAnyMarket($storeID, $Order){
1116
  $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
1117
+ if($ConfigOrder == 0){
1118
+ $idOrder = $Order->getIncrementId();
1119
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
1120
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
1121
 
1122
  //TRATA OS ITEMS
1123
  $orderedItems = $Order->getAllVisibleItems();
1161
  }
1162
 
1163
 
1164
+ if( (strpos($statuAM, 'ERROR:') !== false) || ($statuAM == '') ) {
1165
+ return false;
1166
+ }
1167
+ $dateTmp = new DateTime(str_replace("/", "-", $Order->getData('created_at') ));
1168
+ $params = array(
1169
+ 'marketPlaceId' => $idOrder,
1170
+ "createdAt" => date_format($dateTmp, 'Y-m-d\TH:i:s\Z'),
1171
+ "status" => $statuAM,
1172
+ "marketPlace" => "ECOMMERCE",
1173
+ "marketPlaceStatus" => $statuAM,
1174
+ "marketPlaceUrl" => null,
1175
+ "shipping" => array(
1176
+ "city" => $shipping->getCity(),
1177
+ "state" => $shipping->getRegion(),
1178
+ "country" => $shipping->getCountry(),
1179
+ "address" => $shipping->getStreetFull(),
1180
+ "street" => $shipping->getStreet(1),
1181
+ "number" => $shipping->getStreet(2),
1182
+ "comment" => $shipping->getStreet(3),
1183
+ "neighborhood" => $shipping->getStreet(4),
1184
+ "zipCode" => $shipping->getPostcode()
1185
+ ),
1186
+ "buyer" => array(
1187
+ "id" => 0,
1188
+ "name" => $Order->getCustomerFirstname()." ".$Order->getCustomerLastname(),
1189
+ "email" => $Order->getCustomerEmail(),
1190
+ "document" => $docData,
1191
+ "documentType" => $this->getDocumentType($docData),
1192
+ "phone" => $shipping->getTelephone(),
1193
+ ),
1194
+ "items" => $orderedProductIds,
1195
+ "payments" => array(
1196
+ array(
1197
+ "method" => $payment->getMethodInstance()->getTitle(),
1198
+ "status" => "",
1199
+ "value" => $Order->getBaseGrandTotal()
1200
+ ),
1201
+ ),
1202
+ "discount" => floatval( $Order->getDiscountAmount() ) < 0 ? floatval( $Order->getDiscountAmount() )*-1 : $Order->getDiscountAmount(),
1203
+ "freight" => $Order->getShippingAmount(),
1204
+ "gross" => $Order->getBaseSubtotal(),
1205
+ "total" => $Order->getBaseGrandTotal()
1206
+ );
1207
 
1208
+ $arrTracking = $this->getTrackingOrder($Order);
1209
+ $arrInvoice = $this->getInvoiceOrder($Order);
1210
 
1211
+ if($arrTracking["number"] != ''){
1212
+ $params["tracking"] = $arrTracking;
1213
+ };
1214
 
1215
+ if($arrInvoice["number"] != ''){
1216
+ $params["invoice"] = $arrInvoice;
1217
+ };
1218
 
1219
+ $headers = array(
1220
+ "Content-type: application/json",
1221
+ "Accept: */*",
1222
+ "gumgaToken: ".$TOKEN
1223
+ );
1224
 
1225
+ $returnOrder = $this->CallAPICurl("POST", $HOST."/v2/orders/", $headers, $params);
1226
 
1227
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
1228
+ $anymarketlog->setLogDesc( json_encode($returnOrder['return']) );
1229
 
1230
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($idOrder, 'nmo_id_order');
1231
+ $anymarketorders->setStatus("1");
1232
+ $anymarketorders->setStores(array($storeID));
1233
+ if($returnOrder['error'] == '1'){
1234
+ if( strpos($returnOrder['return'], 'existe uma venda de ECOMMERCE cadastrada com o') === false ) {
1235
  $anymarketorders->setNmoStatusInt('ERROR 02');
1236
  $anymarketorders->setNmoDescError($returnOrder['return']);
1237
  }else{
1238
+ $OrderResp = json_decode($returnOrder['return']);
 
 
 
 
 
 
 
1239
 
1240
+ $IDAnymarket = strpos($OrderResp, 'ID Anymarket');
1241
+ if ($IDAnymarket !== false) {
1242
+ $idAnymarketOrder = substr($OrderResp, $IDAnymarket+14, 100);
1243
+ $idAnymarketOrder = str_replace(']"}', "", $idAnymarketOrder );
1244
 
1245
+ if( is_numeric ($idAnymarketOrder) ) {
1246
+ $anymarketorders->setNmoStatusInt('Integrado');
1247
+ $anymarketorders->setNmoDescError('');
1248
+ $anymarketorders->setNmoIdSeqAnymarket($idAnymarketOrder);
1249
+ $anymarketorders->setNmoIdOrder($idOrder);
1250
+ $anymarketorders->setNmoIdAnymarket($idOrder);
1251
+ $anymarketorders->save();
1252
+
1253
+ $anymarketlog->setStores(array($storeID));
1254
+ $anymarketlog->setLogDesc("Pedido encontrado [" . $idAnymarketOrder . "] e realizado o relacionamento.");
1255
+ $anymarketlog->setStatus("0");
1256
+ $anymarketlog->save();
1257
+
1258
+ $OrderRetry = Mage::getModel('sales/order')->loadByIncrementId($idOrder);
1259
+ $this->updateOrCreateOrderAnyMarket($storeID, $OrderRetry);
1260
+ return $this;
1261
+ }
1262
+ }
1263
  }
1264
+ }else{
1265
+ $retOrderJSON = $returnOrder['return'];
1266
+ $anymarketorders->setNmoStatusInt('Integrado');
1267
+ $anymarketorders->setNmoDescError('');
1268
+ $anymarketorders->setNmoIdAnymarket( $retOrderJSON->marketPlaceId );
1269
+ $anymarketorders->setNmoIdSeqAnymarket( $retOrderJSON->id );
1270
+
1271
+ $anymarketlog->setLogId( $retOrderJSON->marketPlaceId );
1272
  }
1273
 
1274
+ $anymarketlog->setStores(array($storeID));
1275
+ $anymarketlog->setLogJson( $returnOrder['json'] );
1276
+ $anymarketlog->setStatus("0");
1277
+ $anymarketlog->save();
1278
+
1279
  $anymarketorders->setNmoIdOrder($idOrder);
1280
  $anymarketorders->save();
1281
  }
1290
  public function listOrdersFromAnyMarketMagento($storeID){
1291
  $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
1292
  $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
 
1293
 
1294
  $headers = array(
1295
  "Content-type: application/json",
1321
  foreach ($JsonReturn->content as $value) {
1322
  $IDOrderAnyMarket = $value->marketPlaceId;
1323
 
1324
+ $statsConfig = $this->getStatusAnyMarketToMageOrderConfig($storeID, $value->status);
1325
+ $statusMage = $statsConfig["status"];
1326
+ if (strpos($statusMage, 'ERROR:') === false) {
1327
  $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->setStoreId($storeID);
1328
  $anymarketorders->load($IDOrderAnyMarket, 'nmo_id_anymarket');
1329
  if ($anymarketorders->getData('nmo_id_anymarket') == null || (is_array($anymarketorders->getData('store_id')) && !in_array($storeID, $anymarketorders->getData('store_id')))) {
app/code/community/DB1/AnyMarket/Helper/Ordergenerator.php CHANGED
@@ -252,9 +252,10 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
252
 
253
  unset($arrToComp1['qty']);
254
  unset($arrToComp2['qty']);
 
 
255
  if (md5(serialize($arrToComp1)) == md5(serialize($arrToComp2))) {
256
  $prod['qty'] += $prodToGroup['qty'];
257
-
258
  if( isset($prod['bundle_option_qty']) ) {
259
  foreach ($prod['bundle_option_qty'] as $key => $value) {
260
  $prod['bundle_option_qty'][$key] += $prodToGroup['bundle_option_qty'][$key];
@@ -269,7 +270,6 @@ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
269
  array_push($ctrlProds, $prod['product']);
270
  }
271
  }
272
-
273
  return $arryProdAt;
274
  }
275
 
252
 
253
  unset($arrToComp1['qty']);
254
  unset($arrToComp2['qty']);
255
+ unset($arrToComp1['bundle_option_qty']);
256
+ unset($arrToComp2['bundle_option_qty']);
257
  if (md5(serialize($arrToComp1)) == md5(serialize($arrToComp2))) {
258
  $prod['qty'] += $prodToGroup['qty'];
 
259
  if( isset($prod['bundle_option_qty']) ) {
260
  foreach ($prod['bundle_option_qty'] as $key => $value) {
261
  $prod['bundle_option_qty'][$key] += $prodToGroup['bundle_option_qty'][$key];
270
  array_push($ctrlProds, $prod['product']);
271
  }
272
  }
 
273
  return $arryProdAt;
274
  }
275
 
app/code/community/DB1/AnyMarket/Helper/Product.php CHANGED
@@ -341,8 +341,13 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
341
  * @return Mage_Catalog_Model_Product
342
  */
343
  private function update_configurable_product($storeID, $idProd, $dataProdConfig, $simpleProducts){
 
 
 
 
 
344
  $productGenerator = Mage::helper('db1_anymarket/productgenerator');
345
- $product = $productGenerator->updateConfigurableProduct($storeID, $idProd, $dataProdConfig, $simpleProducts);
346
 
347
  $returnProd['return'] = Mage::helper('db1_anymarket')->__('Configurable product Updated').' ('.$product->getSku().')';
348
  $returnProd['error'] = '0';
@@ -351,7 +356,6 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
351
 
352
  return $product;
353
  }
354
-
355
  /**
356
  * create simple prod in magento
357
  *
@@ -490,6 +494,8 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
490
  * @param $product
491
  * @param $skusParam
492
  * @param $storeID
 
 
493
  */
494
  public function sendImageSkuToAnyMarket($storeID, $product, $skusParam) {
495
  $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
@@ -500,56 +506,61 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
500
  "Cache-Control: no-cache",
501
  "gumgaToken: ".$TOKEN
502
  );
 
503
  // SINCRONIZA AS FOTOS E SKUS
504
  if($product->getData('id_anymarket') != "" || $product->getData('id_anymarket') != 0) {
505
  $skusProd = $this->CallAPICurl("GET", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/skus", $headers, null);
506
  if ($skusProd['error'] == '0') {
 
 
 
 
 
507
  foreach ($skusParam as $skuPut) {
508
  $prodSimple = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $skuPut['partnerId']);
509
- if ($prodSimple->getData('id_anymarket') != '') {
510
- $paramSku = array(
511
- "title" => $skuPut['title'],
512
- "partnerId" => $skuPut['partnerId'],
513
- "ean" => $skuPut['ean'],
514
- "amount" => $skuPut['amount'],
515
- "price" => $skuPut['price'],
516
- );
517
 
518
- if (isset($skuPut['variations'])) {
519
- foreach ($skuPut['variations'] as $variationPut) {
520
- Mage::helper('db1_anymarket/image')->sendImageToAnyMarket($storeID, $prodSimple, $variationPut);
521
- }
522
- $paramSku['variations'] = $skuPut['variations'];
523
- } else {
524
- Mage::helper('db1_anymarket/image')->sendImageToAnyMarket($storeID, $product, null);
525
  }
 
 
 
 
526
 
527
- $flagHSku = '';
528
- if (isset($skusProd['return'])) {
529
- foreach ($skusProd['return'] as $skuAM) {
530
- if ($skuAM->partnerId == $prodSimple->getSku()) {
531
- $flagHSku = $skuAM->id;
532
- break;
533
- }
534
  }
535
  }
 
536
 
537
- if ($flagHSku != '') {
538
- $skuProdReturn = $this->CallAPICurl("PUT", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/skus/" . $flagHSku, $headers, $paramSku);
539
-
540
- if ($skuProdReturn['error'] == '0') {
541
- $skuProdReturn['return'] = Mage::helper('db1_anymarket')->__('SKU Updated') . ' (' . $skuPut['partnerId'] . ')';
542
- }
543
- } else {
544
- $skuProdReturn = $this->CallAPICurl("POST", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/skus", $headers, $paramSku);
545
 
546
- if ($skuProdReturn['error'] == '0') {
547
- $skuProdReturn['return'] = Mage::helper('db1_anymarket')->__('SKU Created') . ' (' . $skuPut['partnerId'] . ')';
548
- }
549
  }
 
 
550
 
551
- $this->saveLogsProds($storeID, "1", $skuProdReturn, $prodSimple);
 
 
552
  }
 
 
 
553
  }
554
  } else {
555
  $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
@@ -1316,7 +1327,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1316
  * @param $storeID
1317
  */
1318
  public function getStockProductAnyMarket($storeID, $IDProd){
1319
- $product = Mage::getModel('catalog/product')->load( $IDProd );
1320
  if($product->getIdAnymarket() != ''){
1321
  $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
1322
  $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
@@ -1481,7 +1492,8 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1481
  "idProduct" => $IDProdTrans,
1482
  "idInClient" => isset($transmission->sku->idInClient) ? $transmission->sku->idInClient : $transmission->sku->partnerId,
1483
  "price" => $transmission->sku->price,
1484
- "stockAmount" => $transmission->sku->amount,
 
1485
  "ean" => isset($transmission->sku->ean) ? $transmission->sku->ean : null,
1486
  "variations" => $arrVarSku
1487
  )
@@ -1505,6 +1517,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1505
  "idProduct" => $IDProdTrans,
1506
  "idInClient" => isset($transmission->sku->idInClient) ? $transmission->sku->idInClient : $transmission->sku->partnerId,
1507
  "price" => $transmission->sku->price,
 
1508
  "stockAmount" => $transmission->sku->amount,
1509
  "ean" => isset($transmission->sku->ean) ? $transmission->sku->ean : null,
1510
  "variations" => $arrVarSku
@@ -1556,15 +1569,14 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1556
  }
1557
 
1558
  $typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
1559
- if( $typeSincOrder == 0 ){
1560
  if( $transmissionReturn['error'] == '0' ) {
1561
  $transmissionStock = $transmissionReturn['return'];
1562
-
1563
  $skuToLoad = isset($transmissionStock->sku->partnerId) ? $transmissionStock->sku->partnerId : $transmissionStock->product->id;
1564
  $prodLoaded = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $skuToLoad);
1565
  if ($prodLoaded != null) {
1566
  $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($prodLoaded->getId());
1567
- if ($stockItem->getManageStock()) {
1568
  $stockItem->setData('qty', $transmissionStock->sku->amount);
1569
  if ($transmissionStock->sku->amount > 0) {
1570
  $stockItem->setData('is_in_stock', 1);
@@ -1572,14 +1584,21 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1572
  $stockItem->setData('is_in_stock', 0);
1573
  }
1574
  $stockItem->save();
1575
- }
1576
 
1577
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
1578
- $anymarketlog->setLogDesc( "Stock Updated" );
1579
- $anymarketlog->setLogId( $prodLoaded->getSku() );
1580
- $anymarketlog->setStatus("0");
1581
- $anymarketlog->setStores(array($storeID));
1582
- $anymarketlog->save();
 
 
 
 
 
 
 
 
1583
 
1584
  $prodRet = $prodLoaded->getSku()." - Stock Updated";
1585
  }else{
@@ -1713,6 +1732,9 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1713
  Mage::app()->getCacheInstance()->cleanType('config');
1714
  }
1715
 
 
 
 
1716
  $brand = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_brand_field', $storeID);
1717
  $nbm = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_nbm_field', $storeID);
1718
  $model = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_model_field', $storeID);
@@ -1780,6 +1802,9 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1780
  'description' => $sku->title,
1781
  'short_description' => $sku->title,
1782
  $priceField => $sku->price,
 
 
 
1783
  'created_at' => strtotime('now'),
1784
  'updated_at' => strtotime('now'),
1785
  'id_anymarket' => $sku->idProduct,
@@ -1844,6 +1869,9 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1844
  $product->setData('weight', $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight);
1845
 
1846
  $product->setData($priceField, $sku->price);
 
 
 
1847
  $product->setData($brand, $this->procAttrConfig($brand, $ProdsJSON->brand, 0));
1848
  $product->setData($model, $this->procAttrConfig($model, $ProdsJSON->model, 0));
1849
  $product->setData($video_url, $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0));
@@ -1859,7 +1887,7 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1859
  $product->setData($warranty_text, $this->procAttrConfig($warranty_text, $ProdsJSON->warranty, 0));
1860
  $product->setData('id_anymarket', $sku->idProduct);
1861
  $product->setData('categoria_anymarket', $ProdsJSON->category);
1862
- $product->setData('name', $ProdsJSON->title);
1863
  $product->setStatus(1);
1864
  $product->save();
1865
 
@@ -1953,8 +1981,8 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1953
  $anymarketlog->setStores(array($storeID));
1954
  $anymarketlog->save();
1955
  }
1956
- // PROD SIMPLES
1957
  }else{
 
1958
  foreach ($ProdsJSON->skus as $ProdJSON) {
1959
  $skuProd = $ProdJSON;
1960
  }
@@ -1982,6 +2010,9 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
1982
  'sku' => $IDSkuJsonProd,
1983
  'name' => $skuProd->title,
1984
  $priceField => $skuProd->price,
 
 
 
1985
  'created_at' => strtotime('now'),
1986
  'updated_at' => strtotime('now'),
1987
  'id_anymarket' => $ProdsJSON->id,
@@ -2068,6 +2099,9 @@ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
2068
  }
2069
 
2070
  $product->setData($priceField, $skuProd->price);
 
 
 
2071
 
2072
  if( $typeSincOrder == 0 ) {
2073
  $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
341
  * @return Mage_Catalog_Model_Product
342
  */
343
  private function update_configurable_product($storeID, $idProd, $dataProdConfig, $simpleProducts){
344
+ $productsIDs = array();
345
+ foreach ($simpleProducts as $prodVal) {
346
+ array_push($productsIDs, $prodVal['Id']);
347
+ }
348
+
349
  $productGenerator = Mage::helper('db1_anymarket/productgenerator');
350
+ $product = $productGenerator->updateConfigurableProduct($storeID, $idProd, $dataProdConfig, $productsIDs);
351
 
352
  $returnProd['return'] = Mage::helper('db1_anymarket')->__('Configurable product Updated').' ('.$product->getSku().')';
353
  $returnProd['error'] = '0';
356
 
357
  return $product;
358
  }
 
359
  /**
360
  * create simple prod in magento
361
  *
494
  * @param $product
495
  * @param $skusParam
496
  * @param $storeID
497
+ *
498
+ * @return Boolean
499
  */
500
  public function sendImageSkuToAnyMarket($storeID, $product, $skusParam) {
501
  $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
506
  "Cache-Control: no-cache",
507
  "gumgaToken: ".$TOKEN
508
  );
509
+
510
  // SINCRONIZA AS FOTOS E SKUS
511
  if($product->getData('id_anymarket') != "" || $product->getData('id_anymarket') != 0) {
512
  $skusProd = $this->CallAPICurl("GET", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/skus", $headers, null);
513
  if ($skusProd['error'] == '0') {
514
+ if($product->getTypeID() == "configurable" && $product->getData('integra_images_root_anymarket') == 1 ){
515
+ //obtem as imagens do produto(Config)
516
+ Mage::helper('db1_anymarket/image')->sendImageToAnyMarket($storeID, $product, null);
517
+ }
518
+
519
  foreach ($skusParam as $skuPut) {
520
  $prodSimple = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $skuPut['partnerId']);
521
+ $paramSku = array(
522
+ "title" => $skuPut['title'],
523
+ "partnerId" => $skuPut['partnerId'],
524
+ "ean" => $skuPut['ean'],
525
+ "amount" => $skuPut['amount'],
526
+ "price" => $skuPut['price'],
527
+ );
 
528
 
529
+ if (isset($skuPut['variations'])) {
530
+ foreach ($skuPut['variations'] as $variationPut) {
531
+ Mage::helper('db1_anymarket/image')->sendImageToAnyMarket($storeID, $prodSimple, $variationPut);
 
 
 
 
532
  }
533
+ $paramSku['variations'] = $skuPut['variations'];
534
+ } else {
535
+ Mage::helper('db1_anymarket/image')->sendImageToAnyMarket($storeID, $product, null);
536
+ }
537
 
538
+ $flagHSku = '';
539
+ if (isset($skusProd['return'])) {
540
+ foreach ($skusProd['return'] as $skuAM) {
541
+ if ($skuAM->partnerId == $prodSimple->getSku()) {
542
+ $flagHSku = $skuAM->id;
543
+ break;
 
544
  }
545
  }
546
+ }
547
 
548
+ if ($flagHSku != '') {
549
+ $skuProdReturn = $this->CallAPICurl("PUT", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/skus/" . $flagHSku, $headers, $paramSku);
 
 
 
 
 
 
550
 
551
+ if ($skuProdReturn['error'] == '0') {
552
+ $skuProdReturn['return'] = Mage::helper('db1_anymarket')->__('SKU Updated') . ' (' . $skuPut['partnerId'] . ')';
 
553
  }
554
+ } else {
555
+ $skuProdReturn = $this->CallAPICurl("POST", $HOST . "/v2/products/" . $product->getData('id_anymarket') . "/skus", $headers, $paramSku);
556
 
557
+ if ($skuProdReturn['error'] == '0') {
558
+ $skuProdReturn['return'] = Mage::helper('db1_anymarket')->__('SKU Created') . ' (' . $skuPut['partnerId'] . ')';
559
+ }
560
  }
561
+
562
+ $this->saveLogsProds($storeID, "1", $skuProdReturn, $prodSimple);
563
+
564
  }
565
  } else {
566
  $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
1327
  * @param $storeID
1328
  */
1329
  public function getStockProductAnyMarket($storeID, $IDProd){
1330
+ $product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $IDProd );
1331
  if($product->getIdAnymarket() != ''){
1332
  $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
1333
  $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
1492
  "idProduct" => $IDProdTrans,
1493
  "idInClient" => isset($transmission->sku->idInClient) ? $transmission->sku->idInClient : $transmission->sku->partnerId,
1494
  "price" => $transmission->sku->price,
1495
+ "specialPrice" => ($transmission->sku->price != $transmission->sku->discountPrice) ? $transmission->sku->discountPrice : null,
1496
+ "stockAmount" => $transmission->sku->amount,
1497
  "ean" => isset($transmission->sku->ean) ? $transmission->sku->ean : null,
1498
  "variations" => $arrVarSku
1499
  )
1517
  "idProduct" => $IDProdTrans,
1518
  "idInClient" => isset($transmission->sku->idInClient) ? $transmission->sku->idInClient : $transmission->sku->partnerId,
1519
  "price" => $transmission->sku->price,
1520
+ "specialPrice" => ($transmission->sku->price != $transmission->sku->discountPrice) ? $transmission->sku->discountPrice : null,
1521
  "stockAmount" => $transmission->sku->amount,
1522
  "ean" => isset($transmission->sku->ean) ? $transmission->sku->ean : null,
1523
  "variations" => $arrVarSku
1569
  }
1570
 
1571
  $typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
1572
+ if( $typeSincOrder == 1 ){
1573
  if( $transmissionReturn['error'] == '0' ) {
1574
  $transmissionStock = $transmissionReturn['return'];
 
1575
  $skuToLoad = isset($transmissionStock->sku->partnerId) ? $transmissionStock->sku->partnerId : $transmissionStock->product->id;
1576
  $prodLoaded = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $skuToLoad);
1577
  if ($prodLoaded != null) {
1578
  $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($prodLoaded->getId());
1579
+ if( ($stockItem->getManageStock()) && ($stockItem->getData('qty') != $transmissionStock->sku->amount) ) {
1580
  $stockItem->setData('qty', $transmissionStock->sku->amount);
1581
  if ($transmissionStock->sku->amount > 0) {
1582
  $stockItem->setData('is_in_stock', 1);
1584
  $stockItem->setData('is_in_stock', 0);
1585
  }
1586
  $stockItem->save();
 
1587
 
1588
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
1589
+ $anymarketlog->setLogDesc( "Stock Updated: ".$transmissionStock->sku->amount );
1590
+ $anymarketlog->setLogId( $prodLoaded->getSku() );
1591
+ $anymarketlog->setStatus("0");
1592
+ $anymarketlog->setStores(array($storeID));
1593
+ $anymarketlog->save();
1594
+ }else{
1595
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
1596
+ $anymarketlog->setLogDesc( "Estoques iguais." );
1597
+ $anymarketlog->setLogId( $prodLoaded->getSku() );
1598
+ $anymarketlog->setStatus("0");
1599
+ $anymarketlog->setStores(array($storeID));
1600
+ $anymarketlog->save();
1601
+ }
1602
 
1603
  $prodRet = $prodLoaded->getSku()." - Stock Updated";
1604
  }else{
1732
  Mage::app()->getCacheInstance()->cleanType('config');
1733
  }
1734
 
1735
+ $specialToDate = date('Y-m-dTH:i:sZ', strtotime('+5 years'));
1736
+ $specialFromDate = date('Y-m-dTH:i:sZ', strtotime('-1 years'));
1737
+
1738
  $brand = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_brand_field', $storeID);
1739
  $nbm = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_nbm_field', $storeID);
1740
  $model = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_model_field', $storeID);
1802
  'description' => $sku->title,
1803
  'short_description' => $sku->title,
1804
  $priceField => $sku->price,
1805
+ 'special_price' => $sku->specialPrice,
1806
+ 'special_to_date' => $sku->specialPrice != null ? $specialToDate : null,
1807
+ 'special_from_date' => $sku->specialPrice != null ? $specialFromDate : null,
1808
  'created_at' => strtotime('now'),
1809
  'updated_at' => strtotime('now'),
1810
  'id_anymarket' => $sku->idProduct,
1869
  $product->setData('weight', $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight);
1870
 
1871
  $product->setData($priceField, $sku->price);
1872
+ $product->setData('special_price', $sku->specialPrice);
1873
+ $product->setData('special_to_date', $sku->specialPrice != null ? $specialToDate : null);
1874
+ $product->setData('special_from_date', $sku->specialPrice != null ? $specialFromDate : null);
1875
  $product->setData($brand, $this->procAttrConfig($brand, $ProdsJSON->brand, 0));
1876
  $product->setData($model, $this->procAttrConfig($model, $ProdsJSON->model, 0));
1877
  $product->setData($video_url, $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0));
1887
  $product->setData($warranty_text, $this->procAttrConfig($warranty_text, $ProdsJSON->warranty, 0));
1888
  $product->setData('id_anymarket', $sku->idProduct);
1889
  $product->setData('categoria_anymarket', $ProdsJSON->category);
1890
+ $product->setData('name', $sku->title);
1891
  $product->setStatus(1);
1892
  $product->save();
1893
 
1981
  $anymarketlog->setStores(array($storeID));
1982
  $anymarketlog->save();
1983
  }
 
1984
  }else{
1985
+ // PROD SIMPLES
1986
  foreach ($ProdsJSON->skus as $ProdJSON) {
1987
  $skuProd = $ProdJSON;
1988
  }
2010
  'sku' => $IDSkuJsonProd,
2011
  'name' => $skuProd->title,
2012
  $priceField => $skuProd->price,
2013
+ 'special_price' => $skuProd->specialPrice,
2014
+ 'special_to_date' => $skuProd->specialPrice != null ? $specialToDate : null,
2015
+ 'special_from_date' => $skuProd->specialPrice != null ? $specialFromDate : null,
2016
  'created_at' => strtotime('now'),
2017
  'updated_at' => strtotime('now'),
2018
  'id_anymarket' => $ProdsJSON->id,
2099
  }
2100
 
2101
  $product->setData($priceField, $skuProd->price);
2102
+ $product->setData('special_price', $skuProd->specialPrice);
2103
+ $product->setData('special_to_date', $skuProd->specialPrice != null ? $specialToDate : null);
2104
+ $product->setData('special_from_date', $skuProd->specialPrice != null ? $specialFromDate : null);
2105
 
2106
  if( $typeSincOrder == 0 ) {
2107
  $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
app/code/community/DB1/AnyMarket/Helper/Productgenerator.php CHANGED
@@ -62,7 +62,8 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
62
  ),
63
  'images' => array(),
64
  'stock_item' => array(
65
- 'use_config_manage_stock' => '0',
 
66
  'manage_stock' => '1',
67
  'min_sale_qty' => '1',
68
  'max_sale_qty' => '',
@@ -206,7 +207,7 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
206
 
207
  $configurableProductsData = array();
208
  $configurableAttributesData = $this->getConfigurableAttributes($AttributeIds);
209
- //$configurableAttributesData = $confProduct->getTypeInstance()->getConfigurableAttributesAsArray($confProduct);
210
  foreach ($simpleProducts as $simpleProduct) {
211
  $sProd = Mage::getModel('catalog/product')->load( $simpleProduct['Id'] );
212
 
@@ -221,6 +222,8 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
221
 
222
  $configurableProductsData[ $sProd->getId() ] = $simpleProductsData;
223
  $configurableAttributesData[0]['values'][] = $simpleProductsData;
 
 
224
  }
225
  $confProduct->setCanSaveConfigurableAttributes(true);
226
 
@@ -237,13 +240,24 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
237
  foreach ($dataProdConfig as $key => $value) {
238
  $confProduct->setData($key, $value);
239
  }
 
 
 
 
 
 
 
 
 
 
 
240
  $confProduct->save();
241
  $sku = $dataProdConfig['sku'];
242
  foreach ($dataProdConfig['images'] as $image) {
243
  $this->importImages($confProduct, $image, $sku);
244
  }
245
 
246
- return $confProduct;
247
  }
248
 
249
  /**
@@ -252,28 +266,61 @@ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
252
  * @param $storeID
253
  * @param $idProd
254
  * @param array $dataProdConfig
255
- * @param array $simpleProducts
256
  * @return Mage_Catalog_Model_Product
257
  */
258
- public function updateConfigurableProduct($storeID, $idProd, $dataProdConfig = array() , $simpleProducts = array()){
259
- $confProduct = Mage::getModel('catalog/product')->load( $idProd );
260
- $simplesToAddConfig = array();
261
- foreach ($simpleProducts as $simpleProduct) {
262
- array_push( $simplesToAddConfig, $simpleProduct['Id'] );
263
- }
264
 
265
- //ADICIONA OS JA EXISTENTES NO PRODUTO
266
  $childProducts = Mage::getModel('catalog/product_type_configurable')
267
- ->getUsedProducts(null, $confProduct);
268
 
269
  foreach($childProducts as $child) {
270
- array_push( $simplesToAddConfig, $child->getId() );
271
  }
272
 
273
- $simplesToAddConfig = array_unique($simplesToAddConfig);
274
-
275
- Mage::getResourceSingleton('catalog/product_type_configurable')
276
- ->saveProducts($confProduct, $simplesToAddConfig);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
 
278
  Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
279
  $confProduct = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $idProd );
62
  ),
63
  'images' => array(),
64
  'stock_item' => array(
65
+ 'use_config_manage_stock' => '1',
66
+ 'inventory_manage_stock' => '1',
67
  'manage_stock' => '1',
68
  'min_sale_qty' => '1',
69
  'max_sale_qty' => '',
207
 
208
  $configurableProductsData = array();
209
  $configurableAttributesData = $this->getConfigurableAttributes($AttributeIds);
210
+ $simpleProductIds = array();
211
  foreach ($simpleProducts as $simpleProduct) {
212
  $sProd = Mage::getModel('catalog/product')->load( $simpleProduct['Id'] );
213
 
222
 
223
  $configurableProductsData[ $sProd->getId() ] = $simpleProductsData;
224
  $configurableAttributesData[0]['values'][] = $simpleProductsData;
225
+
226
+ array_push($simpleProductIds, $simpleProduct['Id']);
227
  }
228
  $confProduct->setCanSaveConfigurableAttributes(true);
229
 
240
  foreach ($dataProdConfig as $key => $value) {
241
  $confProduct->setData($key, $value);
242
  }
243
+
244
+ $stockConfig = array(
245
+ 'use_config_manage_stock' => '1',
246
+ 'inventory_manage_stock' => '1',
247
+ 'manage_stock' => '1',
248
+ 'min_sale_qty' => '1',
249
+ 'max_sale_qty' => '',
250
+ 'is_in_stock' => '1',
251
+ );
252
+ $confProduct->setStockData( $stockConfig );
253
+
254
  $confProduct->save();
255
  $sku = $dataProdConfig['sku'];
256
  foreach ($dataProdConfig['images'] as $image) {
257
  $this->importImages($confProduct, $image, $sku);
258
  }
259
 
260
+ return $this->updateConfigurableProduct($storeID, $confProduct->getId(), $dataProdConfig, $simpleProductIds);
261
  }
262
 
263
  /**
266
  * @param $storeID
267
  * @param $idProd
268
  * @param array $dataProdConfig
269
+ * @param array $simpleProductIds
270
  * @return Mage_Catalog_Model_Product
271
  */
272
+ public function updateConfigurableProduct($storeID, $idProd, $dataProdConfig = array() , $simpleProductIds = array()){
273
+ $mainProduct = Mage::getModel('catalog/product')->load( $idProd );
 
 
 
 
274
 
 
275
  $childProducts = Mage::getModel('catalog/product_type_configurable')
276
+ ->getUsedProducts(null, $mainProduct);
277
 
278
  foreach($childProducts as $child) {
279
+ array_push( $simpleProductIds, $child->getId() );
280
  }
281
 
282
+ $mainProduct->setConfigurableProductsData(array_flip($simpleProductIds));
283
+ $productType = $mainProduct->getTypeInstance(true);
284
+ $productType->setProduct($mainProduct);
285
+ $attributesData = $productType->getConfigurableAttributesAsArray();
286
+ if (empty($attributesData)) {
287
+ // Auto generation if configurable product has no attribute
288
+ $attributeIds = array();
289
+ foreach ($productType->getSetAttributes() as $attribute) {
290
+ if ($productType->canUseAttribute($attribute)) {
291
+ $attributeIds[] = $attribute->getAttributeId();
292
+ }
293
+ }
294
+ $productType->setUsedProductAttributeIds($attributeIds);
295
+ $attributesData = $productType->getConfigurableAttributesAsArray();
296
+ }
297
+ if (!empty($configurableAttributes)){
298
+ foreach ($attributesData as $idx => $val) {
299
+ if (!in_array($val['attribute_id'], $configurableAttributes)) {
300
+ unset($attributesData[$idx]);
301
+ }
302
+ }
303
+ }
304
+ $products = Mage::getModel('catalog/product')->getCollection()
305
+ ->addIdFilter($simpleProductIds);
306
+ if (count($products)) {
307
+ foreach ($attributesData as &$attribute) {
308
+ $attribute['label'] = $attribute['frontend_label'];
309
+ $attributeCode = $attribute['attribute_code'];
310
+ foreach ($products as $product) {
311
+ $product->load($product->getId());
312
+ $optionId = $product->getData($attributeCode);
313
+
314
+ $attribute['values'][$optionId] = array(
315
+ 'value_index' => $optionId,
316
+ 'is_percent' => 0,
317
+ 'pricing_value' => $product->getPrice(),
318
+ );
319
+ }
320
+ }
321
+ $mainProduct->setConfigurableAttributesData($attributesData);
322
+ $mainProduct->save();
323
+ }
324
 
325
  Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
326
  $confProduct = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $idProd );
app/code/community/DB1/AnyMarket/Helper/Queue.php CHANGED
@@ -60,16 +60,7 @@ class DB1_AnyMarket_Helper_Queue extends DB1_AnyMarket_Helper_Data
60
  if ($item['nmq_table'] == 'ORDER') {
61
  try {
62
  if ($typImp == 'IMP') {
63
- $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->setStoreId($storeID);
64
- $anymarketorders->load($IdItemQueue, 'nmo_id_anymarket');
65
- //Import
66
- if ($anymarketorders->getNmoStatusInt() != "Não integrado (Magento)") {
67
- $idAnyMarket = $anymarketorders->getNmoIdSeqAnymarket();
68
- if ($idAnyMarket) {
69
- $idReg = $anymarketorders->getId();
70
- Mage::helper('db1_anymarket/order')->getSpecificOrderFromAnyMarket($idAnyMarket, "notoken", $storeID);
71
- }
72
- }
73
  } else {
74
  $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->setStoreId($storeID);
75
  $anymarketorders->load($IdItemQueue, 'nmo_id_order');
@@ -77,7 +68,7 @@ class DB1_AnyMarket_Helper_Queue extends DB1_AnyMarket_Helper_Data
77
  if ($anymarketorders->getNmoStatusInt() != "Não integrado (AnyMarket)") {
78
  $idOrderToLoad = ($anymarketorders->getNmoIdOrder() == null) ? $IdItemQueue : $anymarketorders->getNmoIdOrder();
79
  $Order = Mage::getModel('sales/order')->loadByIncrementId( $idOrderToLoad );
80
- Mage::helper('db1_anymarket/order')->updateOrderAnyMarket($storeID, $Order);
81
  }
82
  }
83
 
@@ -85,14 +76,33 @@ class DB1_AnyMarket_Helper_Queue extends DB1_AnyMarket_Helper_Data
85
  Mage::logException($e);
86
  }
87
  } else if ($item['nmq_table'] == 'STOCK') {
88
- $product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $IdItemQueue );
89
-
90
- // TRATA STOCK
91
- if ($product) {
92
- $filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
93
- $ProdStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
94
- Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product->getId(), $ProdStock->getQty(), $product->getData($filter));
95
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  } else if ($item['nmq_table'] == 'PRODUCT') {
97
  // EXPORT PRODUCT
98
  $typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
@@ -165,6 +175,29 @@ class DB1_AnyMarket_Helper_Queue extends DB1_AnyMarket_Helper_Data
165
 
166
  }
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  /**
169
  * process Stocks By CRON
170
  */
60
  if ($item['nmq_table'] == 'ORDER') {
61
  try {
62
  if ($typImp == 'IMP') {
63
+ Mage::helper('db1_anymarket/order')->getSpecificOrderFromAnyMarket($IdItemQueue, "notoken", $storeID);
 
 
 
 
 
 
 
 
 
64
  } else {
65
  $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->setStoreId($storeID);
66
  $anymarketorders->load($IdItemQueue, 'nmo_id_order');
68
  if ($anymarketorders->getNmoStatusInt() != "Não integrado (AnyMarket)") {
69
  $idOrderToLoad = ($anymarketorders->getNmoIdOrder() == null) ? $IdItemQueue : $anymarketorders->getNmoIdOrder();
70
  $Order = Mage::getModel('sales/order')->loadByIncrementId( $idOrderToLoad );
71
+ Mage::helper('db1_anymarket/order')->updateOrCreateOrderAnyMarket($storeID, $Order);
72
  }
73
  }
74
 
76
  Mage::logException($e);
77
  }
78
  } else if ($item['nmq_table'] == 'STOCK') {
79
+ if ($typImp == 'EXP') {
80
+ $product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $IdItemQueue );
81
+ if ($product) {
82
+ $filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
83
+ $ProdStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
84
+ Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product->getId(), $ProdStock->getQty(), $product->getData($filter));
85
+ }
86
+ } else {
87
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
88
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
89
+
90
+ $headers = array(
91
+ "Content-type: application/json",
92
+ "Accept: */*",
93
+ "gumgaToken: " . $TOKEN
94
+ );
95
+
96
+ $listTransmissions = array();
97
+ array_push($listTransmissions, array(
98
+ "id" => $IdItemQueue,
99
+ "token" => "notoken"
100
+ )
101
+ );
102
+
103
+ $JSON = json_encode($listTransmissions);
104
+ Mage::helper('db1_anymarket/product')->getSpecificFeedProduct($storeID, json_decode($JSON), $headers, $HOST);
105
+ }
106
  } else if ($item['nmq_table'] == 'PRODUCT') {
107
  // EXPORT PRODUCT
108
  $typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
175
 
176
  }
177
 
178
+
179
+ /**
180
+ * process Orders with erros 01 By CRON
181
+ */
182
+ public function processOrdersWithError01(){
183
+ $allStores = Mage::helper('db1_anymarket')->getAllStores();
184
+ foreach ($allStores as $store) {
185
+ $storeID = $store['store_id'];
186
+ $cronEnabled = Mage::getStoreConfig('anymarket_section/anymarket_cron_group/anymarket_order_field', $storeID);
187
+ $orderSync = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
188
+
189
+ if( $cronEnabled == '1' && $orderSync == '1' ) {
190
+ $ordersError = Mage::getModel('db1_anymarket/anymarketorders')
191
+ ->getCollection()
192
+ ->addFilter('nmo_status_int', 'ERROR 01');
193
+
194
+ foreach ($ordersError as $order) {
195
+ Mage::helper('db1_anymarket/queue')->addQueue($storeID, $order->getData('nmo_id_seq_anymarket'), 'IMP', 'ORDER');
196
+ }
197
+ }
198
+ }
199
+ }
200
+
201
  /**
202
  * process Stocks By CRON
203
  */
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketattributes.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketbrands.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketimage.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Admin search model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Adminhtml_Search_Anymarketimage extends Varien_Object
25
+ {
26
+ /**
27
+ * Load search results
28
+ *
29
+ * @access public
30
+ * @return DB1_AnyMarket_Model_Adminhtml_Search_Anymarketimage
31
+ *
32
+ */
33
+ public function load()
34
+ {
35
+ $arr = array();
36
+ if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
37
+ $this->setResults($arr);
38
+ return $this;
39
+ }
40
+ $collection = Mage::getResourceModel('db1_anymarket/anymarketimage_collection')
41
+ ->addFieldToFilter('log_desc', array('like' => $this->getQuery().'%'))
42
+ ->setCurPage($this->getStart())
43
+ ->setPageSize($this->getLimit())
44
+ ->load();
45
+ foreach ($collection->getItems() as $anymarketimage) {
46
+ $arr[] = array(
47
+ 'id' => 'anymarketimage/1/'.$anymarketimage->getId(),
48
+ 'type' => Mage::helper('db1_anymarket')->__('AnyMarket Image'),
49
+ 'name' => $anymarketimage->getLogDesc(),
50
+ 'description' => $anymarketimage->getLogDesc(),
51
+ 'url' => Mage::helper('adminhtml')->getUrl(
52
+ '*/anymarket_anymarketimage/edit',
53
+ array('id'=>$anymarketimage->getId())
54
+ ),
55
+ );
56
+ }
57
+ $this->setResults($arr);
58
+ return $this;
59
+ }
60
+ }
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketlog.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketorders.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketproducts.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketqueue.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketattributes.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api/V2.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketbrands.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketbrands/Api.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketbrands/Api/V2.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketcategories.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api/V2.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketimage.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarketbrands model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Anymarketimage extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'db1_anymarket_anymarketimage';
31
+ const CACHE_TAG = 'db1_anymarket_anymarketimage';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'db1_anymarket_anymarketimage';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'anymarketimage';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('db1_anymarket/anymarketimage');
58
+ }
59
+
60
+ /**
61
+ * before save anymarketimage
62
+ *
63
+ * @access protected
64
+ * @return DB1_AnyMarket_Model_Anymarketimage
65
+
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ return parent::_beforeSave();
70
+ }
71
+
72
+ /**
73
+ * save anymarketbrands relation
74
+ *
75
+ * @access public
76
+ * @return DB1_AnyMarket_Model_Anymarketbrands
77
+
78
+ */
79
+ protected function _afterSave()
80
+ {
81
+ return parent::_afterSave();
82
+ }
83
+
84
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketlog.php CHANGED
@@ -107,6 +107,10 @@ class DB1_AnyMarket_Model_Anymarketlog extends Mage_Core_Model_Abstract
107
  }
108
  $this->setUpdatedAt($now);
109
  }
 
 
 
 
110
  }else {
111
  $this->_dataSaveAllowed = false;
112
  }
107
  }
108
  $this->setUpdatedAt($now);
109
  }
110
+
111
+ if( $this->getLogDesc() == "" && $this->getLogJson() == "" ){
112
+ $this->_dataSaveAllowed = false;
113
+ }
114
  }else {
115
  $this->_dataSaveAllowed = false;
116
  }
app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api/V2.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketorders.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api.php CHANGED
@@ -90,7 +90,14 @@ class DB1_AnyMarket_Model_Anymarketorders_Api extends Mage_Api_Model_Resource_Ab
90
  $TOKEN = $store['token'];
91
 
92
  if ($TOKEN != '') {
93
- $ret = Mage::helper('db1_anymarket/order')->getSpecificOrderFromAnyMarket($data['id'], "notoken", $storeID);
 
 
 
 
 
 
 
94
  }
95
  }
96
  }
90
  $TOKEN = $store['token'];
91
 
92
  if ($TOKEN != '') {
93
+ $sincMode = Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_operation_type_imp_field', $storeID);
94
+ if( $sincMode == "1" ) {
95
+ Mage::helper('db1_anymarket/queue')->addQueue($storeID, $data['id'], 'IMP', 'ORDER');
96
+ $ret = "Adicionado a fila do Magento";
97
+ }else{
98
+ $ret = Mage::helper('db1_anymarket/order')->getSpecificOrderFromAnyMarket($data['id'], "notoken", $storeID);
99
+ }
100
+
101
  }
102
  }
103
  }
app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api/V2.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketproducts.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api.php CHANGED
@@ -91,24 +91,38 @@ class DB1_AnyMarket_Model_Anymarketproducts_Api extends Mage_Api_Model_Resource_
91
  $TOKEN = $store['token'];
92
 
93
  if ($TOKEN != '') {
94
-
95
- $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
96
-
97
- $headers = array(
98
- "Content-type: application/json",
99
- "Accept: */*",
100
- "gumgaToken: " . $TOKEN
101
- );
102
-
103
- $listTransmissions = array();
104
- array_push($listTransmissions, array(
105
- "id" => $data['id'],
106
- "token" => "notoken"
107
- )
108
- );
109
-
110
- $JSON = json_encode($listTransmissions);
111
- $ret = Mage::helper('db1_anymarket/product')->getSpecificFeedProduct($storeID, json_decode($JSON), $headers, $HOST);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
  }
114
  }
91
  $TOKEN = $store['token'];
92
 
93
  if ($TOKEN != '') {
94
+ $sincMode = Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_operation_type_imp_field', $storeID);
95
+ if( $sincMode == "1" ) {
96
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
97
+ if($typeSincProd == "1") {
98
+ Mage::helper('db1_anymarket/queue')->addQueue($storeID, $data['id'], 'IMP', 'PRODUCT');
99
+ }else{
100
+ $typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
101
+ if( $typeSincOrder == "1" ){
102
+ Mage::helper('db1_anymarket/queue')->addQueue($storeID, $data['id'], 'IMP', 'STOCK');
103
+ }
104
+ }
105
+
106
+ $ret = "Adicionado na fila Magento.";
107
+ }else{
108
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
109
+
110
+ $headers = array(
111
+ "Content-type: application/json",
112
+ "Accept: */*",
113
+ "gumgaToken: " . $TOKEN
114
+ );
115
+
116
+ $listTransmissions = array();
117
+ array_push($listTransmissions, array(
118
+ "id" => $data['id'],
119
+ "token" => "notoken"
120
+ )
121
+ );
122
+
123
+ $JSON = json_encode($listTransmissions);
124
+ $ret = Mage::helper('db1_anymarket/product')->getSpecificFeedProduct($storeID, json_decode($JSON), $headers, $HOST);
125
+ }
126
  }
127
  }
128
  }
app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api/V2.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketqueue.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api/V2.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Cron.php CHANGED
@@ -22,8 +22,8 @@ class DB1_AnyMarket_Model_Cron{
22
  Mage::helper('db1_anymarket/queue')->processQueue("CRON");
23
  }
24
 
25
- public function sincOrders(){
26
- Mage::helper('db1_anymarket/queue')->processOrders();
27
  }
28
 
29
  /**
22
  Mage::helper('db1_anymarket/queue')->processQueue("CRON");
23
  }
24
 
25
+ public function sincOrdersWithErrors(){
26
+ Mage::helper('db1_anymarket/queue')->processOrdersWithError01();
27
  }
28
 
29
  /**
app/code/community/DB1/AnyMarket/Model/Observer.php CHANGED
@@ -120,25 +120,105 @@ class DB1_AnyMarket_Model_Observer {
120
  * @param $observer
121
  * @return $this
122
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  public function updateOrderAnyMarketObs($observer){
124
- $storeID = $observer->getEvent()->getOrder()->getStoreId();
125
- $OrderID = $observer->getEvent()->getOrder()->getIncrementId();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  try {
127
  if(Mage::registry('order_save_observer_executed_'.$OrderID )){
128
  Mage::unregister( 'order_save_observer_executed_'.$OrderID );
129
  return $this;
130
  }
131
-
132
  Mage::register('order_save_observer_executed_'.$OrderID, true);
133
- $order = $observer->getEvent()->getOrder();
134
 
135
  if( $this->asyncMode($storeID) ){
136
  Mage::helper('db1_anymarket/queue')->addQueue($storeID, $OrderID, 'EXP', 'ORDER');
137
  }else{
138
- Mage::helper('db1_anymarket/order')->updateOrderAnyMarket($storeID, $order );
 
 
 
 
 
 
139
  }
140
 
141
- //DECREMENTA STOCK ANYMARKET
142
  $orderItems = $order->getItemsCollection();
143
  $filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
144
  foreach ($orderItems as $item){
@@ -152,14 +232,15 @@ class DB1_AnyMarket_Model_Observer {
152
  Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product_id, $stock->getQty(), $_product->getData($filter));
153
  }
154
  }
 
155
  Mage::unregister( 'order_save_observer_executed_'.$OrderID );
156
  } catch (Exception $e) {
157
  Mage::unregister( 'order_save_observer_executed_'.$OrderID );
158
  Mage::logException($e);
159
  }
160
-
161
  }
162
 
 
163
  /**
164
  * @param $observer
165
  */
@@ -176,6 +257,8 @@ class DB1_AnyMarket_Model_Observer {
176
 
177
  /**
178
  * @param $observer
 
 
179
  */
180
  public function catalogInventorySave($observer){
181
  $ImportOrderSession = Mage::getSingleton('core/session')->getImportOrdersVariable();
120
  * @param $observer
121
  * @return $this
122
  */
123
+ public function saveShippingObs($observer){
124
+ if (Mage::registry('salesOrderShipmentSaveBeforeTriggered')) {
125
+ return $this;
126
+ }
127
+
128
+ $shipment = $observer->getEvent()->getShipment();
129
+ if ($shipment) {
130
+ $shipped_date = Mage::app()->getRequest()->getParam('shipped_date');
131
+ $estimated_date = Mage::app()->getRequest()->getParam('estimated_date');
132
+
133
+ if ($shipped_date != "" && $estimated_date != ""){
134
+
135
+ $comment = 'Informações inseridas pelo Anymarket:<br>';
136
+ $comment .= '<b>Data de Entrega na Transportadora: </b>' . $shipped_date . '<br>';
137
+ $comment .= '<b>Data Estimada de Entrega: </b>' . $estimated_date . '<br>';
138
+
139
+ $shipment->addComment($comment, "");
140
+ $shipment->setEmailSent(false);
141
+ }
142
+ Mage::register('salesOrderShipmentSaveBeforeTriggered', true);
143
+ }
144
+
145
+ return $this;
146
+ }
147
+
148
+ /**
149
+ * @param $observer
150
+ */
151
+ public function sendOrderAnyMarketObs($observer){
152
+ $order = new Mage_Sales_Model_Order();
153
+ $OrderID = Mage::getSingleton('checkout/session')->getLastRealOrderId();
154
+ $order->loadByIncrementId($OrderID);
155
+ $storeID = $order->getStoreId();
156
+
157
+ $this->prepareOrderForProc($storeID, "INSERT", $order, $OrderID);
158
+ }
159
+
160
+ /**
161
+ * @param $observer
162
+ *
163
+ * @return $this
164
+ */
165
  public function updateOrderAnyMarketObs($observer){
166
+ if( $observer->getEvent()->getOrder() ) {
167
+ $storeID = $observer->getEvent()->getOrder()->getStoreId();
168
+ $OrderID = $observer->getEvent()->getOrder()->getIncrementId();
169
+
170
+ $order = new Mage_Sales_Model_Order();
171
+ $order->loadByIncrementId($OrderID);
172
+
173
+ $this->prepareOrderForProc($storeID, "UPDATE", $order, $OrderID);
174
+ }
175
+ }
176
+
177
+ /**
178
+ * @param $observer
179
+ *
180
+ * @return $this
181
+ */
182
+ public function updateOrInsertOrderAnyMarketObs($observer){
183
+ if( $observer->getEvent()->getOrder() ) {
184
+ $storeID = $observer->getEvent()->getOrder()->getStoreId();
185
+ $OrderID = $observer->getEvent()->getOrder()->getIncrementId();
186
+
187
+ $order = new Mage_Sales_Model_Order();
188
+ $order->loadByIncrementId($OrderID);
189
+
190
+ $this->prepareOrderForProc($storeID, "BOTH", $order, $OrderID);
191
+ }
192
+ }
193
+
194
+ /**
195
+ * @param $storeID
196
+ * @param $order
197
+ * @param $typeProc
198
+ * @param $OrderID
199
+ *
200
+ * @return $this
201
+ */
202
+ private function prepareOrderForProc($storeID, $typeProc, $order, $OrderID){
203
  try {
204
  if(Mage::registry('order_save_observer_executed_'.$OrderID )){
205
  Mage::unregister( 'order_save_observer_executed_'.$OrderID );
206
  return $this;
207
  }
 
208
  Mage::register('order_save_observer_executed_'.$OrderID, true);
 
209
 
210
  if( $this->asyncMode($storeID) ){
211
  Mage::helper('db1_anymarket/queue')->addQueue($storeID, $OrderID, 'EXP', 'ORDER');
212
  }else{
213
+ if( $typeProc == "INSERT" ){
214
+ Mage::helper('db1_anymarket/order')->sendOrderToAnyMarket($storeID, $order);
215
+ }else if( $typeProc == "UPDATE" ){
216
+ Mage::helper('db1_anymarket/order')->updateOrderAnymarket($storeID, $order);
217
+ }else{
218
+ Mage::helper('db1_anymarket/order')->updateOrCreateOrderAnyMarket($storeID, $order);
219
+ }
220
  }
221
 
 
222
  $orderItems = $order->getItemsCollection();
223
  $filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
224
  foreach ($orderItems as $item){
232
  Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($storeID, $product_id, $stock->getQty(), $_product->getData($filter));
233
  }
234
  }
235
+
236
  Mage::unregister( 'order_save_observer_executed_'.$OrderID );
237
  } catch (Exception $e) {
238
  Mage::unregister( 'order_save_observer_executed_'.$OrderID );
239
  Mage::logException($e);
240
  }
 
241
  }
242
 
243
+
244
  /**
245
  * @param $observer
246
  */
257
 
258
  /**
259
  * @param $observer
260
+ *
261
+ * @return $this
262
  */
263
  public function catalogInventorySave($observer){
264
  $ImportOrderSession = Mage::getSingleton('core/session')->getImportOrdersVariable();
app/code/community/DB1/AnyMarket/Model/PaymentMethod.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes/Collection.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketbrands.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketbrands/Collection.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories/Collection.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketimage.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Image resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketimage extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+ *
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('db1_anymarket/anymarketimage', 'entity_id');
36
+ }
37
+
38
+ /**
39
+ * Perform operations after object load
40
+ *
41
+ * @access public
42
+ * @param Mage_Core_Model_Abstract $object
43
+ * @return DB1_AnyMarket_Model_Resource_Anymarketimage
44
+ *
45
+ */
46
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
47
+ {
48
+ return parent::_afterLoad($object);
49
+ }
50
+
51
+ /**
52
+ * Assign anymarket image to store views
53
+ *
54
+ * @access protected
55
+ * @param Mage_Core_Model_Abstract $object
56
+ * @return DB1_AnyMarket_Model_Resource_Anymarketimage
57
+ *
58
+ */
59
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
60
+ {
61
+ return parent::_afterSave($object);
62
+ }}
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketimage/Collection.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log collection resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketimage_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+ *
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('db1_anymarket/anymarketimage');
39
+ }
40
+
41
+ /**
42
+ * Add filter by store
43
+ *
44
+ * @access public
45
+ * @param int|Mage_Core_Model_Store $store
46
+ * @param bool $withAdmin
47
+ * @return DB1_AnyMarket_Model_Resource_Anymarketimage_Collection
48
+ *
49
+ */
50
+ public function addStoreFilter($store, $withAdmin = true)
51
+ {
52
+ return $this;
53
+ }
54
+
55
+ /**
56
+ * Join store relation table if there is store filter
57
+ *
58
+ * @access protected
59
+ * @return DB1_AnyMarket_Model_Resource_Anymarketimage_Collection
60
+ *
61
+ */
62
+ protected function _renderFiltersBefore()
63
+ {
64
+ return parent::_renderFiltersBefore();
65
+ }
66
+
67
+ /**
68
+ * get anymarket log as array
69
+ *
70
+ * @access protected
71
+ * @param string $valueField
72
+ * @param string $labelField
73
+ * @param array $additional
74
+ * @return array
75
+ *
76
+ */
77
+ protected function _toOptionArray($valueField='entity_id', $labelField='id_image', $additional=array())
78
+ {
79
+ return parent::_toOptionArray($valueField, $labelField, $additional);
80
+ }
81
+
82
+ /**
83
+ * get options hash
84
+ *
85
+ * @access protected
86
+ * @param string $valueField
87
+ * @param string $labelField
88
+ * @return array
89
+ *
90
+ */
91
+ protected function _toOptionHash($valueField='entity_id', $labelField='id_image')
92
+ {
93
+ return parent::_toOptionHash($valueField, $labelField);
94
+ }
95
+
96
+ /**
97
+ * Get SQL for get record count.
98
+ * Extra GROUP BY strip added.
99
+ *
100
+ * @access public
101
+ * @return Varien_Db_Select
102
+ *
103
+ */
104
+ public function getSelectCountSql()
105
+ {
106
+ $countSelect = parent::getSelectCountSql();
107
+ $countSelect->reset(Zend_Db_Select::GROUP);
108
+ return $countSelect;
109
+ }
110
+ }
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog/Collection.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders/Collection.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts/Collection.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue/Collection.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/Resource/Setup.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Group/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Street/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Booleantp/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Price/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Set/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Categories/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/General/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Logs/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Massunit/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Measurementunit/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Orders/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Typesync/Order/Values.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketattributesController.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketbrandsController.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketcategoriesController.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketlogController.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketordersController.php CHANGED
@@ -95,14 +95,14 @@ class DB1_AnyMarket_Adminhtml_Anymarket_AnymarketordersController extends DB1_An
95
  }
96
 
97
  if($anymarketorders->getData('nmo_status_int') == 'ERROR 01'){
98
- Mage::helper('db1_anymarket/queue')->addQueue($storeID, $anymarketorders->getNmoIdAnymarket(), 'IMP', 'ORDER');
99
  }else if($anymarketorders->getData('nmo_status_int') == 'ERROR 02'){
100
  Mage::helper('db1_anymarket/queue')->addQueue($storeID, $anymarketorders->getNmoIdOrder(), 'EXP', 'ORDER');
101
  }else{
102
  $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', Mage::app()->getStore()->getId());
103
  if($ConfigOrder == 1){ //IMPORT
104
  if($anymarketorders->getNmoIdAnymarket() != ''){
105
- Mage::helper('db1_anymarket/queue')->addQueue($storeID, $anymarketorders->getNmoIdAnymarket(), 'IMP', 'ORDER');
106
  }
107
  }else{ //EXPORT
108
  if($anymarketorders->getNmoIdOrder()){
@@ -144,7 +144,7 @@ class DB1_AnyMarket_Adminhtml_Anymarket_AnymarketordersController extends DB1_An
144
  }
145
 
146
  if($anymarketorders->getNmoIdAnymarket() != '') {
147
- Mage::helper('db1_anymarket/queue')->addQueue($storeID, $anymarketorders->getNmoIdAnymarket(), 'IMP', 'ORDER');
148
  }
149
  }
150
  Mage::getSingleton('adminhtml/session')->addSuccess(
95
  }
96
 
97
  if($anymarketorders->getData('nmo_status_int') == 'ERROR 01'){
98
+ Mage::helper('db1_anymarket/queue')->addQueue($storeID, $anymarketorders->getNmoIdSeqAnymarket(), 'IMP', 'ORDER');
99
  }else if($anymarketorders->getData('nmo_status_int') == 'ERROR 02'){
100
  Mage::helper('db1_anymarket/queue')->addQueue($storeID, $anymarketorders->getNmoIdOrder(), 'EXP', 'ORDER');
101
  }else{
102
  $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', Mage::app()->getStore()->getId());
103
  if($ConfigOrder == 1){ //IMPORT
104
  if($anymarketorders->getNmoIdAnymarket() != ''){
105
+ Mage::helper('db1_anymarket/queue')->addQueue($storeID, $anymarketorders->getNmoIdSeqAnymarket(), 'IMP', 'ORDER');
106
  }
107
  }else{ //EXPORT
108
  if($anymarketorders->getNmoIdOrder()){
144
  }
145
 
146
  if($anymarketorders->getNmoIdAnymarket() != '') {
147
+ Mage::helper('db1_anymarket/queue')->addQueue($storeID, $anymarketorders->getNmoIdSeqAnymarket(), 'IMP', 'ORDER');
148
  }
149
  }
150
  Mage::getSingleton('adminhtml/session')->addSuccess(
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketproductsController.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketqueueController.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/controllers/Adminhtml/AnymarketController.php CHANGED
@@ -42,10 +42,6 @@ class DB1_Anymarket_Adminhtml_AnymarketController extends Mage_Adminhtml_Control
42
  if ($ConfigDescProd == 'a:0:{}') {
43
  array_push($errors, " Configuração de Descrição Inválida.");
44
  }
45
- $STATUSIMPORT = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_stauts_order_field', $storeID);
46
- if( $STATUSIMPORT == null ){
47
- array_push($errors, " Não ha nada configurado em Status do Pedido.");
48
- }
49
  $StatusOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_status_mg_am_field', $storeID);
50
  if ($StatusOrder == 'a:0:{}') {
51
  array_push($errors, " Não ha nada configurado em Status Magento-Anymarket.");
42
  if ($ConfigDescProd == 'a:0:{}') {
43
  array_push($errors, " Configuração de Descrição Inválida.");
44
  }
 
 
 
 
45
  $StatusOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_status_mg_am_field', $storeID);
46
  if ($StatusOrder == 'a:0:{}') {
47
  array_push($errors, " Não ha nada configurado em Status Magento-Anymarket.");
app/code/community/DB1/AnyMarket/controllers/IndexController.php CHANGED
@@ -11,7 +11,6 @@ class DB1_AnyMarket_IndexController extends Mage_Core_Controller_Front_Action {
11
  $anymarketlog->setLogJson(file_get_contents('php://input'));
12
  $anymarketlog->setStatus("0");
13
  $anymarketlog->save();
14
- sleep(rand(5,25));
15
 
16
  $allStores = Mage::helper('db1_anymarket')->getTokenByOi( $value->content->oi );
17
  if( !empty($allStores) ) {
@@ -21,72 +20,87 @@ class DB1_AnyMarket_IndexController extends Mage_Core_Controller_Front_Action {
21
 
22
  if ($TOKEN != '') {
23
  if ($value->type == 'ORDER') {
 
 
 
24
 
25
- if( Mage::registry('callback_order_executed_'.$value->content->id ) ){
26
- Mage::unregister( 'callback_order_executed_'.$value->content->id );
27
- return $this;
28
- }
29
- Mage::register('callback_order_executed_'.$value->content->id, true);
30
-
31
- try{
32
- $cache = Mage::app()->getCache();
33
-
34
- $lastProcOrder = $cache->load('order_' . $value->content->id);
35
- $lastProc = true;
36
- if ($lastProcOrder != null) {
37
- $dateOld = new DateTime(date('y-m-d H:i:s', strtotime($lastProcOrder)));
38
- $dateNew = new DateTime(date('y-m-d H:i:s'));
39
-
40
- $difDate = $dateOld->diff($dateNew);
41
- if ($difDate->h <= 0 && $difDate->i <= 0 && $difDate->s <= 20) {
42
- $lastProc = false;
43
- }
44
- }
45
-
46
- if ($lastProc) {
47
- $cache->save(date('y-m-d H:i:s'), 'order_' . $value->content->id, array($value->content->id), 60 * 60);
48
-
49
- Mage::helper('db1_anymarket/order')->getSpecificOrderFromAnyMarket($value->content->id, "notoken", $storeID);
50
- }
51
- Mage::unregister( 'callback_order_executed_'.$value->content->id );
52
- } catch (Exception $e) {
53
- echo "Erro ao inserir Pedido, verificar os logs do Magento";
54
- Mage::unregister( 'callback_order_executed_'.$value->content->id );
55
- Mage::logException($e);
56
- }
 
 
 
57
  } elseif ($value->type == 'TRANSMISSION') {
58
- $listTransmissions = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
- if( !Mage::helper('db1_anymarket/product')->validateCallbackReceiver($storeID, $value->content->id) ){
61
- $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
62
- $anymarketlog->setLogDesc('Callback Rejected');
63
- $anymarketlog->setLogJson(file_get_contents('php://input'));
64
- $anymarketlog->setStatus("0");
65
- $anymarketlog->save();
66
 
67
- return $this;
68
- }
69
 
70
- $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
71
 
72
- $headers = array(
73
- "Content-type: application/json",
74
- "Accept: */*",
75
- "gumgaToken: " . $TOKEN
76
- );
77
 
78
- array_push($listTransmissions, array(
79
- "id" => $value->content->id,
80
- "token" => "notoken"
81
- )
82
- );
 
 
83
 
84
- $JSON = json_encode($listTransmissions);
85
- $sincMode = Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_operation_type_field', $storeID);
86
- if( $sincMode ) {
87
- Mage::helper('db1_anymarket/queue')->addQueue($storeID, $value->content->id, 'IMP', 'PRODUCT');
88
- echo "Adicionado na fila Magento.";
89
- }else{
90
  $transRet = Mage::helper('db1_anymarket/product')->getSpecificFeedProduct($storeID, json_decode($JSON), $headers, $HOST);
91
  echo $transRet;
92
  }
11
  $anymarketlog->setLogJson(file_get_contents('php://input'));
12
  $anymarketlog->setStatus("0");
13
  $anymarketlog->save();
 
14
 
15
  $allStores = Mage::helper('db1_anymarket')->getTokenByOi( $value->content->oi );
16
  if( !empty($allStores) ) {
20
 
21
  if ($TOKEN != '') {
22
  if ($value->type == 'ORDER') {
23
+ $sincMode = Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_operation_type_imp_field', $storeID);
24
+ if( $sincMode == "1" ) {
25
+ Mage::helper('db1_anymarket/queue')->addQueue($storeID, $value->content->id, 'IMP', 'ORDER');
26
 
27
+ echo "Adicionado na fila Magento.";
28
+ }else {
29
+ if (Mage::registry('callback_order_executed_' . $value->content->id)) {
30
+ Mage::unregister('callback_order_executed_' . $value->content->id);
31
+ return $this;
32
+ }
33
+ Mage::register('callback_order_executed_' . $value->content->id, true);
34
+
35
+ try {
36
+ $cache = Mage::app()->getCache();
37
+
38
+ $lastProcOrder = $cache->load('order_' . $value->content->id);
39
+ $lastProc = true;
40
+ if ($lastProcOrder != null) {
41
+ $dateOld = new DateTime(date('y-m-d H:i:s', strtotime($lastProcOrder)));
42
+ $dateNew = new DateTime(date('y-m-d H:i:s'));
43
+
44
+ $difDate = $dateOld->diff($dateNew);
45
+ if ($difDate->h <= 0 && $difDate->i <= 0 && $difDate->s <= 20) {
46
+ $lastProc = false;
47
+ }
48
+ }
49
+
50
+ if ($lastProc) {
51
+ $cache->save(date('y-m-d H:i:s'), 'order_' . $value->content->id, array($value->content->id), 60 * 60);
52
+ Mage::helper('db1_anymarket/order')->getSpecificOrderFromAnyMarket($value->content->id, "notoken", $storeID);
53
+ }
54
+ Mage::unregister('callback_order_executed_' . $value->content->id);
55
+
56
+ } catch (Exception $e) {
57
+ echo "Erro ao inserir Pedido, verificar os logs do Magento";
58
+ Mage::unregister('callback_order_executed_' . $value->content->id);
59
+ Mage::logException($e);
60
+ }
61
+ }
62
  } elseif ($value->type == 'TRANSMISSION') {
63
+ $sincMode = Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_operation_type_imp_field', $storeID);
64
+ if( $sincMode == "1" ) {
65
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
66
+ if($typeSincProd == "1") {
67
+ Mage::helper('db1_anymarket/queue')->addQueue($storeID, $value->content->id, 'IMP', 'PRODUCT');
68
+ }else{
69
+ $typeSincOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
70
+ if( $typeSincOrder == "1" ){
71
+ Mage::helper('db1_anymarket/queue')->addQueue($storeID, $value->content->id, 'IMP', 'STOCK');
72
+ }
73
+ }
74
+ echo "Adicionado na fila Magento.";
75
+ }else{
76
+ $listTransmissions = array();
77
 
78
+ if( !Mage::helper('db1_anymarket/product')->validateCallbackReceiver($storeID, $value->content->id) ){
79
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
80
+ $anymarketlog->setLogDesc('Callback Rejected');
81
+ $anymarketlog->setLogJson(file_get_contents('php://input'));
82
+ $anymarketlog->setStatus("0");
83
+ $anymarketlog->save();
84
 
85
+ return $this;
86
+ }
87
 
88
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
89
 
90
+ $headers = array(
91
+ "Content-type: application/json",
92
+ "Accept: */*",
93
+ "gumgaToken: " . $TOKEN
94
+ );
95
 
96
+ array_push($listTransmissions, array(
97
+ "id" => $value->content->id,
98
+ "token" => "notoken"
99
+ )
100
+ );
101
+
102
+ $JSON = json_encode($listTransmissions);
103
 
 
 
 
 
 
 
104
  $transRet = Mage::helper('db1_anymarket/product')->getSpecificFeedProduct($storeID, json_decode($JSON), $headers, $HOST);
105
  echo $transRet;
106
  }
app/code/community/DB1/AnyMarket/etc/adminhtml.xml CHANGED
File without changes
app/code/community/DB1/AnyMarket/etc/api.xml CHANGED
File without changes
app/code/community/DB1/AnyMarket/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <DB1_AnyMarket>
5
- <version>2.10.1</version>
6
  </DB1_AnyMarket>
7
  </modules>
8
  <global>
@@ -85,6 +85,9 @@
85
  <anymarketbrands>
86
  <table>db1_anymarket_anymarketbrands</table>
87
  </anymarketbrands>
 
 
 
88
  <anymarketlog_store>
89
  <table>db1_anymarket_anymarketlog_store</table>
90
  </anymarketlog_store>
@@ -122,17 +125,6 @@
122
  </observers>
123
  </admin_system_config_changed_section_anymarket_section>
124
 
125
- <sales_order_save_commit_after>
126
- <observers>
127
- <sales_order_save_commit_after_handler>
128
- <type>model</type>
129
- <class>db1_anymarket/observer</class>
130
- <method>updateOrderAnyMarketObs</method>
131
- <args></args>
132
- </sales_order_save_commit_after_handler>
133
- </observers>
134
- </sales_order_save_commit_after>
135
-
136
  <!-- CATEGORIA -->
137
  <catalog_category_save_commit_after>
138
  <observers>
@@ -185,14 +177,26 @@
185
  </catalog_product_delete_after>
186
 
187
  <!-- ORDER -->
188
- <sales_order_save_after>
189
  <observers>
190
- <db1_anymarket>
 
 
 
 
 
 
 
 
 
 
 
191
  <class>db1_anymarket/observer</class>
192
  <method>updateOrderAnyMarketObs</method>
193
- </db1_anymarket>
 
194
  </observers>
195
- </sales_order_save_after>
196
 
197
  <!-- ESTOQUE -->
198
  <cataloginventory_stock_item_save_commit_after>
@@ -240,8 +244,15 @@
240
  </observers>
241
  </sales_order_creditmemo_save_after>
242
 
 
 
 
 
 
 
 
 
243
  </events>
244
-
245
  </global>
246
  <default>
247
  <queue_qty>
@@ -271,6 +282,11 @@
271
  <anymarket_type_order_sync_field>1</anymarket_type_order_sync_field>
272
  </anymarket_integration_order_group>
273
 
 
 
 
 
 
274
  <anymarket_attribute_group>
275
  <anymarket_customer_group_field>1</anymarket_customer_group_field>
276
  <anymarket_doc_type_field>taxvat</anymarket_doc_type_field>
@@ -322,12 +338,15 @@
322
  <schedule><cron_expr>*/15 * * * *</cron_expr></schedule> <!-- 15 min -->
323
  <run><model>db1_anymarket/cron::executeQueue</model></run>
324
  </db1_anymarket_execqueue>
 
 
 
 
325
  </jobs>
326
  </crontab>
327
  <!-- CRON -->
328
 
329
  <adminhtml>
330
-
331
  <layout>
332
  <updates>
333
  <db1_anymarket>
2
  <config>
3
  <modules>
4
  <DB1_AnyMarket>
5
+ <version>2.12.1</version>
6
  </DB1_AnyMarket>
7
  </modules>
8
  <global>
85
  <anymarketbrands>
86
  <table>db1_anymarket_anymarketbrands</table>
87
  </anymarketbrands>
88
+ <anymarketimage>
89
+ <table>db1_anymarket_anymarketimage</table>
90
+ </anymarketimage>
91
  <anymarketlog_store>
92
  <table>db1_anymarket_anymarketlog_store</table>
93
  </anymarketlog_store>
125
  </observers>
126
  </admin_system_config_changed_section_anymarket_section>
127
 
 
 
 
 
 
 
 
 
 
 
 
128
  <!-- CATEGORIA -->
129
  <catalog_category_save_commit_after>
130
  <observers>
177
  </catalog_product_delete_after>
178
 
179
  <!-- ORDER -->
180
+ <checkout_onepage_controller_success_action>
181
  <observers>
182
+ <sales_order_save_commit_after_handler>
183
+ <class>db1_anymarket/observer</class>
184
+ <method>sendOrderAnyMarketObs</method>
185
+ </sales_order_save_commit_after_handler>
186
+ </observers>
187
+ </checkout_onepage_controller_success_action>
188
+
189
+ <!-- ORDER UPDATE -->
190
+ <sales_order_save_commit_after>
191
+ <observers>
192
+ <sales_order_save_commit_after_handler>
193
+ <type>model</type>
194
  <class>db1_anymarket/observer</class>
195
  <method>updateOrderAnyMarketObs</method>
196
+ <args></args>
197
+ </sales_order_save_commit_after_handler>
198
  </observers>
199
+ </sales_order_save_commit_after>
200
 
201
  <!-- ESTOQUE -->
202
  <cataloginventory_stock_item_save_commit_after>
244
  </observers>
245
  </sales_order_creditmemo_save_after>
246
 
247
+ <sales_order_shipment_save_before>
248
+ <observers>
249
+ <db1_anymarket>
250
+ <class>db1_anymarket/observer</class>
251
+ <method>saveShippingObs</method>
252
+ </db1_anymarket>
253
+ </observers>
254
+ </sales_order_shipment_save_before>
255
  </events>
 
256
  </global>
257
  <default>
258
  <queue_qty>
282
  <anymarket_type_order_sync_field>1</anymarket_type_order_sync_field>
283
  </anymarket_integration_order_group>
284
 
285
+ <anymarket_general_group>
286
+ <anymarket_operation_type_field>0</anymarket_operation_type_field>
287
+ <anymarket_operation_type_imp_field>0</anymarket_operation_type_imp_field>
288
+ </anymarket_general_group>
289
+
290
  <anymarket_attribute_group>
291
  <anymarket_customer_group_field>1</anymarket_customer_group_field>
292
  <anymarket_doc_type_field>taxvat</anymarket_doc_type_field>
338
  <schedule><cron_expr>*/15 * * * *</cron_expr></schedule> <!-- 15 min -->
339
  <run><model>db1_anymarket/cron::executeQueue</model></run>
340
  </db1_anymarket_execqueue>
341
+ <db1_anymarket_execorderwitherror>
342
+ <schedule><cron_expr>*/5 * * * *</cron_expr></schedule> <!-- 5 min -->
343
+ <run><model>db1_anymarket/cron::sincOrdersWithErrors</model></run>
344
+ </db1_anymarket_execorderwitherror>
345
  </jobs>
346
  </crontab>
347
  <!-- CRON -->
348
 
349
  <adminhtml>
 
350
  <layout>
351
  <updates>
352
  <db1_anymarket>
app/code/community/DB1/AnyMarket/etc/system.xml CHANGED
@@ -93,20 +93,39 @@
93
  <show_in_store>1</show_in_store>
94
  <fields>
95
 
 
 
 
 
 
 
 
 
 
96
  <anymarket_operation_type_field>
97
- <label>Tipo de Operação</label>
98
  <frontend_type>select</frontend_type>
99
  <source_model>db1_anymarket/system_config_source_general_values</source_model>
100
- <sort_order>0</sort_order>
101
  <show_in_default>0</show_in_default>
102
  <show_in_website>0</show_in_website>
103
  <show_in_store>1</show_in_store>
104
  </anymarket_operation_type_field>
105
 
 
 
 
 
 
 
 
 
 
 
106
  <anymarket_header_validation_field>
107
  <label>Validações</label>
108
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
109
- <sort_order>1</sort_order>
110
  <show_in_default>0</show_in_default>
111
  <show_in_website>0</show_in_website>
112
  <show_in_store>1</show_in_store>
@@ -116,7 +135,7 @@
116
  <label>Check the configurations</label>
117
  <frontend_type>Button</frontend_type>
118
  <frontend_model>db1_anymarket/adminhtml_system_config_form_buttoncheckconfig</frontend_model>
119
- <sort_order>2</sort_order>
120
  <show_in_default>0</show_in_default>
121
  <show_in_website>0</show_in_website>
122
  <show_in_store>1</show_in_store>
@@ -831,17 +850,6 @@
831
  <show_in_store>1</show_in_store>
832
  <fields>
833
 
834
- <anymarket_estimate_date_field translate="label tooltip comment">
835
- <label>Dias adicionais Data Estimada de Entrega</label>
836
- <sort_order>0</sort_order>
837
- <comment>Caso não seja informado, enviará 10 dias adicionais.</comment>
838
- <tooltip>Quantidade de dias que será adicionada a data de envio para o campo Data Estimada.</tooltip>
839
- <show_in_default>0</show_in_default>
840
- <show_in_website>0</show_in_website>
841
- <show_in_store>1</show_in_store>
842
- <frontend_type>text</frontend_type>
843
- </anymarket_estimate_date_field>
844
-
845
  <anymarket_header_order_field>
846
  <label>Fluxo de Integração</label>
847
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
@@ -862,19 +870,10 @@
862
  <source_model>db1_anymarket/system_config_source_typesync_order_values</source_model>
863
  </anymarket_type_order_sync_field>
864
 
865
- <anymarket_header_order_imp_field>
866
- <label>Status a serem importados do Anymarket</label>
867
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
868
- <sort_order>3</sort_order>
869
- <show_in_default>0</show_in_default>
870
- <show_in_website>0</show_in_website>
871
- <show_in_store>2</show_in_store>
872
- </anymarket_header_order_imp_field>
873
-
874
  <anymarket_create_reg_pay_field translate="label comment">
875
  <label>Create payment record when importing paid</label>
876
  <comment>By checking to yes, when it is imported into an application status paid in Anymarket, a record in Invoice will be created, remember to link a status that allows billing with PAGO.</comment>
877
- <sort_order>4</sort_order>
878
  <show_in_default>0</show_in_default>
879
  <show_in_website>0</show_in_website>
880
  <show_in_store>1</show_in_store>
@@ -882,21 +881,10 @@
882
  <source_model>adminhtml/system_config_source_yesno</source_model>
883
  </anymarket_create_reg_pay_field>
884
 
885
- <anymarket_stauts_order_field translate="label tooltip comment">
886
- <label>Status Order</label>
887
- <comment>Status of orders that must be imported.</comment>
888
- <frontend_type>multiselect</frontend_type>
889
- <source_model>db1_anymarket/system_config_source_orders_values</source_model>
890
- <sort_order>5</sort_order>
891
- <show_in_default>0</show_in_default>
892
- <show_in_website>0</show_in_website>
893
- <show_in_store>1</show_in_store>
894
- </anymarket_stauts_order_field>
895
-
896
  <anymarket_header_am_mg_field>
897
  <label>Anymarket para Magento</label>
898
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
899
- <sort_order>6</sort_order>
900
  <show_in_default>0</show_in_default>
901
  <show_in_website>0</show_in_website>
902
  <show_in_store>2</show_in_store>
@@ -906,7 +894,7 @@
906
  <label>Status Order (Anymarket to Magento)</label>
907
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
908
  <frontend_model>db1_anymarket/system_config_source_orders_statusammg_values</frontend_model>
909
- <sort_order>7</sort_order>
910
  <show_in_default>0</show_in_default>
911
  <show_in_website>0</show_in_website>
912
  <show_in_store>1</show_in_store>
@@ -916,7 +904,7 @@
916
  <anymarket_header_mg_am_field>
917
  <label>Magento para Anymarket</label>
918
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
919
- <sort_order>8</sort_order>
920
  <show_in_default>0</show_in_default>
921
  <show_in_website>0</show_in_website>
922
  <show_in_store>2</show_in_store>
@@ -926,7 +914,7 @@
926
  <label>Status Order (Magento to Anymarket)</label>
927
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
928
  <frontend_model>db1_anymarket/system_config_source_orders_statusmgam_values</frontend_model>
929
- <sort_order>9</sort_order>
930
  <show_in_default>0</show_in_default>
931
  <show_in_website>0</show_in_website>
932
  <show_in_store>1</show_in_store>
@@ -945,7 +933,7 @@
945
  <comment>
946
  <![CDATA[
947
  <div>
948
- <h2>v. 2.10.1</h2>
949
  <hr>
950
  <h3>Desenvolvido por<br> NovaPC - Tecnologia da Informação.</h3>
951
  <img src="http://novapc.com.br/images/logo.png" alt="NovaPC" height="100" width="150">
93
  <show_in_store>1</show_in_store>
94
  <fields>
95
 
96
+ <anymarket_header_type_sync_field>
97
+ <label>Tipo de Sincronização</label>
98
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
99
+ <sort_order>0</sort_order>
100
+ <show_in_default>0</show_in_default>
101
+ <show_in_website>0</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </anymarket_header_type_sync_field>
104
+
105
  <anymarket_operation_type_field>
106
+ <label>Enviar para o Anymarket</label>
107
  <frontend_type>select</frontend_type>
108
  <source_model>db1_anymarket/system_config_source_general_values</source_model>
109
+ <sort_order>1</sort_order>
110
  <show_in_default>0</show_in_default>
111
  <show_in_website>0</show_in_website>
112
  <show_in_store>1</show_in_store>
113
  </anymarket_operation_type_field>
114
 
115
+ <anymarket_operation_type_imp_field>
116
+ <label>Receber do Anymarket</label>
117
+ <frontend_type>select</frontend_type>
118
+ <source_model>db1_anymarket/system_config_source_general_values</source_model>
119
+ <sort_order>2</sort_order>
120
+ <show_in_default>0</show_in_default>
121
+ <show_in_website>0</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ </anymarket_operation_type_imp_field>
124
+
125
  <anymarket_header_validation_field>
126
  <label>Validações</label>
127
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
128
+ <sort_order>3</sort_order>
129
  <show_in_default>0</show_in_default>
130
  <show_in_website>0</show_in_website>
131
  <show_in_store>1</show_in_store>
135
  <label>Check the configurations</label>
136
  <frontend_type>Button</frontend_type>
137
  <frontend_model>db1_anymarket/adminhtml_system_config_form_buttoncheckconfig</frontend_model>
138
+ <sort_order>4</sort_order>
139
  <show_in_default>0</show_in_default>
140
  <show_in_website>0</show_in_website>
141
  <show_in_store>1</show_in_store>
850
  <show_in_store>1</show_in_store>
851
  <fields>
852
 
 
 
 
 
 
 
 
 
 
 
 
853
  <anymarket_header_order_field>
854
  <label>Fluxo de Integração</label>
855
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
870
  <source_model>db1_anymarket/system_config_source_typesync_order_values</source_model>
871
  </anymarket_type_order_sync_field>
872
 
 
 
 
 
 
 
 
 
 
873
  <anymarket_create_reg_pay_field translate="label comment">
874
  <label>Create payment record when importing paid</label>
875
  <comment>By checking to yes, when it is imported into an application status paid in Anymarket, a record in Invoice will be created, remember to link a status that allows billing with PAGO.</comment>
876
+ <sort_order>3</sort_order>
877
  <show_in_default>0</show_in_default>
878
  <show_in_website>0</show_in_website>
879
  <show_in_store>1</show_in_store>
881
  <source_model>adminhtml/system_config_source_yesno</source_model>
882
  </anymarket_create_reg_pay_field>
883
 
 
 
 
 
 
 
 
 
 
 
 
884
  <anymarket_header_am_mg_field>
885
  <label>Anymarket para Magento</label>
886
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
887
+ <sort_order>4</sort_order>
888
  <show_in_default>0</show_in_default>
889
  <show_in_website>0</show_in_website>
890
  <show_in_store>2</show_in_store>
894
  <label>Status Order (Anymarket to Magento)</label>
895
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
896
  <frontend_model>db1_anymarket/system_config_source_orders_statusammg_values</frontend_model>
897
+ <sort_order>5</sort_order>
898
  <show_in_default>0</show_in_default>
899
  <show_in_website>0</show_in_website>
900
  <show_in_store>1</show_in_store>
904
  <anymarket_header_mg_am_field>
905
  <label>Magento para Anymarket</label>
906
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
907
+ <sort_order>6</sort_order>
908
  <show_in_default>0</show_in_default>
909
  <show_in_website>0</show_in_website>
910
  <show_in_store>2</show_in_store>
914
  <label>Status Order (Magento to Anymarket)</label>
915
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
916
  <frontend_model>db1_anymarket/system_config_source_orders_statusmgam_values</frontend_model>
917
+ <sort_order>7</sort_order>
918
  <show_in_default>0</show_in_default>
919
  <show_in_website>0</show_in_website>
920
  <show_in_store>1</show_in_store>
933
  <comment>
934
  <![CDATA[
935
  <div>
936
+ <h2>v. 2.12.1</h2>
937
  <hr>
938
  <h3>Desenvolvido por<br> NovaPC - Tecnologia da Informação.</h3>
939
  <img src="http://novapc.com.br/images/logo.png" alt="NovaPC" height="100" width="150">
app/code/community/DB1/AnyMarket/etc/wsdl.xml CHANGED
File without changes
app/code/community/DB1/AnyMarket/etc/wsi.xml CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-install-1.0.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.0.0-1.1.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.1.0-1.2.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.2.0-1.3.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.3.0-1.4.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.4.0-1.5.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.5.0-1.6.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.6.0-1.7.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.7.0-1.8.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.8.0-2.0.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.0.0-2.1.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.1.0-2.2.0.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.11.1-2.11.2.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
6
+ $setup->updateAttribute('catalog_category', 'categ_integra_anymarket', 'is_required', 0);
7
+
8
+ $installer->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.11.2-2.11.3.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ $this->startSetup();
3
+ $this->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.11.3-2.11.4.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $this->startSetup();
3
+
4
+ $tableName = $this->getTable('db1_anymarket/anymarketimage');
5
+ if( $this->getConnection()->isTableExists( $tableName ) != true ) {
6
+ $table = $this->getConnection()
7
+ ->newTable($tableName)
8
+ ->addColumn(
9
+ 'entity_id',
10
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
11
+ null,
12
+ array(
13
+ 'identity' => true,
14
+ 'nullable' => false,
15
+ 'primary' => true,
16
+ ),
17
+ 'AnyMarket Imagem'
18
+ )
19
+ ->addColumn(
20
+ 'value_id',
21
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
22
+ array(
23
+ 'nullable' => true,
24
+ ),
25
+ 'id image magento'
26
+ )
27
+ ->addColumn(
28
+ 'id_image',
29
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
30
+ array(
31
+ 'nullable' => true,
32
+ ),
33
+ 'id image anymarket'
34
+ )
35
+ ->setComment('AnyMarket Image Table');
36
+ $this->getConnection()->createTable($table);
37
+ }
38
+
39
+ $this->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.2.0-2.3.6.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.3.6-2.3.9.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.3.9-2.4.0.php CHANGED
@@ -15,7 +15,7 @@ $attribute = array(
15
  'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
16
  'visible' => true,
17
  'position' => 0,
18
- 'required' => true,
19
  'user_defined' => true,
20
  'default' => "",
21
  'group' => "General Information"
15
  'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
16
  'visible' => true,
17
  'position' => 0,
18
+ 'required' => false,
19
  'user_defined' => true,
20
  'default' => "",
21
  'group' => "General Information"
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.0-2.4.3.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.3-2.4.4.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.4.4-2.9.1.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.9.1-2.9.2.php CHANGED
File without changes
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.9.2-2.11.1.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/db1_anymarket.xml CHANGED
@@ -9,6 +9,15 @@
9
  </reference>
10
  </catalog_product_view>
11
 
 
 
 
 
 
 
 
 
 
12
  <adminhtml_anymarket_anymarketlog_index>
13
  <reference name="menu">
14
  <action method="setActive">
9
  </reference>
10
  </catalog_product_view>
11
 
12
+ <adminhtml_sales_order_shipment_new>
13
+ <reference name="shipment_tracking">
14
+ <action method="setTemplate">
15
+ <template>db1/anymarket/tracking/new/tracking.phtml</template>
16
+ <!--template>sales/order/shipment/create/tracking.phtml</template-->
17
+ </action>
18
+ </reference>
19
+ </adminhtml_sales_order_shipment_new>
20
+
21
  <adminhtml_anymarket_anymarketlog_index>
22
  <reference name="menu">
23
  <action method="setActive">
app/design/adminhtml/default/default/template/db1/anymarket/system/config/form/field/array_dropdown.phtml CHANGED
File without changes
app/design/adminhtml/default/default/template/db1/anymarket/system/config/form/field/button_check_configuration.phtml CHANGED
File without changes
app/etc/modules/DB1_AnyMarket.xml CHANGED
File without changes
app/locale/en_US/DB1_AnyMarket.csv CHANGED
File without changes
app/locale/pt_BR/DB1_AnyMarket.csv CHANGED
File without changes
package.xml CHANGED
@@ -1,22 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>d7db67d0d012350a01ce05c31f91754d</name>
4
- <version>2.10.1</version>
5
- <stability>Stable</stability>
6
  <license>Mozilla Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Integrador entre Magento e Anymarket.</summary>
10
  <description>Mantem um fluxo continuo de integra&#xE7;&#xE3;o de Produtos e Pedidos entre Magento e Anymarket.</description>
11
- <notes>* Adicionado compatibilidade com prefixo em tabelas.&#xD;
12
  &#xD;
13
  &#xD;
14
  Para mais informa&#xE7;&#xF5;es acesse: &#xD;
15
  https://github.com/AnyMarket/magento</notes>
16
- <authors><author><name>Anymarket</name><user>anymarket</user><email>dev@anymarket.com.br</email></author></authors>
17
- <date>2016-11-08</date>
18
- <time>14:04:16</time>
19
- <contents><target name="magecommunity"><dir name="DB1"><dir name="AnyMarket"><dir name="Block"><dir name="Adminhtml"><dir name="Anymarketattributes"><dir name="Edit"><file name="Form.php" hash="2f7fc99eb1e822aec20e00ac2f09e9b6"/><dir name="Tab"><file name="Form.php" hash="b993f886f391902526c13ed921e67f64"/><file name="Stores.php" hash="e2f9a83dcc1c5643584607a9788ce991"/></dir><file name="Tabs.php" hash="c7ea19d365aa6dd186bb5586748c8a36"/></dir><file name="Edit.php" hash="adf55bcb491bb6c4d839ba54228f38bb"/><file name="Grid.php" hash="318ced337407c824b4ed93a6f30b7fb3"/></dir><file name="Anymarketattributes.php" hash="3dec5da837e1bcb3813a55a21cf70452"/><dir name="Anymarketbrands"><dir name="Edit"><file name="Form.php" hash="70295f473585677c25ccb69c729ad264"/><dir name="Tab"><file name="Form.php" hash="5baa22a93472a4552619554aa2f5b74d"/><file name="Stores.php" hash="989e32b60c014c3feb15b394ac75e495"/></dir><file name="Tabs.php" hash="3f38d3849c9c5191f05b6de6e48e1244"/></dir><file name="Edit.php" hash="bb5ee750685a202d059adf7c62207f8d"/><file name="Grid.php" hash="cbc4ea24f205fc5892d5c462a6702550"/></dir><file name="Anymarketbrands.php" hash="efa9ef9b3666136f2a2158bd69860d60"/><dir name="Anymarketcategories"><dir name="Edit"><file name="Form.php" hash="738927ef6cc0cb36d9a318a3fc0494a4"/><dir name="Tab"><file name="Form.php" hash="6b724bea8807e42a5e58607643d10623"/><file name="Stores.php" hash="2065ee5d47b8c7e7632b6311e4dc65eb"/></dir><file name="Tabs.php" hash="4097937c822b540a533390a60a33a0ad"/></dir><file name="Edit.php" hash="ad21c818418accadb19c9e73c964f503"/><file name="Grid.php" hash="b280d8f866c21c1a66373005d7a904d5"/></dir><file name="Anymarketcategories.php" hash="66b271b3c3cdc31153d4a9e4d258bf20"/><dir name="Anymarketlog"><dir name="Edit"><file name="Form.php" hash="475dcc08db1d6e73d0d3fa56916d1c7b"/><dir name="Tab"><file name="Form.php" hash="20949829f756ecbe695308a9ba3dc246"/><file name="Stores.php" hash="6c33618d5556292dd07b037a3ef0b9a4"/></dir><file name="Tabs.php" hash="778a968aa9ed006577ca1b06821ee8d7"/></dir><file name="Edit.php" hash="14bc221c3b69fd79d6c09eaaba2792bb"/><file name="Grid.php" hash="bde6093b89b3db92a25abf3124cd1714"/></dir><file name="Anymarketlog.php" hash="7da774661bfe410cb6df3a1d4bd33f5a"/><dir name="Anymarketorders"><dir name="Edit"><file name="Form.php" hash="40cdd96c786c522f15c0c0df583cd861"/><dir name="Tab"><file name="Form.php" hash="7e6185c620c6ce784055c436609a29c2"/><file name="Stores.php" hash="eae8bbfa5ce5d2d1c3aa76cf09895b62"/></dir><file name="Tabs.php" hash="fd93f19227b2e46c74cadbcf642b936e"/></dir><file name="Edit.php" hash="b887ae08790c7babbc3b386208e57901"/><file name="Grid.php" hash="940a0ca57208c8fe37660a3c567f2f59"/></dir><file name="Anymarketorders.php" hash="59e93a88b8c82e1a8cfb2bd246cff259"/><dir name="Anymarketproducts"><dir name="Edit"><file name="Form.php" hash="980603f48914a1287c2e7c15e4c86d83"/><dir name="Tab"><file name="Form.php" hash="245eab4f574907f0db6bffcd651b6b8c"/><file name="Stores.php" hash="2cec2058ef922bc7cc89511d06d1cf72"/></dir><file name="Tabs.php" hash="1ff12beae435c878edb912960ae17a47"/></dir><file name="Edit.php" hash="efee68f9e82522aeb3908a29cb65d388"/><file name="Grid.php" hash="28abacf7c5294e6d991f363bb4c11afc"/></dir><file name="Anymarketproducts.php" hash="3bac9100d555bd07ab9d0b368994bea2"/><dir name="Anymarketqueue"><dir name="Edit"><file name="Form.php" hash="fd9c0ce4afcf1c12657b180666224e97"/><dir name="Tab"><file name="Form.php" hash="aa603b428632caaf0a51c4d9021f3f08"/><file name="Stores.php" hash="08bdd73cf10ea1fe2bc4a963f0737cc6"/></dir><file name="Tabs.php" hash="381579dc284c6f27acea660886fdbc5f"/></dir><file name="Edit.php" hash="7decfc10b577b4d99c342d23b4a75c01"/><file name="Grid.php" hash="5fb19f0ee6387b4f500191ed4f596e3c"/></dir><file name="Anymarketqueue.php" hash="ae3c146ea8a2b0999a762917d8645dff"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Buttoncheckconfig.php" hash="344078aec3e91f5f8915272935d0a391"/><file name="Callback.php" hash="0e721a318ec6d95e7671f2bdfd0e7c11"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Orders"><dir name="Statusammg"><file name="Values.php" hash="931376d93d7ad770aae1755aa05d880f"/></dir><dir name="Statusmgam"><file name="Values.php" hash="3e39fcc15a9400f09b525ff130aaf775"/></dir></dir><dir name="Products"><file name="Values.php" hash="87e7e2ecaa08fc0c21d7ee93799a6f91"/></dir></dir></dir></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="AnyMarket.php" hash="6d1473008f995a33e619b4d00465ccc0"/></dir></dir><dir name="Helper"><file name="Brand.php" hash="48c1fe421cd14cfe2fa29768d2e06916"/><file name="Category.php" hash="01169a1aa216b248456ec328d4654c72"/><file name="Customergenerator.php" hash="2e9ea1ede85d01637c21d8f59894709d"/><file name="Data.php" hash="83bafbea3cae011507c8aaf7cc34f574"/><file name="Image.php" hash="ad90702a2750c40c10e3edc687a7b578"/><file name="Order.php" hash="e60ac36a673b33e855b9a29a3b474bb1"/><file name="Ordergenerator.php" hash="16f9518a25d32d2057e4c5c8e752a230"/><file name="Product.php" hash="187f390e35aaadb855ec102bb2d6e029"/><file name="Productgenerator.php" hash="225911af1e47d516c317f3271d165b9e"/><file name="Queue.php" hash="3ae5c7901c867e334084869da5c69ea9"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Search"><file name="Anymarketattributes.php" hash="9c70e239108635285a267800c92a5497"/><file name="Anymarketbrands.php" hash="e6ab4761f6162f7eaa0ed9c54ffa0f67"/><file name="Anymarketlog.php" hash="587fd8a1b7579d03a221531e04b16e72"/><file name="Anymarketorders.php" hash="e80623045edfecd2b31469d0ddaae65e"/><file name="Anymarketproducts.php" hash="98721db042c261f99ed4dac40af60b5d"/><file name="Anymarketqueue.php" hash="fe750b1048ed725c715084002eea3bd7"/></dir></dir><dir name="Anymarketattributes"><dir name="Api"><file name="V2.php" hash="2968c2cbc85867bf9689b3925d8661aa"/></dir><file name="Api.php" hash="c08643eee1e8a850a77e1da60b1934f5"/></dir><file name="Anymarketattributes.php" hash="fdb23d6c461452efacdbd3e3fdf7da6e"/><dir name="Anymarketbrands"><dir name="Api"><file name="V2.php" hash="d3e2e0763c146aa4c4260455decfa811"/></dir><file name="Api.php" hash="a197ecaab03dbbb136de2cd6eee4b6a6"/></dir><file name="Anymarketbrands.php" hash="8ae2eacd73d8e72ee69861e0dd763995"/><dir name="Anymarketcategories"><dir name="Api"><file name="V2.php" hash="9be73fc1875d16263554fb9d6220cfce"/></dir><file name="Api.php" hash="54b1068a7c5939e16382311691279664"/></dir><file name="Anymarketcategories.php" hash="56fb7c4397c3058124765c291c666727"/><dir name="Anymarketlog"><dir name="Api"><file name="V2.php" hash="f252eafdd842b105c8952567a5b0ece7"/></dir><file name="Api.php" hash="3424e96e46745bcc76fb3aca2073490e"/></dir><file name="Anymarketlog.php" hash="b2eee6d6ceb878147125ed59570d84bd"/><dir name="Anymarketorders"><dir name="Api"><file name="V2.php" hash="0b11c1be24355033a571d2e56f508d19"/></dir><file name="Api.php" hash="a8d2625d6b56d5596cc9af41151c019e"/></dir><file name="Anymarketorders.php" hash="6d4b8b112af994e6cd2e67eeadb56871"/><dir name="Anymarketproducts"><dir name="Api"><file name="V2.php" hash="d1b289e2fdd26b80c4d921bec5dfa339"/></dir><file name="Api.php" hash="bf63b0e5c0a56fb036807ddfbfb50feb"/></dir><file name="Anymarketproducts.php" hash="cb1fa1d36033d52d09bd485f164bb279"/><dir name="Anymarketqueue"><dir name="Api"><file name="V2.php" hash="e9c8a4c3612249d39d984c29d1ef548a"/></dir><file name="Api.php" hash="eb142eb9f3f92cb950596d47044f3050"/></dir><file name="Anymarketqueue.php" hash="7d2c450d809f530e31c1b6e27374e17d"/><file name="Cron.php" hash="f82e198f7675c4e1a06371024e2a0eba"/><file name="Observer.php" hash="d9038ad0f80a0df06353cb05a5deb06a"/><file name="PaymentMethod.php" hash="7c10a39a005e03d0d0530041bee95a9e"/><dir name="Resource"><dir name="Anymarketattributes"><file name="Collection.php" hash="36566dd648113fbd096ae4c9f2574058"/></dir><file name="Anymarketattributes.php" hash="07099d8acd0244dd22ef3aa591c4d4be"/><dir name="Anymarketbrands"><file name="Collection.php" hash="f542cb47a58e77017a90d4b9733e354b"/></dir><file name="Anymarketbrands.php" hash="aad2b54e04e58df24f9f518e67237d27"/><dir name="Anymarketcategories"><file name="Collection.php" hash="f58ef5b5397c8fdfd68dd860d2998dd6"/></dir><file name="Anymarketcategories.php" hash="80c0ea6b443d2beadc3e0d8fb3329e49"/><dir name="Anymarketlog"><file name="Collection.php" hash="e1b37efe779188ded01622a383c39f7e"/></dir><file name="Anymarketlog.php" hash="69ce526695527d4469f7cae4604d24f9"/><dir name="Anymarketorders"><file name="Collection.php" hash="45ec7c3ccf2de78cf5d0c95e1ea1f3f4"/></dir><file name="Anymarketorders.php" hash="1879ab46e3f47772db8b23710cc3c2ac"/><dir name="Anymarketproducts"><file name="Collection.php" hash="fc88402b7281c58a79b8fb4b8ab5645e"/></dir><file name="Anymarketproducts.php" hash="51ab548790054880bccce85b12e111ea"/><dir name="Anymarketqueue"><file name="Collection.php" hash="c7ce0a9ce11f376cc05d3afefe6ad8ba"/></dir><file name="Anymarketqueue.php" hash="be077e58f0eb8d8e5bbf660c70ff0c8a"/><file name="Setup.php" hash="0df420432c06cee997f9a43e9ca42fd2"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Attributes"><dir name="Customer"><dir name="Group"><file name="Values.php" hash="b3da25e6f5bbd22f88951a40f21c0062"/></dir><dir name="Street"><file name="Values.php" hash="c219bd519b968f614c92aa564272d1b3"/></dir><file name="Values.php" hash="74b98a8dbf05e3089bd9885d610b9203"/></dir><dir name="Product"><dir name="Booleantp"><file name="Values.php" hash="9b80052d0ed97cbbf4ba9f72c0a3e0a9"/></dir><dir name="Price"><file name="Values.php" hash="a9f6f4a2bef252b0731c7d82ebf36ddb"/></dir><file name="Values.php" hash="1000fd8c2cb40456c7ee3671bd06b1b9"/></dir><dir name="Set"><file name="Values.php" hash="c0c0ba6a8f7fcd48896ab4916ca8d515"/></dir></dir><dir name="Categories"><file name="Values.php" hash="f59129783eb797e1c088ef5ac332dc92"/></dir><dir name="General"><file name="Values.php" hash="75e19820d0a8b049e683a68cee20c2b2"/></dir><dir name="Logs"><file name="Values.php" hash="714f462254b42d1ba36546dbd55e06f9"/></dir><dir name="Massunit"><file name="Values.php" hash="475bc7d4556c5f42728b774d7b6749f2"/></dir><dir name="Measurementunit"><file name="Values.php" hash="0831cd50cddff66d9c97339d1a4d61ad"/></dir><dir name="Orders"><file name="Values.php" hash="6df0f33ada91098ba026bd006bd7b9d0"/></dir><dir name="Typesync"><dir name="Order"><file name="Values.php" hash="f2fe8cde6e3ae10cac6a26500fc0984b"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Anymarket"><file name="AnymarketattributesController.php" hash="29db5f472baef6f064861a90577b3d39"/><file name="AnymarketbrandsController.php" hash="8e527c5c0e140e78815c9fb385023112"/><file name="AnymarketcategoriesController.php" hash="74468898d76dece1d5e14dcb9f815fc0"/><file name="AnymarketlogController.php" hash="8dbbbc42b687ad8056e98e61bff72a91"/><file name="AnymarketordersController.php" hash="d385cf6aabb0d46d1b77cedb2f408fe7"/><file name="AnymarketproductsController.php" hash="1548e718073f181fab1faac29dc698ec"/><file name="AnymarketqueueController.php" hash="8fc629165bfeb675d5c7230faca69e63"/></dir><file name="AnymarketController.php" hash="c84286b666ed0bcd988346b2fc46467d"/></dir><file name="IndexController.php" hash="377c4bed65fdf284f793d249cb59650c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="59c70a74d5d791a85a6783dc6c2d954a"/><file name="api.xml" hash="3546bfaef38893f387c70879f8f62bd5"/><file name="config.xml" hash="71bbe2dae5b27f90e47e0f2a053fedb2"/><file name="system.xml" hash="e1f756b9d72ce52d3df13d254e2ee617"/><file name="wsdl.xml" hash="92472d43f8c69fea0b2ca67c102225c6"/><file name="wsi.xml" hash="e7e1d615fdad47f1454edcb4cea6b6df"/></dir><dir name="sql"><dir name="db1_anymarket_setup"><file name="mysql4-install-1.0.0.php" hash="78272b736dd84175c2a929f56e195854"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="08975052bef31e56c8fad046b599b4a8"/><file name="mysql4-upgrade-1.1.0-1.2.0.php" hash="e7af419b7793c1047e5d943f5b790ffb"/><file name="mysql4-upgrade-1.2.0-1.3.0.php" hash="850f538334af173a2918078c87cbfb16"/><file name="mysql4-upgrade-1.3.0-1.4.0.php" hash="1e4a102ab2de2f4af4250c6d7b31b4e3"/><file name="mysql4-upgrade-1.4.0-1.5.0.php" hash="4a21c4dff0151d55d62c5023f7b29930"/><file name="mysql4-upgrade-1.5.0-1.6.0.php" hash="c9ebd2ab6bdd29f0b7eb7e92a66887b0"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="f822917939bf63eb1b51e517a300baf8"/><file name="mysql4-upgrade-1.7.0-1.8.0.php" hash="59ff14275617b4d828eaf8dcc36bc080"/><file name="mysql4-upgrade-1.8.0-2.0.0.php" hash="f84214fc43f665c79b92dc7a092b364f"/><file name="mysql4-upgrade-2.0.0-2.1.0.php" hash="f27d52b9e03093827edf2da66df9af95"/><file name="mysql4-upgrade-2.1.0-2.2.0.php" hash="8540010143d20286287e9b3abfee11f9"/><file name="mysql4-upgrade-2.2.0-2.3.6.php" hash="e5e770b4ab8ba48e177efbc1d613fb3c"/><file name="mysql4-upgrade-2.3.6-2.3.9.php" hash="8482a0d785e4abdfb0e060014c2849f2"/><file name="mysql4-upgrade-2.3.9-2.4.0.php" hash="0c70f1b41ed5bc1c5009c3be94aabc85"/><file name="mysql4-upgrade-2.4.0-2.4.3.php" hash="3b0e01bd5ba4afef89cfbe40305f9087"/><file name="mysql4-upgrade-2.4.3-2.4.4.php" hash="8540010143d20286287e9b3abfee11f9"/><file name="mysql4-upgrade-2.4.4-2.9.1.php" hash="1227a2f27f4144df4d1bbfc928f97d83"/><file name="mysql4-upgrade-2.9.1-2.9.2.php" hash="cbf2ebc39de43a793b54460631eb6668"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="DB1_AnyMarket.xml" hash="98dd8e192a0a2ad509ce5a50c6c40f98"/></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="DB1_AnyMarket.csv" hash="3c464aa9a9643570436eb7afe5dcb28d"/></dir><dir name="pt_BR"><file name="DB1_AnyMarket.csv" hash="e690e6802f73adfeff24e716f5b47d86"/></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="db1_anymarket.xml" hash="47bb7ca814c58a2985f198c3703f1d58"/></dir><dir name="template"><dir name="db1"><dir name="anymarket"><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array_dropdown.phtml" hash="6a0ec3bf507fe6211ca0ad4825325c57"/><file name="button_check_configuration.phtml" hash="252673865f738851cacc1337948b8f86"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.4.0</min><max>5.7.0</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>d7db67d0d012350a01ce05c31f91754d</name>
4
+ <version>2.12.1</version>
5
+ <stability>stable</stability>
6
  <license>Mozilla Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Integrador entre Magento e Anymarket.</summary>
10
  <description>Mantem um fluxo continuo de integra&#xE7;&#xE3;o de Produtos e Pedidos entre Magento e Anymarket.</description>
11
+ <notes>* Pequenas Corre&#xE7;&#xF5;es.&#xD;
12
  &#xD;
13
  &#xD;
14
  Para mais informa&#xE7;&#xF5;es acesse: &#xD;
15
  https://github.com/AnyMarket/magento</notes>
16
+ <authors><author><name>Anymarket</name><user>Anymarket</user><email>dev@anymarket.com.br</email></author></authors>
17
+ <date>2017-01-12</date>
18
+ <time>11:28:49</time>
19
+ <contents><target name="magecommunity"><dir name="DB1"><dir name="AnyMarket"><dir name="Block"><dir name="Adminhtml"><dir name="Anymarketattributes"><dir name="Edit"><file name="Form.php" hash="2f7fc99eb1e822aec20e00ac2f09e9b6"/><dir name="Tab"><file name="Form.php" hash="b993f886f391902526c13ed921e67f64"/><file name="Stores.php" hash="e2f9a83dcc1c5643584607a9788ce991"/></dir><file name="Tabs.php" hash="c7ea19d365aa6dd186bb5586748c8a36"/></dir><file name="Edit.php" hash="adf55bcb491bb6c4d839ba54228f38bb"/><file name="Grid.php" hash="318ced337407c824b4ed93a6f30b7fb3"/></dir><file name="Anymarketattributes.php" hash="3dec5da837e1bcb3813a55a21cf70452"/><dir name="Anymarketbrands"><dir name="Edit"><file name="Form.php" hash="70295f473585677c25ccb69c729ad264"/><dir name="Tab"><file name="Form.php" hash="5baa22a93472a4552619554aa2f5b74d"/><file name="Stores.php" hash="989e32b60c014c3feb15b394ac75e495"/></dir><file name="Tabs.php" hash="3f38d3849c9c5191f05b6de6e48e1244"/></dir><file name="Edit.php" hash="bb5ee750685a202d059adf7c62207f8d"/><file name="Grid.php" hash="cbc4ea24f205fc5892d5c462a6702550"/></dir><file name="Anymarketbrands.php" hash="efa9ef9b3666136f2a2158bd69860d60"/><dir name="Anymarketcategories"><dir name="Edit"><file name="Form.php" hash="738927ef6cc0cb36d9a318a3fc0494a4"/><dir name="Tab"><file name="Form.php" hash="6b724bea8807e42a5e58607643d10623"/><file name="Stores.php" hash="2065ee5d47b8c7e7632b6311e4dc65eb"/></dir><file name="Tabs.php" hash="4097937c822b540a533390a60a33a0ad"/></dir><file name="Edit.php" hash="ad21c818418accadb19c9e73c964f503"/><file name="Grid.php" hash="b280d8f866c21c1a66373005d7a904d5"/></dir><file name="Anymarketcategories.php" hash="66b271b3c3cdc31153d4a9e4d258bf20"/><dir name="Anymarketlog"><dir name="Edit"><file name="Form.php" hash="475dcc08db1d6e73d0d3fa56916d1c7b"/><dir name="Tab"><file name="Form.php" hash="20949829f756ecbe695308a9ba3dc246"/><file name="Stores.php" hash="6c33618d5556292dd07b037a3ef0b9a4"/></dir><file name="Tabs.php" hash="778a968aa9ed006577ca1b06821ee8d7"/></dir><file name="Edit.php" hash="14bc221c3b69fd79d6c09eaaba2792bb"/><file name="Grid.php" hash="bde6093b89b3db92a25abf3124cd1714"/></dir><file name="Anymarketlog.php" hash="7da774661bfe410cb6df3a1d4bd33f5a"/><dir name="Anymarketorders"><dir name="Edit"><file name="Form.php" hash="40cdd96c786c522f15c0c0df583cd861"/><dir name="Tab"><file name="Form.php" hash="7e6185c620c6ce784055c436609a29c2"/><file name="Stores.php" hash="eae8bbfa5ce5d2d1c3aa76cf09895b62"/></dir><file name="Tabs.php" hash="fd93f19227b2e46c74cadbcf642b936e"/></dir><file name="Edit.php" hash="b887ae08790c7babbc3b386208e57901"/><file name="Grid.php" hash="940a0ca57208c8fe37660a3c567f2f59"/></dir><file name="Anymarketorders.php" hash="59e93a88b8c82e1a8cfb2bd246cff259"/><dir name="Anymarketproducts"><dir name="Edit"><file name="Form.php" hash="980603f48914a1287c2e7c15e4c86d83"/><dir name="Tab"><file name="Form.php" hash="245eab4f574907f0db6bffcd651b6b8c"/><file name="Stores.php" hash="2cec2058ef922bc7cc89511d06d1cf72"/></dir><file name="Tabs.php" hash="1ff12beae435c878edb912960ae17a47"/></dir><file name="Edit.php" hash="efee68f9e82522aeb3908a29cb65d388"/><file name="Grid.php" hash="28abacf7c5294e6d991f363bb4c11afc"/></dir><file name="Anymarketproducts.php" hash="3bac9100d555bd07ab9d0b368994bea2"/><dir name="Anymarketqueue"><dir name="Edit"><file name="Form.php" hash="fd9c0ce4afcf1c12657b180666224e97"/><dir name="Tab"><file name="Form.php" hash="aa603b428632caaf0a51c4d9021f3f08"/><file name="Stores.php" hash="08bdd73cf10ea1fe2bc4a963f0737cc6"/></dir><file name="Tabs.php" hash="381579dc284c6f27acea660886fdbc5f"/></dir><file name="Edit.php" hash="7decfc10b577b4d99c342d23b4a75c01"/><file name="Grid.php" hash="5fb19f0ee6387b4f500191ed4f596e3c"/></dir><file name="Anymarketqueue.php" hash="ae3c146ea8a2b0999a762917d8645dff"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Buttoncheckconfig.php" hash="344078aec3e91f5f8915272935d0a391"/><file name="Callback.php" hash="0e721a318ec6d95e7671f2bdfd0e7c11"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Orders"><dir name="Statusammg"><file name="Values.php" hash="931376d93d7ad770aae1755aa05d880f"/></dir><dir name="Statusmgam"><file name="Values.php" hash="3e39fcc15a9400f09b525ff130aaf775"/></dir></dir><dir name="Products"><file name="Values.php" hash="87e7e2ecaa08fc0c21d7ee93799a6f91"/></dir></dir></dir></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="AnyMarket.php" hash="6d1473008f995a33e619b4d00465ccc0"/></dir></dir><dir name="Helper"><file name="Brand.php" hash="48c1fe421cd14cfe2fa29768d2e06916"/><file name="Category.php" hash="01169a1aa216b248456ec328d4654c72"/><file name="Customergenerator.php" hash="2e9ea1ede85d01637c21d8f59894709d"/><file name="Data.php" hash="b5ea9f8344d98375765712c6d742cb2e"/><file name="Image.php" hash="a92a6cf28986d70c58cd2c6c6422be17"/><file name="Order.php" hash="540f616f5c0f8f790345520801b57b01"/><file name="Ordergenerator.php" hash="07fbf055d244590690c90eded6981f9c"/><file name="Product.php" hash="5ea9360836764bbb1fa1a760bfa0d422"/><file name="Productgenerator.php" hash="01eaa4f914cb421ee69d55ef335e6b20"/><file name="Queue.php" hash="e899ff8f810df71d8d6a6758e8e80590"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Search"><file name="Anymarketattributes.php" hash="9c70e239108635285a267800c92a5497"/><file name="Anymarketbrands.php" hash="e6ab4761f6162f7eaa0ed9c54ffa0f67"/><file name="Anymarketimage.php" hash="4d913b790b95b9b7fc1303686e0f5612"/><file name="Anymarketlog.php" hash="587fd8a1b7579d03a221531e04b16e72"/><file name="Anymarketorders.php" hash="e80623045edfecd2b31469d0ddaae65e"/><file name="Anymarketproducts.php" hash="98721db042c261f99ed4dac40af60b5d"/><file name="Anymarketqueue.php" hash="fe750b1048ed725c715084002eea3bd7"/></dir></dir><dir name="Anymarketattributes"><dir name="Api"><file name="V2.php" hash="2968c2cbc85867bf9689b3925d8661aa"/></dir><file name="Api.php" hash="c08643eee1e8a850a77e1da60b1934f5"/></dir><file name="Anymarketattributes.php" hash="fdb23d6c461452efacdbd3e3fdf7da6e"/><dir name="Anymarketbrands"><dir name="Api"><file name="V2.php" hash="d3e2e0763c146aa4c4260455decfa811"/></dir><file name="Api.php" hash="a197ecaab03dbbb136de2cd6eee4b6a6"/></dir><file name="Anymarketbrands.php" hash="8ae2eacd73d8e72ee69861e0dd763995"/><dir name="Anymarketcategories"><dir name="Api"><file name="V2.php" hash="9be73fc1875d16263554fb9d6220cfce"/></dir><file name="Api.php" hash="54b1068a7c5939e16382311691279664"/></dir><file name="Anymarketcategories.php" hash="56fb7c4397c3058124765c291c666727"/><file name="Anymarketimage.php" hash="2b4a3ebc56e56ce15084b055abb39c56"/><dir name="Anymarketlog"><dir name="Api"><file name="V2.php" hash="f252eafdd842b105c8952567a5b0ece7"/></dir><file name="Api.php" hash="3424e96e46745bcc76fb3aca2073490e"/></dir><file name="Anymarketlog.php" hash="468e64ace3c94b0b94b0dbc960364812"/><dir name="Anymarketorders"><dir name="Api"><file name="V2.php" hash="0b11c1be24355033a571d2e56f508d19"/></dir><file name="Api.php" hash="58bfa90b87fd60f494806958bd4544da"/></dir><file name="Anymarketorders.php" hash="6d4b8b112af994e6cd2e67eeadb56871"/><dir name="Anymarketproducts"><dir name="Api"><file name="V2.php" hash="d1b289e2fdd26b80c4d921bec5dfa339"/></dir><file name="Api.php" hash="bec21f702fa1deaaed64434c7f11aa7d"/></dir><file name="Anymarketproducts.php" hash="cb1fa1d36033d52d09bd485f164bb279"/><dir name="Anymarketqueue"><dir name="Api"><file name="V2.php" hash="e9c8a4c3612249d39d984c29d1ef548a"/></dir><file name="Api.php" hash="eb142eb9f3f92cb950596d47044f3050"/></dir><file name="Anymarketqueue.php" hash="7d2c450d809f530e31c1b6e27374e17d"/><file name="Cron.php" hash="176cc97201effe46f7042b2ac93a663c"/><file name="Observer.php" hash="0c2b66c33a33868c32366755a5b7a4a9"/><file name="PaymentMethod.php" hash="7c10a39a005e03d0d0530041bee95a9e"/><dir name="Resource"><dir name="Anymarketattributes"><file name="Collection.php" hash="36566dd648113fbd096ae4c9f2574058"/></dir><file name="Anymarketattributes.php" hash="07099d8acd0244dd22ef3aa591c4d4be"/><dir name="Anymarketbrands"><file name="Collection.php" hash="f542cb47a58e77017a90d4b9733e354b"/></dir><file name="Anymarketbrands.php" hash="aad2b54e04e58df24f9f518e67237d27"/><dir name="Anymarketcategories"><file name="Collection.php" hash="f58ef5b5397c8fdfd68dd860d2998dd6"/></dir><file name="Anymarketcategories.php" hash="80c0ea6b443d2beadc3e0d8fb3329e49"/><dir name="Anymarketimage"><file name="Collection.php" hash="67e15d3d1df7fe17a74e3155e27d32e1"/></dir><file name="Anymarketimage.php" hash="f062a9c5adb7f9f47265d07025e844d9"/><dir name="Anymarketlog"><file name="Collection.php" hash="e1b37efe779188ded01622a383c39f7e"/></dir><file name="Anymarketlog.php" hash="69ce526695527d4469f7cae4604d24f9"/><dir name="Anymarketorders"><file name="Collection.php" hash="45ec7c3ccf2de78cf5d0c95e1ea1f3f4"/></dir><file name="Anymarketorders.php" hash="1879ab46e3f47772db8b23710cc3c2ac"/><dir name="Anymarketproducts"><file name="Collection.php" hash="fc88402b7281c58a79b8fb4b8ab5645e"/></dir><file name="Anymarketproducts.php" hash="51ab548790054880bccce85b12e111ea"/><dir name="Anymarketqueue"><file name="Collection.php" hash="c7ce0a9ce11f376cc05d3afefe6ad8ba"/></dir><file name="Anymarketqueue.php" hash="be077e58f0eb8d8e5bbf660c70ff0c8a"/><file name="Setup.php" hash="0df420432c06cee997f9a43e9ca42fd2"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Attributes"><dir name="Customer"><dir name="Group"><file name="Values.php" hash="b3da25e6f5bbd22f88951a40f21c0062"/></dir><dir name="Street"><file name="Values.php" hash="c219bd519b968f614c92aa564272d1b3"/></dir><file name="Values.php" hash="74b98a8dbf05e3089bd9885d610b9203"/></dir><dir name="Product"><dir name="Booleantp"><file name="Values.php" hash="9b80052d0ed97cbbf4ba9f72c0a3e0a9"/></dir><dir name="Price"><file name="Values.php" hash="a9f6f4a2bef252b0731c7d82ebf36ddb"/></dir><file name="Values.php" hash="1000fd8c2cb40456c7ee3671bd06b1b9"/></dir><dir name="Set"><file name="Values.php" hash="c0c0ba6a8f7fcd48896ab4916ca8d515"/></dir></dir><dir name="Categories"><file name="Values.php" hash="f59129783eb797e1c088ef5ac332dc92"/></dir><dir name="General"><file name="Values.php" hash="75e19820d0a8b049e683a68cee20c2b2"/></dir><dir name="Logs"><file name="Values.php" hash="714f462254b42d1ba36546dbd55e06f9"/></dir><dir name="Massunit"><file name="Values.php" hash="475bc7d4556c5f42728b774d7b6749f2"/></dir><dir name="Measurementunit"><file name="Values.php" hash="0831cd50cddff66d9c97339d1a4d61ad"/></dir><dir name="Orders"><file name="Values.php" hash="6df0f33ada91098ba026bd006bd7b9d0"/></dir><dir name="Typesync"><dir name="Order"><file name="Values.php" hash="f2fe8cde6e3ae10cac6a26500fc0984b"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Anymarket"><file name="AnymarketattributesController.php" hash="29db5f472baef6f064861a90577b3d39"/><file name="AnymarketbrandsController.php" hash="8e527c5c0e140e78815c9fb385023112"/><file name="AnymarketcategoriesController.php" hash="74468898d76dece1d5e14dcb9f815fc0"/><file name="AnymarketlogController.php" hash="8dbbbc42b687ad8056e98e61bff72a91"/><file name="AnymarketordersController.php" hash="8fd37b92f7b556b2a392383c340c8bcb"/><file name="AnymarketproductsController.php" hash="1548e718073f181fab1faac29dc698ec"/><file name="AnymarketqueueController.php" hash="8fc629165bfeb675d5c7230faca69e63"/></dir><file name="AnymarketController.php" hash="a529e1e081c3a1e736a8f306f5be415e"/></dir><file name="IndexController.php" hash="d9f12ff47322ff5a6cf383ee45a881a2"/></dir><dir name="etc"><file name="adminhtml.xml" hash="59c70a74d5d791a85a6783dc6c2d954a"/><file name="api.xml" hash="3546bfaef38893f387c70879f8f62bd5"/><file name="config.xml" hash="5f2fa5fb2dd53a45335661c6e41f892a"/><file name="system.xml" hash="7c3dd956162382da981cf7f8daef776a"/><file name="wsdl.xml" hash="92472d43f8c69fea0b2ca67c102225c6"/><file name="wsi.xml" hash="e7e1d615fdad47f1454edcb4cea6b6df"/></dir><dir name="sql"><dir name="db1_anymarket_setup"><file name="mysql4-install-1.0.0.php" hash="78272b736dd84175c2a929f56e195854"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="08975052bef31e56c8fad046b599b4a8"/><file name="mysql4-upgrade-1.1.0-1.2.0.php" hash="e7af419b7793c1047e5d943f5b790ffb"/><file name="mysql4-upgrade-1.2.0-1.3.0.php" hash="850f538334af173a2918078c87cbfb16"/><file name="mysql4-upgrade-1.3.0-1.4.0.php" hash="1e4a102ab2de2f4af4250c6d7b31b4e3"/><file name="mysql4-upgrade-1.4.0-1.5.0.php" hash="4a21c4dff0151d55d62c5023f7b29930"/><file name="mysql4-upgrade-1.5.0-1.6.0.php" hash="c9ebd2ab6bdd29f0b7eb7e92a66887b0"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="f822917939bf63eb1b51e517a300baf8"/><file name="mysql4-upgrade-1.7.0-1.8.0.php" hash="59ff14275617b4d828eaf8dcc36bc080"/><file name="mysql4-upgrade-1.8.0-2.0.0.php" hash="f84214fc43f665c79b92dc7a092b364f"/><file name="mysql4-upgrade-2.0.0-2.1.0.php" hash="f27d52b9e03093827edf2da66df9af95"/><file name="mysql4-upgrade-2.1.0-2.2.0.php" hash="8540010143d20286287e9b3abfee11f9"/><file name="mysql4-upgrade-2.11.1-2.11.2.php" hash="17464aee4579bfbfc8c725a6d796f0e4"/><file name="mysql4-upgrade-2.11.2-2.11.3.php" hash="a74433b5f3419ba6b399814134854633"/><file name="mysql4-upgrade-2.11.3-2.11.4.php" hash="f2a0aa070b0a70cc3122f2dfc7261c40"/><file name="mysql4-upgrade-2.2.0-2.3.6.php" hash="e5e770b4ab8ba48e177efbc1d613fb3c"/><file name="mysql4-upgrade-2.3.6-2.3.9.php" hash="8482a0d785e4abdfb0e060014c2849f2"/><file name="mysql4-upgrade-2.3.9-2.4.0.php" hash="f170e03c9b93cb2eb17b5fe5e1e9c66c"/><file name="mysql4-upgrade-2.4.0-2.4.3.php" hash="3b0e01bd5ba4afef89cfbe40305f9087"/><file name="mysql4-upgrade-2.4.3-2.4.4.php" hash="8540010143d20286287e9b3abfee11f9"/><file name="mysql4-upgrade-2.4.4-2.9.1.php" hash="1227a2f27f4144df4d1bbfc928f97d83"/><file name="mysql4-upgrade-2.9.1-2.9.2.php" hash="cbf2ebc39de43a793b54460631eb6668"/><file name="mysql4-upgrade-2.9.2-2.11.1.php" hash="1227a2f27f4144df4d1bbfc928f97d83"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="DB1_AnyMarket.xml" hash="98dd8e192a0a2ad509ce5a50c6c40f98"/></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="DB1_AnyMarket.csv" hash="3c464aa9a9643570436eb7afe5dcb28d"/></dir><dir name="pt_BR"><file name="DB1_AnyMarket.csv" hash="e690e6802f73adfeff24e716f5b47d86"/></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="db1_anymarket.xml" hash="76c6b9cf46033d4030796b71cd8a4dfd"/></dir><dir name="template"><dir name="db1"><dir name="anymarket"><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array_dropdown.phtml" hash="6a0ec3bf507fe6211ca0ad4825325c57"/><file name="button_check_configuration.phtml" hash="252673865f738851cacc1337948b8f86"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.4.0</min><max>5.7.0</max></php></required></dependencies>
22
  </package>