Springbot - Version 1.5.2.2

Version Notes

Fix for PHP 5.3 and below where function calls were used as arrays. This notation is only supported in PHP 5.4 and above.

Download this release

Release Info

Developer Springbot Integrations Team
Extension Springbot
Version 1.5.2.2
Comparing to
See all releases


Code changes from version 1.5.2.1 to 1.5.2.2

Files changed (294) hide show
  1. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Auth.php +10 -0
  2. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Bmbleb/Login.php +39 -0
  3. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Bmbleb/Login/Form.php +85 -0
  4. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Connected.php +10 -0
  5. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Help.php +11 -0
  6. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Index.php +20 -0
  7. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Index/Messages.php +13 -0
  8. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Index/Terms.php +9 -0
  9. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Jobs.php +13 -0
  10. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Jobs/Grid.php +97 -0
  11. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Jobs/Status.php +75 -0
  12. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Login.php +10 -0
  13. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Logout.php +10 -0
  14. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Logs.php +16 -0
  15. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Notifications.php +27 -0
  16. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Order/Marketplaces.php +42 -0
  17. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Status.php +10 -0
  18. Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Tabs.php +32 -0
  19. Springbot-1.5.2.2/Springbot/Bmbleb/Helper/Account.php +112 -0
  20. Springbot-1.5.2.2/Springbot/Bmbleb/Helper/Data.php +6 -0
  21. Springbot-1.5.2.2/Springbot/Bmbleb/Helper/PluginStatus.php +30 -0
  22. Springbot-1.5.2.2/Springbot/Bmbleb/Model/Bmbleb.php +10 -0
  23. Springbot-1.5.2.2/Springbot/Bmbleb/Model/Observer.php +21 -0
  24. Springbot-1.5.2.2/Springbot/Bmbleb/Model/Status.php +15 -0
  25. Springbot-1.5.2.2/Springbot/Bmbleb/Model/Sync.php +28 -0
  26. Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/HelpController.php +17 -0
  27. Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/IndexController.php +75 -0
  28. Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/JobsController.php +85 -0
  29. Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/LoginController.php +65 -0
  30. Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/LogsController.php +35 -0
  31. Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/SettingsController.php +69 -0
  32. Springbot-1.5.2.2/Springbot/Bmbleb/etc/config.xml +117 -0
  33. Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestAbstract.php +83 -0
  34. Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestAttribute/Observer.php +53 -0
  35. Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestCart/Observer.php +191 -0
  36. Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestCategory/Observer.php +38 -0
  37. Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestCustomer/Observer.php +59 -0
  38. Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestInventoryItem/Observer.php +101 -0
  39. Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestProduct/Observer.php +80 -0
  40. Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestPurchase/Observer.php +116 -0
  41. Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestRule/Observer.php +94 -0
  42. Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestSubscriber/Observer.php +39 -0
  43. Springbot-1.5.2.2/Springbot/BoneCollector/etc/config.xml +228 -0
  44. Springbot-1.5.2.2/Springbot/Boss.php +205 -0
  45. Springbot-1.5.2.2/Springbot/Cli.php +179 -0
  46. Springbot-1.5.2.2/Springbot/Combine/Helper/Attributes.php +171 -0
  47. Springbot-1.5.2.2/Springbot/Combine/Helper/Cart.php +28 -0
  48. Springbot-1.5.2.2/Springbot/Combine/Helper/Data.php +237 -0
  49. Springbot-1.5.2.2/Springbot/Combine/Helper/Harvest.php +402 -0
  50. Springbot-1.5.2.2/Springbot/Combine/Helper/Marketplaces.php +38 -0
  51. Springbot-1.5.2.2/Springbot/Combine/Helper/Parser.php +267 -0
  52. Springbot-1.5.2.2/Springbot/Combine/Helper/Redirect.php +135 -0
  53. Springbot-1.5.2.2/Springbot/Combine/Helper/Store.php +40 -0
  54. Springbot-1.5.2.2/Springbot/Combine/Helper/Trackable.php +63 -0
  55. Springbot-1.5.2.2/Springbot/Combine/Model/Action.php +62 -0
  56. Springbot-1.5.2.2/Springbot/Combine/Model/Api.php +171 -0
  57. Springbot-1.5.2.2/Springbot/Combine/Model/Cron.php +25 -0
  58. Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Count.php +86 -0
  59. Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Manager/Status.php +107 -0
  60. Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Queue.php +123 -0
  61. Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Queue/Batch.php +76 -0
  62. Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Queue/Batch/Row.php +39 -0
  63. Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Worker.php +91 -0
  64. Springbot-1.5.2.2/Springbot/Combine/Model/File/Io.php +146 -0
  65. Springbot-1.5.2.2/Springbot/Combine/Model/File/Path.php +75 -0
  66. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest.php +270 -0
  67. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/AttributeSets.php +64 -0
  68. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Carts.php +36 -0
  69. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Categories.php +34 -0
  70. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Coupons.php +38 -0
  71. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/CustomerAttributeSets.php +64 -0
  72. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Customers.php +31 -0
  73. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Guests.php +30 -0
  74. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Inventories.php +59 -0
  75. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Products.php +35 -0
  76. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Purchases.php +32 -0
  77. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Rules.php +39 -0
  78. Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Subscribers.php +37 -0
  79. Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Order/Builder.php +270 -0
  80. Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Order/Customer.php +135 -0
  81. Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Order/Item.php +92 -0
  82. Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Order/Parser.php +41 -0
  83. Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/OrderService.php +43 -0
  84. Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Payment.php +10 -0
  85. Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Remote/Order.php +24 -0
  86. Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Shipping.php +23 -0
  87. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Action.php +5 -0
  88. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Action/Collection.php +5 -0
  89. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Cron/Count.php +5 -0
  90. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Cron/Queue.php +5 -0
  91. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Cron/Queue/Collection.php +5 -0
  92. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Redirect.php +5 -0
  93. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Redirect/Collection.php +5 -0
  94. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Redirect/Order.php +5 -0
  95. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Redirect/Order/Collection.php +5 -0
  96. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Setup.php +5 -0
  97. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Trackable.php +5 -0
  98. Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Trackable/Collection.php +5 -0
  99. Springbot-1.5.2.2/Springbot/Combine/Model/Parser.php +190 -0
  100. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/AttributeSet.php +42 -0
  101. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Category.php +31 -0
  102. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Coupon.php +32 -0
  103. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Customer.php +115 -0
  104. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/CustomerAttributeSet.php +29 -0
  105. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Guest.php +84 -0
  106. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Inventory.php +50 -0
  107. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Product.php +94 -0
  108. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Purchase.php +192 -0
  109. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Purchase/Item.php +114 -0
  110. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Purchase/Shipment.php +48 -0
  111. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Quote.php +79 -0
  112. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Quote/Item.php +92 -0
  113. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Rule.php +52 -0
  114. Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Subscriber.php +44 -0
  115. Springbot-1.5.2.2/Springbot/Combine/Model/Redirect.php +47 -0
  116. Springbot-1.5.2.2/Springbot/Combine/Model/Redirect/Order.php +34 -0
  117. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Abstract.php +58 -0
  118. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Action.php +79 -0
  119. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Action/Collection.php +25 -0
  120. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Cron/Count.php +68 -0
  121. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Cron/Count/Collection.php +11 -0
  122. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Cron/Queue.php +77 -0
  123. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Cron/Queue/Collection.php +72 -0
  124. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Debug.php +66 -0
  125. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Marketplaces/Remote/Order.php +10 -0
  126. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Marketplaces/Remote/Order/Collection.php +10 -0
  127. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Redirect.php +13 -0
  128. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Redirect/Collection.php +45 -0
  129. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Redirect/Order.php +10 -0
  130. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Redirect/Order/Collection.php +15 -0
  131. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Setup.php +258 -0
  132. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Trackable.php +32 -0
  133. Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Trackable/Collection.php +9 -0
  134. Springbot-1.5.2.2/Springbot/Combine/Model/Rewrite.php +150 -0
  135. Springbot-1.5.2.2/Springbot/Combine/Model/System/Config/Source/Harvestertype.php +12 -0
  136. Springbot-1.5.2.2/Springbot/Combine/Model/System/Config/Source/LogFormat.php +13 -0
  137. Springbot-1.5.2.2/Springbot/Combine/Model/System/Config/Source/LogLevel.php +12 -0
  138. Springbot-1.5.2.2/Springbot/Combine/Model/System/Config/Source/Stability.php +13 -0
  139. Springbot-1.5.2.2/Springbot/Combine/Model/System/Config/Source/UrlType.php +13 -0
  140. Springbot-1.5.2.2/Springbot/Combine/Model/Trackable.php +76 -0
  141. Springbot-1.5.2.2/Springbot/Combine/etc/adminhtml.xml +22 -0
  142. Springbot-1.5.2.2/Springbot/Combine/etc/config.xml +168 -0
  143. Springbot-1.5.2.2/Springbot/Combine/etc/system.xml +349 -0
  144. Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-install-1.0.0.70.php +17 -0
  145. Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.0.0.70-1.0.0.84.php +39 -0
  146. Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.0.0.84-1.0.0.88.php +16 -0
  147. Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.0.0.88-1.2.0.0.php +39 -0
  148. Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.2.0.0-1.2.0.1.php +13 -0
  149. Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.2.0.1-1.2.1.0.php +47 -0
  150. Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.3.9.9-1.4.0.0.php +50 -0
  151. Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.4.7.0-1.5.0.0.php +42 -0
  152. Springbot-1.5.2.2/Springbot/Log.php +165 -0
  153. Springbot-1.5.2.2/Springbot/Services.php +132 -0
  154. Springbot-1.5.2.2/Springbot/Services/Cmd/Forecast.php +34 -0
  155. Springbot-1.5.2.2/Springbot/Services/Cmd/Halt.php +15 -0
  156. Springbot-1.5.2.2/Springbot/Services/Cmd/Harvest.php +347 -0
  157. Springbot-1.5.2.2/Springbot/Services/Cmd/Healthcheck.php +96 -0
  158. Springbot-1.5.2.2/Springbot/Services/Harvest.php +40 -0
  159. Springbot-1.5.2.2/Springbot/Services/Harvest/AttributeSets.php +35 -0
  160. Springbot-1.5.2.2/Springbot/Services/Harvest/Carts.php +39 -0
  161. Springbot-1.5.2.2/Springbot/Services/Harvest/Categories.php +49 -0
  162. Springbot-1.5.2.2/Springbot/Services/Harvest/Coupons.php +35 -0
  163. Springbot-1.5.2.2/Springbot/Services/Harvest/CustomerAttributeSets.php +19 -0
  164. Springbot-1.5.2.2/Springbot/Services/Harvest/Customers.php +44 -0
  165. Springbot-1.5.2.2/Springbot/Services/Harvest/Guests.php +47 -0
  166. Springbot-1.5.2.2/Springbot/Services/Harvest/Inventories.php +43 -0
  167. Springbot-1.5.2.2/Springbot/Services/Harvest/Products.php +34 -0
  168. Springbot-1.5.2.2/Springbot/Services/Harvest/Purchases.php +43 -0
  169. Springbot-1.5.2.2/Springbot/Services/Harvest/Rules.php +44 -0
  170. Springbot-1.5.2.2/Springbot/Services/Harvest/Subscribers.php +32 -0
  171. Springbot-1.5.2.2/Springbot/Services/Log/Installer.php +10 -0
  172. Springbot-1.5.2.2/Springbot/Services/Post.php +9 -0
  173. Springbot-1.5.2.2/Springbot/Services/Post/Attribute.php +38 -0
  174. Springbot-1.5.2.2/Springbot/Services/Post/AttributeSet.php +19 -0
  175. Springbot-1.5.2.2/Springbot/Services/Post/Cart.php +21 -0
  176. Springbot-1.5.2.2/Springbot/Services/Post/Category.php +18 -0
  177. Springbot-1.5.2.2/Springbot/Services/Post/Coupon.php +18 -0
  178. Springbot-1.5.2.2/Springbot/Services/Post/Customer.php +15 -0
  179. Springbot-1.5.2.2/Springbot/Services/Post/Guest.php +15 -0
  180. Springbot-1.5.2.2/Springbot/Services/Post/Inventory.php +29 -0
  181. Springbot-1.5.2.2/Springbot/Services/Post/Json.php +17 -0
  182. Springbot-1.5.2.2/Springbot/Services/Post/Jsonstring.php +12 -0
  183. Springbot-1.5.2.2/Springbot/Services/Post/Product.php +38 -0
  184. Springbot-1.5.2.2/Springbot/Services/Post/Purchase.php +64 -0
  185. Springbot-1.5.2.2/Springbot/Services/Post/Rule.php +21 -0
  186. Springbot-1.5.2.2/Springbot/Services/Post/Subscriber.php +14 -0
  187. Springbot-1.5.2.2/Springbot/Services/Registry.php +84 -0
  188. Springbot-1.5.2.2/Springbot/Services/Store/Finalize.php +28 -0
  189. Springbot-1.5.2.2/Springbot/Services/Store/Register.php +109 -0
  190. Springbot-1.5.2.2/Springbot/Services/Tasks.php +30 -0
  191. Springbot-1.5.2.2/Springbot/Services/Tasks/ClearCache.php +26 -0
  192. Springbot-1.5.2.2/Springbot/Services/Tasks/ClearJobs.php +15 -0
  193. Springbot-1.5.2.2/Springbot/Services/Tasks/ClearStores.php +23 -0
  194. Springbot-1.5.2.2/Springbot/Services/Tasks/CreateRewrite.php +47 -0
  195. Springbot-1.5.2.2/Springbot/Services/Tasks/Debug.php +24 -0
  196. Springbot-1.5.2.2/Springbot/Services/Tasks/DeleteJob.php +16 -0
  197. Springbot-1.5.2.2/Springbot/Services/Tasks/DeliverEventLog.php +63 -0
  198. Springbot-1.5.2.2/Springbot/Services/Tasks/Forecast.php +11 -0
  199. Springbot-1.5.2.2/Springbot/Services/Tasks/GetLog.php +30 -0
  200. Springbot-1.5.2.2/Springbot/Services/Tasks/Harvest.php +15 -0
  201. Springbot-1.5.2.2/Springbot/Services/Tasks/HarvestInventory.php +29 -0
  202. Springbot-1.5.2.2/Springbot/Services/Tasks/Healthcheck.php +20 -0
  203. Springbot-1.5.2.2/Springbot/Services/Tasks/Jobs.php +18 -0
  204. Springbot-1.5.2.2/Springbot/Services/Tasks/KillHarvest.php +10 -0
  205. Springbot-1.5.2.2/Springbot/Services/Tasks/LaunchFullHarvest.php +10 -0
  206. Springbot-1.5.2.2/Springbot/Services/Tasks/LaunchPartialHarvest.php +20 -0
  207. Springbot-1.5.2.2/Springbot/Services/Tasks/PluginVersion.php +18 -0
  208. Springbot-1.5.2.2/Springbot/Services/Tasks/PostItem.php +18 -0
  209. Springbot-1.5.2.2/Springbot/Services/Tasks/Redirects.php +159 -0
  210. Springbot-1.5.2.2/Springbot/Services/Tasks/RegisterStores.php +19 -0
  211. Springbot-1.5.2.2/Springbot/Services/Tasks/ResetRetries.php +11 -0
  212. Springbot-1.5.2.2/Springbot/Services/Tasks/ResumeHarvest.php +12 -0
  213. Springbot-1.5.2.2/Springbot/Services/Tasks/Run.php +17 -0
  214. Springbot-1.5.2.2/Springbot/Services/Tasks/SetVar.php +21 -0
  215. Springbot-1.5.2.2/Springbot/Services/Tasks/Stores.php +33 -0
  216. Springbot-1.5.2.2/Springbot/Services/Tasks/UnlockJobs.php +15 -0
  217. Springbot-1.5.2.2/Springbot/Services/Tasks/ViewConfig.php +13 -0
  218. Springbot-1.5.2.2/Springbot/Services/Work/Cleanup.php +28 -0
  219. Springbot-1.5.2.2/Springbot/Services/Work/Manager.php +123 -0
  220. Springbot-1.5.2.2/Springbot/Services/Work/Report.php +26 -0
  221. Springbot-1.5.2.2/Springbot/Services/Work/Restart.php +19 -0
  222. Springbot-1.5.2.2/Springbot/Services/Work/Runner.php +32 -0
  223. Springbot-1.5.2.2/Springbot/Services/Work/Stop.php +47 -0
  224. Springbot-1.5.2.2/Springbot/Shadow/Block/Action/View.php +20 -0
  225. Springbot-1.5.2.2/Springbot/Shadow/Block/Async.php +24 -0
  226. Springbot-1.5.2.2/Springbot/Shadow/Controller/Action.php +33 -0
  227. Springbot-1.5.2.2/Springbot/Shadow/Helper/Data.php +5 -0
  228. Springbot-1.5.2.2/Springbot/Shadow/Helper/Prattler.php +30 -0
  229. Springbot-1.5.2.2/Springbot/Shadow/Model/Listeners/Observer.php +19 -0
  230. Springbot-1.5.2.2/Springbot/Shadow/controllers/ActionController.php +23 -0
  231. Springbot-1.5.2.2/Springbot/Shadow/controllers/IndexController.php +141 -0
  232. Springbot-1.5.2.2/Springbot/Shadow/etc/config.xml +55 -0
  233. Springbot-1.5.2.2/Springbot/Util/Caller.php +53 -0
  234. Springbot-1.5.2.2/Springbot/Util/Categories.php +71 -0
  235. Springbot-1.5.2.2/Springbot/Util/Log/Rollover.php +121 -0
  236. Springbot-1.5.2.2/Springbot/Util/Logger.php +76 -0
  237. Springbot-1.5.2.2/Springbot/Util/Partition.php +24 -0
  238. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/bmbleb.css +343 -0
  239. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/arrows_up-down-large.png +0 -0
  240. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/bmb-ctl.png +0 -0
  241. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/check.png +0 -0
  242. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/grn-bg.png +0 -0
  243. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/h3-bg.png +0 -0
  244. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/icon-alert.png +0 -0
  245. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/icon-bmbleb.png +0 -0
  246. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/icon-insights.png +0 -0
  247. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/icon-status.png +0 -0
  248. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico1.png +0 -0
  249. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico2.png +0 -0
  250. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico3.png +0 -0
  251. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico4.png +0 -0
  252. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico5.png +0 -0
  253. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico6.png +0 -0
  254. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico7.png +0 -0
  255. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico8.png +0 -0
  256. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico_demographics.png +0 -0
  257. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/login-icn-b.png +0 -0
  258. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/login-icn.png +0 -0
  259. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/logo.png +0 -0
  260. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/orng-bg.png +0 -0
  261. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/plugin_dashboard_syncing.jpg +0 -0
  262. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/register.png +0 -0
  263. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/registration-bg-25.png +0 -0
  264. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/registration-bg-50.png +0 -0
  265. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/registration-bg.png +0 -0
  266. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/spinner.gif +0 -0
  267. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/springbot-ctl.png +0 -0
  268. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/submit-btn-bg.png +0 -0
  269. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/sync_icon.png +0 -0
  270. Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/white-check.png +0 -0
  271. Springbot-1.5.2.2/adminhtml/default/default/layout/bmbleb.xml +130 -0
  272. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/auth.phtml +4 -0
  273. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/dashboard_loggedout.phtml +34 -0
  274. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/help/index.phtml +44 -0
  275. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/index/messages.phtml +11 -0
  276. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/index/terms.phtml +8 -0
  277. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/jobs.phtml +16 -0
  278. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/jobs/status.phtml +34 -0
  279. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/login.phtml +15 -0
  280. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/logout.phtml +36 -0
  281. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/logs/index.phtml +40 -0
  282. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/notifications.phtml +7 -0
  283. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/order/marketplaces.phtml +23 -0
  284. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/problems/index.phtml +43 -0
  285. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/status.phtml +12 -0
  286. Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/tabs.phtml +13 -0
  287. Springbot-1.5.2.2/frontend/base/default/layout/shadow.xml +27 -0
  288. Springbot-1.5.2.2/frontend/base/default/template/shadow/async.phtml +13 -0
  289. Springbot-1.5.2.2/frontend/base/default/template/shadow/conversion.phtml +27 -0
  290. Springbot-1.5.2.2/modules/Springbot.xml +25 -0
  291. Springbot-1.5.2.2/shell/springbot.php +87 -0
  292. app/code/community/Springbot/Combine/Model/Marketplaces/Order/Builder.php +270 -266
  293. app/code/community/Springbot/Combine/etc/config.xml +1 -1
  294. package.xml +52 -47
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Auth.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Auth extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate("bmbleb/auth.phtml");
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Bmbleb/Login.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: joereger
5
+ * Date: 12/10/11
6
+ * Time: 2:02 PM
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+ class Springbot_Bmbleb_Block_Adminhtml_Bmbleb_Login extends Mage_Adminhtml_Block_Widget_Form_Container
10
+ {
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+
15
+ $this->_blockGroup = 'bmbleb';
16
+ $this->_controller = 'adminhtml_bmbleb';
17
+ $this->_mode = 'login';
18
+
19
+ $this->_removeButton('back');
20
+ $this->_removeButton('reset');
21
+ $this->_removeButton('save');
22
+
23
+ $this->_addButton('login', array(
24
+ 'label' => Mage::helper('bmbleb')->__('Login'),
25
+ 'onclick' => 'login_form.submit();',
26
+ ), 0, 100, 'footer');
27
+
28
+ }
29
+
30
+ /*
31
+ NOTE: the issue with submitting is being caused because of this html
32
+ editForm = new varienForm('edit_form', '');
33
+ this is also the reason js validation is not working
34
+ */
35
+ public function getHeaderText()
36
+ {
37
+ return Mage::helper('bmbleb')->__('Log In');
38
+ }
39
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Bmbleb/Login/Form.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: joereger
5
+ * Date: 12/10/11
6
+ * Time: 6:45 AM
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+ class Springbot_Bmbleb_Block_Adminhtml_Bmbleb_Login_Form extends Mage_Adminhtml_Block_Widget_Form
10
+ {
11
+ protected function _prepareForm()
12
+ {
13
+ $form = new Varien_Data_Form();
14
+
15
+ $fieldset = $form->addFieldset('bmbleb_form', array('legend' => Mage::helper('bmbleb')->__('Already Registered at www.springbot.com?')));
16
+
17
+ $fieldset->addField('email', 'text', array(
18
+ 'label' => Mage::helper('bmbleb')->__('Email'),
19
+ 'class' => 'required-entry',
20
+ 'required' => true,
21
+ 'name' => 'email'
22
+ ));
23
+
24
+ $fieldset->addField('password', 'password', array(
25
+ 'label' => Mage::helper('bmbleb')->__('Password'),
26
+ 'class' => 'required-entry',
27
+ 'required' => true,
28
+ 'name' => 'password',
29
+ ));
30
+
31
+ $fieldset->addField('link', 'note', array(
32
+ 'label' => '',
33
+ 'text' => '<a href="http://www.springbot.com">Need a Springbot Account? Click Here</a>',
34
+ ));
35
+
36
+ // Hide submit button so that we can press enter to submit
37
+ $submitButton = new Varien_Data_Form_Element_Submit(array('style' => 'position: absolute; left: -9999px; width: 1px; height: 1px;'));
38
+ $fieldset->addElement($submitButton);
39
+
40
+ $form->setMethod('post');
41
+ $form->setUseContainer(true);
42
+ $form->setId('login_form');
43
+ $form->setName('login_form');
44
+ $form->setAction($this->getUrl('adminhtml/bmbleb_login/login'));
45
+ $this->logPageVisit();
46
+ $this->setForm($form);
47
+ }
48
+
49
+ private function logPageVisit()
50
+ {
51
+ $springbotStoreId = '';
52
+
53
+ $storeId = Mage::app()->getStore()->getStoreId();
54
+ $storeURL = Mage::getStoreConfig('web/unsecure/base_url', $storeId);
55
+
56
+ if (Mage::getStoreConfig("springbot/config/store_id_{$storeId}")) {
57
+ $springbotStoreId = Mage::getStoreConfig("springbot/config/store_id_{$storeId}");
58
+ }
59
+
60
+ $eventDatetime = date("Y-m-d H:i:s " . '-0500');
61
+ $pri = '1';
62
+ $msg = 'User is viewing Springbot Login Form from ' . $storeURL;
63
+ if (!($url = Mage::getStoreConfig('springbot/config/api_url'))) {
64
+ $url = 'https://api.springbot.com/';
65
+ }
66
+ $url .= 'api/logs';
67
+ $rawJSON = '{"logs" :{"' . $springbotStoreId . '":{"store_id":"' . $springbotStoreId . '",'
68
+ . '"event_time":"' . $eventDatetime . '",'
69
+ . '"store_url":"' . $storeURL . '",'
70
+ . '"remote_addr":"",'
71
+ . '"priority":"' . $pri . '",'
72
+ . '"description":"' . $msg . '"'
73
+ . '}}}';
74
+
75
+ try {
76
+ $client = new Varien_Http_Client($url);
77
+ $client->setRawData($rawJSON);
78
+ $client->setHeaders('Content-type: application/json');
79
+ $req = $client->request('POST');
80
+ } catch (Exception $e) {
81
+ Springbot_Log::error($e->getMessage());
82
+ }
83
+ }
84
+
85
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Connected.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Connected extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate("bmbleb/status.phtml");
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Help.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Help extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate("bmbleb/help/index.phtml");
9
+ }
10
+
11
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Index.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Index extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate("bmbleb/index.phtml");
9
+ }
10
+
11
+ public function didSyncThisSession()
12
+ {
13
+ return false;
14
+ }
15
+
16
+ public function autoLauchSync()
17
+ {
18
+ return false;
19
+ }
20
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Index/Messages.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Springbot_Bmbleb_Block_Adminhtml_Index_Messages extends Mage_Adminhtml_Block_Template
3
+ {
4
+ /**
5
+ * Block constructor
6
+ */
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setTemplate("bmbleb/index/messages.phtml");
11
+ }
12
+
13
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Index/Terms.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Springbot_Bmbleb_Block_Adminhtml_Index_Terms extends Mage_Adminhtml_Block_Template
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setTemplate("bmbleb/index/terms.phtml");
8
+ }
9
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Jobs.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Jobs extends Mage_Adminhtml_Block_Widget_Grid_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->_controller = 'adminhtml_jobs';
8
+ $this->_blockGroup = 'bmbleb';
9
+ $this->_headerText = $this->__('Jobs');
10
+ parent::__construct();
11
+ $this->_removeButton('add');
12
+ }
13
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Jobs/Grid.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Jobs_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('id');
9
+ $this->setDefaultDir('desc');
10
+ $this->setUseAjax(true);
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getResourceModel('combine/cron_queue_collection');
17
+ $this->setCollection($collection);
18
+
19
+ return parent::_prepareCollection();
20
+ }
21
+
22
+ protected function _prepareColumns()
23
+ {
24
+ $this->addColumn('id', array(
25
+ 'header' => $this->__('Id'),
26
+ 'width' => '80',
27
+ 'align' => 'center',
28
+ 'index' => 'id'
29
+ ));
30
+
31
+ $this->addColumn('method', array(
32
+ 'header' => $this->__('Method'),
33
+ 'index' => 'method'
34
+ ));
35
+
36
+ $this->addColumn('args', array(
37
+ 'header' => $this->__('Arguments'),
38
+ 'index' => 'args'
39
+ ));
40
+
41
+ $this->addColumn('priority', array(
42
+ 'header' => $this->__('Priority'),
43
+ 'width' => '80',
44
+ 'index' => 'priority'
45
+ ));
46
+
47
+ $this->addColumn('attempts', array(
48
+ 'header' => $this->__('Attempts'),
49
+ 'width' => '80',
50
+ 'index' => 'attempts'
51
+ ));
52
+
53
+ $this->addColumn('error', array(
54
+ 'header' => $this->__('Last Error'),
55
+ 'width' => '80',
56
+ 'index' => 'error'
57
+ ));
58
+
59
+ $this->addColumn('locked_at', array(
60
+ 'header' => $this->__('locked_at'),
61
+ 'index' => 'locked_at',
62
+ 'type' => 'datetime'
63
+ ));
64
+
65
+ $this->addColumn('created_at', array(
66
+ 'header' => $this->__('created_at'),
67
+ 'index' => 'created_at',
68
+ 'type' => 'datetime'
69
+ ));
70
+
71
+ return parent::_prepareColumns();
72
+ }
73
+
74
+ protected function _prepareMassaction()
75
+ {
76
+ $this->setMassactionIdField('id');
77
+ $this->getMassactionBlock()->setFormFieldName('job_ids');
78
+ $this->getMassactionBlock()->setUseSelectAll(false);
79
+
80
+ $this->getMassactionBlock()->addItem('run_jobs', array(
81
+ 'label'=> $this->__('Run selected jobs'),
82
+ 'url' => $this->getUrl('*/*/run'),
83
+ ));
84
+
85
+ $this->getMassactionBlock()->addItem('deleted_jobs', array(
86
+ 'label'=> $this->__('Deleted selected jobs'),
87
+ 'url' => $this->getUrl('*/*/delete'),
88
+ ));
89
+
90
+ return $this;
91
+ }
92
+
93
+ public function getGridUrl()
94
+ {
95
+ return $this->getUrl('*/*/grid', array('_current'=>true));
96
+ }
97
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Jobs/Status.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Jobs_Status extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate("bmbleb/jobs/status.phtml");
9
+ }
10
+
11
+ public function getManager()
12
+ {
13
+ return Mage::getModel('combine/cron_manager_status');
14
+ }
15
+
16
+ public function getAjaxToggleUrl()
17
+ {
18
+ return Mage::helper('adminhtml')->getUrl('*/*/toggleWorkerStatus');
19
+ }
20
+
21
+ public function renderAsJson()
22
+ {
23
+ return json_encode(array(
24
+ 'button_text' => $this->getButtonLabelText(),
25
+ 'label_text' => $this->getLabelText(),
26
+ ));
27
+ }
28
+
29
+ public function getLabelText()
30
+ {
31
+ if($this->getManager()->isActive()) {
32
+ return $this->_getEnabledMessage();
33
+ }
34
+ else if($this->getManager()->isBlocked()) {
35
+ return $this->_getBlockedMessage();
36
+ }
37
+ else {
38
+ return $this->_getDisabledMessage();
39
+ }
40
+ }
41
+
42
+ protected function _getEnabledMessage()
43
+ {
44
+ $mgr = $this->getManager();
45
+ return 'Manager is <span class="status-alert-' . $mgr->getStatus() . '">' .
46
+ $mgr->getStatus() . '</span>, and has been running for ' . $mgr->getRuntime() . ' seconds';
47
+ }
48
+
49
+ protected function _getBlockedMessage()
50
+ {
51
+ return 'The Manager is <span class="status-alert-' .
52
+ Springbot_Combine_Model_Cron_Manager_Status::INACTIVE . '">DISABLED</span>! ' .
53
+ 'There may be available jobs left in the queue but will not be processed until the work manger is restarted. ' .
54
+ 'This is likely because a stop work command was issued. ';
55
+ }
56
+
57
+ protected function _getDisabledMessage()
58
+ {
59
+ return 'The Manager is not running. ' .
60
+ 'This is most likely because there are no available jobs left to run. ' .
61
+ 'We will continue to queue jobs for syncing as they happen.';
62
+ }
63
+
64
+ public function getButtonLabelText()
65
+ {
66
+ $manager = $this->getManager();
67
+
68
+ if($manager->isActive()) {
69
+ $text = 'Deactivate Manager';
70
+ } else {
71
+ $text = 'Start Manager';
72
+ }
73
+ return $this->__($text);
74
+ }
75
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Login.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Login extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate("bmbleb/login.phtml");
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Logout.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Logout extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ //parent::__construct();
8
+ //$this->setTemplate("bmbleb/login.phtml");
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Logs.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Logs extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->setTemplate("bmbleb/logs/index.phtml");
8
+ $this->_blockGroup = 'bmbleb';
9
+ parent::__construct();
10
+ }
11
+
12
+ public function getLogContent($logName)
13
+ {
14
+ return htmlspecialchars(Mage::helper('combine')->getLogContents($logName));
15
+ }
16
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Notifications.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
4
+ {
5
+ /**
6
+ * Uses PluginStatus helper to determine if major problem needs to be displayed globally
7
+ */
8
+ public function getMessage()
9
+ {
10
+ try {
11
+ if (Mage::getStoreConfig('springbot/config/show_notifications') == 1) {
12
+ if (Mage::helper('bmbleb/PluginStatus')->needsToLogin()) {
13
+ $message = 'Springbot has been installed successfully. ' .
14
+ '<a href="' . $this->getUrl('adminhtml/bmbleb_index/status') . '">Click here to login</a>. ' .
15
+ 'You can turn off Springbot notifications in ' .
16
+ '<a href="' . $this->getUrl('adminhtml/system_config/edit/section/springbot') . '">Springbot configuration.</a>'
17
+ ;
18
+ return array('message' => $message, 'type' => 'success');
19
+ }
20
+ }
21
+ }
22
+ catch (Exception $e) {
23
+ Springbot_Log::error($e->getMessage());
24
+ }
25
+ return false;
26
+ }
27
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Order/Marketplaces.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Order_Marketplaces extends Mage_Core_Block_Template
4
+ {
5
+ protected $_order;
6
+ protected $_mpOrder;
7
+
8
+ public function getOrder()
9
+ {
10
+ if (is_null($this->_order)) {
11
+ if (Mage::registry('current_order')) {
12
+ $order = Mage::registry('current_order');
13
+ }
14
+ elseif (Mage::registry('order')) {
15
+ $order = Mage::registry('order');
16
+ }
17
+ else {
18
+ $order = new Varien_Object();
19
+ }
20
+ $this->_order = $order;
21
+ }
22
+ return $this->order;
23
+ }
24
+
25
+ public function isMarketplaces($order)
26
+ {
27
+ Springbot_Log::debug($order->debug());
28
+ return $this->getMarketplacesOrder($order) != null;
29
+ }
30
+
31
+ public function getMarketplacesOrder($order = null)
32
+ {
33
+ if(is_null($this->_mpOrder)) {
34
+ if(!is_null($order) && is_null($this->_order)) {
35
+ $this->_order = $order;
36
+ }
37
+ $this->_mpOrder = Mage::getModel('combine/marketplaces_remote_order')
38
+ ->findByIncrementId($this->_order->getIncrementId());
39
+ }
40
+ return $this->_mpOrder;
41
+ }
42
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Status.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Status extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate("bmbleb/status.phtml");
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Block/Adminhtml/Tabs.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Block_Adminhtml_Tabs extends Mage_Adminhtml_Block_Template
4
+ {
5
+ /**
6
+ * Block constructor
7
+ */
8
+ public function __construct()
9
+ {
10
+ parent::__construct();
11
+ $this->setTemplate("bmbleb/tabs.phtml");
12
+ }
13
+
14
+ public function isActive($controller = '', $action = '')
15
+ {
16
+ return ($controller == $this->getRequest()->getControllerName() && ($action == '' || $action == $this->getRequest()->getActionName()));
17
+ }
18
+
19
+ // basic check for login status
20
+ public function isLoggedIn()
21
+ {
22
+ return Mage::helper('bmbleb/Account')->authorize('sync');
23
+ }
24
+
25
+ /**
26
+ * Uses PluginStatus helper to determine if major problem needs to be displayed globally
27
+ */
28
+ public function useExtendedAdmin()
29
+ {
30
+ return (Mage::getStoreConfig('springbot/advanced/extended_config') == 1);
31
+ }
32
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Helper/Account.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * manage account functions for a session
5
+ * authenticate checks if email / password are valid and retrieves account
6
+ * authorize checks to see if account has permission to perform certain functions
7
+ * all other methods are private/protected
8
+ */
9
+ class Springbot_Bmbleb_Helper_Account extends Mage_Core_Helper_Abstract
10
+ {
11
+ public function setAccount($account = array())
12
+ {
13
+ Mage::getSingleton('core/session')->setBmblebAccount($account);
14
+ }
15
+
16
+ public function getAccount()
17
+ {
18
+ return Mage::getSingleton('core/session')->getBmblebAccount();
19
+ }
20
+
21
+ public function setIsLoggedIn($value)
22
+ {
23
+ return Mage::getSingleton('core/session')->setBmblebIsloggedIn($value);
24
+ }
25
+
26
+ public function getIsLoggedIn()
27
+ {
28
+ return Mage::getSingleton('core/session')->getBmblebIsloggedIn();
29
+ }
30
+
31
+ public function getIsAuthenticated()
32
+ {
33
+ $email = $this->getSavedEmail();
34
+ $password = $this->getSavedPassword();
35
+
36
+ if($email && $password) {
37
+ $account = Mage::helper('combine')->checkCredentials($email, $password);
38
+ if($account['valid']) {
39
+ return true;
40
+ } else if(isset($account['message'])) {
41
+ Mage::getSingleton('adminhtml/session')->addError($account['message']);
42
+ }
43
+ }
44
+ return false;
45
+ }
46
+
47
+ public function authenticate($email = '', $password = '')
48
+ {
49
+ $result = false;
50
+
51
+ try {
52
+ $saveCredentials = true;
53
+ if ($email == '' && $password == ''){
54
+ return false;
55
+ }
56
+ $account = Mage::helper('combine')->checkCredentials($email, $password);
57
+ if ($account['valid']) {
58
+ $result = true;
59
+ if ($saveCredentials){
60
+ $this->setSavedAccountInformation($email, $password);
61
+ }
62
+ } else {
63
+ $this->setSavedAccountInformation('', '');
64
+ }
65
+ }
66
+ catch (Mage_Core_Exception $e) {
67
+ throw $e;
68
+ }
69
+
70
+ return $result;
71
+ }
72
+
73
+ public function authorize($feature = '')
74
+ {
75
+ if ($this->getIsLoggedIn() || $feature == ''){
76
+ return true;
77
+ } else {
78
+ return false;
79
+ }
80
+ }
81
+
82
+ public function logout()
83
+ {
84
+ $this->setAccount(array());
85
+ $this->setIsLoggedIn(false);
86
+ }
87
+
88
+ public function getSavedEmail()
89
+ {
90
+ return Mage::getStoreConfig('springbot/config/account_email', Mage::app()->getStore());
91
+ }
92
+
93
+ public function getSavedPassword()
94
+ {
95
+ return Mage::helper('core')->decrypt(Mage::getStoreConfig('springbot/config/account_password', Mage::app()->getStore()));
96
+ }
97
+
98
+ public function getSavedSecurityToken()
99
+ {
100
+ return Mage::getStoreConfig('springbot/config/security_token', Mage::app()->getStore());
101
+ }
102
+
103
+ public function setSavedAccountInformation($email='', $password='', $secToken='')
104
+ {
105
+ $config = new Mage_Core_Model_Config();
106
+ $config->saveConfig('springbot/config/account_email', $email, 'default', 0);
107
+ $config->saveConfig('springbot/config/account_password', Mage::helper('core')->encrypt($password), 'default', 0);
108
+ $config->saveConfig('springbot/config/security_token', $secToken, 'default', 0);
109
+ Mage::getConfig()->cleanCache();
110
+ Mage::getConfig()->reinit();
111
+ }
112
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Helper/PluginStatus.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Helper_PluginStatus extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ public function needsToLogin()
7
+ {
8
+ if ($this->_emailPasswordSet()) {
9
+ return false;
10
+ } else {
11
+ return true;
12
+ }
13
+ }
14
+
15
+ /**
16
+ * Check to make sure user has logged in to avoid showing a problem notification before they even login
17
+ */
18
+ private function _emailPasswordSet()
19
+ {
20
+ if (
21
+ Mage::getStoreConfig('springbot/config/account_email') &&
22
+ Mage::getStoreConfig('springbot/config/account_password')
23
+ ) {
24
+ return true;
25
+ } else {
26
+ return false;
27
+ }
28
+ }
29
+
30
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Model/Bmbleb.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Socketware_Bmbleb_Model_Bmbleb extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('bmbleb/bmbleb');
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Model/Observer.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Springbot_Bmbleb_Model_Observer
3
+ {
4
+ public function getSalesOrderViewInfo(Varien_Event_Observer $observer)
5
+ {
6
+ $block = $observer->getBlock();
7
+ if (
8
+ ($block->getNameInLayout() == 'order_info')
9
+ && ($child = $block->getChild('bmbleb.order.marketplaces'))
10
+ ) {
11
+ if($child->isMarketplaces($block->getOrder())) {
12
+ $transport = $observer->getTransport();
13
+ if ($transport) {
14
+ $html = $transport->getHtml();
15
+ $html .= $child->toHtml();
16
+ $transport->setHtml($html);
17
+ }
18
+ }
19
+ }
20
+ }
21
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Socketware_Bmbleb_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('bmbleb')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('bmbleb')->__('Disabled')
13
+ );
14
+ }
15
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/Model/Sync.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Socketware_Bmbleb_Model_Sync extends Mage_Core_Model_Abstract
4
+ {
5
+ const STATUS_STARTED = 0;
6
+ const STATUS_PROCESSING = 1;
7
+ const STATUS_PARTIALLY_COMPLETE = 2;
8
+ const STATUS_COMPLETED = 3;
9
+
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('bmbleb/sync');
14
+ }
15
+
16
+ public function getParsedDetails()
17
+ {
18
+ if ($this->getDetails() != ''){
19
+ return Zend_Json::decode($this->getDetails());
20
+ }
21
+ return array();
22
+ }
23
+
24
+ public function setParsedDetails($dataArray = array())
25
+ {
26
+ $this->setDetails(Zend_Json::encode($dataArray));
27
+ }
28
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/HelpController.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Springbot_Bmbleb_Adminhtml_Bmbleb_HelpController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+ public function indexAction()
6
+ {
7
+ $this->loadLayout();
8
+ $this->_setActiveMenu('springbot_bmbleb/dashboard');
9
+ $this->renderLayout();
10
+ }
11
+
12
+ protected function _isAllowed()
13
+ {
14
+ return Mage::getSingleton('admin/session')->isAllowed('springbot_bmbleb/dashboard');
15
+ }
16
+
17
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/IndexController.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Springbot_Bmbleb_Adminhtml_Bmbleb_IndexController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+ protected function _init()
6
+ {
7
+ if(!Mage::helper('bmbleb/Account')->getIsAuthenticated()) {
8
+ $this->_redirect('*/*/auth');
9
+ } else if(
10
+ $this->getRequest()->getParam('logout') &&
11
+ Mage::helper('bmbleb/Account')->getIsAuthenticated()
12
+ ) {
13
+ $this->_redirect('bmbleb/logout/logout');
14
+ return;
15
+ } elseif($this->getRequest()->getParam('harvest')) {
16
+ $this->_redirect('*/*/index');
17
+ } elseif($this->getRequest()->getParam('killharvest')) {
18
+ Springbot_Boss::halt();
19
+ $this->_redirect('*/*/status');
20
+ }
21
+ }
22
+
23
+ public function harvestAction()
24
+ {
25
+ try {
26
+ Springbot_Cli::launchHarvestInline();
27
+ }
28
+ catch (Exception $e) {
29
+ Springbot_Log::error($e->getMessage());
30
+ }
31
+ $this->_redirect('*/*/status');
32
+ return;
33
+ }
34
+
35
+ public function connectedtospringbotAction()
36
+ {
37
+ $this->_init();
38
+ $this->loadLayout();
39
+ $this->_setActiveMenu('springbot_bmbleb');
40
+ $this->renderLayout();
41
+ return;
42
+ }
43
+
44
+ public function loginAction()
45
+ {
46
+ $this->_init();
47
+ $this->loadLayout();
48
+ $this->_setActiveMenu('springbot_bmbleb');
49
+ $this->renderLayout();
50
+ return;
51
+ }
52
+
53
+ public function authAction()
54
+ {
55
+ $this->loadLayout();
56
+ $this->_setActiveMenu('springbot_bmbleb');
57
+ $this->renderLayout();
58
+ return;
59
+ }
60
+
61
+ public function statusAction()
62
+ {
63
+ $this->_init();
64
+ $this->loadLayout();
65
+ $this->_setActiveMenu('springbot_bmbleb');
66
+ $this->renderLayout();
67
+ return;
68
+ }
69
+
70
+ protected function _isAllowed()
71
+ {
72
+ return Mage::getSingleton('admin/session')->isAllowed('springbot_bmbleb/dashboard');
73
+ }
74
+
75
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/JobsController.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Springbot_Bmbleb_Adminhtml_Bmbleb_JobsController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->_setActiveMenu('springbot_bmbleb/dashboard');
8
+ $this->renderLayout();
9
+ }
10
+
11
+ public function toggleWorkerStatusAction()
12
+ {
13
+ Springbot_Log::debug('Toggling work manager status');
14
+ $manager = Mage::getModel('combine/cron_manager_status');
15
+ $manager->toggle();
16
+
17
+ sleep(1); // give everything a second to process
18
+
19
+ $this->getResponse()->setHeader('Content-type', 'application/json');
20
+ $this->getResponse()->setBody(
21
+ $this->getLayout()->createBlock('bmbleb/adminhtml_jobs_status')->renderAsJson()
22
+ );
23
+ }
24
+
25
+ public function statusAction()
26
+ {
27
+ $this->loadLayout();
28
+ $this->getResponse()->setBody(
29
+ $this->getLayout()->createBlock('bmbleb/adminhtml_jobs_status')->toHtml()
30
+ );
31
+ }
32
+
33
+ public function gridAction()
34
+ {
35
+ $this->loadLayout();
36
+ $this->getResponse()->setBody(
37
+ $this->getLayout()->createBlock('bmbleb/adminhtml_jobs_grid')->toHtml()
38
+ );
39
+ }
40
+
41
+ public function runAction()
42
+ {
43
+ if($jobIds = $this->getRequest()->getParam('job_ids')) {
44
+ foreach($jobIds as $jobId) {
45
+ try {
46
+ $job = $this->_loadJob($jobId);
47
+ $job->run();
48
+ } catch (Exception $e) {
49
+ Springbot_Log::error($e->getMessage());
50
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
51
+ }
52
+ }
53
+ }
54
+
55
+ $this->_redirect('*/*/index');
56
+ }
57
+
58
+ public function deleteAction()
59
+ {
60
+ $jobIds = $this->getRequest()->getParam('job_ids');
61
+
62
+ foreach($jobIds as $jobId) {
63
+ try {
64
+ $job = $this->_loadJob($jobId);
65
+ $job->delete();
66
+ } catch (Exception $e) {
67
+ Springbot_Log::error($e->getMessage());
68
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
69
+ }
70
+ }
71
+
72
+ $this->_redirect('*/*/index');
73
+ }
74
+
75
+ protected function _loadJob($id)
76
+ {
77
+ return Mage::getModel('combine/cron_queue')->load($id);
78
+ }
79
+
80
+ protected function _isAllowed()
81
+ {
82
+ return Mage::getSingleton('admin/session')->isAllowed('springbot_bmbleb/dashboard');
83
+ }
84
+
85
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/LoginController.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Bmbleb_Adminhtml_Bmbleb_LoginController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function loginAction()
6
+ {
7
+ // Pull request params
8
+ $email = $this->getRequest()->getParam('email');
9
+ $pass = $this->getRequest()->getParam('password');
10
+
11
+ // Set helper data and configure API URL
12
+ $bmblebAccount = Mage::helper('bmbleb/Account');
13
+ $bmblebAccount->setIsLoggedIn(false);
14
+ if (!($url = Mage::getStoreConfig('springbot/config/api_url'))) {
15
+ $url = 'https://api.springbot.com/';
16
+ }
17
+ $url .= 'api/registration/login';
18
+
19
+ try {
20
+ // Initialize cURL target URL
21
+ $c = curl_init('https://api.springbot.com/api/registration/login');
22
+
23
+ // Build cURL query
24
+ curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
25
+ curl_setopt($c, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
26
+ curl_setopt($c, CURLOPT_POSTFIELDS, "{\"user_id\":\"$email\", \"password\":\"$pass\"}");
27
+
28
+ // Save the response/result
29
+ $response = curl_exec($c);
30
+ $result = json_decode($response, true);
31
+ } catch (Exception $e) {
32
+ // Notify user the API service is unavailable
33
+ Springbot_Log::error($e->getMessage());
34
+ Mage::getSingleton('adminhtml/session')->addError('Service unavailable from ' . $url . ' please contact support@springbot.com.');
35
+ $this->_redirect('*/bmbleb_index/auth');
36
+ return;
37
+ }
38
+
39
+ // Notify user of any error
40
+ if ($result['status'] == 'error') {
41
+ Mage::getSingleton('adminhtml/session')
42
+ ->addError($result['message'] . ' or service unavailable from ' . $url);
43
+ $this->_redirect('*/bmbleb_index/auth');
44
+ } else {
45
+ // Notify user of denied login attempt
46
+ if ($result['token'] == '') {
47
+ Mage::getSingleton('adminhtml/session')
48
+ ->addError('Login denied by Springbot');
49
+ $this->_redirect('*/bmbleb_index/auth');
50
+ } // Redirect successful login to Springbot Dashboard
51
+ else {
52
+ $bmblebAccount->setSavedAccountInformation($email,$pass,$result['token']);
53
+ $this->_redirect('*/bmbleb_index/harvest');
54
+ }
55
+ }
56
+ }
57
+
58
+ // Make sure user is authorized to access this page
59
+ protected function _isAllowed()
60
+ {
61
+ return Mage::getSingleton('admin/session')
62
+ ->isAllowed('springbot_bmbleb/dashboard');
63
+ }
64
+
65
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/LogsController.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Springbot_Bmbleb_Adminhtml_Bmbleb_LogsController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+ public function indexAction()
6
+ {
7
+ $this->loadLayout();
8
+ $this->renderLayout();
9
+ }
10
+
11
+ public function downloadAction() {
12
+ $logName = $this->getRequest()->getParam('name');;
13
+ $logPath = Mage::getBaseDir('log') . DS . $logName;
14
+ if (!is_file($logPath) || !is_readable($logPath)) {
15
+ throw new Exception();
16
+ }
17
+ $this->getResponse()
18
+ ->setHttpResponseCode(200)
19
+ ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true )
20
+ ->setHeader('Pragma', 'public', true )
21
+ ->setHeader('Content-type', 'application/force-download')
22
+ ->setHeader('Content-Length', filesize($logPath))
23
+ ->setHeader('Content-Disposition', 'attachment' . '; filename=' . basename($logPath) );
24
+ $this->getResponse()->clearBody();
25
+ $this->getResponse()->sendHeaders();
26
+ readfile($logPath);
27
+ exit;
28
+ }
29
+
30
+ protected function _isAllowed()
31
+ {
32
+ return Mage::getSingleton('admin/session')->isAllowed('springbot_bmbleb/dashboard');
33
+ }
34
+
35
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/controllers/Adminhtml/Bmbleb/SettingsController.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Springbot_Bmbleb_Adminhtml_Bmbleb_SettingsController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $securityToken = Mage::getStoreConfig('springbot/config/security_token');
7
+ if (!$securityToken) {
8
+ $auth = Mage::helper('bmbleb/Account')->authenticate(
9
+ Mage::getStoreConfig('springbot/config/account_email'),
10
+ Mage::helper('core')->decrypt(Mage::getStoreConfig('springbot/config/account_password'))
11
+ );
12
+ } else {
13
+ $auth = true;
14
+ }
15
+
16
+ if ($auth) {
17
+ $bmbAcct = Mage::helper('bmbleb/Account');
18
+ $bmbAcct->setIsLoggedIn(true);
19
+ $this->_redirect('adminhtml/bmbleb_index/status');
20
+ return;
21
+ }
22
+
23
+ $this->_redirect('adminhtml/bmbleb_index/auth');
24
+ return;
25
+ }
26
+
27
+ public function postAction()
28
+ {
29
+ if ($data = $this->getRequest()->getPost()) {
30
+ // if both password fields are empty then do NOT attempt to update them
31
+ $password = $data['password'];
32
+ $passwordverify = $data['passwordverify'];
33
+ if ($password != '' || $passwordverify != '') {
34
+ // some extra validation
35
+ if (strlen($password) <= 6) {
36
+ Mage::getSingleton('adminhtml/session')->addError('Passwords must be more than 6 characters long.');
37
+ } else if ($password != $passwordverify) {
38
+ Mage::getSingleton('adminhtml/session')->addError('The passwords entered did not match.');
39
+ } else {
40
+ // validated - attempt save
41
+ $result = Mage::helper('bmbleb/ChangePassword')->ChangePassword($password);
42
+ if ($result === true) {
43
+ // update the saved and session password too
44
+ $bmblebAccount = Mage::helper('bmbleb/Account');
45
+ $account = $bmblebAccount->getAccount();
46
+ $account['password'] = $password;
47
+ $bmblebAccount->setAccount($account);
48
+ $bmblebAccount->setSavedAccountInformation($account['email'], $password);
49
+
50
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Your password was successfully updated.'));
51
+ } else {
52
+ // $result contains the error message
53
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('bmbleb')->__('We\'re sorry, there\'s been an error. ') . $result);
54
+ }
55
+ }
56
+ }
57
+ } else {
58
+ Mage::getSingleton('adminhtml/session')->addError('No data submitted');
59
+ }
60
+ $this->_redirect('*/*/index', array());
61
+ return;
62
+ }
63
+
64
+ protected function _isAllowed()
65
+ {
66
+ return Mage::getSingleton('admin/session')->isAllowed('springbot_bmbleb/dashboard');
67
+ }
68
+
69
+ }
Springbot-1.5.2.2/Springbot/Bmbleb/etc/config.xml ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Springbot_Bmbleb>
5
+ <version>0.3.0</version>
6
+ </Springbot_Bmbleb>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <adminhtml>
11
+ <args>
12
+ <modules>
13
+ <bmbleb after="Mage_Adminhtml">Springbot_Bmbleb_Adminhtml</bmbleb>
14
+ </modules>
15
+ </args>
16
+ </adminhtml>
17
+ </routers>
18
+ </admin>
19
+ <adminhtml>
20
+ <menu>
21
+ <springbot_bmbleb module="bmbleb">
22
+ <title>Springbot</title>
23
+ <sort_order>71</sort_order>
24
+ <children>
25
+ <dashboard module="bmbleb">
26
+ <title>Dashboard</title>
27
+ <action>adminhtml/bmbleb_settings/index</action>
28
+ </dashboard>
29
+ </children>
30
+ </springbot_bmbleb>
31
+ </menu>
32
+ <acl>
33
+ <resources>
34
+ <all><title>Allow Everything</title></all>
35
+ <admin>
36
+ <children>
37
+ <springbot_bmbleb translate="title" module="bmbleb">
38
+ <title>Springbot</title>
39
+ <sort_order>300</sort_order>
40
+ <children>
41
+ <dashboard translate="title" module="bmbleb">
42
+ <title>Dashboard</title>
43
+ <sort_order>10</sort_order>
44
+ </dashboard>
45
+ </children>
46
+ </springbot_bmbleb>
47
+ </children>
48
+ </admin>
49
+ </resources>
50
+ </acl>
51
+ <layout>
52
+ <updates>
53
+ <bmbleb>
54
+ <file>bmbleb.xml</file>
55
+ </bmbleb>
56
+ </updates>
57
+ </layout>
58
+ <events>
59
+ <core_block_abstract_to_html_after>
60
+ <observers>
61
+ <bmbleb_mp_order_view_info>
62
+ <class>Springbot_Bmbleb_Model_Observer</class>
63
+ <method>getSalesOrderViewInfo</method>
64
+ </bmbleb_mp_order_view_info>
65
+ </observers>
66
+ </core_block_abstract_to_html_after>
67
+ </events>
68
+ </adminhtml>
69
+ <global>
70
+ <models>
71
+ <bmbleb>
72
+ <class>Sprigbot_Bmbleb_Model</class>
73
+ <resourceModel>bmbleb_mysql4</resourceModel>
74
+ </bmbleb>
75
+ <bmbleb_mysql4>
76
+ <class>Springbot_Bmbleb_Model_Mysql4</class>
77
+ </bmbleb_mysql4>
78
+ </models>
79
+ <resources>
80
+ <bmbleb_setup>
81
+ <setup>
82
+ <module>Springbot_Bmbleb</module>
83
+ </setup>
84
+ <connection>
85
+ <use>core_setup</use>
86
+ </connection>
87
+ </bmbleb_setup>
88
+ <bmbleb_write>
89
+ <connection>
90
+ <use>core_write</use>
91
+ </connection>
92
+ </bmbleb_write>
93
+ <bmbleb_read>
94
+ <connection>
95
+ <use>core_read</use>
96
+ </connection>
97
+ </bmbleb_read>
98
+ </resources>
99
+ <blocks>
100
+ <bmbleb>
101
+ <class>Springbot_Bmbleb_Block</class>
102
+ </bmbleb>
103
+ </blocks>
104
+ <helpers>
105
+ <bmbleb>
106
+ <class>Springbot_Bmbleb_Helper</class>
107
+ </bmbleb>
108
+ </helpers>
109
+ </global>
110
+ <default>
111
+ <bmbleb>
112
+ <config>
113
+ </config>
114
+ </bmbleb>
115
+ </default>
116
+ </config>
117
+
Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestAbstract.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_BoneCollector_Model_HarvestAbstract
4
+ {
5
+ /**
6
+ * The attributes which we want to listen for changes on
7
+ *
8
+ * @return array
9
+ */
10
+ protected $_attributes = array();
11
+
12
+ protected function _initObserver($observer)
13
+ {
14
+ if($event = $observer->getEvent()) {
15
+ Springbot_Log::debug($event->getName());
16
+ }
17
+ }
18
+
19
+ /**
20
+ * Get top level sku
21
+ *
22
+ * This aims to get the top level sku. The getSku method for the product
23
+ * model is overloaded providing the type instance version of the sku
24
+ * meaning that it gives the simple sku for configurable or grouped products
25
+ * we need to get the _data array directly and pass that sku up to ensure the
26
+ * parent sku.
27
+ *
28
+ * @param $observer Varient_Event_Observer
29
+ * @return string
30
+ */
31
+ public function getTopLevelSku($observer)
32
+ {
33
+ $product = $observer->getEvent()->getProduct();
34
+ return Mage::helper('combine/parser')->getTopLevelSku($product);
35
+ }
36
+
37
+ public function doSend($object, $sessionKey)
38
+ {
39
+ $json = $object->toJson();
40
+ $hash = sha1($json);
41
+ $session = $this->_getSession();
42
+
43
+ if ($session->getData($sessionKey) == $hash) {
44
+ Springbot_Log::debug("Hash for {$sessionKey} is match, this object has already been posted, skipping");
45
+ return false;
46
+ } else {
47
+ $session->setData($sessionKey, $hash);
48
+ Springbot_Log::debug("Hash for {$sessionKey} does not match cache, sending");
49
+ return true;
50
+ }
51
+ }
52
+
53
+ protected function _getSession()
54
+ {
55
+ return Mage::getSingleton('core/session');
56
+ }
57
+
58
+ protected function _getAttributesToListenFor($extras = array())
59
+ {
60
+ return array_merge($this->_attributes, $extras);
61
+ }
62
+
63
+ protected function _entityChanged($model)
64
+ {
65
+ foreach($this->_getAttributesToListenFor() as $attribute) {
66
+ if($attribute != 'created_at' && $attribute != 'updated_at') {
67
+ if($this->_hasDataChangedFor($model, $attribute)) {
68
+ return true;
69
+ }
70
+ }
71
+ }
72
+ Springbot_Log::debug('Entity unchanged');
73
+ return false;
74
+ }
75
+
76
+ protected function _hasDataChangedFor($model, $field)
77
+ {
78
+ $newData = $model->getData($field);
79
+ $origData = $model->getOrigData($field);
80
+ return $newData != $origData;
81
+ }
82
+
83
+ }
Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestAttribute/Observer.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_BoneCollector_Model_HarvestAttribute_Observer extends Springbot_BoneCollector_Model_HarvestAbstract
4
+ {
5
+ public function onAdminAttributeSaveAfter($observer)
6
+ {
7
+ try {
8
+ $this->_initObserver($observer);
9
+ $attribute = $observer->getEvent()->getAttribute();
10
+ if ($attribute->getIsUserDefined()) {
11
+ if ($this->doSend($attribute, 'sb_eav_entity_attribute_obs_hash')) {
12
+ Springbot_Log::debug("Attempting to post parent attribute sets");
13
+ Springbot_Boss::scheduleJob(
14
+ 'post:attribute',
15
+ array('i' => $attribute->getAttributeId()),
16
+ Springbot_Services::LISTENER,
17
+ 'listener'
18
+ );
19
+ }
20
+ }
21
+ else {
22
+ Springbot_Log::debug("Attribute is not user defined, skipping");
23
+ }
24
+ }
25
+ catch (Exception $e) {
26
+ Springbot_Log::error($e->getMessage());
27
+ }
28
+ }
29
+
30
+ public function onAdminAttributeSetSaveAfter($observer)
31
+ {
32
+ try {
33
+ $attribute = $observer->getEvent()->getAttribute();
34
+ $set = $this->_getAttributeSet($attribute->getAttributeSetId());
35
+ if ($this->doSend($set, 'sb_eav_entity_attribute_set_obs_hash')) {
36
+ $this->_initObserver($observer);
37
+ Springbot_Boss::scheduleJob('post:attributeSet', array('i' => $attribute->getAttributeSetId()), Springbot_Services::LISTENER, 'listener');
38
+ }
39
+ }
40
+ catch (Exception $e) {
41
+ Springbot_Log::error($e->getMessage());
42
+ }
43
+ }
44
+
45
+ protected function _getAttributeSet($id)
46
+ {
47
+ $helper = Mage::helper('combine/attributes');
48
+
49
+ // invalidate cache as attributes are added to set
50
+ $attrIds = $helper->getAttributesBySet($id)->getAllIds();
51
+ return $helper->getAttributeSetById($id)->setNestedAttributeIds($attrIds);
52
+ }
53
+ }
Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestCart/Observer.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_BoneCollector_Model_HarvestCart_Observer extends Springbot_BoneCollector_Model_HarvestAbstract
4
+ {
5
+ /**
6
+ * Push cart object to api
7
+ *
8
+ * @param Varien_Event_Observer $observer
9
+ */
10
+ public function onFrontendQuoteSaveAfter($observer)
11
+ {
12
+ try {
13
+ $this->_initObserver($observer);
14
+ $quoteObject = $observer->getQuote();
15
+ $quoteParser = $this->_initParser($quoteObject);
16
+
17
+ if (
18
+ $quoteParser->getItemsCount() > 0 &&
19
+ ($quoteParser->hasCustomerData() || Mage::getStoreConfig('springbot/config/send_cart_noemail')) &&
20
+ $quoteParser->getStoreId()
21
+ ) {
22
+ $json = $quoteParser->toJson();
23
+
24
+ if (Mage::helper('combine')->doSendQuote($json)) {
25
+ Springbot_Boss::addTrackable(
26
+ 'cart_user_agent',
27
+ Mage::helper('core/http')->getHttpUserAgent(),
28
+ $quoteParser->getQuoteId(),
29
+ $quoteParser->getCustomerId(),
30
+ $quoteParser->getCustomerEmail()
31
+ );
32
+
33
+ Springbot_Boss::scheduleJob('post:cart', array(
34
+ 's' => Mage::app()->getStore()->getId(),
35
+ 'i' => $quoteParser->getQuoteId()
36
+ ), Springbot_Services::LISTENER, 'listener'
37
+ );
38
+
39
+ $this->insertRedirectIds($quoteParser);
40
+ $this->createTrackables($quoteParser);
41
+ }
42
+ }
43
+ }
44
+ catch (Exception $e) {
45
+ Springbot_Log::error($e->getMessage());
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Capture sku for add to cart
51
+ * Inserts line into event csv to push
52
+ *
53
+ * @param Varien_Event_Observer $observer
54
+ */
55
+ public function onFrontendCartAddProduct($observer)
56
+ {
57
+ try {
58
+ $this->_initObserver($observer);
59
+ $quoteId = Mage::getSingleton("checkout/session")->getQuote()->getId();
60
+ $storeId = Mage::app()->getStore()->getStoreId();
61
+ $product = $observer->getEvent()->getProduct();
62
+ $lastCatId = Mage::helper('combine')->checkCategoryIdSanity($this->_getLastCategory(), $storeId);
63
+ $visitorIp = Mage::helper('core/http')->getRemoteAddr(true);
64
+
65
+ // Check added qty from request, default to 1
66
+ $qtyAdded = $observer->getEvent()->getRequest()->getParam('qty');
67
+ $qtyAdded = is_numeric($qtyAdded) && $qtyAdded > 0 ? $qtyAdded : 1;
68
+
69
+ Springbot_Boss::insertEvent(array(
70
+ 'type' => 'atc',
71
+ 'sku' => $this->getTopLevelSku($observer),
72
+ 'sku_fulfillment' => $product->getSku(),
73
+ 'quote_id' => $quoteId,
74
+ 'category_id' => $lastCatId,
75
+ 'store_id' => $storeId,
76
+ 'quantity' => $qtyAdded,
77
+ ));
78
+ }
79
+ catch (Exception $e) {
80
+ Springbot_Log::error($e->getMessage());
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Add product actions on update qty
86
+ *
87
+ * This is a one-way street. This examines the new quantity to the saved
88
+ * quote item amount. If the new quanity is higher, it inserts one event
89
+ * for each item higher than the pre-existing quanity (i.e. the delta).
90
+ * We are not concerned with items getting removed as we are counting the
91
+ * add actions themselves.
92
+ *
93
+ * @param Varien_Event_Observer $observer
94
+ */
95
+ public function onFrontendCartUpdate($observer)
96
+ {
97
+ try {
98
+ $this->_initObserver($observer);
99
+ $info = $observer->getEvent()->getInfo();
100
+ $cart = $observer->getEvent()->getCart();
101
+ $storeId = $cart->getQuote()->getStoreId();
102
+ $parsedQuote = Mage::getModel('combine/parser_quote', $cart->getQuote());
103
+
104
+ foreach ($info as $itemId => $itemInfo) {
105
+ $item = $cart->getQuote()->getItemById($itemId);
106
+
107
+ if($item && isset($itemInfo['qty'])) {
108
+ if($itemInfo['qty'] > $item->getQty()) {
109
+ $parsed = Mage::getModel('combine/parser_quote_item', $item);
110
+ $diffQty = $itemInfo['qty'] - $item->getQty();
111
+ $diffQty = $diffQty > 0 ? $diffQty : 1;
112
+
113
+ Springbot_Log::debug("Cart delta +$diffQty");
114
+ Springbot_Boss::insertEvent(array(
115
+ 'type' => 'atc',
116
+ 'sku' => $parsed->getSku(),
117
+ 'sku_fulfillment' => $parsed->getSkuFulfillment(),
118
+ 'quote_id' => $parsedQuote->getQuoteId(),
119
+ 'category_id' => $this->_getLastCategory(),
120
+ 'store_id' => $storeId,
121
+ 'quantity' => $diffQty,
122
+ ));
123
+ }
124
+ }
125
+ }
126
+ }
127
+ catch (Exception $e) {
128
+ Springbot_Log::error($e->getMessage());
129
+ }
130
+ }
131
+
132
+ /**
133
+ * This exists as a naive dependency injector, so we can set the
134
+ * local object for testing purposes
135
+ *
136
+ * @param $quote Mage_Sales_Model_Quote
137
+ * @return Springbot_Combine_Model_Parser_Quote
138
+ */
139
+ protected function _initParser($quote)
140
+ {
141
+ if (!isset($this->_parser)) {
142
+ $this->_parser = Mage::getModel('Springbot_Combine_Model_Parser_Quote', $quote);
143
+ }
144
+ return $this->_parser;
145
+ }
146
+
147
+ public function insertRedirectIds($quote)
148
+ {
149
+ if (Mage::helper('combine/redirect')->hasRedirectId()) {
150
+ Springbot_Log::debug("Insert redirect id for customer : {$quote->getCustomerEmail()}");
151
+ $params = array(
152
+ 'email' => $quote->getCustomerEmail(),
153
+ 'quote_id' => $quote->getQuoteId(),
154
+ 'customer_id' => $quote->getCustomerId(),
155
+ );
156
+
157
+ Mage::helper('combine/redirect')->insertRedirectIds($params);
158
+ }
159
+ }
160
+
161
+ public function createTrackables($quoteParser)
162
+ {
163
+ $helper = Mage::helper('combine/trackable');
164
+ $model = Mage::getModel('combine/trackable');
165
+
166
+ if ($helper->hasTrackables()) {
167
+ foreach ($helper->getTrackables() as $type => $value) {
168
+ $model->setData(array(
169
+ 'email' => $quoteParser->getCustomerEmail(),
170
+ 'type' => $type,
171
+ 'value' => $value,
172
+ 'quote_id' => $quoteParser->getQuoteId(),
173
+ 'customer_id' => $quoteParser->getCustomerId(),
174
+ ));
175
+ $model->createOrUpdate();
176
+ }
177
+ }
178
+ }
179
+
180
+ public function setParser($parser)
181
+ {
182
+ $this->_parser = $parser;
183
+ }
184
+
185
+ protected function _getLastCategory()
186
+ {
187
+ return Mage::helper('combine')->getLastCategoryId();
188
+ }
189
+
190
+
191
+ }
Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestCategory/Observer.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_BoneCollector_Model_HarvestCategory_Observer extends Springbot_BoneCollector_Model_HarvestAbstract
4
+ {
5
+ public function onCategorySaveAfter($observer)
6
+ {
7
+ try {
8
+ $this->_initObserver($observer);
9
+ $categoryId = $observer->getEvent()->getCategory()->getEntityId();
10
+ if (!empty($categoryId)) {
11
+ Springbot_Boss::scheduleJob('post:category', array('i' => $categoryId), Springbot_Services::LISTENER, 'listener');
12
+ }
13
+ }
14
+ catch (Exception $e) {
15
+ Springbot_Log::error($e->getMessage());
16
+ }
17
+ }
18
+
19
+ public function onCategoryDeleteAfter($observer)
20
+ {
21
+ try {
22
+ $category = $observer->getEvent()->getCategory();
23
+ $this->_initObserver($observer);
24
+ foreach (Mage::helper('combine/harvest')->mapStoreIds($category) as $mapped) {
25
+ $deleted = array(
26
+ 'store_id' => $mapped->getStoreId(),
27
+ 'cat_id' => $category->getEntityId(),
28
+ 'is_deleted' => true,
29
+ );
30
+ Mage::helper('combine/harvest')->deleteRemote($deleted, 'categories');
31
+ }
32
+
33
+ }
34
+ catch (Exception $e) {
35
+ Springbot_Log::error($e->getMessage());
36
+ }
37
+ }
38
+ }
Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestCustomer/Observer.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_BoneCollector_Model_HarvestCustomer_Observer extends Springbot_BoneCollector_Model_HarvestAbstract
4
+ {
5
+ protected $_customer;
6
+
7
+ public function onCustomerSaveAfter($observer)
8
+ {
9
+ try {
10
+ $this->_initObserver($observer);
11
+ $this->_customer = $observer->getEvent()->getCustomer();
12
+
13
+ if ($this->_entityChanged($this->_customer)) {
14
+ $customerId = $this->_customer->getId();
15
+ Springbot_Boss::scheduleJob('post:customer', array('i' => $customerId), Springbot_Services::LISTENER, 'listener');
16
+ }
17
+ } catch (Exception $e) {
18
+ Springbot_Log::error($e->getMessage());
19
+ }
20
+ }
21
+
22
+ public function onCustomerDeleteBefore($observer)
23
+ {
24
+ try {
25
+ // Runs blocking in session to guarantee record existence
26
+ $customer = $observer->getEvent()->getCustomer();
27
+ $this->_initObserver($observer);
28
+ Mage::getModel('Springbot_Services_Post_Customer')->setData(array(
29
+ 'start_id' => $customer->getId(),
30
+ 'delete' => true,
31
+ ))->run();
32
+ } catch (Exception $e) {
33
+ Springbot_Log::error($e->getMessage());
34
+ }
35
+ }
36
+
37
+ protected function _getAttributesToListenFor($extras = array())
38
+ {
39
+ $codes = array();
40
+ $h = Mage::helper('combine/attributes');
41
+ $attributes = $h->getCustomerCustomAttributes($h->getCustomerAttributeSet());
42
+
43
+ try {
44
+ foreach($attributes as $attribute) {
45
+ $codes[] = $attribute->getAttributeCode();
46
+ }
47
+ }
48
+ catch (Exception $e) {
49
+ Springbot_Log::error('Exception caught during attribute iteration for customer observer: ' . $e->getMessage());
50
+ }
51
+
52
+
53
+ // Ensure we test for change in group
54
+ $codes[] = 'group_id';
55
+
56
+ return parent::_getAttributesToListenFor($codes);
57
+ }
58
+ }
59
+
Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestInventoryItem/Observer.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_BoneCollector_Model_HarvestInventoryItem_Observer extends Springbot_BoneCollector_Model_HarvestAbstract
4
+ {
5
+ protected $_product;
6
+
7
+ protected $_attributes = array(
8
+ 'qty'
9
+ );
10
+
11
+
12
+ public function onCatalogInventorySave(Varien_Event_Observer $observer)
13
+ {
14
+ if ($this->_sendInventory()) {
15
+ try {
16
+ $event = $observer->getEvent();
17
+ $_item = $event->getItem();
18
+ if ((int)$_item->getData('qty') != (int)$_item->getOrigData('qty')) {
19
+ Springbot_Boss::scheduleJob('post:inventory', array(
20
+ 'i' => $_item->getItemId(),
21
+ ), Springbot_Services::LISTENER, 'listener'
22
+ );
23
+ }
24
+ }
25
+ catch (Exception $e) {
26
+ Springbot_Log::error($e->getMessage());
27
+ }
28
+ }
29
+ }
30
+
31
+ public function onQuoteSubmit(Varien_Event_Observer $observer)
32
+ {
33
+ if ($this->_sendInventory()) {
34
+ $quote = $observer->getEvent()->getQuote();
35
+ foreach ($quote->getAllItems() as $item) {
36
+ try {
37
+ Springbot_Boss::scheduleJob('post:inventory', array(
38
+ 'i' => $item->getItemId(),
39
+ ), Springbot_Services::LISTENER, 'listener'
40
+ );
41
+ }
42
+ catch (Exception $e) {
43
+ Springbot_Log::error($e->getMessage());
44
+ }
45
+ }
46
+ }
47
+ }
48
+
49
+ public function onCancelOrderItem(Varien_Event_Observer $observer)
50
+ {
51
+ if ($this->_sendInventory()) {
52
+ try {
53
+ $item = $observer->getEvent()->getItem();
54
+ Springbot_Boss::scheduleJob('post:inventory', array(
55
+ 'i' => $item->getItemId(),
56
+ ), Springbot_Services::LISTENER, 'listener'
57
+ );
58
+ }
59
+ catch (Exception $e) {
60
+ Springbot_Log::error($e->getMessage());
61
+ }
62
+ }
63
+ }
64
+
65
+ public function onCreditmemoSave(Varien_Event_Observer $observer)
66
+ {
67
+ if ($this->_sendInventory()) {
68
+ try {
69
+ $event = $observer->getEvent();
70
+ $creditmemo = $event->getCreditmemo();
71
+ foreach ($creditmemo->getAllItems() as $creditMemoItem) {
72
+ $productId = $creditMemoItem->getProductId();
73
+ if ($product = Mage::getModel('catalog/product')->load($productId)) {
74
+ if ($inventoryItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)) {
75
+ Springbot_Boss::scheduleJob('post:inventory', array(
76
+ 'i' => $inventoryItem->getItemId(),
77
+ ), Springbot_Services::LISTENER, 'listener'
78
+ );
79
+ }
80
+ }
81
+ }
82
+ }
83
+ catch (Exception $e) {
84
+ Springbot_Log::error($e->getMessage());
85
+ }
86
+ }
87
+
88
+ }
89
+
90
+ private function _sendInventory() {
91
+ if (Mage::getStoreConfig('springbot/advanced/send_inventory') == 1) {
92
+ return true;
93
+ } else {
94
+ return false;
95
+ }
96
+ }
97
+
98
+
99
+
100
+
101
+ }
Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestProduct/Observer.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_BoneCollector_Model_HarvestProduct_Observer extends Springbot_BoneCollector_Model_HarvestAbstract
4
+ {
5
+ protected $_product;
6
+
7
+ protected $_attributes = array(
8
+ 'entity_id',
9
+ 'sku',
10
+ 'attribute_set_id',
11
+ 'description',
12
+ 'full_description',
13
+ 'short_description',
14
+ 'image',
15
+ 'url_key',
16
+ 'small_image',
17
+ 'thumbnail',
18
+ 'status',
19
+ 'visibility',
20
+ 'price',
21
+ 'special_price',
22
+ 'image_label',
23
+ 'name',
24
+ );
25
+
26
+ public function onProductSaveAfter($observer)
27
+ {
28
+ try {
29
+ $this->_product = $observer->getEvent()->getProduct();
30
+
31
+ if ($this->_entityChanged($this->_product)) {
32
+ $this->_initObserver($observer);
33
+ Springbot_Boss::scheduleJob('post:product', array('i' => $this->_product->getId()), Springbot_Services::LISTENER, 'listener');
34
+ }
35
+
36
+ } catch (Exception $e) {
37
+ Springbot_Log::error($e->getMessage());
38
+ }
39
+ }
40
+
41
+ public function onProductDeleteBefore($observer)
42
+ {
43
+ $this->_initObserver($observer);
44
+ try{
45
+ $this->_product = $observer->getEvent()->getProduct();
46
+ $entityId = $this->_product->getId();
47
+ $helper = Mage::helper('combine/harvest');
48
+ foreach($helper->mapStoreIds($this->_product) as $mapped) {
49
+ $sbId = $helper->getSpringbotStoreId($mapped->getStoreId());
50
+ $post[] = array(
51
+ 'store_id' => $sbId,
52
+ 'entity_id' => $entityId,
53
+ 'sku' => $this->_getSkuFailsafe($this->_product),
54
+ 'is_deleted' => true,
55
+ );
56
+ }
57
+ Mage::helper('combine/harvest')->deleteRemote($post, 'products');
58
+ } catch (Exception $e) {
59
+ Springbot_Log::error($e->getMessage());
60
+ }
61
+ }
62
+
63
+ protected function _getSkuFailsafe($product)
64
+ {
65
+ if ($sku = $product->getSku()) {
66
+ return $sku;
67
+ }
68
+ else {
69
+ return Springbot_Boss::NO_SKU_PREFIX . $product->getEntityId();
70
+ }
71
+ }
72
+
73
+ protected function _getAttributesToListenFor($extras = array())
74
+ {
75
+ return parent::_getAttributesToListenFor(
76
+ Mage::helper('combine/parser')->getCustomAttributeNames($this->_product)
77
+ );
78
+
79
+ }
80
+ }
Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestPurchase/Observer.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_BoneCollector_Model_HarvestPurchase_Observer extends Springbot_BoneCollector_Model_HarvestAbstract
4
+ {
5
+ const ACTION = 'purchase';
6
+
7
+ public function onFrontendOrderSaveAfter($observer)
8
+ {
9
+ try {
10
+ $order = $observer->getEvent()->getOrder();
11
+ Mage::helper('combine/trackable')->updateTrackables($order);
12
+ Springbot_Boss::addTrackable(
13
+ 'purchase_user_agent',
14
+ Mage::helper('core/http')->getHttpUserAgent(),
15
+ $order->getQuoteId(),
16
+ $order->getCustomerId(),
17
+ $order->getCustomerEmail(),
18
+ $order->getEntityId()
19
+ );
20
+ $this->_schedulePurchasePost($order, true);
21
+ }
22
+ catch (Exception $e) {
23
+ Springbot_Log::error($e->getMessage());
24
+ }
25
+ }
26
+
27
+ public function onAdminOrderSaveAfter($observer)
28
+ {
29
+ try {
30
+ $order = $observer->getEvent()->getOrder();
31
+ Mage::helper('combine/trackable')->updateTrackables($order);
32
+ $this->_schedulePurchasePost($order, false);
33
+ }
34
+ catch (Exception $e) {
35
+ Springbot_Log::error($e->getMessage());
36
+ }
37
+ }
38
+
39
+ public function onFrontendOrderPlaceAfter($observer)
40
+ {
41
+ try {
42
+ $this->_initObserver($observer);
43
+ $order = $observer->getEvent()->getOrder();
44
+ $storeId = $order->getStoreId();
45
+ $parsedPurchase = Mage::getModel('combine/parser_purchase', $order);
46
+
47
+ foreach ($order->getAllVisibleItems() as $item) {
48
+ $lastCatId = $this->_getSaneCategoryId($item);
49
+ $qty = $item->getQtyOrdered();
50
+ $qty = $qty > 0 ? $qty : 1;
51
+
52
+ $parsedItem = Mage::getModel('combine/parser_purchase_item', $item);
53
+
54
+ Springbot_Boss::insertEvent(array(
55
+ 'type' => 'purchase',
56
+ 'sku' => $parsedItem->getSku(),
57
+ 'sku_fulfillment' => $parsedItem->getSkuFulfillment(),
58
+ 'purchase_id' => $parsedPurchase->getPurchaseId(),
59
+ 'category_id' => $this->_getSaneCategoryId($item),
60
+ 'store_id' => $storeId,
61
+ 'quantity' => $qty,
62
+ ));
63
+ }
64
+
65
+ }
66
+ catch (Exception $e) {
67
+ Springbot_Log::error($e->getMessage());
68
+ }
69
+ }
70
+
71
+ private function _schedulePurchasePost($order, $frontend)
72
+ {
73
+ Springbot_Boss::scheduleJob('post:purchase',
74
+ array(
75
+ 'i' => $order->getEntityId(),
76
+ 'c' => $this->_getLastCategoryId(),
77
+ 'r' => $this->_getRedirectIds($frontend, $order),
78
+ ),
79
+ Springbot_Services::LISTENER, 'listener'
80
+ );
81
+ }
82
+
83
+ private function _getLastCategoryId()
84
+ {
85
+ return Mage::helper('combine')->getLastCategoryId();
86
+ }
87
+
88
+ private function _getSaneCategoryId($item)
89
+ {
90
+ return Mage::helper('combine')->checkCategoryIdSanity(
91
+ $this->_getLastCategoryId(),
92
+ $item->getProductId()
93
+ );
94
+ }
95
+
96
+ private function _getAccessibleSku($item)
97
+ {
98
+ return Mage::helper('combine/parser')->getAccessibleSkuFromSalesItem($item);
99
+ }
100
+
101
+ private function _getRedirectIds($frontend = true, $order)
102
+ {
103
+ if ($frontend) {
104
+ $redirects = Mage::helper('combine/redirect')->getRedirectIds();
105
+ }
106
+ else {
107
+ $redirects = array();
108
+ }
109
+
110
+ $customerEmail = $order->getCustomerEmail();
111
+ if ($dbRedirects = Mage::helper('combine/redirect')->getRedirectsByEmail($customerEmail, $order->getCreatedAt())) {
112
+ $redirects = array_unique(array_merge($redirects, $dbRedirects));
113
+ }
114
+ return array_reverse(array_values($redirects));
115
+ }
116
+ }
Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestRule/Observer.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_BoneCollector_Model_HarvestRule_Observer extends Springbot_BoneCollector_Model_HarvestAbstract
4
+ {
5
+ protected $_attributes = array(
6
+ 'is_active',
7
+ 'name' ,
8
+ 'coupon_code',
9
+ 'description',
10
+ 'conditions',
11
+ 'actions',
12
+ 'from_date',
13
+ 'to_date',
14
+ 'uses_per_coupon',
15
+ 'uses_per_customer',
16
+ 'stop_rules_processing',
17
+ 'is_advanced',
18
+ 'product_ids',
19
+ 'sort_order',
20
+ 'simple_action',
21
+ 'discount_amount',
22
+ 'discount_qty',
23
+ 'discount_step',
24
+ 'simple_free_shipping',
25
+ 'apply_to_shipping',
26
+ 'times_used',
27
+ 'is_rss',
28
+ 'website_ids',
29
+ 'customer_group_ids',
30
+ );
31
+
32
+ public function onSalesruleRuleSaveAfter($observer)
33
+ {
34
+ try {
35
+ $this->_initObserver($observer);
36
+ $this->_rule = $observer->getEvent()->getRule();
37
+
38
+ if ($this->_entityChanged($this->_rule)) {
39
+ $ruleId = $this->_rule->getId();
40
+
41
+ foreach ($this->_getWebsiteIds() as $websiteId) {
42
+ if ($website = Mage::app()->getWebsite($websiteId)) {
43
+ foreach ($website->getGroups() as $group) {
44
+ $stores = $group->getStores();
45
+ foreach ($stores as $store) {
46
+ Springbot_Boss::scheduleJob(
47
+ 'post:rule',
48
+ array('i' => $ruleId, 's' => $store->getId()),
49
+ Springbot_Services::LISTENER,
50
+ 'listener'
51
+ );
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ catch (Exception $e) {
59
+ Springbot_Log::error($e->getMessage());
60
+ }
61
+
62
+ }
63
+
64
+ public function onSalesruleRuleDeleteBefore($observer)
65
+ {
66
+ try {
67
+ // Runs blocking in session to guarantee record existence
68
+ $rule = $observer->getEvent()->getRule()->getPrimaryCoupon();
69
+ $this->_initObserver($observer);
70
+ Springbot_Boss::scheduleJob(
71
+ 'post:rule',
72
+ array('i' => $rule->getId(), 'd' => true),
73
+ Springbot_Services::LISTENER,
74
+ 'listener'
75
+ );
76
+ }
77
+ catch (Exception $e) {
78
+ Springbot_Log::error($e->getMessage());
79
+ }
80
+ }
81
+
82
+ protected function _getWebsiteIds()
83
+ {
84
+ $ids = $this->_rule->getWebsiteIds();
85
+ if(is_string($ids)) {
86
+ $ids = explode(',', $ids);
87
+ }
88
+ if(!is_array($ids)) {
89
+ $ids = array();
90
+ }
91
+ return $ids;
92
+ }
93
+ }
94
+
Springbot-1.5.2.2/Springbot/BoneCollector/Model/HarvestSubscriber/Observer.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_BoneCollector_Model_HarvestSubscriber_Observer extends Springbot_BoneCollector_Model_HarvestAbstract
4
+ {
5
+ public function onSubscriberSaveAfter($observer)
6
+ {
7
+ try {
8
+ $this->_initObserver($observer);
9
+ $subscriberId = $observer->getEvent()->getSubscriber()->getId();
10
+
11
+ Springbot_Boss::scheduleJob(
12
+ 'post:subscriber',
13
+ array('i' => $subscriberId),
14
+ Springbot_Services::LISTENER,
15
+ 'listener'
16
+ );
17
+
18
+ }
19
+ catch (Exception $e) {
20
+ Springbot_Log::error($e->getMessage());
21
+ }
22
+ }
23
+
24
+ public function onSubscriberDeleteBefore($observer)
25
+ {
26
+ try {
27
+ // Runs blocking in session to guarantee record existence
28
+ $this->_initObserver($observer);
29
+ Mage::getModel('Springbot_Services_Post_Subscriber')->setData(array(
30
+ 'start_id' => $observer->getEvent()->getSubscriber()->getId(),
31
+ 'delete' => true,
32
+ ))->run();
33
+ }
34
+ catch (Exception $e) {
35
+ Springbot_Log::error($e->getMessage());
36
+ }
37
+ }
38
+ }
39
+
Springbot-1.5.2.2/Springbot/BoneCollector/etc/config.xml ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <global>
4
+ <models>
5
+ <bonecollector>
6
+ <class>Springbot_BoneCollector_Model</class>
7
+ </bonecollector>
8
+ </models>
9
+ <events>
10
+ <catalog_product_save_after>
11
+ <observers>
12
+ <springbot_bonecollector_product_observer>
13
+ <type>singleton</type>
14
+ <class>Springbot_BoneCollector_Model_HarvestProduct_Observer</class>
15
+ <method>onProductSaveAfter</method>
16
+ </springbot_bonecollector_product_observer>
17
+ </observers>
18
+ </catalog_product_save_after>
19
+ <catalog_product_delete_before>
20
+ <observers>
21
+ <springbot_bonecollector_productdelete_observer>
22
+ <type>singleton</type>
23
+ <class>Springbot_BoneCollector_Model_HarvestProduct_Observer</class>
24
+ <method>onProductDeleteBefore</method>
25
+ </springbot_bonecollector_productdelete_observer>
26
+ </observers>
27
+ </catalog_product_delete_before>
28
+ <catalog_category_save_after>
29
+ <observers>
30
+ <springbot_bonecollector_categorysave_observer>
31
+ <type>singleton</type>
32
+ <class>Springbot_BoneCollector_Model_HarvestCategory_Observer</class>
33
+ <method>onCategorySaveAfter</method>
34
+ </springbot_bonecollector_categorysave_observer>
35
+ </observers>
36
+ </catalog_category_save_after>
37
+ <catalog_category_delete_after>
38
+ <observers>
39
+ <springbot_bonecollector_categorydelete_observer>
40
+ <type>singleton</type>
41
+ <class>Springbot_BoneCollector_Model_HarvestCategory_Observer</class>
42
+ <method>onCategoryDeleteAfter</method>
43
+ </springbot_bonecollector_categorydelete_observer>
44
+ </observers>
45
+ </catalog_category_delete_after>
46
+ <customer_save_after>
47
+ <observers>
48
+ <springbot_bonecollector_customersave_observer>
49
+ <type>singleton</type>
50
+ <class>Springbot_BoneCollector_Model_HarvestCustomer_Observer</class>
51
+ <method>onCustomerSaveAfter</method>
52
+ </springbot_bonecollector_customersave_observer>
53
+ </observers>
54
+ </customer_save_after>
55
+ <customer_delete_before>
56
+ <observers>
57
+ <springbot_bonecollector_customerdelete_observer>
58
+ <type>singleton</type>
59
+ <class>Springbot_BoneCollector_Model_HarvestCustomer_Observer</class>
60
+ <method>onCustomerDeleteBefore</method>
61
+ </springbot_bonecollector_customerdelete_observer>
62
+ </observers>
63
+ </customer_delete_before>
64
+ <newsletter_subscriber_save_after>
65
+ <observers>
66
+ <springbot_bonecollector_subscribersave_observer>
67
+ <type>singleton</type>
68
+ <class>Springbot_BoneCollector_Model_HarvestSubscriber_Observer</class>
69
+ <method>onSubscriberSaveAfter</method>
70
+ </springbot_bonecollector_subscribersave_observer>
71
+ </observers>
72
+ </newsletter_subscriber_save_after>
73
+ <newsletter_subscriber_delete_before>
74
+ <observers>
75
+ <springbot_bonecollector_subscriberdelete_observer>
76
+ <type>singleton</type>
77
+ <class>Springbot_BoneCollector_Model_HarvestSubscriber_Observer</class>
78
+ <method>onSubscriberDeleteBefore</method>
79
+ </springbot_bonecollector_subscriberdelete_observer>
80
+ </observers>
81
+ </newsletter_subscriber_delete_before>
82
+
83
+
84
+ <!-- Inventory update listeners -->
85
+ <cataloginventory_stock_item_save_commit_after>
86
+ <observers>
87
+ <springbot_bonecollector_stockitemsavecommit_observer>
88
+ <class>Springbot_BoneCollector_Model_HarvestInventoryItem_Observer</class>
89
+ <method>onCatalogInventorySave</method>
90
+ </springbot_bonecollector_stockitemsavecommit_observer>
91
+ </observers>
92
+ </cataloginventory_stock_item_save_commit_after>
93
+ <sales_model_service_quote_submit_before>
94
+ <observers>
95
+ <springbot_bonecollector_quoteseubmit_observer>
96
+ <class>Springbot_BoneCollector_Model_HarvestInventoryItem_Observer</class>
97
+ <method>onQuoteSubmit</method>
98
+ </springbot_bonecollector_quoteseubmit_observer>
99
+ </observers>
100
+ </sales_model_service_quote_submit_before>
101
+ <sales_model_service_quote_submit_failure>
102
+ <observers>
103
+ <springbot_bonecollector_quotesubmitfailure>
104
+ <class>Springbot_BoneCollector_Model_HarvestInventoryItem_Observer</class>
105
+ <method>onQuoteSubmit</method>
106
+ </springbot_bonecollector_quotesubmitfailure>
107
+ </observers>
108
+ </sales_model_service_quote_submit_failure>
109
+ <sales_order_item_cancel>
110
+ <observers>
111
+ <springbot_bonecollector_stockupdate>
112
+ <class>Springbot_BoneCollector_Model_HarvestInventoryItem_Observer</class>
113
+ <method>onCancelOrderItem</method>
114
+ </springbot_bonecollector_stockupdate>
115
+ </observers>
116
+ </sales_order_item_cancel>
117
+ <sales_order_creditmemo_save_after>
118
+ <observers>
119
+ <springbot_bonecollector_stockupdate>
120
+ <class>Springbot_BoneCollector_Model_HarvestInventoryItem_Observer</class>
121
+ <method>onCreditmemoSave</method>
122
+ </springbot_bonecollector_stockupdate>
123
+ </observers>
124
+ </sales_order_creditmemo_save_after>
125
+ <!-- End inventory update listeners -->
126
+
127
+
128
+ </events>
129
+ </global>
130
+ <frontend>
131
+ <events>
132
+ <sales_order_place_after>
133
+ <observers>
134
+ <springbot_bonecollector_purchase_action_observer>
135
+ <type>singleton</type>
136
+ <class>Springbot_BoneCollector_Model_HarvestPurchase_Observer</class>
137
+ <method>onFrontendOrderPlaceAfter</method>
138
+ </springbot_bonecollector_purchase_action_observer>
139
+ </observers>
140
+ </sales_order_place_after>
141
+ <sales_order_save_after>
142
+ <observers>
143
+ <springbot_bonecollector_purchase_observer>
144
+ <type>singleton</type>
145
+ <class>Springbot_BoneCollector_Model_HarvestPurchase_Observer</class>
146
+ <method>onFrontendOrderSaveAfter</method>
147
+ </springbot_bonecollector_purchase_observer>
148
+ </observers>
149
+ </sales_order_save_after>
150
+ <sales_quote_save_after>
151
+ <observers>
152
+ <springbot_bonecollector_addtocart_observer>
153
+ <type>singleton</type>
154
+ <class>Springbot_BoneCollector_Model_HarvestCart_Observer</class>
155
+ <method>onFrontendQuoteSaveAfter</method>
156
+ </springbot_bonecollector_addtocart_observer>
157
+ </observers>
158
+ </sales_quote_save_after>
159
+ <checkout_cart_add_product_complete>
160
+ <observers>
161
+ <springbot_bonecollector_addskutocart_observer>
162
+ <type>singleton</type>
163
+ <class>Springbot_BoneCollector_Model_HarvestCart_Observer</class>
164
+ <method>onFrontendCartAddProduct</method>
165
+ </springbot_bonecollector_addskutocart_observer>
166
+ </observers>
167
+ </checkout_cart_add_product_complete>
168
+ <checkout_cart_update_items_before>
169
+ <observers>
170
+ <springbot_bonecollector_updatecart_observer>
171
+ <type>singleton</type>
172
+ <class>Springbot_BoneCollector_Model_HarvestCart_Observer</class>
173
+ <method>onFrontendCartUpdate</method>
174
+ </springbot_bonecollector_updatecart_observer>
175
+ </observers>
176
+ </checkout_cart_update_items_before>
177
+ </events>
178
+ </frontend>
179
+ <adminhtml>
180
+ <events>
181
+ <sales_order_save_after>
182
+ <observers>
183
+ <springbot_bonecollector_purchase_admin_observer>
184
+ <type>singleton</type>
185
+ <class>Springbot_BoneCollector_Model_HarvestPurchase_Observer</class>
186
+ <method>onAdminOrderSaveAfter</method>
187
+ </springbot_bonecollector_purchase_admin_observer>
188
+ </observers>
189
+ </sales_order_save_after>
190
+ <catalog_entity_attribute_save_commit_after>
191
+ <observers>
192
+ <springbot_bonecollector_attribute_observer>
193
+ <type>singleton</type>
194
+ <class>Springbot_BoneCollector_Model_HarvestAttribute_Observer</class>
195
+ <method>onAdminAttributeSaveAfter</method>
196
+ </springbot_bonecollector_attribute_observer>
197
+ </observers>
198
+ </catalog_entity_attribute_save_commit_after>
199
+ <eav_entity_attribute_save_commit_after>
200
+ <observers>
201
+ <springbot_bonecollector_attribute_set_observer>
202
+ <type>singleton</type>
203
+ <class>Springbot_BoneCollector_Model_HarvestAttribute_Observer</class>
204
+ <method>onAdminAttributeSetSaveAfter</method>
205
+ </springbot_bonecollector_attribute_set_observer>
206
+ </observers>
207
+ </eav_entity_attribute_save_commit_after>
208
+ <salesrule_rule_save_after>
209
+ <observers>
210
+ <springbot_bonecollector_rulesave_observer>
211
+ <type>singleton</type>
212
+ <class>Springbot_BoneCollector_Model_HarvestRule_Observer</class>
213
+ <method>onSalesruleRuleSaveAfter</method>
214
+ </springbot_bonecollector_rulesave_observer>
215
+ </observers>
216
+ </salesrule_rule_save_after>
217
+ <salesrule_rule_delete_before>
218
+ <observers>
219
+ <springbot_bonecollector_coupondelete_observer>
220
+ <type>singleton</type>
221
+ <class>Springbot_BoneCollector_Model_HarvestCoupon_Observer</class>
222
+ <method>onSalesruleRuleDeleteBefore</method>
223
+ </springbot_bonecollector_coupondelete_observer>
224
+ </observers>
225
+ </salesrule_rule_delete_before>
226
+ </events>
227
+ </adminhtml>
228
+ </config>
Springbot-1.5.2.2/Springbot/Boss.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class: Springbot_Boss
5
+ *
6
+ * @author Springbot Magento Integration Team <magento@springbot.com>
7
+ * @version 1.4.0.6
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Springbot_Boss
11
+ {
12
+ const SOURCE_BULK_HARVEST = 'BH';
13
+ const SOURCE_OBSERVER = 'OB';
14
+ const DATE_FORMAT = 'Y-m-d H:i:s';
15
+ const NO_SKU_PREFIX = '_sbentity-';
16
+ const TOKEN_DELIMITER = '%7';
17
+ const COOKIE_NAME = 'springbot_redirect_queue';
18
+ const SB_TRACKABLES_COOKIE = '_sbtk';
19
+ const MAXIMUM_IDS_SAVED = 32;
20
+
21
+ /**
22
+ * Schedule cron job
23
+ *
24
+ * @param string $method
25
+ * @param array $args
26
+ * @param int $priority
27
+ * @param string $queue
28
+ * @param int $storeId
29
+ * @param int $minutesInFuture
30
+ */
31
+ public static function scheduleJob($method, array $args, $priority, $queue = 'default', $storeId = null, $minutesInFuture = 0)
32
+ {
33
+ if(self::active() && !empty($method)) {
34
+
35
+ if (is_int($minutesInFuture) && ($minutesInFuture > 0)) {
36
+ $nextRunAt = date("Y-m-d H:i:s", strtotime("+{$minutesInFuture} minutes"));
37
+ }
38
+ else {
39
+ $nextRunAt = date("Y-m-d H:i:s");
40
+ }
41
+
42
+ $cronModel = Mage::getModel('combine/cron_queue');
43
+ $cronModel->setData(array(
44
+ 'method' => $method,
45
+ 'args' => json_encode($args),
46
+ 'priority' => $priority,
47
+ 'command_hash' => sha1($method . json_encode($args)),
48
+ 'queue' => $queue,
49
+ 'store_id' => $storeId,
50
+ 'next_run_at' => $nextRunAt
51
+ ));
52
+
53
+ $cronModel->insertIgnore();
54
+ self::startWorkManager();
55
+ }
56
+ }
57
+
58
+ public static function insertEvent($data)
59
+ {
60
+ if(self::active()) {
61
+ if(!isset($data['type']) || !isset($data['store_id'])) {
62
+ Springbot_Log::error("Invalid action attempted to log");
63
+ return;
64
+ }
65
+ $event = Mage::getModel('combine/action');
66
+ $event->setData($data);
67
+ $event->save();
68
+
69
+ Springbot_Log::debug($event->getData());
70
+ }
71
+ }
72
+
73
+ public static function addTrackable($type, $value, $quoteId, $customerId, $customerEmail = '', $orderId = null)
74
+ {
75
+ if(self::active()) {
76
+ $trackableModel = Mage::getModel('combine/trackable');
77
+ $trackableModel->setData(array(
78
+ 'type' => $type,
79
+ 'value' => $value,
80
+ 'quote_id' => $quoteId,
81
+ 'customer_id' => $customerId,
82
+ 'email' => $customerEmail,
83
+ 'order_id' => $orderId
84
+ ));
85
+ $trackableModel->createOrUpdate();
86
+
87
+ // Ensure that trackables in cookie are processed
88
+ foreach($trackableModel->getTrackables() as $type => $value) {
89
+ Springbot_Log::debug("Ensure trackable $type => $value");
90
+ $trackableModel->setData(array(
91
+ 'type' => $type,
92
+ 'value' => $value,
93
+ 'quote_id' => $quoteId,
94
+ 'customer_id' => $customerId,
95
+ 'email' => $customerEmail,
96
+ 'order_id' => $orderId
97
+ ));
98
+ $trackableModel->createOrUpdate();
99
+ }
100
+ }
101
+ }
102
+
103
+ public static function startWorkManager()
104
+ {
105
+ if(self::active() && !self::isCron() && !self::isPrattler()) {
106
+ $status = Mage::getModel('combine/cron_manager_status');
107
+ if(
108
+ !$status->isBlocked() &&
109
+ !$status->isActive()
110
+ ) {
111
+ Springbot_Cli::internalCallback('work:manager');
112
+ }
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Schedule all jobs intended to run in the future
118
+ *
119
+ * @param integer $storeId
120
+ */
121
+ public static function scheduleFutureJobs($storeId = null)
122
+ {
123
+ if (is_null($storeId)) {
124
+ $storeId = Mage::app()->getStore()->getStoreId();
125
+ }
126
+
127
+ // Healthcheck uses default query interval
128
+ Springbot_Boss::scheduleJob('cmd:healthcheck', array('s' => $storeId), 5, 'listener', $storeId, 5);
129
+
130
+ // Send event log every minute
131
+ Springbot_Boss::scheduleJob('tasks:deliverEventLog', array('s' => $storeId), 5, 'listener', $storeId, 1);
132
+
133
+ // Run this in real time, but only every 30 min
134
+ Springbot_Boss::scheduleJob('work:cleanup', array('s' => $storeId), 5, 'listener', $storeId, 30);
135
+ }
136
+
137
+ /**
138
+ * Removes all harvest jobs from the queue
139
+ *
140
+ * @param integer $storeId
141
+ */
142
+ public static function halt($storeId = null)
143
+ {
144
+ $queueDb = new Springbot_Combine_Model_Mysql4_Cron_Queue;
145
+ $queueDb->removeHarvestRows($storeId);
146
+ }
147
+
148
+ public static function isCron()
149
+ {
150
+ if (Mage::getStoreConfig('springbot/advanced/harvester_type') == "cron") {
151
+ return true;
152
+ } else {
153
+ return false;
154
+ }
155
+ }
156
+
157
+
158
+ public static function isPrattler()
159
+ {
160
+ if (Mage::getStoreConfig('springbot/advanced/harvester_type') == "prattler") {
161
+ return true;
162
+ } else {
163
+ return false;
164
+ }
165
+ }
166
+
167
+ public static function harvesterType()
168
+ {
169
+ return Mage::getStoreConfig('springbot/advanced/harvester_type');
170
+ }
171
+
172
+ public static function storeIdsExist()
173
+ {
174
+ foreach (Mage::app()->getStores() as $store) {
175
+ if (!Mage::getStoreConfig('springbot/config/store_id_' . $store->getId())) {
176
+ return false;
177
+ }
178
+ }
179
+ return true;
180
+ }
181
+
182
+ /**
183
+ * Check if plugin is active and should function properly
184
+ */
185
+ public static function active()
186
+ {
187
+ $token = Mage::getStoreConfig('springbot/config/security_token');
188
+ return !empty($token);
189
+ }
190
+
191
+ public static function setCookie($name, $value)
192
+ {
193
+ Springbot_Log::debug("Saving cookie $name : $value");
194
+
195
+ Mage::getModel('core/cookie')->set(
196
+ $name,
197
+ $value,
198
+ strtotime('+365 days'),
199
+ '/', // path
200
+ null, // domain
201
+ null, // secure
202
+ false // httpOnly
203
+ );
204
+ }
205
+ }
Springbot-1.5.2.2/Springbot/Cli.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class: Springbot_Cli
5
+ *
6
+ * @author Springbot Magento Integration Team <magento@springbot.com>
7
+ * @version 1.4.0.0
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Springbot_Cli
11
+ {
12
+
13
+ private static $_phpExec;
14
+
15
+ /**
16
+ * Intended to be a wrapper for interalCallback to route cronned
17
+ * instances to the cron queue. We do not want to send jobs in
18
+ * the work service here, as they wind up in a loop.
19
+ *
20
+ * @param string $method
21
+ * @param array $args
22
+ */
23
+ public static function async($method, $args = array())
24
+ {
25
+ if (Springbot_Boss::isCron() || Springbot_Boss::isPrattler()) {
26
+ Springbot_Boss::scheduleJob($method, $args, 1);
27
+ } else {
28
+ self::internalCallback($method, $args, true);
29
+ }
30
+ }
31
+
32
+ /**
33
+ *
34
+ * @param string $method
35
+ * @param array $args
36
+ * @param bool $background
37
+ */
38
+ public static function internalCallback($method, $args = array(), $background = true)
39
+ {
40
+ $bkg = $background ? '&' : '';
41
+ $fmt = self::buildFlags($args);
42
+ $php = self::getPhpExec();
43
+ $dir = Mage::getBaseDir();
44
+ $err = Springbot_Log::getSpringbotErrorLog();
45
+ $log = Springbot_Log::getSpringbotLog();
46
+ $nohup = self::nohup();
47
+ $nice = self::nice();
48
+
49
+ $cmd = "{$nohup} {$nice} {$php} {$dir}/shell/springbot.php {$fmt} {$method} >> {$log} 2>> {$err} {$bkg}";
50
+ return self::spawn($cmd);
51
+ }
52
+
53
+ public static function nohup()
54
+ {
55
+ return Mage::getStoreConfig('springbot/advanced/nohup') ? 'nohup' : '';
56
+ }
57
+
58
+ public static function nice()
59
+ {
60
+ return Mage::getStoreConfig('springbot/advanced/nice') ? 'nice' : '';
61
+ }
62
+
63
+ /**
64
+ * Build cli flags from arg array
65
+ *
66
+ * @param array $args
67
+ * @return string
68
+ */
69
+ public static function buildFlags($args)
70
+ {
71
+ $fmt = array();
72
+
73
+ foreach($args as $flag => $arg) {
74
+ if(is_int($flag)) {
75
+ $flag = $arg;
76
+ $arg = '';
77
+ }
78
+ $fmt[] = "-$flag $arg";
79
+ }
80
+ return implode(' ', $fmt);
81
+ }
82
+
83
+ /**
84
+ * Spawn system callback with any available system command
85
+ *
86
+ * @param string $command
87
+ * @param int $return_var
88
+ */
89
+ public static function spawn($command, &$return_var = 0)
90
+ {
91
+ Springbot_Log::debug($command);
92
+ if(function_exists('system')) {
93
+ $ret = system($command, $return_var);
94
+ } else if(function_exists('exec')) {
95
+ $ret = exec($command, $return_var);
96
+ } else if(function_exists('passthru')) {
97
+ $ret = passthru($command, $return_var);
98
+ } else if(function_exists('shell_exec')) {
99
+ $ret = shell_exec($command);
100
+ } else {
101
+ throw new Exception('Program execution function not found!');
102
+ }
103
+ Springbot_Log::debug($ret);
104
+ return $ret;
105
+ }
106
+
107
+ public static function launchHarvest()
108
+ {
109
+ Mage::helper('combine/harvest')->truncateEngineLogs();
110
+ self::async('cmd:harvest');
111
+ }
112
+
113
+ public static function launchHarvestInline() {
114
+ $harvest = new Springbot_Services_Cmd_Harvest();
115
+ $harvest->run();
116
+ }
117
+
118
+
119
+ public static function startWorkManager()
120
+ {
121
+ $status = Mage::getModel('combine/cron_manager_status');
122
+ if (!$status->isBlocked() && !$status->isActive()) {
123
+ self::internalCallback('work:manager');
124
+ }
125
+ }
126
+
127
+ public static function haltManager($pid)
128
+ {
129
+ self::internalCallback('work:stop', array('p' => $pid));
130
+ }
131
+
132
+ public static function postItem($type, $id)
133
+ {
134
+ self::async(
135
+ "post:$id",
136
+ array('i' => $id)
137
+ );
138
+ }
139
+
140
+ public static function resumeHarvest()
141
+ {
142
+ self::async('work:manager');
143
+ }
144
+
145
+ /**
146
+ * Get PHP executable path
147
+ *
148
+ * @return string
149
+ */
150
+ public static function getPhpExec()
151
+ {
152
+ if(!isset(self::$_phpExec)) {
153
+ try {
154
+ $php = Mage::getStoreConfig('springbot/config/php_exec');
155
+
156
+ if((empty($php))) {
157
+ // This prevents the system command from outputting to apache
158
+ ob_start();
159
+ if(empty($php) || !file_exists($php)) {
160
+ $php = self::spawn('which php5 2> /dev/null');
161
+ }
162
+ if(empty($php) || !file_exists($php)) {
163
+ $php = self::spawn('which php 2> /dev/null');
164
+ }
165
+ if(empty($php) || !file_exists($php)) {
166
+ $php = 'php';
167
+ }
168
+ ob_end_clean();
169
+ }
170
+ self::$_phpExec = $php;
171
+ }
172
+ catch (Exception $e) {
173
+ Springbot_Log::error($e->getMessage());
174
+ return '';
175
+ }
176
+ }
177
+ return self::$_phpExec;
178
+ }
179
+ }
Springbot-1.5.2.2/Springbot/Combine/Helper/Attributes.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // @TODO test for store id
4
+
5
+ class Springbot_Combine_Helper_Attributes extends Mage_Core_Helper_Abstract
6
+ {
7
+ public function getAttributeSets($type = 'catalog_product')
8
+ {
9
+ $entityTypeId = Mage::getModel('eav/entity')
10
+ ->setType($type)
11
+ ->getTypeId();
12
+ return Mage::getModel('eav/entity_attribute_set')
13
+ ->getCollection()
14
+ ->setEntityTypeFilter($entityTypeId);
15
+ }
16
+
17
+ public function getCustomerAttributeSet()
18
+ {
19
+ return $this->getCustomerAttributeSets()->getFirstItem();
20
+ }
21
+
22
+ public function getCustomerAttributeSets()
23
+ {
24
+ return $this->getAttributeSets('customer');
25
+ }
26
+
27
+ public function getAttributeSetById($id)
28
+ {
29
+ return Mage::getModel('eav/entity_attribute_set')->load($id);
30
+ }
31
+
32
+ public function getAttributesBySet($attributeSet)
33
+ {
34
+ if(!is_int($attributeSet)) {
35
+ $attributeSet = $this->_resolveSet($attributeSet);
36
+ }
37
+ return Mage::getResourceModel('eav/entity_attribute_collection')
38
+ ->setAttributeSetFilter($attributeSet)
39
+ ->addSetInfo();
40
+ }
41
+
42
+ public function getCustomAttributesBySet($attributeSet)
43
+ {
44
+ $collection = $this->getAttributesBySet($attributeSet);
45
+ return $this->filterNonUserDefined($collection);
46
+ }
47
+
48
+ public function getCustomerCustomAttributes($attributeSet)
49
+ {
50
+ $collection = $this->getAttributesBySet($attributeSet);
51
+ return $this->filterSystemForCustomers($collection);
52
+ }
53
+
54
+ public function getAttributeGroupsBySet($attributeSet)
55
+ {
56
+ return Mage::getModel('eav/entity_attribute_group')
57
+ ->getResourceCollection()
58
+ ->setAttributeSetFilter($this->_resolveSet($attributeSet));
59
+ }
60
+
61
+ public function getProductAttributesByGroup($group)
62
+ {
63
+ return Mage::getResourceModel('catalog/product_attribute_collection')
64
+ ->setAttributeGroupFilter($group->getId())
65
+ ->addVisibleFilter()
66
+ ->checkConfigurableProducts();
67
+ }
68
+
69
+ public function getAllSetsForAttribute($attribute)
70
+ {
71
+ if(is_object($attribute)) {
72
+ $attribute = $attribute->getAttributeId();
73
+ }
74
+ $collection = Mage::getModel('eav/entity_attribute')
75
+ ->getCollection()
76
+ ->addSetInfo()
77
+ ->addFieldToFilter('attribute_id', $attribute);
78
+
79
+ if($attribute = $collection->getFirstItem()) {
80
+ $sets = $attribute->getAttributeSetInfo();
81
+ if(is_array($sets)) {
82
+ return array_keys($sets);
83
+ }
84
+ }
85
+ }
86
+
87
+ public function getOptionText($attribute, $value)
88
+ {
89
+ foreach($this->getOptionsByAttribute($attribute) as $option) {
90
+ if(isset($option['value']) && $option['value'] == $value) {
91
+ return $option['label'];
92
+ }
93
+ }
94
+ }
95
+
96
+ public function getOptionsByAttribute($attribute)
97
+ {
98
+ try {
99
+ if($attribute->usesSource()) {
100
+ return Mage::getResourceModel('eav/entity_attribute_option_collection')
101
+ ->setAttributeFilter($attribute->getId())
102
+ ->setStoreFilter(0,false)
103
+ ->toOptionArray();
104
+ }
105
+ } catch (Exception $e) {
106
+ Springbot_Log::error($e->getMessage());
107
+ }
108
+ }
109
+
110
+ public function getParsedAttributesBySet($set)
111
+ {
112
+ return $this->parseAttributes($this->getCustomAttributesBySet($set));
113
+ }
114
+
115
+ public function parseAttributes($_attributes)
116
+ {
117
+ foreach($_attributes as $attr) {
118
+ $toInsert = array(
119
+ 'label' => $attr->getFrontendLabel(),
120
+ 'attribute_id' => $attr->getAttributeId(),
121
+ 'attribute_code' => $attr->getAttributeCode(),
122
+ );
123
+
124
+ if($options = $this->getOptionsByAttribute($attr)) {
125
+ $toInsert['options'] = $this->pluckOptions($options);
126
+ }
127
+ $attributes[] = $toInsert;
128
+ }
129
+ return $attributes;
130
+ }
131
+
132
+ public function pluckOptions($options)
133
+ {
134
+ return array_values($this->pluck($options, 'label'));
135
+ }
136
+
137
+ public function pluck($array, $field)
138
+ {
139
+ $_array = array();
140
+ foreach($array as $item) {
141
+ $_array[] = $item[$field];
142
+ }
143
+ return $_array;
144
+ }
145
+
146
+ public function filterNonUserDefined($collection)
147
+ {
148
+ return $collection->addFieldToFilter('is_user_defined', array('gt' => 0));
149
+ }
150
+
151
+ public function filterSystemForCustomers($collection)
152
+ {
153
+ $table = Mage::getSingleton('core/resource')->getTableName('customer/eav_attribute');
154
+
155
+ $collection->getSelect()->join(
156
+ array('additional_table' => $table),
157
+ 'additional_table.attribute_id = main_table.attribute_id',
158
+ 'is_system'
159
+ )->where('is_system = 0');
160
+
161
+ return $collection;
162
+ }
163
+
164
+ protected function _resolveSet($attributeSet)
165
+ {
166
+ if($attributeSet instanceof Mage_Eav_Model_Entity_Attribute_Set) {
167
+ $attributeSet = $attributeSet->getAttributeSetId();
168
+ }
169
+ return $attributeSet;
170
+ }
171
+ }
Springbot-1.5.2.2/Springbot/Combine/Helper/Cart.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Helper_Cart extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function setQuote($quoteId, $suppliedSecurityHash) {
6
+ if (Mage::getStoreConfig('springbot/cart_restore/do_restore') == 1) {
7
+ if ($quote = Mage::getModel('sales/quote')->load($quoteId)) {
8
+ $cartCount = Mage::helper('checkout/cart')->getSummaryCount();
9
+ if ($cartCount == 0) {
10
+
11
+ $quote->setIsActive(true)->save();
12
+ $token = Mage::getStoreConfig('springbot/config/security_token');
13
+
14
+ $correctSecurityHash = sha1($quoteId . $token);
15
+ if ($suppliedSecurityHash == $correctSecurityHash) {
16
+
17
+ if (Mage::getStoreConfig('springbot/cart_restore/retain_coupon') == 0) {
18
+ $quote->setCouponCode('');
19
+ $quote->save();
20
+ }
21
+
22
+ Mage::getSingleton('checkout/session')->setQuoteId($quoteId);
23
+ }
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
Springbot-1.5.2.2/Springbot/Combine/Helper/Data.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function formatDateTime($date = null)
6
+ {
7
+ $_date = new DateTime($date, new DateTimeZone('UTC'));
8
+ return $_date->format(DateTime::ATOM);
9
+ }
10
+
11
+ /**
12
+ * Converts a store guid into its alphanumeric-only representation if present.
13
+ */
14
+ public function getPublicGuid($storeId)
15
+ {
16
+ $guid = Mage::getStoreConfig('springbot/config/store_guid_' . $storeId);
17
+ if(isset($guid)) {
18
+ return str_replace('-', '', strtolower($guid));
19
+ }
20
+ }
21
+
22
+ public function getStoreGuid($storeId)
23
+ {
24
+ $guid = Mage::getStoreConfig('springbot/config/store_guid_' . $storeId);
25
+ if (empty($guid)) {
26
+ $charid = strtoupper(md5(uniqid(rand(), true)));
27
+ $guid = substr($charid, 0, 8).'-'
28
+ .substr($charid, 8, 4).'-'
29
+ .substr($charid,12, 4).'-'
30
+ .substr($charid,16, 4).'-'
31
+ .substr($charid,20,12);
32
+ }
33
+ return $guid;
34
+ }
35
+
36
+ public function apiPostWrapped($model, $struct, $arrayWrap = false)
37
+ {
38
+ if($arrayWrap) {
39
+ $struct = array($struct);
40
+ }
41
+ $api = Mage::getModel('combine/api');
42
+ $payload = $api->wrap($model, $struct);
43
+ return $api->reinit()->call($model, $payload);
44
+ }
45
+
46
+ public function checkCredentials($email = null, $password = null)
47
+ {
48
+ try {
49
+ $return = array('valid' => false);
50
+ $this->requestSecurityToken($email, $password, true);
51
+ $return['valid'] = true;
52
+ }
53
+ catch (Exception $e) {
54
+ $return['message'] = $e->getMessage();
55
+ }
56
+ return $return;
57
+ }
58
+
59
+ public function requestSecurityToken($email = null, $password = null, $force = false)
60
+ {
61
+ $token = Mage::getStoreConfig('springbot/config/security_token');
62
+ if($token && !$force) {
63
+ return $token;
64
+ }
65
+
66
+ $payload = $this->_resolvePassword($email, $password);
67
+
68
+ $response = Mage::getModel('combine/api')->call('registration/login', json_encode($payload), false);
69
+
70
+ if(!isset($response['token'])) {
71
+ throw new Exception($response['message']);
72
+ }
73
+ return $response['token'];
74
+ }
75
+
76
+ protected function _resolvePassword($email = null, $password = null)
77
+ {
78
+ if (is_null($email) || is_null($password)) {
79
+ $payload = array(
80
+ 'user_id' => Mage::getStoreConfig('springbot/config/account_email'),
81
+ 'password' => Mage::helper('core')->decrypt(Mage::getStoreConfig('springbot/config/account_password')),
82
+ );
83
+ }
84
+ else {
85
+ $payload = array(
86
+ 'user_id' => $email,
87
+ 'password' => $password,
88
+ );
89
+ }
90
+ return $payload;
91
+ }
92
+
93
+ public function doSendQuote($json)
94
+ {
95
+ $obj = json_decode($json);
96
+ $toHash = '';
97
+ if (isset($obj->customer_firstname)) {
98
+ $toHash .= $obj->customer_firstname;
99
+ }
100
+ if (isset($obj->customer_lastname)) {
101
+ $toHash .= $obj->customer_lastname;
102
+ }
103
+
104
+ if (isset($obj->line_items)) {
105
+ $hash = sha1($toHash . json_encode($obj->line_items));
106
+ }
107
+ else {
108
+ $hash = sha1($toHash . json_encode(array()));
109
+ }
110
+
111
+ if (Mage::getSingleton('core/session')->getSpringbotQuoteHash() !== $hash) {
112
+ Mage::getSingleton('core/session')->setSpringbotQuoteHash($hash);
113
+ return true;
114
+ } else {
115
+ return false;
116
+ }
117
+ }
118
+
119
+ public function escapeShell($arg)
120
+ {
121
+ if(function_exists('escapeshellarg')) {
122
+ return escapeshellarg($arg);
123
+ } else {
124
+ return "'" . str_replace("'", "'\"'\"'", $arg) . "'";
125
+ }
126
+ }
127
+
128
+ public function getMicroTime()
129
+ {
130
+ $mtime = explode(" ",microtime());
131
+ return $mtime[1] + $mtime[0];
132
+ }
133
+
134
+ public function isJson($string)
135
+ {
136
+ return is_string($string) && json_decode($string) != null;
137
+ }
138
+
139
+ public function getLastCategoryId()
140
+ {
141
+ $this->setLastCategoryId();
142
+ return Mage::getSingleton('core/session')->getSpringbotLastCategoryId();
143
+ }
144
+
145
+ public function setLastCategoryId()
146
+ {
147
+ $product = Mage::registry('current_product');
148
+ $category = Mage::registry('current_category');
149
+
150
+ if($categoryId = $this->resolveCategoryId($category, $product)) {
151
+ Mage::getSingleton('core/session')->setSpringbotLastCategoryId($categoryId);
152
+ }
153
+ }
154
+
155
+ /**
156
+ * Resolve category id to set in session
157
+ *
158
+ * We are handling multiple states:
159
+ * cat && prod => check if cat makes sense
160
+ * prod => pop cat id from prod
161
+ * cat => use cat id
162
+ * !cat && !prod => use cached
163
+ *
164
+ * @param Mage_Catalog_Model_Category $category
165
+ * @param Mage_Catalog_Model_Product $product
166
+ * @return int|null
167
+ */
168
+ public function resolveCategoryId($category, $product)
169
+ {
170
+ $categoryId = null;
171
+ if((isset($product) || isset($category)))
172
+ {
173
+ if(isset($product) && isset($category))
174
+ {
175
+ $productCatIds = $product->getCategoryIds();
176
+ $categoryId = $category->getId();
177
+
178
+ if(!in_array($categoryId, $productCatIds))
179
+ {
180
+ $categoryId = array_pop($productCatIds);
181
+ }
182
+ }
183
+ else if(isset($product))
184
+ {
185
+ $productCatIds = $product->getCategoryIds();
186
+ $categoryId = array_pop($productCatIds);
187
+ }
188
+ else if (isset($category))
189
+ {
190
+ $categoryId = $category->getId();
191
+ }
192
+ }
193
+ return $categoryId;
194
+ }
195
+
196
+ public function checkCategoryIdSanity($categoryId, $product)
197
+ {
198
+ if(!$product instanceof Varien_Object) {
199
+ $product = Mage::getModel('catalog/product')->load($product);
200
+ }
201
+ return $this->resolveCategoryId(
202
+ new Varien_Object(array('id' => $categoryId)),
203
+ $product
204
+ );
205
+ }
206
+
207
+ public function getLogContents($logName)
208
+ {
209
+ $maxRecSize = 65536;
210
+
211
+ if (empty($logName)) {
212
+ $fullFilename = Springbot_Log::getSpringbotLog();
213
+ }
214
+ else {
215
+ // Remove directory traversals for security
216
+ $fullFilename = Mage::getBaseDir('log') . DS . str_replace('../', '', $logName);
217
+ }
218
+
219
+ $buffer = '';
220
+ if (file_exists($fullFilename)) {
221
+ if (($fHandle = fopen($fullFilename, 'r')) !== FALSE) {
222
+ $fSize = filesize($fullFilename) / 1024;
223
+ if ($fSize > 32) {
224
+ fseek($fHandle, 1024*($fSize-32));
225
+ }
226
+ while (!feof($fHandle)) {
227
+ $buffer .= fgets($fHandle,$maxRecSize) . ' ';
228
+ }
229
+ fclose($fHandle);
230
+ }
231
+ else {
232
+ $buffer = 'Open failed on '.$fullFilename;
233
+ }
234
+ }
235
+ return $buffer;
236
+ }
237
+ }
Springbot-1.5.2.2/Springbot/Combine/Helper/Harvest.php ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Helper_Harvest extends Mage_Core_Helper_Abstract
4
+ {
5
+ protected $_ignores;
6
+ protected $_defines;
7
+ protected $_rulesBuilt = false;
8
+ protected $_harvestId;
9
+
10
+ public function initRemoteHarvest($id)
11
+ {
12
+ $api = Mage::getModel('combine/api');
13
+
14
+ Springbot_Log::debug("Query remote service for harvest id");
15
+
16
+ $response = $api->get('harvests/new', array('store_id' => $this->getSpringbotStoreId($id)));
17
+
18
+ if(isset($response['harvest_id'])) {
19
+ $this->_harvestId = $response['harvest_id'];
20
+ } else {
21
+ Springbot_Log::debug("Harvest id not present in response");
22
+ Springbot_Log::debug($response);
23
+ }
24
+
25
+ return $this->_harvestId;
26
+ }
27
+
28
+ public function reinit()
29
+ {
30
+ $this->_buildStoreRules();
31
+ return $this;
32
+ }
33
+
34
+ /**
35
+ * Map store ids to given model
36
+ *
37
+ * This method intends to apply all appropriate store ids to an object (namely
38
+ * categories and products), but could be anything. If the callback fails to
39
+ * provide any store ids, we failover to provide the originally supplied model.
40
+ *
41
+ * @param Varien_Object $model
42
+ * @param mixed $storeIds
43
+ * @param string $callback
44
+ * @return array<Varien_Object>
45
+ */
46
+ public function mapStoreIds($model, $storeIds = null, $callback = 'getStoreIds')
47
+ {
48
+ $output = array();
49
+
50
+ if(!$storeIds) {
51
+ $storeIds = $model->{$callback}();
52
+ }
53
+
54
+ foreach($storeIds as $id) {
55
+ if($id) {
56
+ $_model = clone $model;
57
+ $_model = $_model->setStoreId($id)->load($_model->getId());
58
+ $output[] = $_model;
59
+ }
60
+ }
61
+
62
+ return !empty($output) ? $output : array($model);
63
+ }
64
+
65
+
66
+ /**
67
+ * Get last collection primary id
68
+ *
69
+ * @param Varien_Data_Collection $collection
70
+ * @return int
71
+ */
72
+ public function getLastCollectionId($collection, $dir = 'DESC')
73
+ {
74
+ $collection->clear();
75
+
76
+ $id = $this->getIdFieldName($collection);
77
+
78
+ $collection->getSelect()
79
+ ->reset(Zend_Db_Select::ORDER)
80
+ ->order("$id $dir")
81
+ ->limit(1);
82
+ return $collection->getFirstItem()->getData($id);
83
+ }
84
+
85
+ public function getFirstCollectionId($collection)
86
+ {
87
+ return $this->getLastCollectionId($collection, 'ASC');
88
+ }
89
+
90
+ /**
91
+ * Get id field name for collection
92
+ *
93
+ * Attempt to get id field name (sql primary key) for collection through
94
+ * existing methods, then failing over to inspecting an the resource itself.
95
+ * Mainly done this way for subscribers.
96
+ *
97
+ * @param Varien_Data_Collection $collection
98
+ * @param string $default | optional
99
+ * @return string
100
+ */
101
+ public function getIdFieldName($collection, $default = 'entity_id')
102
+ {
103
+ if(method_exists($collection, 'getIdFieldName')) {
104
+ $id = $collection->getIdFieldName();
105
+ }
106
+
107
+ if(is_null($id) && method_exists($collection, 'getRowIdFieldName')) {
108
+ $id = $collection->getRowIdFieldName();
109
+ }
110
+
111
+ if(is_null($id)) {
112
+ try {
113
+ $id = $collection->getResource()->getIdFieldName();
114
+ } catch (Exception $e) {
115
+ Springbot_Log::error($e->getMessage());
116
+ }
117
+ }
118
+
119
+ if(is_null($id)) {
120
+ $id = $default;
121
+ }
122
+
123
+ return $id;
124
+ }
125
+
126
+ /**
127
+ * Partition collection
128
+ *
129
+ * This could be done a little more efficiently through the use of limit and next
130
+ * commands, but we run the risk of utilizing more memory than we want to for large collections.
131
+ * In this method we split the collection up, not caring for density, so we might 'harvest'
132
+ * countless blank segments.
133
+ *
134
+ * @param Varien_Data_Collection $collection
135
+ * @return array<string>
136
+ */
137
+ public function partitionCollection($collection, $segmentSize = null)
138
+ {
139
+ $class = get_class($collection);
140
+ Springbot_Log::debug("Parititoning {$class} with select:");
141
+ Springbot_Log::debug((string) $collection->getSelect());
142
+
143
+ $idFieldName = $this->getIdFieldName($collection);
144
+ $sampleSize = self::getSampleSize();
145
+ $reverseSample = self::getReverseSample();
146
+
147
+ $size = is_null($segmentSize) ? $this->getSegmentSize() : $segmentSize;
148
+ $segments = array();
149
+
150
+ // If getting just a sample of each entity, get the $sampleSize most recent entities
151
+ if ($sampleSize && !$reverseSample) {
152
+ $maxEntities = $sampleSize;
153
+ }
154
+ else {
155
+ $maxEntities = null;
156
+ }
157
+
158
+ $lastId = $this->getLastCollectionId($collection);
159
+ $firstId = $this->getFirstCollectionId($collection);
160
+
161
+ Springbot_Log::debug("Partitioning collection from $firstId to $lastId");
162
+
163
+ if ($lastId) {
164
+ $blockCount = 0;
165
+ do {
166
+ $nextId = $this->_getLowestEntityId($collection, $idFieldName, $lastId, $size);
167
+
168
+ if($nextId < $firstId) {
169
+ $nextId = $firstId;
170
+ } else if (!$nextId) {
171
+ $nextId = 0;
172
+ }
173
+
174
+ $segments[] = new Springbot_Util_Partition($nextId, $lastId);
175
+ $lastId = $nextId;
176
+ $blockCount++;
177
+ if ($maxEntities && (($blockCount * $size) > $maxEntities)) break;
178
+ } while ($nextId > $firstId);
179
+ }
180
+
181
+ return $segments;
182
+ }
183
+
184
+ private function _getLowestEntityId($collection, $idFieldName, $lastId, $size)
185
+ {
186
+ $collection->clear();
187
+ $collection->getSelect()
188
+ ->reset(Zend_Db_Select::COLUMNS)
189
+ ->reset(Zend_Db_Select::WHERE)
190
+ ->reset(Zend_Db_Select::ORDER)
191
+ ->columns("$idFieldName")
192
+ ->order("{$idFieldName} DESC")
193
+ ->limit(1, $size);
194
+
195
+ $collection->addFieldToFilter($idFieldName, array(
196
+ 'lt' => $lastId
197
+ ));
198
+
199
+ $result = $collection->getFirstItem();
200
+ if ($result) {
201
+ return $result[$idFieldName];
202
+ }
203
+ else {
204
+ return 0;
205
+ }
206
+ }
207
+
208
+
209
+ public static function getSampleSize()
210
+ {
211
+ if ($sampleSize = Mage::getStoreConfig('springbot/config/sample_size')) {
212
+ return $sampleSize;
213
+ }
214
+ else {
215
+ return null;
216
+ }
217
+ }
218
+
219
+
220
+ public static function getReverseSample()
221
+ {
222
+ if ($reverseSample = Mage::getStoreConfig('springbot/config/reverse_sample')) {
223
+ return $reverseSample;
224
+ }
225
+ else {
226
+ return false;
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Forecast collection count
232
+ *
233
+ * @param Varien_Data_Collection $collection
234
+ * @param int $storeId
235
+ * @param string $label
236
+ * @param int $harvestId
237
+ */
238
+ public function forecast($collection, $storeId, $label, $harvestId = null)
239
+ {
240
+ try {
241
+ $size = $collection->getSize();
242
+ $message = "{$size} {$label} will be harvested from store : {$storeId}/{$this->getSpringbotStoreId($storeId)}";
243
+
244
+ Springbot_Log::harvest($message, true, $storeId);
245
+
246
+ if(!is_null($harvestId)) {
247
+ $this->reportHarvestCount(array(
248
+ 'store_id' => $this->getSpringbotStoreId($storeId),
249
+ 'type' => $label,
250
+ 'estimate' => $size,
251
+ ), $harvestId);
252
+ }
253
+
254
+ } catch (Exception $e) {
255
+ Springbot_Log::error($e->getMessage());
256
+ Springbot_Log::harvest("Unknown quantity of {$label} to harvest!");
257
+ }
258
+ }
259
+
260
+ /**
261
+ * Helper method to delete remote objects
262
+ *
263
+ * @param array $post
264
+ * @param string $method
265
+ */
266
+ public function deleteRemote(array $post, $method)
267
+ {
268
+ $serialized = json_encode($post);
269
+ $file = Mage::getModel('combine/file_io');
270
+ $file->write(sha1($serialized) . '.json', $serialized);
271
+
272
+ Springbot_Boss::scheduleJob(
273
+ 'post:json',
274
+ array(
275
+ 'n' => $file->getBaseFilename(),
276
+ 'm' => $method,
277
+ ), 0, 'listener'
278
+ );
279
+ }
280
+
281
+ public function reportHarvestCount($params, $id = null)
282
+ {
283
+ Springbot_Log::debug("Reporting harvest count for store_id => $id");
284
+
285
+ $api = Mage::getModel('combine/api');
286
+ $payload = $api->wrap('harvest_segments', array($params));
287
+ $id = is_null($id) ? $this->getHarvestId() : $id;
288
+
289
+ if(!is_null($id)) {
290
+ return $api->put("harvests/{$id}", $payload);
291
+ }
292
+ }
293
+
294
+
295
+ public function getStoreUrl($storeId)
296
+ {
297
+ $store = Mage::app()->getStore($storeId);
298
+ $url = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, true);
299
+
300
+ if($store->getStoreInUrl()) {
301
+ $url .= $store->getCode();
302
+ }
303
+
304
+ return preg_replace('/\/$/', '', $url);
305
+ }
306
+
307
+ public function getSpringbotStoreId($id)
308
+ {
309
+ $storeIDIndex = 'store_id_' . $id;
310
+ $botId = Mage::getStoreConfig('springbot/config/' . $storeIDIndex);
311
+
312
+ if(!isset($botId)) {
313
+ Springbot_Log::debug("Tried to find config for key : $storeIDIndex");
314
+ }
315
+ return $botId;
316
+ }
317
+
318
+ public function getStoresToHarvest()
319
+ {
320
+ $_stores = array();
321
+ foreach (Mage::app()->getWebsites() as $website) {
322
+ foreach ($website->getGroups() as $group) {
323
+ foreach ($group->getStores() as $store) {
324
+ if ($this->doHarvestStore($store->getStoreId())) {
325
+ $_stores[$store->getStoreId()] = $store;
326
+ }
327
+ }
328
+ }
329
+ }
330
+ ksort($_stores, SORT_NUMERIC);
331
+ return $_stores;
332
+ }
333
+
334
+ public function doHarvestStore($storeId)
335
+ {
336
+ $harvest = true;
337
+ if(!$this->_rulesBuilt) {
338
+ $this->_buildStoreRules();
339
+ }
340
+ if(isset($this->_defines)) {
341
+ $harvest = (in_array($storeId, $this->_defines));
342
+ }
343
+ if(isset($this->_ignores)) {
344
+ $harvest = !(in_array($storeId, $this->_ignores));
345
+ }
346
+ return $harvest;
347
+ }
348
+
349
+ public function isHarvestRunning()
350
+ {
351
+ $jobs = Mage::getModel('combine/cron_queue')->getCollection();
352
+
353
+ $jobs->addFieldToFilter('queue', array('neq' => 'listener'))
354
+ ->addFieldToFilter('attempts', 0);
355
+
356
+ if($jobs->getSize() > 0) {
357
+ return true;
358
+ } else {
359
+ return false;
360
+ }
361
+ }
362
+
363
+ public function truncateEngineLogs()
364
+ {
365
+ @file_put_contents(Mage::getBaseDir('log') . DS . Springbot_Log::LOGFILE, '');
366
+ @file_put_contents(Mage::getBaseDir('log') . DS . Springbot_Log::ERRFILE, '');
367
+ }
368
+
369
+ public function getHarvestId()
370
+ {
371
+ return $this->_harvestId;
372
+ }
373
+
374
+ public function setHarvestId($id)
375
+ {
376
+ $this->_harvestId = $id;
377
+ return $this;
378
+ }
379
+
380
+ protected function _buildStoreRules()
381
+ {
382
+ $ignores = Mage::getStoreConfig('springbot/config/ignore_store_list');
383
+ if(!empty($ignores)) {
384
+ Springbot_Log::harvest('Ignore stores : ' . $ignores);
385
+ $this->_ignores =explode(',', $ignores);
386
+ }
387
+
388
+ $defines = Mage::getStoreConfig('springbot/config/define_store_list');
389
+ if(!empty($defines)) {
390
+ Springbot_Log::harvest('Explicitly defined stores : ' . $defines);
391
+ $this->_defines = explode(',', $defines);
392
+ }
393
+
394
+ $this->_rulesBuilt = true;
395
+ }
396
+
397
+ protected function getSegmentSize()
398
+ {
399
+ $size = Mage::getStoreConfig('springbot/config/segment_size');
400
+ return $size ? $size : 100;
401
+ }
402
+ }
Springbot-1.5.2.2/Springbot/Combine/Helper/Marketplaces.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Helper_Marketplaces extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function fetch($keys, $obj = null, $origKey = null)
6
+ {
7
+ if(is_null($obj)) {
8
+ return null;
9
+ }
10
+ if(is_null($origKey)) {
11
+ $origKey = $keys;
12
+ }
13
+ if(!is_array($keys)) {
14
+ $keys = explode('->', $keys);
15
+ }
16
+
17
+ $key = array_shift($keys);
18
+
19
+ if(!isset($obj[$key])) {
20
+ throw new Exception("Missing required value for key {$origKey}", 422);
21
+ }
22
+
23
+ if(count($keys) > 0) {
24
+ return $this->fetch($keys, $obj[$key], $origKey);
25
+ } else {
26
+ return $obj[$key];
27
+ }
28
+ }
29
+
30
+ public function safeFetch($keys, $obj = null, $origKey = null)
31
+ {
32
+ try {
33
+ return $this->fetch($keys, $obj, $origKey);
34
+ } catch (Exception $e) {
35
+ return null;
36
+ }
37
+ }
38
+ }
Springbot-1.5.2.2/Springbot/Combine/Helper/Parser.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Helper_Parser extends Mage_Core_Helper_Abstract
4
+ {
5
+ protected $_transEmails;
6
+
7
+ public function getParentSkus($entityId)
8
+ {
9
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($entityId);
10
+
11
+ $parentCollection = Mage::getResourceModel('catalog/product_collection')
12
+ ->addFieldToFilter('entity_id', array('in' => $parentIds))
13
+ ->addAttributeToSelect('sku');
14
+ $parentSkusArray = $parentCollection->getColumnValues('sku');
15
+ $parentIdsArray = $parentCollection->getColumnValues('entity_id');
16
+
17
+ foreach ($parentSkusArray as $index => $sku) {
18
+ if (!$sku) {
19
+ $parentSkusArray[$index] = Springbot_Boss::NO_SKU_PREFIX . $parentIdsArray[$index];
20
+ }
21
+ }
22
+
23
+ return $parentSkusArray;
24
+ }
25
+
26
+ /**
27
+ * Get top level sku
28
+ *
29
+ * This aims to get the top level sku. The getSku method for the product
30
+ * model is overloaded providing the type instance version of the sku
31
+ * meaning that it gives the simple sku for configurable or grouped products
32
+ * we need to get the _data array directly and pass that sku up to ensure the
33
+ * parent sku.
34
+ *
35
+ * @param $product
36
+ * @return string
37
+ */
38
+ public function getTopLevelSku($product)
39
+ {
40
+ if($product instanceof Mage_Catalog_Model_Product) {
41
+ $data = $product->getData();
42
+ if (isset($data['sku']) && $data['sku']) {
43
+ return $data['sku'];
44
+ }
45
+ else {
46
+ return $this->_getSkuFailsafe($product);
47
+ }
48
+ }
49
+ }
50
+
51
+ protected function _getSkuFailsafe($product)
52
+ {
53
+ if ($sku = $product->getSku()) {
54
+ return $sku;
55
+ }
56
+ else {
57
+ return Springbot_Boss::NO_SKU_PREFIX . $product->getEntityId();
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Gets accessible sku, product is visible from frontend
63
+ *
64
+ * @param Mage_Sales_Model_Order_Item
65
+ * @return string
66
+ */
67
+ public function getAccessibleSkuFromSalesItem($item)
68
+ {
69
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
70
+ if($product) {
71
+ if(!$this->isAccessible($product)) {
72
+ Springbot_Log::debug('Product not visible - attempt to find parent');
73
+ $product = $this->getParentProductFromSalesItem($item);
74
+ }
75
+ return $this->getTopLevelSku($product);
76
+ }
77
+ }
78
+
79
+ public function isAccessible(Mage_Catalog_Model_Product $product)
80
+ {
81
+ return
82
+ !(
83
+ $product->getVisibility() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE ||
84
+ $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED
85
+ );
86
+ }
87
+
88
+ /**
89
+ * Uses config data to get parent product for purchased simple
90
+ *
91
+ * @param Mage_Sales_Model_Order_Item
92
+ * @return Mage_Catalog_Model_Product
93
+ */
94
+ public function getParentProductFromSalesItem($item)
95
+ {
96
+ $values = $item->getBuyRequest()->toArray();
97
+
98
+ if($type = $item->getOptionsByCode('product_type')) {
99
+ if($parentProductId = $type->getProductId()) {
100
+ $product = Mage::getModel('catalog/product')->load($parentProductId);
101
+ }
102
+ }
103
+ else if($item->hasParentItemId()) {
104
+ $product = $item->getParentItem()->getProduct();
105
+ }
106
+ else if (isset($values['super_product_config']) && ($values['super_product_config']['product_type'] == 'grouped')) {
107
+ $parentProductId = $values['super_product_config']['product_id'];
108
+ $product = Mage::getModel('catalog/product')->load($parentProductId);
109
+ }
110
+ else {
111
+ $product = $item->getProduct();
112
+ }
113
+ return $product;
114
+ }
115
+
116
+ public function getChildProductIds($product)
117
+ {
118
+ $ids = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($product->getId());
119
+ if(isset($ids[0]) && is_array($ids[0])) {
120
+ $ids = $ids[0];
121
+ }
122
+ return $ids;
123
+ }
124
+
125
+ public function getCustomAttributeNames($product)
126
+ {
127
+ return array_keys($this->getCustomAttributes($product));
128
+ }
129
+
130
+ public function getCustomAttributes($product, $len = -1)
131
+ {
132
+ $return = array();
133
+ $helper = Mage::helper('combine/attributes');
134
+ $attributes = $helper->getCustomAttributesBySet($product->getAttributeSetId());
135
+
136
+ foreach($attributes as $attribute) {
137
+ $code = $attribute->getAttributeCode();
138
+
139
+ if($attribute->usesSource()) {
140
+ try {
141
+ $value = $this->_getAttributeText($product, $code);
142
+ } catch (Mage_Eav $e) {
143
+ Springbot_Log::debug(print_r($e->getMessage(), true));
144
+ }
145
+ } else {
146
+ $value = $product->getData($code);
147
+ }
148
+
149
+ $return[$code] = $len > 0 ? substr($value, 0, $len) : $value;
150
+ }
151
+
152
+ return $return;
153
+ }
154
+
155
+ private function _getAttributeText($product, $attributeCode) {
156
+ $resource = $product->getResource();
157
+ if (is_object($resource)) {
158
+ $attribute = $resource->getAttribute($attributeCode);
159
+ if (is_object($attribute)) {
160
+ if(Mage::getModel($attribute->getSourceModel())) {
161
+ $source = $attribute->getSource();
162
+ if (is_object($source)) {
163
+ return $source->getOptionText($product->getData($attributeCode));
164
+ }
165
+ }
166
+ }
167
+ }
168
+ return null;
169
+ }
170
+
171
+ public function hasImage($product)
172
+ {
173
+ if($product instanceof Mage_Catalog_Model_Product) {
174
+ if(($image = $product->getImage()) && $this->_exists($image) ) {
175
+ return true;
176
+ } else if(($image = $product->getSmallImage()) && $this->_exists($image) ) {
177
+ return true;
178
+ } else if(($image = $product->getThumbnail()) && $this->_exists($image) ) {
179
+ return true;
180
+ } else if($product instanceof Mage_Catalog_Model_Product) {
181
+ if($gallery = $product->getMediaGalleryImages()) {
182
+ return $gallery->count() > 0;
183
+ }
184
+ }
185
+ }
186
+ return false;
187
+ }
188
+
189
+ public function getLandingUrl($product)
190
+ {
191
+ if($product instanceof Mage_Catalog_Model_Product) {
192
+ $linkType = Mage::getStoreConfig('springbot/advanced/product_url_type');
193
+ if ($linkType == 'id_path') {
194
+ $url = Mage::getUrl('catalog/product/view', array(
195
+ 'id' => $product->getId(),
196
+ '_store' => $product->getStoreId(),
197
+ ));
198
+ } else if ($linkType == 'in_store') {
199
+ $url = $product->getUrlInStore();
200
+ } else if ($uri = $product->getUrlPath() && $linkType == 'default') {
201
+ $url = Mage::helper('combine/harvest')->getStoreUrl($product->getStoreId()) . '/' . $product->getUrlPath();
202
+ } else {
203
+ $url = $product->getProductUrl(false);
204
+ }
205
+ // remove calling script from url (Mage logic ftw)
206
+ $url = preg_replace('/\/springbot.php\//', '/', $url);
207
+ }
208
+ return $url;
209
+ }
210
+
211
+ public function getImageUrl($product)
212
+ {
213
+ if($product instanceof Mage_Catalog_Model_Product) {
214
+ if((Mage::getStoreConfig('springbot/images/use_cached_images'))) {
215
+ $img = Mage::helper('catalog/image')->init($product, 'image');
216
+ if($size = Mage::getStoreConfig('springbot/images/pixel_width')) {
217
+ $img->resize($size);
218
+ }
219
+ return (string) $img;
220
+ }
221
+ else if(($image = $product->getImage()) && $this->_exists($image) ) {
222
+ // main
223
+ }
224
+ else if(($image = $product->getSmallImage()) && $this->_exists($image) ) {
225
+ // small
226
+ }
227
+ else if(($image = $product->getThumbnail()) && $this->_exists($image) ) {
228
+ // thumbnail
229
+ }
230
+ else if ($product->getMediaGalleryImages() && $product->getMediaGalleryImages()->getSize() > 0) {
231
+ // First item from gallery
232
+ return $product->getMediaGalleryImages()->getFirstItem()->getUrl();
233
+ }
234
+ else {
235
+ // if we get here, the image doesn't exist, return null
236
+ return null;
237
+ }
238
+
239
+ if(strpos($image, DS) !== 0) {
240
+ $image = DS . $image;
241
+ }
242
+ return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $image;
243
+ }
244
+ }
245
+
246
+ public function isTransactionalEmail($email)
247
+ {
248
+ return array_search($email, $this->_getTransEmails()) !== false;
249
+ }
250
+
251
+ protected function _exists($file, $type = Mage_Core_Model_Store::URL_TYPE_MEDIA)
252
+ {
253
+ $file = Mage::getBaseDir($type) . '/catalog/product/' . $file;
254
+ return file_exists($file);
255
+ }
256
+
257
+ protected function _getTransEmails()
258
+ {
259
+ if(!isset($this->_transEmails)) {
260
+ foreach(Mage::getStoreConfig('trans_email') as $k => $v) {
261
+ if(isset($v['email'])) { $this->_transEmails[] = $v['email']; }
262
+ }
263
+ }
264
+ return $this->_transEmails;
265
+ }
266
+
267
+ }
Springbot-1.5.2.2/Springbot/Combine/Helper/Redirect.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Helper_Redirect extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ public function insertRedirectIds($params, $ids = null)
7
+ {
8
+ if(is_null($ids)) {
9
+ $ids = $this->getRedirectIds();
10
+ } else if (is_string($ids)) {
11
+ $ids = $this->getRedirectIds($ids);
12
+ }
13
+
14
+ foreach($ids as $id) {
15
+ Springbot_Log::debug("Insert redirect_id : $id");
16
+ $redirect = Mage::getModel('combine/redirect');
17
+
18
+ $redirect->setData($params)
19
+ ->setRedirectId($id)
20
+ ->insertIgnore();
21
+ }
22
+ }
23
+
24
+ public function checkAllRedirectTables()
25
+ {
26
+ $resource = Mage::getSingleton('core/resource');
27
+ $tables = array(
28
+ $resource->getTableName('combine/redirect'),
29
+ $resource->getTableName('combine/redirect_order'),
30
+ );
31
+
32
+ foreach($tables as $table) {
33
+ if($this->checkTable($table)) {
34
+ return;
35
+ }
36
+ }
37
+ }
38
+
39
+ public function checkTable($table)
40
+ {
41
+ if(!Mage::getSingleton('core/resource')->getConnection('core_read')->showTableStatus($table)) {
42
+ Springbot_Log::error("{$table} table does not exist. Rerunning Springbot update 1.0.0.70->1.2.0.0.");
43
+ $setup = new Springbot_Combine_Model_Resource_Setup('combine_setup');
44
+ $setup->reinstallSetupScript('1.0.0.70', '1.2.0.0');
45
+ return true;
46
+ }
47
+ }
48
+
49
+ public function getRedirectIds($raw = null)
50
+ {
51
+ if(is_null($raw)) {
52
+ $raw = $this->getRawCookie();
53
+ }
54
+ $queue = explode($this->determineDelimiter($raw), trim($raw));
55
+ return $this->sanitizeMongo($queue);
56
+ }
57
+
58
+ public function getLastId()
59
+ {
60
+ $ids = $this->getRedirectIds();
61
+ if(count($ids)) {
62
+ return $ids[0];
63
+ }
64
+ }
65
+
66
+ public function sanitizeMongo($array)
67
+ {
68
+ $output = array();
69
+ foreach($array as $value) {
70
+ if(empty($value)) { continue; }
71
+ if(preg_match("/^[0-9a-fA-F]{24}$/", $value)) {
72
+ $output[] = $value;
73
+ } else {
74
+ $ip = Mage::helper('core/http')->getRemoteAddr();
75
+ Springbot_Log::error("{$value} attempted to pass as cookie param from {$ip}. Possible insertion attack.");
76
+ Springbot_Boss::setCookie(Springbot_Boss::COOKIE_NAME, '');
77
+ }
78
+ }
79
+ return $output;
80
+ }
81
+
82
+ public function encodeEscapeCookie($array)
83
+ {
84
+ return Mage::helper('combine')->escapeShell(implode('%7', $array));
85
+ }
86
+
87
+ public function getRedirectsByEmail($email, $dateLimit = null)
88
+ {
89
+ $collection = Mage::getModel('combine/redirect')
90
+ ->getCollection()
91
+ ->loadByEmail($email);
92
+ $collection->getSelect()->order('id ASC');
93
+
94
+ if (!is_null($dateLimit)) {
95
+ $collection->addFieldToFilter('created_at', array('to' => $dateLimit));
96
+ }
97
+
98
+ if($collection instanceof Varien_Data_Collection && $collection->getSize() > 0) {
99
+ return array_values($collection->getColumnValues('redirect_id'));
100
+ }
101
+ else {
102
+ return array();
103
+ }
104
+ }
105
+
106
+ public function getRedirectByOrderId($orderId)
107
+ {
108
+ $collection = Mage::getModel('combine/redirect')->getCollection()
109
+ ->joinOrderIds()
110
+ ->addFieldToFilter('order_id', $orderId)
111
+ ;
112
+ $collection->getSelect()->order('id DESC');
113
+ return $collection->getFirstItem();
114
+ }
115
+
116
+ public function getRawCookie()
117
+ {
118
+ return Mage::getModel('core/cookie')->get(Springbot_Boss::COOKIE_NAME);
119
+ }
120
+
121
+ public function hasRedirectId()
122
+ {
123
+ $raw = $this->getRawCookie();
124
+ return !empty($raw);
125
+ }
126
+
127
+ public function determineDelimiter($str)
128
+ {
129
+ if (substr_count($str,'%7') > 0) {
130
+ return '%7';
131
+ } else {
132
+ return '|';
133
+ }
134
+ }
135
+ }
Springbot-1.5.2.2/Springbot/Combine/Helper/Store.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Helper_Store extends Mage_Core_Helper_Abstract
4
+ {
5
+ protected $_storeId;
6
+
7
+ public function setStore($store)
8
+ {
9
+ if($store instanceof Mage_Core_Model_Store) {
10
+ $store = $store->getStoreId();
11
+ }
12
+ $this->_storeId = $store;
13
+ return $this;
14
+ }
15
+
16
+ public function getGuid()
17
+ {
18
+ return $this->getValue('springbot/config/store_guid_' . $this->_storeId);
19
+ }
20
+
21
+ public function getSpringbotStoreId()
22
+ {
23
+ return $this->getValue('springbot/config/store_id_' . $this->_storeId);
24
+ }
25
+
26
+ public function getAccountEmail()
27
+ {
28
+ return $this->getValue('springbot/config/account_email');
29
+ }
30
+
31
+ public function getValue($path)
32
+ {
33
+ return Mage::getStoreConfig($path, $this->getStoreId());
34
+ }
35
+
36
+ public function getStoreId()
37
+ {
38
+ return $this->_storeId;
39
+ }
40
+ }
Springbot-1.5.2.2/Springbot/Combine/Helper/Trackable.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Helper_Trackable extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ public function getTrackables()
7
+ {
8
+ $sbCookie = $this->getCookie();
9
+ return json_decode(base64_decode($sbCookie));
10
+ }
11
+
12
+ public function updateTrackables($order)
13
+ {
14
+ $quoteId = $order->getQuoteId();
15
+
16
+ foreach($this->getTrackablesForQuote($quoteId) as $trackable) {
17
+ $trackable->setOrderId($order->getId())
18
+ ->setCustomerId($order->getCustomerId())
19
+ ->save();
20
+ }
21
+ }
22
+
23
+ public function hasTrackables()
24
+ {
25
+ $sb = $this->getCookie();
26
+ return !empty($sb);
27
+ }
28
+
29
+ public function getCookie()
30
+ {
31
+ return Mage::getModel('core/cookie')->get(Springbot_Boss::SB_TRACKABLES_COOKIE);
32
+ }
33
+
34
+ public function getTrackablesHashByOrder($orderId)
35
+ {
36
+ $collection = $this->getTrackablesForQuote($order->getQuote->getId());
37
+ return $this->_buildHash($collection);
38
+ }
39
+
40
+ public function getTrackablesHashByQuote($quoteId)
41
+ {
42
+ $collection = $this->getTrackablesForQuote($quoteId);
43
+ return $this->_buildHash($collection);
44
+ }
45
+
46
+ public function getTrackablesForQuote($quoteId)
47
+ {
48
+ return Mage::getModel('combine/trackable')->getCollection()
49
+ ->addFieldToFilter('quote_id', $quoteId);
50
+ }
51
+
52
+ protected function _buildHash($collection)
53
+ {
54
+ $hash = new stdClass();
55
+ foreach ($collection as $item) {
56
+ $hash->{$item->getType()} = $item->getValue();
57
+ }
58
+ if (count((array) $hash) > 0) {
59
+ return $hash;
60
+ }
61
+ }
62
+
63
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Action.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Action extends Springbot_Combine_Model_Cron
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/action');
8
+ }
9
+
10
+ public function toAction()
11
+ {
12
+ $actionMethod = "_{$this->getType()}ToAction";
13
+ return $this->{$actionMethod}();
14
+ }
15
+
16
+ public function isValidView()
17
+ {
18
+ return ($this->getType() == 'view') && $this->hasSku();
19
+ }
20
+
21
+ protected function _viewToAction()
22
+ {
23
+ return array(
24
+ 'action' => $this->getType(),
25
+ 'page_url' => $this->getPageUrl(),
26
+ 'sku' => $this->getSku(),
27
+ 'visitor_ip' => $this->getVisitorIp(),
28
+ 'category_id' => $this->getCategoryId(),
29
+ 'store_id' => $this->getStoreId(),
30
+ 'quantity' => $this->getQuantity(),
31
+ 'datetime' => $this->getCreatedAt(),
32
+ );
33
+ }
34
+
35
+ protected function _atcToAction()
36
+ {
37
+ return array(
38
+ 'action' => $this->getType(),
39
+ 'sku' => $this->getSku(),
40
+ 'sku_fulfillment' => $this->getSkuFulfillment(),
41
+ 'quote_id' => $this->getQuoteId(),
42
+ 'category_id' => $this->getCategoryId(),
43
+ 'store_id' => $this->getStoreId(),
44
+ 'quantity' => $this->getQuantity(),
45
+ 'datetime' => $this->getCreatedAt(),
46
+ );
47
+ }
48
+
49
+ protected function _purchaseToAction()
50
+ {
51
+ return array(
52
+ 'action' => $this->getType(),
53
+ 'sku' => $this->getSku(),
54
+ 'sku_fulfillment' => $this->getSkuFulfillment(),
55
+ 'purchase_id' => $this->getPurchaseId(),
56
+ 'category_id' => $this->getCategoryId(),
57
+ 'store_id' => $this->getStoreId(),
58
+ 'quantity' => $this->getQuantity(),
59
+ 'datetime' => $this->getCreatedAt(),
60
+ );
61
+ }
62
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Api.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Api extends Varien_Object
4
+ {
5
+ const SUCCESSFUL_RESPONSE = 'ok';
6
+ const HTTP_CONTENT_TYPE = 'Content-type: application/json';
7
+ const TOTAL_POST_FAIL_LIMIT = 32;
8
+ const RETRY_LIMIT = 3;
9
+
10
+ protected $_securityToken;
11
+ protected $_client;
12
+ protected $_header;
13
+ protected $_url;
14
+ protected $_retries = 0;
15
+ protected $_requestStart;
16
+
17
+ public function wrap($model, $data)
18
+ {
19
+ $transport = new stdClass();
20
+ $transport->$model = $data;
21
+
22
+ return Zend_Json::encode($transport,
23
+ false,
24
+ array('enableJsonExprFinder' => true)
25
+ );
26
+ }
27
+
28
+ public function reinit()
29
+ {
30
+ $this->_retries = 0;
31
+ return $this;
32
+ }
33
+
34
+ public function get($method, $param = array(), $authenticate = true)
35
+ {
36
+ $url = $method . '?' . http_build_query($param);
37
+ return $this->call($url, false, $authenticate, Varien_Http_Client::GET);
38
+ }
39
+
40
+ public function put($method, $payload, $authenticate = true)
41
+ {
42
+ return $this->call($method, $payload, $authenticate, Varien_Http_Client::PUT);
43
+ }
44
+
45
+ public function call($method, $payload = false, $authenticate = true, $httpMethod = Varien_Http_Client::POST)
46
+ {
47
+ $result = array();
48
+ $client = $this->getClient($httpMethod);
49
+ $client->setUri($this->getApiUrl($method));
50
+ Springbot_Log::debug("Calling Springbot api method : $method | " . $client->getUri(true));
51
+
52
+ if($authenticate) {
53
+ $this->authenticate();
54
+ $client->setHeaders('X-AUTH-TOKEN:' . $this->_securityToken);
55
+ }
56
+
57
+ if($payload) {
58
+ $client->setRawData(utf8_encode($payload));
59
+ }
60
+
61
+ try {
62
+ // stop Zend_Http_Client from dumping to stream on error
63
+ ob_start();
64
+ $this->_startProfile();
65
+ $response = $client->request();
66
+ $this->_stopProfile();
67
+ ob_end_clean();
68
+
69
+ if($response->isSuccessful()) {
70
+ $result = json_decode($response->getBody(),true);
71
+ if ($result['status'] != self::SUCCESSFUL_RESPONSE) {
72
+ Springbot_Log::harvest($response->getBody());
73
+ }
74
+ }
75
+ Springbot_Log::http($payload);
76
+ } catch (Exception $e) {
77
+ Springbot_Log::error($e->getMessage());
78
+ $code = isset($result['status']) ? $result['status'] : 'null';
79
+ throw new Exception("$method call failed with code: $code");
80
+ }
81
+
82
+ return $result;
83
+ }
84
+
85
+
86
+ public function hasToken()
87
+ {
88
+ $token = Mage::getStoreConfig('springbot/config/security_token');
89
+ if($token) {
90
+ $this->_securityToken = $token;
91
+ }
92
+ return isset($this->_securityToken);
93
+ }
94
+
95
+ public function authenticate()
96
+ {
97
+ if(!$this->hasToken()) {
98
+ $credentials = $this->_getApiCredentials();
99
+ $result = $this->call('registration/login', $credentials, false);
100
+
101
+ if(!isset($result['token'])) {
102
+ throw new Exception('Token not available in api response. Please check springbot credentials.');
103
+ }
104
+
105
+ $this->_securityToken = $result['token'];
106
+ }
107
+ return;
108
+ }
109
+
110
+ public function getApiUrl($method = '')
111
+ {
112
+ if(!isset($this->_url)) {
113
+ $this->_url = Mage::getStoreConfig('springbot/config/api_url');
114
+ if(!$this->_url) {
115
+ $this->_url = 'https://api.springbot.com/';
116
+ }
117
+ $this->_url .= 'api/';
118
+ }
119
+ return $this->_url . $method;
120
+ }
121
+
122
+ public function getClient($method = Varien_Http_Client::POST)
123
+ {
124
+ $this->_client = new Zend_Http_Client();
125
+ $this->_client->setMethod($method);
126
+ $this->_client->setHeaders(self::HTTP_CONTENT_TYPE);
127
+ return $this->_client;
128
+ }
129
+
130
+ public function getLastStatus()
131
+ {
132
+ return $this->_responseCode;
133
+ }
134
+
135
+ protected function _getApiCredentials()
136
+ {
137
+ $post = array(
138
+ 'user_id' => $this->_getAccountEmail(),
139
+ 'password' => $this->_getAccountPassword(),
140
+ );
141
+ return json_encode($post);
142
+ }
143
+
144
+ protected function _getAccountEmail()
145
+ {
146
+ return Mage::getStoreConfig('springbot/config/account_email');
147
+ }
148
+
149
+ protected function _getAccountPassword()
150
+ {
151
+ $passwd = Mage::getStoreConfig('springbot/config/account_password');
152
+ return Mage::helper('core')->decrypt($passwd);
153
+ }
154
+
155
+ protected function _getSecurityToken()
156
+ {
157
+ $this->_securityToken = Mage::getStoreConfig('springbot/config/security_token');
158
+ return $this->_securityToken;
159
+ }
160
+
161
+ protected function _startProfile()
162
+ {
163
+ $this->_requestStart = Mage::helper('combine')->getMicroTime();
164
+ }
165
+
166
+ protected function _stopProfile()
167
+ {
168
+ $time = Mage::helper('combine')->getMicroTime() - $this->_requestStart;
169
+ Springbot_Log::debug("Request completed in $time sec");
170
+ }
171
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Cron.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Cron extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _validate()
6
+ {
7
+ return true;
8
+ }
9
+
10
+ public function insertIgnore()
11
+ {
12
+ try {
13
+ if($this->_validate()) {
14
+ $this->_getResource()->insertIgnore($this);
15
+ }
16
+ }
17
+ catch(Exception $e) {
18
+ $this->_getResource()->rollBack();
19
+ Springbot_Log::error($e->getMessage());
20
+ }
21
+ return $this;
22
+ }
23
+
24
+
25
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Count.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Cron_Count extends Springbot_Combine_Model_Cron
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/cron_count');
8
+ }
9
+
10
+ public function increaseCount($storeId, $harvestId, $entityType, $increment)
11
+ {
12
+ $collection = Mage::getModel('combine/cron_count')->getCollection();
13
+ $countResource = Mage::getResourceModel('combine/cron_count');
14
+
15
+ // Query to see if count already exists
16
+ $rowCount = $collection->addFieldToFilter('store_id', $storeId)
17
+ ->addFieldToFilter('harvest_id', $harvestId)
18
+ ->addFieldToFilter('entity', $entityType)
19
+ ->getSize();
20
+
21
+ // If it doesn't exist yet, create a new row
22
+ if($rowCount == 0) {
23
+ $countResource->createCountRow($storeId, $harvestId, $entityType, $increment);
24
+ }
25
+ else {
26
+ $countResource->increaseCountRow($storeId, $harvestId, $entityType, $increment);
27
+ }
28
+ }
29
+
30
+ public function getProcessedCount($storeId, $harvestId, $entityType)
31
+ {
32
+ $countRow = $this->_getEntityCountItem($storeId, $harvestId, $entityType);
33
+ if ($countRow) {
34
+ return $countRow->getCount();
35
+ }
36
+ else {
37
+ return 0;
38
+ }
39
+ }
40
+
41
+ public function getEntityStartTime($storeId, $harvestId, $entityType)
42
+ {
43
+ $countRow = $this->_getEntityCountItem($storeId, $harvestId, $entityType);
44
+ if ($countRow) {
45
+ return $countRow->getCreatedAt();
46
+ }
47
+ else {
48
+ return 0;
49
+ }
50
+ }
51
+
52
+ public function getEntityCompletedTime($storeId, $harvestId, $entityType)
53
+ {
54
+ $countRow = $this->_getEntityCountItem($storeId, $harvestId, $entityType);
55
+ if ($countRow) {
56
+ return $countRow->getCompleted();
57
+ }
58
+ else {
59
+ return 0;
60
+ }
61
+ }
62
+
63
+
64
+ private function _getEntityCountItem($storeId, $harvestId, $entityType)
65
+ {
66
+ $collection = Mage::getModel('combine/cron_count')->getCollection();
67
+ $countRow = $collection
68
+ ->addFieldToFilter('store_id', $storeId)
69
+ ->addFieldToFilter('harvest_id', $harvestId)
70
+ ->addFieldToFilter('entity', $entityType)
71
+ ->getFirstItem();
72
+ if ($countRow->hasCount()) {
73
+ return $countRow;
74
+ }
75
+ else {
76
+ return null;
77
+ }
78
+ }
79
+
80
+ public function setCompletedTime($storeId, $harvestId, $entityType)
81
+ {
82
+ $countResource = Mage::getResourceModel('combine/cron_count');
83
+ $countResource->setCompletedTime($storeId, $harvestId, $entityType);
84
+ }
85
+
86
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Manager/Status.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Cron_Manager_Status extends Varien_Object
4
+ {
5
+ const ACTIVE = 'active';
6
+ const INACTIVE = 'inactive';
7
+ const BLOCKER = 'springbot-work-mgr.block';
8
+
9
+ public function isActive()
10
+ {
11
+ if (is_readable('/proc')) {
12
+ $pid = $this->getPid();
13
+ return !empty($pid) && file_exists("/proc/$pid");
14
+ }
15
+ else {
16
+ $filename = Mage::getBaseDir('tmp') . DS . Springbot_Services_Work_Manager::WORKMANAGER_FILENAME;
17
+ if(file_exists($filename)) {
18
+ list($pid, $startTime) = explode('-', file_get_contents($filename));
19
+ return ((time() - $startTime) < Springbot_Services_Work_Manager::WORKER_TIMEOUT);
20
+ } else {
21
+ return false;
22
+ }
23
+ }
24
+ }
25
+
26
+ public function toggle()
27
+ {
28
+ if($this->isActive()) {
29
+ Springbot_Log::debug('Work manager active, halting');
30
+ $this->issueWorkBlocker();
31
+ $this->haltManager($this->getPid());
32
+ } else {
33
+ Springbot_Log::debug('Work manager inactive, starting');
34
+ $this->removeWorkBlocker();
35
+ Springbot_Boss::startWorkManager();
36
+ }
37
+ }
38
+
39
+ public function isBlocked()
40
+ {
41
+ return file_exists($this->_getBlockFile());
42
+ }
43
+
44
+
45
+ public function issueWorkBlocker()
46
+ {
47
+ file_put_contents($this->_getBlockFile(), '');
48
+ }
49
+
50
+ public function removeWorkBlocker()
51
+ {
52
+ if($this->isBlocked()) {
53
+ unlink($this->_getBlockFile());
54
+ }
55
+ }
56
+
57
+ public function getStatus()
58
+ {
59
+ return $this->isActive() ? self::ACTIVE : self::INACTIVE;
60
+ }
61
+
62
+ public function getRuntime()
63
+ {
64
+ $filename = $this->_getWorkmanagerFilename();
65
+ if(file_exists($filename)) {
66
+ return time() - filectime($filename);
67
+ }
68
+ }
69
+
70
+ public function getActiveWorkerPids()
71
+ {
72
+ $ids = array();
73
+ foreach($this->_getWorkerFiles() as $file) {
74
+ $matches = array();
75
+ preg_match('/\d+$/', $file, $matches);
76
+ if(isset($matches[0])) {
77
+ $ids[] = $matches[0];
78
+ }
79
+ }
80
+ return $ids;
81
+ }
82
+
83
+ public function getPid()
84
+ {
85
+ $filename = $this->_getWorkmanagerFilename();
86
+ if(file_exists($filename)) {
87
+ return file_get_contents($filename);
88
+ } else {
89
+ return null;
90
+ }
91
+ }
92
+
93
+ protected function _getBlockFile()
94
+ {
95
+ return Mage::getBaseDir('tmp') . DS . self::BLOCKER;
96
+ }
97
+
98
+ protected function _getWorkmanagerFilename()
99
+ {
100
+ return Mage::getBaseDir('tmp') . DS . Springbot_Services_Work_Manager::WORKMANAGER_FILENAME;
101
+ }
102
+
103
+ private function _getWorkerFiles()
104
+ {
105
+ return glob(Mage::getBaseDir('tmp') . DS . 'springbotworker*');
106
+ }
107
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Queue.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Cron_Queue extends Springbot_Combine_Model_Cron
4
+ {
5
+ const FAILED_JOB_PRIORITY = 9;
6
+
7
+ public function _construct()
8
+ {
9
+ $this->_init('combine/cron_queue');
10
+ }
11
+
12
+ public function save()
13
+ {
14
+ if($this->_validate()) {
15
+ return parent::save();
16
+ } else {
17
+ Springbot_Log::debug(__CLASS__." invalid, not saving!");
18
+ Springbot_Log::debug($this->getData());
19
+ }
20
+ }
21
+
22
+ protected function _validate()
23
+ {
24
+ return $this->hasMethod();
25
+ }
26
+
27
+ protected function _pre()
28
+ {
29
+ $this->addData(array(
30
+ 'attempts' => $this->getAttempts() + 1,
31
+ 'run_at' => now(),
32
+ 'locked_at' => now(),
33
+ 'locked_by' => getmypid(),
34
+ 'next_run_at' => $this->_calculateNextRunAt(),
35
+ 'error' => null
36
+ ));
37
+ $this->save();
38
+ }
39
+
40
+ public function run()
41
+ {
42
+ try {
43
+ $maxJobTime = Mage::getStoreConfig('springbot/advanced/max_job_time');
44
+ if (is_int($maxJobTime)) {
45
+ set_time_limit(Mage::getStoreConfig('springbot/advanced/max_job_time'));
46
+ }
47
+
48
+ $return = true;
49
+ $class = $this->getInstance();
50
+
51
+ if($class) {
52
+ $class->setData($this->getParsedArgs());
53
+ $this->_pre();
54
+ $class->run();
55
+ } else {
56
+ $this->delete();
57
+ }
58
+ }
59
+ catch (Exception $e) {
60
+ $this->setError($e->getMessage());
61
+ // Lower priority for failed job - keeping order intact
62
+ $this->setPriority($this->getPriority() + Springbot_Services::FAILED);
63
+ $return = false;
64
+ if ($this->getAttempts() >= Springbot_Combine_Model_Resource_Cron_Queue_Collection::ATTEMPT_LIMIT) {
65
+ Springbot_Log::remote(
66
+ "Job failed multiple times. Method: {$this->getMethod()}, Args: {$this->getArgs()}, Error: {$this->getError()}",
67
+ $this->getStoreId(),
68
+ self::FAILED_JOB_PRIORITY
69
+ );
70
+ }
71
+ }
72
+ $this->_post();
73
+
74
+ try {
75
+ Springbot_Log::debug("Scheduling future jobs");
76
+ Springbot_Boss::scheduleFutureJobs($class->getStoreId());
77
+
78
+ if (is_object($class)) {
79
+ $class->doFinally();
80
+ }
81
+ }
82
+ catch (Exception $e) {
83
+ Springbot_Log::error($e->getMessage());
84
+ }
85
+
86
+ return $return;
87
+ }
88
+
89
+ protected function _calculateNextRunAt()
90
+ {
91
+ $attempts = $this->getAttempts();
92
+ $expMinutes = pow(2, $attempts);
93
+ $nextRun = date("Y-m-d H:i:s", strtotime("+$expMinutes minutes"));
94
+
95
+ Springbot_Log::debug('Next run at: ' . $nextRun);
96
+ return $nextRun;
97
+ }
98
+
99
+ protected function _post()
100
+ {
101
+ if(!$this->hasError()) {
102
+ $this->delete();
103
+ }
104
+ else {
105
+ $this->addData(array(
106
+ 'locked_at' => null,
107
+ 'locked_by' => null,
108
+ ))->save();
109
+ }
110
+
111
+ }
112
+
113
+ public function getInstance()
114
+ {
115
+ return Springbot_Services_Registry::getInstance($this->getMethod());
116
+ }
117
+
118
+ public function getParsedArgs()
119
+ {
120
+ $args = (array) json_decode($this->getArgs());
121
+ return Springbot_Services_Registry::parseOpts($args);
122
+ }
123
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Queue/Batch.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Cron_Queue_Batch extends Varien_Object
4
+ {
5
+ protected $_stack = array();
6
+
7
+ public function schedule($method, $args, $priority, $queue = 'default', $storeId = null, $requiresAuth = true)
8
+ {
9
+ $this->push(array(
10
+ 'method' => $method,
11
+ 'args' => json_encode($args),
12
+ 'priority' => $priority,
13
+ 'command_hash' => sha1($method . json_encode($args)),
14
+ 'queue' => $queue,
15
+ 'store_id' => $storeId
16
+ ));
17
+ return $this;
18
+ }
19
+
20
+ public function insert()
21
+ {
22
+ if($rows = $this->_rowCount()) {
23
+ $sql = $this->toSql();
24
+ Springbot_Log::info("Inserting {$rows} rows into {$this->_getTablename()}");
25
+ $rows = $this->_getWriter()->query($sql);
26
+ }
27
+ }
28
+
29
+ public function push($args)
30
+ {
31
+ if($this->_isValid($args)) {
32
+ $row = $this->_getRowModel();
33
+ $row->setData($args);
34
+ $this->_stack[] = $row->toString();
35
+ }
36
+ return $this;
37
+ }
38
+
39
+ public function toSql()
40
+ {
41
+ $columns = $this->_getRowModel()->getColumnNames();
42
+ $table = $this->_getTablename();
43
+ $rows = $this->_rowsToSql();
44
+ return "INSERT IGNORE INTO {$table} ({$columns}) VALUES {$rows}";
45
+ }
46
+
47
+ protected function _isValid($args)
48
+ {
49
+ return isset($args['method']);
50
+ }
51
+
52
+ protected function _rowsToSql()
53
+ {
54
+ return implode(', ', $this->_stack);
55
+ }
56
+
57
+ protected function _rowCount()
58
+ {
59
+ return count($this->_stack);
60
+ }
61
+
62
+ protected function _getRowModel()
63
+ {
64
+ return Mage::getModel('combine/cron_queue_batch_row');
65
+ }
66
+
67
+ protected function _getTablename()
68
+ {
69
+ return Mage::getSingleton('core/resource')->getTableName('springbot_cron_queue');
70
+ }
71
+
72
+ protected function _getWriter()
73
+ {
74
+ return Mage::getSingleton('core/resource')->getConnection('core_write');
75
+ }
76
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Queue/Batch/Row.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Cron_Queue_Batch_Row extends Varien_Object
4
+ {
5
+ protected $_schema = array(
6
+ 'method',
7
+ 'args',
8
+ 'priority',
9
+ 'command_hash',
10
+ 'queue',
11
+ 'store_id',
12
+ );
13
+
14
+ public function getSchema()
15
+ {
16
+ return $this->_schema;
17
+ }
18
+
19
+ public function getColumnNames()
20
+ {
21
+ return '`' . implode('`,`', $this->getSchema()) . '`';
22
+ }
23
+
24
+ public function toString($format='')
25
+ {
26
+ $res = $this->_getResource();
27
+ $quoted = array();
28
+ foreach ($this->getSchema() as $column) {
29
+ $value = $this->getData($column);
30
+ $quoted[] = !empty($value) ? $res->quote($value) : 'NULL';
31
+ }
32
+ return '(' . implode(',', $quoted) . ')';
33
+ }
34
+
35
+ protected function _getResource()
36
+ {
37
+ return Mage::getSingleton('core/resource')->getConnection('core_write');
38
+ }
39
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Cron/Worker.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Cron_Worker extends Mage_Core_Model_Abstract
4
+ {
5
+ public function run($isForeman = true, $jobId = null)
6
+ {
7
+ Springbot_Log::debug("Starting worker for pid => " . getmypid());
8
+ try{
9
+ if($jobId) {
10
+ // Run only a specific job
11
+ $job = $this->getJob($jobId);
12
+ if($job->hasId()) {
13
+ $job->run();
14
+ }
15
+ }
16
+ else {
17
+ $count = 0;
18
+ $maxJobs = $this->getMaxJobs();
19
+ do {
20
+ if($job = $this->getNextJob($isForeman)) {
21
+ Springbot_Log::debug("Running job #$count for pid => " . getmypid());
22
+ $job->run();
23
+ $count++;
24
+ } else {
25
+ Springbot_Log::debug("No more jobs found");
26
+ }
27
+ } while ($job && ($count < $maxJobs));
28
+ }
29
+ } catch (Exception $e) {
30
+ Springbot_Log::error($e->getMessage());
31
+ }
32
+ }
33
+
34
+ public function cronRun()
35
+ {
36
+ if(Springbot_Boss::isCron()) {
37
+ $status = Mage::getModel('combine/cron_manager_status');
38
+ if(!($status->isBlocked() && $status->isActive())) {
39
+ $this->run(true);
40
+ }
41
+ }
42
+ }
43
+
44
+ public function getMaxJobs()
45
+ {
46
+ if (!$maxJobs = Mage::getStoreConfig('springbot/cron/max_jobs')) {
47
+ $maxJobs = 10;
48
+ }
49
+ return $maxJobs;
50
+ }
51
+
52
+ public function getBulkJobsToRun($queue)
53
+ {
54
+ return $this->_getCollection()->getPriorityJobs($this->getMaxJobs(), $queue);
55
+ }
56
+
57
+ public function getActiveCount()
58
+ {
59
+ return $this->_getCollection()->getActiveCount();
60
+ }
61
+
62
+ protected function _cleanup()
63
+ {
64
+ foreach($this->_getFailedJobs() as $job) {
65
+ Springbot_Log::debug("Removing failed job {$job->getMethod()}");
66
+ $job->delete();
67
+ }
68
+ }
69
+
70
+ protected function _getFailedJobs()
71
+ {
72
+ return $this->_getCollection()
73
+ ->addFieldToFilter('error', array('notnull' => true));
74
+ }
75
+
76
+ protected function _getCollection()
77
+ {
78
+ return Mage::getModel('combine/cron_queue')->getCollection();
79
+ }
80
+
81
+ public function getNextJob($isForeman)
82
+ {
83
+ return $this->_getCollection()->getNextJob($isForeman);
84
+ }
85
+
86
+ public function getJob($jobId)
87
+ {
88
+ return Mage::getModel('combine/cron_queue')->load($jobId);
89
+ }
90
+
91
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/File/Io.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_File_Io
4
+ {
5
+ const TRUNCATE = 'w';
6
+ const APPEND = 'a';
7
+ const READ = 'r';
8
+
9
+ protected $_filename;
10
+ protected $_resource;
11
+ protected $_mode;
12
+ protected $_path;
13
+
14
+ public function __destruct()
15
+ {
16
+ @fclose($this->_resource);
17
+ }
18
+
19
+ protected function _init($filename, $mode)
20
+ {
21
+ $this->setFilename($this->_getPath()->resolve($filename, 'tmp'));
22
+ $this->_setMode($mode);
23
+
24
+ if(empty($this->_filename)) {
25
+ throw new Exception('Filename required for I/O.');
26
+ }
27
+ $this->_openFile();
28
+ }
29
+
30
+ public function write($filename, $content)
31
+ {
32
+ $this->_init($filename, self::TRUNCATE);
33
+
34
+ if(fwrite($this->_getResource(), $content) === false) {
35
+ throw new Exception('Writing to file ' . $this->_filename . ' failed.');
36
+ }
37
+ }
38
+
39
+ public function read($filename)
40
+ {
41
+ $this->_init($filename, self::READ);
42
+
43
+ if(!($content = fread($this->_getResource(), $this->_getStreamLength()))) {
44
+ throw new Exception('Reading from file ' . $this->_filename . ' failed.');
45
+ }
46
+ return $content;
47
+ }
48
+
49
+ public function exists($filename)
50
+ {
51
+ $path = $this->_getPath()->resolve($filename, 'tmp');
52
+
53
+ return @file_exists($path);
54
+ }
55
+
56
+ public function delete()
57
+ {
58
+ @unlink($this->_filename);
59
+ }
60
+
61
+ public function getBaseFilename()
62
+ {
63
+ return basename($this->_filename);
64
+ }
65
+
66
+ public function getFilename()
67
+ {
68
+ return $this->_filename;
69
+ }
70
+
71
+ public function setFilename($filename)
72
+ {
73
+ $this->_filename = $filename;
74
+ return $this;
75
+ }
76
+
77
+ protected function _openFile()
78
+ {
79
+ if(empty($this->_filename)) {
80
+ throw new Exception('Filename required to open file.');
81
+ }
82
+
83
+ if(!file_exists($this->_filename) && $this->_doCreate()) {
84
+ $this->_createFile();
85
+ }
86
+
87
+ $this->_resource = $this->_getResource();
88
+
89
+ if(!$this->_resource) {
90
+ throw new Exception('Could not open file for reading.');
91
+ }
92
+
93
+ return $this;
94
+ }
95
+
96
+ protected function _createFile()
97
+ {
98
+ @file_put_contents($this->_filename, '');
99
+ @chmod($this->_filename, 0777);
100
+ if(!file_exists($this->_filename)) {
101
+ throw new Exception('Invalid filename.');
102
+ }
103
+ return $this;
104
+ }
105
+
106
+ protected function _getResource()
107
+ {
108
+ if(!isset($this->_resource)) {
109
+ $this->_resource = @fopen($this->_filename, $this->_getMode());
110
+ }
111
+ return $this->_resource;
112
+ }
113
+
114
+ protected function _getPath()
115
+ {
116
+ if(!isset($this->_path)) {
117
+ $this->_path = Mage::getModel('combine/file_path');
118
+ }
119
+ return $this->_path;
120
+ }
121
+
122
+ protected function _setMode($mode)
123
+ {
124
+ $this->_mode = $mode;
125
+ return $this;
126
+ }
127
+
128
+ protected function _getMode()
129
+ {
130
+ if(!isset($this->_mode)) {
131
+ throw new Exception('No mode set for I/O.');
132
+ }
133
+ return $this->_mode;
134
+ }
135
+
136
+ protected function _getStreamLength()
137
+ {
138
+ $filesize = @filesize($this->_filename);
139
+ return $filesize ? $filesize : 1024;
140
+ }
141
+
142
+ protected function _doCreate()
143
+ {
144
+ return $this->_getMode() != self::READ;
145
+ }
146
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/File/Path.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_File_Path
4
+ {
5
+ protected $_baseDir;
6
+ protected $_filename;
7
+ protected $_type;
8
+
9
+ public function getBaseDir($type = 'base')
10
+ {
11
+ if(isset($this->_type)) {
12
+ $type = $this->_type;
13
+ }
14
+ if(!isset($this->_baseDir)) {
15
+ $this->_baseDir = Mage::getBaseDir($type);
16
+ }
17
+ return $this->_baseDir;
18
+ }
19
+
20
+ public function setBaseDir($path)
21
+ {
22
+ $this->_baseDir = $path;
23
+ return $this;
24
+ }
25
+
26
+ public function setBaseDirType($type)
27
+ {
28
+ $this->_type = $type;
29
+ return $this;
30
+ }
31
+
32
+ public function setFilename($name)
33
+ {
34
+ $this->_filename = $name;
35
+ return $this;
36
+ }
37
+
38
+ public function getFilename()
39
+ {
40
+ return $this->_filename;
41
+ }
42
+
43
+ public function getAbsolutePath()
44
+ {
45
+ return $this->getBaseDir() . DS . $this->getFilename();
46
+ }
47
+
48
+ public function resolve($filename = null, $type = null)
49
+ {
50
+ $filename = is_null($filename) ? $this->_filename : $filename;
51
+ $type = is_null($type) ? $this->_type : $type;
52
+
53
+ if(!isset($filename)) {
54
+ throw new Exception('Filename required as property or argument.');
55
+ }
56
+ if(!isset($type)) {
57
+ throw new Exception('Directory type required.');
58
+ }
59
+
60
+ $this->setFilename($filename);
61
+
62
+ return $this->getBaseDir($type) . DS . $this->getFilename();
63
+ }
64
+
65
+ public function isWriteable($path = null)
66
+ {
67
+ if(is_null($path)) {
68
+ $path = $this->getBaseDir();
69
+ }
70
+ if(!file_exists($path)) {
71
+ throw new Exception('File or directory does not exist.');
72
+ }
73
+ return is_writable($path);
74
+ }
75
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Springbot_Combine_Model_Harvest
4
+ {
5
+ abstract public function getMageModel();
6
+ abstract public function getParserModel();
7
+ abstract public function getApiController();
8
+ abstract public function getApiModel();
9
+
10
+ private $_api;
11
+ private $_collection;
12
+ private $_model;
13
+ private $_total = 0;
14
+ private $_segmentQueue = array();
15
+ private $_segmentSize = 250;
16
+ private $_segmentMin = 0;
17
+ private $_segmentMax = 0;
18
+ private $_delete = false;
19
+ private $_storeId = null;
20
+ private $_dataSource;
21
+
22
+
23
+ public function __construct(Springbot_Combine_Model_Api $api, Varien_Data_Collection $collection, $dataSource)
24
+ {
25
+ $this->_api = $api;
26
+ $this->_collection = $collection;
27
+ $this->_dataSource = $dataSource;
28
+ }
29
+
30
+ /**
31
+ * Return the row name for the given
32
+ *
33
+ * @return string the name of the unique id column for the entity
34
+ */
35
+ public function getRowId()
36
+ {
37
+ return 'entity_id';
38
+ }
39
+
40
+ /**
41
+ * Iterate through all entities in the collection and call the step() method
42
+ * which will post the JSON entities to the API.
43
+ *
44
+ * @return Springbot_Combine_Model_Harvest
45
+ */
46
+ public function harvest()
47
+ {
48
+ //if ($this->getCollection()->getCount()) {
49
+ Mage::getSingleton('core/resource_iterator')->walk(
50
+ $this->getCollection()->getSelect(),
51
+ array(array($this, 'step'))
52
+ );
53
+
54
+ // Post leftover segment
55
+ $this->_total += count($this->_segmentQueue);
56
+ $this->postSegment();
57
+ //}
58
+
59
+ return $this;
60
+ }
61
+
62
+ /**
63
+ * Set delete param for all records
64
+ *
65
+ * @return Springbot_Combine_Model_Harvest
66
+ */
67
+ public function delete()
68
+ {
69
+ $this->_delete = true;
70
+ return $this->harvest();
71
+ }
72
+
73
+ /**
74
+ * Post single defined model
75
+ *
76
+ * We must post as a single element in array to handle downstream
77
+ * formatting concerns.
78
+ *
79
+ * @param Mage_Core_Model_Abstract $model
80
+ */
81
+ public function post($model)
82
+ {
83
+ $parsed = array($this->parse($model)->getData());
84
+ $payload = $this->getApi()->wrap($this->getApiModel(), $parsed);
85
+ $this->getApi()->reinit()->call($this->getApiController(), $payload);
86
+ }
87
+
88
+ /**
89
+ * Push a model onto the segment queue
90
+ *
91
+ * @param Mage_Core_Model_Abstract $model
92
+ * @return Springbot_Combine_Model_Harvest_Abstract
93
+ */
94
+ public function push(Mage_Core_Model_Abstract $model)
95
+ {
96
+ $this->_segmentQueue[] = $this->parse($model);
97
+ return $this;
98
+ }
99
+
100
+ /**
101
+ * Step callback referenced in harvester. Posts the segment (limited by the
102
+ * defined segment size)
103
+ *
104
+ * @param array $args
105
+ */
106
+ public function step($args)
107
+ {
108
+ if (count($this->_segmentQueue) >= $this->getSegmentSize()) {
109
+ $this->_total += $this->getSegmentSize();
110
+ echo "Posting segment\n";
111
+ $this->postSegment();
112
+ }
113
+
114
+ try {
115
+ if (isset($args['row'])) {
116
+ $id = $this->_getRowId($args['row']);
117
+ $model = $this->loadMageModel($id);
118
+ $this->_segmentQueue[] = $this->parse($model);
119
+ }
120
+ }
121
+ catch (Exception $e) {
122
+ Springbot_Log::error($e->getMessage());
123
+ }
124
+ }
125
+
126
+ /**
127
+ * Parse caller for dependent parser method
128
+ *
129
+ * @param Mage_Core_Model_Abstract $model
130
+ * @return Zend_Json_Expr
131
+ */
132
+ public function parse($model)
133
+ {
134
+ $parser = Mage::getModel($this->getParserModel(), $model);
135
+ if ($this->getStoreId()) {
136
+ $parser->setMageStoreId($this->getStoreId());
137
+ }
138
+ $parser->setDataSource($this->getDataSource());
139
+ if($this->_delete) {
140
+ $parser->setIsDeleted(true);
141
+ }
142
+
143
+ return $parser->getData();
144
+ }
145
+
146
+ /**
147
+ * Loads mage model to parse
148
+ *
149
+ * @param int $entityId
150
+ * @return Mage_Core_Model_Abstract
151
+ */
152
+ public function loadMageModel($entityId)
153
+ {
154
+ if(!isset($this->_model)) {
155
+ $this->_model = Mage::getModel($this->getMageModel());
156
+ }
157
+ return $this->_model->load($entityId);
158
+ }
159
+
160
+ /**
161
+ * Post segment to api
162
+ *
163
+ */
164
+ public function postSegment()
165
+ {
166
+ if (count($this->_segmentQueue) > 0) {
167
+ $payload = $this->getApi()->wrap($this->getApiModel(), $this->_segmentQueue);
168
+ $this->getApi()->reinit()->call($this->getApiController(), $payload);
169
+ $this->_segmentQueue = array();
170
+ }
171
+ }
172
+
173
+ /**
174
+ * Set the current store id
175
+ *
176
+ * @param int $id
177
+ */
178
+ public function setStoreId($id)
179
+ {
180
+ $this->_storeId = $id;
181
+ return $this;
182
+ }
183
+
184
+ public function getDataSource()
185
+ {
186
+ return $this->_dataSource;
187
+ }
188
+
189
+ public function setDelete($bool)
190
+ {
191
+ $this->_delete = $bool;
192
+ return $this;
193
+ }
194
+
195
+ public function getDelete()
196
+ {
197
+ return $this->_delete;
198
+ }
199
+
200
+ public function getHarvesterName()
201
+ {
202
+ return ucfirst($this->getHarvesterName());
203
+ }
204
+
205
+ public function getCollection()
206
+ {
207
+ return $this->_collection;
208
+ }
209
+
210
+ public function getProcessedCount()
211
+ {
212
+ return $this->_total;
213
+ }
214
+
215
+ public function getSegmentMin()
216
+ {
217
+ return $this->_segmentMin;
218
+ }
219
+
220
+ public function getSegmentMax()
221
+ {
222
+ return $this->_segmentMax;
223
+ }
224
+
225
+ public function getSegmentSize()
226
+ {
227
+ return $this->_segmentSize;
228
+ }
229
+
230
+ public function getApi()
231
+ {
232
+ return $this->_api;
233
+ }
234
+
235
+ public function getStoreId()
236
+ {
237
+ return $this->_storeId;
238
+ }
239
+
240
+ /**
241
+ * Gets row id based on class config
242
+ *
243
+ * @param array $row
244
+ * @return int
245
+ */
246
+ private function _getRowId($row)
247
+ {
248
+ $id = null;
249
+ if(isset($row[$this->getRowId()])) {
250
+ $id = $row[$this->getRowId()];
251
+ $this->_setSegmentMinMax($id);
252
+ }
253
+ return $id;
254
+ }
255
+
256
+ /**
257
+ * Set min/max for current segment
258
+ *
259
+ * @param int $id
260
+ */
261
+ private function _setSegmentMinMax($id)
262
+ {
263
+ if($id < $this->_segmentMin || !$this->_segmentMin) {
264
+ $this->_segmentMin = $id;
265
+ }
266
+ if($id > $this->_segmentMax) {
267
+ $this->_segmentMax = $id;
268
+ }
269
+ }
270
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/AttributeSets.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_AttributeSets extends Springbot_Combine_Model_Harvest
4
+ {
5
+ protected $_helper;
6
+
7
+
8
+ public function getMageModel()
9
+ {
10
+ return 'eav/entity_attribute_set';
11
+ }
12
+
13
+ public function getParserModel()
14
+ {
15
+ return 'combine/parser_attributeSet';
16
+ }
17
+
18
+ public function getApiController()
19
+ {
20
+ return 'attribute_sets';
21
+ }
22
+
23
+ public function getApiModel()
24
+ {
25
+ return 'attribute_sets';
26
+ }
27
+
28
+ public function getRowId()
29
+ {
30
+ return 'attribute_set_id';
31
+ }
32
+
33
+ /**
34
+ * Parse caller for dependent parser method
35
+ *
36
+ * @param Mage_Core_Model_Abstract $model
37
+ * @return Zend_Json_Expr
38
+ */
39
+ public function parse($model)
40
+ {
41
+ $parser = Mage::getModel($this->getParserModel(), $model);
42
+ $parser->setMageStoreId($this->getStoreId());
43
+ $parser->setStoreId($this->getStoreId());
44
+ $parser->parse();
45
+
46
+ if ($this->getDelete()) {
47
+ $parser->setIsDeleted(true);
48
+ }
49
+ return $parser->getData();
50
+ }
51
+
52
+ public function loadMageModel($id)
53
+ {
54
+ return $this->_getHelper()->getAttributeSetById($id);
55
+ }
56
+
57
+ protected function _getHelper()
58
+ {
59
+ if(!isset($this->_helper)) {
60
+ $this->_helper = Mage::helper('combine/attributes');
61
+ }
62
+ return $this->_helper;
63
+ }
64
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Carts.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_Carts extends Springbot_Combine_Model_Harvest
4
+ {
5
+ public function getMageModel()
6
+ {
7
+ return 'sales/quote';
8
+ }
9
+
10
+ public function getParserModel()
11
+ {
12
+ return 'combine/parser_quote';
13
+ }
14
+
15
+ public function getApiController()
16
+ {
17
+ return 'carts';
18
+ }
19
+
20
+ public function getApiModel()
21
+ {
22
+ return 'carts';
23
+ }
24
+
25
+
26
+ public function loadMageModel($entityId)
27
+ {
28
+ $model = Mage::getModel($this->getMageModel());
29
+ $model->setStoreId($this->getStoreId());
30
+ $model->load($entityId);
31
+ return $model;
32
+ }
33
+
34
+
35
+
36
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Categories.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_Categories extends Springbot_Combine_Model_Harvest
4
+ {
5
+
6
+ public function getMageModel()
7
+ {
8
+ return 'catalog/category';
9
+ }
10
+
11
+ public function getParserModel()
12
+ {
13
+ return 'combine/parser_category';
14
+ }
15
+
16
+ public function getApiController()
17
+ {
18
+ return 'categories';
19
+ }
20
+
21
+ public function getApiModel()
22
+ {
23
+ return 'categories';
24
+ }
25
+
26
+
27
+ public function loadMageModel($entityId)
28
+ {
29
+ $model = Mage::getModel($this->getMageModel());
30
+ $model->setStoreId($this->getStoreId());
31
+ $model->load($entityId);
32
+ return $model;
33
+ }
34
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Coupons.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_Coupons extends Springbot_Combine_Model_Harvest
4
+ {
5
+
6
+ public function getMageModel()
7
+ {
8
+ return 'salesrule/coupon';
9
+ }
10
+
11
+ public function getParserModel()
12
+ {
13
+ return 'combine/parser_coupon';
14
+ }
15
+
16
+ public function getApiController()
17
+ {
18
+ return 'coupons';
19
+ }
20
+
21
+ public function getApiModel()
22
+ {
23
+ return 'coupons';
24
+ }
25
+
26
+ public function getRowId()
27
+ {
28
+ return 'coupon_id';
29
+ }
30
+
31
+ public function loadMageModel($entityId)
32
+ {
33
+ $model = Mage::getModel($this->getMageModel());
34
+ $model->setStoreId($this->getStoreId());
35
+ $model->load($entityId);
36
+ return $model;
37
+ }
38
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/CustomerAttributeSets.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_CustomerAttributeSets extends Springbot_Combine_Model_Harvest
4
+ {
5
+ protected $_helper;
6
+
7
+ public function getMageModel()
8
+ {
9
+ return 'eav/entity_attribute_set';
10
+ }
11
+
12
+ public function getParserModel()
13
+ {
14
+ return 'combine/parser_customerAttributeSet';
15
+ }
16
+
17
+ public function getApiController()
18
+ {
19
+ return 'attribute_sets';
20
+ }
21
+
22
+ public function getApiModel()
23
+ {
24
+ return 'attribute_sets';
25
+ }
26
+
27
+ public function getRowId()
28
+ {
29
+ return 'attribute_set_id';
30
+ }
31
+
32
+ /**
33
+ * Parse caller for dependent parser method
34
+ *
35
+ * @param Mage_Core_Model_Abstract $model
36
+ * @return Zend_Json_Expr
37
+ */
38
+ public function parse($model)
39
+ {
40
+ $parser = Mage::getModel($this->getParserModel(), $model);
41
+ $parser->setMageStoreId($this->getStoreId());
42
+ $parser->setStoreId($this->getStoreId());
43
+ $parser->parse();
44
+
45
+ if ($this->getDelete()) {
46
+ $parser->setIsDeleted(true);
47
+ }
48
+ return $parser->getData();
49
+ }
50
+
51
+ public function loadMageModel($id)
52
+ {
53
+ return $this->_getHelper()->getAttributeSetById($id);
54
+ }
55
+
56
+ protected function _getHelper()
57
+ {
58
+ if(!isset($this->_helper)) {
59
+ $this->_helper = Mage::helper('combine/attributes');
60
+ }
61
+ return $this->_helper;
62
+ }
63
+
64
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Customers.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_Customers extends Springbot_Combine_Model_Harvest
4
+ {
5
+ public function getMageModel()
6
+ {
7
+ return 'customer/customer';
8
+ }
9
+
10
+ public function getParserModel()
11
+ {
12
+ return 'combine/parser_customer';
13
+ }
14
+
15
+ public function getApiController()
16
+ {
17
+ return 'customers';
18
+ }
19
+
20
+ public function getApiModel()
21
+ {
22
+ return 'customers';
23
+ }
24
+
25
+
26
+ public function loadMageModel($entityId)
27
+ {
28
+ $model = Mage::getModel('customer/customer');
29
+ return $model->load($entityId);
30
+ }
31
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Guests.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_Guests extends Springbot_Combine_Model_Harvest
4
+ {
5
+ public function getMageModel()
6
+ {
7
+ return 'sales/order';
8
+ }
9
+
10
+ public function getParserModel()
11
+ {
12
+ return 'combine/parser_guest';
13
+ }
14
+
15
+ public function getApiController()
16
+ {
17
+ return 'customers';
18
+ }
19
+
20
+ public function getApiModel()
21
+ {
22
+ return 'customers';
23
+ }
24
+
25
+ public function loadMageModel($entityId)
26
+ {
27
+ $model = Mage::getModel('sales/order');
28
+ return $model->load($entityId);
29
+ }
30
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Inventories.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_Inventories extends Springbot_Combine_Model_Harvest
4
+ {
5
+ protected $_segmentSize = 100;
6
+
7
+ public function getMageModel()
8
+ {
9
+ return 'cataloginventory/stock_item';
10
+ }
11
+
12
+ public function getParserModel()
13
+ {
14
+ return 'combine/parser_inventory';
15
+ }
16
+
17
+ public function getApiController()
18
+ {
19
+ return 'inventories';
20
+ }
21
+
22
+ public function getApiModel()
23
+ {
24
+ return 'inventories';
25
+ }
26
+
27
+ public function getRowId()
28
+ {
29
+ return 'item_id';
30
+ }
31
+
32
+ /**
33
+ * Parse caller for dependent parser method
34
+ *
35
+ * @param Mage_Core_Model_Abstract $model
36
+ * @return Zend_Json_Expr
37
+ */
38
+ public function parse($model)
39
+ {
40
+ $parser = Mage::getModel($this->getParserModel(), $model);
41
+ $parser->setMageStoreId($this->getStoreId());
42
+ $parser->parse();
43
+
44
+ if ($this->getDelete()) {
45
+ $parser->setIsDeleted(true);
46
+ }
47
+
48
+ return $parser->getData();
49
+ }
50
+
51
+ public function loadMageModel($entityId)
52
+ {
53
+ $model = Mage::getModel($this->getMageModel());
54
+ $model->load($entityId);
55
+ return $model;
56
+ }
57
+ }
58
+
59
+
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Products.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_Products extends Springbot_Combine_Model_Harvest
4
+ {
5
+ protected $_segmentSize = 100;
6
+
7
+ public function getMageModel()
8
+ {
9
+ return 'catalog/product';
10
+ }
11
+
12
+ public function getParserModel()
13
+ {
14
+ return 'combine/parser_product';
15
+ }
16
+
17
+ public function getApiController()
18
+ {
19
+ return 'products';
20
+ }
21
+
22
+ public function getApiModel()
23
+ {
24
+ return 'products';
25
+ }
26
+
27
+
28
+ public function loadMageModel($entityId)
29
+ {
30
+ $model = Mage::getModel($this->getMageModel());
31
+ $model->setStoreId($this->getStoreId());
32
+ $model->load($entityId);
33
+ return $model;
34
+ }
35
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Purchases.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_Purchases extends Springbot_Combine_Model_Harvest
4
+ {
5
+ protected $_segmentSize = 100;
6
+
7
+ public function getMageModel()
8
+ {
9
+ return 'sales/order';
10
+ }
11
+
12
+ public function getParserModel()
13
+ {
14
+ return 'combine/parser_purchase';
15
+ }
16
+
17
+ public function getApiController()
18
+ {
19
+ return 'purchases';
20
+ }
21
+
22
+ public function getApiModel()
23
+ {
24
+ return 'purchases';
25
+ }
26
+
27
+ public function loadMageModel($entityId)
28
+ {
29
+ $model = Mage::getModel($this->getMageModel());
30
+ return $model->load($entityId);
31
+ }
32
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Rules.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_Rules extends Springbot_Combine_Model_Harvest
4
+ {
5
+ public function getMageModel()
6
+ {
7
+ return 'salesrule/rule';
8
+ }
9
+
10
+ public function getParserModel()
11
+ {
12
+ return 'combine/parser_rule';
13
+ }
14
+
15
+ public function getApiController()
16
+ {
17
+ return 'promotions';
18
+ }
19
+
20
+ public function getApiModel()
21
+ {
22
+ return 'promotions';
23
+ }
24
+
25
+ public function getRowId()
26
+ {
27
+ return 'rule_id';
28
+ }
29
+
30
+ public function loadMageModel($entityId)
31
+ {
32
+ $model = Mage::getModel($this->getMageModel());
33
+ $model->setStoreId($this->getStoreId());
34
+ $model->load($entityId);
35
+ return $model;
36
+ }
37
+
38
+
39
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Harvest/Subscribers.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Harvest_Subscribers extends Springbot_Combine_Model_Harvest
4
+ {
5
+ public function getMageModel()
6
+ {
7
+ return 'newsletter/subscriber';
8
+ }
9
+
10
+ public function getParserModel()
11
+ {
12
+ return 'combine/parser_subscriber';
13
+ }
14
+
15
+ public function getApiController()
16
+ {
17
+ return 'customers';
18
+ }
19
+
20
+ public function getApiModel()
21
+ {
22
+ return 'customers';
23
+ }
24
+
25
+ public function getRowId()
26
+ {
27
+ return 'subscriber_id';
28
+ }
29
+
30
+ public function parse($model)
31
+ {
32
+ if ($this->getDelete()) {
33
+ $model->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED);
34
+ }
35
+ return parent::parse($model);
36
+ }
37
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Order/Builder.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Marketplaces_Order_Builder extends Varien_Object
4
+ {
5
+ protected $_data;
6
+ protected $_products;
7
+ protected $_customer;
8
+ protected $_storeId;
9
+ protected $_order;
10
+ protected $_mpOrder;
11
+
12
+ protected $_shippingMethod = 'sbShipping';
13
+ protected $_paymentMethod = 'sbPayment';
14
+ protected $_itemTotals;
15
+
16
+ public function __construct($data)
17
+ {
18
+ $this->_data = $data;
19
+ $this->_helper = Mage::helper('combine/marketplaces');
20
+ }
21
+
22
+ public function buildOrder($products, $customer)
23
+ {
24
+ $customer->cleanAllAddresses();
25
+
26
+ $this->_customer = $customer;
27
+ $this->_products = $products;
28
+
29
+ $this->_storeId = $customer->getStoreId();
30
+
31
+ $this->makeOrder()
32
+ ->setAddresses()
33
+ ->setPayment()
34
+ ->addProducts()
35
+ ->setTotals();
36
+
37
+ $this->makeMarketplaceOrder();
38
+
39
+ try {
40
+ $transaction = Mage::getModel('core/resource_transaction');
41
+
42
+ $transaction->addObject($this->_order)
43
+ ->addObject($this->_mpOrder)
44
+ ->addCommitCallback(array($this->_order, 'place'))
45
+ ->addCommitCallback(array($this->_order, 'save'))
46
+ ->save();
47
+ } catch (Zend_Db_Statement_Exception $e) {
48
+ throw new Exception("Order already exists for order with id {$this->_mpOrder->getRemoteOrderId()}", 409);
49
+ }
50
+
51
+ $this->_mpOrder->setOrderId($this->_order->getId())->save();
52
+
53
+ return $this->_order;
54
+ }
55
+
56
+ private function makeMarketplaceOrder()
57
+ {
58
+ Springbot_Log::debug("Making mp order for {$this->fetch('amazon_order_id')}");
59
+ $this->_mpOrder = Mage::getModel('combine/marketplaces_remote_order');
60
+ $this->_mpOrder->setData(array(
61
+ 'increment_id' => $this->_order->getIncrementId(),
62
+ 'remote_order_id' => $this->fetch('amazon_order_id'),
63
+ 'marketplace_type' => Springbot_Combine_Model_Marketplaces_OrderService::AMAZON
64
+ ));
65
+
66
+ Springbot_Log::debug($this->_mpOrder->getData());
67
+
68
+ return $this;
69
+ }
70
+
71
+ private function makeOrder()
72
+ {
73
+ $reservedOrderId = $this->reserveOrderId();
74
+
75
+ $currencyCode = $this->getCurrencyCode();
76
+
77
+ $this->_order = Mage::getModel('sales/order')
78
+ ->setIncrementId($reservedOrderId)
79
+ ->setStoreId($this->_customer->getStoreId())
80
+ ->setQuoteId(0)
81
+ ->setGlobalCurrencyCode($currencyCode)
82
+ ->setBaseCurrencyCode($currencyCode)
83
+ ->setStoreCurrencyCode($currencyCode)
84
+ ->setOrderCurrencyCode($currencyCode)
85
+ ;
86
+
87
+ $this->_order->setCustomerEmail($this->_customer->getEmail())
88
+ ->setCustomerFirstname($this->_customer->getFirstname())
89
+ ->setCustomerLastname($this->_customer->getLastname())
90
+ ->setCustomerGroupId($this->_customer->getGroupId())
91
+ ->setCustomerIsGuest(0)
92
+ ->setCustomer($this->_customer);
93
+
94
+ return $this;
95
+ }
96
+
97
+ private function setTotals()
98
+ {
99
+ $total = $this->fetch('order_total->Amount');
100
+ $subtotal = $this->getSubtotal();
101
+
102
+ Springbot_Log::debug($this->getItemTotals());
103
+
104
+ $this->_order->setSubtotal($subtotal)
105
+ ->setBaseSubtotal($subtotal)
106
+ ->setGrandTotal($total)
107
+ ->setBaseGrandTotal($total)
108
+ ->setTotalPaid($total)
109
+ ->setBaseTotalPaid($total)
110
+ ->setShippingAmount($this->getShipping())
111
+ ->setBaseShippingAmount($this->getShipping())
112
+ ->setShippingTaxAmount($this->getShippingTax())
113
+ ->setBaseShippingTaxAmount($this->getShippingTax())
114
+ ->setTaxAmount($this->getTax())
115
+ ->setBaseTaxAmount($this->getTax())
116
+ ;
117
+
118
+ return $this;
119
+ }
120
+
121
+ private function setAddresses()
122
+ {
123
+ $billing = $this->_customer->getDefaultBillingAddress();
124
+ $billingAddress = Mage::getModel('sales/order_address')
125
+ ->setStoreId($this->_storeId)
126
+ ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)
127
+ ->setCustomerId($this->_customer->getId())
128
+ ->setCustomerAddressId($this->_customer->getDefaultBilling())
129
+ ->setCustomerAddress_id($billing->getEntityId())
130
+ ->setPrefix($billing->getPrefix())
131
+ ->setFirstname($billing->getFirstname())
132
+ ->setMiddlename($billing->getMiddlename())
133
+ ->setLastname($billing->getLastname())
134
+ ->setSuffix($billing->getSuffix())
135
+ ->setCompany($billing->getCompany())
136
+ ->setStreet($billing->getStreet())
137
+ ->setCity($billing->getCity())
138
+ ->setCountry_id($billing->getCountryId())
139
+ ->setRegion($billing->getRegion())
140
+ ->setRegion_id($billing->getRegionId())
141
+ ->setPostcode($billing->getPostcode())
142
+ ->setTelephone($billing->getTelephone())
143
+ ->setFax($billing->getFax())
144
+ ->setVatId($billing->getVatId());
145
+ $this->_order->setBillingAddress($billingAddress);
146
+
147
+ $shipping = $this->_customer->getDefaultShippingAddress();
148
+ $shippingAddress = Mage::getModel('sales/order_address')
149
+ ->setStoreId($this->_storeId)
150
+ ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
151
+ ->setCustomerId($this->_customer->getId())
152
+ ->setCustomerAddressId($this->_customer->getDefaultShipping())
153
+ ->setCustomer_address_id($shipping->getEntityId())
154
+ ->setPrefix($shipping->getPrefix())
155
+ ->setFirstname($shipping->getFirstname())
156
+ ->setMiddlename($shipping->getMiddlename())
157
+ ->setLastname($shipping->getLastname())
158
+ ->setSuffix($shipping->getSuffix())
159
+ ->setCompany($shipping->getCompany())
160
+ ->setStreet($shipping->getStreet())
161
+ ->setCity($shipping->getCity())
162
+ ->setCountry_id($shipping->getCountryId())
163
+ ->setRegion($shipping->getRegion())
164
+ ->setRegion_id($shipping->getRegionId())
165
+ ->setPostcode($shipping->getPostcode())
166
+ ->setTelephone($shipping->getTelephone())
167
+ ->setFax($shipping->getFax())
168
+ ->setVatId($billing->getVatId());
169
+
170
+ $this->_order->setShippingAddress($shippingAddress)
171
+ ->setShippingMethod($this->_shippingMethod)
172
+ ->setShippingDescription($this->fetch('shipment_service_level_category'));
173
+
174
+ return $this;
175
+ }
176
+
177
+ private function setPayment()
178
+ {
179
+ $orderPayment = Mage::getModel('sales/order_payment')
180
+ ->setStoreId($this->_customer->getStoreId())
181
+ ->setCustomerPaymentId(0)
182
+ ->setMethod($this->_paymentMethod)
183
+ ->setPoNumber($this->safeFetch('purchase_order_number'));
184
+
185
+ $this->_order->setPayment($orderPayment);
186
+
187
+ return $this;
188
+ }
189
+
190
+ private function addProducts()
191
+ {
192
+ foreach ($this->_products as $product) {
193
+ $item = Mage::getModel('combine/marketplaces_order_item')->makeOrderItem($product, $this->_data);
194
+ $this->_order->addItem($item);
195
+ }
196
+ return $this;
197
+ }
198
+
199
+ private function getCurrencyCode()
200
+ {
201
+ if($value = $this->fetch('order_total->CurrencyCode')) {
202
+ return $value;
203
+ } else {
204
+ return Mage::app()->getBaseCurrencyCode();
205
+ }
206
+ }
207
+
208
+ private function reserveOrderId()
209
+ {
210
+ $transaction = Mage::getModel('core/resource_transaction');
211
+ return Mage::getSingleton('eav/config')
212
+ ->getEntityType('order')
213
+ ->fetchNewIncrementId($this->_storeId);
214
+ }
215
+
216
+ private function getSubtotal()
217
+ {
218
+ $itemTotals = $this->getItemTotals();
219
+ return $itemTotals['item_price'] + $itemTotals['tax'];
220
+ }
221
+
222
+ private function getShipping()
223
+ {
224
+ $itemTotals = $this->getItemTotals();
225
+ return $itemTotals['shipping'];
226
+ }
227
+
228
+ private function getShippingTax()
229
+ {
230
+ $itemTotals = $this->getItemTotals();
231
+ return $itemTotals['shipping_tax'];
232
+ }
233
+
234
+ private function getTax()
235
+ {
236
+ $itemTotals = $this->getItemTotals();
237
+ return $itemTotals['tax'];
238
+ }
239
+
240
+ private function getItemTotals()
241
+ {
242
+ if(!isset($this->_itemTotals)) {
243
+ $shipping = 0; $shippingTax = 0; $tax = 0; $itemPrice = 0;
244
+ foreach($this->fetch('order_items') as $item) {
245
+ $shipping += $this->_helper->safeFetch('shipping_price->Amount', $item);
246
+ $shippingTax += $this->_helper->safeFetch('shipping_tax->Amount', $item);
247
+ $tax += $this->_helper->safeFetch('item_tax->Amount', $item);
248
+ $itemPrice += $this->_helper->safeFetch('item_price->Amount', $item);
249
+ }
250
+ $this->_itemTotals = array(
251
+ 'shipping' => $shipping,
252
+ 'shipping_tax' => $shippingTax,
253
+ 'tax' => $tax,
254
+ 'item_price' => $itemPrice
255
+ );
256
+ Springbot_Log::debug($this->_itemTotals);
257
+ }
258
+ return $this->_itemTotals;
259
+ }
260
+
261
+ private function safeFetch($key)
262
+ {
263
+ return $this->_helper->safeFetch($key, $this->_data);
264
+ }
265
+
266
+ private function fetch($key)
267
+ {
268
+ return $this->_helper->fetch($key, $this->_data);
269
+ }
270
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Order/Customer.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Marketplaces_Order_Customer extends Varien_Object
4
+ {
5
+ protected $_data;
6
+ protected $_region;
7
+
8
+ public function __construct($data)
9
+ {
10
+ $this->_data = $data;
11
+ }
12
+
13
+ public function createCustomer()
14
+ {
15
+ if ($customer = $this->existingCustomer()) {
16
+ // nop
17
+ } else {
18
+ $password = Mage::helper('core')->getRandomString(6);
19
+
20
+ $customer = Mage::getModel('customer/customer')
21
+ ->setData('firstname', $this->getFirstname())
22
+ ->setData('lastname', $this->getLastname())
23
+ ->setData('website_id', 0)
24
+ ->setData('group_id', 0)
25
+ ->setData('email', $this->fetch('buyer_email'))
26
+ ->setData('confirmation', $password);
27
+
28
+ $customer->setPassword($password);
29
+ $customer->save();
30
+ }
31
+
32
+ $customerAddress = Mage::getModel('customer/address')
33
+ ->setFirstname($this->getFirstname())
34
+ ->setLastname($this->getLastname())
35
+ ->setCompany($this->getCompany())
36
+ ->setRegion($this->getRegion())
37
+ ->setRegionId($this->getRegionId())
38
+ ->setCountryId($this->safeFetch('shipping_address->CountryCode'))
39
+ ->setCity($this->safeFetch('shipping_address->City'))
40
+ ->setPostcode($this->safeFetch('shipping_address->PostalCode'))
41
+ ->setPhone($this->safeFetch('shipping_address->Phone'))
42
+ ->setStreet($this->getStreet())
43
+ ->setCustomer($customer)
44
+ ->setIsDefaultBilling(true)
45
+ ->setIsDefaultShipping(true);
46
+
47
+ $customerAddress->save();
48
+
49
+ $customer->setDefaultBilling($customerAddress->getEntityId())
50
+ ->setDefaultShipping($customerAddress->getEntityId());
51
+
52
+ $customer->save();
53
+
54
+ Springbot_Log::debug($customer->debug());
55
+
56
+ return $customer;
57
+ }
58
+
59
+ private function getCompany()
60
+ {
61
+ if($this->fetch('buyer_name') != $this->fetch('shipping_address->Name')) {
62
+ return $this->fetch('shipping_address->Name');
63
+ }
64
+ }
65
+
66
+ public function getFirstname()
67
+ {
68
+ return preg_replace('/\s.*$/', '', $this->fetch('buyer_name'));
69
+ }
70
+
71
+ public function getLastname()
72
+ {
73
+ return str_replace($this->getFirstname(), '', $this->fetch('buyer_name'));
74
+ }
75
+
76
+ private function getStreet()
77
+ {
78
+ return $this->fetch('shipping_address->AddressLine1')
79
+ . PHP_EOL . $this->safeFetch('shipping_address->AddressLine2')
80
+ . PHP_EOL . $this->safeFetch('shipping_address->AddressLine3');
81
+ }
82
+
83
+ private function getRegion()
84
+ {
85
+ if(!isset($this->_region)) {
86
+ $this->_region = Mage::getModel('directory/region')->loadByName(
87
+ $this->fetch('shipping_address->StateOrRegion'),
88
+ $this->fetch('shipping_address->CountryCode')
89
+ );
90
+
91
+ // If we can't load by region, fail over and try to load by code
92
+ if($this->_region->getId() == null) {
93
+ $this->_region = Mage::getModel('directory/region')->loadByCode(
94
+ $this->fetch('shipping_address->StateOrRegion'),
95
+ $this->fetch('shipping_address->CountryCode')
96
+ );
97
+ }
98
+ }
99
+ return $this->_region;
100
+ }
101
+
102
+ private function getRegionId()
103
+ {
104
+ if($region = $this->getRegion()) {
105
+ return $region->getId();
106
+ }
107
+ return null;
108
+ }
109
+
110
+ private function safeFetch($keys)
111
+ {
112
+ return Mage::helper('combine/marketplaces')->safeFetch($keys, $this->_data);
113
+ }
114
+
115
+ private function fetch($keys, $obj = null, $origKey = null)
116
+ {
117
+ if(is_null($obj)) {
118
+ $obj = $this->_data;
119
+ }
120
+ return Mage::helper('combine/marketplaces')->fetch($keys, $this->_data);
121
+ }
122
+
123
+ private function existingCustomer()
124
+ {
125
+ $customer = Mage::getModel('customer/customer');
126
+ $customer->setWebsiteId(0);
127
+ $customer->loadByEmail($this->fetch('buyer_email'));
128
+
129
+ if ($customer->getId()) {
130
+ return $customer;
131
+ } else {
132
+ return false;
133
+ }
134
+ }
135
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Order/Item.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Marketplaces_Order_Item
4
+ {
5
+ private $_product;
6
+ private $_data;
7
+
8
+ public function makeOrderItem($product)
9
+ {
10
+ $this->_product = $product['product'];
11
+ $this->_data = $product['data'];
12
+
13
+ $this->setOptions();
14
+
15
+ return $this->buildItem();
16
+ }
17
+
18
+ private function buildItem()
19
+ {
20
+ $product = $this->_product;
21
+ $options = $product->getTypeInstance(true)->getOrderOptions($product);
22
+
23
+ $qty = $this->fetch('quantity_ordered');
24
+ $tax = $this->fetch('item_tax->Amount');
25
+ $itemPrice = floatval($this->fetch('item_price->Amount'));
26
+
27
+ if ($qty == 0) {
28
+ throw new Exception("No quantity provided for product with sku: {$this->_product()->getSku()}");
29
+ }
30
+
31
+ $price = $itemPrice / $qty;
32
+ $rowTotal = $itemPrice + $tax;
33
+
34
+ $orderItem = Mage::getModel('sales/order_item')
35
+ ->setStoreId(0)
36
+ ->setQuoteItemId(0)
37
+ ->setQuoteParentItemId(NULL)
38
+ ->setProductId($product->getId())
39
+ ->setProductType($product->getTypeId())
40
+ ->setQtyBackordered(NULL)
41
+ ->setTotalQtyOrdered($qty)
42
+ ->setQtyOrdered($qty)
43
+ ->setName($product->getName())
44
+ ->setSku($product->getSku())
45
+ ->setPrice($price)
46
+ ->setBasePrice($price)
47
+ ->setTax($tax)
48
+ ->setBaseTax($tax)
49
+ ->setOriginalPrice($rowTotal)
50
+ ->setRowTotal($rowTotal)
51
+ ->setBaseRowTotal($rowTotal)
52
+
53
+ ->setWeeeTaxApplied(serialize(array()))
54
+ ->setBaseWeeeTaxDisposition(0)
55
+ ->setWeeeTaxDisposition(0)
56
+ ->setBaseWeeeTaxRowDisposition(0)
57
+ ->setWeeeTaxRowDisposition(0)
58
+ ->setBaseWeeeTaxAppliedAmount(0)
59
+ ->setBaseWeeeTaxAppliedRowAmount(0)
60
+ ->setWeeeTaxAppliedAmount(0)
61
+ ->setWeeeTaxAppliedRowAmount(0)
62
+
63
+ ->setProductOptions($options);
64
+
65
+ return $orderItem;
66
+ }
67
+
68
+ private function setOptions()
69
+ {
70
+ $options = $this->_product->getCustomOptions();
71
+
72
+ $optionsByCode = array();
73
+
74
+ foreach ($options as $option)
75
+ {
76
+ $quoteOption = Mage::getModel('sales/quote_item_option')->setData($option->getData())
77
+ ->setProduct($option->getProduct());
78
+
79
+ $optionsByCode[$quoteOption->getCode()] = $quoteOption;
80
+ }
81
+
82
+ $this->_product->setCustomOptions($optionsByCode);
83
+
84
+ return $this;
85
+ }
86
+
87
+ private function fetch($keys)
88
+ {
89
+ return Mage::helper('combine/marketplaces')->fetch($keys, $this->_data);
90
+ }
91
+ }
92
+
Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Order/Parser.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Marketplaces_Order_Parser extends Varien_Object
4
+ {
5
+ protected $_data;
6
+
7
+ public function __construct($data)
8
+ {
9
+ $this->_data = $data;
10
+ }
11
+
12
+ public function loadProducts()
13
+ {
14
+ $products = array();
15
+
16
+ foreach($this->fetch('order_items') as $item) {
17
+ $id = $this->fetch('product_id', $item);
18
+ $product = Mage::getModel('catalog/product')->load($id);
19
+
20
+ if(is_null($product->getId())) {
21
+ throw new Exception("Could not find product where id = {$id}", 409);
22
+ }
23
+
24
+ $products[] = array(
25
+ 'data' => $item,
26
+ 'product' => $product
27
+ );
28
+ }
29
+
30
+ return $products;
31
+ }
32
+
33
+ private function fetch($keys, $obj = null, $origKey = null)
34
+ {
35
+ if(is_null($obj)) {
36
+ $obj = $this->_data;
37
+ }
38
+
39
+ return Mage::helper('combine/marketplaces')->fetch($keys, $obj);
40
+ }
41
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/OrderService.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Marketplaces_OrderService
4
+ {
5
+ const AMAZON = 'amz';
6
+
7
+ protected $_data;
8
+
9
+ public function __construct($data)
10
+ {
11
+ $this->_data = $data;
12
+ }
13
+
14
+ public function createOrder()
15
+ {
16
+ $products = $this->loadProducts();
17
+
18
+ $customer = $this->createCustomer();
19
+
20
+ $builder = $this->getOrderBuilder();
21
+
22
+ $order = $builder->buildOrder($products, $customer);
23
+
24
+ return Mage::getModel('combine/parser_purchase', $order)->parse();
25
+ }
26
+
27
+ public function loadProducts()
28
+ {
29
+ return Mage::getModel('combine/marketplaces_order_parser', $this->_data)->loadProducts();
30
+ }
31
+
32
+ public function createCustomer()
33
+ {
34
+ return Mage::getModel('combine/marketplaces_order_customer', $this->_data)->createCustomer();
35
+ }
36
+
37
+ public function getOrderBuilder()
38
+ {
39
+ return Mage::getModel('combine/marketplaces_order_builder', $this->_data);
40
+ }
41
+ }
42
+
43
+
Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Payment.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Marketplaces_Payment extends Mage_Payment_Model_Method_Abstract
4
+ {
5
+ protected $_code = 'sbPayment';
6
+
7
+ protected $_canUseCheckout = false;
8
+ protected $_canUseInternal = false;
9
+ protected $_canUseForMultishipping = false;
10
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Remote/Order.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Marketplaces_Remote_Order extends Springbot_Combine_Model_Cron
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/marketplaces_remote_order');
8
+ }
9
+
10
+ public function findByIncrementId($id)
11
+ {
12
+ $instance = $this->getCollection()->addFieldToFilter('increment_id', $id)->getFirstItem();
13
+
14
+ # Return null if we get a blank object
15
+ return $instance->getId() == null ? null : $instance;
16
+ }
17
+
18
+ public function getHumanMarketplaceType()
19
+ {
20
+ if($this->getMarketplaceType() == 'amz') {
21
+ return 'Amazon';
22
+ }
23
+ }
24
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Marketplaces/Shipping.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Marketplaces_Shipping
4
+ extends Mage_Shipping_Model_Carrier_Abstract
5
+ implements Mage_Shipping_Model_Carrier_Interface
6
+ {
7
+ protected $_code = 'sbShipping';
8
+
9
+ public function getAllowedMethods()
10
+ {
11
+ return array($this->_code => $this->getConfigData('name'));
12
+ }
13
+
14
+ public function isTrackingAvailable()
15
+ {
16
+ return false;
17
+ }
18
+
19
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
20
+ {
21
+ return Mage::getModel('shipping/rate_result');
22
+ }
23
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Action.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Action extends Springbot_Combine_Model_Resource_Cron_Events
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Action/Collection.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Action_Collection extends Springbot_Combine_Model_Resource_Action_Collection
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Cron/Count.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Cron_Count extends Springbot_Combine_Model_Resource_Cron_Count
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Cron/Queue.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Cron_Queue extends Springbot_Combine_Model_Resource_Cron_Queue
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Cron/Queue/Collection.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Cron_Queue_Collection extends Springbot_Combine_Model_Resource_Cron_Queue_Collection
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Redirect.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Redirect extends Springbot_Combine_Model_Resource_Redirect
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Redirect/Collection.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Redirect_Collection extends Springbot_Combine_Model_Resource_Redirect_Collection
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Redirect/Order.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Redirect_Order extends Springbot_Combine_Model_Resource_Redirect_Order
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Redirect/Order/Collection.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Redirect_Order_Collection extends Springbot_Combine_Model_Resource_Redirect_Order_Collection
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Setup extends Springbot_Combine_Model_Resource_Setup
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Trackable.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Trackable extends Springbot_Combine_Model_Resource_Trackable
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Mysql4/Trackable/Collection.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Mysql4_Trackable_Collection extends Springbot_Combine_Model_Resource_Trackable_Collection
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Springbot_Combine_Model_Parser extends Varien_Object
4
+ {
5
+ protected $_parsed = false;
6
+ protected $_attrProtected = array();
7
+ protected $_storeId;
8
+
9
+ /*
10
+ * Public accessor for parse method
11
+ */
12
+ public function parse()
13
+ {
14
+ $this->_parse();
15
+ return $this;
16
+ }
17
+
18
+ /**
19
+ * Redeclaration of Varien_Object::toJson
20
+ *
21
+ * @array $attributes array of attributes to include
22
+ * @return string
23
+ */
24
+ public function toJson(array $arrAttributes = array())
25
+ {
26
+ if(!$this->isParsed()) {
27
+ $this->_parse();
28
+ }
29
+ //$this->prune();
30
+ return parent::toJson($arrAttributes);
31
+ }
32
+
33
+ public function reinit()
34
+ {
35
+ unset($this->_storeId);
36
+ }
37
+
38
+ public function prune()
39
+ {
40
+ $this->_data = $this->_prune($this->_data);
41
+ return $this;
42
+ }
43
+
44
+ protected function _prune($array)
45
+ {
46
+ if(is_array($array)) {
47
+ foreach($array as $key => $value) {
48
+ if(is_array($value)) {
49
+ $array[$key] = $this->_prune($value);
50
+ }
51
+ if(empty($value)) {
52
+ unset($array[$key]);
53
+ } else if(is_string($value)) {
54
+ $array[$key] = trim($array[$key]);
55
+ }
56
+ }
57
+ }
58
+ return $array;
59
+ }
60
+
61
+ public function getCustomAttributes()
62
+ {
63
+ $return = array();
64
+ $helper = Mage::helper('combine/attributes');
65
+ $model = $this->_getAccessor();
66
+ $attributes = $helper->getAttributesBySet($model->getAttributeSetId());
67
+
68
+ foreach($attributes as $attribute) {
69
+ $code = $attribute->getAttributeCode();
70
+
71
+ if(!$this->_isProtected($code) && $model->hasData($code)) {
72
+ if($attribute->usesSource()) {
73
+ $value = $helper->getOptionText($attribute, $model->getData($code));
74
+ } else {
75
+ $value = $model->getData($code);
76
+ }
77
+
78
+ $return[$code] = $value;
79
+ }
80
+ }
81
+
82
+ return $return;
83
+ }
84
+
85
+ public function setIsParsed()
86
+ {
87
+ $this->_parsed = true;
88
+ return $this;
89
+ }
90
+
91
+ public function isParsed()
92
+ {
93
+ return $this->_parsed;
94
+ }
95
+
96
+ public function getAccessibleSku($item)
97
+ {
98
+ if($product = $item->getProduct()) {
99
+ if(
100
+ $product->getVisibility() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE ||
101
+ $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED
102
+ ) {
103
+ Springbot_Log::debug('Product not visible - attempt to find parent');
104
+ $product = $this->getParentProduct($item);
105
+ }
106
+ return $this->_getHelper()->getTopLevelSku($product);
107
+ }
108
+ }
109
+
110
+ protected function _getLandingUrl($product)
111
+ {
112
+ return $this->_getHelper()->getLandingUrl($product);
113
+ }
114
+
115
+ protected function _getHelper()
116
+ {
117
+ return Mage::helper('combine/parser');
118
+ }
119
+
120
+ protected function _parse()
121
+ {
122
+ return $this->setIsParsed();
123
+ }
124
+
125
+ protected function _formatDateTime($date)
126
+ {
127
+ if(!is_null($date)) {
128
+ $_date = new DateTime($date, new DateTimeZone('UTC'));
129
+ return $_date->format(DateTime::ATOM);
130
+ }
131
+ }
132
+
133
+ protected function _getAccessor()
134
+ {
135
+ if(!isset($this->_accessor)) {
136
+ throw new Exception('Please set _accessor in Class ' . __CLASS__);
137
+ }
138
+ return $this->{$this->_accessor};
139
+ }
140
+
141
+ public function getMageStoreId()
142
+ {
143
+ if(!isset($this->_storeId)) {
144
+ $this->_storeId = $this->_getAccessor()->getStoreId();
145
+ }
146
+ return $this->_storeId;
147
+ }
148
+
149
+ public function setMageStoreId($storeId)
150
+ {
151
+ $this->_storeId = $storeId;
152
+ return $this;
153
+ }
154
+
155
+ public function getSpringbotStoreId()
156
+ {
157
+ return $this->_getSpringbotStoreId($this->getMageStoreId());
158
+ }
159
+
160
+ protected function _getSpringbotStoreId($id)
161
+ {
162
+ return Mage::helper('combine/harvest')->getSpringbotStoreId($id);
163
+ }
164
+
165
+ protected function _isProtected($attrCode)
166
+ {
167
+ return in_array($attrCode, $this->_attrProtected);
168
+ }
169
+
170
+ protected function _getBaseAmt($field, $model = null)
171
+ {
172
+ if(is_null($model)) {
173
+ $model = $this->_getAccessor();
174
+ }
175
+ return ($amt = $model->getData("base_{$field}")) ? $amt : $model->getData($field);
176
+ }
177
+
178
+ protected function _getSkuFailsafe($product)
179
+ {
180
+ // Use array accessor here because getSku method
181
+ // use the type instance's sku (i.e. the child sku)
182
+ if ($sku = $product['sku']) {
183
+ return $sku;
184
+ }
185
+ else {
186
+ return Springbot_Boss::NO_SKU_PREFIX .$product->getEntityId();
187
+ }
188
+ }
189
+
190
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/AttributeSet.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_AttributeSet extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_helper;
6
+ protected $_set;
7
+ protected $_storeId;
8
+ protected $_accessor = '_set';
9
+ protected $_type = 'product';
10
+
11
+ public function __construct(Mage_Eav_Model_Entity_Attribute_Set $set)
12
+ {
13
+ $this->_set = $set;
14
+ $this->_parse();
15
+ }
16
+
17
+ protected function _parse()
18
+ {
19
+ $this->_data = array(
20
+ 'store_id' => $this->getSpringbotStoreId(),
21
+ 'attribute_set_id' => $this->_set->getAttributeSetId(),
22
+ 'name' => $this->_set->getAttributeSetName(),
23
+ 'type' => $this->_type,
24
+ 'attribute_items' => $this->_parseAttributes(),
25
+ );
26
+
27
+ return parent::_parse();
28
+ }
29
+
30
+ protected function _parseAttributes()
31
+ {
32
+ return Mage::helper('combine/attributes')->getParsedAttributesBySet($this->_set);
33
+ }
34
+
35
+ protected function _getHelper()
36
+ {
37
+ if(!isset($this->_helper)) {
38
+ $this->_helper = Mage::helper('combine/attributes');
39
+ }
40
+ return $this->_helper;
41
+ }
42
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Category.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Category extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_accessor = '_category';
6
+ protected $_category;
7
+ protected $_storeId;
8
+
9
+ public function __construct(Mage_Catalog_Model_Category $category)
10
+ {
11
+ $this->_category = $category;
12
+ $this->_parse();
13
+ }
14
+
15
+ protected function _parse()
16
+ {
17
+ $this->setData(array(
18
+ 'cat_id' => $this->_category->getEntityId(),
19
+ 'path' => $this->_category->getPath(),
20
+ 'level' => $this->_category->getLevel(),
21
+ 'store_id' => $this->getSpringbotStoreId(),
22
+ 'cat_name' => $this->_category->getName(),
23
+ 'deleted' => $this->_category->getDeleted(),
24
+ 'json_data' => array(
25
+ 'url_path' => $this->_category->getUrlPath(),
26
+ 'is_active' => $this->_category->getIsActive(),
27
+ )
28
+ ));
29
+ return parent::_parse();
30
+ }
31
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Coupon.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Coupon extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_coupon;
6
+ protected $_accessor = '_coupon';
7
+
8
+ public function __construct(Mage_SalesRule_Model_Coupon $coupon)
9
+ {
10
+ $this->_coupon = $coupon;
11
+ $this->_parse();
12
+ }
13
+
14
+ protected function _parse()
15
+ {
16
+ $this->setData(array(
17
+ 'coupon_id' => $this->_coupon->getCouponId(),
18
+ 'store_id' => Mage::helper('combine/harvest')->getSpringbotStoreId($this->_coupon->getStoreId()),
19
+ 'rule_id' => $this->_coupon->getRuleId(),
20
+ 'code' => $this->_coupon->getCode(),
21
+ 'usage_limit' => $this->_coupon->getUsageLimit(),
22
+ 'usage_per_customer' => $this->_coupon->getUsagePerCustomer(),
23
+ 'times_used' => $this->_coupon->getTimesUsed(),
24
+ 'expiration_date' => $this->_coupon->getExpirationDate(),
25
+ 'is_primary' => $this->_coupon->getIsPrimary(),
26
+ 'type' => $this->_coupon->getType(),
27
+ ));
28
+
29
+ return parent::_parse();
30
+ }
31
+
32
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Customer.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Customer extends Springbot_Combine_Model_Parser
4
+ {
5
+ const TYPE = 'REGISTERED';
6
+
7
+ protected $_customer;
8
+ protected $_sales;
9
+ protected $_attrProtected = array('password_hash', 'default_billing', 'default_shipping');
10
+ protected $_accessor = '_customer';
11
+
12
+ public function __construct(Mage_Customer_Model_Customer $customer)
13
+ {
14
+ $this->_customer = $customer;
15
+ $this->_parse();
16
+ }
17
+
18
+ public function getSalesModel()
19
+ {
20
+ if(!isset($this->_sales) || !($this->_sales instanceof Mage_Sales_Model_Order)) {
21
+ $this->_sales = Mage::getModel('sales/order');
22
+ }
23
+ return $this->_sales;
24
+ }
25
+
26
+ public function setSalesModel($sales)
27
+ {
28
+ $this->_sales = $sales;
29
+ return $this;
30
+ }
31
+
32
+ public function hasCustomerPurchased()
33
+ {
34
+ return $this->_getCustomerOrderCollection()->getSize() > 0;
35
+ }
36
+
37
+ protected function _parse()
38
+ {
39
+ $magentoStoreId = $this->_customer->getStore()->getId();
40
+ if ($magentoStoreId == 0) {
41
+ $magentoStoreId = Mage::getStoreConfig('springbot/config/store_zero_alias');
42
+ }
43
+ $this->setData(array(
44
+ 'customer_id' => $this->_customer->getEntityId(),
45
+ 'first_name' => $this->_customer->getFirstname(),
46
+ 'last_name' => $this->_customer->getLastname(),
47
+ 'email' => $this->_getEmail(),
48
+ 'store_id' => $this->_getSpringbotStoreId($magentoStoreId),
49
+ 'has_purchase' => $this->hasCustomerPurchased(),
50
+ 'json_data' => $this->_getAddressData(),
51
+ 'custom_attribute_set_id' => $this->_customer->getAttributeSetId(),
52
+ 'custom_attributes' => $this->getCustomAttributes(),
53
+ 'customer_type' => self::TYPE,
54
+ ));
55
+
56
+ return parent::_parse();
57
+ }
58
+
59
+ public function getCustomAttributes()
60
+ {
61
+ $attributes = parent::getCustomAttributes();
62
+
63
+ $attributes['group_id'] = $this->_customer->getGroupId();
64
+ $attributes['group'] = $this->_getCustomerGroupName();
65
+
66
+ return $attributes;
67
+ }
68
+
69
+ protected function _getAddressData()
70
+ {
71
+ if($address = $this->_customer->getDefaultBillingAddress()) {
72
+ $class = 'billing';
73
+ } else if ($address = $this->_customer->getDefaultShippingAddress()) {
74
+ $class = 'shipping';
75
+ } else {
76
+ return new stdClass;
77
+ }
78
+
79
+ return array(
80
+ 'telephone' => $address->getTelephone(),
81
+ 'street' => $address->getStreet1(),
82
+ 'city' => $address->getCity(),
83
+ 'state' => $address->getRegionCode(),
84
+ 'postal_code' => $address->getPostcode(),
85
+ 'country_code' => $address->getCountry(),
86
+ 'company' => $address->getCompany(),
87
+ 'class' => $class,
88
+ );
89
+ }
90
+
91
+ protected function _getCustomerOrderCollection()
92
+ {
93
+ return $this->getSalesModel()->getCollection()
94
+ ->addAttributeToFilter('customer_id', $this->_customer->getEntityId());
95
+ }
96
+
97
+ protected function _getCustomerGroupName()
98
+ {
99
+ $groupId = $this->_customer->getGroupId();
100
+ $group = Mage::getModel('customer/group')->load($groupId);
101
+ return $group->getCode();
102
+ }
103
+
104
+ private function _getEmail() {
105
+ $email = $this->_customer->getEmail();
106
+ // If no email is found use the email stored in the session by the javascript listener
107
+ if (!$email) {
108
+ if ($quote = Mage::getSingleton('checkout/session')->getQuote()) {
109
+ $email = $quote->getCustomerEmail();
110
+ }
111
+ }
112
+
113
+ return $email;
114
+ }
115
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/CustomerAttributeSet.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_CustomerAttributeSet extends Springbot_Combine_Model_Parser_AttributeSet
4
+ {
5
+ protected $_type = 'customer';
6
+
7
+ protected function _parseAttributes()
8
+ {
9
+ $helper = $this->_getHelper();
10
+ $attributes = $helper->parseAttributes($helper->getCustomerCustomAttributes($this->_set));
11
+
12
+ $customerGroupModel = new Mage_Customer_Model_Group();
13
+ $customerGroups = $customerGroupModel->getCollection()->toOptionHash();
14
+ $optionsArray = array();
15
+ foreach ($customerGroups as $key => $customerGroup){
16
+ $optionsArray[] = $customerGroup;
17
+ }
18
+
19
+ $attributes[] = array(
20
+ 'label' => 'Group',
21
+ 'attribute_id' => 9000000,
22
+ 'attribute_code' => 'group',
23
+ 'options' => $optionsArray
24
+ );
25
+
26
+ return $attributes;
27
+
28
+ }
29
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Guest.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Guest extends Springbot_Combine_Model_Parser
4
+ {
5
+ const TYPE = 'GUEST';
6
+ const OFFSET = 100000000;
7
+
8
+ protected $_order;
9
+
10
+ public function __construct(Mage_Sales_Model_Order $order)
11
+ {
12
+ $this->_order = $order;
13
+ $this->_address = $this->_order->getShippingAddress();
14
+ $this->_parse();
15
+ }
16
+
17
+ protected function _parse()
18
+ {
19
+ if(!is_object($this->_address)) { return false; }
20
+
21
+ $this->_data = array(
22
+ 'customer_id' => $this->_createCustomerId(),
23
+ 'first_name' => $this->_address->getFirstname(),
24
+ 'last_name' => $this->_address->getLastname(),
25
+ 'email' => $this->_getEmail(),
26
+ 'store_id' => $this->_getSpringbotStoreId($this->_order->getStoreId()),
27
+ 'has_purchase' => true,
28
+ 'json_data' => $this->_getAddressData(),
29
+ 'customer_type' => self::TYPE
30
+ );
31
+
32
+ return parent::_parse();
33
+ }
34
+
35
+ protected function _createCustomerId()
36
+ {
37
+ return self::OFFSET + $this->_order->getEntityId();
38
+ }
39
+
40
+ protected function _getAddressData()
41
+ {
42
+ if($address = $this->_order->getBillingAddress()) {
43
+ $class = 'billing';
44
+ } else if ($address = $this->_order->getShippingAddress()) {
45
+ $class = 'shipping';
46
+ } else {
47
+ // No default addresses found
48
+ return;
49
+ }
50
+
51
+ return array(
52
+ 'street' => $address->getStreet1(),
53
+ 'city' => $address->getCity(),
54
+ 'state' => $address->getRegionCode(),
55
+ 'postal_code' => $address->getPostcode(),
56
+ 'country_code' => $address->getCountry(),
57
+ 'company' => $address->getCompany(),
58
+ 'class' => $class,
59
+ 'guest' => true,
60
+ );
61
+ }
62
+
63
+ protected function _getEmail()
64
+ {
65
+ $email = $this->_order->getCustomerEmail();
66
+
67
+ if($this->hasAddress() && !isset($email)) {
68
+ $email = $this->_address->getEmail();
69
+ }
70
+
71
+ if (!$email) {
72
+ if ($quote = Mage::getSingleton('checkout/session')->getQuote()) {
73
+ $email = $quote->getCustomerEmail();
74
+ }
75
+ }
76
+
77
+ return $email;
78
+ }
79
+
80
+ public function hasAddress()
81
+ {
82
+ return isset($this->_address);
83
+ }
84
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Inventory.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Inventory extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_inventory;
6
+ protected $_accessor = '_inventory';
7
+
8
+ public function __construct(Mage_CatalogInventory_Model_Stock_Item $inventory)
9
+ {
10
+ $this->_inventory = $inventory;
11
+ }
12
+
13
+ protected function _parse()
14
+ {
15
+ $productId = $this->_inventory->getProductId();
16
+ if ($product = Mage::getModel('catalog/product')->load($productId)) {
17
+ $this->_data = array(
18
+ 'product_id' => $this->_inventory->getProductId(),
19
+ 'system_managed' => (bool) $this->_inventory->getManageStock(),
20
+ 'out_of_stock_qty' => $this->_inventory->getMinQty(),
21
+ 'quantity' => $this->_inventory->getQty(),
22
+ 'store_id' => $this->getSpringbotStoreId(),
23
+ 'item_id' => $this->_inventory->getItemId(),
24
+ 'is_in_stock' => $this->_inventory->getIsInStock(),
25
+ 'min_sale_qty' => $this->_inventory->getMinSaleQty(),
26
+ 'sku' => $this->_getSku($product),
27
+ 'sku_fulfillment' => $product->getSku(),
28
+ );
29
+
30
+ return parent::_parse();
31
+ }
32
+ }
33
+
34
+ public function getSpringbotStoreId()
35
+ {
36
+ return $this->_getSpringbotStoreId($this->getMageStoreId());
37
+ }
38
+
39
+ protected function _getSku($product)
40
+ {
41
+ $parents = Mage::helper('combine/parser')->getParentSkus($product->getId());
42
+ if(sizeof($parents) > 0) {
43
+ $sku = implode('|', $parents);
44
+ } else {
45
+ $sku = $this->_getSkuFailsafe($product);
46
+ }
47
+ return $sku;
48
+ }
49
+
50
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Product.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Product extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_accessor = '_product';
6
+ protected $_product;
7
+
8
+ public function __construct(Mage_Catalog_Model_Product $product)
9
+ {
10
+ $this->_product = $product;
11
+ $this->_parse();
12
+ }
13
+
14
+ public function _parse()
15
+ {
16
+ $p = $this->_product;
17
+ $categories = Springbot_Util_Categories::forProduct($this->_product);
18
+
19
+ $this->setData(array(
20
+ 'store_id' => $this->getSpringbotStoreId(),
21
+ 'entity_id' => $p->getId(),
22
+ 'sku' => $this->_getSku(),
23
+ 'sku_fulfillment' => $p->getSku(),
24
+ 'category_ids' => $p->getCategoryIds(),
25
+ 'root_category_ids' => $categories->getRoots(),
26
+ 'all_category_ids' => $categories->getAll(),
27
+ 'full_description' => $p->getDescription(),
28
+ 'short_description' => $p->getShortDescription(),
29
+ 'image_url' => $this->getImageUrl(),
30
+ 'landing_url' => $this->getLandingUrl(),
31
+ 'name' => $p->getName(),
32
+ 'url_key' => $p->getUrlKey(),
33
+ 'is_deleted' => false,
34
+ 'status' => $p->getStatus(),
35
+ 'created_at' => $this->_formatDateTime($p->getCreatedAt()),
36
+ 'updated_at' => $this->_formatDateTime($p->getUpdatedAt()),
37
+ 'catalog_created_at' => $this->_formatDateTime($p->getCreatedAt()),
38
+ 'catalog_updated_at' => $this->_formatDateTime($p->getUpdatedAt()),
39
+ 'json_data' => array(
40
+ 'unit_price' => $p->getPrice(),
41
+ 'msrp' => $p->getMsrp(),
42
+ 'sale_price' => $p->getSpecialPrice(),
43
+ 'unit_cost' => 0,
44
+ 'image_label' => $p->getImageLabel(),
45
+ 'unit_wgt' => $p->getWeight(),
46
+ 'type' => $p->getTypeId(),
47
+ 'visibility' => $p->getVisibility(),
48
+ 'cat_id_list' => $this->_implodeCategoryIds(),
49
+ ),
50
+ 'custom_attribute_set_id' => $p->getAttributeSetId(),
51
+ 'custom_attributes' => $this->getCustomAttributes(),
52
+ ));
53
+ return parent::_parse();
54
+ }
55
+
56
+
57
+
58
+ public function getCustomAttributes()
59
+ {
60
+ return $this->_getHelper()->getCustomAttributes($this->_product);
61
+ }
62
+
63
+ protected function _implodeCategoryIds()
64
+ {
65
+ $ids = $this->_product->getCategoryIds();
66
+
67
+ if($ids && count($ids) > 0) {
68
+ $ids = implode(',', $ids);
69
+ }
70
+ return $ids;
71
+ }
72
+
73
+ protected function _getSku()
74
+ {
75
+ $parents = Mage::helper('combine/parser')->getParentSkus($this->_product->getId());
76
+ if(sizeof($parents) > 0) {
77
+ $sku = implode('|', $parents);
78
+ } else {
79
+ $sku = $this->_getSkuFailsafe($this->_product);
80
+ }
81
+ return $sku;
82
+ }
83
+
84
+ public function getImageUrl()
85
+ {
86
+ return $this->_getHelper()->getImageUrl($this->_product);
87
+ }
88
+
89
+ public function getLandingUrl()
90
+ {
91
+ return parent::_getLandingUrl($this->_product);
92
+ }
93
+ }
94
+
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Purchase.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Purchase extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_accessor = '_purchase';
6
+ protected $_purchase;
7
+ protected $_lineItems;
8
+
9
+ public function __construct(Mage_Sales_Model_Order $order)
10
+ {
11
+ $this->_lineItems = null;
12
+ $this->_purchase = $order;
13
+ $this->_parse();
14
+ }
15
+
16
+ protected function _parse()
17
+ {
18
+ $model = $this->_purchase;
19
+ if ($model->getStoreId() == 0) {
20
+ $storeId = Mage::getStoreConfig('springbot/config/store_zero_alias');
21
+ }
22
+ else {
23
+ $storeId = $model->getStoreId();
24
+ }
25
+
26
+ $this->setData(array(
27
+ 'purchase_id' => $model->getIncrementId(),
28
+ 'entity_id' => $model->getId(),
29
+ 'email' => $this->_getEmail($model),
30
+ 'quote_id' => $model->getQuoteId(),
31
+ 'redirect_mongo_id' => $this->_getRedirectMongoId(),
32
+ 'redirect_mongo_ids' => $this->_getRedirectMongoIds(),
33
+ 'sb_params' => $this->_getSbParams($model->getQuoteId()),
34
+ 'store_id' => $this->_getSpringbotStoreId($storeId),
35
+ 'customer_id' => $this->_getCustomerId(),
36
+ 'order_date_time' => $model->getCreatedAt(),
37
+ 'order_gross' => $this->_getBaseAmt('grand_total'),
38
+ 'order_discount' => $this->_getBaseAmt('discount_amount'),
39
+ 'order_paid' => $this->_getOrderPaid(),
40
+ 'shipping' => $this->_getBaseAmt('shipping_amount'),
41
+ 'sales_tax' => $this->_getBaseAmt('tax_amount'),
42
+ 'pay_method' => $this->_getPaymentMethod(),
43
+ 'guest' => $model->getCustomerIsGuest() ? 'Y' : 'N',
44
+ 'order_state' => $model->getState(),
45
+ 'order_status' => $model->getStatus(),
46
+ 'line_items' => $this->_getLineItems(),
47
+ 'attribute_items' => $this->_getAttributeArray(),
48
+ 'json_data' => $this->_getJsonData(),
49
+ 'shipments' => $this->_getShipments(),
50
+ 'marketplaces' => $this->_getMarketplacesDetail(),
51
+ ));
52
+
53
+ return parent::_parse();
54
+ }
55
+
56
+ protected function _getRedirectMongoId()
57
+ {
58
+ if($modelId = $this->_purchase->getRedirectMongoId()) {
59
+ return $modelId;
60
+ }
61
+ return Mage::helper('combine/redirect')->getRedirectByOrderId($this->_purchase->getId())->getRedirectId();
62
+ }
63
+
64
+ protected function _getRedirectMongoIds()
65
+ {
66
+ if($modelIds = $this->_purchase->getRedirectMongoIds()) {
67
+ return array_values($modelIds);
68
+ }
69
+ return Mage::helper('combine/redirect')->getRedirectsByEmail($this->_purchase->getCustomerEmail(), $this->_purchase->getCreatedAt());
70
+ }
71
+
72
+ protected function _getSbParams($quoteId)
73
+ {
74
+ return Mage::helper('combine/trackable')->getTrackablesHashByQuote($quoteId);
75
+ }
76
+
77
+ protected function _getShipments()
78
+ {
79
+ $shipments = array();
80
+ foreach($this->_purchase->getShipmentsCollection() as $shipment) {
81
+ foreach($shipment->getAllTracks() as $track) {
82
+ $shipments[] = Mage::getModel('combine/parser_purchase_shipment', $track)->getData();
83
+ }
84
+ }
85
+ return empty($shipments) ? null : $shipments;
86
+ }
87
+
88
+ protected function _getLineItems()
89
+ {
90
+ if(!isset($this->_lineItems)) {
91
+ $lineItems = array();
92
+ $items = $this->_purchase->getAllVisibleItems();
93
+
94
+ if(count($items) > 0) {
95
+ foreach($items as $item) {
96
+ $lineItems[] = Mage::getModel('combine/parser_purchase_item', $item)->getData();
97
+ }
98
+ }
99
+ $this->_lineItems = $lineItems;
100
+ }
101
+ return $this->_lineItems;
102
+ }
103
+
104
+ protected function _getAttributeArray()
105
+ {
106
+ $attrs = array();
107
+ foreach($this->_lineItems as $item)
108
+ {
109
+ $id = isset($item['attribute_set_id']) ? $item['attribute_set_id'] : null;
110
+ foreach($item['attributes'] as $key => $value) {
111
+ if(!empty($value)) {
112
+ $attrs[] = "$key:$value:$id";
113
+ }
114
+ }
115
+ }
116
+ return $attrs;
117
+ }
118
+
119
+ protected function _getJsonData()
120
+ {
121
+ $model = $this->_purchase;
122
+
123
+ return array(
124
+ 'order_dow' => date('D', strtotime($model->getCreatedAt())),
125
+ 'currency' => $model->getOrderCurrencyCode(),
126
+ 'ship_service' => $model->getShippingDescription(),
127
+ 'ip' => $model->getRemoteIp(),
128
+ 'gift_msg' => (bool) $model->getGiftMessage(),
129
+ 'guest' => (bool) $model->getCustomerIsGuest(),
130
+ 'free_shipping' => (bool) $model->getFreeShipping(),
131
+ 'coupon_code' => $model->getCouponCode(),
132
+ );
133
+ }
134
+
135
+ protected function _getCustomerId()
136
+ {
137
+ if($id = $this->_purchase->getCustomerId()) {
138
+ return $id;
139
+ } else {
140
+ $offset = Springbot_Combine_Model_Parser_Guest::OFFSET;
141
+ return $offset + $this->_purchase->getEntityId();
142
+ }
143
+ }
144
+
145
+ protected function _getOrderPaid()
146
+ {
147
+ $payment = $this->_getPayment();
148
+ if($amt = $payment->getBaseAmountOrdered()) {
149
+ // using payment amt ordered
150
+ } else if ($amt = $payment->getBaseAmountAuthorized()) {
151
+ // using payment authorized amt
152
+ } else {
153
+ $amt = $this->_getBaseAmt('grand_total');
154
+ }
155
+ return $amt;
156
+ }
157
+
158
+ protected function _getPaymentMethod()
159
+ {
160
+ $payment = $this->_getPayment();
161
+ return is_object($payment) ? $payment->getMethod() : null;
162
+ }
163
+
164
+ protected function _getPayment()
165
+ {
166
+ $payment = $this->_purchase->getPayment();
167
+ if(empty($payment)) {
168
+ $payment = Mage::getModel('sales/order_payment');
169
+ }
170
+ return $payment;
171
+ }
172
+
173
+ private function _getEmail($model)
174
+ {
175
+ $email = $model->getCustomerEmail();
176
+
177
+ return $email;
178
+ }
179
+
180
+ private function _getMarketplacesDetail()
181
+ {
182
+ $mpOrder = Mage::getModel('combine/marketplaces_remote_order')
183
+ ->load($this->_purchase->getIncrementId(), 'increment_id');
184
+
185
+ if ($mpOrder) {
186
+ return array(
187
+ 'mp_type' => $mpOrder->getMarketplaceType(),
188
+ 'remote_order_id' => $mpOrder->getRemoteOrderId(),
189
+ );
190
+ }
191
+ }
192
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Purchase/Item.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Purchase_Item extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_item;
6
+ protected $_accessor = '_item';
7
+ protected $_actualProduct;
8
+ protected $_parentProduct;
9
+
10
+ public function __construct(Mage_Sales_Model_Order_Item $item)
11
+ {
12
+ $this->_item = $item;
13
+ $this->_actualProduct = null;
14
+ $this->_parentProduct = null;
15
+ $this->_parse();
16
+ }
17
+
18
+ public function _parse()
19
+ {
20
+ $item = $this->_item;
21
+
22
+ $parent = $this->getParentProduct();
23
+ $actual = $this->getActualProduct();
24
+
25
+ $categories = Springbot_Util_Categories::forProduct($parent);
26
+
27
+ $this->_data = array(
28
+ 'sku' => $this->_getSkuFailsafe($parent),
29
+ 'sku_fulfillment' => $item->getSku(),
30
+ 'qty_ordered' => $item->getQtyOrdered(),
31
+ 'landing_url' => $this->getLandingUrl(),
32
+ 'image_url' => $this->getImageUrl(),
33
+ 'wgt' => $item->getWeight(),
34
+ 'name' => $item->getName(),
35
+ 'desc' => $item->getDescription(),
36
+ 'sell_price' => $this->_getBaseAmt('row_total', $item),
37
+ 'product_id' => (int) $item->getProductId(),
38
+ 'product_type' => $item->getProductType(),
39
+ 'category_ids' => $parent->getCategoryIds(),
40
+ 'root_category_ids' => $categories->getRoots(),
41
+ 'all_category_ids' => $categories->getAll(),
42
+ 'attribute_set_id' => (int) $actual->getAttributeSetId(),
43
+ 'attributes' => $this->_getProductAttributes(),
44
+ );
45
+ }
46
+
47
+ public function getParentProduct()
48
+ {
49
+ $item = $this->_item;
50
+
51
+ if(!isset($this->_parentProduct))
52
+ {
53
+ if($config = $item->getProductOptionByCode('super_product_config')) {
54
+ $parentProductId = isset($config['product_id']) ? $config['product_id'] : null;
55
+ }
56
+ else if($item->hasParentItemId()) {
57
+ $parentProductId = $item->getParentItem()->getProductId();
58
+ }
59
+ if(!isset($parentProductId)) {
60
+ $parentProductId = $item->getProductId();
61
+ }
62
+ $this->_parentProduct = Mage::getModel('catalog/product')->load($parentProductId);
63
+ }
64
+ return $this->_parentProduct;
65
+ }
66
+
67
+ public function getActualProduct()
68
+ {
69
+ $item = $this->_item;
70
+
71
+ if(!isset($this->_actualProduct)) {
72
+ if($item->getProductType() == 'simple') {
73
+ $this->_actualProduct = Mage::getModel('catalog/product')->load($item->getProductId());
74
+ }
75
+ else {
76
+ $this->_actualProduct = Mage::getModel('catalog/product')->load($item->getProductId());
77
+
78
+ foreach($item->getOrder()->getAllItems() as $_item) {
79
+ if($item->getSku() == $_item->getSku()) {
80
+ $this->_actualProduct = Mage::getModel('catalog/product')->load($_item->getProductId());
81
+ }
82
+ }
83
+ }
84
+ }
85
+ return $this->_actualProduct;
86
+ }
87
+
88
+ protected function _getProductAttributes()
89
+ {
90
+ return $this->_getHelper()->getCustomAttributes($this->getActualProduct(), 50);
91
+ }
92
+
93
+ public function getLandingUrl()
94
+ {
95
+ $product = $this->getActualProduct();
96
+
97
+ if(!$this->_getHelper()->isAccessible($product)) {
98
+ $product = $this->getParentProduct();
99
+ }
100
+
101
+ return $this->_getLandingUrl($product);
102
+ }
103
+
104
+ public function getImageUrl()
105
+ {
106
+ $product = $this->getActualProduct();
107
+
108
+ if(!$this->_getHelper()->hasImage($product)) {
109
+ $product = $this->getParentProduct();
110
+ }
111
+
112
+ return $this->_getHelper()->getImageUrl($product);
113
+ }
114
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Purchase/Shipment.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Purchase_Shipment extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_accessor = '_shipment';
6
+ protected $_shipment;
7
+ protected $_track;
8
+
9
+ public function __construct(Mage_Sales_Model_Order_Shipment_Track $track)
10
+ {
11
+ $this->_track = $track;
12
+ $this->_shipment = $track->getShipment();
13
+ $this->_parse();
14
+ }
15
+
16
+ protected function _parse()
17
+ {
18
+ $this->_data = array(
19
+ 'tracking_number' => $this->_track->getTrackNumber(),
20
+ 'carrier_code' => $this->_track->getCarrierCode(),
21
+ 'title' => $this->_track->getTitle(),
22
+ 'ship_to' => $this->_getShippingName(),
23
+ 'shipment_status' => $this->_shipment->getShipmentStatus(),
24
+ 'items' => $this->_getShippedItems(),
25
+ );
26
+ }
27
+
28
+ protected function _getShippingName()
29
+ {
30
+ return $this->_shipment->getShippingAddress()->getName();
31
+ }
32
+
33
+ protected function _getShippedItems()
34
+ {
35
+ $data = array();
36
+
37
+ foreach($this->_shipment->getItemsCollection() as $item) {
38
+ $data[] = array(
39
+ 'sku' => $item->getSku(),
40
+ 'name' => $item->getName(),
41
+ 'product_id' => $item->getProductId(),
42
+ 'qty' => $item->getQty(),
43
+ );
44
+ }
45
+
46
+ return $data;
47
+ }
48
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Quote.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Quote extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_quote;
6
+ protected $_accessor = '_quote';
7
+ protected $_items = array();
8
+
9
+ public function __construct(Mage_Sales_Model_Quote $quote)
10
+ {
11
+ $this->_items = array();
12
+ $this->_quote = $quote;
13
+ $this->_parse();
14
+ }
15
+
16
+ public function getItemsCount()
17
+ {
18
+ return count($this->_items);
19
+ }
20
+
21
+ public function hasCustomerData()
22
+ {
23
+ // Explicitly return true for test suite
24
+ if ($this->_getEmail()) {
25
+ return true;
26
+ }
27
+ else {
28
+ return false;
29
+ }
30
+ }
31
+
32
+ protected function _parse()
33
+ {
34
+ $this->setData(array(
35
+ 'quote_id' => $this->_quote->getEntityId(),
36
+ 'sb_params' => $this->_getSbParams($this->_quote->getEntityId()),
37
+ 'store_id' => $this->_getSpringbotStoreId($this->_quote->getStoreId()),
38
+ 'customer_id' => $this->_quote->getCustomerId(),
39
+ 'quote_created' => $this->_formatDateTime($this->_quote->getCreatedAt()),
40
+ 'quote_updated' => $this->_formatDateTime($this->_quote->getUpdatedAt()),
41
+ 'quote_converted' => $this->_formatDateTime($this->_quote->getConvertedAt()),
42
+ 'customer_email' => $this->_getEmail(),
43
+ 'customer_prefix' => $this->_quote->getCustomerPrefix(),
44
+ 'customer_firstname' => $this->_quote->getCustomerFirstname(),
45
+ 'customer_middlename' => $this->_quote->getCustomerMiddlename(),
46
+ 'customer_lastname' => $this->_quote->getCustomerLastname(),
47
+ 'customer_suffix' => $this->_quote->getCustomerSuffix(),
48
+ 'json_data' => array(
49
+ 'checkout_method' => $this->_quote->getCheckoutMethod(),
50
+ 'customer_is_guest' => $this->_quote->getCustomerIsGuest(),
51
+ 'remote_ip' => $this->_quote->getRemoteIp(),
52
+ ),
53
+ 'line_items' => $this->_getLineItems(),
54
+ ));
55
+
56
+ return parent::_parse();
57
+ }
58
+
59
+ protected function _getLineItems()
60
+ {
61
+ if($items = $this->_quote->getAllVisibleItems()) {
62
+ foreach($items as $item) {
63
+ $this->_items[] = Mage::getModel('combine/parser_quote_item', $item)->getData();
64
+ }
65
+ }
66
+ return $this->_items;
67
+ }
68
+
69
+ public function _getEmail() {
70
+ $email = $this->_quote->getCustomerEmail();
71
+ return $email;
72
+ }
73
+
74
+ protected function _getSbParams($quoteId)
75
+ {
76
+ return Mage::helper('combine/trackable')->getTrackablesHashByQuote($quoteId);
77
+ }
78
+
79
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Quote/Item.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Quote_Item extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_item;
6
+ protected $_accessor = '_item';
7
+ protected $_parentProduct;
8
+ protected $_actualProduct;
9
+
10
+ public function __construct(Mage_Sales_Model_Quote_Item $item)
11
+ {
12
+ $this->_item = $item;
13
+ $this->_parentProduct = null;
14
+ $this->_actualProduct = null;
15
+ $this->_parse();
16
+ }
17
+
18
+ protected function _parse()
19
+ {
20
+ $item = $this->_item;
21
+ $parent = $this->getParentProduct();
22
+
23
+ $this->_data = array(
24
+ 'sku' => $this->_getSkuFailsafe($parent),
25
+ 'sku_fulfillment' => $item->getSku(),
26
+ 'entity_id' => $item->getProductId(),
27
+ 'landing_url' => $this->getLandingUrl(),
28
+ 'image_url' => $this->getImageUrl(),
29
+ 'qty' => $item->getQty(),
30
+ 'product_type' => $item->getProductType(),
31
+ );
32
+ return parent::_parse();
33
+ }
34
+
35
+ public function getParentProduct()
36
+ {
37
+ if(!isset($this->_parentProduct)) {
38
+ $item = $this->_item;
39
+
40
+ if($type = $item->getOptionByCode('product_type')) {
41
+ if($parentProductId = $type->getProductId()) {
42
+ $this->_parentProduct = Mage::getModel('catalog/product')->load($parentProductId);
43
+ }
44
+ }
45
+ else if($item->hasParentItemId()) {
46
+ $this->_parentProduct = $item->getParentItem()->getProduct();
47
+ }
48
+ else {
49
+ $this->_parentProduct = $item->getProduct();
50
+ }
51
+ }
52
+ return $this->_parentProduct;
53
+ }
54
+
55
+ public function getActualProduct()
56
+ {
57
+ if(!isset($this->_actualProduct))
58
+ {
59
+ if($option = $this->_item->getOptionByCode('simple_product'))
60
+ {
61
+ $this->_actualProduct = Mage::getModel('catalog/product')->load($option->getProductId());
62
+ }
63
+ else
64
+ {
65
+ $this->_actualProduct = $this->_item->getProduct();
66
+ }
67
+ }
68
+ return $this->_actualProduct;
69
+ }
70
+
71
+ public function getLandingUrl()
72
+ {
73
+ $product = $this->getActualProduct();
74
+
75
+ if(!$this->_getHelper()->isAccessible($product)) {
76
+ $product = $this->getParentProduct();
77
+ }
78
+
79
+ return $this->_getLandingUrl($product);
80
+ }
81
+
82
+ public function getImageUrl()
83
+ {
84
+ $product = $this->getActualProduct();
85
+
86
+ if(!$this->_getHelper()->hasImage($product)) {
87
+ $product = $this->getParentProduct();
88
+ }
89
+
90
+ return $this->_getHelper()->getImageUrl($product);
91
+ }
92
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Rule.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Rule extends Springbot_Combine_Model_Parser
4
+ {
5
+ protected $_rule;
6
+ protected $_accessor = '_rule';
7
+
8
+ public function __construct(Mage_SalesRule_Model_Rule $rule)
9
+ {
10
+ $this->_rule = $rule;
11
+ $this->_parse();
12
+ }
13
+
14
+ protected function _parse()
15
+ {
16
+ $this->setData(array(
17
+ 'rule_id' => $this->_rule->getId(),
18
+ 'store_id' => Mage::helper('combine/harvest')->getSpringbotStoreId($this->_rule->getStoreId()),
19
+ 'is_active' => $this->_rule->getIsActive(),
20
+ 'name' => $this->_rule->getName(),
21
+ 'coupon_code' => $this->_rule->getCouponCode(),
22
+ 'description' => $this->_rule->getDescription(),
23
+ 'conditions' => $this->_serializedToJson($this->_rule->getConditionsSerialized()),
24
+ 'actions' => $this->_serializedToJson($this->_rule->getActionsSerialized()),
25
+ 'from_date' => $this->_rule->getFromDate(),
26
+ 'to_date' => $this->_rule->getToDate(),
27
+ 'uses_per_coupon' => $this->_rule->getUsesPerCoupon(),
28
+ 'uses_per_customer' => $this->_rule->getUsesPerCustomer(),
29
+ 'stop_rules_processing' => $this->_rule->getUsesPerCustomer(),
30
+ 'is_advanced' => $this->_rule->getUsesPerCustomer(),
31
+ 'product_ids' => $this->_rule->getProductIds(),
32
+ 'sort_order' => $this->_rule->getSortOrder(),
33
+ 'simple_action' => $this->_rule->getSimpleAction(),
34
+ 'discount_amount' => $this->_rule->getDiscountAmount(),
35
+ 'discount_qty' => $this->_rule->getDiscountQty(),
36
+ 'discount_step' => $this->_rule->getDiscountStep(),
37
+ 'simple_free_shipping' => $this->_rule->getSimpleFreeShipping(),
38
+ 'apply_to_shipping' => $this->_rule->getApplyToShipping(),
39
+ 'times_used' => $this->_rule->getTimesUsed(),
40
+ 'is_rss' => $this->_rule->getIsRss(),
41
+ 'website_ids' => $this->_rule->getWebsiteIds(),
42
+ 'customer_group_ids' => $this->_rule->getCustomerGroupIds(),
43
+ ));
44
+
45
+ return parent::_parse();
46
+ }
47
+
48
+ protected function _serializedToJson($arg)
49
+ {
50
+ return unserialize($arg);
51
+ }
52
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Parser/Subscriber.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Parser_Subscriber extends Springbot_Combine_Model_Parser
4
+ {
5
+ const TYPE = 'SUBSCRIBER';
6
+ const SUBSCRIBER_MODE = 'NL';
7
+ const OFFSET = 200000000;
8
+
9
+ protected $_subscriber;
10
+
11
+ public function __construct(Mage_Newsletter_Model_Subscriber $subscriber)
12
+ {
13
+ $this->_subscriber = $subscriber;
14
+ $this->_parse();
15
+ }
16
+
17
+ public function isCustomer()
18
+ {
19
+ $customerId = $this->_subscriber->getCustomerId();
20
+ return !empty($customerId);
21
+ }
22
+
23
+ protected function _parse()
24
+ {
25
+ $this->setCustomerId($this->_buildCustomerId())
26
+ ->setSubscriberId($this->_subscriber->getSubscriberId())
27
+ ->setStoreId($this->_getSpringbotStoreId($this->_subscriber->getStoreId()))
28
+ ->setEmail($this->_subscriber->getSubscriberEmail())
29
+ ->setOptinStatus($this->_subscriber->getSubscriberStatus())
30
+ ->setSubscriberMode(self::SUBSCRIBER_MODE)
31
+ ->setCustomerType(self::TYPE);
32
+ return parent::_parse();
33
+ }
34
+
35
+ protected function _buildCustomerId()
36
+ {
37
+ $customerId = $this->_subscriber->getCustomerId();
38
+ if(empty($customerId)) {
39
+ $id = $this->_subscriber->getSubscriberId();
40
+ $customerId = $id + self::OFFSET;
41
+ }
42
+ return $customerId;
43
+ }
44
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Redirect.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Redirect extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/redirect');
8
+ Mage::helper('combine/redirect')->checkAllRedirectTables();
9
+ }
10
+
11
+ public function save()
12
+ {
13
+ if($this->_validate()) {
14
+ Springbot_Log::debug("Save redirect id : {$this->getRedirectId()} for order : {$this->getOrderId()}");
15
+ parent::save();
16
+ }
17
+ }
18
+
19
+ protected function _validate()
20
+ {
21
+ return $this->hasRedirectId() && !empty($this->_data['redirect_id']);
22
+ }
23
+
24
+ public function getAttributionIds()
25
+ {
26
+ $collection = Mage::getModel('combine/redirect')->getCollection()->loadByEmail($this->getEmail());
27
+ $ids = $collection->getAllIds();
28
+ return $ids;
29
+ }
30
+
31
+ /**
32
+ * Insert ignore into collection
33
+ */
34
+ public function insertIgnore()
35
+ {
36
+ try {
37
+ if($this->_validate()) {
38
+ $this->_getResource()->insertIgnore($this);
39
+ }
40
+ } catch(Exception $e) {
41
+ $this->_getResource()->rollBack();
42
+ Springbot_Log::error($e->getMessage());
43
+ }
44
+
45
+ return $this;
46
+ }
47
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Redirect/Order.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Redirect_Order extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/redirect_order');
8
+ Mage::helper('combine/redirect')->checkTable($this->getMainTable());
9
+ }
10
+
11
+ protected function _validate()
12
+ {
13
+ $entity = $this->getRedirectEntityId();
14
+ $orderId = $this->getOrderId();
15
+ return !(empty($entity) || empty($orderId));
16
+ }
17
+
18
+ /**
19
+ * Insert ignore into collection
20
+ */
21
+ public function insertIgnore()
22
+ {
23
+ try {
24
+ if($this->_validate()) {
25
+ $this->_getResource()->insertIgnore($this);
26
+ }
27
+ } catch(Exception $e) {
28
+ $this->_getResource()->rollBack();
29
+ Springbot_Log::error($e->getMessage());
30
+ }
31
+
32
+ return $this;
33
+ }
34
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Abstract.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Springbot_Combine_Model_Resource_Abstract extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function insertIgnore(Mage_Core_Model_Abstract $object)
6
+ {
7
+ try {
8
+ $table = $this->getMainTable();
9
+ $bind = $this->_prepareDataForSave($object);
10
+ $bind = $this->_convertDatetimesToString($bind);
11
+ $this->_insertIgnore($table, $bind);
12
+ } catch (Exception $e) {
13
+ Springbot_Log::error($e->getMessage());
14
+ }
15
+ }
16
+
17
+ protected function _insertIgnore($table, array $bind)
18
+ {
19
+ $adapter = $this->_getWriteAdapter();
20
+
21
+ // extract and quote col names from the array keys
22
+ $cols = array();
23
+ $vals = array();
24
+ foreach ($bind as $col => $val) {
25
+ $cols[] = $adapter->quoteIdentifier($col, true);
26
+ $vals[] = '?';
27
+ }
28
+
29
+ // build the statement
30
+ $sql = "INSERT IGNORE INTO "
31
+ . $adapter->quoteIdentifier($table, true)
32
+ . ' (' . implode(', ', $cols) . ') '
33
+ . 'VALUES (' . implode(', ', $vals) . ')';
34
+
35
+ Springbot_Log::debug($sql);
36
+
37
+ Springbot_Log::debug('BIND : '.implode(', ', $bind));
38
+
39
+ // execute the statement and return the number of affected rows
40
+ $stmt = $adapter->query($sql, array_values($bind));
41
+ return $stmt->rowCount();
42
+ }
43
+
44
+ // Fixes issue with Magento converting DateTimes to an object and inserting extra quotes
45
+ protected function _convertDatetimesToString($bind) {
46
+ foreach ($bind as $key => $value) {
47
+ if (is_object($value)) {
48
+ $bind[$key] = trim((string)$value, "'");
49
+ }
50
+ }
51
+ return $bind;
52
+ }
53
+
54
+ protected function _getHelper()
55
+ {
56
+ return Mage::helper('combine/redirect');
57
+ }
58
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Action.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Action extends Springbot_Combine_Model_Resource_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/action', 'id');
8
+ }
9
+
10
+ public function lockEvents($pid, $storeId, $count)
11
+ {
12
+ $count = (int) $count;
13
+ $vars = array(
14
+ 'pid' => $pid,
15
+ 'store_id' => $storeId,
16
+ );
17
+ $cronEventsTable = Mage::getSingleton('core/resource')->getTableName('springbot_actions');
18
+ $write = $this->_getWriter();
19
+ $write->query(
20
+ "UPDATE `{$cronEventsTable}`
21
+ SET `locked_by` = :pid, `locked_at` = NOW()
22
+ WHERE `store_id` = :store_id
23
+ ORDER BY `id`
24
+ LIMIT $count",
25
+ $vars
26
+ );
27
+ }
28
+
29
+ public function removeEvents($pid = null)
30
+ {
31
+ $cronEventsTable = Mage::getSingleton('core/resource')->getTableName('springbot_actions');
32
+ $write = $this->_getWriter();
33
+ $sql = $write->quoteInto("DELETE FROM `{$cronEventsTable}` WHERE `locked_by` = ?;", $pid);
34
+ $write->query($sql);
35
+ }
36
+
37
+ public function removeStoreEventRows($storeId, $pid = null)
38
+ {
39
+ if (is_numeric($storeId) && is_numeric($limit)) {
40
+ $cronEventsTable = Mage::getSingleton('core/resource')->getTableName('springbot_actions');
41
+ $write = $this->_getWriter();
42
+ $sql = $write->quoteInto("DELETE FROM `{$cronEventsTable}` WHERE `store_id` = ?", $storeId);
43
+
44
+ if($pid) {
45
+ $sql .= " AND `locked_by` = $pid";
46
+ }
47
+
48
+ $write->query($sql);
49
+ }
50
+ }
51
+
52
+ public function releaseLocksForPid($pid)
53
+ {
54
+ $cronEventsTable = Mage::getSingleton('core/resource')->getTableName('springbot_actions');
55
+ $write = $this->_getWriter();
56
+ $sql = $write->quoteInto("UPDATE `{$cronEventsTable}` SET `locked_by` = NULL, `locked_at` = NULL WHERE `locked_by`", $pid);
57
+ $write->query($sql);
58
+ }
59
+
60
+ public function releaseOldLocks($hoursOld)
61
+ {
62
+ $cronEventsTable = Mage::getSingleton('core/resource')->getTableName('springbot_actions');
63
+ $write = $this->_getWriter();
64
+ $sql = $write->quoteInto("UPDATE `{$cronEventsTable}` SET `locked_by` = NULL, `locked_at` = NULL WHERE `locked_at` < DATE_SUB(NOW(), INTERVAL ? HOUR)", $hoursOld);
65
+ $write->query($sql);
66
+ }
67
+
68
+ public function unlockActions()
69
+ {
70
+ $cronEventsTable = Mage::getSingleton('core/resource')->getTableName('springbot_actions');
71
+ $write = $this->_getWriter();
72
+ $write->query("UPDATE `{$cronEventsTable}` SET `locked_by` = NULL, `locked_at` = NULL WHERE 1");
73
+ }
74
+
75
+ protected function _getWriter()
76
+ {
77
+ return Mage::getSingleton('core/resource')->getConnection('core_write');
78
+ }
79
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Action/Collection.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Action_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/action');
8
+ }
9
+
10
+ public function getEvents($storeId, $limit = 200)
11
+ {
12
+ $this->addFieldToFilter('store_id', $storeId)
13
+ ->setPage(1, $limit);
14
+ return $this;
15
+ }
16
+
17
+ public function getLockedEvents($storeId, $pid = null)
18
+ {
19
+ if($pid) {
20
+ $this->addFieldToFilter('locked_by', $pid);
21
+ }
22
+ $this->addFieldToFilter('store_id', $storeId);
23
+ return $this;
24
+ }
25
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Cron/Count.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Cron_Count extends Springbot_Combine_Model_Resource_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/cron_count', 'id');
8
+ }
9
+
10
+ public function createCountRow($storeId, $harvestId, $entityType, $count)
11
+ {
12
+ $countItem = Mage::getModel('combine/cron_count');
13
+ $countItem->setData(array(
14
+ 'store_id' => $storeId,
15
+ 'harvest_id' => $harvestId,
16
+ 'entity' => $entityType,
17
+ 'count' => $count
18
+ ));
19
+ $this->insertIgnore($countItem);
20
+ }
21
+
22
+ public function increaseCountRow($storeId, $harvestId, $entityType, $count)
23
+ {
24
+ $adapter = $this->_getWriter();
25
+ $table = $this->getMainTable();
26
+ $sql = "UPDATE `{$table}` SET `count` = `count` + :count WHERE `store_id` = :store_id AND `harvest_id` = :harvest_id AND `entity` = :entity_type";
27
+ $binds = array(
28
+ 'count' => $count,
29
+ 'store_id' => $storeId,
30
+ 'harvest_id' => $harvestId,
31
+ 'entity_type' => $entityType,
32
+ );
33
+
34
+ $stmt = $adapter->query($sql, $binds);
35
+ return $stmt->rowCount();
36
+ }
37
+
38
+ public function setCompletedTime($storeId, $harvestId, $entityType)
39
+ {
40
+ $adapter = $this->_getWriter();
41
+ $table = $this->getMainTable();
42
+ $sql = "UPDATE `{$table}` SET `completed` = NOW() WHERE `store_id` = :store_id AND `harvest_id` = :harvest_id AND `entity` = :entity_type";
43
+ $binds = array(
44
+ 'store_id' => $storeId,
45
+ 'harvest_id' => $harvestId,
46
+ 'entity_type' => $entityType,
47
+ );
48
+ $stmt = $adapter->query($sql, $binds);
49
+ }
50
+
51
+ public function clearStoreCounts($storeId)
52
+ {
53
+ $adapter = $this->_getWriter();
54
+ $table = $this->getMainTable();
55
+ $sql = "DELETE FROM `{$table}` WHERE `store_id` = :store_id";
56
+ $binds = array(
57
+ 'store_id' => $storeId,
58
+ );
59
+
60
+ $stmt = $adapter->query($sql, $binds);
61
+ return $stmt->rowCount();
62
+ }
63
+
64
+ protected function _getWriter()
65
+ {
66
+ return Mage::getSingleton('core/resource')->getConnection('core_write');
67
+ }
68
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Cron/Count/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Cron_Count_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/cron_count');
8
+ }
9
+
10
+
11
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Cron/Queue.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Cron_Queue extends Springbot_Combine_Model_Resource_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/cron_queue', 'id');
8
+ }
9
+
10
+ public function removeHarvestRows($storeId = null, $listenersOnly = true)
11
+ {
12
+ $cronQueueTable = Mage::getSingleton('core/resource')->getTableName('springbot_cron_queue');
13
+ $write = $this->_getWriter();
14
+ if (is_null($storeId)) {
15
+ if ($listenersOnly) {
16
+ $write->query("DELETE FROM `{$cronQueueTable}` WHERE `queue` != 'listener';");
17
+ }
18
+ else {
19
+ $write->query("DELETE FROM `{$cronQueueTable}` WHERE 1;");
20
+ }
21
+ }
22
+ else {
23
+ $sql = $write->quoteInto("DELETE FROM `{$cronQueueTable}` WHERE `store_id` = ?", $storeId);
24
+ $write->query($sql);
25
+ }
26
+ }
27
+
28
+ public function removeHarvestRow($rowId)
29
+ {
30
+ $cronQueueTable = Mage::getSingleton('core/resource')->getTableName('springbot_cron_queue');
31
+ $write = $this->_getWriter();
32
+ $sql = $write->quoteInto("DELETE FROM `{$cronQueueTable}` WHERE `id` = ?", $rowId);
33
+ $write->query($sql);
34
+ }
35
+
36
+ public function lockRows($rowIds)
37
+ {
38
+ $cronQueueTable = Mage::getSingleton('core/resource')->getTableName('springbot_cron_queue');
39
+ $write = $this->_getWriter();
40
+ $lockedAt = now();
41
+ $lockedBy = getmypid();
42
+ $idsString = implode(', ', $rowIds);
43
+ $write->query("UPDATE `{$cronQueueTable}` SET `locked_at` = '{$lockedAt}', `locked_by` = {$lockedBy} WHERE `id` IN ({$idsString});");
44
+ }
45
+
46
+ public function unlockOldRows($hoursOld)
47
+ {
48
+ $cronQueueTable = Mage::getSingleton('core/resource')->getTableName('springbot_cron_queue');
49
+ $write = $this->_getWriter($cronQueueTable);
50
+ $write->query("UPDATE `{$cronQueueTable}` SET `locked_at` = NULL, `locked_by` = NULL WHERE `locked_at` < DATE_SUB(NOW(), INTERVAL {$hoursOld} HOUR)");
51
+ }
52
+
53
+ public function unlockOrphanedRows($activeIds = array())
54
+ {
55
+ $cronQueueTable = Mage::getSingleton('core/resource')->getTableName('springbot_cron_queue');
56
+ $write = $this->_getWriter($cronQueueTable);
57
+ $sql = "UPDATE `{$cronQueueTable}` SET `locked_at` = NULL, `locked_by` = NULL WHERE (`locked_by` IS NOT NULL OR `locked_at` IS NOT NULL) ";
58
+ if(count($activeIds)) {
59
+ $sql = $write->quoteInto($sql . "AND `locked_by` NOT IN (?)", $activeIds);
60
+ }
61
+ Springbot_Log::debug($sql);
62
+ $write->query($sql);
63
+ }
64
+
65
+ public function resetRetries()
66
+ {
67
+ $cronQueueTable = Mage::getSingleton('core/resource')->getTableName('springbot_cron_queue');
68
+ $write = $this->_getWriter($cronQueueTable);
69
+ $write->query("UPDATE `{$cronQueueTable}` SET `attempts` = 0 WHERE 1");
70
+ }
71
+
72
+
73
+ protected function _getWriter()
74
+ {
75
+ return Mage::getSingleton('core/resource')->getConnection('core_write');
76
+ }
77
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Cron/Queue/Collection.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Cron_Queue_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ const ATTEMPT_LIMIT = 10;
6
+
7
+ public function _construct()
8
+ {
9
+ $this->_init('combine/cron_queue');
10
+ }
11
+
12
+ /**
13
+ * Get jobs based on priority and created at
14
+ * FIFO, ordered on priority (0 is top priority)
15
+ *
16
+ * @param int|string|null $limit
17
+ */
18
+ public function getPriorityJobs($limit, $queue = null, $isForeman = true)
19
+ {
20
+ $this->getSelect()
21
+ ->where('locked_at IS NULL')
22
+ ->where('attempts < ?', $this->getAttemptLimit())
23
+ ->where(
24
+ "(next_run_at IS NULL OR next_run_at < ?)",
25
+ date("Y-m-d H:i:s")
26
+ );
27
+
28
+ // Only foreman can process the default queue
29
+ if(!$isForeman) {
30
+ $this->getSelect()->where("queue != 'default'");
31
+ }
32
+
33
+ $this->getSelect()
34
+ ->order(array('priority ASC', 'id ASC'));
35
+
36
+ if(!empty($limit)) {
37
+ $this->getSelect()->limit($limit);
38
+ }
39
+
40
+ if ($queue) {
41
+ $this->getSelect()->where('queue = "' . $queue .'" ');
42
+ }
43
+
44
+ return $this;
45
+ }
46
+
47
+ public function getNextJob($isForeman)
48
+ {
49
+ $col = $this->getPriorityJobs(1, null, $isForeman);
50
+
51
+ if($col && $col->getSize() > 0) {
52
+ return $col->getFirstItem();
53
+ } else {
54
+ return false;
55
+ }
56
+ }
57
+
58
+ public function hasJobs()
59
+ {
60
+ return $this->getPriorityJobs(1)->getSize() > 0;
61
+ }
62
+
63
+ public function getAttemptLimit()
64
+ {
65
+ return self::ATTEMPT_LIMIT;
66
+ }
67
+
68
+ public function getActiveCount()
69
+ {
70
+ return $this->getPriorityJobs(1)->getSize();
71
+ }
72
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Debug.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Debug extends Springbot_Combine_Model_Resource_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ }
9
+
10
+ public function getProductsRaw()
11
+ {
12
+ $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
13
+ $productTableName = Mage::getSingleton('core/resource')->getTableName('catalog_product_entity');
14
+ $query = "SELECT COUNT(*) as `count`, `type_id` FROM {$productTableName} GROUP BY `type_id`";
15
+ return $readConnection->fetchAll($query);
16
+ }
17
+
18
+ public function getCategoriesRaw()
19
+ {
20
+ $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
21
+ $categoryTableName = Mage::getSingleton('core/resource')->getTableName('catalog_category_entity');
22
+ $query = "SELECT COUNT(*) as `count` FROM {$categoryTableName}";
23
+ return $readConnection->fetchAll($query);
24
+ }
25
+
26
+ public function getCustomersRaw()
27
+ {
28
+ $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
29
+ $customerTableName = Mage::getSingleton('core/resource')->getTableName('customer_entity');
30
+ $query = "SELECT COUNT(*) as `count`, `store_id` FROM {$customerTableName} GROUP BY `store_id`";
31
+ return $readConnection->fetchAll($query);
32
+ }
33
+
34
+ public function getSubscribersRaw()
35
+ {
36
+ $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
37
+ $subscriberTableName = Mage::getSingleton('core/resource')->getTableName('newsletter_subscriber');
38
+ $query = "SELECT COUNT(*) as `count`, `store_id` FROM {$subscriberTableName} GROUP BY `store_id`";
39
+ return $readConnection->fetchAll($query);
40
+ }
41
+
42
+ public function getPurchasesRaw()
43
+ {
44
+ $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
45
+ $ordersTableName = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
46
+ $query = "SELECT COUNT(*) as `count`, `store_id` FROM {$ordersTableName} GROUP BY `store_id`";
47
+ return $readConnection->fetchAll($query);
48
+ }
49
+
50
+ public function getCartsRaw()
51
+ {
52
+ $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
53
+ $quotesTableName = Mage::getSingleton('core/resource')->getTableName('sales_flat_quote');
54
+ $query = "SELECT COUNT(*) as `count`, `store_id` FROM {$quotesTableName} GROUP BY `store_id`";
55
+ return $readConnection->fetchAll($query);
56
+ }
57
+
58
+ public function getGuestsRaw()
59
+ {
60
+ $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
61
+ $quotesTableName = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
62
+ $query = "SELECT COUNT(*) AS `count`, `store_id` FROM (SELECT DISTINCT (customer_email), `store_id` FROM `{$quotesTableName}` GROUP BY store_id, customer_email) `customers` GROUP BY `store_id`";
63
+ return $readConnection->fetchAll($query);
64
+ }
65
+
66
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Marketplaces/Remote/Order.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Marketplaces_Remote_Order
4
+ extends Springbot_Combine_Model_Resource_Abstract
5
+ {
6
+ public function _construct()
7
+ {
8
+ $this->_init('combine/marketplaces_remote_order', 'id');
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Marketplaces/Remote/Order/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Marketplaces_Remote_Order_Collection
4
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
5
+ {
6
+ public function _construct()
7
+ {
8
+ $this->_init('combine/marketplaces_remote_order');
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Redirect.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Redirect extends Springbot_Combine_Model_Resource_Abstract
4
+ {
5
+ protected $_redirectOrderTable;
6
+
7
+ public function _construct()
8
+ {
9
+ $this->_init('combine/redirect', 'id');
10
+ Mage::helper('combine/redirect')->checkAllRedirectTables();
11
+ $this->_redirectOrderTable = $this->getTable('combine/redirect_order');
12
+ }
13
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Redirect/Collection.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Redirect_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/redirect');
8
+ }
9
+
10
+ protected function _initSelect()
11
+ {
12
+ parent::_initSelect();
13
+ Mage::helper('combine/redirect')->checkAllRedirectTables();
14
+ }
15
+
16
+ public function loadByEmail($email)
17
+ {
18
+ $this->addFieldToFilter('email', $email);
19
+ return $this;
20
+ }
21
+
22
+ public function loadByQuoteId($quoteId)
23
+ {
24
+ $this->addFieldToFilter('quote_id', $quoteId);
25
+ return $this;
26
+ }
27
+
28
+ public function loadByKey($email, $redirectId)
29
+ {
30
+ Springbot_Log::debug("Loading redirect for unique key {$email} : {$redirectId}");
31
+ return $this->addFieldToFilter('email', $email)
32
+ ->addFieldToFilter('redirect_id', $redirectId)
33
+ ->getFirstItem();
34
+ }
35
+
36
+ public function joinOrderIds()
37
+ {
38
+ $this->getSelect()->join(
39
+ array('at_order_id' => $this->getTable('combine/redirect_order')),
40
+ 'main_table.id = at_order_id.redirect_entity_id',
41
+ 'at_order_id.order_id'
42
+ );
43
+ return $this;
44
+ }
45
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Redirect/Order.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Redirect_Order extends Springbot_Combine_Model_Resource_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/redirect_order', 'id');
8
+ Mage::helper('combine/redirect')->checkTable($this->getMainTable());
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Redirect/Order/Collection.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Redirect_Order_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/redirect_order');
8
+ }
9
+
10
+ protected function _initSelect()
11
+ {
12
+ parent::_initSelect();
13
+ Mage::helper('combine/redirect')->checkTable($this->getMainTable());
14
+ }
15
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Setup.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
4
+ {
5
+ protected $_app;
6
+ protected $_api;
7
+ protected $_config;
8
+ protected $_data = array();
9
+
10
+ public function toJson($attributes = array())
11
+ {
12
+ $obj = new stdClass();
13
+ $obj->installs = array($this->_data);
14
+ return json_encode($obj);
15
+ }
16
+
17
+ public function reinstallSetupScript($fromVersion, $toVersion)
18
+ {
19
+ Mage::log("Reinstall $fromVersion to $toVersion");
20
+ $files = $this->_getAvailableDbFiles(self::TYPE_DB_UPGRADE, $fromVersion, $toVersion);
21
+
22
+ try {
23
+ foreach($files as $file) {
24
+ $fileName = $file['fileName'];
25
+ Mage::log("Reinstall $fileName");
26
+ $conn = $this->getConnection();
27
+ include $fileName;
28
+ }
29
+ } catch (Exception $e) {
30
+ Springbot_Log::error($e->getMessage());
31
+ Mage::logException($e);
32
+ }
33
+ }
34
+
35
+ public function resendInstallLog()
36
+ {
37
+ $this->getSiteDetails();
38
+ $this->submit();
39
+ }
40
+
41
+ public function getData()
42
+ {
43
+ return $this->_data;
44
+ }
45
+
46
+ public function getSiteDetails()
47
+ {
48
+ try{
49
+ $this->fetchConfig();
50
+ } catch (Exception $e) {
51
+ Mage::logException($e);
52
+ Springbot_Log::error($e->getMessage());
53
+ $this->_setData('type', 'magento')
54
+ ->_setData('error', 'General failure on install.');
55
+ }
56
+ return true;
57
+ }
58
+
59
+ public function fetchConfig()
60
+ {
61
+ $this->_getApp()->reinitStores();
62
+ $config = $this->_getConfig();
63
+ $config->getResourceModel()->loadToXml($config);
64
+
65
+ $this->_setData('type', 'magento')
66
+ ->_setData('version', $this->getVersion())
67
+ ->_setData('primary_url', $this->getPrimaryUrl())
68
+ ->_setData('modules', $this->getExtensions())
69
+ ->_setData('store_details', $this->getStoreDetails())
70
+ ->_setData('system_info', $this->getSystemDetails());
71
+ return $this;
72
+ }
73
+
74
+ public function submit()
75
+ {
76
+ $this->_getApi()->call('installs', $this->toJson(), false);
77
+ }
78
+
79
+ public function getVersion()
80
+ {
81
+ return Mage::getVersion();
82
+ }
83
+
84
+ public function getPrimaryUrl()
85
+ {
86
+ return $this->_getApp()
87
+ ->getStore(Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID)
88
+ ->getConfig(Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL);
89
+ }
90
+
91
+ public function getStoreDetails()
92
+ {
93
+ $stores = array();
94
+ foreach($this->_getStores() as $store) {
95
+ if($store instanceof Mage_Core_Model_Store) {
96
+ $stores[] = array(
97
+ 'id' => $store->getId(),
98
+ 'name' => $store->getName(),
99
+ 'base_url' => $store->getConfig(Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL),
100
+ 'transactional_emails' => $store->getConfig('trans_email'),
101
+ 'contact_information' => $store->getConfig('general/store_information'),
102
+ );
103
+ }
104
+ }
105
+ return $stores;
106
+ }
107
+
108
+ public function getSystemDetails()
109
+ {
110
+ return array(
111
+ 'php_version' => phpversion(),
112
+ 'host' => php_uname(),
113
+ 'php_exec_healthcheck' => $this->_checkPhpExec(),
114
+ 'functions_exist' => array (
115
+ 'system' => $this->_checkFunction('system'),
116
+ 'exec' => $this->_checkFunction('exec'),
117
+ 'escapeshellarg' => $this->_checkFunction('escapeshellarg'),
118
+ 'escapeshellcmd' => $this->_checkFunction('escapeshellcmd'),
119
+ 'passthru' => $this->_checkFunction('passthru'),
120
+ 'shell_exec' => $this->_checkFunction('shell_exec'),
121
+ 'proc' => array(
122
+ 'proc_close' => $this->_checkFunction('proc_close'),
123
+ 'proc_get_status' => $this->_checkFunction('proc_get_status'),
124
+ 'proc_nice' => $this->_checkFunction('proc_nice'),
125
+ 'proc_open' => $this->_checkFunction('proc_open'),
126
+ 'proc_terminate' => $this->_checkFunction('proc_terminate'),
127
+ ),
128
+ 'pcntl' => array(
129
+ 'pcntl_alarm' => $this->_checkFunction('pctnl_alarm'),
130
+ 'pcntl_errno' => $this->_checkFunction('pctnl_errno'),
131
+ 'pcntl_exec' => $this->_checkFunction('pctnl_exec'),
132
+ 'pcntl_fork' => $this->_checkFunction('pctnl_fork'),
133
+ 'pcntl_get_last_error' => $this->_checkFunction('pctnl_get_last_error'),
134
+ 'pcntl_getpriority' => $this->_checkFunction('pctnl_getpriority'),
135
+ 'pcntl_setpriority' => $this->_checkFunction('pctnl_setpriority'),
136
+ 'pcntl_signal_dispatch' => $this->_checkFunction('pctnl_signal_dispatch'),
137
+ 'pcntl_signal' => $this->_checkFunction('pctnl_signal'),
138
+ 'pcntl_sigprocmask' => $this->_checkFunction('pctnl_sigprocmask'),
139
+ 'pcntl_sigtimedwait' => $this->_checkFunction('pctnl_sigtimedwait'),
140
+ 'pcntl_sigwaitinfo' => $this->_checkFunction('pctnl_sigwaitinfo'),
141
+ 'pcntl_strerror' => $this->_checkFunction('pctnl_strerror'),
142
+ 'pcntl_wait' => $this->_checkFunction('pctnl_wait'),
143
+ 'pcntl_waitpid' => $this->_checkFunction('pctnl_waitpid'),
144
+ 'pcntl_wexitstatus' => $this->_checkFunction('pctnl_wexitstatus'),
145
+ 'pcntl_wifexited' => $this->_checkFunction('pctnl_wifexited'),
146
+ 'pcntl_wifsignaled' => $this->_checkFunction('pctnl_wifsignaled'),
147
+ 'pcntl_wifstopped' => $this->_checkFunction('pctnl_wifstopped'),
148
+ 'pcntl_wstopsig' => $this->_checkFunction('pctnl_wstopsig'),
149
+ 'pcntl_wtermsig' => $this->_checkFunction('pctnl_wtermsig'),
150
+ )
151
+ ),
152
+ 'phpinfo' => $this->_phpinfoArray(true),
153
+ );
154
+ }
155
+
156
+ public function getExtensions()
157
+ {
158
+ $versions = new stdClass();
159
+ $modules = $this->_getConfig()->getNode('modules')->children();
160
+ if($modules) {
161
+ foreach($modules as $name => $meta) {
162
+ if(strpos($name, 'Mage') !== 0) {
163
+ $versions->$name = $meta;
164
+ }
165
+ }
166
+ }
167
+ return $versions;
168
+ }
169
+
170
+ protected function _setData($type, $value = null)
171
+ {
172
+ $this->_data[$type] = $value;
173
+ return $this;
174
+ }
175
+
176
+ protected function _getApp()
177
+ {
178
+ if(!isset($this->_app)) {
179
+ $this->_app = Mage::app();
180
+ }
181
+ return $this->_app;
182
+ }
183
+
184
+ protected function _getConfig()
185
+ {
186
+ if(!isset($this->_config)) {
187
+ $this->_config = Mage::getConfig();
188
+ }
189
+ return $this->_config;
190
+ }
191
+
192
+ protected function _getStores()
193
+ {
194
+ return $this->_getApp()->getStores();
195
+ }
196
+
197
+ protected function _getApi()
198
+ {
199
+ if(!isset($this->_api)) {
200
+ $this->_api = Mage::getModel('combine/api');
201
+ }
202
+ return $this->_api;
203
+ }
204
+
205
+ protected function _checkFunction($func)
206
+ {
207
+ return function_exists($func) ? 'true' : 'false';
208
+ }
209
+
210
+ protected function _checkPhpExec()
211
+ {
212
+ ob_start();
213
+ $check = system("/usr/bin/php -r \"echo 'ok';\"");
214
+ ob_end_clean();
215
+ return $check == "ok" ? "ok" : "could not execute php as shell";
216
+ }
217
+
218
+ protected function _phpinfoArray($return=false){
219
+ /* Andale! Andale! Yee-Hah! */
220
+ ob_start();
221
+ phpinfo(-1);
222
+
223
+ $pi = preg_replace(
224
+ array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms',
225
+ '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#',
226
+ "#[ \t]+#", '#&nbsp;#', '# +#', '# class=".*?"#', '%&#039;%',
227
+ '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>'
228
+ .'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#',
229
+ '#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#',
230
+ '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#',
231
+ "# +#", '#<tr>#', '#</tr>#'),
232
+ array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ',
233
+ '<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2</td></tr>'.
234
+ "\n".'<tr><td>PHP Egg</td><td>$1</td></tr>',
235
+ '<tr><td>PHP Credits Egg</td><td>$1</td></tr>',
236
+ '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" .
237
+ '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'),
238
+ ob_get_clean());
239
+
240
+ $sections = explode('<h2>', strip_tags($pi, '<h2><th><td>'));
241
+ unset($sections[0]);
242
+
243
+ $pi = array();
244
+ foreach($sections as $section){
245
+ $n = substr($section, 0, strpos($section, '</h2>'));
246
+ preg_match_all(
247
+ '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#',
248
+ $section, $askapache, PREG_SET_ORDER);
249
+ foreach($askapache as $m) {
250
+ if(isset($m[2])) {
251
+ $pi[$n][$m[1]]=(!isset($m[3])||$m[2]==$m[3])?$m[2]:array_slice($m,2);
252
+ }
253
+ }
254
+ }
255
+
256
+ return ($return === false) ? print_r($pi) : $pi;
257
+ }
258
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Trackable.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Trackable extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/trackable', 'id');
8
+ }
9
+
10
+ public function create(Springbot_Combine_Model_Trackable $object)
11
+ {
12
+ $adapter = $this->_getWriteAdapter();
13
+
14
+ $select = $adapter->select()
15
+ ->from($this->getMainTable())
16
+ ->where('quote_id = ?', $object->getQuoteId())
17
+ ->where('type = ?', $object->getType());
18
+
19
+ if(!($row = $adapter->fetchRow($select))) {
20
+ Springbot_Log::debug("Creating trackable {$object->getType()} : {$object->getValue()}");
21
+ $adapter->insert($this->getMainTable(), $object->getData());
22
+ $object->setId($adapter->lastInsertId($this->getMainTable()));
23
+ return $object;
24
+ } else {
25
+ Springbot_Log::debug("Trackable {$object->getType()} : {$object->getValue()} exists, updating");
26
+ $object->setId($row['id']);
27
+
28
+ $this->save($object);
29
+ return $object;
30
+ }
31
+ }
32
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Resource/Trackable/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Resource_Trackable_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/trackable');
8
+ }
9
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Rewrite.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Rewrite extends Mage_Core_Model_Abstract
4
+ {
5
+ /**
6
+ * Create a new rewrite based on magento version
7
+ *
8
+ * @param Mage_Core_Model_Store $store
9
+ * @param string $idPath
10
+ * @param string $requestPath
11
+ * @param string $targetPath
12
+ * @return boolean
13
+ */
14
+ public function createRewrite($store, $idPath, $requestPath, $targetPath)
15
+ {
16
+ try {
17
+ // check if community edition
18
+ if ($this->isMageCommunity()) {
19
+ // check if rewrites already exist
20
+ $existingRewrite = Mage::getModel('core/url_rewrite')->loadByIdPath($idPath);
21
+
22
+ // if they don't
23
+ if ($existingRewrite->getUrlRewriteId() == null) {
24
+ Mage::getModel('core/url_rewrite')
25
+ ->setIsSystem(0)
26
+ ->setStoreId($store->getStoreId())
27
+ ->setOptions('RP')
28
+ ->setIdPath($idPath)
29
+ ->setRequestPath($requestPath)
30
+ ->setTargetPath($targetPath)
31
+ ->save();
32
+ return true;
33
+ } else {
34
+ return false;
35
+ }
36
+ }
37
+
38
+ // check if enterprise edition
39
+ if ($this->isMageEnterprise()) {
40
+ $existingRewrite = Mage::getModel('enterprise_urlrewrite/redirect')->getCollection()
41
+ ->addFieldToFilter('target_path')
42
+ ->getFirstItem();
43
+
44
+ if (!$existingRewrite->getId()) {
45
+ Mage::getModel('enterprise_urlrewrite/redirect')
46
+ ->setStoreId($store->getStoreId())
47
+ ->setOptions('RP')
48
+ ->setIdentifier($idPath)
49
+ ->setRequestPath($requestPath)
50
+ ->setTargetPath($targetPath)
51
+ ->save();
52
+ return true;
53
+ } else {
54
+ return false;
55
+ }
56
+ }
57
+ return false;
58
+ } catch (Exception $e) {
59
+ Springbot_Log::error('Unable to create URL rewrite for store id: ' .
60
+ $store->getStoreId() . ' - ' . $requestPath . ' to ' . $targetPath . '');
61
+ return false;
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Delete a rewrite from the database based on magento version
67
+ *
68
+ * @param int $urlRewriteId the rewrite id
69
+ * @return boolean
70
+ */
71
+ public function deleteRewrite($urlRewriteId)
72
+ {
73
+ try {
74
+ // check if community edition
75
+ if ($this->isMageCommunity()) {
76
+ // check if rewrite exists
77
+ $existingRewrite = Mage::getModel('core/url_rewrite')->load($urlRewriteId);
78
+
79
+ if ($existingRewrite->getStoreId() !== null) {
80
+ $existingRewrite->delete();
81
+ if (Mage::getModel('core/url_rewrite')->load($urlRewriteId)->getStoreId() == null) {
82
+ return true;
83
+ } else {
84
+ return false;
85
+ }
86
+ } else {
87
+ return false;
88
+ }
89
+ }
90
+
91
+ // check if enterprise edition
92
+ if ($this->isMageEnterprise()) {
93
+ // check if rewrite exists
94
+ $existingRewrite = Mage::getModel('enterprise_urlrewrite/redirect')->load($urlRewriteId);
95
+
96
+ if ($existingRewrite->exists()) {
97
+ $existingRewrite->delete();
98
+
99
+ if (!Mage::getModel('enterprise_urlrewrite/redirect')->load($urlRewriteId)->exists()) {
100
+ return true;
101
+ } else {
102
+ return false;
103
+ }
104
+ } else {
105
+ return false;
106
+ }
107
+ }
108
+ return false;
109
+ } catch (Exception $e) {
110
+ Springbot_Log::error("Unable to delete URL rewrite with id: " . $urlRewriteId . ': ' . $e->getMessage());
111
+ return false;
112
+ }
113
+ }
114
+
115
+ /**
116
+ * True if the version of Magento currently being run is Enterprise Edition
117
+ *
118
+ * @return boolean
119
+ */
120
+ public function isMageEnterprise()
121
+ {
122
+ return Mage::getConfig()->getModuleConfig('Enterprise_Enterprise')
123
+ && Mage::getConfig()->getModuleConfig('Enterprise_AdminGws')
124
+ && Mage::getConfig()->getModuleConfig('Enterprise_Checkout')
125
+ && Mage::getConfig()->getModuleConfig('Enterprise_Customer');
126
+ }
127
+
128
+ /**
129
+ * True if the version of Magento currently being run is Professional Edition
130
+ *
131
+ * @return boolean
132
+ */
133
+ public function isMageProfessional()
134
+ {
135
+ return Mage::getConfig()->getModuleConfig('Enterprise_Enterprise')
136
+ && !Mage::getConfig()->getModuleConfig('Enterprise_AdminGws')
137
+ && !Mage::getConfig()->getModuleConfig('Enterprise_Checkout')
138
+ && !Mage::getConfig()->getModuleConfig('Enterprise_Customer');
139
+ }
140
+
141
+ /**
142
+ * True if the version of Magento currently being run is Community Edition
143
+ *
144
+ * @return boolean
145
+ */
146
+ public function isMageCommunity()
147
+ {
148
+ return !$this->isMageEnterprise() && !$this->isMageProfessional();
149
+ }
150
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/System/Config/Source/Harvestertype.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_System_Config_Source_Harvestertype
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 'cron', 'label'=>Mage::helper('combine')->__('Cron')),
9
+ array('value' => 'prattler', 'label'=>Mage::helper('combine')->__('Prattler')),
10
+ );
11
+ }
12
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/System/Config/Source/LogFormat.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_System_Config_Source_LogFormat
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 'simple', 'label'=>Mage::helper('combine')->__('Simple')),
9
+ array('value' => 'default', 'label'=>Mage::helper('combine')->__('Default')),
10
+ array('value' => 'expanded', 'label'=>Mage::helper('combine')->__('Expanded')),
11
+ );
12
+ }
13
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/System/Config/Source/LogLevel.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_System_Config_Source_LogLevel
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => '6', 'label'=>Mage::helper('combine')->__('Info')),
9
+ array('value' => '7', 'label'=>Mage::helper('combine')->__('Debug')),
10
+ );
11
+ }
12
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/System/Config/Source/Stability.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_System_Config_Source_Stability
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 'stable', 'label'=>Mage::helper('combine')->__('Stable')),
9
+ array('value' => 'beta', 'label'=>Mage::helper('combine')->__('Beta')),
10
+ //array('value' => 'alpha', 'label'=>Mage::helper('combine')->__('Alpha')),
11
+ );
12
+ }
13
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/System/Config/Source/UrlType.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_System_Config_Source_UrlType
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 'default', 'label'=>Mage::helper('combine')->__('Default')),
9
+ array('value' => 'id_path', 'label'=>Mage::helper('combine')->__('Id Path')),
10
+ array('value' => 'in_store', 'label'=>Mage::helper('combine')->__('In Store')),
11
+ );
12
+ }
13
+ }
Springbot-1.5.2.2/Springbot/Combine/Model/Trackable.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Trackable extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('combine/trackable');
8
+ }
9
+
10
+ public function createOrUpdate()
11
+ {
12
+ if($this->_validate()) {
13
+ if (!$this->getResource()->create($this)) {
14
+ $this->save();
15
+ }
16
+ }
17
+ $trackables = $this->getTrackables();
18
+ $this->_setSbTrackablesCookie($trackables);
19
+ return $this;
20
+ }
21
+
22
+ protected function _validate()
23
+ {
24
+ return !empty($this->_data['type']) &&
25
+ !empty($this->_data['value']) &&
26
+ !empty($this->_data['quote_id']);
27
+ }
28
+
29
+ public function updateTrackables($order)
30
+ {
31
+ foreach ($this->getTrackablesForQuote($order->getId()) as $trackable) {
32
+ $trackable->setOrderId($order->getId())
33
+ ->setCustomerId($order->getCustomerId())
34
+ ->save();
35
+ }
36
+ }
37
+
38
+ public function getTrackablesForQuote($quoteId)
39
+ {
40
+ return Mage::getModel('combine/trackable')->getCollection()
41
+ ->addFieldToFilter('quote_id', $quoteId);
42
+ }
43
+
44
+ public function isObjectEmpty($obj)
45
+ {
46
+ return count((array) $obj) == 0;
47
+ }
48
+
49
+ private function _setSbTrackablesCookie($params)
50
+ {
51
+ if (!$this->isObjectEmpty($params)) {
52
+ $encoded = base64_encode(json_encode($params));
53
+ Springbot_Boss::setCookie(Springbot_Boss::SB_TRACKABLES_COOKIE, $encoded);
54
+ }
55
+ }
56
+
57
+ public function getTrackables()
58
+ {
59
+ $params = Mage::app()->getRequest()->getParams();
60
+ $origParams = Mage::helper('combine/trackable')->getTrackables();
61
+ if ($origParams) {
62
+ $sbParams = clone $origParams;
63
+ }
64
+ else {
65
+ $sbParams = new stdClass();
66
+ }
67
+ foreach ($params as $param => $value) {
68
+ if (preg_match('/^sb_/', $param)) {
69
+ Springbot_Log::debug("Assigning $param from url with $value");
70
+ $sbParams->$param = $value;
71
+ }
72
+ }
73
+ return !$this->isObjectEmpty($sbParams) ? $sbParams : new stdClass();
74
+ }
75
+
76
+ }
Springbot-1.5.2.2/Springbot/Combine/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <springbot translate="title" module="combine">
12
+ <title>Springbot</title>
13
+ </springbot>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
Springbot-1.5.2.2/Springbot/Combine/etc/config.xml ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Springbot_Combine>
5
+ <version>1.5.2.2</version>
6
+ </Springbot_Combine>
7
+ </modules>
8
+ <default>
9
+ <carriers>
10
+ <sbShipping>
11
+ <active>1</active>
12
+ <allowed_methods>sbShipping</allowed_methods>
13
+ <methods>sbShipping</methods>
14
+ <sallowspecific>0</sallowspecific>
15
+ <model>Springbot_Combine_Model_Marketplaces_Shipping</model>
16
+ <name>Amazon Marketplaces Shipping</name>
17
+ <title>Amazon Marketplaces Shipping</title>
18
+ <handling_type>F</handling_type>
19
+ </sbShipping>
20
+ </carriers>
21
+ <payment>
22
+ <sbPayment>
23
+ <active>1</active>
24
+ <model>Springbot_Combine_Model_Marketplaces_Payment</model>
25
+ <order_status>pending</order_status>
26
+ <title>Amazon Marketplaces Payment</title>
27
+ <allowspecific>0</allowspecific>
28
+ <group>offline</group>
29
+ </sbPayment>
30
+ </payment>
31
+ </default>
32
+ <global>
33
+ <models>
34
+ <combine>
35
+ <class>Springbot_Combine_Model</class>
36
+ <resourceModel>combine_resource</resourceModel>
37
+ </combine>
38
+ <combine_resource>
39
+ <class>Springbot_Combine_Model_Resource</class>
40
+ <deprecatedNode>combine_mysql4</deprecatedNode>
41
+ <entities>
42
+ <redirect>
43
+ <table>springbot_redirect</table>
44
+ </redirect>
45
+ <redirect_order>
46
+ <table>springbot_redirect_order</table>
47
+ </redirect_order>
48
+ <trackable>
49
+ <table>springbot_trackable</table>
50
+ </trackable>
51
+ <action>
52
+ <table>springbot_actions</table>
53
+ </action>
54
+ <cron_queue>
55
+ <table>springbot_cron_queue</table>
56
+ </cron_queue>
57
+ <cron_count>
58
+ <table>springbot_cron_count</table>
59
+ </cron_count>
60
+ <marketplaces_remote_order>
61
+ <table>springbot_mp_remote_order</table>
62
+ </marketplaces_remote_order>
63
+ </entities>
64
+ </combine_resource>
65
+ </models>
66
+ <helpers>
67
+ <combine>
68
+ <class>Springbot_Combine_Helper</class>
69
+ </combine>
70
+ </helpers>
71
+ <resources>
72
+ <combine_setup>
73
+ <setup>
74
+ <module>Springbot_Combine</module>
75
+ <class>Springbot_Combine_Model_Resource_Setup</class>
76
+ </setup>
77
+ <connection>
78
+ <use>core_setup</use>
79
+ </connection>
80
+ </combine_setup>
81
+ <combine_write>
82
+ <connection>
83
+ <use>core_write</use>
84
+ </connection>
85
+ </combine_write>
86
+ <combine_read>
87
+ <connection>
88
+ <use>core_read</use>
89
+ </connection>
90
+ </combine_read>
91
+ </resources>
92
+ </global>
93
+ <default>
94
+ <springbot>
95
+ <config>
96
+ <segment_size>25</segment_size>
97
+ <show_notifications>1</show_notifications>
98
+ <remote_update>0</remote_update>
99
+ <stability>stable</stability>
100
+ <email_selector>billing:email,login-email,newsletter</email_selector>
101
+ <email_selector_classes>validate-email</email_selector_classes>
102
+ <sent_store_noemail>0</sent_store_noemail>
103
+ <store_zero_alias>1</store_zero_alias>
104
+ </config>
105
+ <images>
106
+ <use_cached_images>0</use_cached_images>
107
+ </images>
108
+ <debug>
109
+ <log_format>default</log_format>
110
+ <log_level>6</log_level>
111
+ <pretty_print>0</pretty_print>
112
+ <expire_time_days>10</expire_time_days>
113
+ <filesize_limit>10000000</filesize_limit>
114
+ </debug>
115
+ <advanced>
116
+ <harvester_type>prattler</harvester_type>
117
+ <max_jobs>10</max_jobs>
118
+ <nice>0</nice>
119
+ <nohup>0</nohup>
120
+ <worker_count>2</worker_count>
121
+ <sleep_interval>1</sleep_interval>
122
+ <extended_config>0</extended_config>
123
+ <product_url_type>default</product_url_type>
124
+ <assets_domain>d2z0bn1jv8xwtk.cloudfront.net</assets_domain>
125
+ <scrape_coupons>0</scrape_coupons>
126
+ <max_job_time>60</max_job_time>
127
+ <send_inventory>0</send_inventory>
128
+ </advanced>
129
+ <cart_restore>
130
+ <do_restore>1</do_restore>
131
+ <retain_coupon>1</retain_coupon>
132
+ </cart_restore>
133
+ <cron>
134
+ <enabled>0</enabled>
135
+ <max_jobs>10</max_jobs>
136
+ </cron>
137
+ </springbot>
138
+ </default>
139
+ <crontab>
140
+ <jobs>
141
+ <springbot_cron_worker>
142
+ <schedule><cron_expr>* * * * *</cron_expr></schedule>
143
+ <run><model>combine/cron_worker::cronRun</model></run>
144
+ </springbot_cron_worker>
145
+ </jobs>
146
+ </crontab>
147
+ <adminhtml>
148
+ <acl>
149
+ <resources>
150
+ <admin>
151
+ <children>
152
+ <system>
153
+ <children>
154
+ <config>
155
+ <children>
156
+ <springbot translate="title" module="combine">
157
+ <title>Springbot</title>
158
+ </springbot>
159
+ </children>
160
+ </config>
161
+ </children>
162
+ </system>
163
+ </children>
164
+ </admin>
165
+ </resources>
166
+ </acl>
167
+ </adminhtml>
168
+ </config>
Springbot-1.5.2.2/Springbot/Combine/etc/system.xml ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <config>
4
+ <tabs>
5
+ <springbot translate="label">
6
+ <label>Springbot</label>
7
+ <sort_order>88888</sort_order>
8
+ <show_in_default>1</show_in_default>
9
+ <show_in_website>0</show_in_website>
10
+ <show_in_store>0</show_in_store>
11
+ </springbot>
12
+ </tabs>
13
+ <sections>
14
+ <springbot translate="label" module="combine">
15
+ <label>Harvest</label>
16
+ <tab>springbot</tab>
17
+ <frontend_type>text</frontend_type>
18
+ <sort_order>1000</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>0</show_in_website>
21
+ <show_in_store>0</show_in_store>
22
+ <groups>
23
+ <config translate="label">
24
+ <label>System Configuration</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>150</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>0</show_in_website>
29
+ <show_in_store>0</show_in_store>
30
+ <fields>
31
+ <php_exec translate="label">
32
+ <label>PHP Executable</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>10</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>0</show_in_website>
37
+ <show_in_store>0</show_in_store>
38
+ <comment>Use this to define the PHP executable (including any runtime options) that you wish Springbot to use. If you don't know what this means, leave it blank!</comment>
39
+ </php_exec>
40
+ <segment_size translate="label">
41
+ <label>Segment Size</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>12</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>0</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ <comment>Defines the maximum segment inspected during harvest</comment>
48
+ </segment_size>
49
+ <ignore_store_list translate="label">
50
+ <label>Ignore Store List</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>20</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>0</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ <comment>Comma-separated list of stores to ignore. Leave blank to harvest all stores.</comment>
57
+ </ignore_store_list>
58
+ <define_store_list translate="label">
59
+ <label>Explicitly Define Stores to Harvest</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>30</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>0</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ <comment>Comma-separated list of stores to harvest. Leave blank to harvest all stores. Ignores will supercede the values in this list.</comment>
66
+ </define_store_list>
67
+ <account_email translate="label">
68
+ <label>Springbot Username</label>
69
+ <frontend_type>text</frontend_type>
70
+ <sort_order>40</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>0</show_in_website>
73
+ </account_email>
74
+ <account_password translate="label">
75
+ <label>Springbot Password</label>
76
+ <frontend_type>obscure</frontend_type>
77
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
78
+ <sort_order>50</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>0</show_in_website>
81
+ </account_password>
82
+ <stability translate="label">
83
+ <label>Minimum Acceptable Stability</label>
84
+ <frontend_type>select</frontend_type>
85
+ <source_model>combine/system_config_source_stability</source_model>
86
+ <sort_order>70</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>0</show_in_website>
89
+ <show_in_store>0</show_in_store>
90
+ <size>2</size>
91
+ </stability>
92
+ <show_notifications translate="label">
93
+ <label>Show Notifications</label>
94
+ <frontend_type>select</frontend_type>
95
+ <source_model>adminhtml/system_config_source_yesno</source_model>
96
+ <sort_order>80</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>0</show_in_website>
99
+ <show_in_store>0</show_in_store>
100
+ </show_notifications>
101
+ <email_selector translate="label">
102
+ <label>Email Javascript Selector</label>
103
+ <frontend_type>text</frontend_type>
104
+ <sort_order>90</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>0</show_in_website>
107
+ <comment>Comma separated list of IDs for the frontend field where a user enters their email address.</comment>
108
+ </email_selector>
109
+ <email_selector translate="label">
110
+ <label>Email Javascript Selector Classes</label>
111
+ <frontend_type>text</frontend_type>
112
+ <sort_order>100</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>0</show_in_website>
115
+ <comment>Comma separated list of Classes for the frontend field where a user enters their email address.</comment>
116
+ </email_selector>
117
+ <security_token translate="label">
118
+ <label>Security Token</label>
119
+ <frontend_type>text</frontend_type>
120
+ <sort_order>110</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>0</show_in_website>
123
+ <comment>Springbot supplied security token.</comment>
124
+ </security_token>
125
+ </fields>
126
+ </config>
127
+ <images translate="label">
128
+ <label>Images</label>
129
+ <frontend_type>text</frontend_type>
130
+ <sort_order>250</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>0</show_in_website>
133
+ <show_in_store>0</show_in_store>
134
+ <fields>
135
+ <use_cached_images translate="label">
136
+ <label>Use Cached Images</label>
137
+ <frontend_type>select</frontend_type>
138
+ <source_model>adminhtml/system_config_source_yesno</source_model>
139
+ <sort_order>10</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>0</show_in_website>
142
+ <comment>Selecting yes will generate a cached image on your server. Clearing image cache will require a full reharvest. If you do not know what this means, this should be left off.</comment>
143
+ </use_cached_images>
144
+ <!--<pixel_width translate="label">
145
+ <label>Image Pixel Width</label>
146
+ <frontend_type>text</frontend_type>
147
+ <sort_order>20</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>0</show_in_website>
150
+ <can_be_empty>1</can_be_empty>
151
+ <depends>
152
+ <use_cached_images>1</use_cached_images>
153
+ </depends>
154
+ <comment>This sets pixel width for cached images.</comment>
155
+ </pixel_width>-->
156
+ </fields>
157
+ </images>
158
+ <debug translate="label">
159
+ <label>Debug</label>
160
+ <frontend_type>text</frontend_type>
161
+ <sort_order>350</sort_order>
162
+ <show_in_default>1</show_in_default>
163
+ <show_in_website>0</show_in_website>
164
+ <show_in_store>0</show_in_store>
165
+ <fields>
166
+ <log_http translate="label">
167
+ <label>Log HTTP Requests</label>
168
+ <frontend_type>select</frontend_type>
169
+ <source_model>adminhtml/system_config_source_yesno</source_model>
170
+ <sort_order>10</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>0</show_in_website>
173
+ <show_in_store>0</show_in_store>
174
+ <comment>&lt;strong style="color:red"&gt;Warning!&lt;/strong&gt; Please monitor disk space if setting to Debug level, filesize may grow rapidly.</comment>
175
+ </log_http>
176
+ <pretty_print translate="label">
177
+ <label>Pretty Print HTTP Requests in Log</label>
178
+ <frontend_type>select</frontend_type>
179
+ <source_model>adminhtml/system_config_source_yesno</source_model>
180
+ <sort_order>15</sort_order>
181
+ <show_in_default>1</show_in_default>
182
+ <show_in_website>0</show_in_website>
183
+ <show_in_store>0</show_in_store>
184
+ <depends><log_http>1</log_http></depends>
185
+ </pretty_print>
186
+ <log_level translate="label">
187
+ <label>Log Level</label>
188
+ <frontend_type>select</frontend_type>
189
+ <source_model>combine/system_config_source_logLevel</source_model>
190
+ <sort_order>20</sort_order>
191
+ <show_in_default>1</show_in_default>
192
+ <show_in_website>0</show_in_website>
193
+ <show_in_store>0</show_in_store>
194
+ <comment>&lt;strong style="color:red"&gt;Warning!&lt;/strong&gt; For debugging purposes only! It will create very large log files quickly on a busy site.</comment>
195
+ </log_level>
196
+ <log_format translate="label">
197
+ <label>Log Format</label>
198
+ <frontend_type>select</frontend_type>
199
+ <source_model>combine/system_config_source_logFormat</source_model>
200
+ <sort_order>25</sort_order>
201
+ <show_in_default>1</show_in_default>
202
+ <show_in_website>0</show_in_website>
203
+ <show_in_store>0</show_in_store>
204
+ </log_format>
205
+ <expire_time_days translate="label">
206
+ <label>Delete Log Files after X Days</label>
207
+ <frontend_type>text</frontend_type>
208
+ <sort_order>30</sort_order>
209
+ <show_in_default>1</show_in_default>
210
+ <show_in_website>0</show_in_website>
211
+ </expire_time_days>
212
+ <filesize_limit translate="label">
213
+ <label>Filesize Limit</label>
214
+ <frontend_type>text</frontend_type>
215
+ <sort_order>40</sort_order>
216
+ <show_in_default>1</show_in_default>
217
+ <show_in_website>0</show_in_website>
218
+ <comment>Filesize limit in bytes for when to roll log files over</comment>
219
+ </filesize_limit>
220
+ </fields>
221
+ </debug>
222
+ <advanced translate="label">
223
+ <label>Advanced Config</label>
224
+ <frontend_type>text</frontend_type>
225
+ <sort_order>550</sort_order>
226
+ <show_in_default>1</show_in_default>
227
+ <show_in_website>0</show_in_website>
228
+ <show_in_store>0</show_in_store>
229
+ <fields>
230
+ <harvester_type translate="label">
231
+ <label>Harvester Type</label>
232
+ <frontend_type>select</frontend_type>
233
+ <source_model>combine/system_config_source_harvestertype</source_model>
234
+ <sort_order>19</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>0</show_in_website>
237
+ <show_in_store>0</show_in_store>
238
+ <size>2</size>
239
+ </harvester_type>
240
+ <max_jobs translate="label">
241
+ <label>Max cron jobs to run per instance</label>
242
+ <frontend_type>text</frontend_type>
243
+ <sort_order>20</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>0</show_in_website>
246
+ <comment>This is the maximum number of jobs the cron worker will attempt to run each time it is called. Leave blank for unlimited.</comment>
247
+ </max_jobs>
248
+ <nohup translate="label">
249
+ <label>Nohup</label>
250
+ <frontend_type>select</frontend_type>
251
+ <source_model>adminhtml/system_config_source_yesno</source_model>
252
+ <sort_order>70</sort_order>
253
+ <show_in_default>1</show_in_default>
254
+ <show_in_website>0</show_in_website>
255
+ <show_in_store>0</show_in_store>
256
+ </nohup>
257
+ <nice translate="label">
258
+ <label>Nice</label>
259
+ <frontend_type>select</frontend_type>
260
+ <source_model>adminhtml/system_config_source_yesno</source_model>
261
+ <sort_order>80</sort_order>
262
+ <show_in_default>1</show_in_default>
263
+ <show_in_website>0</show_in_website>
264
+ <show_in_store>0</show_in_store>
265
+ </nice>
266
+ <worker_count translate="label">
267
+ <label>Worker Count</label>
268
+ <frontend_type>text</frontend_type>
269
+ <sort_order>90</sort_order>
270
+ <show_in_default>1</show_in_default>
271
+ <show_in_website>0</show_in_website>
272
+ <show_in_store>0</show_in_store>
273
+ </worker_count>
274
+ <sleep_interval translate="label">
275
+ <label>Sleep Interval</label>
276
+ <frontend_type>text</frontend_type>
277
+ <sort_order>100</sort_order>
278
+ <show_in_default>1</show_in_default>
279
+ <show_in_website>0</show_in_website>
280
+ <show_in_store>0</show_in_store>
281
+ </sleep_interval>
282
+ <extended_config translate="label">
283
+ <label>Extended Configuration</label>
284
+ <frontend_type>select</frontend_type>
285
+ <source_model>adminhtml/system_config_source_yesno</source_model>
286
+ <sort_order>110</sort_order>
287
+ <show_in_default>1</show_in_default>
288
+ <show_in_website>0</show_in_website>
289
+ <show_in_store>0</show_in_store>
290
+ </extended_config>
291
+ <product_url_type translate="label">
292
+ <label>Product Url Type</label>
293
+ <frontend_type>select</frontend_type>
294
+ <source_model>combine/system_config_source_urlType</source_model>
295
+ <sort_order>120</sort_order>
296
+ <show_in_default>1</show_in_default>
297
+ <show_in_website>0</show_in_website>
298
+ <show_in_store>0</show_in_store>
299
+ </product_url_type>
300
+ <max_job_time translate="label">
301
+ <label>Max job execution time</label>
302
+ <frontend_type>text</frontend_type>
303
+ <sort_order>130</sort_order>
304
+ <show_in_default>1</show_in_default>
305
+ <show_in_website>0</show_in_website>
306
+ <show_in_store>0</show_in_store>
307
+ </max_job_time>
308
+ <send_inventory translate="label">
309
+ <label>Send inventory data</label>
310
+ <frontend_type>select</frontend_type>
311
+ <source_model>adminhtml/system_config_source_yesno</source_model>
312
+ <sort_order>130</sort_order>
313
+ <show_in_default>1</show_in_default>
314
+ <show_in_website>0</show_in_website>
315
+ </send_inventory>
316
+ </fields>
317
+ </advanced>
318
+ <cart_restore>
319
+ <label>Restore Carts</label>
320
+ <frontend_type>text</frontend_type>
321
+ <sort_order>560</sort_order>
322
+ <show_in_default>1</show_in_default>
323
+ <show_in_website>0</show_in_website>
324
+ <show_in_store>0</show_in_store>
325
+ <fields>
326
+ <do_restore translate="label">
327
+ <label>Restore Carts</label>
328
+ <frontend_type>select</frontend_type>
329
+ <source_model>adminhtml/system_config_source_yesno</source_model>
330
+ <sort_order>90</sort_order>
331
+ <show_in_default>1</show_in_default>
332
+ <show_in_website>0</show_in_website>
333
+ <show_in_store>0</show_in_store>
334
+ </do_restore>
335
+ <retain_coupon translate="label">
336
+ <label>Restore Coupons</label>
337
+ <frontend_type>select</frontend_type>
338
+ <source_model>adminhtml/system_config_source_yesno</source_model>
339
+ <sort_order>110</sort_order>
340
+ <show_in_default>1</show_in_default>
341
+ <show_in_website>0</show_in_website>
342
+ <show_in_store>0</show_in_store>
343
+ </retain_coupon>
344
+ </fields>
345
+ </cart_restore>
346
+ </groups>
347
+ </springbot>
348
+ </sections>
349
+ </config>
Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-install-1.0.0.70.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ /* @var $installer Springbot_Combine_Model_Resource_Setup */
5
+
6
+ $installer->startSetup();
7
+
8
+ try {
9
+ $installer->getSiteDetails();
10
+ if(!Mage::getStoreConfig('springbot/debug/skip_install_log')) {
11
+ $installer->submit();
12
+ }
13
+ }
14
+ catch (Exception $e) {
15
+ Springbot_Log::error($e->getMessage());
16
+ }
17
+ $installer->endSetup();
Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.0.0.70-1.0.0.84.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ /* @var $installer Springbot_Combine_Model_Resource_Setup */
5
+
6
+ $installer->startSetup();
7
+
8
+ $installer->getConnection()->beginTransaction();
9
+
10
+ $installer->run("
11
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('combine/redirect')}`
12
+ (
13
+ `id` INT(11) unsigned NOT NULL auto_increment,
14
+ `email` VARCHAR(255) NOT NULL,
15
+ `redirect_id` CHAR(24) NOT NULL,
16
+ `quote_id` INT(11) DEFAULT NULL,
17
+ `customer_id` INT(11) DEFAULT NULL,
18
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
19
+ PRIMARY KEY (`id`),
20
+ UNIQUE KEY `UNQ_COMPOUND_EMAIL_REDIRECT_ID` (`email`, `redirect_id`),
21
+ KEY `IDX_EMAIL` (`email`)
22
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
23
+ ");
24
+
25
+ $installer->run("
26
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('combine/redirect_order')}`
27
+ (
28
+ `id` INT(11) unsigned NOT NULL auto_increment,
29
+ `redirect_entity_id` INT(11) NOT NULL,
30
+ `order_id` INT(11) DEFAULT NULL,
31
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
32
+ PRIMARY KEY (`id`),
33
+ UNIQUE KEY `UNQ_COMPOUND_REDIRECT_ENTITY_ORDER_ID` (`redirect_entity_id`, `order_id`),
34
+ KEY `IDX_REDIRECT_ENTITY_ID` (`redirect_entity_id`),
35
+ KEY `IDX_ORDER_ID` (`order_id`)
36
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
37
+ ");
38
+
39
+ $installer->endSetup();
Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.0.0.84-1.0.0.88.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ /* @var $installer Springbot_Combine_Model_Resource_Setup */
5
+
6
+ $installer->startSetup();
7
+
8
+ $installer->getConnection()->beginTransaction();
9
+
10
+ $installer->run("
11
+ DELETE FROM `{$installer->getTable('combine/redirect_order')}` WHERE order_id IS NULL;
12
+ ALTER TABLE `{$installer->getTable('combine/redirect_order')}` MODIFY COLUMN order_id int(11) NOT NULL;
13
+ ");
14
+
15
+ $installer->endSetup();
16
+
Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.0.0.88-1.2.0.0.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ /* @var $installer Springbot_Combine_Model_Resource_Setup */
5
+
6
+ $installer->startSetup();
7
+
8
+ $installer->getConnection()->beginTransaction();
9
+
10
+ $session = Mage::getSingleton('core/session');
11
+
12
+ try {
13
+ $installer->run("
14
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('combine/trackable')}`
15
+ (
16
+ `id` INT(11) unsigned NOT NULL auto_increment,
17
+ `email` VARCHAR(255) NOT NULL,
18
+ `type` VARCHAR(255) NOT NULL,
19
+ `value` CHAR(24) NOT NULL,
20
+ `quote_id` INT(11) DEFAULT NULL,
21
+ `order_id` INT(11) DEFAULT NULL,
22
+ `customer_id` INT(11) DEFAULT NULL,
23
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
24
+ PRIMARY KEY (`id`),
25
+ KEY `IDX_EMAIL` (`email`),
26
+ KEY `IDX_QUOTE_ID` (`quote_id`),
27
+ KEY `IDX_ORDER_ID` (`order_id`)
28
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
29
+ ");
30
+ } catch (Exception $e) {
31
+ Springbot_Log::error('Install failed clear and retry: ' . $e->getMessage());
32
+ if (!$session->getSbReinstall()) {
33
+ $session->setSbReinstall(true);
34
+ $installer->reinstallSetupScript('1.0.0.70', '1.2.0.0');
35
+ }
36
+ }
37
+
38
+ $session->setSbReinstall(false);
39
+ $installer->endSetup();
Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.2.0.0-1.2.0.1.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ /* @var $installer Springbot_Combine_Model_Resource_Setup */
5
+
6
+ $installer->startSetup();
7
+
8
+ $installer->getConnection()->beginTransaction();
9
+
10
+ $installer->run("ALTER TABLE `{$installer->getTable('combine/trackable')}` MODIFY COLUMN `value` varchar(255) NOT NULL;");
11
+
12
+ $installer->endSetup();
13
+
Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.2.0.1-1.2.1.0.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ /* @var $installer Springbot_Combine_Model_Resource_Setup */
5
+
6
+ $installer->startSetup();
7
+
8
+ $installer->getConnection()->beginTransaction();
9
+
10
+ try {
11
+ $installer->run("
12
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('combine/cron_queue')}`
13
+ (
14
+ `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
15
+ `method` VARCHAR(255) NOT NULL,
16
+ `args` TEXT NOT NULL,
17
+ `store_id` INT NOT NULL,
18
+ `command_hash` CHAR(40) NOT NULL,
19
+ `queue` VARCHAR(255) NOT NULL DEFAULT 'default',
20
+ `priority` INT UNSIGNED NOT NULL DEFAULT 5,
21
+ `attempts` INT UNSIGNED NOT NULL DEFAULT 0,
22
+ `run_at` DATETIME NULL,
23
+ `locked_at` DATETIME NULL,
24
+ `locked_by` VARCHAR(255) NULL,
25
+ `error` TEXT NULL,
26
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
27
+ UNIQUE (`command_hash`),
28
+ PRIMARY KEY (`id`),
29
+ KEY `IDX_PRIORITY_CREATED_AT` (`priority`, `created_at`)
30
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
31
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('combine/cron_count')}`
32
+ (
33
+ `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
34
+ `entity` VARCHAR(255) NOT NULL,
35
+ `store_id` INT NOT NULL,
36
+ `harvest_id` CHAR(40) NOT NULL,
37
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
38
+ `completed` TIMESTAMP NULL DEFAULT NULL,
39
+ `count` INT UNSIGNED NOT NULL DEFAULT 0,
40
+ PRIMARY KEY (`id`)
41
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
42
+ ");
43
+ } catch (Exception $e) {
44
+ Springbot_Log::error('Springbot 1.2.0.0-1.2.1.0 update failed: ' . $e->getMessage());
45
+ }
46
+
47
+ $installer->endSetup();
Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.3.9.9-1.4.0.0.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ /* @var $installer Springbot_Combine_Model_Resource_Setup */
5
+
6
+ $installer->startSetup();
7
+
8
+ $installer->getConnection()->beginTransaction();
9
+
10
+ $session = Mage::getSingleton('core/session');
11
+
12
+ try {
13
+ $installer->run("
14
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('combine/action')}`
15
+ (
16
+ `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
17
+ `type` ENUM('atc', 'view', 'purchase') NOT NULL,
18
+ `store_id` INT NOT NULL,
19
+ `visitor_ip` VARCHAR(100) NOT NULL,
20
+ `page_url` TEXT NULL,
21
+ `sku` VARCHAR(255) NOT NULL,
22
+ `sku_fulfillment` VARCHAR(255) NOT NULL,
23
+ `quantity` INT UNSIGNED DEFAULT 1,
24
+ `purchase_id` INT UNSIGNED NULL,
25
+ `quote_id` INT UNSIGNED NULL,
26
+ `category_id` INT UNSIGNED NULL,
27
+ `locked_by` VARCHAR(255) NULL,
28
+ `locked_at` DATETIME NULL,
29
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
30
+ PRIMARY KEY (`id`)
31
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
32
+ ");
33
+
34
+
35
+ } catch (Exception $e) {
36
+ Springbot_Log::error('Springbot 1.2.1.0-1.4.0.0 update failed!');
37
+ Springbot_Log::error('Install failed clear and retry. ' . $e->getMessage());
38
+ if (!$session->getSbReinstall()) {
39
+ $session->setSbReinstall(true);
40
+ $installer->reinstallSetupScript('1.2.1.0', '1.4.0.0');
41
+ }
42
+ }
43
+
44
+ try {
45
+ $installer->run("ALTER TABLE `{$installer->getTable('combine/cron_queue')}` ADD COLUMN `next_run_at` DATETIME NULL AFTER `error`;");
46
+ } catch (Exception $e) {
47
+ Springbot_Log::error($e->getMessage());
48
+ }
49
+
50
+ $installer->endSetup();
Springbot-1.5.2.2/Springbot/Combine/sql/combine_setup/mysql4-upgrade-1.4.7.0-1.5.0.0.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ /* @var $installer Springbot_Combine_Model_Resource_Setup */
5
+
6
+ $installer->startSetup();
7
+
8
+ $installer->getConnection()->beginTransaction();
9
+
10
+ $session = Mage::getSingleton('core/session');
11
+
12
+ $table = $installer->getTable('combine/marketplaces_remote_order');
13
+
14
+ try {
15
+ $installStr = "
16
+ CREATE TABLE IF NOT EXISTS `{$table}`
17
+ (
18
+ `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
19
+ `order_id` INT(11) NULL,
20
+ `increment_id` VARCHAR(50) NOT NULL,
21
+ `remote_order_id` VARCHAR(50) NULL,
22
+ `marketplace_type` VARCHAR(50) NULL,
23
+ PRIMARY KEY (`id`),
24
+ UNIQUE KEY `UNQ_REMOTE_ORDER_ID` (`remote_order_id`),
25
+ UNIQUE KEY `UNQ_INCREMENT_ID` (`increment_id`)
26
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27
+ ";
28
+
29
+ Springbot_Log::debug($installStr);
30
+
31
+ $installer->run($installStr);
32
+
33
+ } catch (Exception $e) {
34
+ Springbot_Log::error('Springbot 1.4.7.0-1.5.0.0 update failed!');
35
+ Springbot_Log::error(new Exception('Install failed clear and retry. ' . $e->getMessage()));
36
+ if (!$session->getSbReinstall()) {
37
+ $session->setSbReinstall(true);
38
+ $installer->reinstallSetupScript('1.4.7.0', '1.5.0.0');
39
+ }
40
+ }
41
+
42
+ $installer->endSetup();
Springbot-1.5.2.2/Springbot/Log.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class: Springbot_Log
5
+ *
6
+ * @author Springbot Magento Integration Team <magento@springbot.com>
7
+ * @version 1.4.0.0
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Springbot_Log
11
+ {
12
+ const EMERG = 0; // Emergency: system is unusable
13
+ const ALERT = 1; // Alert: action must be taken immediately
14
+ const CRIT = 2; // Critical: critical conditions
15
+ const ERR = 3; // Error: error conditions
16
+ const WARN = 4; // Warning: warning conditions
17
+ const NOTICE = 5; // Notice: normal but significant condition
18
+ const INFO = 6; // Informational: informational messages
19
+ const DEBUG = 7; // Debug: debug messages
20
+
21
+ const LOGFILE = 'Springbot.log';
22
+ const ERRFILE = 'Springbot.err';
23
+ const HTTPFILE = 'Springbot-Http.log';
24
+
25
+ protected static $_logger;
26
+
27
+ public static function getFormat()
28
+ {
29
+ return Mage::getStoreConfig('springbot/debug/log_format');
30
+ }
31
+
32
+ public static function getExtras()
33
+ {
34
+ $caller = Springbot_Util_Caller::find(4);
35
+ if(self::getFormat() == 'expanded') {
36
+ return array(
37
+ 'className' => $caller->class,
38
+ 'method' => $caller->method,
39
+ 'callType' => $caller->call_type,
40
+ 'line' => $caller->line,
41
+ );
42
+ }
43
+ }
44
+
45
+ public static function logger()
46
+ {
47
+ if(!isset(self::$_logger)) {
48
+ self::$_logger = new Springbot_Util_Logger();
49
+ }
50
+ return self::$_logger;
51
+ }
52
+
53
+ public static function release($filename)
54
+ {
55
+ self::logger()->release($filename);
56
+ }
57
+
58
+ private static function _log($message, $level, $fmt = null, $file = self::LOGFILE)
59
+ {
60
+ if(self::_levelAllowed($level)) {
61
+ if(!$fmt) {
62
+ $fmt = self::getFormat();
63
+ }
64
+ self::logger()->log($message, $level, $file, $fmt, self::getExtras());
65
+ }
66
+ }
67
+
68
+ public static function debug($message)
69
+ {
70
+ self::_log($message, Zend_Log::DEBUG);
71
+ }
72
+
73
+ public static function harvest($message, $remote = false, $storeId = 1)
74
+ {
75
+ if(is_null($storeId)) {
76
+ $storeId = isset(self::$_currentStore) ? self::$_currentStore : 1;
77
+ }
78
+ self::_log($message, Zend_Log::CRIT, 'simple', self::LOGFILE);
79
+
80
+ if($remote) {
81
+ self::remote($message, $storeId);
82
+ }
83
+ }
84
+
85
+ public static function info($message)
86
+ {
87
+ self::_log($message, Zend_Log::INFO);
88
+ }
89
+
90
+ public static function getSpringbotErrorLog()
91
+ {
92
+ return Mage::getBaseDir('log') . DS . Springbot_Log::ERRFILE;
93
+ }
94
+
95
+ public static function getSpringbotLog()
96
+ {
97
+ return Mage::getBaseDir('log') . DS . Springbot_Log::LOGFILE;
98
+ }
99
+
100
+
101
+ public static function error($e)
102
+ {
103
+ if(is_string($e)) {
104
+ $e = new Exception($e);
105
+ }
106
+ self::_log("\n" . $e->__toString(), Zend_Log::ERR, 'default', self::ERRFILE);
107
+ }
108
+
109
+ public static function http($message)
110
+ {
111
+ if(Mage::getStoreConfig('springbot/debug/log_http')) {
112
+ if(Mage::getStoreConfig('springbot/debug/pretty_print')) {
113
+ $message = Zend_Json::prettyPrint($message, array("indent" => " "));
114
+ }
115
+ // lowest possible level - we have another setting controlling this logging
116
+ self::_log($message, Zend_Log::CRIT, 'simple', 'Springbot-Http.log');
117
+ }
118
+ }
119
+
120
+ public static function remote($message, $id = 1, $priority = 5, $alert = false)
121
+ {
122
+ $id = (is_null($id)) ? 1 : $id;
123
+ if($storeId = Mage::helper('combine/harvest')->getSpringbotStoreId($id)) {
124
+ $ar = array(
125
+ 'store_id' => $storeId,
126
+ 'event_time' => Mage::helper('combine')->formatDateTime(),
127
+ 'store_url' => Mage::helper('combine/harvest')->getStoreUrl($id),
128
+ 'remote_addr' => self::getRemoteAddress(),
129
+ 'priority' => $priority,
130
+ 'description' => $message,
131
+ );
132
+
133
+ if($alert) {
134
+ $ar['log_type'] = 'ALERT';
135
+ }
136
+ $struct = array($storeId => $ar);
137
+ $api = Mage::getModel('combine/api');
138
+ $payload = $api->wrap('logs', $struct);
139
+ $api->reinit()->call('logs', $payload);
140
+ }
141
+ }
142
+
143
+ public static function getRemoteAddress()
144
+ {
145
+ if ($remoteIp = Mage::helper('core/http')->getRemoteAddr(true)) {
146
+ return $remoteIp;
147
+ }
148
+ else {
149
+ return null;
150
+ }
151
+ }
152
+
153
+ private static function _levelAllowed($level)
154
+ {
155
+ return $level <= Mage::getStoreConfig('springbot/debug/log_level');
156
+ }
157
+
158
+ public static function printLine($remote = false)
159
+ {
160
+ Springbot_Log::harvest('--------------------------------------------------------------------------------', $remote);
161
+ }
162
+
163
+
164
+
165
+ }
Springbot-1.5.2.2/Springbot/Services.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class: Springbot_Services
5
+ *
6
+ * @author Springbot Magento Integration Team <magento@springbot.com>
7
+ * @version 1.4.0.0
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ * @abstract
10
+ */
11
+ abstract class Springbot_Services extends Varien_Object
12
+ {
13
+ const HARVEST = 0;
14
+ const PARTITION = 1;
15
+ const SEGMENT = 2;
16
+ const CATEGORY = 3;
17
+ const LISTENER = 5;
18
+ const FAILED = 8;
19
+
20
+ protected $_type = 'items';
21
+ protected $_startTime;
22
+
23
+ protected function _construct()
24
+ {
25
+ $this->_startTime = microtime(true);
26
+ }
27
+
28
+ abstract public function run();
29
+
30
+ public function getData($key = '', $index = NULL)
31
+ {
32
+ $val = parent::getData($key);
33
+
34
+ if(!(isset($val) || is_array($val))) {
35
+ //throw new Exception($this->_humanize($key) . ' required for harvest!');
36
+ return null;
37
+ } else {
38
+ return $val;
39
+ }
40
+ }
41
+
42
+ public function getHarvestId()
43
+ {
44
+ return parent::getData('harvest_id');
45
+ }
46
+
47
+ public function hasRange()
48
+ {
49
+ return isset($this->_data['start_id']) || isset($this->_data['stop_id']);
50
+ }
51
+
52
+ public function getStoreId()
53
+ {
54
+ if($storeId = parent::getData('store_id')) {
55
+ return $storeId;
56
+ } else {
57
+ return Mage::app()->getStore()->getStoreId();
58
+ }
59
+ return 0;
60
+ }
61
+
62
+ public function getSpringbotStoreId()
63
+ {
64
+ return Mage::helper('combine/harvest')
65
+ ->getSpringbotStoreId($this->getStoreId());
66
+ }
67
+
68
+ public function getStartId()
69
+ {
70
+ $value = parent::getData('start_id');
71
+ return isset($value) ? $value : 0;
72
+ }
73
+
74
+ public function getStopId()
75
+ {
76
+ return parent::getData('stop_id');
77
+ }
78
+
79
+ public function getFailedStartId()
80
+ {
81
+ return parent::getData('failed_start_id');
82
+ }
83
+
84
+ public function getFailedStopId()
85
+ {
86
+ return parent::getData('failed_stop_id');
87
+ }
88
+
89
+ public function getIsResume()
90
+ {
91
+ return isset($this->_data['resume']);
92
+ }
93
+
94
+ public function getLastFailedPartition()
95
+ {
96
+ return isset($this->_data['failed_partition']);
97
+ }
98
+
99
+ public function getForce()
100
+ {
101
+ return isset($this->_data['force']) && $this->_data['force'] === true;
102
+ }
103
+
104
+ public function getSegmentMin($harvester)
105
+ {
106
+ return $harvester->getSegmentMin();
107
+ }
108
+
109
+ public function getSegmentMax($harvester)
110
+ {
111
+ return $harvester->getSegmentMax();
112
+ }
113
+
114
+ public function getRuntime()
115
+ {
116
+ return number_format(microtime(true) - $this->_startTime, 3, '.', '');
117
+ }
118
+
119
+ public function doFinally() {
120
+
121
+ }
122
+
123
+ protected function _humanize($var)
124
+ {
125
+ return ucfirst(preg_replace('/\_/', ' ', $var));
126
+ }
127
+
128
+ protected function _getStatus()
129
+ {
130
+ return Mage::getSingleton('combine/cron_manager_status');
131
+ }
132
+ }
Springbot-1.5.2.2/Springbot/Services/Cmd/Forecast.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Cmd_Forecast extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ if ($storeId = $this->getStoreId()) {
8
+ $harvestId = Mage::helper('combine/harvest')->initRemoteHarvest($storeId);
9
+ $this->forecastStore($storeId, $harvestId);
10
+ }
11
+ else {
12
+ $this->forecastAllStores();
13
+ }
14
+ }
15
+
16
+ public function forecastAllStores() {
17
+ foreach (Mage::helper('combine/harvest')->getStoresToHarvest() as $store) {
18
+ $harvestId = Mage::helper('combine/harvest')->initRemoteHarvest($store->getStoreId());
19
+ $this->forecastStore($store->getStoreId(), $harvestId);
20
+ }
21
+ }
22
+
23
+ public function forecastStore($storeId, $harvestId)
24
+ {
25
+ foreach (Springbot_Services_Cmd_Harvest::getClasses() as $key) {
26
+ $keyUpper = ucwords($key);
27
+ $harvestClassName = 'Springbot_Services_Harvest_' . $keyUpper;
28
+ $harvestObject = new $harvestClassName;
29
+ $collection = $harvestObject->getCollection($storeId);
30
+ Mage::helper('combine/harvest')->forecast($collection, $storeId, $keyUpper, $harvestId);
31
+ }
32
+ }
33
+
34
+ }
Springbot-1.5.2.2/Springbot/Services/Cmd/Halt.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Cmd_Halt extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ if (isset($this->_data['halt_command'])) {
8
+ $out = Springbot_Boss::halt($this->getHaltCommand());
9
+ }
10
+ else {
11
+ $out = Springbot_Boss::halt();
12
+ }
13
+ print $out . PHP_EOL;
14
+ }
15
+ }
Springbot-1.5.2.2/Springbot/Services/Cmd/Harvest.php ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Cmd_Harvest extends Springbot_Services
4
+ {
5
+ const SEGMENT_SIZE = 2000;
6
+
7
+ protected $_harvestId;
8
+
9
+ // Defines order which entities are harvested during a full harvest
10
+ protected static $_classes = array(
11
+ 'categories',
12
+ 'attributeSets',
13
+ 'customerAttributeSets',
14
+ 'products',
15
+ 'purchases',
16
+ 'customers',
17
+ 'guests',
18
+ 'subscribers',
19
+ 'coupons',
20
+ 'rules',
21
+ //'carts',
22
+ );
23
+
24
+
25
+ public static function getClasses()
26
+ {
27
+ // 1.3 does not have salesrule module
28
+ if (!mageFindClassFile('Mage_SalesRule_Model_Coupons')) {
29
+ self::$_classes = array_merge(array_diff(
30
+ self::$_classes, array('coupons', 'rules')
31
+ ));
32
+ }
33
+
34
+ if (Mage::getStoreConfig('springbot/advanced/send_inventory') == 1) {
35
+ self::$_classes[] = 'inventories';
36
+ }
37
+
38
+ return self::$_classes;
39
+ }
40
+
41
+
42
+ protected function _init()
43
+ {
44
+ $service = new Springbot_Services_Store_Register;
45
+
46
+ // Init all stores upfront
47
+ foreach ($this->getHelper()->getStoresToHarvest() as $store) {
48
+ $service->setStoreId($store->getStoreId())->run();
49
+ }
50
+
51
+ // Have to clear cache in parent thread after config set
52
+ Mage::getConfig()->cleanCache();
53
+ Springbot_Log::debug(Mage::getStoreConfig('springbot'));
54
+ }
55
+
56
+ public function run()
57
+ {
58
+ Springbot_Log::debug(__METHOD__);
59
+
60
+ if ($this->getIsResume()) {
61
+ $this->_resumeHarvest();
62
+ } else if ($this->hasClass() && $this->hasRange()) {
63
+ $this->_harvest($this->getClass(), $this->getStoreId());
64
+ } else if ($this->hasClass()) {
65
+ $this->_segmentHarvest($this->getClass(), $this->getStoreId());
66
+ } else {
67
+ $this->_fullHarvest();
68
+ }
69
+ }
70
+
71
+ protected function _fullHarvest()
72
+ {
73
+ if ($this->getHelper()->isHarvestRunning()) {
74
+ throw new Exception('Harvest is running already!');
75
+ }
76
+
77
+ $this->_init();
78
+
79
+ // Iterate all stores
80
+ foreach ($this->getHelper()->getStoresToHarvest() as $store) {
81
+ $this->_harvestId = Mage::helper('combine/harvest')->initRemoteHarvest($store->getStoreId());
82
+ $this->_harvestStore($store, self::getClasses(), $this->_harvestId);
83
+ }
84
+ }
85
+
86
+ protected function _resumeHarvest()
87
+ {
88
+ $harvestCursor = Mage::getStoreConfig('springbot/config/harvest_cursor');
89
+
90
+ if (!$harvestCursor) {
91
+ Springbot_Log::remote('Resume harvest command received, no valid harvest cursor found: Cursor value: ' . $harvestCursor);
92
+ } else {
93
+ list($lastClassCompleted, $partition, $storeId) = explode('|', $harvestCursor);
94
+ foreach ($this->getHelper()->getStoresToHarvest() as $store) {
95
+ $this->_harvestId = Mage::helper('combine/harvest')->initRemoteHarvest($store->getStoreId());
96
+ if ($store->getStoreId() == $storeId) {
97
+ // Only harvest classes for this store that have not been fully or partially harvested yet
98
+ $classesLeft = $this->_getClassesSubset($lastClassCompleted);
99
+ $this->_partialHarvestClass($store, $lastClassCompleted, $partition, $this->_harvestId);
100
+ $this->_harvestStore($store, $classesLeft, $this->_harvestId);
101
+ } else if ($store->getStoreId() > $storeId) {
102
+ // Harvest has not begun for this store so harvest all classes
103
+ $this->_harvestStore($store, self::getClasses(), $this->_harvestId);
104
+ }
105
+ }
106
+ }
107
+ }
108
+
109
+ protected function _partialHarvestClass(Mage_Core_Model_Store $store, $class, $partition, $harvestId)
110
+ {
111
+ Springbot_Log::debug("Partial harvest started {$store->getStoreId()} | $class | {$harvestId}");
112
+ Springbot_Boss::scheduleJob(
113
+ 'cmd:harvest',
114
+ array(
115
+ 's' => $store->getStoreId(),
116
+ 'c' => $class,
117
+ 'v' => $harvestId,
118
+ 'i' => $partition,
119
+ ),
120
+ Springbot_Services::CATEGORY,
121
+ 'default',
122
+ $store->getStoreId()
123
+ );
124
+ }
125
+
126
+ protected function _harvestStore(Mage_Core_Model_Store $store, array $classes, $harvestId)
127
+ {
128
+ $this->_logStoreHeader($store);
129
+
130
+ $forecastService = new Springbot_Services_Cmd_Forecast;
131
+ $forecastService->forecastStore($store->getStoreId(), $this->_harvestId);
132
+ $this->_registerInstagramRewrites($store);
133
+
134
+ foreach ($classes as $class) {
135
+ Springbot_Boss::scheduleJob(
136
+ 'cmd:harvest',
137
+ array(
138
+ 's' => $store->getStoreId(),
139
+ 'c' => $class,
140
+ 'v' => $harvestId,
141
+ ),
142
+ Springbot_Services::CATEGORY,
143
+ 'default',
144
+ $store->getStoreId()
145
+ );
146
+ Springbot_Boss::scheduleJob(
147
+ 'work:report',
148
+ array(
149
+ 's' => $store->getStoreId(),
150
+ 'c' => $class,
151
+ 'v' => $harvestId,
152
+ ),
153
+ Springbot_Services::CATEGORY,
154
+ 'default',
155
+ $store->getStoreId()
156
+ );
157
+ }
158
+ Springbot_Boss::scheduleJob(
159
+ 'store:finalize',
160
+ array('s' => $store->getStoreId()),
161
+ Springbot_Services::CATEGORY,
162
+ 'default',
163
+ $store->getStoreId()
164
+ );
165
+
166
+ }
167
+
168
+
169
+
170
+ private function _registerInstagramRewrites($store)
171
+ {
172
+ if ($springbotStoreId = $this->getHelper()->getSpringbotStoreId($store->getStoreId())) {
173
+ // cache the store name to sanitize
174
+ $storeName = $store->getGroup()->getName();
175
+
176
+ // strip out the dot if it exists in store name
177
+ if (strpos($storeName, ".") !== false) {
178
+ $storeName = str_replace('.', '', $storeName);
179
+ }
180
+
181
+ $rewrite = Mage::getModel('combine/rewrite');
182
+ $encodedStoreName = urlencode($storeName);
183
+
184
+ $path = "springbot/{$store->getStoreId()}";
185
+ $targetPath = "https://app.springbot.com/i/{$springbotStoreId}/{$encodedStoreName}";
186
+ $rewrite->createRewrite($store, $path, 'i', $targetPath);
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Harvests a class segment for a specific store. Possible flags are:
192
+ *
193
+ * -s store_id, required
194
+ * -i _start_:_stop_ will limit the collection to be partitioned - both sides are optional
195
+ * -v harvest_id
196
+ *
197
+ * This will forecast the collection to be harvested, and it will then be split up into
198
+ * smaller chunks, each of which will be scheduled.
199
+ *
200
+ * @param string $key
201
+ * @param int $storeId
202
+ */
203
+ protected function _harvest($key, $storeId)
204
+ {
205
+ $count = 0;
206
+ $keyUpper = ucwords($key);
207
+
208
+ Springbot_Log::harvest("Harvesting {$keyUpper}");
209
+
210
+ $collection = $this->_getCollection($keyUpper, $storeId);
211
+
212
+ $scheduler = Mage::getModel('combine/cron_queue_batch');
213
+
214
+ foreach (Mage::helper('combine/harvest')->partitionCollection($collection) as $partition) {
215
+ $count++;
216
+ $scheduler->schedule(
217
+ "harvest:{$key}",
218
+ array(
219
+ 's' => $storeId,
220
+ 'i' => (string)$partition,
221
+ 'c' => $key,
222
+ 'v' => $this->getHarvestId(),
223
+ ),
224
+ Springbot_Services::PARTITION,
225
+ 'partition', // Partition queue
226
+ $storeId
227
+ );
228
+ }
229
+ $scheduler->insert();
230
+
231
+ Springbot_Log::harvest("{$count} partitions created for {$keyUpper}");
232
+ }
233
+
234
+ protected function _segmentHarvest($key, $storeId)
235
+ {
236
+ $keyUpper = ucwords($key);
237
+ $collection = $this->_getCollection($keyUpper, $storeId);
238
+
239
+ Springbot_Log::harvest("Segmenting {$keyUpper}");
240
+ $scheduler = Mage::getModel('combine/cron_queue_batch');
241
+
242
+ $this->_reportHarvestStartTime($this->getHarvestId(), $storeId, $key);
243
+
244
+ $this->getHelper()->forecast($collection, $storeId, $keyUpper, $this->getHarvestId());
245
+
246
+ $count = 0;
247
+ foreach (Mage::helper('combine/harvest')->partitionCollection($collection, self::SEGMENT_SIZE) as $partition) {
248
+ $count++;
249
+ $scheduler->schedule(
250
+ "cmd:harvest",
251
+ array(
252
+ 's' => $storeId,
253
+ 'c' => $key,
254
+ 'i' => (string)$partition,
255
+ 'v' => $this->getHarvestId(),
256
+ ),
257
+ Springbot_Services::SEGMENT,
258
+ 'default',
259
+ $storeId
260
+ );
261
+ }
262
+ $scheduler->insert();
263
+ Springbot_Log::harvest("{$count} segments created for {$key}");
264
+ }
265
+
266
+ private function _reportHarvestStartTime($harvestId, $storeId, $type)
267
+ {
268
+ $cronCount = Mage::getModel('combine/cron_count');
269
+
270
+ // Create the cron count row for the entity if it doesn't exist already.
271
+ $cronCount->increaseCount($storeId, $harvestId, $type, 0);
272
+
273
+ $started = $cronCount->getEntityStartTime($storeId, $harvestId, $type);
274
+ $params = array(
275
+ 'store_id' => $this->getHelper()->getSpringbotStoreId($storeId),
276
+ 'type' => $type,
277
+ 'started' => $started,
278
+ );
279
+ $api = Mage::getModel('combine/api');
280
+ $payload = $api->wrap('harvest_segments', array($params));
281
+ if (!is_null($harvestId)) {
282
+ return $api->put("harvests/{$harvestId}", $payload);
283
+ }
284
+ }
285
+
286
+ /**
287
+ * @return Varien_Db_Collection_Abstract
288
+ */
289
+ protected function _getCollection($type, $storeId)
290
+ {
291
+ Springbot_Log::debug("Building collection $type for partition => {$this->getPartition()}");
292
+ $harvestServiceClassName = 'Springbot_Services_Harvest_' . $type;
293
+ $harvestServiceObject = new $harvestServiceClassName;
294
+
295
+ return $harvestServiceObject->getCollection($storeId, $this->getPartition());
296
+ }
297
+
298
+
299
+ public function getPartition()
300
+ {
301
+ return new Springbot_Util_Partition($this->getStartId(), $this->getStopId());
302
+ }
303
+
304
+ public function getHarvestId()
305
+ {
306
+ return isset($this->_harvestId) ? $this->_harvestId : $this->_data['harvest_id'];
307
+ }
308
+
309
+ public function getHelper()
310
+ {
311
+ return Mage::helper('combine/harvest');
312
+ }
313
+
314
+ /**
315
+ * When resuming a harvest, get all class types that have not been fully or partially harvested yet
316
+ *
317
+ * @param $lastClassCompleted
318
+ *
319
+ * @return array
320
+ */
321
+ private function _getClassesSubset($lastClassCompleted)
322
+ {
323
+ $classesLeft = array();
324
+ $foundLastClass = false;
325
+ foreach (self::getClasses() as $class) {
326
+ if ($foundLastClass) {
327
+ $classesLeft[] = $class;
328
+ }
329
+ if ($class == $lastClassCompleted) {
330
+ $foundLastClass = true;
331
+ }
332
+ }
333
+
334
+ return $classesLeft;
335
+ }
336
+
337
+ private function _logStoreHeader(Mage_Core_Model_Store $store)
338
+ {
339
+ $helper = Mage::helper('combine/store')->setStore($store);
340
+
341
+ Springbot_Log::printLine(true);
342
+ Springbot_Log::harvest("Harvesting Store {$store->getUrl()} => {$store->getId()}/{$helper->getSpringbotStoreId()}", true);
343
+ Springbot_Log::harvest("Harvest ID => {$this->_harvestId}\nGUID => {$helper->getGuid()}\nEmail => {$helper->getAccountEmail()}", true);
344
+ Springbot_Log::printLine(true);
345
+ }
346
+
347
+ }
Springbot-1.5.2.2/Springbot/Services/Cmd/Healthcheck.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Cmd_Healthcheck extends Springbot_Services
4
+ {
5
+ const SUCCESSFUL_RESPONSE = 'ok';
6
+
7
+ public function run()
8
+ {
9
+ // Run checkin process
10
+ $this->healthcheck($this->getStoreId());
11
+
12
+ // Scrape coupons
13
+ if(Mage::getStoreConfig('springbot/advanced/scrape_coupons')) {
14
+ $this->_scrapeEntities();
15
+ }
16
+
17
+ // Inspect, rollover and delete logs
18
+ $rollover = new Springbot_Util_Log_Rollover();
19
+ $rollover->expireLogs();
20
+ $rollover->ensureLogSize();
21
+ $rollover->reset();
22
+
23
+ // Clean orphaned jobs
24
+ $cleanup = new Springbot_Services_Work_Cleanup();
25
+ $cleanup->run();
26
+
27
+ Springbot_Log::debug("Healthcheck job complete");
28
+ }
29
+
30
+ public function healthcheck($storeId)
31
+ {
32
+ Springbot_Log::debug("Running healthcheck for $storeId");
33
+
34
+ if ($storeId) {
35
+ $springbotStoreId = Mage::helper('combine/harvest')->getSpringbotStoreId($storeId);
36
+ $packageVersion = Mage::getConfig()->getModuleConfig("Springbot_Combine")->version;
37
+
38
+ $result = Mage::getModel('combine/api')
39
+ ->call(
40
+ 'harvest_master',
41
+ '{"store_id":"'.$springbotStoreId.'","version":"'. $packageVersion .'"}'
42
+ );
43
+
44
+ if (isset($result['status']) && $result['status'] == self::SUCCESSFUL_RESPONSE) {
45
+ foreach ($result['commands'] as $cmd) {
46
+ $task = $this->_makeTaskInstance($cmd);
47
+ $task->run();
48
+ }
49
+ }
50
+ }
51
+ }
52
+
53
+ public function doFinally()
54
+ {
55
+ Springbot_Log::debug("Scheduling future jobs from healthcheck job");
56
+ Springbot_Boss::scheduleFutureJobs($this->getStoreId());
57
+ }
58
+
59
+ private function _scrapeEntities()
60
+ {
61
+ $lastPostedCouponId = Mage::getStoreConfig('springbot/tmp/last_coupon_id');
62
+ if (!$lastPostedCouponId) {
63
+ $lastPostedCouponId = 0;
64
+ }
65
+ $couponsToPost = Mage::getModel('salesrule/coupon')->getCollection()
66
+ ->addFieldToFilter('coupon_id', array('gt' => $lastPostedCouponId));
67
+
68
+ $couponsToPost->getSelect()->order('coupon_id', 'ASC');
69
+ $lastFoundCouponId = null;
70
+ foreach ($couponsToPost as $couponToPost) {
71
+ Springbot_Boss::scheduleJob('post:coupon', array('i' => $couponToPost->getId()), Springbot_Services::LISTENER, 'listener');
72
+ $lastFoundCouponId = $couponToPost->getId();
73
+ }
74
+ if (($lastFoundCouponId) && ($lastPostedCouponId != $lastFoundCouponId)) {
75
+ Mage::getModel('core/config')->saveConfig('springbot/tmp/last_coupon_id', $lastFoundCouponId, 'default', 0);
76
+ Mage::getConfig()->cleanCache();
77
+ }
78
+ }
79
+
80
+ private function _makeTaskInstance($cmd)
81
+ {
82
+ $taskname = $cmd['command'];
83
+ return Springbot_Services_Tasks::makeTask($taskname, $this->_getParams($cmd));
84
+ }
85
+
86
+ private function _getParams($cmd)
87
+ {
88
+ if(is_array($cmd['data'])) {
89
+ return array_merge($cmd['data'], $this->getData());
90
+ } else {
91
+ return $this->getData();
92
+ }
93
+ }
94
+
95
+
96
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Springbot_Services_Harvest extends Springbot_Services
4
+ {
5
+
6
+ public function reportCount($harvester)
7
+ {
8
+ $mb = round(memory_get_peak_usage(true) / pow(1024, 2), 2);
9
+
10
+ $processedCount = $harvester->getProcessedCount();
11
+ $segmentMin = $harvester->getSegmentMin();
12
+ $segmentMax = $harvester->getSegmentMax();
13
+ $apiModel = $harvester->getApiModel();
14
+
15
+ $msg = "{$apiModel} block {$segmentMin}:{$segmentMax} posted [{$processedCount} overall] | {$mb}MB | {$this->getRuntime()} sec";
16
+
17
+ Springbot_Log::harvest($msg);
18
+ $countObject = Mage::getModel('combine/cron_count');
19
+ $countObject->increaseCount($this->getStoreId(), $this->getHarvestId(), $harvester->getApiModel(), $harvester->getProcessedCount());
20
+
21
+ return $harvester->getProcessedCount();
22
+ }
23
+
24
+ public function getDataSource()
25
+ {
26
+ return Springbot_Boss::SOURCE_BULK_HARVEST;
27
+ }
28
+
29
+ public static function limitCollection($collection, Springbot_Util_Partition $partition, $idColumn = 'entity_id')
30
+ {
31
+ if ($partition->start) {
32
+ $collection->addFieldToFilter($idColumn, array('gteq' => $partition->start));
33
+ }
34
+
35
+ if ($partition->stop) {
36
+ $collection->addFieldToFilter($idColumn, array('lteq' => $partition->stop));
37
+ }
38
+ return $collection;
39
+ }
40
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/AttributeSets.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_AttributeSets extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ if ($this->getStoreId()) {
8
+ $collection = $this->getCollection($this->getStoreId());
9
+ $api = Mage::getModel('combine/api');
10
+ $harvester = new Springbot_Combine_Model_Harvest_AttributeSets($api, $collection, $this->getDataSource());
11
+ $harvester->setStoreId($this->getStoreId());
12
+ $harvester->harvest();
13
+ $this->reportCount($harvester);
14
+ }
15
+ else {
16
+ throw new Exception("Missing store id for Attribute Sets harvest");
17
+ }
18
+
19
+ }
20
+
21
+ public function getCollection($storeId, $partition = null)
22
+ {
23
+ $collection = Mage::helper('combine/attributes')->getAttributeSets();
24
+ //self::getCollection($this->getStoreId())
25
+
26
+ $collection->addFieldToFilter('attribute_set_id', array('gt' => $this->getStartId()));
27
+
28
+ if ($this->getStopId() !== null) {
29
+ $collection->addFieldToFilter('attribute_set_id', array('lteq' => $this->getStopId()));
30
+ }
31
+
32
+ return $collection;
33
+ }
34
+
35
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/Carts.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_Carts extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ if ($this->getStoreId()) {
8
+ $collection = $this->getCollection($this->getStoreId());
9
+ $api = Mage::getModel('combine/api');
10
+ $harvester = new Springbot_Combine_Model_Harvest_Carts($api, $collection, $this->getDataSource());
11
+ $harvester->setStoreId($this->getStoreId());
12
+ $harvester->harvest();
13
+ return $this->reportCount($harvester);
14
+ }
15
+ else {
16
+ throw new exception("Store id missing for carts harvest");
17
+ }
18
+ }
19
+
20
+ public function getCollection($storeId, $partition = null)
21
+ {
22
+ $collection = Mage::getModel('sales/quote')->getCollection();
23
+ $collection->addFieldToFilter('customer_email', array('notnull' => true));
24
+ $collection->addFieldToFilter('store_id', $storeId);
25
+ $collection->addFieldToFilter('is_active', 1);
26
+
27
+ if ($this->getStartId() !== null) {
28
+ $collection->addFieldToFilter('entity_id', array('gt' => $this->getStartId()));
29
+ }
30
+ if ($this->getStopId()) {
31
+ $collection->addFieldToFilter('entity_id', array('lteq' => $this->getStopId()));
32
+ }
33
+ if ($partition) {
34
+ $collection = parent::limitCollection($collection, $partition);
35
+ }
36
+
37
+ return $collection;
38
+ }
39
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/Categories.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_Categories extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ if ($this->getStoreId()) {
8
+ $collection = $this->getCollection($this->getStoreId());
9
+ $api = Mage::getModel('combine/api');
10
+ $harvester = new Springbot_Combine_Model_Harvest_Categories($api, $collection, $this->getDataSource());
11
+ $harvester->setStoreId($this->getStoreId());
12
+ $harvester->harvest();
13
+ return $this->reportCount($harvester);
14
+ }
15
+ else {
16
+ throw new Exception('Store id missing for category harvest');
17
+ }
18
+ }
19
+
20
+ public function getCollection($storeId, $partition = null)
21
+ {
22
+ $rootCategory = Mage::app()->getStore($storeId)->getRootCategoryId();
23
+ $collection = Mage::getModel('catalog/category')->getCollection();
24
+ if ($this->getStopId() !== null) {
25
+ $collection->addFieldToFilter('entity_id', array('lteq' => $this->getStopId()));
26
+ }
27
+ if ($this->getStartId() !== null) {
28
+ $collection->addFieldToFilter('entity_id', array('gt' => $this->getStartId()));
29
+ }
30
+ $collection->addAttributeToFilter(
31
+ array(
32
+ array(
33
+ 'attribute' => 'entity_id',
34
+ 'eq' => $rootCategory
35
+ ),
36
+ array(
37
+ 'attribute' => 'path',
38
+ 'like' => "1/{$rootCategory}/%"
39
+ ),
40
+ )
41
+ );
42
+
43
+ if ($partition) {
44
+ $collection = parent::limitCollection($collection, $partition);
45
+ }
46
+
47
+ return $collection;
48
+ }
49
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/Coupons.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_Coupons extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ $collection = $this->getCollection($this->getStoreId());
8
+ $api = Mage::getModel('combine/api');
9
+ $harvester = new Springbot_Combine_Model_Harvest_Coupons($api, $collection, $this->getDataSource());
10
+ $harvester->harvest();
11
+ $this->reportCount($harvester);
12
+ }
13
+
14
+ public function getCollection($storeId, $partition = null)
15
+ {
16
+ if(!mageFindClassFile('Mage_SalesRule_Model_Coupons')) {
17
+ return array();
18
+ }
19
+
20
+ // Filter based on the website_ids string
21
+ $collection = Mage::getModel('salesrule/coupon')->getCollection();
22
+
23
+ if ($partition) {
24
+ $collection = parent::limitCollection($collection, $partition, 'coupon_id');
25
+ }
26
+ if ($this->getStartId() !== null) {
27
+ $collection->addFieldToFilter('coupon_id', array('gt' => $this->getStartId()));
28
+ }
29
+ if ($this->getStopId()) {
30
+ $collection->addFieldToFilter('coupon_id', array('lteq' => $this->getStopId()));
31
+ }
32
+
33
+ return $collection;
34
+ }
35
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/CustomerAttributeSets.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_CustomerAttributeSets extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ $collection = $this->getCollection();
8
+ $api = Mage::getModel('combine/api');
9
+ $harvester = new Springbot_Combine_Model_Harvest_CustomerAttributeSets($api, $collection, $this->getDataSource());
10
+ $harvester->setStoreId($this->getStoreId());
11
+ $harvester->harvest();
12
+ $this->reportCount($harvester);
13
+ }
14
+
15
+ public function getCollection()
16
+ {
17
+ return Mage::helper('combine/attributes')->getCustomerAttributeSets();
18
+ }
19
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/Customers.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_Customers extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ $api = Mage::getModel('combine/api');
8
+ $collection = $this->getCollection($this->getStoreId());
9
+ $harvester = new Springbot_Combine_Model_Harvest_Customers($api, $collection, $this->getDataSource());
10
+ $harvester->harvest();
11
+ return $this->reportCount($harvester);
12
+ }
13
+
14
+ public function getCollection($storeId, $partition = null)
15
+ {
16
+ $collection = Mage::getModel('customer/customer')->getCollection();
17
+
18
+ if ($storeId == Mage::getStoreConfig('springbot/config/store_zero_alias')) {
19
+ $collection->addFieldToFilter('store_id',
20
+ array(
21
+ array('eq' => 0),
22
+ array('eq' => $storeId),
23
+ )
24
+ );
25
+ }
26
+ else {
27
+ $collection->addFieldToFilter('store_id', $storeId);
28
+ }
29
+
30
+
31
+ if ($this->getStartId() !== null) {
32
+ $collection->addFieldToFilter('entity_id', array('gt' => $this->getStartId()));
33
+ }
34
+
35
+ if ($this->getStopId()) {
36
+ $collection->addFieldToFilter('entity_id', array('lteq' => $this->getStopId()));
37
+ }
38
+
39
+ if($partition) {
40
+ $collection = parent::limitCollection($collection, $partition);
41
+ }
42
+ return $collection;
43
+ }
44
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/Guests.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_Guests extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ $collection = $this->getCollection($this->getStoreId());
8
+ $api = Mage::getModel('combine/api');
9
+ $harvester = new Springbot_Combine_Model_Harvest_Guests($api, $collection, $this->getDataSource());
10
+ $harvester->harvest();
11
+
12
+ return $this->reportCount($harvester);
13
+ }
14
+
15
+ public function getCollection($storeId, $partition = null)
16
+ {
17
+ $collection = Mage::getModel('sales/order')->getCollection();
18
+ $collection->addFieldToFilter('store_id', $storeId);
19
+ $collection->addFieldToFilter('customer_is_guest', true);
20
+
21
+ if ($this->getStartId() !== null) {
22
+ $collection->addFieldToFilter('entity_id', array('gt' => $this->getStartId()));
23
+ }
24
+ if ($this->getStopId()) {
25
+ $collection->addFieldToFilter('entity_id', array('lteq' => $this->getStopId()));
26
+ }
27
+ if ($partition) {
28
+ $collection = parent::limitCollection($collection, $partition);
29
+ }
30
+
31
+ if (method_exists($collection, 'groupByAttribute')) {
32
+ // Magento 1.3.*
33
+ $collection->groupByAttribute('customer_email');
34
+ }
35
+ else if($collection->getSelect() instanceof Zend_Db_Select) {
36
+ // Deduplicate by customer email
37
+ try {
38
+ $collection->getSelect()->order('increment_id')->group('customer_email');
39
+ }
40
+ catch (Exception $e) {
41
+ Springbot_Log::error($e->getMessage());
42
+ }
43
+ }
44
+
45
+ return $collection;
46
+ }
47
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/Inventories.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_Inventories extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ if ($this->_sendInventory()) {
8
+ $collection = $this->getCollection($this->getStoreId());
9
+ $api = Mage::getModel('combine/api');
10
+ $harvester = new Springbot_Combine_Model_Harvest_Inventories($api, $collection, $this->getDataSource());
11
+ $harvester->setStoreId($this->getStoreId());
12
+ $harvester->harvest();
13
+
14
+ return $this->reportCount($harvester);
15
+ }
16
+ }
17
+
18
+ public function getCollection($storeId, $partition = null)
19
+ {
20
+ $collection = Mage::getModel('cataloginventory/stock_item')->getCollection();
21
+
22
+ if ($this->getStartId() !== null) {
23
+ $collection->addFieldToFilter('item_id', array('gt' => $this->getStartId()));
24
+ }
25
+ if ($this->getStopId()) {
26
+ $collection->addFieldToFilter('item_id', array('lteq' => $this->getStopId()));
27
+ }
28
+
29
+ if ($partition) {
30
+ $collection = parent::limitCollection($collection, $partition);
31
+ }
32
+
33
+ return $collection;
34
+ }
35
+
36
+ private function _sendInventory() {
37
+ if (Mage::getStoreConfig('springbot/advanced/send_inventory') == 1) {
38
+ return true;
39
+ } else {
40
+ return false;
41
+ }
42
+ }
43
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/Products.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_Products extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ $collection = $this->getCollection($this->getStoreId());
8
+
9
+ $api = Mage::getModel('combine/api');
10
+ $harvester = new Springbot_Combine_Model_Harvest_Products($api, $collection, $this->getDataSource());
11
+ $harvester->setStoreId($this->getStoreId());
12
+ $harvester->harvest();
13
+
14
+ return $this->reportCount($harvester);
15
+ }
16
+
17
+ public function getCollection($storeId, $partition = null)
18
+ {
19
+ $collection = Mage::getModel('catalog/product')
20
+ ->getCollection()
21
+ ->addStoreFilter($storeId);
22
+
23
+ $collection->addFieldToFilter('entity_id', array('gt' => $this->getStartId()));
24
+ $stopId = $this->getStopId();
25
+ if ($stopId !== null) {
26
+ $collection->addFieldToFilter('entity_id', array('lteq' => $this->getStopId()));
27
+ }
28
+
29
+ if($partition) {
30
+ $collection = parent::limitCollection($collection, $partition);
31
+ }
32
+ return $collection;
33
+ }
34
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/Purchases.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_Purchases extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ $collection = self::getCollection($this->getStoreId());
8
+ $api = Mage::getModel('combine/api');
9
+ $harvester = new Springbot_Combine_Model_Harvest_Purchases($api, $collection, $this->getDataSource());
10
+ $harvester->harvest();
11
+
12
+ return $this->reportCount($harvester);
13
+ }
14
+
15
+ public function getCollection($storeId, $partition = null)
16
+ {
17
+ $collection = Mage::getModel('sales/order')->getCollection();
18
+
19
+ if ($storeId == Mage::getStoreConfig('springbot/config/store_zero_alias')) {
20
+ $collection->addFieldToFilter('store_id',
21
+ array(
22
+ array('eq' => 0),
23
+ array('eq' => $storeId),
24
+ )
25
+ );
26
+ }
27
+ else {
28
+ $collection->addFieldToFilter('store_id', $storeId);
29
+ }
30
+
31
+ if ($this->getStartId() !== null) {
32
+ $collection->addFieldToFilter('entity_id', array('gt' => $this->getStartId()));
33
+ }
34
+ if ($this->getStopId()) {
35
+ $collection->addFieldToFilter('entity_id', array('lteq' => $this->getStopId()));
36
+ }
37
+
38
+ if ($partition) {
39
+ $collection = parent::limitCollection($collection, $partition);
40
+ }
41
+ return $collection;
42
+ }
43
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/Rules.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_Rules extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ $collection = $this->getCollection($this->getStoreId());
8
+ $api = Mage::getModel('combine/api');
9
+ $harvester = new Springbot_Combine_Model_Harvest_Rules($api, $collection, $this->getDataSource());
10
+ $harvester->harvest();
11
+
12
+ return $this->reportCount($harvester);
13
+ }
14
+
15
+ public function getCollection($storeId, $partition = null)
16
+ {
17
+ $websiteId = Mage::getModel('core/store')->load($storeId)->getWebsiteId();
18
+
19
+ // Find all rules for the given storeId
20
+ $collection = Mage::getModel('salesrule/rule')->getCollection();
21
+ $collection->addFieldToFilter('website_ids',
22
+ array(
23
+ array('like' => "%,{$websiteId},%"),
24
+ array('like' => "{$websiteId},%"),
25
+ array('like' => "%,{$websiteId}"),
26
+ array('like' => "{$websiteId}"),
27
+ )
28
+ );
29
+
30
+ if ($partition) {
31
+ $collection = parent::limitCollection($collection, $partition, 'rule_id');
32
+ }
33
+
34
+ if ($this->getStartId() !== null) {
35
+ $collection->addFieldToFilter('rule_id', array('gt' => $this->getStartId()));
36
+ }
37
+
38
+ if ($this->getStopId()) {
39
+ $collection->addFieldToFilter('rule_id', array('lteq' => $this->getStopId()));
40
+ }
41
+
42
+ return $collection;
43
+ }
44
+ }
Springbot-1.5.2.2/Springbot/Services/Harvest/Subscribers.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Harvest_Subscribers extends Springbot_Services_Harvest
4
+ {
5
+ public function run()
6
+ {
7
+ $collection = $this->getCollection($this->getStoreId());
8
+ $api = Mage::getModel('combine/api');
9
+ $harvester = new Springbot_Combine_Model_Harvest_Subscribers($api, $collection, $this->getDataSource());
10
+ $harvester->harvest();
11
+ return $this->reportCount($harvester);
12
+ }
13
+
14
+ public function getCollection($storeId, $partition = null)
15
+ {
16
+ $collection = Mage::getResourceModel('newsletter/subscriber_collection');
17
+ $collection->addFieldToFilter('store_id', $storeId);
18
+
19
+ if ($this->getStartId() !== null) {
20
+ $collection->addFieldToFilter('subscriber_id', array('gt' => $this->getStartId()));
21
+ }
22
+ if ($this->getStopId()) {
23
+ $collection->addFieldToFilter('subscriber_id', array('lteq' => $this->getStopId()));
24
+ }
25
+
26
+ if ($partition) {
27
+ $collection = parent::limitCollection($collection, $partition, 'subscriber_id');
28
+ }
29
+
30
+ return $collection;
31
+ }
32
+ }
Springbot-1.5.2.2/Springbot/Services/Log/Installer.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Log_Installer extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $setupModel = Mage::getModel('Springbot_Combine_Model_Resource_Setup');
8
+ $setupModel->resendInstallLog();
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Services/Post.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Springbot_Services_Post extends Springbot_Services
4
+ {
5
+ public function getDataSource()
6
+ {
7
+ return Springbot_Boss::SOURCE_OBSERVER;
8
+ }
9
+ }
Springbot-1.5.2.2/Springbot/Services/Post/Attribute.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Attribute extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $api = Mage::getModel('combine/api');
8
+ $collection = new Varien_Data_Collection;
9
+ $harvester = new Springbot_Combine_Model_Harvest_AttributeSets($api, $collection, $this->getDataSource());
10
+
11
+ $ids = Mage::helper('combine/attributes')->getAllSetsForAttribute($this->getEntityId());
12
+ if (($count = count($ids)) > 0) {
13
+ Springbot_Log::debug("{$count} related attribute sets found, saving!");
14
+ foreach ($ids as $setId) {
15
+ $set = Mage::getModel('eav/entity_attribute_set')->load($setId);
16
+ foreach ($this->_getStoreIds() as $id) {
17
+ $harvester->setStoreId($id);
18
+ $harvester->push($set);
19
+ }
20
+ }
21
+ }
22
+ else {
23
+ Springbot_Log::debug("No related attribute sets found");
24
+ }
25
+ $harvester->postSegment();
26
+ }
27
+
28
+ protected function _getStoreIds()
29
+ {
30
+ $stores = Mage::helper('combine/harvest')->getStoresToHarvest();
31
+ $ids = array();
32
+ foreach($stores as $store) {
33
+ $ids[] = $store->getStoreId();
34
+ }
35
+ return $ids;
36
+ }
37
+
38
+ }
Springbot-1.5.2.2/Springbot/Services/Post/AttributeSet.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_AttributeSet extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $api = Mage::getModel('combine/api');
8
+ $collection = new Varien_Data_Collection;
9
+ $harvester = new Springbot_Combine_Model_Harvest_AttributeSets($api, $collection, $this->getDataSource());
10
+
11
+ foreach (Mage::helper('combine/harvest')->getStoresToHarvest() as $store) {
12
+ $harvester->setStoreId($store->getStoreId());
13
+ $attributeSet = Mage::getModel('eav/entity_attribute_set')->load($this->getEntityId());
14
+ $harvester->push($attributeSet);
15
+ }
16
+ $harvester->postSegment();
17
+ }
18
+
19
+ }
Springbot-1.5.2.2/Springbot/Services/Post/Cart.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Cart extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $quoteId = $this->getEntityId();
8
+ Springbot_Log::debug("Posting quote $quoteId");
9
+
10
+ $quote = Mage::getModel('sales/quote');
11
+
12
+ // For some reason you have to set the store to load a quote, why??? Varien knows...
13
+ $store = Mage::getModel('core/store')->load($this->getStoreId());
14
+ $quote->setStore($store)->load($quoteId);
15
+
16
+ $parser = Mage::getModel('combine/parser_quote', $quote);
17
+ $quoteJson = $parser->toJson();
18
+ Mage::helper('combine')->apiPostWrapped('carts', json_decode($quoteJson), true);
19
+ }
20
+
21
+ }
Springbot-1.5.2.2/Springbot/Services/Post/Category.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Category extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $category = Mage::getModel('catalog/category')->load($this->getEntityId());
8
+ $api = Mage::getModel('combine/api');
9
+ $collection = new Varien_Data_Collection;
10
+ $harvester = new Springbot_Combine_Model_Harvest_Categories($api, $collection, $this->getDataSource());
11
+
12
+ foreach (Mage::helper('combine/harvest')->mapStoreIds($category) as $mapped) {
13
+ $harvester->push($mapped);
14
+ }
15
+
16
+ $harvester->postSegment();
17
+ }
18
+ }
Springbot-1.5.2.2/Springbot/Services/Post/Coupon.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Coupon extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $coupon = Mage::getModel('salesrule/coupon');
8
+ $coupon->load($this->getEntityId());
9
+ $coupon->setStoreId($this->getStoreId());
10
+
11
+ $api = Mage::getModel('combine/api');
12
+ $collection = new Varien_Data_Collection;
13
+ $harvester = new Springbot_Combine_Model_Harvest_Coupons($api, $collection, $this->getDataSource());
14
+ $harvester->push($coupon);
15
+ $harvester->postSegment();
16
+ }
17
+ }
18
+
Springbot-1.5.2.2/Springbot/Services/Post/Customer.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Customer extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $api = Mage::getModel('combine/api');
8
+ $collection = new Varien_Data_Collection;
9
+ $harvester = new Springbot_Combine_Model_Harvest_Customers($api, $collection, $this->getDataSource());
10
+ $harvester->setDelete($this->getDelete());
11
+ $customer = Mage::getModel('customer/customer')->load($this->getStartId());
12
+ $harvester->push($customer);
13
+ $harvester->postSegment();
14
+ }
15
+ }
Springbot-1.5.2.2/Springbot/Services/Post/Guest.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Guest extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $api = Mage::getModel('combine/api');
8
+ $collection = new Varien_Data_Collection;
9
+ $harvester = new Springbot_Combine_Model_Harvest_Guests($api, $collection, $this->getDataSource());
10
+ $harvester->setDelete($this->getDelete());
11
+ $purchase = Mage::getModel('sales/order')->load($this->getStartId());
12
+ $harvester->push($purchase);
13
+ $harvester->postSegment();
14
+ }
15
+ }
Springbot-1.5.2.2/Springbot/Services/Post/Inventory.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Inventory extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $api = Mage::getModel('combine/api');
8
+ $collection = new Varien_Data_Collection;
9
+ $harvester = new Springbot_Combine_Model_Harvest_Inventories($api, $collection, $this->getDataSource());
10
+ $harvester->setDelete($this->getDelete());
11
+ $this->_aggregateInventoryItem($this->getStartId(), $harvester);
12
+ $harvester->postSegment();
13
+ }
14
+
15
+
16
+
17
+ protected function _aggregateInventoryItem($itemId, $harvester)
18
+ {
19
+ $inventoryItem = Mage::getModel('cataloginventory/stock_item')->load($itemId);
20
+ $productId = $inventoryItem->getProductId();
21
+ if ($product = Mage::getModel('catalog/product')->load($productId)) {
22
+ foreach ($product->getStoreIds() as $storeId) {
23
+ $inventoryItem->setStoreId($storeId);
24
+ $harvester->push($inventoryItem);
25
+ }
26
+ }
27
+ }
28
+
29
+ }
Springbot-1.5.2.2/Springbot/Services/Post/Json.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Json extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $file = Mage::getModel('combine/file_io');
8
+ $filename = $this->getFilename();
9
+
10
+ if($file->exists($filename)) {
11
+ $quoteJson = $file->read($filename);
12
+ $file->delete();
13
+ }
14
+
15
+ Mage::helper('combine')->apiPostWrapped($this->getPostMethod(), json_decode($quoteJson));
16
+ }
17
+ }
Springbot-1.5.2.2/Springbot/Services/Post/Jsonstring.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Jsonstring extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ Mage::helper('combine')->apiPostWrapped(parent::getData('method'), parent::getData('json'));
8
+ }
9
+ }
10
+
11
+
12
+
Springbot-1.5.2.2/Springbot/Services/Post/Product.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Product extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $api = Mage::getModel('combine/api');
8
+ $collection = new Varien_Data_Collection;
9
+ $harvester = new Springbot_Combine_Model_Harvest_Products($api, $collection, $this->getDataSource());
10
+ $this->_aggregateProduct($this->getEntityId(), $harvester);
11
+ $harvester->postSegment();
12
+ }
13
+
14
+ /**
15
+ * Map store ids to given model
16
+ *
17
+ * This method will push all products that are children of the supplied product if they're
18
+ * a configurable as well as the same product for all stores it is associated to.
19
+ *
20
+ * @param integer $entityId
21
+ */
22
+ protected function _aggregateProduct($entityId, $harvester)
23
+ {
24
+ $product = Mage::getModel('catalog/product')->load($entityId);
25
+
26
+ foreach(Mage::helper('combine/harvest')->mapStoreIds($product) as $mapped) {
27
+ $harvester->push($mapped);
28
+ }
29
+
30
+ if($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
31
+ Springbot_Log::debug('Executing configurable callback save');
32
+ foreach(Mage::helper('combine/parser')->getChildProductIds($product) as $childId) {
33
+ $this->_aggregateProduct($childId, $harvester);
34
+ }
35
+ }
36
+ }
37
+
38
+ }
Springbot-1.5.2.2/Springbot/Services/Post/Purchase.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Purchase extends Springbot_Services_Post
4
+ {
5
+ protected $_purchase;
6
+
7
+ public function run()
8
+ {
9
+ $orderId = $this->getEntityId();
10
+ Springbot_Log::debug('Executing Purchase Method (at '.date(Springbot_Boss::DATE_FORMAT).') Order Number->' . $orderId);
11
+
12
+ $this->_purchase = Mage::getModel('sales/order')->load($orderId);
13
+ $redirectIds = $this->_getRedirectIds();
14
+
15
+ if(count($redirectIds)) {
16
+ $this->_createRedirectForOrder($redirectIds[0]);
17
+
18
+ $this->_purchase->setRedirectMongoId($redirectIds[0])
19
+ ->setRedirectMongoIds($redirectIds);
20
+ }
21
+
22
+ $api = Mage::getModel('combine/api');
23
+ $collection = new Varien_Data_Collection;
24
+ $harvester = new Springbot_Combine_Model_Harvest_Purchases($api, $collection, $this->getDataSource());
25
+
26
+ $harvester->push($this->_purchase);
27
+ $harvester->postSegment();
28
+
29
+ if($this->_purchase->getCustomerIsGuest()) {
30
+ Springbot_Boss::scheduleJob(
31
+ 'post:guest',
32
+ array('i' => $orderId),
33
+ Springbot_Services::LISTENER,
34
+ 'listener'
35
+ );
36
+ }
37
+ }
38
+
39
+ protected function _createRedirectForOrder($redirectId)
40
+ {
41
+ Springbot_Log::debug("Creating order entry for redirect_id: {$redirectId}");
42
+
43
+ if($redirectId) {
44
+ $redirect = Mage::getResourceModel('combine/redirect_collection')
45
+ ->loadByKey($this->_purchase->getCustomerEmail(), $redirectId);
46
+
47
+ if($redirect) {
48
+ $redirectOrder = Mage::getModel('combine/redirect_order');
49
+
50
+ $redirectOrder->setData(array(
51
+ 'redirect_entity_id' => $redirect->getId(),
52
+ 'order_id' => $this->_purchase->getId(),
53
+ ));
54
+
55
+ $redirectOrder->insertIgnore();
56
+ }
57
+ }
58
+ }
59
+
60
+ protected function _getRedirectIds()
61
+ {
62
+ return isset($this->_data['redirect_ids']) ? (array) $this->_data['redirect_ids'] : array();
63
+ }
64
+ }
Springbot-1.5.2.2/Springbot/Services/Post/Rule.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Rule extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $api = Mage::getModel('combine/api');
8
+ $collection = new Varien_Data_Collection;
9
+ $harvester = new Springbot_Combine_Model_Harvest_Rules($api, $collection, $this->getDataSource());
10
+
11
+ $rule = Mage::getModel('salesrule/rule');
12
+ $rule->load($this->getEntityId());
13
+
14
+ // Since rules do not have store ids, we go by the store_id passed from the command line
15
+ $rule->setStoreId($this->getStoreId());
16
+
17
+ $harvester->push($rule);
18
+ $harvester->postSegment();
19
+ }
20
+ }
21
+
Springbot-1.5.2.2/Springbot/Services/Post/Subscriber.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Post_Subscriber extends Springbot_Services_Post
4
+ {
5
+ public function run()
6
+ {
7
+ $api = Mage::getModel('combine/api');
8
+ $collection = new Varien_Data_Collection;
9
+ $harvester = new Springbot_Combine_Model_Harvest_Subscribers($api, $collection, $this->getDataSource());
10
+ $harvester->setDelete($this->getDelete());
11
+ $harvester->push(Mage::getModel('newsletter/subscriber')->load($this->getStartId()));
12
+ $harvester->postSegment();
13
+ }
14
+ }
Springbot-1.5.2.2/Springbot/Services/Registry.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Registry
4
+ {
5
+ public static function getInstance($method)
6
+ {
7
+ $classname = self::_constantize($method);
8
+ Springbot_Log::debug("Creating instance of $classname");
9
+
10
+ if(class_exists($classname)) {
11
+ return new $classname();
12
+ } else {
13
+ return false;
14
+ }
15
+ }
16
+
17
+ public static function parseOpts($opts)
18
+ {
19
+ Springbot_Log::debug("Parsing args");
20
+
21
+ if(isset($opts['s'])) {
22
+ $args['store_id'] = $opts['s'];
23
+ }
24
+
25
+ if(isset($opts['i'])) {
26
+ list($start, $stop) = array_pad(explode(':', $opts['i']), 2, null);
27
+ $args['entity_id'] = $start;
28
+ $args['start_id'] = $start;
29
+ $args['stop_id'] = $stop;
30
+ }
31
+
32
+ if(isset($opts['h'])) {
33
+ $args['halt_command'] = $opts['h'];
34
+ }
35
+
36
+ if(isset($opts['c'])) {
37
+ $args['class'] = $opts['c'];
38
+ }
39
+
40
+ if(isset($opts['v'])) {
41
+ $args['version'] = $opts['v'];
42
+ $args['harvest_id'] = $opts['v'];
43
+ }
44
+
45
+ if(isset($opts['r'])) {
46
+ $args['redirect_ids'] = $opts['r'];
47
+ }
48
+
49
+ if(isset($opts['j'])) {
50
+ $args['json'] = $opts['j'];
51
+ }
52
+
53
+ if(isset($opts['n'])) {
54
+ $args['filename'] = $opts['n'];
55
+ }
56
+
57
+ if(isset($opts['m'])) {
58
+ $args['post_method'] = $opts['m'];
59
+ }
60
+
61
+ if(isset($opts['p'])) {
62
+ $args['pid'] = $opts['p'];
63
+ }
64
+
65
+ $args['delete'] = isset($opts['d']);
66
+ $args['force'] = isset($opts['f']);
67
+ $args['is_foreman'] = isset($opts['o']);
68
+
69
+ return $args;
70
+ }
71
+
72
+ /**
73
+ * Take a colon-separated string and turns it into a classname
74
+ * in the Springbot_Services_ namespace
75
+ *
76
+ * @param string $method
77
+ * @return string
78
+ */
79
+ private static function _constantize($method)
80
+ {
81
+ $mods = array_map('ucfirst', explode(':', $method));
82
+ return 'Springbot_Services_' . implode('_', $mods);
83
+ }
84
+ }
Springbot-1.5.2.2/Springbot/Services/Store/Finalize.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Store_Finalize extends Springbot_Services
4
+ {
5
+
6
+ public function run()
7
+ {
8
+
9
+ $storeId = $this->getStoreId();
10
+
11
+ if ($store = Mage::getModel('core/store')->load($storeId)) {
12
+ $helper = Mage::helper('combine/store')->setStore($store);
13
+
14
+ Springbot_Log::printLine();
15
+ Springbot_Log::harvest('Store level harvesting complete for Store->'. $storeId .'/'. $helper->getSpringbotStoreId(), true, $storeId);
16
+ Springbot_Log::printLine();
17
+
18
+ $api = Mage::getModel('combine/api');
19
+ $api->call('sync_status/' . $helper->getSpringbotStoreId(), '{"status":"synced"}');
20
+
21
+ $countResource = Mage::getResourceModel('combine/cron_count');
22
+ $countResource->clearStoreCounts($storeId);
23
+
24
+ Mage::getModel('core/config')->saveConfig('springbot/config/harvest_cursor', '0');
25
+ }
26
+ }
27
+
28
+ }
Springbot-1.5.2.2/Springbot/Services/Store/Register.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Store_Register extends Springbot_Services
4
+ {
5
+ const API_CLASS = 'stores';
6
+
7
+ protected $_guid;
8
+
9
+ public function run()
10
+ {
11
+ $guid = $this->_getGuid();
12
+
13
+ $response = $this->_query($guid, $this->getStoreArray($guid));
14
+
15
+ if ($response['status'] == 'ok' && isset($response['stores'])) {
16
+ $springbotStoreId = array_search($guid, $response['stores']);
17
+ $id = $this->getStoreId();
18
+ $vars = array(
19
+ 'store_guid' => $guid,
20
+ 'store_id' => $springbotStoreId,
21
+ 'security_token' => $this->_getSecurityToken()
22
+ );
23
+ $this->commitVars($vars, $id);
24
+ Mage::getConfig()->cleanCache();
25
+ }
26
+ }
27
+
28
+ public function getStoreArray($guid)
29
+ {
30
+ $helper = $this->_getHelper();
31
+ $storeUrl = $helper->getStoreUrl($this->getStoreId());
32
+ $store = $this->_getStore();
33
+
34
+ $storeDetail = array(
35
+ 'guid' => $guid,
36
+ 'url' => $storeUrl,
37
+ 'name' => $store->getName(),
38
+ 'logo_src' => Mage::getStoreConfig('design/header/logo_src'),
39
+ 'logo_alt_tag' => Mage::getStoreConfig('design/header/logo_alt'),
40
+ 'json_data' => array(
41
+ 'web_id' => $store->getWebsiteId(),
42
+ 'store_id' => $this->getStoreId(),
43
+ 'store_name' => $store->getName(),
44
+ 'store_code' => $store->getCode(),
45
+ 'store_active' => $store->getIsActive(),
46
+ 'store_url' => $storeUrl,
47
+ 'media_url' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA),
48
+ 'store_mail_address' => $this->_getStoreAddress(),
49
+ 'store_custsrv_email' => Mage::getStoreConfig('trans_email/ident_support/email'),
50
+ 'store_statuses' => $this->_getStoreStatuses($this->getStoreId())
51
+ ),
52
+ );
53
+
54
+ return $storeDetail;
55
+ }
56
+
57
+ public function commitVars($vars)
58
+ {
59
+ foreach ($vars as $key => $val)
60
+ {
61
+ $configKey = $this->_makeConfigKey($key, $this->getStoreId());
62
+ Springbot_Log::harvest('Committing Config Var ['. $configKey .']->'.$val);
63
+ Mage::getConfig()->saveConfig($configKey, $val, 'default', 0);
64
+ }
65
+ }
66
+
67
+ protected function _getStoreStatuses($storeId) {
68
+ return Mage::getModel('sales/order')->getConfig()->getStatuses();
69
+ }
70
+
71
+ protected function _getSecurityToken()
72
+ {
73
+ return Mage::helper('combine')->requestSecurityToken();
74
+ }
75
+
76
+ protected function _query($guid, $storeMetaData)
77
+ {
78
+ return Mage::helper('combine')->apiPostWrapped(self::API_CLASS, array($guid => $storeMetaData));
79
+ }
80
+
81
+ protected function _getGuid()
82
+ {
83
+ return Mage::helper('combine')->getStoreGuid($this->getStoreId());
84
+ }
85
+
86
+ protected function _getStore()
87
+ {
88
+ return Mage::getModel('core/store')->load($this->getStoreId());
89
+ }
90
+
91
+ protected function _getStoreAddress()
92
+ {
93
+ return str_replace(array("\n","\r"),"|",Mage::getStoreConfig('general/store_information/address'));
94
+ }
95
+
96
+ protected function _getHelper()
97
+ {
98
+ return Mage::helper('combine/harvest');
99
+ }
100
+
101
+ protected function _makeConfigKey($dataClass, $storeId = '')
102
+ {
103
+ $cKey = 'springbot/config/'.$dataClass;
104
+ if ($storeId != '') {
105
+ $cKey = $cKey.'_'.$storeId;
106
+ }
107
+ return $cKey;
108
+ }
109
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks
4
+ {
5
+
6
+ public static function makeTask($taskname, $params)
7
+ {
8
+ $className = self::_snakeToCamel($taskname);
9
+ $fullClassName = "Springbot_Services_Tasks_{$className}";
10
+ Springbot_Log::debug("Init {$fullClassName}");
11
+ if (class_exists($fullClassName)) {
12
+ $task = new $fullClassName();
13
+ $task->setData($params);
14
+ return $task;
15
+ }
16
+ else {
17
+ return null;
18
+ }
19
+ }
20
+
21
+ private static function _snakeToCamel($string)
22
+ {
23
+ $toReturn = '';
24
+ foreach(explode('_', $string) as $word) {
25
+ $toReturn .= ucfirst($word);
26
+ }
27
+ return $toReturn;
28
+ }
29
+
30
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/ClearCache.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_ClearCache extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ try {
8
+ $allTypes = Mage::app()->useCache();
9
+ foreach($allTypes as $type => $blah) {
10
+ Mage::app()->getCacheInstance()->cleanType($type);
11
+ }
12
+ return true;
13
+ }
14
+ catch (Exception $e) {
15
+ Springbot_Log::error($e->getMessage());
16
+ return array(
17
+ 'success' => false,
18
+ 'message' => $e->getMessage()
19
+ );
20
+ }
21
+ }
22
+ }
23
+
24
+
25
+
26
+
Springbot-1.5.2.2/Springbot/Services/Tasks/ClearJobs.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_ClearJobs extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $resource = Mage::getResourceModel('combine/cron_queue');
8
+ $resource->removeHarvestRows(null, false);
9
+ return true;
10
+ }
11
+ }
12
+
13
+
14
+
15
+
Springbot-1.5.2.2/Springbot/Services/Tasks/ClearStores.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_ClearStores extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ foreach (Mage::getStoreConfig('springbot/config') as $configKey => $configValue) {
8
+ if (
9
+ (substr($configKey, 0, strlen('store_id_')) == 'store_id_') ||
10
+ (substr($configKey, 0, strlen('store_guid_')) == 'store_guid_') ||
11
+ (substr($configKey, 0, strlen('security_token_')) == 'security_token_')
12
+ ) {
13
+ Mage::getModel('core/config')->saveConfig('springbot/config/' . $configKey, null, 'default', 0);
14
+ }
15
+ }
16
+ Mage::getConfig()->cleanCache();
17
+ return true;
18
+ }
19
+ }
20
+
21
+
22
+
23
+
Springbot-1.5.2.2/Springbot/Services/Tasks/CreateRewrite.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_CreateRewrite extends Springbot_Services
4
+ {
5
+ private $_requiredParams = ['store_id', 'id_path', 'request_path', 'target_path'];
6
+
7
+ public function run() {
8
+ try {
9
+ if (
10
+ ($storeId = $this->getData('store_id')) &&
11
+ ($idPath = $this->getData('id_path')) &&
12
+ ($requestPath = $this->getData('request_path')) &&
13
+ ($targetPath = $this->getData('target_path'))
14
+ ) {
15
+ if ($store = Mage::getModel('core/store')->load($storeId)) {
16
+ Mage::getModel('combine/rewrite')->createRewrite($store, $idPath, $requestPath, $targetPath);
17
+ return [
18
+ 'success' => true,
19
+ 'message' => "Created rewrite"
20
+ ];
21
+ }
22
+ else {
23
+ return $this->_showError("Could not load store with id {$storeId}");
24
+ }
25
+ }
26
+ else {
27
+ return $this->_showError("Required params: " . implode(', ', $this->_requiredParams));
28
+ }
29
+ }
30
+ catch (Exception $e) {
31
+ return $this->_showError("Unable to create URL rewrite for store id: " . $e->getMessage());
32
+ }
33
+ }
34
+
35
+ private function _showError($errorMessage) {
36
+ Springbot_Log::error($errorMessage);
37
+ return [
38
+ 'success' => false,
39
+ 'message' => $errorMessage
40
+ ];
41
+ }
42
+
43
+ }
44
+
45
+
46
+
47
+
Springbot-1.5.2.2/Springbot/Services/Tasks/Debug.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_Debug extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ Mage::getConfig()->cleanCache();
8
+ $resource = Mage::getResourceModel('combine/debug');
9
+
10
+ return array(
11
+ 'customers' => $resource->getCustomersRaw(),
12
+ 'guests' => $resource->getGuestsRaw(),
13
+ 'subscribers' => $resource->getSubscribersRaw(),
14
+ 'products' => $resource->getProductsRaw(),
15
+ 'categories' => $resource->getCategoriesRaw(),
16
+ 'purchases' => $resource->getPurchasesRaw(),
17
+ 'carts' => $resource->getCartsRaw(),
18
+ );
19
+ }
20
+ }
21
+
22
+
23
+
24
+
Springbot-1.5.2.2/Springbot/Services/Tasks/DeleteJob.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_DeleteJob extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ if (is_numeric($this->getJobId())) {
8
+ $resource = Mage::getModel('combine/cron_queue')->getResource();
9
+ $resource->removeHarvestRow($this->getJobId());
10
+ return true;
11
+ }
12
+ else {
13
+ return false;
14
+ }
15
+ }
16
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/DeliverEventLog.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_DeliverEventLog extends Springbot_Services
4
+ {
5
+ const EVENT_MAX = 200;
6
+
7
+ public function run()
8
+ {
9
+ $ssid = $this->getSpringbotStoreId();
10
+ $method = "stores/{$ssid}/products/actions/create";
11
+ $eventItems = array();
12
+ try{
13
+ $this->_lockEvents();
14
+ foreach($this->_getLockedEvents() as $event) {
15
+ $eventItems[] = $event->toAction();
16
+ }
17
+ if ($eventItems) {
18
+ $result = Mage::getModel('combine/api')->call($method, json_encode($eventItems));
19
+ }
20
+ $this->_removeEvents();
21
+ $successful = true;
22
+ } catch (Exception $e) {
23
+ // We can capture this here and keep if from bubbling up.
24
+ // This api call will fail and get recreated on the next check in
25
+ Springbot_Log::error($e->getMessage());
26
+ $successful = false;
27
+ }
28
+ $this->_releaseLocks();
29
+ return $successful;
30
+ }
31
+
32
+ private function _removeEvents()
33
+ {
34
+ $this->_getEventsResource()->removeEvents(getmypid());
35
+ }
36
+
37
+ private function _getLockedEvents()
38
+ {
39
+ return $this->_getEventsCollection()
40
+ ->getLockedEvents($this->getStoreId(), getmypid());
41
+ }
42
+
43
+ private function _lockEvents()
44
+ {
45
+ $this->_getEventsResource()
46
+ ->lockEvents(getmypid(), $this->getStoreId(), self::EVENT_MAX);
47
+ }
48
+
49
+ private function _releaseLocks()
50
+ {
51
+ $this->_getEventsResource()->releaseLocksForPid(getmypid());
52
+ }
53
+
54
+ private function _getEventsCollection()
55
+ {
56
+ return Mage::getModel('combine/action')->getCollection();
57
+ }
58
+
59
+ private function _getEventsResource()
60
+ {
61
+ return Mage::getResourceModel('combine/action');
62
+ }
63
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/Forecast.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_Forecast extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $instance = new Springbot_Services_Cmd_Forecast();
8
+ $instance->forecastAllStores();
9
+ return true;
10
+ }
11
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/GetLog.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_GetLog extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $buffer = Mage::helper('combine')->getLogContents($this->getLogName());
8
+
9
+ $logData = array(
10
+ 'logs' => array(
11
+ array(
12
+ 'store_id' => $this->getSpringbotStoreId(),
13
+ 'description' => $buffer,
14
+ ),
15
+ ),
16
+ );
17
+
18
+ Mage::getModel('combine/api')->call('logs', json_encode($logData), false);
19
+
20
+ if (isset($result['status'])) {
21
+ if ($result['status']==self::SUCCESSFUL_RESPONSE) {
22
+ Springbot_Log::harvest('['.__METHOD__.'] was successfully delivered');
23
+ }
24
+ else {
25
+ Springbot_Log::harvest('['.__METHOD__.'] delivery failed ->'.$result['status']);
26
+ }
27
+ }
28
+ return true;
29
+ }
30
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/Harvest.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_Harvest extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $harvest = new Springbot_Services_Cmd_Harvest();
8
+ $harvest->run();
9
+ return true;
10
+ }
11
+ }
12
+
13
+
14
+
15
+
Springbot-1.5.2.2/Springbot/Services/Tasks/HarvestInventory.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_HarvestInventory extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $this->_turnOnInventorySync();
8
+
9
+ Springbot_Boss::scheduleJob(
10
+ 'cmd:harvest',
11
+ array(
12
+ 's' => $this->getStoreId(),
13
+ 'c' => 'inventories',
14
+ ),
15
+ Springbot_Services::HARVEST,
16
+ 'default',
17
+ $this->getStoreId()
18
+ );
19
+ return true;
20
+ }
21
+
22
+ protected function _turnOnInventorySync()
23
+ {
24
+ if(!Mage::getStoreConfig('springbot/advanced/send_inventory') == 1) {
25
+ Mage::getConfig()->saveConfig('springbot/advanced/send_inventory', 1, 'default', 0);
26
+ Mage::getConfig()->cleanCache();
27
+ }
28
+ }
29
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/Healthcheck.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_Healthcheck extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $healthcheck = new Springbot_Services_Cmd_Healthcheck();
8
+ $healthcheck->setStoreId($this->getStoreId());
9
+ $healthcheck->run();
10
+
11
+ Springbot_Log::debug("Scheduling future jobs via endpoint healthcheck");
12
+ Springbot_Boss::scheduleFutureJobs($this->getStoreId());
13
+
14
+ return true;
15
+ }
16
+ }
17
+
18
+
19
+
20
+
Springbot-1.5.2.2/Springbot/Services/Tasks/Jobs.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_Jobs extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ if (!$page = $this->getData('page')) {
8
+ $page = 1;
9
+ }
10
+ $collection = Mage::getModel('combine/cron_queue')->getCollection();
11
+ $collection->setPageSize(20)->setCurPage($page);
12
+ return $collection->toArray();
13
+ }
14
+ }
15
+
16
+
17
+
18
+
Springbot-1.5.2.2/Springbot/Services/Tasks/KillHarvest.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_KillHarvest extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ Springbot_Boss::halt();
8
+ return true;
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/LaunchFullHarvest.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_LaunchFullHarvest extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ Springbot_Cli::launchHarvest();
8
+ return true;
9
+ }
10
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/LaunchPartialHarvest.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_LaunchPartialHarvest extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ Mage::helper('combine/harvest')->truncateEngineLogs();
8
+ Springbot_Boss::scheduleJob(
9
+ 'cmd:harvest',
10
+ array(
11
+ 's' => $this->getStoreId(),
12
+ 'c' => $this->getType(),
13
+ ),
14
+ Springbot_Services::HARVEST,
15
+ 'default',
16
+ $this->getStoreId()
17
+ );
18
+ return true;
19
+ }
20
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/PluginVersion.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_PluginVersion extends Springbot_Services
4
+ {
5
+ /**
6
+ * Return the Plugin Version Number. Echo out and throw an Exception if the value is empty.
7
+ *
8
+ * @return array
9
+ */
10
+ public function run()
11
+ {
12
+ $version = array('plugin_version' => (string) Mage::getConfig()->getModuleConfig("Springbot_Combine")->version);
13
+ if (empty($version)) {
14
+ throw new Exception('Plugin version is empty.');
15
+ }
16
+ return $version;
17
+ }
18
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/PostItem.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_PostItem extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ if($type = ucfirst($this->getCategory())) {
8
+ $classname = 'Springbot_Services_Post_' . $type;
9
+ $instance = new $classname();
10
+ $instance->setEntityId($this->getEntityId());
11
+ $instance->run();
12
+ return true;
13
+ } else {
14
+ throw new Exception("Type not supplied for " . __CLASS__);
15
+ return false;
16
+ }
17
+ }
18
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/Redirects.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_Redirects extends Springbot_Services
4
+ {
5
+ /**
6
+ * View redirects in a paginated collection
7
+ * @return array
8
+ */
9
+ public function run()
10
+ {
11
+ $request = Mage::app()->getRequest();
12
+
13
+ switch ($request->getParam('action')) {
14
+ case null:
15
+ return $this->view();
16
+ break;
17
+ case 'view':
18
+ return $this->view();
19
+ break;
20
+ case 'create':
21
+ return $this->create($request);
22
+ break;
23
+ case 'delete':
24
+ return $this->delete($request->getParam('id'));
25
+ break;
26
+ default:
27
+ return $this->getMessage('error', 'Invalid action.');
28
+ break;
29
+ }
30
+ }
31
+
32
+ /**
33
+ * View a paginated array of redirects
34
+ * @return array
35
+ */
36
+ public function view()
37
+ {
38
+ $combineRewriteModel = Mage::getModel('combine/rewrite');
39
+ $pageSize = ($this->getData('pageSize')) ? $this->getData('pageSize') : 10;
40
+
41
+ if (!$page = $this->getData('page')) {
42
+ $page = 1;
43
+ }
44
+
45
+ if ($combineRewriteModel->isMageCommunity()) {
46
+ $model = Mage::getModel('core/url_rewrite');
47
+ return $this->getPaginatedArray($model, $page, $pageSize);
48
+ } elseif ($combineRewriteModel->isMageEnterprise()) {
49
+ $model = Mage::getModel('enterprise_urlrewrite/redirect');
50
+ return $this->getPaginatedArray($model, $page, $pageSize);
51
+ } else {
52
+ return $this->getMessage('error', 'Unable to determine Magento version');
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Create a new redirect
58
+ * @param Mage_Api2_Model_Request $request
59
+ * @return array
60
+ */
61
+ public function create($request)
62
+ {
63
+ $store = Mage::getModel('core/store')->load($request->getParam('store_id'));
64
+ $createRewrite = Mage::getModel('combine/rewrite')->createRewrite(
65
+ $store,
66
+ $request->getParam('id_path'),
67
+ $request->getParam('source'),
68
+ $request->getParam('target')
69
+ );
70
+
71
+ if ($createRewrite) {
72
+ return $this->getMessage('success', 'Redirect added successfully.');
73
+ } else {
74
+ return $this->getMessage('error', 'Unable to create redirect.');
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Delete a redirect from the database
80
+ * @param integer $rewriteUrlId
81
+ * @return array
82
+ */
83
+ public function delete($rewriteUrlId)
84
+ {
85
+ $combineRewriteModel = Mage::getModel('combine/rewrite');
86
+ if ($combineRewriteModel->deleteRewrite($rewriteUrlId)) {
87
+ return $this->getMessage('success', 'Redirect deleted for id: ' . $rewriteUrlId);
88
+ } else {
89
+ return $this->getMessage('error', 'Unable to delete redirect for id: ' . $rewriteUrlId);
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Create a paginated area based on the model, the page to view, and the number of items on eah page
95
+ *
96
+ * @param Mage_Core_Model_Abstract $model The model to paginate items from.
97
+ * @param integer $page The current page number.
98
+ * @param integer $pageSize The number of items on each page.
99
+ * @return array An array with the count of items and a nested array containing those items paginated.
100
+ */
101
+ public function getPaginatedArray($model, $page = 1, $pageSize = 10)
102
+ {
103
+ $collection = $model->getCollection();
104
+ $totalItems = $collection->count();
105
+ $pages = ceil($totalItems / $pageSize);
106
+ $page = ($page > $pages) ? $pages : $page;
107
+ $offset = ($page - 1) * $pageSize;
108
+ $itemsArray = array('totalRecords' => (int) $totalItems, 'items' => array());
109
+
110
+ if ($model->getResourceName() == 'core/url_rewrite') {
111
+ foreach ($collection as $urlRewrite) {
112
+ $item = array(
113
+ 'id' => (int) $urlRewrite->getUrlRewriteId(),
114
+ 'store_id' => (int) $urlRewrite->getStoreId(),
115
+ 'identifier' => $urlRewrite->getIdPath(),
116
+ 'request_path' => $urlRewrite->getRequestPath(),
117
+ 'target_path' => $urlRewrite->getTargetPath(),
118
+ 'options' => $urlRewrite->getOptions(),
119
+ );
120
+ $itemsArray['items'][] = $item;
121
+ }
122
+ } elseif ($model->getResourceName() == 'enterprise_urlrewrite/redirect') {
123
+ foreach ($collection as $redirect) {
124
+ $rewrite = Mage::getModel('enterprise_urlrewrite/url_rewrite')
125
+ ->loadByRequestPath($redirect->getIdentifier())
126
+ ->getCollection()
127
+ ->addFieldToFilter('store_id', $redirect->getStoreId())
128
+ ->getFirstItem();
129
+
130
+ $item = array(
131
+ 'id' => (int) $redirect->getRedirectId(),
132
+ 'store_id' => (int) $redirect->getStoreId(),
133
+ 'identifier' => $redirect->getIdentifier(),
134
+ 'request_path' => $rewrite->getRequestPath(),
135
+ 'target_path' => $rewrite->getTargetPath(),
136
+ 'options' => $redirect->getOptions(),
137
+ );
138
+
139
+ $itemsArray['items'][] = $item;
140
+ }
141
+ }
142
+ $itemsArray['items'] = array_slice($itemsArray['items'], $offset, $pageSize);
143
+ return $itemsArray;
144
+ }
145
+
146
+ /**
147
+ * Return a status message
148
+ * @param string $status
149
+ * @param string $msg
150
+ * @return array
151
+ */
152
+ public static function getMessage($status, $msg)
153
+ {
154
+ return array(
155
+ 'status' => $status,
156
+ 'message' => $msg
157
+ );
158
+ }
159
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/RegisterStores.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_RegisterStores extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $service = new Springbot_Services_Store_Register;
8
+ $helper = Mage::helper('combine/harvest');
9
+ foreach ($helper->getStoresToHarvest() as $store) {
10
+ $service->setStoreId($store->getStoreId())->run();
11
+ }
12
+ Mage::getConfig()->cleanCache();
13
+ return true;
14
+ }
15
+ }
16
+
17
+
18
+
19
+
Springbot-1.5.2.2/Springbot/Services/Tasks/ResetRetries.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_ResetRetries extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $resource = Mage::getResourceModel('combine/cron_queue');
8
+ $resource->resetRetries();
9
+ return true;
10
+ }
11
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/ResumeHarvest.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_ResumeHarvest extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ Mage::getConfig()->cleanCache();
8
+ Mage::getConfig()->reinit();
9
+ Springbot_Cli::resumeHarvest();
10
+ return true;
11
+ }
12
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/Run.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_Run extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $cronWorker = Mage::getModel('combine/cron_worker');
8
+ $cronWorker->run();
9
+
10
+ $helper = Mage::helper('shadow/prattler');
11
+ return $helper->getPrattlerResponse();
12
+ }
13
+ }
14
+
15
+
16
+
17
+
Springbot-1.5.2.2/Springbot/Services/Tasks/SetVar.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_SetVar extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $varName = $this->getVarName();
8
+ $varValue = $this->getVarValue();
9
+
10
+ if (!preg_match('/.*\/.*\/.*/', $varName)) {
11
+ $varName = 'springbot/config/' . $varName;
12
+ }
13
+
14
+ if (!empty($varName) && ($varName != 'springbot/config/php_exec')) {
15
+ Mage::getModel('core/config')->saveConfig($varName, $varValue, 'default', 0);
16
+ }
17
+
18
+ Mage::getConfig()->cleanCache();
19
+ return true;
20
+ }
21
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/Stores.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_Stores extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $stores = [];
8
+ $helper = Mage::helper('combine/store');
9
+
10
+ foreach (Mage::app()->getWebsites() as $website) {
11
+ foreach ($website->getGroups() as $group) {
12
+ foreach ($group->getStores() as $store) {
13
+ $helper->setStore($store);
14
+ $sbStoreId = $helper->getSpringbotStoreId();
15
+ $sbStoreGuid = $helper->getGuid();
16
+
17
+ $stores[] = array(
18
+ "name" => $store->getName(),
19
+ "code" => $store->getCode(),
20
+ "url" => $store->getBaseUrl('link'),
21
+ "secure_url" => $store->getBaseUrl('link', true),
22
+ "media_url" => $store->getBaseUrl('media'),
23
+ "website_id" => (int) $store->getWebsiteId(),
24
+ "magento_store_id" => (int) $helper->getStoreId(),
25
+ "springbot_store_id" => (isset($sbStoreId) ? (int) $sbStoreId : null),
26
+ "springbot_store_guid" => (isset($sbStoreGuid) ? $sbStoreGuid : null)
27
+ );
28
+ }
29
+ }
30
+ }
31
+ return $stores;
32
+ }
33
+ }
Springbot-1.5.2.2/Springbot/Services/Tasks/UnlockJobs.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_UnlockJobs extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $resource = Mage::getResourceModel('combine/cron_queue');
8
+ $resource->unlockOrphanedRows();
9
+ return true;
10
+ }
11
+ }
12
+
13
+
14
+
15
+
Springbot-1.5.2.2/Springbot/Services/Tasks/ViewConfig.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Tasks_ViewConfig extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ return Mage::getStoreConfig('springbot');
8
+ }
9
+ }
10
+
11
+
12
+
13
+
Springbot-1.5.2.2/Springbot/Services/Work/Cleanup.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Work_Cleanup extends Springbot_Services
4
+ {
5
+ const UNLOCK_AFTER_X_HOURS = 24;
6
+
7
+ public function run()
8
+ {
9
+ $this->_unlockOrphanedRows();
10
+ $this->_unlockForgottenJobs(self::UNLOCK_AFTER_X_HOURS);
11
+ }
12
+
13
+ protected function _unlockOrphanedRows()
14
+ {
15
+ Springbot_Log::debug("Unlocking orphaned rows");
16
+ $queueDb = Mage::getResourceModel('combine/cron_queue');
17
+ $status = Mage::getModel('combine/cron_manager_status');
18
+ $pids = $status->getActiveWorkerPids();
19
+ $queueDb->unlockOrphanedRows($pids);
20
+ }
21
+
22
+ protected function _unlockForgottenJobs($hoursOld)
23
+ {
24
+ Springbot_Log::debug("Unlocking forgotten jobs");
25
+ $queueDb = Mage::getResourceModel('combine/cron_queue');
26
+ $queueDb->unlockOldRows($hoursOld);
27
+ }
28
+ }
Springbot-1.5.2.2/Springbot/Services/Work/Manager.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Work_Manager extends Springbot_Services
4
+ {
5
+ const WORKMANAGER_FILENAME = 'springbot-workmanager';
6
+ const WORKER_PREFIX = 'springbotworker-';
7
+ const SPAWN_WORKER_SECONDS = 2;
8
+ const WORKMANAGER_MAX_TIME = 50;
9
+ const WORKER_TIMEOUT = 600; // 10 minutes
10
+
11
+ protected $_foremanQueued = false;
12
+
13
+ public function run()
14
+ {
15
+ Springbot_Log::debug("Starting work manager");
16
+ if (!$this->_managerRunning()) {
17
+
18
+ $filename = Mage::getBaseDir('tmp') . DS . self::WORKMANAGER_FILENAME;
19
+ file_put_contents($filename, getmypid() . '-' . time());
20
+
21
+ if (file_exists($filename)) {
22
+ if (!$maxWorkers = Mage::getStoreConfig('springbot/advanced/worker_count')) {
23
+ $maxWorkers = 1;
24
+ }
25
+
26
+ $start = time();
27
+ do {
28
+ $currentWorkerCount = $this->_getWorkerCount();
29
+ if(!$this->_foremanRunning()) {
30
+ $this->_foremanQueued = true;
31
+ Springbot_Cli::internalCallback('work:runner', array('o' => true));
32
+ }
33
+ else if($currentWorkerCount < $maxWorkers) {
34
+ Springbot_Cli::internalCallback('work:runner');
35
+ }
36
+ sleep(self::SPAWN_WORKER_SECONDS);
37
+ $this->_verifyWorkersRunning();
38
+ $currentWorkerCount = $this->_getWorkerCount();
39
+ $elapsedTime = time() - $start;
40
+ } while (($elapsedTime < self::WORKMANAGER_MAX_TIME) && ($currentWorkerCount > 0) && $this->_hasJobs());
41
+ unlink($filename);
42
+ }
43
+
44
+ if($this->_hasJobs()) {
45
+ Springbot_Log::debug("Jobs still queued, restarting manager");
46
+ Springbot_Cli::startWorkManager();
47
+ } else {
48
+ Springbot_Log::debug("No more jobs found. Exiting. Manager will restart on next checkin.");
49
+ }
50
+
51
+ }
52
+ }
53
+
54
+ public function cleanup()
55
+ {
56
+ $this->_managerRunning();
57
+ $this->_verifyWorkersRunning();
58
+ }
59
+
60
+ public function hasWorkers()
61
+ {
62
+ return $this->_getWorkerCount() > 0 && !$this->_managerRunning();
63
+ }
64
+
65
+ private function _managerRunning()
66
+ {
67
+ $filename = Mage::getBaseDir('tmp') . DS . self::WORKMANAGER_FILENAME;
68
+ if (file_exists($filename)) {
69
+ list($pid, $startTime) = explode('-', file_get_contents($filename));
70
+ if (is_readable('/proc')) {
71
+ $exists = file_exists("/proc/{$pid}");
72
+ }
73
+ else {
74
+ $exists = ((time() - $startTime) < self::WORKER_TIMEOUT);
75
+ }
76
+ if (!$exists) unlink($filename);
77
+ return $exists;
78
+ }
79
+ return false;
80
+ }
81
+
82
+ private function _foremanRunning()
83
+ {
84
+ if($this->_foremanQueued) { return true; }
85
+
86
+ $files = @glob(Mage::getBaseDir('tmp') . DS . 'springbotworkerforeman*');
87
+ if ($files === false) return false;
88
+ else return count($files) > 0;
89
+ }
90
+
91
+ private function _verifyWorkersRunning()
92
+ {
93
+ foreach ($this->_getWorkerFiles() as $workerFile) {
94
+ if (is_readable('/proc')) {
95
+ list($frontName, $pid) = explode('-', basename($workerFile));
96
+ if (!file_exists("/proc/{$pid}")) {
97
+ Springbot_Log::debug("Procfile not found, removing work file for pid => $pid");
98
+ unlink($workerFile);
99
+ }
100
+ }
101
+ else if ((time() - file_get_contents($workerFile)) > self::WORKER_TIMEOUT) {
102
+ Springbot_Log::debug("/proc not readable and process timed out for pid => $pid");
103
+ unlink($workerFile);
104
+ }
105
+ }
106
+ }
107
+
108
+ private function _getWorkerCount()
109
+ {
110
+ return count($this->_getWorkerFiles());
111
+ }
112
+
113
+ private function _getWorkerFiles()
114
+ {
115
+ $glob = glob(Mage::getBaseDir('tmp') . DS . 'springbotworker*');
116
+ return $glob ? $glob : array();
117
+ }
118
+
119
+ private function _hasJobs()
120
+ {
121
+ return Mage::getModel('combine/cron_queue')->getCollection()->hasJobs();
122
+ }
123
+ }
Springbot-1.5.2.2/Springbot/Services/Work/Report.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Work_Report extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $keyUpper = ucwords($this->getClass());
8
+ $countModel = Mage::getModel('combine/cron_count');
9
+ $count = $countModel->getProcessedCount($this->getStoreId(), $this->getHarvestId(), $this->getClass());
10
+ $springbotStoreId = Mage::helper('combine/harvest')->getSpringbotStoreId($this->getStoreId());
11
+ $countModel->setCompletedTime($this->getStoreId(), $this->getHarvestId(), $this->getClass());
12
+ $startTime = $countModel->getEntityStartTime($this->getStoreId(), $this->getHarvestId(), $this->getClass());
13
+ $completedTime = $countModel->getEntityCompletedTime($this->getStoreId(), $this->getHarvestId(), $this->getClass());
14
+ $params = array(
15
+ 'store_id' => $springbotStoreId,
16
+ 'type' => $keyUpper,
17
+ 'sent' => $count,
18
+ 'started' => $startTime,
19
+ 'completed' => $completedTime,
20
+ );
21
+
22
+ Mage::helper('combine/harvest')->reportHarvestCount($params, $this->getHarvestId());
23
+ Springbot_Log::remote("Harvested {$count} {$keyUpper} from store " . $this->getStoreId(), $this->getStoreId());
24
+ }
25
+
26
+ }
Springbot-1.5.2.2/Springbot/Services/Work/Restart.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Work_Restart extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ $status = Mage::getModel('combine/cron_manager_status');
8
+
9
+ if($this->getForce()) {
10
+ $this->_getStatus()->removeWorkBlocker();
11
+ }
12
+
13
+ if($status->isActive()) {
14
+ $status->haltManager();
15
+ }
16
+ Springbot_Cli::startWorkManager();
17
+ }
18
+
19
+ }
Springbot-1.5.2.2/Springbot/Services/Work/Runner.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Work_Runner extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ if ($this->getIsForeman()) {
8
+ $filename = Mage::getBaseDir('tmp') . DS . 'springbotworkerforeman-' . getmypid();
9
+ }
10
+ else {
11
+ $filename = Mage::getBaseDir('tmp') . DS . 'springbotworker-' . getmypid();
12
+ }
13
+
14
+ Springbot_Log::debug("Creating workerfile : $filename");
15
+
16
+ file_put_contents($filename, time());
17
+
18
+ if(file_exists($filename)) {
19
+ if($this->hasEntityId()) {
20
+ Mage::getModel('combine/cron_worker')->run($this->getIsForeman(), $this->getEntityId());
21
+ }
22
+ else {
23
+ Mage::getModel('combine/cron_worker')->run($this->getIsForeman());
24
+ }
25
+
26
+ Springbot_Log::debug('Worker ' . getmypid() . ' spinning down');
27
+
28
+ @unlink($filename);
29
+ }
30
+ }
31
+
32
+ }
Springbot-1.5.2.2/Springbot/Services/Work/Stop.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Services_Work_Stop extends Springbot_Services
4
+ {
5
+ public function run()
6
+ {
7
+ if($this->getForce() === true) {
8
+ $this->_getStatus()->issueWorkBlocker();
9
+ }
10
+
11
+ do{
12
+ if($pid = $this->getPid()) {
13
+ Springbot_Log::debug("Issuing kill command for manager pid: {$pid}");
14
+ Springbot_Cli::spawn('kill ' . $pid);
15
+ } else {
16
+ Springbot_Log::debug("No active manager found, skipping");
17
+ }
18
+
19
+ if($pids = $this->_getStatus()->getActiveWorkerPids()) {
20
+ foreach ($pids as $pid) {
21
+ Springbot_Log::debug("Issuing kill command for worker pid: {$pid}");
22
+ Springbot_Cli::spawn('kill ' . $pid);
23
+ }
24
+ } else {
25
+ Springbot_Log::debug("No active workers found, skipping");
26
+ }
27
+
28
+ $this->_getManager()->cleanup();
29
+
30
+ sleep(2); // ensure that we don't get jobs spinning up
31
+ } while ($this->_getManager()->hasWorkers());
32
+ }
33
+
34
+ public function getPid()
35
+ {
36
+ if(isset($this->_data['pid'])) {
37
+ return parent;
38
+ } else {
39
+ return $this->_getStatus()->getPid();
40
+ }
41
+ }
42
+
43
+ protected function _getManager()
44
+ {
45
+ return new Springbot_Services_Work_Manager();
46
+ }
47
+ }
Springbot-1.5.2.2/Springbot/Shadow/Block/Action/View.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Shadow_Block_Action_View extends Mage_Core_Block_Template
4
+ {
5
+ protected function _toHtml()
6
+ {
7
+ return '<img src="' . $this->_getPixelUrl() . ' " style="position:absolute; visibility:hidden">';
8
+ }
9
+
10
+ private function _getPixelUrl()
11
+ {
12
+ $params = array(
13
+ 'store_id' => Mage::app()->getStore()->getStoreId(),
14
+ 'sku' => Mage::helper('combine/parser')->getTopLevelSku(Mage::registry('current_product')),
15
+ 'page_url' => Mage::helper('core/url')->getCurrentUrl(),
16
+ 'category_id' => Mage::helper('combine')->getLastCategoryId(),
17
+ );
18
+ return Mage::getUrl('springbot_update/action/view', array('_query' => $params));
19
+ }
20
+ }
Springbot-1.5.2.2/Springbot/Shadow/Block/Async.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Shadow_Block_Async extends Mage_Core_Block_Template
4
+ {
5
+ public function getSpringbotStoreId()
6
+ {
7
+ return Mage::helper('combine/harvest')->getSpringbotStoreId($this->_getStoreId());
8
+ }
9
+
10
+ public function getAssetsDomain()
11
+ {
12
+ return Mage::getStoreConfig('springbot/advanced/assets_domain');
13
+ }
14
+
15
+ public function getPublicId()
16
+ {
17
+ return Mage::helper('combine')->getPublicGuid($this->_getStoreId());
18
+ }
19
+
20
+ private function _getStoreId()
21
+ {
22
+ return Mage::app()->getStore()->getStoreId();
23
+ }
24
+ }
Springbot-1.5.2.2/Springbot/Shadow/Controller/Action.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Shadow_Controller_Action extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function preDispatch()
6
+ {
7
+ $this->setFlag('', self::FLAG_NO_PRE_DISPATCH, 1);
8
+ $this->setFlag('', self::FLAG_NO_POST_DISPATCH, 1);
9
+ parent::preDispatch();
10
+ return $this;
11
+ }
12
+
13
+ /**
14
+ * Return whether or not the current request is authenticated by a
15
+ * Springbot token in the header
16
+ *
17
+ * @return boolean
18
+ */
19
+ public function hasSbAuthToken()
20
+ {
21
+ $helper = Mage::helper('shadow/prattler');
22
+ $token = $helper->getPrattlerToken();
23
+ if (!$token) {
24
+ Springbot_Log::debug('Could not load security token to authenticated jobs endpoint');
25
+ }
26
+ else if ($this->getRequest()->getHeader('Springbot-Security-Token') != $token) {
27
+ Springbot_Log::debug('Supplied security token hash does not match');
28
+ } else {
29
+ return true;
30
+ }
31
+ return false;
32
+ }
33
+ }
Springbot-1.5.2.2/Springbot/Shadow/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Shadow_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ }
Springbot-1.5.2.2/Springbot/Shadow/Helper/Prattler.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Shadow_Helper_Prattler extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function getPrattlerToken()
6
+ {
7
+ $storeId = Mage::app()->getStore()->getStoreId();
8
+ $token = Mage::helper('bmbleb/account')->getSavedSecurityToken();
9
+ return sha1($token);
10
+ }
11
+
12
+ public function getPrattlerResponse()
13
+ {
14
+ $jobs = Mage::getModel('combine/cron_queue')->getCollection();
15
+ $events = Mage::getModel('combine/action')->getCollection();
16
+ return array(
17
+ 'success' => true,
18
+ 'jobs' => $jobs->getActiveCount(),
19
+ 'events' => $events->getSize()
20
+ );
21
+ }
22
+
23
+ public function getExceptionResponse($e)
24
+ {
25
+ return array(
26
+ 'success' => false,
27
+ 'message' => $e->getMessage(),
28
+ );
29
+ }
30
+ }
Springbot-1.5.2.2/Springbot/Shadow/Model/Listeners/Observer.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Shadow_Model_Listeners_Observer {
4
+
5
+ public function reconstituteCart($observer)
6
+ {
7
+ try {
8
+ if ($quoteId = Mage::app()->getRequest()->getParam('quote_id')) {
9
+ $suppliedSecurityHash = Mage::app()->getRequest()->getParam('sec_key');
10
+ Mage::helper('combine/cart')->setQuote($quoteId, $suppliedSecurityHash);
11
+ }
12
+ }
13
+ catch (Exception $e) {
14
+ Springbot_Log::error($e->getMessage());
15
+ }
16
+ return;
17
+ }
18
+
19
+ }
Springbot-1.5.2.2/Springbot/Shadow/controllers/ActionController.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Springbot_Shadow_ActionController extends Springbot_Shadow_Controller_Action
3
+ {
4
+ public function viewAction()
5
+ {
6
+ $params = $this->getRequest()->getParams();
7
+
8
+ $params['type'] = 'view';
9
+ $params['visitor_ip'] = (string)ip2long(Mage::helper('core/http')->getRemoteAddr());
10
+
11
+ Springbot_Boss::insertEvent($params);
12
+
13
+ // return 1x1 pixel transparent gif
14
+ $this->getResponse()->setHeader('Content-type', 'image/gif');
15
+ // needed to avoid cache time on browser side
16
+ $this->getResponse()->setHeader('Content-Length', '42');
17
+ $this->getResponse()->setHeader('Cache-Control', 'private, no-cache, no-cache=Set-Cookie, proxy-revalidate');
18
+ $this->getResponse()->setHeader('Expires', 'Wed, 11 Jan 2000 12:59:00 GMT');
19
+ $this->getResponse()->setHeader('Last-Modified', 'Wed, 11 Jan 2006 12:59:00 GMT');
20
+ $this->getResponse()->setHeader('Pragma', 'no-cache');
21
+ $this->getResponse()->setBody(sprintf('%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%',71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59));
22
+ }
23
+ }
Springbot-1.5.2.2/Springbot/Shadow/controllers/IndexController.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Springbot_Shadow_IndexController extends Springbot_Shadow_Controller_Action
3
+ {
4
+ /**
5
+ * Order of priority desc - "there can only be one!"
6
+ */
7
+ private $_redirectIds = array(
8
+ 'sb',
9
+ 'redirect_mongo_id',
10
+ );
11
+
12
+ public function indexAction()
13
+ {
14
+ try {
15
+ $params = $this->getRequest()->getParams();
16
+
17
+ // Maintain backward compatibility
18
+ $aliases = array('run', 'healthcheck');
19
+ foreach ($aliases as $alias) {
20
+ if (isset($params[$alias])) {
21
+ $params['task'] = $alias;
22
+ unset($params[$alias]);
23
+ }
24
+ }
25
+
26
+ if (isset($params['email'])) {
27
+ $this->emailCaller();
28
+ }
29
+ else if (isset($params['trackable']) && isset($params['type'])) {
30
+ $this->trackableCaller();
31
+ }
32
+ else if (isset($params['task'])) {
33
+ if ($this->hasSbAuthToken()) {
34
+ $task = $params['task'];
35
+ unset($params['task']);
36
+ if ($task = Springbot_Services_Tasks::makeTask($task, $params)) {
37
+ $responseBody = json_encode($task->run());
38
+ $this->getResponse()->setHeader('Content-type', 'application/json');
39
+ $this->getResponse()->setBody($responseBody);
40
+ }
41
+ }
42
+ else {
43
+ $this->getResponse()->setHttpResponseCode(401);
44
+ }
45
+ }
46
+ else if (isset($params['view_log'])) {
47
+ if ($this->hasSbAuthToken()) {
48
+ $this->viewLogCaller();
49
+ }
50
+ else {
51
+ $this->getResponse()->setHttpResponseCode(401);
52
+ }
53
+ }
54
+
55
+ } catch (Exception $e) {
56
+ Springbot_Log::error($e->getMessage());
57
+ $helper = Mage::helper('shadow/prattler');
58
+ $this->getResponse()->setHeader('Content-type', 'application/json');
59
+ $this->getResponse()->setBody(json_encode($helper->getExceptionResponse($e)));
60
+ }
61
+ }
62
+
63
+
64
+ private function emailCaller()
65
+ {
66
+ if ($quote = Mage::getSingleton('checkout/session')->getQuote()) {
67
+ $sessionQuoteExists = $quote->hasEntityId();
68
+
69
+ // If there is no email address associated with the quote, check to see if one exists from our js listener
70
+ if (!$quote->getCustomerEmail()) {
71
+ $quote->setCustomerEmail($this->getRequest()->getParam('email'));
72
+ $quote->save();
73
+ }
74
+
75
+ if (!$sessionQuoteExists) {
76
+ Mage::getSingleton('checkout/session')->setQuoteId($quote->getId());
77
+ }
78
+
79
+ $this->getResponse()->setHeader('Content-type', 'application/json');
80
+ $this->getResponse()->setBody('{}');
81
+ }
82
+ }
83
+
84
+ private function trackableCaller()
85
+ {
86
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
87
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
88
+ $customerId = $customerData->getId();
89
+ }
90
+ else {
91
+ $customerId = null;
92
+ }
93
+
94
+ if ($quote = Mage::getModel('checkout/session')->getQuote()) {
95
+ $quoteId = $quote->getId();
96
+ }
97
+ else {
98
+ $quoteId = null;
99
+ }
100
+
101
+ Springbot_Boss::addTrackable(
102
+ $this->getRequest()->getParam('type'),
103
+ $this->getRequest()->getParam('trackable'),
104
+ $quoteId,
105
+ $customerId
106
+ );
107
+ }
108
+
109
+
110
+ private function viewLogCaller()
111
+ {
112
+ if ($this->hasSbAuthToken()) {
113
+ $logName = $this->getRequest()->getParam('view_log');
114
+ $logName = str_replace('..', '', $logName);
115
+ $logPath = Mage::getBaseDir('log') . DS . $logName;
116
+ if (!is_file($logPath) || !is_readable($logPath)) {
117
+ $this->getResponse()->setHeader('Content-type', 'application/json');
118
+ $this->getResponse()->setBody('{"success": false}');
119
+ }
120
+ else {
121
+ $this->getResponse()
122
+ ->setHttpResponseCode(200)
123
+ ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true )
124
+ ->setHeader('Pragma', 'public', true )
125
+ ->setHeader('Content-type', 'application/force-download')
126
+ ->setHeader('Content-Length', filesize($logPath))
127
+ ->setHeader('Content-Disposition', 'attachment' . '; filename=' . basename($logPath) );
128
+ $this->getResponse()->clearBody();
129
+ $this->getResponse()->sendHeaders();
130
+ readfile($logPath);
131
+ exit;
132
+ }
133
+ }
134
+ }
135
+
136
+
137
+
138
+
139
+
140
+
141
+ }
Springbot-1.5.2.2/Springbot/Shadow/etc/config.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Springbot_Shadow>
5
+ <version>0.1.0</version>
6
+ </Springbot_Shadow>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <shadow>
11
+ <class>Springbot_Shadow_Model</class>
12
+ </shadow>
13
+ </models>
14
+ <helpers>
15
+ <shadow>
16
+ <class>Springbot_Shadow_Helper</class>
17
+ </shadow>
18
+ </helpers>
19
+ <blocks>
20
+ <shadow>
21
+ <class>Springbot_Shadow_Block</class>
22
+ </shadow>
23
+ </blocks>
24
+ </global>
25
+ <frontend>
26
+ <routers>
27
+ <shadow>
28
+ <use>standard</use>
29
+ <args>
30
+ <module>Springbot_Shadow</module>
31
+ <frontName>springbot_update</frontName>
32
+ </args>
33
+ </shadow>
34
+ </routers>
35
+ <layout>
36
+ <updates>
37
+ <shadow>
38
+ <file>shadow.xml</file>
39
+ </shadow>
40
+ </updates>
41
+ </layout>
42
+ <events>
43
+ <controller_action_predispatch_checkout_cart_index>
44
+ <observers>
45
+ <springbot_shadow_observer>
46
+ <type>singleton</type>
47
+ <class>shadow/listeners_observer</class>
48
+ <method>reconstituteCart</method>
49
+ </springbot_shadow_observer>
50
+ </observers>
51
+ </controller_action_predispatch_checkout_cart_index>
52
+ </events>
53
+ </frontend>
54
+ </config>
55
+
Springbot-1.5.2.2/Springbot/Util/Caller.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Util_Caller
4
+ {
5
+ public $class;
6
+ public $line;
7
+ public $method;
8
+ public $call_type;
9
+
10
+ private static $_trace;
11
+
12
+ public function __construct($class, $method, $type, $line)
13
+ {
14
+ $this->class = $class;
15
+ $this->method = $method;
16
+ $this->call_type = $type;
17
+ $this->line = $line;
18
+ }
19
+
20
+ /**
21
+ * This weird little method returns an instance of this class
22
+ * populated with data retrived from the backtrace inspection.
23
+ *
24
+ * @param $depth int
25
+ * @return Springbot_Util_Caller
26
+ */
27
+ public static function find($depth = 1)
28
+ {
29
+ self::$_trace = debug_backtrace();
30
+
31
+ // Get the class that is asking for who awoke it
32
+ $caller = self::$_trace[$depth];
33
+ $called = self::_getCalledAt($depth);
34
+
35
+ return new Springbot_Util_Caller(
36
+ self::_safeGet($caller, 'class'),
37
+ self::_safeGet($caller, 'function'),
38
+ self::_safeGet($caller, 'type'),
39
+ self::_safeGet($called, 'line')
40
+ );
41
+ }
42
+
43
+ protected static function _safeGet($array, $key)
44
+ {
45
+ return isset($array[$key]) ? $array[$key] : null;
46
+ }
47
+
48
+ private static function _getCalledAt($depth)
49
+ {
50
+ return self::_safeGet(self::$_trace, $depth - 1);
51
+ }
52
+
53
+ }
Springbot-1.5.2.2/Springbot/Util/Categories.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Util_Categories
4
+ {
5
+ protected $_product;
6
+ protected $_paths = array();
7
+ protected $_pathsBuilt = false;
8
+
9
+ public function __construct(Mage_Catalog_Model_Product $product)
10
+ {
11
+ $this->_product = $product;
12
+ }
13
+
14
+ public static function forProduct($product)
15
+ {
16
+ return new Springbot_Util_Categories($product);
17
+ }
18
+
19
+ public function getRoots()
20
+ {
21
+ $roots = array();
22
+ foreach($this->_getPaths() as $path) {
23
+ if(isset($path[2])) {
24
+ $roots[] = $path[2];
25
+ }
26
+ }
27
+ return array_values(array_unique($roots));
28
+ }
29
+
30
+ public function getAll()
31
+ {
32
+ $categories = array();
33
+ foreach($this->_getPaths() as $path) {
34
+ $categories = array_merge($path, $categories);
35
+ }
36
+ sort($categories);
37
+ return array_values(array_unique($categories));
38
+ }
39
+
40
+ protected function _getPaths()
41
+ {
42
+ if(!$this->_pathsBuilt) {
43
+ $_paths = $this->_getColumnValues();
44
+ foreach($_paths as $_path) {
45
+ $path = explode('/', $_path);
46
+ if(count($path) > 2) {
47
+ $this->_paths[] = $path;
48
+ }
49
+ }
50
+ $this->_pathsBuild = true;
51
+ }
52
+ return $this->_paths;
53
+ }
54
+
55
+ /*
56
+ * This might not happen in practice, but we were seeing
57
+ * tests return the CategoryCollection as an object of
58
+ * type Varien_Data_Tree_Node_Collection, which does not
59
+ * have getColumnValues. This is mostly so the tests will
60
+ * pass, but it doesn't hurt anyting to leave it in.
61
+ */
62
+ protected function _getColumnValues()
63
+ {
64
+ $collection = $this->_product->getCategoryCollection();
65
+ if(method_exists($collection, 'getColumnValues')) {
66
+ return $collection->getColumnValues('path');
67
+ } else {
68
+ return array();
69
+ }
70
+ }
71
+ }
Springbot-1.5.2.2/Springbot/Util/Log/Rollover.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Util_Log_Rollover
4
+ {
5
+ protected $_globbed = array();
6
+
7
+ public function reset()
8
+ {
9
+ $this->_globbed = array();
10
+ }
11
+
12
+ public function ensureLogSize()
13
+ {
14
+ Springbot_Log::debug('Ensure log size');
15
+
16
+ foreach($this->getLogFilenames() as $filename) {
17
+ if($this->sizeLimitReached($filename)) {
18
+ Springbot_Log::debug('File limit reached for ' . $filename);
19
+ $this->rolloverLog($filename);
20
+ }
21
+ }
22
+ }
23
+
24
+ public function rolloverLog($initFilename)
25
+ {
26
+ $filename = $this->_qualify($initFilename);
27
+ Springbot_Log::debug("Rolling log for $filename");
28
+ if(file_exists($filename)) {
29
+ Springbot_Log::debug('Rolling over ' . $filename);
30
+ $id = $this->_getNextLogId($filename);
31
+ rename($filename, $filename . '.' . $id);
32
+ Springbot_Log::release($initFilename);
33
+ }
34
+ }
35
+
36
+ public function expireLogs()
37
+ {
38
+ Springbot_Log::debug('Check expire time');
39
+
40
+ foreach($this->getLogFilenames() as $filename) {
41
+ foreach($this->getGlobbedFilenames($filename) as $file) {
42
+ $this->_expireFile($file);
43
+ }
44
+ }
45
+ }
46
+
47
+ public function getGlobbedFilenames($filename)
48
+ {
49
+ if(!isset($this->_globbed[$filename])) {
50
+ $filename = $this->_qualify($filename);
51
+ $pattern = $filename . '.*';
52
+ $glob = glob($pattern);
53
+ $this->_globbed[$filename] = isset($glob) ? $glob : array();
54
+ Springbot_Log::debug("Checking glob for $pattern, returns " . count($this->_globbed[$filename]) . " results");
55
+ }
56
+ return $this->_globbed[$filename];
57
+ }
58
+
59
+ public function getLogFilenames()
60
+ {
61
+ return array(
62
+ Springbot_Log::LOGFILE,
63
+ Springbot_Log::ERRFILE,
64
+ Springbot_Log::HTTPFILE
65
+ );
66
+ }
67
+
68
+ public function sizeLimitReached($filename)
69
+ {
70
+ $filename = $this->_qualify($filename);
71
+ $fileLimit = Mage::getStoreConfig('springbot/debug/filesize_limit');
72
+
73
+ if(file_exists($filename)) {
74
+ return filesize($filename) > $fileLimit;
75
+ } else {
76
+ return false;
77
+ }
78
+ }
79
+
80
+ protected function _getNextLogId($filename)
81
+ {
82
+ $ids = array(0);
83
+ foreach($this->getGlobbedFilenames($filename) as $file) {
84
+ $matches = array();
85
+ preg_match('/\d+$/', $file, $matches);
86
+ if(isset($matches[0])) {
87
+ $ids[] = $matches[0];
88
+ }
89
+ }
90
+ $id = max($ids) + 1;
91
+ Springbot_Log::debug("Next id: $id");
92
+ return $id;
93
+ }
94
+
95
+ protected function _qualify($filename)
96
+ {
97
+ return $this->_getLogDir() . DS . basename($filename);
98
+ }
99
+
100
+ protected function _getLogDir()
101
+ {
102
+ return Mage::getBaseDir('var') . DS . 'log';
103
+ }
104
+
105
+ protected function _expireFile($file)
106
+ {
107
+ if(file_exists($file)) {
108
+ $elapsedSinceModified = time() - filectime($file);
109
+ if($elapsedSinceModified > $this->_getExpireLimit()) {
110
+ Springbot_Log::debug("Removing $file due to expiration");
111
+ unlink($file);
112
+ }
113
+ }
114
+ }
115
+
116
+ private function _getExpireLimit()
117
+ {
118
+ // converting days into seconds for comparision to filectime
119
+ return Mage::getStoreConfig('springbot/debug/expire_time_days') * 24 * 60 * 60;
120
+ }
121
+ }
Springbot-1.5.2.2/Springbot/Util/Logger.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Util_Logger
4
+ {
5
+ const SIMPLE_FORMAT = '%message%';
6
+ const DEFAULT_FORMAT = '%timestamp% %priorityName% (%priority%): %message%';
7
+ const EXPANDED_FORMAT = '%timestamp% %className%%callType%%method%(%line%) [%priorityName%] : %message%';
8
+
9
+ protected static $_loggers = array();
10
+
11
+ protected $_format;
12
+
13
+ public function log($message, $level, $file, $format = null, $extras = null)
14
+ {
15
+ switch ($format) {
16
+ case 'simple':
17
+ $this->_format = self::SIMPLE_FORMAT;
18
+ break;
19
+ case 'expanded':
20
+ $this->_format = self::EXPANDED_FORMAT;
21
+ break;
22
+ default:
23
+ $this->_format = self::DEFAULT_FORMAT;
24
+ }
25
+ $this->_log($message, $level, $file, $extras);
26
+ }
27
+
28
+ public function release($filename)
29
+ {
30
+ Springbot_Log::debug('Releasing log for ' . $filename);
31
+ unset(self::$_loggers[$filename]);
32
+ $this->_provisionLogFile($filename);
33
+ }
34
+
35
+ protected function _log($message, $level, $file, $extras = null)
36
+ {
37
+ try {
38
+ if (!isset(self::$_loggers[$file])) {
39
+ $this->_provisionLogFile($file);
40
+ }
41
+
42
+ if (is_array($message) || is_object($message)) {
43
+ $message = print_r($message, true);
44
+ }
45
+
46
+ self::$_loggers[$file]->log($message, $level, $extras);
47
+ }
48
+ catch (Exception $e) {
49
+ Springbot_Log::error($e->getMessage());
50
+ }
51
+ }
52
+
53
+ private function _provisionLogFile($file)
54
+ {
55
+ $logDir = Mage::getBaseDir('var') . DS . 'log';
56
+ $logFile = $logDir . DS . $file;
57
+
58
+ if (!is_dir($logDir)) {
59
+ mkdir($logDir);
60
+ chmod($logDir, 0777);
61
+ }
62
+
63
+ if (!file_exists($logFile)) {
64
+ file_put_contents($logFile, '');
65
+ chmod($logFile, 0777);
66
+ }
67
+
68
+ $format = $this->_format . PHP_EOL;
69
+
70
+ $formatter = new Zend_Log_Formatter_Simple($format);
71
+ $writer = new Zend_Log_Writer_Stream($logFile);
72
+ $writer->setFormatter($formatter);
73
+ self::$_loggers[$file] = new Zend_Log($writer);
74
+
75
+ }
76
+ }
Springbot-1.5.2.2/Springbot/Util/Partition.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Util_Partition
4
+ {
5
+ public $start;
6
+ public $stop;
7
+
8
+ public function __construct($start, $stop)
9
+ {
10
+ $this->start = $start;
11
+ $this->stop = $stop;
12
+ }
13
+
14
+ public function fromStart()
15
+ {
16
+ return $this->start . ':';
17
+ }
18
+
19
+ public function __toString()
20
+ {
21
+ // We are non-inclusive from the start
22
+ return ($this->start - 1) . ':' . $this->stop;
23
+ }
24
+ }
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/bmbleb.css ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* General Styles */
2
+ .clear {
3
+ clear: both;
4
+ }
5
+
6
+ .bmbleb-adminhtml-jobs-index #id {
7
+ float:left;
8
+ }
9
+
10
+ #bmbleb-sync-now {
11
+ height:170px;
12
+ width:170px;
13
+ }
14
+
15
+ #bmbleb-sync-stats-left{width:170px; float: left; text-align:center;}
16
+ #bmbleb-sync-stats-right{width:600px; float: left; margin:32px 0 0 40px;}
17
+
18
+ table.bmbleb-stat-table {
19
+ font-family:Arial;
20
+ font-size: 14px;
21
+ font-style: normal;
22
+ font-weight: normal;
23
+ text-transform: capitalize;
24
+ letter-spacing: -1px;
25
+ line-height: 1.7em;
26
+ text-align:left;
27
+ border-collapse:collapse;
28
+ }
29
+
30
+ table.bmbleb-stat-table td {
31
+ padding:5px 0 5px 10px;
32
+ text-shadow:1px 1px 1px #fff;
33
+ }
34
+
35
+ table.bmbleb-stat-table tr{
36
+ border-bottom:1px solid #fff;
37
+ }
38
+
39
+ table.bmbleb-stat-table tr.bmbleb-table-last-row{
40
+ border-bottom:none;
41
+ }
42
+
43
+ table.bmbleb-stat-table tr td.cell1{
44
+ font-weight:bold;
45
+ color: #338007;
46
+ border-right:1px solid #c0c0c0;
47
+ width:75px
48
+ }
49
+ table.bmbleb-stat-table tr td.cell2{
50
+ width:325px
51
+ }
52
+
53
+ table.bmbleb-stat-table{
54
+ font-style: normal;
55
+ font-weight: normal;
56
+ letter-spacing: -1px;
57
+ line-height: 1.2em;
58
+ border-collapse:collapse;
59
+ text-align:center;
60
+ }
61
+
62
+ .bmbleb-stat-table thead th {
63
+ padding:20px 10px 20px 10px;
64
+ color:#fff;
65
+ background-color:#222;
66
+ border-right:1px solid #666;
67
+ -moz-box-shadow:0px -1px 4px #000;
68
+ -webkit-box-shadow:0px -1px 4px #000;
69
+ box-shadow:0px -1px 4px #000;
70
+ text-shadow:0px 0px 1px #fff;
71
+ text-shadow:1px 1px 1px #000;
72
+ }
73
+
74
+ .bmbleb-stat-table thead :nth-last-child(1){
75
+ border-right:none;
76
+ }
77
+
78
+ .bmbleb-stat-tablethead :first-child,
79
+ .bmbleb-stat-table tbody :nth-last-child(1){
80
+ border:none;
81
+ }
82
+
83
+ .bmbleb-stat-table tbody td{
84
+ padding:10px;
85
+ background-color:#f0f0f0;
86
+ border-right:1px solid #9e9e9e;
87
+ text-shadow:-1px 1px 1px #fff;
88
+ text-transform:uppercase;
89
+ color:#333;
90
+ }
91
+
92
+ .bmbleb-account-index col {
93
+ width:30%;
94
+ }
95
+
96
+ .bmbleb-mgr-status label {
97
+ padding-right: 8px;
98
+ display: inline-block;
99
+ width: 70%;
100
+ }
101
+
102
+ .bmbleb-mgr-status button {
103
+ float: right;
104
+ }
105
+
106
+ .bmbleb-mgr-status .status-alert-active {
107
+ font-weight: bold;
108
+ color: green;
109
+ }
110
+
111
+ .bmbleb-mgr-status .status-alert-inactive {
112
+ font-weight: bold;
113
+ color: red;
114
+ }
115
+
116
+ /*-----------style for new design-----*/
117
+
118
+ #login-register-wrapper {width:600px; margin:0px auto; font-family:Arial, Helvetica, sans-serif;}
119
+ #login-register-wrapper .bmb-logo {float:left; margin:0 25px 0 0;}
120
+ #login-register-wrapper .content-header-block {float:left; }
121
+ #login-register-wrapper .content-header-block h3{float:none; font-size:24px; padding-bottom:10px; color:#63A814; margin-bottom:5px; background:url(images/top-sept.png) no-repeat bottom left;}
122
+ #login-register-wrapper .header-content {float:left; width:auto;}
123
+ #login-register-wrapper .header-content h2 {font-size:18px; color:#000; margin:0px; padding:0px;}
124
+ #login-register-wrapper .header-content p {font-size:14px; color:#333333; padding:5px 0;}
125
+ #login-register-wrapper .form-wrap {margin:2px 3px 3px 2px; min-height:420px; background:#F9F9F9; border:1px solid #CCCCCC; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; -o-border-radius:5px; -webkit-box-shadow: 0px 0px 2px 1px #EEEEEE; -moz-box-shadow: 0px 0px 2px 1px #EEEEEE; box-shadow: 0px 0px 2px 1px #EEEEEE;}
126
+ /* removed font-weight: bold from the line below this one for IE9 fix */
127
+ #login-register-wrapper .form-wrap .entry-edit-head {border-bottom:1px solid #CCCCCC; padding: 14px 10px; color:#63A814; font-size:18px; }
128
+ #login-register-wrapper .form-wrap .entry-edit-head h4 {color:#63A814; padding:0 0 0 50px; margin:0 0 0 15px; height:28px; line-height:28px; background:url(images/login-icn.png) no-repeat left center; display:block;}
129
+ #login-register-wrapper .form-wrap .fieldset {padding:20px 0px 0 80px;}
130
+ #login-register-wrapper .form-wrap .fieldset label {color:#000; font-size:14px; padding: 0 0 4px; display:block;}
131
+
132
+ #login-register-wrapper .form-wrap input.input-text {padding:5px 10px; height:25px; line-height:25px; border:1px solid #999999; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; -o-border-radius:5px; width:300px; -webkit-box-shadow: 0 1px 2px 0 #666666 inset; -moz-box-shadow: 0 1px 2px 0 #666666 inset; box-shadow: 0 1px 2px 0 #666666 inset; font-size:14px; }
133
+ #login-register-wrapper button {background: url(images/submit-btn-bg.png) repeat-x scroll top left ; border:1px solid #265602; border-radius: 5px 5px 5px 5px; color: #FFFFFF; cursor: pointer; font-size: 14px; font-weight: bold; height: 34px; padding: 5px 15px; -webkit-box-shadow: 0px 1px 4px 0px #cccccc; -moz-box-shadow: 0px 1px 4px 0px #cccccc; box-shadow: 0px 1px 4px 0px #cccccc; font-size:16px; text-shadow: 1px 1px #333333;}
134
+ #login-register-wrapper button:hover {background-position: 0 -37px;}
135
+ /* formerly - removed entry-edit wrapping element
136
+ #login-register-wrapper .form-wrap .form-buttons {margin:15px 0 0 0; padding:0 0 0 5px;}
137
+ */
138
+ #login-register-wrapper .form-buttons {margin:15px 0 0 0; padding:0 0 0 5px;}
139
+ #login-register-wrapper .forgot-pwd {float:left; width:100%; margin:50px 0 0 0;}
140
+ #login-register-wrapper .forgot-pwd a {color:#63A814; text-decoration:underline; font-size:13px;}
141
+ #login-register-wrapper .forgot-pwd a:hover {text-decoration:none;}
142
+ #login-register-wrapper .form-wrap form#register_form .entry-edit-head h4 {background:url(images/register.png) no-repeat left center;}
143
+ #login-register-wrapper .form-wrap.last {background:#F9F9F9 url(images/registration-bg.png) no-repeat left top;}
144
+
145
+ /* New Login Form Hacks, Broke in > IE7 */
146
+ .middle #login-register-wrapper td { float:left; display:inline; padding:0; }
147
+ .middle #login-register-wrapper td.label { height:14px; margin:0; padding:0; }
148
+ .middle #login-register-wrapper td.value input.input-text { margin:0; }
149
+
150
+
151
+
152
+ /* CSS add by Jitendra On 14 March (14-03-2012) */
153
+ .left-logo {float:left; width:100%; height:104px;}
154
+ .left-logo img{float:left; margin-top:17px;}
155
+ ul.tabs {float:left; width:218px; clear:both;}
156
+ ul.tabs li a {background:#E7EFEF;}
157
+ ul.tabs li a:hover {background:#D8E6E6;}
158
+ ul.tabs li a span {padding-left:34px; background:url(images/left-ico1.png) no-repeat 5px 50%; }
159
+ ul.tabs li {border-bottom:dotted #636363 1px;}
160
+ ul.tabs li a.active {border:none; background-color:#fff; color:#67AB18;}
161
+ ul.tabs li.ico1 a span, ul.tabs li.ico1 a:hover span, ul.tabs li.ico1 a.active span {background:url(images/left-ico1.png) no-repeat 5px 50%;}
162
+ ul.tabs li.ico2 a span, ul.tabs li.ico2 a:hover span, ul.tabs li.ico2 a.active span {background:url(images/left-ico2.png) no-repeat 5px 50%;}
163
+ ul.tabs li.ico3 a span, ul.tabs li.ico3 a:hover span, ul.tabs li.ico3 a.active span {background:url(images/left-ico3.png) no-repeat 5px 50%;}
164
+ ul.tabs li.ico4 a span, ul.tabs li.ico4 a:hover span, ul.tabs li.ico4 a.active span {background:url(images/left-ico4.png) no-repeat 5px 50%;}
165
+ ul.tabs li.ico5 a span, ul.tabs li.ico5 a:hover span, ul.tabs li.ico5 a.active span {background:url(images/left-ico5.png) no-repeat 5px 50%;}
166
+ ul.tabs li.ico6 a span, ul.tabs li.ico6 a:hover span, ul.tabs li.ico6 a.active span {background:url(images/left-ico6.png) no-repeat 5px 50%;}
167
+ ul.tabs li.ico7 a span, ul.tabs li.ico7 a:hover span, ul.tabs li.ico7 a.active span {background:url(images/left-ico7.png) no-repeat 5px 50%;}
168
+ ul.tabs li.ico8 a span, ul.tabs li.ico8 a:hover span, ul.tabs li.ico8 a.active span {background:url(images/left-ico8.png) no-repeat 5px 50%;}
169
+ ul.tabs li.ico9 a span, ul.tabs li.ico9 a:hover span, ul.tabs li.ico9 a.active span {background:url(images/left-ico_demographics.png) no-repeat 5px 50%;}
170
+
171
+ .j-content {float:left; width:100%; font-size:14px; min-width:970px; color:#333; }
172
+
173
+ .j-content .j-box-left {float:left; min-width:310px; margin-right:20px; width:31%;}
174
+ .j-content .j-box-left h3, h3.alert-head {background:url(images/h3-bg.png) repeat-x bottom; height:72px; float:left; width:100%; margin-bottom:20px; line-height:72px; color:#333333; font-size:24px; font-weight:bold;}
175
+ .j-content .j-box-left h3 span.head, h3.alert-head span.head {float:left; padding-left:50px; background:url(images/icon-alert.png) no-repeat 4px 50%; height:68px; line-height:68px;}
176
+ .j-content .j-box-left h3 .counter {height:33px; line-height:33px; float:right; background:#FFF9E9; border:solid 1px #EEE2BE; padding:0 8px; color:#000; font-size:18px; font-weight:bold; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; margin-top:16px;}
177
+ .j-content .j-box-left.box2 h3 span.head {background-image:url(images/icon-insights.png);}
178
+ .j-content .j-box-left.box2 h3 {margin-bottom:10px;}
179
+ .j-content .j-box-left.box3 h3 span.head {background-image:url(images/icon-status.png);}
180
+ .j-content .j-box-left p {color:#333; margin-bottom:20px;}
181
+
182
+
183
+ .timebox {float:left; width:100%; height:116px; position:relative; margin-top:12px;}
184
+ .timebox .watch-m {position:absolute; top:0; left:0; z-index:2;}
185
+ .timebox .timebox-bg {position:absolute; z-index:1; height:48px; width:100%; left:0; top:34px; background:#E1EDD1; border-radius:5px; box-shadow:0 0 3px #aaa inset;}
186
+ .jbtn {background: url(images/submit-btn-bg.png) repeat-x scroll top left ; border:1px solid #265602; border-radius: 5px; color: #FFFFFF !important; cursor: pointer; font-size: 14px; font-weight: bold; height: 34px; line-height:34px; padding: 0px;text-align:center; -webkit-box-shadow: 0px 1px 4px 0px #cccccc; -moz-box-shadow: 0px 1px 4px 0px #cccccc; box-shadow: 0px 1px 4px 0px #cccccc; font-size:16px; float:right; margin:6px 6px 0 0 ; text-decoration:none !important; text-shadow: 1px 1px #333333;}
187
+ .jbtn.btn1 {float:left; padding:0 12px;}
188
+ .jbtn:hover {background-position: 0 -37px;}
189
+ .cancle {float:left; margin:14px 0 0 10px; }
190
+ .timebox .timebox-bg .timebox-in.jbtn { width:160px; }
191
+
192
+ .chart-box-outer {width:310px; margin:0 auto;}
193
+ .chart-box {float:left; width:100%; text-align:center; position:relative;}
194
+
195
+ .box2-down {float:left; width:100%; text-align:center; margin-top:50px; line-height:24px;}
196
+ .j-content a {color:#63A814; text-decoration:underline;}
197
+ .j-content a:hover {text-decoration:none;}
198
+ .box3-up {float:left; width:100%;}
199
+ .box3-tbl td {border-bottom:solid 1px #ccc; padding:10px 0; color:#666;}
200
+ .box3-tbl td+td+td {font-weight:bold; color:#000;}
201
+ .box3-tbl tr:first-child td {padding-top:0;}
202
+
203
+ .j-box-left.box3 {margin-right:0;}
204
+ .box3-up .link {float:left; margin:10px 0;}
205
+ .upgrade-box {width:100%; background:#E1EDD1; border-radius:5px; box-shadow:0 0 3px #aaa inset; float:left; margin-top:10px;}
206
+ .upgrade-box a.upg-btn.jbtn { width:90%; margin:20px 0 20px 5%; float:left; }
207
+
208
+ .upgrade-box span {float:left; width:100%; text-align:center; padding-bottom:23px;}
209
+ .wrapper {min-width:1245px;}
210
+
211
+ .headline {float:left; width:100%; height:35px; background:url(images/grn-bg.png) no-repeat left; margin-bottom:15px;}
212
+ .headline.orng {background-image:url(images/orng-bg.png);}
213
+ .headline span {float:left; margin-left:12px; line-height:35px; font-weight:bold; }
214
+ .j-content h4 {float:left; width:100%; font-size:14px; font-weight:bold; color:#333; margin:0; padding:6px 0;}
215
+ .j-content h2 {float:left; width:100%; font-size:18px; color:#333; margin:0; padding:10px 0;}
216
+ .marl12 {float:left; margin-left:12px;}
217
+ .w100per {width:100%; float:left;}
218
+ .marb20 {margin-bottom:20px;}
219
+
220
+ .jleft-box {width:638px; float:left; background:#FFF9E9; border:solid 1px #EEE2BE; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; margin-bottom:10px; line-height:1;}
221
+ .jright-box {width:310px; float:right; background:#E1EDD1; box-shadow:0 0 3px #aaa inset; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; overflow:hidden; text-align:center; font-weight:bold; font-size:16px; line-height:1; margin-bottom:10px;}
222
+ .pad12 {padding:12px;}
223
+ .to-do {float:left; width:100%; padding-bottom:20px; font-size:16px;}
224
+ .to-do span.ttl {display:block; float:left; width:100%; color:#666; font-size:13px; margin-bottom:8px; font-weight:bold;}
225
+ .jleft-box .to-do {padding:12px 0; font-size:14px;}
226
+
227
+ .jright-box .timer-up {float:left; width:100%; padding:17px 0 10px 0;}
228
+ .jright-box .timer-mid {float:left; width:100%; font-size:48px; padding:0px 0 10px 0;}
229
+ .jright-box .timer-down {float:left; width:100%; background:url(images/check.png) no-repeat 41px 12px #63A814; height:43px; line-height:43px; color:#fff; }
230
+ .pad12left {padding-left:12px;}
231
+ .msg-row {color:#666; margin-bottom:15px;}
232
+
233
+ .entry-edit-form td.label1 {padding:5px 5px 0 5px;}
234
+ .entry-edit-form td.label2 {padding:0px 5px 5px 5px;}
235
+ .entry-edit-form .content-footer, .entry-edit-form .hor-scroll {float:left;}
236
+ .entry-edit-form .content-footer {*float:none;}
237
+
238
+ /* CSS jitendra ends */
239
+
240
+
241
+ /* Help Screen */
242
+ #help-screen-wrap { width:100%; }
243
+ #help-screen-wrap:after { content:'.'; clear:both; display:block; height:0; visibility:hidden; }
244
+ #help-screen-wrap .col-one { float:left; margin-left:30px; width:60%; }
245
+ #help-screen-wrap .col-two { float:left; margin-left:30px; width:30%; }
246
+
247
+ #help-screen-wrap label.gsfn_label { display:block; margin-bottom:20px; font-weight:bold; }
248
+ #help-screen-wrap input#gsfn_search_query {
249
+ border: 1px solid #999999;
250
+ border-radius: 5px 5px 5px 5px;
251
+ box-shadow: 0 1px 2px 0 #666666 inset;
252
+ font-size: 14px;
253
+ height: 25px;
254
+ line-height: 25px;
255
+ margin:0 0 20px;
256
+ padding: 5px 10px;
257
+ width: 300px;
258
+ }
259
+ #help-screen-wrap input#continue { clear:both; display:block; }
260
+
261
+ /* Terms & Conditions */
262
+ .tc-info { float:right; display:inline; padding-top:20px; }
263
+ .tc-link {}
264
+ .tc-link a {}
265
+
266
+ .tc-content { position:relative; margin-bottom:40px; }
267
+ .tc-content-inner {}
268
+ .tc-content { display:none; height:0; }
269
+ .tc-content h3 { color:#333; font-size:24px; font-weight:bold; line-height:72px; margin-bottom:20px; }
270
+ .tc-content hr { margin:30px 0; }
271
+ .tc-content .close-btn { font-size:12px; font-weight:bold; text-align:right; padding-top:10px; }
272
+ #MB_window .tc-content { display:block; height:auto; padding:30px; }
273
+ #MB_window { z-index:999; }
274
+ #MB_window,
275
+ #MB_frame { background-color:#fff!important; }
276
+ #MB_caption { text-shadow:none; }
277
+
278
+ /* IE7 Hack */
279
+ .main-col { z-index:999!important; }
280
+
281
+ /* extras for login/register form */
282
+ #login-register-wrapper div.form-wrap { width:48%; float:left; margin-top:20px; margin-right:20px; }
283
+ #login-register-wrapper div.form-wrap.last { margin-right:0; }
284
+
285
+ #login-register-wrapper div.form-wrap .form-list td.value input.input-text { width:90%; }
286
+ #login-register-wrapper div.form-wrap .form-list td.label label { width:100%; padding-right:10px; }
287
+
288
+ #login-register-wrapper .entry-edit .entry-edit-head { background:none; }
289
+ /*#login-register-wrapper .entry-edit fieldset, .entry-edit .fieldset { background:none; border:none; } */
290
+
291
+ #login-register-wrapper div.form-wrap div.content-header { display:none; }
292
+ #login-register-wrapper .form-wrap .content-footer { padding-left:80px; }
293
+ #login-register-wrapper .form-buttons { padding-left:0px; }
294
+ #login-register-wrapper .forgot-pwd { padding-left:80px; }
295
+
296
+ #login-register-wrapper td { display: table-row; }
297
+ #login-register-wrapper td.value input.input-text { margin-bottom:10px; }
298
+
299
+ /* demographics tab */
300
+ .demographics li { width:220px; min-height:150px; float:left; margin:10px 10px 0 0; background:#efefef; border:solid #636363 1px; padding:5px; }
301
+ .demographics li.last { clear:left; }
302
+ .demographics li .chart-box { height:250px; }
303
+
304
+ .demographics dt { clear:left; float:left; width:150px; text-align:left; margin-left:10px; font-weight:bold; }
305
+ .demographics dd { }
306
+ .demographics h3 { }
307
+ .demographics p { font-weight:normal; font-size:11px; margin-top:15px; }
308
+
309
+
310
+ table.age-makeup {}
311
+ table.age-makeup tr {}
312
+ table.age-makeup td { width:200px; text-align:center; padding:2px 0; color:#2F2F2F; }
313
+ table.age-makeup td.label { width:100px; }
314
+
315
+ table.age-makeup tr.age-group td { background-color:#efefef; border:1px solid #999; }
316
+ table.age-makeup tr.gender td { height:100px; }
317
+
318
+ table.age-makeup tr.gender-male td { vertical-align:bottom; padding-bottom:0; margin-bottom:0; }
319
+ table.age-makeup tr.gender-female td { vertical-align:top; padding-top:0; margin-top:0; }
320
+
321
+ table.age-makeup tr.gender td span { display:block; background:#E7EFEF; border:dotted #636363 1px; }
322
+ table.age-makeup tr.gender-male td span { border-bottom:none; }
323
+ table.age-makeup tr.gender-female td span { border-top:none; }
324
+
325
+ /* insights table */
326
+ .insights-col { width:50%; float:left; }
327
+ table.insights-compare th { text-align:center; padding:2px 5px; }
328
+ table.insights-compare td { text-align:right; width:75px; padding:2px 5px; }
329
+ table.insights-compare td.label { text-align:left; width:auto; }
330
+
331
+ .j-box-left table.insights-compare { width:100%; }
332
+ .j-box-left table.insights-compare td { width:145px; }
333
+ .j-box-left table.insights-compare td.label { width:auto; }
334
+
335
+ table.insights-compare .increase { color:green; padding-right:15px; background:url(images/arrows_up-down-large.png) no-repeat right 8px; }
336
+ table.insights-compare .decrease { color:red; padding-right:15px; background:url(images/arrows_up-down-large.png) no-repeat right -38px; }
337
+
338
+ /* faces grid */
339
+ .faces-grid li { position:relative; float:left; width:100px; height:100px; margin:1px; }
340
+ .faces-grid img.avatar { width:100px; height:100px; position:relative; z-index:1; }
341
+ .faces-grid li .name { display: block; position: absolute; width: 92px; background: #333; color: white; z-index: 99; text-decoration: none; bottom: 0px; overflow:none; font-size:10px; padding:0 4px; }
342
+
343
+ .monospace-textarea { font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace; }
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/arrows_up-down-large.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/bmb-ctl.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/check.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/grn-bg.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/h3-bg.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/icon-alert.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/icon-bmbleb.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/icon-insights.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/icon-status.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico1.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico2.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico3.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico4.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico5.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico6.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico7.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico8.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/left-ico_demographics.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/login-icn-b.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/login-icn.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/logo.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/orng-bg.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/plugin_dashboard_syncing.jpg ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/register.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/registration-bg-25.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/registration-bg-50.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/registration-bg.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/spinner.gif ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/springbot-ctl.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/submit-btn-bg.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/sync_icon.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/bmbleb/images/white-check.png ADDED
Binary file
Springbot-1.5.2.2/adminhtml/default/default/layout/bmbleb.xml ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <adminhtml_sales_order_view>
4
+ <reference name="order_info">
5
+ <block type="bmbleb/adminhtml_order_marketplaces" name="bmbleb.order.marketplaces" template="bmbleb/order/marketplaces.phtml" before="order_history" />
6
+ </reference>
7
+ </adminhtml_sales_order_view>
8
+ <adminhtml_bmbleb_index_index>
9
+ <reference name="head">
10
+ <action method="addCss"><stylesheet>bmbleb/bmbleb.css</stylesheet></action>
11
+ </reference>
12
+ <reference name="content">
13
+ <block type="bmbleb/adminhtml_index" name="bmbleb.index"/>
14
+ </reference>
15
+ <reference name="left">
16
+ <block type="bmbleb/adminhtml_tabs" name="bmbleb.tabs"/>
17
+ </reference>
18
+ </adminhtml_bmbleb_index_index>
19
+ <adminhtml_bmbleb_index_auth>
20
+ <reference name="head">
21
+ <action method="addCss"><stylesheet>bmbleb/bmbleb.css</stylesheet></action>
22
+ </reference>
23
+ <reference name="content">
24
+ <block type="bmbleb/adminhtml_auth" name="bmbleb.auth">
25
+ <block type="bmbleb/adminhtml_bmbleb_login" as="login_form" name="bmbleb.auth.loginform" />
26
+ </block>
27
+ </reference>
28
+ <reference name="left">
29
+ <block type="bmbleb/adminhtml_tabs" name="bmbleb.tabs"/>
30
+ </reference>
31
+ </adminhtml_bmbleb_index_auth>
32
+ <adminhtml_bmbleb_index_status>
33
+ <reference name="head">
34
+ <action method="addCss"><stylesheet>bmbleb/bmbleb.css</stylesheet></action>
35
+ </reference>
36
+ <reference name="content">
37
+ <block type="bmbleb/adminhtml_status" name="bmbleb.status"/>
38
+ </reference>
39
+ <reference name="left">
40
+ <block type="bmbleb/adminhtml_tabs" name="bmbleb.tabs"/>
41
+ </reference>
42
+ </adminhtml_bmbleb_index_status>
43
+ <adminhtml_bmbleb_connectedtospringbot>
44
+ <reference name="head">
45
+ <action method="addCss"><stylesheet>bmbleb/bmbleb.css</stylesheet></action>
46
+ </reference>
47
+ <reference name="content">
48
+ <block type="bmbleb/adminhtml_status" name="bmbleb.status"/>
49
+ </reference>
50
+ <reference name="left">
51
+ <block type="bmbleb/adminhtml_tabs" name="bmbleb.tabs"/>
52
+ </reference>
53
+ </adminhtml_bmbleb_connectedtospringbot>
54
+ <adminhtml_bmbleb_help_index>
55
+ <reference name="head">
56
+ <action method="addCss"><stylesheet>bmbleb/bmbleb.css</stylesheet></action>
57
+ </reference>
58
+ <reference name="content">
59
+ <block type="bmbleb/adminhtml_help" name="bmbleb.help" />
60
+ </reference>
61
+ <reference name="left">
62
+ <block type="bmbleb/adminhtml_tabs" name="bmbleb.tabs"/>
63
+ </reference>
64
+ </adminhtml_bmbleb_help_index>
65
+ <adminhtml_bmbleb_jobs_index>
66
+ <reference name="head">
67
+ <action method="addCss"><stylesheet>bmbleb/bmbleb.css</stylesheet></action>
68
+ </reference>
69
+ <reference name="content">
70
+ <block type="bmbleb/adminhtml_jobs" template="bmbleb/jobs.phtml" name="bmbleb.jobs">
71
+ <block type="bmbleb/adminhtml_jobs_status" name="bmbleb.jobs.status"/>
72
+ </block>
73
+ </reference>
74
+ <reference name="left">
75
+ <block type="bmbleb/adminhtml_tabs" name="bmbleb.tabs"/>
76
+ </reference>
77
+ </adminhtml_bmbleb_jobs_index>
78
+ <adminhtml_bmbleb_logs_index>
79
+ <reference name="head">
80
+ <action method="addCss"><stylesheet>bmbleb/bmbleb.css</stylesheet></action>
81
+ </reference>
82
+ <reference name="content">
83
+ <block type="bmbleb/adminhtml_logs" name="bmbleb.logs"/>
84
+ </reference>
85
+ <reference name="left">
86
+ <block type="bmbleb/adminhtml_tabs" name="bmbleb.tabs"/>
87
+ </reference>
88
+ </adminhtml_bmbleb_logs_index>
89
+ <adminhtml_bmbleb_problems_index>
90
+ <reference name="head">
91
+ <action method="addCss"><stylesheet>bmbleb/bmbleb.css</stylesheet></action>
92
+ </reference>
93
+ <reference name="content">
94
+ <block type="bmbleb/adminhtml_problems" name="bmbleb.problems" />
95
+ </reference>
96
+ <reference name="left">
97
+ <block type="bmbleb/adminhtml_tabs" name="bmbleb.tabs"/>
98
+ </reference>
99
+ </adminhtml_bmbleb_problems_index>
100
+ <bmbleb_account_index>
101
+ <reference name="head">
102
+ <action method="addCss"><stylesheet>bmbleb/bmbleb.css</stylesheet></action>
103
+ </reference>
104
+ </bmbleb_account_index>
105
+ <adminhtml_bmbleb_settings_index>
106
+ <reference name="head">
107
+ <action method="addCss"><stylesheet>bmbleb/bmbleb.css</stylesheet></action>
108
+ </reference>
109
+ <reference name="content">
110
+ <block type="bmbleb/adminhtml_settings" name="bmbleb.settings" />
111
+ </reference>
112
+ <reference name="left">
113
+ <block type="bmbleb/adminhtml_tabs" name="bmbleb.tabs"/>
114
+ </reference>
115
+ </adminhtml_bmbleb_settings_index>
116
+ <bmbleb_logout_logout>
117
+ <reference name="left">
118
+ <block type="bmbleb/adminhtml_tabs" name="bmbleb.tabs"/>
119
+ </reference>
120
+ <reference name="content">
121
+ <block type="bmbleb/adminhtml_logout" name="bmbleb.logout" template="bmbleb/logout.phtml" />
122
+ </reference>
123
+ </bmbleb_logout_logout>
124
+
125
+ <default>
126
+ <reference name="notifications">
127
+ <block type="bmbleb/adminhtml_notifications" name="bmbleb_notifications" template="bmbleb/notifications.phtml"/>
128
+ </reference>
129
+ </default>
130
+ </layout>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/auth.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php /* @var $this Socketware_Bmbleb_Block_Adminhtml_Login */ ?>
2
+ <div class="form-wrap last">
3
+ <?php echo $this->getChildHtml('login_form'); ?>
4
+ </div>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/dashboard_loggedout.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header-block">
2
+ <div class="bmb-logo"><a href="javascript:void(0);"><img src="<?php echo $this->getSkinUrl('bmbleb/images/bmb-ctl.png'); ?>" alt="bmbleb logo" /></a></div>
3
+ <div class="header-content">
4
+ <h2>Please login or register for a free bmbleb account</h2>
5
+ </div>
6
+ </div>
7
+ <style type="text/css">
8
+
9
+ div.form-wrap { width:48%; float:left; margin-top:20px; margin-right:20px; }
10
+ div.form-wrap.last { margin-right:0; }
11
+
12
+ div.form-wrap .form-list td.value input.input-text { width:90%; }
13
+ div.form-wrap .form-list td.label label { width:125px; padding-right:10px; }
14
+ /* more adjustments - move these all to css */
15
+
16
+ /* override some default boxes backgrounds */
17
+ .entry-edit .entry-edit-head { background:none; }
18
+ .entry-edit fieldset, .entry-edit .fieldset { background:none; border:none; }
19
+
20
+ div.form-wrap div.content-header { display:none; }
21
+ .form-wrap .content-footer { padding-left:80px; }
22
+ #login-register-wrapper .form-buttons { padding-left:0px; }
23
+ #login-register-wrapper .forgot-pwd { padding-left:80px; }
24
+
25
+ /*
26
+ ! working on table cell problem
27
+ this works in ffox and chrome but not IE 9 or IE compat
28
+ */
29
+ #login-register-wrapper td { display: table-row; }
30
+ #login-register-wrapper td.value input.input-text { margin-bottom:10px; }
31
+
32
+
33
+ </style>
34
+
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/help/index.phtml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <h3>Help</h3>
3
+ </div>
4
+
5
+ <div id="help-screen-wrap">
6
+ <div class="col-one">
7
+ <script type="text/javascript" charset="utf-8">
8
+ var is_ssl = ("https:" == document.location.protocol);
9
+ var asset_host = is_ssl ? "https://s3.amazonaws.com/getsatisfaction.com/" : "http://s3.amazonaws.com/getsatisfaction.com/";
10
+ document.write(unescape("%3Cscript src='" + asset_host + "javascripts/feedback-v2.js' type='text/javascript'%3E%3C/script%3E"));
11
+ </script>
12
+ <script type="text/javascript" charset="utf-8">
13
+ var feedback_widget_options = {};
14
+ feedback_widget_options.display = "inline";
15
+ feedback_widget_options.company = "bmbleb";
16
+ feedback_widget_options.style = "question";
17
+ var feedback_widget = new GSFN.feedback_widget(feedback_widget_options);
18
+ </script>
19
+ </div>
20
+ <div class="col-two">
21
+ <div id='gsfn_search_widget'>
22
+ <h3>Search</h3>
23
+ <div class='gsfn_content'>
24
+ <form accept-charset='utf-8' action='https://getsatisfaction.com/bmbleb' id='gsfn_search_form' method='get' onsubmit='gsfn_search(this); return false;'>
25
+ <div>
26
+ <input name='style' type='hidden' value='' />
27
+ <input name='limit' type='hidden' value='10' />
28
+ <input name='utm_medium' type='hidden' value='widget_search' />
29
+ <input name='utm_source' type='hidden' value='widget_bmbleb' />
30
+ <input name='callback' type='hidden' value='gsfnResultsCallback' />
31
+ <input name='format' type='hidden' value='widget' />
32
+ <label class='gsfn_label' for='gsfn_search_query'>Ask a question, share an idea, or report a problem.</label>
33
+ <input id='gsfn_search_query' maxlength='120' name='query' type='text' value='' />
34
+ <input id='continue' type='submit' value='Continue' />
35
+ </div>
36
+ </form>
37
+ <div id='gsfn_search_results' style='height: auto;'></div>
38
+ </div>
39
+ </div>
40
+ <script src="https://getsatisfaction.com/bmbleb/widgets/javascripts/3081adb659/widgets.js" type="text/javascript"></script>
41
+ </div>
42
+ </div>
43
+
44
+
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/index/messages.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $messages = $this->getSystemMessages(); ?>
2
+ <?php if (count($messages) > 0): ?>
3
+ <div class="upgrade-box">
4
+ <h4>Notice</h4>
5
+ <ul>
6
+ <?php foreach ($this->getSystemMessages() as $mess): ?>
7
+ <li><p><?php echo $mess; ?></p></li>
8
+ <?php endforeach; ?>
9
+ </ul>
10
+ </div>
11
+ <?php endif; ?>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/index/terms.phtml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <div id="tc-content" class="tc-content">
2
+ <div class="tc-content-inner">
3
+ <p class="close-btn"><a href="#" title="Close window" onclick="Modalbox.hide(); return false;">Close</a></p>
4
+
5
+ <h3>springbot Terms &amp; Conditions</h3>
6
+ <?php echo nl2br(Mage::helper('bmbleb/GetTermsOfService')->getTermsOfService()); ?>
7
+ </div>
8
+ </div>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/jobs.phtml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ?>
3
+ <div class="content-header">
4
+ <table cellspacing="0">
5
+ <tr>
6
+ <td style="<?php echo $this->getHeaderWidth() ?>"><?php echo $this->getHeaderHtml() ?></td>
7
+ <td class="form-buttons"><?php echo $this->getButtonsHtml() ?></td>
8
+ </tr>
9
+ </table>
10
+ </div>
11
+ <div>
12
+ <?php echo $this->getChildHtml('bmbleb.jobs.status', true, true); ?>
13
+ </div>
14
+ <div>
15
+ <?php echo $this->getGridHtml(true, true); ?>
16
+ </div>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/jobs/status.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ?>
3
+ <div class="box-left">
4
+ <div class="entry-edit">
5
+ <div class="entry-edit-head">
6
+ <h4><?php echo $this->__('Job Worker Status') ?></h4>
7
+ </div>
8
+ <div class="fieldset">
9
+ <?php $manager = $this->getManager() ?>
10
+ <div class="bmbleb-mgr-status">
11
+ <?php $buttonText = $this->getButtonLabelText() ?>
12
+ <label for="bmbleb-mgr-button" id="bmbleb-mgr-status"><?php echo $this->getLabelText() ?></label>
13
+ <button id="bmbleb-mgr-button" id="bmbleb-mgr-button" title="<?php echo $buttonText ?>" class="scalable" onclick="javascript:bmblebToggleMgr(); return false;" ><?php echo $buttonText ?></button>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ <script type='text/javascript'>
19
+ //<![CDATA[
20
+ function bmblebToggleMgr() {
21
+ new Ajax.Request('<?php echo $this->getAjaxToggleUrl() ?>', {
22
+ method: 'get',
23
+ onSuccess: function(transport){
24
+ if (res = transport.responseJSON){
25
+ document.getElementById('bmbleb-mgr-status').innerHTML = res.label_text;
26
+ var button = document.getElementById('bmbleb-mgr-button');
27
+ button.innerHTML = res.button_text;
28
+ button.title = res.button_text;
29
+ }
30
+ }
31
+ });
32
+ }
33
+ //]]>
34
+ </script>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/login.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Socketware_Bmbleb_Block_Adminhtml_Login */ ?>
2
+ <div id="sb-login-register-wrapper">
3
+ <div class="content-header-block">
4
+ <div class="bmb-logo"><a href="www.springbot.com"><img align=left width=60 height=60 src="<?php echo $this->getSkinUrl('bmbleb/images/springbot-ctl.png'); ?>" alt="springbot logo" />&nbsp;</a>
5
+ <h2>Springbot Account Login</h2>
6
+ </div>
7
+ <div class="header-content">
8
+ <p>Our Marketing Magic uncovers hard-to-find social and demographic data about your customers.</p>
9
+ </div>
10
+ </div>
11
+
12
+ <div style="background:#F9F9F9 url(skin/adminhtml/base/default/bmbleb/images/registration-bg.png) no-repeat left top;">
13
+ <?php echo $this->getChildHtml('form'); ?>
14
+ </div>
15
+ </div>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/logout.phtml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template for Springbot_Bmbleb_Block_Adminhtml_Logout
4
+ */
5
+ ?>
6
+ <style>
7
+ .sb-alert {
8
+ margin: 8px 0 8px;
9
+ }
10
+ .sb-accept {
11
+ margin: 8px 0 8px;
12
+ }
13
+ </style>
14
+
15
+ <h2 class="sb-header">Unplugging Springbot Services</h2>
16
+
17
+ <div class="sb-alert">
18
+ <p>This will disconnect you from Springbot's services.</p>
19
+ <p>Your account will still be accessible through the Springbot web application, however you will need to re-enter your credentials here on in the Magento admin panel in order for the Springbots to get back to work harvesting your data.</p>
20
+ <p>Please click the button below to finish disconnecting.</p>
21
+ </div>
22
+
23
+ <div class="sb-accept">
24
+ <form action="<?php echo $this->getUrl('*/*/remoteDisconnect') ?>">
25
+ <input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>" />
26
+ <p>
27
+ <button class="sb-button" type="submit" id="logout-button">Logout</button>
28
+ </p>
29
+ <p>
30
+ <span id="sb-checkbox">
31
+ <input type="checkbox" id="confirm-logout" required />
32
+ </span>
33
+ <label for="confirm-logout">I understand the risks but I wish to disconnect anyway.</label>
34
+ </p>
35
+ </form>
36
+ </div>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/logs/index.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="entry-edit">
3
+ <div class="entry-edit-head">
4
+ <h4 class="icon-head head-edit-form fieldset-legend">Springbot Logs</h4>
5
+ <div class="form-buttons"></div>
6
+ </div>
7
+ <div class="fieldset fieldset-wide" id="base_fieldset">
8
+ <div class="hor-scroll">
9
+ <table cellspacing="0" class="form-list">
10
+ <tbody>
11
+ <tr>
12
+ <td class="label">
13
+ <label for="log1">Springbot.log</label>
14
+ </td>
15
+ <td class="value">
16
+ <textarea class="textarea monospace-textarea" id="springbot-log-textarea"><?php echo $this->getLogContent(Springbot_Log::LOGFILE) ?></textarea>
17
+ <a href="<?php echo $this->getUrl('adminhtml/bmbleb_logs/download/name/' . Springbot_Log::LOGFILE); ?>">Download Springbot.log</a>
18
+ </td>
19
+ </tr>
20
+ <tr>
21
+ <td class="label">
22
+ <label for="log1">Springbot-Http.log</label>
23
+ </td>
24
+ <td class="value">
25
+ <textarea class="textarea monospace-textarea" id="springbothttp-log-textarea"><?php echo $this->getLogContent(Springbot_Log::HTTPFILE) ?></textarea>
26
+ <a href="<?php echo $this->getUrl('adminhtml/bmbleb_logs/download/name/' . Springbot_Log::HTTPFILE); ?>">Download Springbot-Http.log</a>
27
+ </td>
28
+ </tr>
29
+ </tbody>
30
+ </table>
31
+ </div>
32
+ </div>
33
+ </div>
34
+
35
+ <script type="text/javascript">
36
+ var springbottextarea = document.getElementById('springbot-log-textarea');
37
+ springbottextarea.scrollTop = springbottextarea.scrollHeight;
38
+ var springbothttptextarea = document.getElementById('springbothttp-log-textarea');
39
+ springbothttptextarea.scrollTop = springbothttptextarea.scrollHeight;
40
+ </script>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/notifications.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php if ($message = $this->getMessage()) : ?>
2
+ <?php if ($message['type'] == 'success'): ?>
3
+ <div class="notification-global" style="background-color: #eff5ea; background-image: none"><?php echo $message['message'] ?></div>
4
+ <?php else: ?>
5
+ <div class="notification-global"><?php echo $message['message'] ?></div>
6
+ <?php endif ?>
7
+ <?php endif; ?>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/order/marketplaces.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder() ?>
2
+ <?php $mpOrder = $this->getMarketplacesOrder() ?>
3
+ <div class="box-left">
4
+ <!--Marketplaces Detail-->
5
+ <div class="entry-edit">
6
+ <div class="entry-edit-head">
7
+ <h4 class="icon-head head-account">Marketplaces Detail</h4>
8
+ </div>
9
+ <div class="fieldset">
10
+ <table cellspacing="0" class="form-list">
11
+ <tr>
12
+ <td class="label"><label><?php echo $this->__('Marketplace') ?></label></td>
13
+ <td class="value"><strong><?php echo $mpOrder->getHumanMarketplaceType() ?></strong></td>
14
+ </tr>
15
+ <tr>
16
+ <td class="label"><label><?php echo $this->__('Remote Order Id') ?></label></td>
17
+ <td class="value"><strong><a href="https://sellercentral.amazon.com/gp/orders-v2/details/ref=ag_orddet_cont_myo?ie=UTF8&orderID=<?php echo $mpOrder->getRemoteOrderId() ?>" target="_blank"><?php echo $mpOrder->getRemoteOrderId() ?></a></strong></td>
18
+ </tr>
19
+ </table>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ <div class="clear"></div>
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/problems/index.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($solutions = $this->getSolutions()): ?>
2
+
3
+ <h1>Springbot encountered a problem</h1>
4
+ <p>
5
+ Don't worry! We can help with any problems you may have. Sometimes
6
+ <a href="<?php echo $this->getUrl('adminhtml/bmbleb_index/auth') ?>">re-logging into Springbot</a> will fix any
7
+ issues you may be having. If the problem persists please email our support team:
8
+ <a href="mailto:support@springbot.com">support@springbot.com</a>.
9
+ </p>
10
+
11
+ <div class="grid">
12
+ <table class="data" cellspacing="0">
13
+ <thead>
14
+ <tr class="headings">
15
+ <th class="no-link"><span class="nobr">Problem</span></th>
16
+ <th class="no-link"><span class="nobr">Possible solution</span></th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+
21
+
22
+ <?php foreach ($solutions as $problem): ?>
23
+
24
+ <tr>
25
+ <td class="a-left">
26
+ <strong><?php echo $problem['problem'] ?></strong>
27
+ </td>
28
+
29
+ <td class="a-left">
30
+ <?php echo $problem['solution'] ?>
31
+ </td>
32
+
33
+ </tr>
34
+
35
+ <?php endforeach ?>
36
+
37
+
38
+ </tbody>
39
+ </table>
40
+
41
+ </div>
42
+ <?php endif ?>
43
+
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/status.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="j-content">
2
+ <div class="j-box-left box2">
3
+ <a href="<?php echo 'http://app.springbot.com/dashboard'; ?>" target="_blank">
4
+ <img align=left src="<?php echo $this->getSkinUrl('bmbleb/images/plugin_dashboard_syncing.jpg'); ?>" alt="springbot logo" />
5
+ </a>
6
+ </div>
7
+ </div>
8
+ <div class="tc-info">
9
+ <p class="tc-link"><a href="http://www.springbot.com/content/terms_of_use" target="_blank" title="Terms &amp; Conditions">View our Terms &amp; Conditions</a></p>
10
+ <p style="float:right;">Springbot v<?php echo Mage::getConfig()->getModuleConfig("Springbot_Combine")->version ?></p>
11
+ </div>
12
+
Springbot-1.5.2.2/adminhtml/default/default/template/bmbleb/tabs.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Socketware_Bmbleb_Block_Adminhtml_Tabs */ ?>
2
+ <div class="left-logo">
3
+ <img alt="bmbleb logo" src="<?php echo $this->getSkinUrl('bmbleb/images/logo.png')?>" /><br/>
4
+ </div>
5
+
6
+ <ul class="tabs">
7
+ <li class="ico1"><a href="<?php echo $this->getUrl('adminhtml/bmbleb_index/status'); ?>" class="tab-item-link<?php if ($this->isActive('adminhtml_index')) { echo ' active'; } ?>"><span>Dashboard</span></a></li>
8
+ <?php if($this->useExtendedAdmin()): ?>
9
+ <li class="ico2"><a href="<?php echo $this->getUrl('adminhtml/bmbleb_jobs/index'); ?>" class="tab-item-link<?php if ($this->isActive('adminhtml_jobs')) { echo ' active'; } ?>"><span>Jobs</span></a></li>
10
+ <li class="ico3"><a href="<?php echo $this->getUrl('adminhtml/bmbleb_logs/index'); ?>" class="tab-item-link<?php if ($this->isActive('adminhtml_logs')) { echo ' active'; } ?>"><span>Logs</span></a></li>
11
+ <?php endif ?>
12
+ <li class="ico7"><a href="<?php echo $this->getUrl('adminhtml/bmbleb_help/index'); ?>" class="tab-item-link<?php if ($this->isActive('adminhtml_help')) { echo ' active'; } ?>"><span>Help</span></a></li>
13
+ </ul>
Springbot-1.5.2.2/frontend/base/default/layout/shadow.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout>
4
+ <default>
5
+ <reference name="before_body_end">
6
+ <block type="shadow/async" name="shadow.async" template="shadow/async.phtml"/>
7
+ </reference>
8
+ </default>
9
+
10
+ <shadow_frontend_index_index>
11
+ <block type="core/template" name="root"/>
12
+ </shadow_frontend_index_index>
13
+
14
+ <checkout_onepage_success>
15
+ <reference name="before_body_end">
16
+ <block type="core/template" template="shadow/conversion.phtml" name="shadow.conversion" />
17
+ </reference>
18
+ </checkout_onepage_success>
19
+
20
+ <catalog_product_view>
21
+ <reference name="before_body_end">
22
+ <block type="shadow/action_view" name="shadow.action.view" />
23
+ </reference>
24
+ </catalog_product_view>
25
+ </layout>
26
+
27
+
Springbot-1.5.2.2/frontend/base/default/template/shadow/async.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($publicId = $this->getPublicId()) : ?>
2
+ <script type="text/javascript">
3
+ var _sbparams = _sbparams || [];
4
+ _sbparams.push({'action': 'view'});
5
+ (function() {
6
+ var sb = document.createElement('script');
7
+ var fs = document.getElementsByTagName('script')[0];
8
+ sb.type = 'text/javascript'; sb.async = true;
9
+ sb.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + '<?php echo $this->getAssetsDomain()?>/async/preload/<?php echo $publicId ?>.js';
10
+ fs.parentNode.insertBefore(sb, fs);
11
+ })();
12
+ </script>
13
+ <?php endif ?>
Springbot-1.5.2.2/frontend/base/default/template/shadow/conversion.phtml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $total = 0.0;
3
+ $escapedOrderId = '';
4
+ try {
5
+ $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
6
+ $order = Mage::getModel('sales/order')->load($lastOrderId);
7
+ $total = $order->getGrandTotal();
8
+ $escapedOrderId = $this->escapeHtml($lastOrderId);
9
+
10
+ Springbot_Boss::addTrackable(
11
+ 'success_page_url',
12
+ Mage::helper('core/url')->getCurrentUrl(),
13
+ $order->getQuoteId(),
14
+ $order->getCustomerId(),
15
+ $order->getCustomerEmail(),
16
+ $order->getEntityId()
17
+ );
18
+
19
+ } catch (Exception $e) {
20
+ Springbot_Log::error($e->getMessage());
21
+ }
22
+ ?>
23
+
24
+ <script type="text/javascript">
25
+ adroll_conversion_value_in_dollars = <?php echo $total ?>;
26
+ adroll_custom_data = {"ORDER_ID": "<?php echo $escapedOrderId ?>"};
27
+ </script>
Springbot-1.5.2.2/modules/Springbot.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Springbot_Bmbleb>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Springbot_Bmbleb>
8
+ <Springbot_BoneCollector>
9
+ <active>true</active>
10
+ <codePool>community</codePool>
11
+ </Springbot_BoneCollector>
12
+ <Springbot_Combine>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ </Springbot_Combine>
16
+ <Springbot_Shadow>
17
+ <active>true</active>
18
+ <codePool>community</codePool>
19
+ </Springbot_Shadow>
20
+ <Springbot_Api>
21
+ <active>true</active>
22
+ <codePool>community</codePool>
23
+ </Springbot_Api>
24
+ </modules>
25
+ </config>
Springbot-1.5.2.2/shell/springbot.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * There are a few similarities to this and Mage_Shell_Abstract. Springbot still
4
+ * officially supports Magento 1.3.*, therefore, we needed to roll our own.
5
+ */
6
+ class Springbot_Shell
7
+ {
8
+ private $_action;
9
+ private $_type;
10
+ private $_appCode = 'admin';
11
+ private $_appType = 'store';
12
+ private $_magentoRootDir;
13
+ private $_args;
14
+
15
+ public function __construct()
16
+ {
17
+ require_once $this->getApplicationPath() . $this->getMagePath();
18
+ Mage::app($this->_appCode, $this->_appType);
19
+ $this->_parseArgs();
20
+ }
21
+
22
+ public function run()
23
+ {
24
+ try {
25
+ Springbot_Log::debug("Running {$this->_action}:{$this->_type}");
26
+ $class = Springbot_Services_Registry::getInstance("{$this->_action}:{$this->_type}");
27
+ if($class) {
28
+ $ret = $class->setData($this->_args)->run();
29
+ }
30
+ echo $ret;
31
+ }
32
+ catch (Exception $e) {
33
+ Springbot_Log::error($e->getMessage());
34
+ echo $e->getMessage() . PHP_EOL;
35
+ exit(1);
36
+ }
37
+ }
38
+
39
+ public function getMagePath()
40
+ {
41
+ return 'app' . DIRECTORY_SEPARATOR . 'Mage.php';
42
+ }
43
+
44
+ public function getApplicationPath()
45
+ {
46
+ if(!isset($this->_magentoRootDir)) {
47
+ if(file_exists($this->getMagePath())) {
48
+ $this->_magentoRootDir = getcwd() . DIRECTORY_SEPARATOR;
49
+ }
50
+ else {
51
+ for ($i = 0, $d = ''; !file_exists($d.$this->getMagePath()) && $i++ < 10; $d .= '../');
52
+ $this->_magentoRootDir = getcwd() . DIRECTORY_SEPARATOR . $d;
53
+ }
54
+
55
+ if(!file_exists($this->_magentoRootDir . $this->getMagePath())) {
56
+ throw new Exception("Cannot find Mage root path!");
57
+ }
58
+ }
59
+ return $this->_magentoRootDir;
60
+ }
61
+
62
+ private function _parseArgs()
63
+ {
64
+ try {
65
+ $argv = $_SERVER['argv'];
66
+ $opts = getopt('s:i:h:c:o:dfrv:m:j:n:p:');
67
+ list($this->_action, $this->_type) = explode(':', end($argv));
68
+ $this->_args = Springbot_Services_Registry::parseOpts($opts);
69
+ if(!isset($this->_action) || !isset($this->_type)) {
70
+ throw new Exception;
71
+ }
72
+ }
73
+ catch (Exception $e) {
74
+ Springbot_Log::error($e->getMessage());
75
+ $this->_usage();
76
+ exit;
77
+ }
78
+ }
79
+
80
+ private function _usage()
81
+ {
82
+ echo "Usage: \033[1mphp shell/springbot.php -s\033[0m \033[4mstore_id\033[0m \033[1m-i\033[0m \033[4mstart_id\033[0m:\033[4mend_id\033[0m \033[1maction:type\033[0m\n\n";
83
+ }
84
+ }
85
+
86
+ $shell = new Springbot_Shell;
87
+ $shell->run();
app/code/community/Springbot/Combine/Model/Marketplaces/Order/Builder.php CHANGED
@@ -1,266 +1,270 @@
1
- <?php
2
-
3
- class Springbot_Combine_Model_Marketplaces_Order_Builder extends Varien_Object
4
- {
5
- protected $_data;
6
- protected $_products;
7
- protected $_customer;
8
- protected $_storeId;
9
- protected $_order;
10
- protected $_mpOrder;
11
-
12
- protected $_shippingMethod = 'sbShipping';
13
- protected $_paymentMethod = 'sbPayment';
14
- protected $_itemTotals;
15
-
16
- public function __construct($data)
17
- {
18
- $this->_data = $data;
19
- $this->_helper = Mage::helper('combine/marketplaces');
20
- }
21
-
22
- public function buildOrder($products, $customer)
23
- {
24
- $customer->cleanAllAddresses();
25
-
26
- $this->_customer = $customer;
27
- $this->_products = $products;
28
-
29
- $this->_storeId = $customer->getStoreId();
30
-
31
- $this->makeOrder()
32
- ->setAddresses()
33
- ->setPayment()
34
- ->addProducts()
35
- ->setTotals();
36
-
37
- $this->makeMarketplaceOrder();
38
-
39
- try {
40
- $transaction = Mage::getModel('core/resource_transaction');
41
-
42
- $transaction->addObject($this->_order)
43
- ->addObject($this->_mpOrder)
44
- ->addCommitCallback(array($this->_order, 'place'))
45
- ->addCommitCallback(array($this->_order, 'save'))
46
- ->save();
47
- } catch (Zend_Db_Statement_Exception $e) {
48
- throw new Exception("Order already exists for order with id {$this->_mpOrder->getRemoteOrderId()}", 409);
49
- }
50
-
51
- $this->_mpOrder->setOrderId($this->_order->getId())->save();
52
-
53
- return $this->_order;
54
- }
55
-
56
- private function makeMarketplaceOrder()
57
- {
58
- Springbot_Log::debug("Making mp order for {$this->fetch('amazon_order_id')}");
59
- $this->_mpOrder = Mage::getModel('combine/marketplaces_remote_order');
60
- $this->_mpOrder->setData(array(
61
- 'increment_id' => $this->_order->getIncrementId(),
62
- 'remote_order_id' => $this->fetch('amazon_order_id'),
63
- 'marketplace_type' => Springbot_Combine_Model_Marketplaces_OrderService::AMAZON
64
- ));
65
-
66
- Springbot_Log::debug($this->_mpOrder->getData());
67
-
68
- return $this;
69
- }
70
-
71
- private function makeOrder()
72
- {
73
- $reservedOrderId = $this->reserveOrderId();
74
-
75
- $currencyCode = $this->getCurrencyCode();
76
-
77
- $this->_order = Mage::getModel('sales/order')
78
- ->setIncrementId($reservedOrderId)
79
- ->setStoreId($this->_customer->getStoreId())
80
- ->setQuoteId(0)
81
- ->setGlobalCurrencyCode($currencyCode)
82
- ->setBaseCurrencyCode($currencyCode)
83
- ->setStoreCurrencyCode($currencyCode)
84
- ->setOrderCurrencyCode($currencyCode)
85
- ;
86
-
87
- $this->_order->setCustomerEmail($this->_customer->getEmail())
88
- ->setCustomerFirstname($this->_customer->getFirstname())
89
- ->setCustomerLastname($this->_customer->getLastname())
90
- ->setCustomerGroupId($this->_customer->getGroupId())
91
- ->setCustomerIsGuest(0)
92
- ->setCustomer($this->_customer);
93
-
94
- return $this;
95
- }
96
-
97
- private function setTotals()
98
- {
99
- $total = $this->fetch('order_total->Amount');
100
- $subtotal = $this->getSubtotal();
101
-
102
- Springbot_Log::debug($this->getItemTotals());
103
-
104
- $this->_order->setSubtotal($subtotal)
105
- ->setBaseSubtotal($subtotal)
106
- ->setGrandTotal($total)
107
- ->setBaseGrandTotal($total)
108
- ->setTotalPaid($total)
109
- ->setBaseTotalPaid($total)
110
- ->setShippingAmount($this->getShipping())
111
- ->setBaseShippingAmount($this->getShipping())
112
- ->setShippingTaxAmount($this->getShippingTax())
113
- ->setBaseShippingTaxAmount($this->getShippingTax())
114
- ->setTaxAmount($this->getTax())
115
- ->setBaseTaxAmount($this->getTax())
116
- ;
117
-
118
- return $this;
119
- }
120
-
121
- private function setAddresses()
122
- {
123
- $billing = $this->_customer->getDefaultBillingAddress();
124
- $billingAddress = Mage::getModel('sales/order_address')
125
- ->setStoreId($this->_storeId)
126
- ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)
127
- ->setCustomerId($this->_customer->getId())
128
- ->setCustomerAddressId($this->_customer->getDefaultBilling())
129
- ->setCustomerAddress_id($billing->getEntityId())
130
- ->setPrefix($billing->getPrefix())
131
- ->setFirstname($billing->getFirstname())
132
- ->setMiddlename($billing->getMiddlename())
133
- ->setLastname($billing->getLastname())
134
- ->setSuffix($billing->getSuffix())
135
- ->setCompany($billing->getCompany())
136
- ->setStreet($billing->getStreet())
137
- ->setCity($billing->getCity())
138
- ->setCountry_id($billing->getCountryId())
139
- ->setRegion($billing->getRegion())
140
- ->setRegion_id($billing->getRegionId())
141
- ->setPostcode($billing->getPostcode())
142
- ->setTelephone($billing->getTelephone())
143
- ->setFax($billing->getFax())
144
- ->setVatId($billing->getVatId());
145
- $this->_order->setBillingAddress($billingAddress);
146
-
147
- $shipping = $this->_customer->getDefaultShippingAddress();
148
- $shippingAddress = Mage::getModel('sales/order_address')
149
- ->setStoreId($this->_storeId)
150
- ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
151
- ->setCustomerId($this->_customer->getId())
152
- ->setCustomerAddressId($this->_customer->getDefaultShipping())
153
- ->setCustomer_address_id($shipping->getEntityId())
154
- ->setPrefix($shipping->getPrefix())
155
- ->setFirstname($shipping->getFirstname())
156
- ->setMiddlename($shipping->getMiddlename())
157
- ->setLastname($shipping->getLastname())
158
- ->setSuffix($shipping->getSuffix())
159
- ->setCompany($shipping->getCompany())
160
- ->setStreet($shipping->getStreet())
161
- ->setCity($shipping->getCity())
162
- ->setCountry_id($shipping->getCountryId())
163
- ->setRegion($shipping->getRegion())
164
- ->setRegion_id($shipping->getRegionId())
165
- ->setPostcode($shipping->getPostcode())
166
- ->setTelephone($shipping->getTelephone())
167
- ->setFax($shipping->getFax())
168
- ->setVatId($billing->getVatId());
169
-
170
- $this->_order->setShippingAddress($shippingAddress)
171
- ->setShippingMethod($this->_shippingMethod)
172
- ->setShippingDescription($this->fetch('shipment_service_level_category'));
173
-
174
- return $this;
175
- }
176
-
177
- private function setPayment()
178
- {
179
- $orderPayment = Mage::getModel('sales/order_payment')
180
- ->setStoreId($this->_customer->getStoreId())
181
- ->setCustomerPaymentId(0)
182
- ->setMethod($this->_paymentMethod)
183
- ->setPoNumber($this->safeFetch('purchase_order_number'));
184
-
185
- $this->_order->setPayment($orderPayment);
186
-
187
- return $this;
188
- }
189
-
190
- private function addProducts()
191
- {
192
- foreach ($this->_products as $product) {
193
- $item = Mage::getModel('combine/marketplaces_order_item')->makeOrderItem($product, $this->_data);
194
- $this->_order->addItem($item);
195
- }
196
- return $this;
197
- }
198
-
199
- private function getCurrencyCode()
200
- {
201
- if($value = $this->fetch('order_total->CurrencyCode')) {
202
- return $value;
203
- } else {
204
- return Mage::app()->getBaseCurrencyCode();
205
- }
206
- }
207
-
208
- private function reserveOrderId()
209
- {
210
- $transaction = Mage::getModel('core/resource_transaction');
211
- return Mage::getSingleton('eav/config')
212
- ->getEntityType('order')
213
- ->fetchNewIncrementId($this->_storeId);
214
- }
215
-
216
- private function getSubtotal()
217
- {
218
- return $this->getItemTotals()['item_price'] + $this->getItemTotals()['tax'];
219
- }
220
-
221
- private function getShipping()
222
- {
223
- return $this->getItemTotals()['shipping'];
224
- }
225
-
226
- private function getShippingTax()
227
- {
228
- return $this->getItemTotals()['shipping_tax'];
229
- }
230
-
231
- private function getTax()
232
- {
233
- return $this->getItemTotals()['tax'];
234
- }
235
-
236
- private function getItemTotals()
237
- {
238
- if(!isset($this->_itemTotals)) {
239
- $shipping = 0; $shippingTax = 0; $tax = 0; $itemPrice = 0;
240
- foreach($this->fetch('order_items') as $item) {
241
- $shipping += $this->_helper->safeFetch('shipping_price->Amount', $item);
242
- $shippingTax += $this->_helper->safeFetch('shipping_tax->Amount', $item);
243
- $tax += $this->_helper->safeFetch('item_tax->Amount', $item);
244
- $itemPrice += $this->_helper->safeFetch('item_price->Amount', $item);
245
- }
246
- $this->_itemTotals = array(
247
- 'shipping' => $shipping,
248
- 'shipping_tax' => $shippingTax,
249
- 'tax' => $tax,
250
- 'item_price' => $itemPrice
251
- );
252
- Springbot_Log::debug($this->_itemTotals);
253
- }
254
- return $this->_itemTotals;
255
- }
256
-
257
- private function safeFetch($key)
258
- {
259
- return $this->_helper->safeFetch($key, $this->_data);
260
- }
261
-
262
- private function fetch($key)
263
- {
264
- return $this->_helper->fetch($key, $this->_data);
265
- }
266
- }
 
 
 
 
1
+ <?php
2
+
3
+ class Springbot_Combine_Model_Marketplaces_Order_Builder extends Varien_Object
4
+ {
5
+ protected $_data;
6
+ protected $_products;
7
+ protected $_customer;
8
+ protected $_storeId;
9
+ protected $_order;
10
+ protected $_mpOrder;
11
+
12
+ protected $_shippingMethod = 'sbShipping';
13
+ protected $_paymentMethod = 'sbPayment';
14
+ protected $_itemTotals;
15
+
16
+ public function __construct($data)
17
+ {
18
+ $this->_data = $data;
19
+ $this->_helper = Mage::helper('combine/marketplaces');
20
+ }
21
+
22
+ public function buildOrder($products, $customer)
23
+ {
24
+ $customer->cleanAllAddresses();
25
+
26
+ $this->_customer = $customer;
27
+ $this->_products = $products;
28
+
29
+ $this->_storeId = $customer->getStoreId();
30
+
31
+ $this->makeOrder()
32
+ ->setAddresses()
33
+ ->setPayment()
34
+ ->addProducts()
35
+ ->setTotals();
36
+
37
+ $this->makeMarketplaceOrder();
38
+
39
+ try {
40
+ $transaction = Mage::getModel('core/resource_transaction');
41
+
42
+ $transaction->addObject($this->_order)
43
+ ->addObject($this->_mpOrder)
44
+ ->addCommitCallback(array($this->_order, 'place'))
45
+ ->addCommitCallback(array($this->_order, 'save'))
46
+ ->save();
47
+ } catch (Zend_Db_Statement_Exception $e) {
48
+ throw new Exception("Order already exists for order with id {$this->_mpOrder->getRemoteOrderId()}", 409);
49
+ }
50
+
51
+ $this->_mpOrder->setOrderId($this->_order->getId())->save();
52
+
53
+ return $this->_order;
54
+ }
55
+
56
+ private function makeMarketplaceOrder()
57
+ {
58
+ Springbot_Log::debug("Making mp order for {$this->fetch('amazon_order_id')}");
59
+ $this->_mpOrder = Mage::getModel('combine/marketplaces_remote_order');
60
+ $this->_mpOrder->setData(array(
61
+ 'increment_id' => $this->_order->getIncrementId(),
62
+ 'remote_order_id' => $this->fetch('amazon_order_id'),
63
+ 'marketplace_type' => Springbot_Combine_Model_Marketplaces_OrderService::AMAZON
64
+ ));
65
+
66
+ Springbot_Log::debug($this->_mpOrder->getData());
67
+
68
+ return $this;
69
+ }
70
+
71
+ private function makeOrder()
72
+ {
73
+ $reservedOrderId = $this->reserveOrderId();
74
+
75
+ $currencyCode = $this->getCurrencyCode();
76
+
77
+ $this->_order = Mage::getModel('sales/order')
78
+ ->setIncrementId($reservedOrderId)
79
+ ->setStoreId($this->_customer->getStoreId())
80
+ ->setQuoteId(0)
81
+ ->setGlobalCurrencyCode($currencyCode)
82
+ ->setBaseCurrencyCode($currencyCode)
83
+ ->setStoreCurrencyCode($currencyCode)
84
+ ->setOrderCurrencyCode($currencyCode)
85
+ ;
86
+
87
+ $this->_order->setCustomerEmail($this->_customer->getEmail())
88
+ ->setCustomerFirstname($this->_customer->getFirstname())
89
+ ->setCustomerLastname($this->_customer->getLastname())
90
+ ->setCustomerGroupId($this->_customer->getGroupId())
91
+ ->setCustomerIsGuest(0)
92
+ ->setCustomer($this->_customer);
93
+
94
+ return $this;
95
+ }
96
+
97
+ private function setTotals()
98
+ {
99
+ $total = $this->fetch('order_total->Amount');
100
+ $subtotal = $this->getSubtotal();
101
+
102
+ Springbot_Log::debug($this->getItemTotals());
103
+
104
+ $this->_order->setSubtotal($subtotal)
105
+ ->setBaseSubtotal($subtotal)
106
+ ->setGrandTotal($total)
107
+ ->setBaseGrandTotal($total)
108
+ ->setTotalPaid($total)
109
+ ->setBaseTotalPaid($total)
110
+ ->setShippingAmount($this->getShipping())
111
+ ->setBaseShippingAmount($this->getShipping())
112
+ ->setShippingTaxAmount($this->getShippingTax())
113
+ ->setBaseShippingTaxAmount($this->getShippingTax())
114
+ ->setTaxAmount($this->getTax())
115
+ ->setBaseTaxAmount($this->getTax())
116
+ ;
117
+
118
+ return $this;
119
+ }
120
+
121
+ private function setAddresses()
122
+ {
123
+ $billing = $this->_customer->getDefaultBillingAddress();
124
+ $billingAddress = Mage::getModel('sales/order_address')
125
+ ->setStoreId($this->_storeId)
126
+ ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)
127
+ ->setCustomerId($this->_customer->getId())
128
+ ->setCustomerAddressId($this->_customer->getDefaultBilling())
129
+ ->setCustomerAddress_id($billing->getEntityId())
130
+ ->setPrefix($billing->getPrefix())
131
+ ->setFirstname($billing->getFirstname())
132
+ ->setMiddlename($billing->getMiddlename())
133
+ ->setLastname($billing->getLastname())
134
+ ->setSuffix($billing->getSuffix())
135
+ ->setCompany($billing->getCompany())
136
+ ->setStreet($billing->getStreet())
137
+ ->setCity($billing->getCity())
138
+ ->setCountry_id($billing->getCountryId())
139
+ ->setRegion($billing->getRegion())
140
+ ->setRegion_id($billing->getRegionId())
141
+ ->setPostcode($billing->getPostcode())
142
+ ->setTelephone($billing->getTelephone())
143
+ ->setFax($billing->getFax())
144
+ ->setVatId($billing->getVatId());
145
+ $this->_order->setBillingAddress($billingAddress);
146
+
147
+ $shipping = $this->_customer->getDefaultShippingAddress();
148
+ $shippingAddress = Mage::getModel('sales/order_address')
149
+ ->setStoreId($this->_storeId)
150
+ ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
151
+ ->setCustomerId($this->_customer->getId())
152
+ ->setCustomerAddressId($this->_customer->getDefaultShipping())
153
+ ->setCustomer_address_id($shipping->getEntityId())
154
+ ->setPrefix($shipping->getPrefix())
155
+ ->setFirstname($shipping->getFirstname())
156
+ ->setMiddlename($shipping->getMiddlename())
157
+ ->setLastname($shipping->getLastname())
158
+ ->setSuffix($shipping->getSuffix())
159
+ ->setCompany($shipping->getCompany())
160
+ ->setStreet($shipping->getStreet())
161
+ ->setCity($shipping->getCity())
162
+ ->setCountry_id($shipping->getCountryId())
163
+ ->setRegion($shipping->getRegion())
164
+ ->setRegion_id($shipping->getRegionId())
165
+ ->setPostcode($shipping->getPostcode())
166
+ ->setTelephone($shipping->getTelephone())
167
+ ->setFax($shipping->getFax())
168
+ ->setVatId($billing->getVatId());
169
+
170
+ $this->_order->setShippingAddress($shippingAddress)
171
+ ->setShippingMethod($this->_shippingMethod)
172
+ ->setShippingDescription($this->fetch('shipment_service_level_category'));
173
+
174
+ return $this;
175
+ }
176
+
177
+ private function setPayment()
178
+ {
179
+ $orderPayment = Mage::getModel('sales/order_payment')
180
+ ->setStoreId($this->_customer->getStoreId())
181
+ ->setCustomerPaymentId(0)
182
+ ->setMethod($this->_paymentMethod)
183
+ ->setPoNumber($this->safeFetch('purchase_order_number'));
184
+
185
+ $this->_order->setPayment($orderPayment);
186
+
187
+ return $this;
188
+ }
189
+
190
+ private function addProducts()
191
+ {
192
+ foreach ($this->_products as $product) {
193
+ $item = Mage::getModel('combine/marketplaces_order_item')->makeOrderItem($product, $this->_data);
194
+ $this->_order->addItem($item);
195
+ }
196
+ return $this;
197
+ }
198
+
199
+ private function getCurrencyCode()
200
+ {
201
+ if($value = $this->fetch('order_total->CurrencyCode')) {
202
+ return $value;
203
+ } else {
204
+ return Mage::app()->getBaseCurrencyCode();
205
+ }
206
+ }
207
+
208
+ private function reserveOrderId()
209
+ {
210
+ $transaction = Mage::getModel('core/resource_transaction');
211
+ return Mage::getSingleton('eav/config')
212
+ ->getEntityType('order')
213
+ ->fetchNewIncrementId($this->_storeId);
214
+ }
215
+
216
+ private function getSubtotal()
217
+ {
218
+ $itemTotals = $this->getItemTotals();
219
+ return $itemTotals['item_price'] + $itemTotals['tax'];
220
+ }
221
+
222
+ private function getShipping()
223
+ {
224
+ $itemTotals = $this->getItemTotals();
225
+ return $itemTotals['shipping'];
226
+ }
227
+
228
+ private function getShippingTax()
229
+ {
230
+ $itemTotals = $this->getItemTotals();
231
+ return $itemTotals['shipping_tax'];
232
+ }
233
+
234
+ private function getTax()
235
+ {
236
+ $itemTotals = $this->getItemTotals();
237
+ return $itemTotals['tax'];
238
+ }
239
+
240
+ private function getItemTotals()
241
+ {
242
+ if(!isset($this->_itemTotals)) {
243
+ $shipping = 0; $shippingTax = 0; $tax = 0; $itemPrice = 0;
244
+ foreach($this->fetch('order_items') as $item) {
245
+ $shipping += $this->_helper->safeFetch('shipping_price->Amount', $item);
246
+ $shippingTax += $this->_helper->safeFetch('shipping_tax->Amount', $item);
247
+ $tax += $this->_helper->safeFetch('item_tax->Amount', $item);
248
+ $itemPrice += $this->_helper->safeFetch('item_price->Amount', $item);
249
+ }
250
+ $this->_itemTotals = array(
251
+ 'shipping' => $shipping,
252
+ 'shipping_tax' => $shippingTax,
253
+ 'tax' => $tax,
254
+ 'item_price' => $itemPrice
255
+ );
256
+ Springbot_Log::debug($this->_itemTotals);
257
+ }
258
+ return $this->_itemTotals;
259
+ }
260
+
261
+ private function safeFetch($key)
262
+ {
263
+ return $this->_helper->safeFetch($key, $this->_data);
264
+ }
265
+
266
+ private function fetch($key)
267
+ {
268
+ return $this->_helper->fetch($key, $this->_data);
269
+ }
270
+ }
app/code/community/Springbot/Combine/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Springbot_Combine>
5
- <version>1.5.2.1</version>
6
  </Springbot_Combine>
7
  </modules>
8
  <default>
2
  <config>
3
  <modules>
4
  <Springbot_Combine>
5
+ <version>1.5.2.2</version>
6
  </Springbot_Combine>
7
  </modules>
8
  <default>
package.xml CHANGED
@@ -1,58 +1,63 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Springbot</name>
4
- <version>1.5.2.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License v3.0 (OSL-3.0)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Springbot helps merchants drive marketing actions based on insights from its &#x201C;big data&#x201D; analytics engine</summary>
10
- <description>Springbot - Better Data. Better Actions. More Revenue.&#xD;
11
- &#xD;
12
- Do you need help deciding how to spend your next marketing dollar? Springbot can help. &#xD;
13
- &#xD;
14
- Know your customers better. &#xD;
15
- Take better marketing actions. &#xD;
16
- Drive more revenue. &#xD;
17
- &#xD;
18
- Springbot helps Magento merchants drive marketing actions based on insights from its &#x201C;big data&#x201D; analytics engine. &#xD;
19
- - Analyze and augment consumer data and purchase behavior &#xD;
20
- - Integrate online marketing channels, content and marketplaces &#xD;
21
- - Prioritize future marketing actions based on the potential ROI &#xD;
22
- &#xD;
23
- Get to Know your Customers&#xD;
24
- &#xD;
25
- Springbot works magic by adding hard-to-find social and demographic data about your customers directly into Magento.&#xD;
26
- &#xD;
27
- age, gender, geo - gain an intuitive sense of your real market dynamics &#xD;
28
- social media data - facebook, twitter, linkedin... find your customers online without googling all of them! &#xD;
29
- home owner data - renting vs. owning and home value can drive purchase behavior &#xD;
30
- &#xD;
31
- plus employment data, income data and much more! &#xD;
32
- &#xD;
33
- Get Started Now with a Limited Time Free Data Offer&#xD;
34
- &#xD;
35
- It's completely free to sign up. We'll give you augmented data for up to 1000 of your customers so that you can experience the power of our awesome data service.&#xD;
36
- &#xD;
37
- Deep Magento Integration&#xD;
38
- &#xD;
39
- You have enough screens, graphs and forms to run your store. bmbleb enhances those screens... it doesn't replace them. Your extra customer data appears in your normal Magento customer screens. You can sort and search using it. And when you do want to dig deeper... Springbot has screens for you!&#xD;
40
- &#xD;
41
- Powerful Living Data Alerts&#xD;
42
- &#xD;
43
- Data isn't static. It changes constantly as we go about our lives. While you're busy watching over your store, Springbot watches over your data and alerts you to sales, marketing and relationship opportunities. Living Data Alerts tell you when your customers are ready to buy. Social media monitors tell you when customers are tweeting about topics relevant to your store.&#xD;
44
- &#xD;
45
- Living Data Alerts example: 378 pieces of data have been added to your customer database &#xD;
46
- Social Media Alerts example: Ted Smith Tweeted about your company &#xD;
47
- Proclivity to Buy Alerts example: Sally Avalon bought a house recently &#xD;
48
- &#xD;
49
- For support information, features and pricing and more details visit springbot.com </description>
50
- <notes>Refactor existing code&#xD;
51
- Amazon Order Sync</notes>
 
 
 
 
 
52
  <authors><author><name>Springbot Integrations Team</name><user>Springbot</user><email>magento@springbot.com</email></author></authors>
53
- <date>2016-07-25</date>
54
- <time>22:21:15</time>
55
- <contents><target name="magecommunity"><dir name="Springbot"><dir name="Shadow"><dir name="Block"><dir name="Action"><file name="View.php" hash="c565170f40e3e26d30d7464ce83aa1cf"/></dir><file name="Async.php" hash="0d203fe1a722f7045029613a0e97bfc2"/></dir><dir name="Controller"><file name="Action.php" hash="5dc41d4ddf12a468fb23fc757ef49a95"/></dir><dir name="Helper"><file name="Data.php" hash="82089d4cfecee69628ae9d627ad2de0c"/><file name="Prattler.php" hash="e2658c19a182bd5cc9948eccc024ad21"/></dir><dir name="Model"><dir name="Listeners"><file name="Observer.php" hash="ea89c307b28795d568366b48a8986240"/></dir></dir><dir name="controllers"><file name="ActionController.php" hash="ea69946850d6aa24d14c6df26541ecaf"/><file name="IndexController.php" hash="07ec0cd97882eb37b157a6c6eaf8b656"/></dir><dir name="etc"><file name="config.xml" hash="b1717e37375197b449c0736adff99d87"/></dir></dir><dir name="Services"><dir name="Cmd"><file name="Forecast.php" hash="efaeb6ca5b2667b30929b223cddfb044"/><file name="Halt.php" hash="85c85ae257e9b86d0fb10fb46060fea3"/><file name="Harvest.php" hash="4330b805baf9ab761fad94a22652972c"/><file name="Healthcheck.php" hash="b1c26cd3e54c303c7c6d73e5accf2e18"/></dir><dir name="Harvest"><file name="AttributeSets.php" hash="95610f6fd6323e0473589c01051781f2"/><file name="Carts.php" hash="ecaf8583962fc63e49cf069d73eb22bf"/><file name="Categories.php" hash="acfe9c8dc9a02992a058015e8aaf9311"/><file name="Coupons.php" hash="5190a1669b0b4ef10222843451e9dc36"/><file name="CustomerAttributeSets.php" hash="7c3a0bed9f841900f692f5a17e7c6e8f"/><file name="Customers.php" hash="3d57c8238976554081176e249f2e7f4b"/><file name="Guests.php" hash="4a806542ae8aad1781a7222052ba1595"/><file name="Inventories.php" hash="d5a78ead8d37188df6286d4697b25f76"/><file name="Products.php" hash="087d01eddc45b4a30c4aa7dba5cc5dce"/><file name="Purchases.php" hash="a3d76ae1a2ea514fcce5ca2607ddf5a4"/><file name="Rules.php" hash="355ecad7266987a391ceca9d2eb0244f"/><file name="Subscribers.php" hash="a8b0d7197580bd9f3de7b10f9c6dc7ca"/></dir><file name="Harvest.php" hash="af3b9604c7b9d7da76cffe846dc34d70"/><dir name="Log"><file name="Installer.php" hash="342706712eb2731ea27aeec993fd2d7f"/></dir><dir name="Post"><file name="Attribute.php" hash="e0a283984de84bc16d5f89a893a8dc83"/><file name="AttributeSet.php" hash="c8f66b5a189125a63e834196402b709a"/><file name="Cart.php" hash="26d33fb887417e46d3ba3e46badc04a3"/><file name="Category.php" hash="0645d5eb9bb790f25e29666bc3a703e0"/><file name="Coupon.php" hash="6b8b49327874ce431f6100b6917ba21f"/><file name="Customer.php" hash="d2f018919afdb7d49617e6b9ac7d2760"/><file name="Guest.php" hash="3b7ee9f0e274340713d8c4302d01b361"/><file name="Inventory.php" hash="a003e45720f7527d29a5678596e4e843"/><file name="Json.php" hash="86a5f26aa5367d8c4c66d278e4c02546"/><file name="Jsonstring.php" hash="9dfb5761d1a7835bf35040a073fa8fc4"/><file name="Product.php" hash="5ec9cbf29df156da09d17e1b6526f53d"/><file name="Purchase.php" hash="0b924c8e5d8f7018eb335ba9fb6d63dd"/><file name="Rule.php" hash="fa038fa414a176d960ed6470c7b7b4cd"/><file name="Subscriber.php" hash="88c5dbcaae805866595217eedbbf5f34"/></dir><file name="Post.php" hash="df9bf80bee670259f3a54e3308d0dbd3"/><file name="Registry.php" hash="d54afde887b72e79ae36ab11766ec5c9"/><dir name="Store"><file name="Finalize.php" hash="e840d2c2dbe813f259b92feba8173b52"/><file name="Register.php" hash="72ae8d75c11dc1c0635c799e284ecb2d"/></dir><dir name="Tasks"><file name="ClearCache.php" hash="5653a49dbb7743ffc967640c933976a1"/><file name="ClearJobs.php" hash="380740a54aa4d79a89d2c67f06724a31"/><file name="ClearStores.php" hash="33e216186c56bde7e558cd828e90dda0"/><file name="CreateRewrite.php" hash="fe937a07db1b9e415f97cfc22a49c437"/><file name="Debug.php" hash="41a522394c2b9375393d81bb3ab206cc"/><file name="DeleteJob.php" hash="be2a2be88290cc3e9bc54c59e22254b5"/><file name="DeliverEventLog.php" hash="97d4b71f3ae619503dc82420e862826c"/><file name="Forecast.php" hash="caaf18be7fe387a4eba5a77eb0db2c12"/><file name="GetLog.php" hash="d850bba9f90b134f884d8d7a36730a26"/><file name="Harvest.php" hash="f71f97f078a081425c8848ba435d3b16"/><file name="HarvestInventory.php" hash="570d3aba5ac28b397d601d21f070415e"/><file name="Healthcheck.php" hash="63fdc080533ab8dff8d0949dd6ef4a3b"/><file name="Jobs.php" hash="9df9611445f9ab4a7a6d4b4e79f6b681"/><file name="KillHarvest.php" hash="a757f35956e4565b597522168109071c"/><file name="LaunchFullHarvest.php" hash="e5271dbfa422a90f4c4dda7362cb68f3"/><file name="LaunchPartialHarvest.php" hash="9c5aa7792fe9a3b98f9de9f4b59e3866"/><file name="PluginVersion.php" hash="4139fe90a74f4d6531243fcacf22777a"/><file name="PostItem.php" hash="54b4bac0b26b8b0e06df1d6da1ea7a91"/><file name="Redirects.php" hash="357b3008bbc9967cef73ad055c89e16e"/><file name="RegisterStores.php" hash="c054ef31b9c28efc5a18ee2ddf31c512"/><file name="ResetRetries.php" hash="bf00fe101b69a78955dc9a6d054e7ba7"/><file name="ResumeHarvest.php" hash="c9ba7b36e2b16dd1d1d947fc83a0ce5e"/><file name="Run.php" hash="c6892d3f812d5085b284d3501211bd5d"/><file name="SetVar.php" hash="93a0afb5e5c32536f430fc3b58b72995"/><file name="Stores.php" hash="d444cd05f1487945528e3f1e7bb01bb5"/><file name="UnlockJobs.php" hash="9bf4b725445897ab2842bcb97e344e0c"/><file name="ViewConfig.php" hash="cc60cbc3d2212576301b13b0b286c618"/></dir><file name="Tasks.php" hash="173bdc5c586a0f5d41528cdbd2fff70b"/><dir name="Work"><file name="Cleanup.php" hash="100fef130220e91dc255b5e0f30c37f1"/><file name="Manager.php" hash="9dbdfb717865b7724f4ffd38b3ec866e"/><file name="Report.php" hash="8a3eec618fe3b04a3514dc302c4c5a0f"/><file name="Restart.php" hash="d55e811fbba86348890b4047fa5a579f"/><file name="Runner.php" hash="c0ced9ce83e5e51b4ba5f10bb46760af"/><file name="Stop.php" hash="db97407b43396f0adf44a2354a23a0a5"/></dir></dir><dir name="Util"><file name="Caller.php" hash="4fcc265eb1a58fed5c3b404ec864514b"/><file name="Categories.php" hash="1292843306c38d9593902616e04320a6"/><dir name="Log"><file name="Rollover.php" hash="6ad4bd93adb7e906c1de5a05a2871ea8"/></dir><file name="Logger.php" hash="e6e82bcb3124fce31aa62425ce3d17e6"/><file name="Partition.php" hash="b9296b086003ba58ba12f8b8b0373c50"/></dir><file name="Services.php" hash="b9f0a869c089aa0ce4e111813827e0b0"/><dir name="Bmbleb"><dir name="Block"><dir name="Adminhtml"><file name="Auth.php" hash="7dc661bbe9ec85f700a22b319981114d"/><dir name="Bmbleb"><dir name="Login"><file name="Form.php" hash="04a552a32d4f4079fa4f4960f8fbf8ff"/></dir><file name="Login.php" hash="7232e8225f5b21de5675c0d84cb452bd"/></dir><file name="Connected.php" hash="833cef8e351f5efa7a4d104b1c51ca7f"/><file name="Help.php" hash="b280b3292ed778140b751b6426ef56fb"/><dir name="Index"><file name="Messages.php" hash="1e247e31194447de32e54f49dafc3ccc"/><file name="Terms.php" hash="739e5a9ebe204f1f9ac433557c994ae6"/></dir><file name="Index.php" hash="eb7bbef5fa26a53748596e145c3677c4"/><dir name="Jobs"><file name="Grid.php" hash="67255d982ac3d50b38d7a2a525c2b922"/><file name="Status.php" hash="f1b197bf6fdc392bed93ff0734a54ad6"/></dir><file name="Jobs.php" hash="84801c6008802496e168e763a7e6d71f"/><file name="Login.php" hash="2e4d8baead482d404ed40f7d5f3d902c"/><file name="Logout.php" hash="b75af51891b751b9d070e1e784dd6914"/><file name="Logs.php" hash="686e958b553c1e3fcf74841eab30fffb"/><file name="Notifications.php" hash="9643c809802b0596de2fb5fb12b9674e"/><dir name="Order"><file name="Marketplaces.php" hash="cf241263dc2d6b74b53b54a2d1500a49"/></dir><file name="Status.php" hash="9b67a20f0ee00608029d24850cefda4d"/><file name="Tabs.php" hash="6f93d5c6bd5208a99637c06118c6c630"/></dir></dir><dir name="Helper"><file name="Account.php" hash="c41f40e6f58abd3b8486e0e92cc079d8"/><file name="Data.php" hash="dca14b137de1e2734a377ca645eeddbe"/><file name="PluginStatus.php" hash="9de073079a7ee90a43acd9807a4adc56"/></dir><dir name="Model"><file name="Bmbleb.php" hash="700d11c3006f2dcd2e80cd8bbbab15f9"/><file name="Observer.php" hash="675a90ca08e7b8cd87656d15513e7bb0"/><file name="Status.php" hash="9409d26c7884be6b8075ba97dbf71f78"/><file name="Sync.php" hash="a800b6064a88f37957392cd967f2b3cb"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Bmbleb"><file name="HelpController.php" hash="cda8111aaec6f9155aac1f2e0afb8b32"/><file name="IndexController.php" hash="174d93cdc2d881f2f183e69a8ad151d5"/><file name="JobsController.php" hash="1feb95dd4b477910165a250826e49145"/><file name="LoginController.php" hash="6b56c101ddd0316d9a8f1e832c27683f"/><file name="LogsController.php" hash="d31f21a550cac8b5bfa5af6b6bdfd412"/><file name="SettingsController.php" hash="8bce329eed695d7403e874b73fe30ceb"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="dd106e93b300a7d872498397f6135d21"/></dir></dir><file name="Boss.php" hash="446dbbf01f05f72328cbc033769e2354"/><file name="Cli.php" hash="36bb25a8314c24e5aa49df8b78111a55"/><file name="Log.php" hash="172ef37dda5b5e495e97872ef48754c4"/><dir name="Combine"><dir name="Helper"><file name="Attributes.php" hash="b3cedc8aecd0c57f4ed4aa8a0158caa1"/><file name="Cart.php" hash="07ce5f461ecded3b9b00ed5c30faa266"/><file name="Data.php" hash="bba3915380a71aaacacc306f10396ef1"/><file name="Harvest.php" hash="dabc1f514d2378d2b723856c732b1253"/><file name="Marketplaces.php" hash="5b080bf0649759b563a90ae5992091fd"/><file name="Parser.php" hash="480f573160e775654555022a5fee1450"/><file name="Redirect.php" hash="92ffe4e71329c1418143d295ae71d18a"/><file name="Store.php" hash="8db94d157d7e497e7612844da43a6c11"/><file name="Trackable.php" hash="a042cb0d176730ec87353b1c5c6d21f7"/></dir><dir name="Model"><file name="Action.php" hash="6375461263bdf7fe26e71235d2449c21"/><file name="Api.php" hash="1c38e0ef61c84be1bf997b7143238f27"/><dir name="Cron"><file name="Count.php" hash="57552740b6ffdd9a4e879191a51043b0"/><dir name="Manager"><file name="Status.php" hash="aeb4445bc2d4b1b7e0e19c09172f0483"/></dir><dir name="Queue"><dir name="Batch"><file name="Row.php" hash="25f4ed809a9190f5d41c6c210cd8a537"/></dir><file name="Batch.php" hash="fa905d2781aab5881e881e3b12d25e0c"/></dir><file name="Queue.php" hash="52fae6cb137515dd59f0e8a612a90adb"/><file name="Worker.php" hash="4a825f89f340c34cd5feff2cfb859a7a"/></dir><file name="Cron.php" hash="92641d27ee653b22eeb9f6b995abde0b"/><dir name="File"><file name="Io.php" hash="6d1f79eaf45897bf0525b0f3f3ac69d2"/><file name="Path.php" hash="24900b670c07fcdc4e54bae585f20002"/></dir><dir name="Harvest"><file name="AttributeSets.php" hash="479dfb30912b74183b396fa4e62323b2"/><file name="Carts.php" hash="0b303b2b7d4458a9a0cbf0653b9d660f"/><file name="Categories.php" hash="fd5f13ad449a320616569f64c82327ff"/><file name="Coupons.php" hash="14112f9063bbf20cea7ff3649f238524"/><file name="CustomerAttributeSets.php" hash="044f426226165ee86b0f822c00ec7712"/><file name="Customers.php" hash="c7850418a39abf09c10fbfafcb96f8e1"/><file name="Guests.php" hash="3685b3220b724e518dc83daad015577f"/><file name="Inventories.php" hash="15dc9f8c38dd7ab626eb3154c6b1b0f2"/><file name="Products.php" hash="da471abcc04837391b5270464164aefd"/><file name="Purchases.php" hash="427d38d1f6579f63730aa6bdf6b7bba4"/><file name="Rules.php" hash="fd1789174225c4ed6ad1e1137fe2aee5"/><file name="Subscribers.php" hash="e499e299612a6e2ce07ee19228cf43c5"/></dir><file name="Harvest.php" hash="73e9f8c899fab89ef9ce90f8acfe9de7"/><dir name="Marketplaces"><dir name="Order"><file name="Builder.php" hash="e4e8853504ba73123ab9d0df22748c2c"/><file name="Customer.php" hash="83e02326c7a00f3df20f217d7ce3ea9e"/><file name="Item.php" hash="8f285f1648bf52b9fa95dfa3c68d3011"/><file name="Parser.php" hash="55dad7d4feb487f3c8d3094423245cde"/></dir><file name="OrderService.php" hash="28251d154f69ea6ba31a6768f8753492"/><file name="Payment.php" hash="f3accd929ab4ddbc1ae4872a20c705a8"/><dir name="Remote"><file name="Order.php" hash="c687a441bc08ed2e967e30a2c0235624"/></dir><file name="Shipping.php" hash="f4aa773729c7058c9789537c8da79694"/></dir><dir name="Mysql4"><dir name="Action"><file name="Collection.php" hash="830a7db2ea307d594fe945701654d883"/></dir><file name="Action.php" hash="5b18cc8842c83d981575b7b2de496f66"/><dir name="Cron"><file name="Count.php" hash="acbbb7ec28afbbe98101f5d114cb30b3"/><dir name="Queue"><file name="Collection.php" hash="b26806c9e7cefd052bb784f5a6ce814c"/></dir><file name="Queue.php" hash="4add10644bfc94b88ef5042b23c82ae7"/></dir><dir name="Redirect"><file name="Collection.php" hash="3bbe4f8729c603f8d8131154a0a117c1"/><dir name="Order"><file name="Collection.php" hash="88c0cfcce31b0eed8c035dee4e7e86df"/></dir><file name="Order.php" hash="852bea330edac3372ec5c168111301a8"/></dir><file name="Redirect.php" hash="842e4ba35c6b049c8eaa64704588ca76"/><file name="Setup.php" hash="3fdec335980846a4c3adbc6f4e3478eb"/><dir name="Trackable"><file name="Collection.php" hash="8799c5bf630d267b551cf9dba986cbb0"/></dir><file name="Trackable.php" hash="b38749697b641874b42dceae38ab4a30"/></dir><dir name="Parser"><file name="AttributeSet.php" hash="9ae4013d42da5de0e9c8492fb29cd8d6"/><file name="Category.php" hash="0c3c71ff784307b9120d7cf781005069"/><file name="Coupon.php" hash="a66b3d4c8397610863cd74e35cbd5b62"/><file name="Customer.php" hash="99233c3da1eb28f1ec15e20e837d764a"/><file name="CustomerAttributeSet.php" hash="1b51f9300a9ee102872ff9d7f9bbccbc"/><file name="Guest.php" hash="002c900d3722f761e3e3ac63be84014f"/><file name="Inventory.php" hash="6f9ea827ee304f72b13bce3d7316efbc"/><file name="Product.php" hash="7e0fa4a55ca45fc876e588442cce72eb"/><dir name="Purchase"><file name="Item.php" hash="ca7facc8c81504ea990fdb1feeba64dd"/><file name="Shipment.php" hash="15f75c4443f41ed79fed37611912ce6d"/></dir><file name="Purchase.php" hash="d718ed744e15b9faaec2eaf3c2fb7b3b"/><dir name="Quote"><file name="Item.php" hash="37cbc74a49a16e67e02f421978e1741f"/></dir><file name="Quote.php" hash="fa0e008c67f15d1a4c7866a407aaaeaf"/><file name="Rule.php" hash="0a0f70172aeff0e5157f2f1652c3ae09"/><file name="Subscriber.php" hash="357aae3d07af49ad69e6df273ae2548b"/></dir><file name="Parser.php" hash="2e10487d6e00e3d2c3ec075c68e25d52"/><dir name="Redirect"><file name="Order.php" hash="e3ada1549e933dc4d247416c86f44266"/></dir><file name="Redirect.php" hash="9cb73f08f55f70335b1434c5a917ba1a"/><dir name="Resource"><file name="Abstract.php" hash="dfb049670e71971990e7920952fc9a39"/><dir name="Action"><file name="Collection.php" hash="22e278b8cbc5d18d4faa48c4f224d145"/></dir><file name="Action.php" hash="83b00531db5ec3a51ea7c0fc65a1d083"/><dir name="Cron"><dir name="Count"><file name="Collection.php" hash="c5cb4ab406c1d008c1bc22bb95b3ba28"/></dir><file name="Count.php" hash="6a356b5d92b509945c4567f479b9bfdd"/><dir name="Queue"><file name="Collection.php" hash="e6655bdbc5920eeb9178adfcb905ac36"/></dir><file name="Queue.php" hash="f9eae90970e4d935b5e5335c8e57e71b"/></dir><file name="Debug.php" hash="976156dc1ff783a26174bdac79decde2"/><dir name="Marketplaces"><dir name="Remote"><dir name="Order"><file name="Collection.php" hash="f94042d6a8ed87de18e64776f8aa0caf"/></dir><file name="Order.php" hash="08dfd41765ce0045b25bfb1e76a7aaac"/></dir></dir><dir name="Redirect"><file name="Collection.php" hash="df6662f064b3170aab46d69d42c514a3"/><dir name="Order"><file name="Collection.php" hash="162359ed9499b6f976f5c341fd0585c3"/></dir><file name="Order.php" hash="7ea4477380a5215dc0efe561ede359d9"/></dir><file name="Redirect.php" hash="d239af442388bb9fa80db81a7fc43711"/><file name="Setup.php" hash="3177eb8b02a951e0b988abcfd3eb92a1"/><dir name="Trackable"><file name="Collection.php" hash="6f060c3537b49710302e38e881885a69"/></dir><file name="Trackable.php" hash="764b0d21c492dd69b9f85ae3c647666e"/></dir><file name="Rewrite.php" hash="a10802e5fa677fc9e6c106ef32a615c8"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Harvestertype.php" hash="2f8c8f285df356013c15c1441bb5de3e"/><file name="LogFormat.php" hash="828680dafe5a7042221900cb6d9dfa17"/><file name="LogLevel.php" hash="b86c793ca04205f045efd9ea42d02a10"/><file name="Stability.php" hash="830e5bc4e8ce9657221224dbaf99cee6"/><file name="UrlType.php" hash="28f9a5bc024afe5526685d429a751ad8"/></dir></dir></dir><file name="Trackable.php" hash="9a78a576f6df1d2c535200b9c6069ba8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="794fc8a1d67ac3e6b5d71c707a0c7cad"/><file name="config.xml" hash="2e2c8ba7c027001899924bf7b8c8ef13"/><file name="system.xml" hash="29876070fa3148b4905477207c5b8bb9"/></dir><dir name="sql"><dir name="combine_setup"><file name="mysql4-install-1.0.0.70.php" hash="a2039a52ee797d6b7bb059a778964e37"/><file name="mysql4-upgrade-1.0.0.70-1.0.0.84.php" hash="e51deaff9e65f43483ab00573605329d"/><file name="mysql4-upgrade-1.0.0.84-1.0.0.88.php" hash="89bd8a585c0d351aae6838ace48f608d"/><file name="mysql4-upgrade-1.0.0.88-1.2.0.0.php" hash="6935370d864865461a4d3c3c4f5f7852"/><file name="mysql4-upgrade-1.2.0.0-1.2.0.1.php" hash="01a7ef2466b9f676884db4d7a7c562a9"/><file name="mysql4-upgrade-1.2.0.1-1.2.1.0.php" hash="46028e3aafb6558e2e15bef932468cb4"/><file name="mysql4-upgrade-1.3.9.9-1.4.0.0.php" hash="6db20f53ea3551243dc024aa207aaaa7"/><file name="mysql4-upgrade-1.4.7.0-1.5.0.0.php" hash="0251b062192af9015dc20f9261795f06"/></dir></dir></dir><dir name="BoneCollector"><dir name="Model"><file name="HarvestAbstract.php" hash="fecaefad7d4fc279e3a54b4c8cac54ae"/><dir name="HarvestAttribute"><file name="Observer.php" hash="e54c6434c56db411d1a95f55eacc1a7b"/></dir><dir name="HarvestCart"><file name="Observer.php" hash="c4bf9096fce93dc167a7204d3eaa4c24"/></dir><dir name="HarvestCategory"><file name="Observer.php" hash="2072d69344379f4de67b60c209a24875"/></dir><dir name="HarvestCustomer"><file name="Observer.php" hash="e99f1e144447b794f821e41abffb5b7e"/></dir><dir name="HarvestInventoryItem"><file name="Observer.php" hash="df82aade901d3098695d26ed5697455f"/></dir><dir name="HarvestProduct"><file name="Observer.php" hash="30d353b22e2a5e61374e4c679fed6da9"/></dir><dir name="HarvestPurchase"><file name="Observer.php" hash="78ed47e474ddebd7e48527df3b4c7b1f"/></dir><dir name="HarvestRule"><file name="Observer.php" hash="3511954dd9842dcc1defa0c0237b4b49"/></dir><dir name="HarvestSubscriber"><file name="Observer.php" hash="4fa55a9ad34b47118c8aa43d55fa383b"/></dir></dir><dir name="etc"><file name="config.xml" hash="b1a43d80a3326ef2c26f20660d7f0a3b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Springbot.xml" hash="1376424af56bb8add0a97f9f8da2ba93"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="bmbleb.xml" hash="69aa1b64c5349cbb53fcdc385b0adce4"/></dir><dir name="template"><dir name="bmbleb"><file name="auth.phtml" hash="bf509b53c49cd69ec3ea60e3effe69c3"/><file name="dashboard_loggedout.phtml" hash="19281143b19a544d4e3072dc754ada2d"/><dir name="help"><file name="index.phtml" hash="e9d3f11c623c735c3e699e406ff9e0e7"/></dir><dir name="index"><file name="messages.phtml" hash="fcbbb47d2cc30c493ed2316a8b888f5d"/><file name="terms.phtml" hash="dfff1182d2fe7d8eee69b9b302c4cbc7"/></dir><dir name="jobs"><file name="status.phtml" hash="77f0b0ae7c3c6c42031675cfc959e270"/></dir><file name="jobs.phtml" hash="961ac83f56bf8703dbc433894da4933e"/><file name="login.phtml" hash="0a1a20dfaffe8646bb56323ab811d46a"/><file name="logout.phtml" hash="09b92790c5e124a01086d6929ed7e8de"/><dir name="logs"><file name="index.phtml" hash="d7ca20d89a393bbc8cd31e98f73c0ea9"/></dir><file name="notifications.phtml" hash="45f8767a090a4f7a7e177151bbc43f4f"/><dir name="order"><file name="marketplaces.phtml" hash="03857d6c46acb08886cb597e6f3ba5e5"/></dir><dir name="problems"><file name="index.phtml" hash="b6ad14ab59fc3a06fda655d57faeab23"/></dir><file name="status.phtml" hash="1acc630a6549b234bc1fa5923e04b8ce"/><file name="tabs.phtml" hash="779c335a284b9bab18b36859011d673f"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="shadow.xml" hash="3f29bebbcf7e42c57dcac9150c6b7d68"/></dir><dir name="template"><dir name="shadow"><file name="async.phtml" hash="af147801ed74d45bb0580b0bb69ce0fd"/><file name="conversion.phtml" hash="c1eff343cf8d9a2189caaf1387ddc225"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="bmbleb"><file name="bmbleb.css" hash="d929b5f42085c25b86101379f286f55f"/><dir name="images"><file name="arrows_up-down-large.png" hash="72c27995e1ab1d182891dad0a4d1dae2"/><file name="bmb-ctl.png" hash="de59a694a82b8699560df5146b2e315f"/><file name="check.png" hash="126f33ed483549e79a16186b7499c190"/><file name="grn-bg.png" hash="f681a524e2b4561dbe94152a2d24d60b"/><file name="h3-bg.png" hash="b93df0b0bdba8e8f6e0a07cc31fcc180"/><file name="icon-alert.png" hash="ac2e70efdcebc3813222d0d3ee62a6d9"/><file name="icon-bmbleb.png" hash="fb5574b5e63ee33b84eee26b3d8ef8e3"/><file name="icon-insights.png" hash="725fd29fe1b705e358c9080408693d3d"/><file name="icon-status.png" hash="bd13429f23166a6d431739010ea1b2cd"/><file name="left-ico1.png" hash="7d188f5e6021569750756f58067f0a3b"/><file name="left-ico2.png" hash="d2f6379a73290a8ffa4cb3e19a809d25"/><file name="left-ico3.png" hash="73bc75f7a746e54a75f14eda7a28a6b9"/><file name="left-ico4.png" hash="1da2c26187fed26b6c61599682b2dc4b"/><file name="left-ico5.png" hash="ada61cb32805f2cb8e8dace46361613e"/><file name="left-ico6.png" hash="1e62822267f72589ffa0771352a002da"/><file name="left-ico7.png" hash="16118412d581f0c83ce45c44f62f25a1"/><file name="left-ico8.png" hash="c7de2fe523c892b432b575648cc05631"/><file name="left-ico_demographics.png" hash="3fe23a2dea68f6c65114f248a8bdaa5e"/><file name="login-icn-b.png" hash="64e72070f595e215ece79736ac77ee2f"/><file name="login-icn.png" hash="6142cc2fc8ee2d1c40bf3c8f9ac1fa85"/><file name="logo.png" hash="8fb783f7d68fca3914123f56b8c066a4"/><file name="orng-bg.png" hash="074a6912ca2a139df537e3d15b6bc9b2"/><file name="plugin_dashboard_syncing.jpg" hash="8511648541f6f1b96ff1c53dda3a439b"/><file name="register.png" hash="f73fe51cf7df27ab11089385fa50714e"/><file name="registration-bg-25.png" hash="9d2cf77619cc8fce3ae4d44b0aae30c1"/><file name="registration-bg-50.png" hash="99942fdc8c3f88b0d4b09f87c9e39045"/><file name="registration-bg.png" hash="96365b39495e56ffe491dd9930fe221d"/><file name="spinner.gif" hash="add667817f25bce331a213ab3cc9621f"/><file name="springbot-ctl.png" hash="de59a694a82b8699560df5146b2e315f"/><file name="submit-btn-bg.png" hash="d98aa287b7b73dad9f780b22cb53fbdb"/><file name="sync_icon.png" hash="cb12f2e8943c8e324e3456375f953c86"/><file name="white-check.png" hash="126f33ed483549e79a16186b7499c190"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="shell"><file name="springbot.php" hash="4b36425179a2db3bf63cf706f4989f80"/></dir></target></contents>
56
  <compatible/>
57
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
58
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Springbot</name>
4
+ <version>1.5.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License v3.0 (OSL-3.0)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Springbot helps merchants drive marketing actions based on insights from its "big data " analytics engine</summary>
10
+ <description>Springbot - Better Data. Better Actions. More Revenue.&amp;lt;br&amp;gt;&#xD;
11
+ &amp;lt;br&amp;gt;&#xD;
12
+ Do you need help deciding how to spend your next marketing dollar? Springbot can help.&amp;lt;br&amp;gt;&#xD;
13
+ &amp;lt;br&amp;gt;&#xD;
14
+ Know your customers better.&amp;lt;br&amp;gt;&#xD;
15
+ Take better marketing actions.&amp;lt;br&amp;gt;&#xD;
16
+ Drive more revenue.&amp;lt;br&amp;gt;&#xD;
17
+ &amp;lt;br&amp;gt;&#xD;
18
+ Springbot helps Magento merchants drive marketing actions based on insights from its &amp;quot;big data&amp;quot; analytics engine.&amp;lt;br&amp;gt;&#xD;
19
+ - Analyze and augment consumer data and purchase behavior&amp;lt;br&amp;gt;&#xD;
20
+ - Integrate online marketing channels, content and marketplaces&amp;lt;br&amp;gt;&#xD;
21
+ - Prioritize future marketing actions based on the potential ROI&amp;lt;br&amp;gt;&#xD;
22
+ &amp;lt;br&amp;gt;&#xD;
23
+ Get to Know your Customers&amp;lt;br&amp;gt;&#xD;
24
+ &amp;lt;br&amp;gt;&#xD;
25
+ Springbot works magic by adding hard-to-find social and demographic data about your customers directly into Magento.&amp;lt;br&amp;gt;&#xD;
26
+ &amp;lt;br&amp;gt;&#xD;
27
+ age, gender, geo - gain an intuitive sense of your real market dynamics&amp;lt;br&amp;gt;&#xD;
28
+ social media data - facebook, twitter, linkedin... find your customers online without googling all of them!&amp;lt;br&amp;gt;&#xD;
29
+ home owner data - renting vs. owning and home value can drive purchase behavior&amp;lt;br&amp;gt;&#xD;
30
+ &amp;lt;br&amp;gt;&#xD;
31
+ plus employment data, income data and much more!&amp;lt;br&amp;gt;&#xD;
32
+ &amp;lt;br&amp;gt;&#xD;
33
+ Get Started Now with a Limited Time Free Data Offer&amp;lt;br&amp;gt;&#xD;
34
+ &amp;lt;br&amp;gt;&#xD;
35
+ It&amp;apos;s completely free to sign up. We&amp;apos;ll give you augmented data for up to 1000 of your customers so that&amp;lt;br&amp;gt;&#xD;
36
+ you can experience the power of our awesome data service.&amp;lt;br&amp;gt;&#xD;
37
+ &amp;lt;br&amp;gt;&#xD;
38
+ Deep Magento Integration&amp;lt;br&amp;gt;&#xD;
39
+ &amp;lt;br&amp;gt;&#xD;
40
+ You have enough screens, graphs and forms to run your store. bmbleb enhances those screens... it doesn&amp;apos;t&amp;lt;br&amp;gt;&#xD;
41
+ replace them. Your extra customer data appears in your normal Magento customer screens. You can sort and search&amp;lt;br&amp;gt;&#xD;
42
+ using it. And when you do want to dig deeper... Springbot has screens for you!&amp;lt;br&amp;gt;&#xD;
43
+ &amp;lt;br&amp;gt;&#xD;
44
+ Powerful Living Data Alerts&amp;lt;br&amp;gt;&#xD;
45
+ &amp;lt;br&amp;gt;&#xD;
46
+ Data isn&amp;apos;t static. It changes constantly as we go about our lives. While you&amp;apos;re busy watching over your&amp;lt;br&amp;gt;&#xD;
47
+ store, Springbot watches over your data and alerts you to sales, marketing and relationship opportunities. Living&amp;lt;br&amp;gt;&#xD;
48
+ Data Alerts tell you when your customers are ready to buy. Social media monitors tell you when customers are&amp;lt;br&amp;gt;&#xD;
49
+ tweeting about topics relevant to your store.&amp;lt;br&amp;gt;&#xD;
50
+ &amp;lt;br&amp;gt;&#xD;
51
+ Living Data Alerts example: 378 pieces of data have been added to your customer database&amp;lt;br&amp;gt;&#xD;
52
+ Social Media Alerts example: Ted Smith Tweeted about your company&amp;lt;br&amp;gt;&#xD;
53
+ Proclivity to Buy Alerts example: Sally Avalon bought a house recently&amp;lt;br&amp;gt;&#xD;
54
+ &amp;lt;br&amp;gt;&#xD;
55
+ For support information, features and pricing and more details visit springbot.com</description>
56
+ <notes>Fix for PHP 5.3 and below where function calls were used as arrays. This notation is only supported in PHP 5.4 and above.</notes>
57
  <authors><author><name>Springbot Integrations Team</name><user>Springbot</user><email>magento@springbot.com</email></author></authors>
58
+ <date>2016-08-29</date>
59
+ <time>18:02:42</time>
60
+ <contents><target name="magecommunity"><dir name="Springbot"><dir name="Shadow"><dir name="Block"><dir name="Action"><file name="View.php" hash="c565170f40e3e26d30d7464ce83aa1cf"/></dir><file name="Async.php" hash="0d203fe1a722f7045029613a0e97bfc2"/></dir><dir name="Controller"><file name="Action.php" hash="5dc41d4ddf12a468fb23fc757ef49a95"/></dir><dir name="Helper"><file name="Data.php" hash="82089d4cfecee69628ae9d627ad2de0c"/><file name="Prattler.php" hash="e2658c19a182bd5cc9948eccc024ad21"/></dir><dir name="Model"><dir name="Listeners"><file name="Observer.php" hash="ea89c307b28795d568366b48a8986240"/></dir></dir><dir name="controllers"><file name="ActionController.php" hash="ea69946850d6aa24d14c6df26541ecaf"/><file name="IndexController.php" hash="07ec0cd97882eb37b157a6c6eaf8b656"/></dir><dir name="etc"><file name="config.xml" hash="b1717e37375197b449c0736adff99d87"/></dir></dir><dir name="Services"><dir name="Cmd"><file name="Forecast.php" hash="efaeb6ca5b2667b30929b223cddfb044"/><file name="Halt.php" hash="85c85ae257e9b86d0fb10fb46060fea3"/><file name="Harvest.php" hash="4330b805baf9ab761fad94a22652972c"/><file name="Healthcheck.php" hash="b1c26cd3e54c303c7c6d73e5accf2e18"/></dir><dir name="Harvest"><file name="AttributeSets.php" hash="95610f6fd6323e0473589c01051781f2"/><file name="Carts.php" hash="ecaf8583962fc63e49cf069d73eb22bf"/><file name="Categories.php" hash="acfe9c8dc9a02992a058015e8aaf9311"/><file name="Coupons.php" hash="5190a1669b0b4ef10222843451e9dc36"/><file name="CustomerAttributeSets.php" hash="7c3a0bed9f841900f692f5a17e7c6e8f"/><file name="Customers.php" hash="3d57c8238976554081176e249f2e7f4b"/><file name="Guests.php" hash="4a806542ae8aad1781a7222052ba1595"/><file name="Inventories.php" hash="d5a78ead8d37188df6286d4697b25f76"/><file name="Products.php" hash="087d01eddc45b4a30c4aa7dba5cc5dce"/><file name="Purchases.php" hash="a3d76ae1a2ea514fcce5ca2607ddf5a4"/><file name="Rules.php" hash="355ecad7266987a391ceca9d2eb0244f"/><file name="Subscribers.php" hash="a8b0d7197580bd9f3de7b10f9c6dc7ca"/></dir><file name="Harvest.php" hash="af3b9604c7b9d7da76cffe846dc34d70"/><dir name="Log"><file name="Installer.php" hash="342706712eb2731ea27aeec993fd2d7f"/></dir><dir name="Post"><file name="Attribute.php" hash="e0a283984de84bc16d5f89a893a8dc83"/><file name="AttributeSet.php" hash="c8f66b5a189125a63e834196402b709a"/><file name="Cart.php" hash="26d33fb887417e46d3ba3e46badc04a3"/><file name="Category.php" hash="0645d5eb9bb790f25e29666bc3a703e0"/><file name="Coupon.php" hash="6b8b49327874ce431f6100b6917ba21f"/><file name="Customer.php" hash="d2f018919afdb7d49617e6b9ac7d2760"/><file name="Guest.php" hash="3b7ee9f0e274340713d8c4302d01b361"/><file name="Inventory.php" hash="a003e45720f7527d29a5678596e4e843"/><file name="Json.php" hash="86a5f26aa5367d8c4c66d278e4c02546"/><file name="Jsonstring.php" hash="9dfb5761d1a7835bf35040a073fa8fc4"/><file name="Product.php" hash="5ec9cbf29df156da09d17e1b6526f53d"/><file name="Purchase.php" hash="0b924c8e5d8f7018eb335ba9fb6d63dd"/><file name="Rule.php" hash="fa038fa414a176d960ed6470c7b7b4cd"/><file name="Subscriber.php" hash="88c5dbcaae805866595217eedbbf5f34"/></dir><file name="Post.php" hash="df9bf80bee670259f3a54e3308d0dbd3"/><file name="Registry.php" hash="d54afde887b72e79ae36ab11766ec5c9"/><dir name="Store"><file name="Finalize.php" hash="e840d2c2dbe813f259b92feba8173b52"/><file name="Register.php" hash="72ae8d75c11dc1c0635c799e284ecb2d"/></dir><dir name="Tasks"><file name="ClearCache.php" hash="5653a49dbb7743ffc967640c933976a1"/><file name="ClearJobs.php" hash="380740a54aa4d79a89d2c67f06724a31"/><file name="ClearStores.php" hash="33e216186c56bde7e558cd828e90dda0"/><file name="CreateRewrite.php" hash="fe937a07db1b9e415f97cfc22a49c437"/><file name="Debug.php" hash="41a522394c2b9375393d81bb3ab206cc"/><file name="DeleteJob.php" hash="be2a2be88290cc3e9bc54c59e22254b5"/><file name="DeliverEventLog.php" hash="97d4b71f3ae619503dc82420e862826c"/><file name="Forecast.php" hash="caaf18be7fe387a4eba5a77eb0db2c12"/><file name="GetLog.php" hash="d850bba9f90b134f884d8d7a36730a26"/><file name="Harvest.php" hash="f71f97f078a081425c8848ba435d3b16"/><file name="HarvestInventory.php" hash="570d3aba5ac28b397d601d21f070415e"/><file name="Healthcheck.php" hash="63fdc080533ab8dff8d0949dd6ef4a3b"/><file name="Jobs.php" hash="9df9611445f9ab4a7a6d4b4e79f6b681"/><file name="KillHarvest.php" hash="a757f35956e4565b597522168109071c"/><file name="LaunchFullHarvest.php" hash="e5271dbfa422a90f4c4dda7362cb68f3"/><file name="LaunchPartialHarvest.php" hash="9c5aa7792fe9a3b98f9de9f4b59e3866"/><file name="PluginVersion.php" hash="4139fe90a74f4d6531243fcacf22777a"/><file name="PostItem.php" hash="54b4bac0b26b8b0e06df1d6da1ea7a91"/><file name="Redirects.php" hash="357b3008bbc9967cef73ad055c89e16e"/><file name="RegisterStores.php" hash="c054ef31b9c28efc5a18ee2ddf31c512"/><file name="ResetRetries.php" hash="bf00fe101b69a78955dc9a6d054e7ba7"/><file name="ResumeHarvest.php" hash="c9ba7b36e2b16dd1d1d947fc83a0ce5e"/><file name="Run.php" hash="c6892d3f812d5085b284d3501211bd5d"/><file name="SetVar.php" hash="93a0afb5e5c32536f430fc3b58b72995"/><file name="Stores.php" hash="d444cd05f1487945528e3f1e7bb01bb5"/><file name="UnlockJobs.php" hash="9bf4b725445897ab2842bcb97e344e0c"/><file name="ViewConfig.php" hash="cc60cbc3d2212576301b13b0b286c618"/></dir><file name="Tasks.php" hash="173bdc5c586a0f5d41528cdbd2fff70b"/><dir name="Work"><file name="Cleanup.php" hash="100fef130220e91dc255b5e0f30c37f1"/><file name="Manager.php" hash="9dbdfb717865b7724f4ffd38b3ec866e"/><file name="Report.php" hash="8a3eec618fe3b04a3514dc302c4c5a0f"/><file name="Restart.php" hash="d55e811fbba86348890b4047fa5a579f"/><file name="Runner.php" hash="c0ced9ce83e5e51b4ba5f10bb46760af"/><file name="Stop.php" hash="db97407b43396f0adf44a2354a23a0a5"/></dir></dir><dir name="Util"><file name="Caller.php" hash="4fcc265eb1a58fed5c3b404ec864514b"/><file name="Categories.php" hash="1292843306c38d9593902616e04320a6"/><dir name="Log"><file name="Rollover.php" hash="6ad4bd93adb7e906c1de5a05a2871ea8"/></dir><file name="Logger.php" hash="e6e82bcb3124fce31aa62425ce3d17e6"/><file name="Partition.php" hash="b9296b086003ba58ba12f8b8b0373c50"/></dir><file name="Services.php" hash="b9f0a869c089aa0ce4e111813827e0b0"/><dir name="Bmbleb"><dir name="Block"><dir name="Adminhtml"><file name="Auth.php" hash="7dc661bbe9ec85f700a22b319981114d"/><dir name="Bmbleb"><dir name="Login"><file name="Form.php" hash="04a552a32d4f4079fa4f4960f8fbf8ff"/></dir><file name="Login.php" hash="7232e8225f5b21de5675c0d84cb452bd"/></dir><file name="Connected.php" hash="833cef8e351f5efa7a4d104b1c51ca7f"/><file name="Help.php" hash="b280b3292ed778140b751b6426ef56fb"/><dir name="Index"><file name="Messages.php" hash="1e247e31194447de32e54f49dafc3ccc"/><file name="Terms.php" hash="739e5a9ebe204f1f9ac433557c994ae6"/></dir><file name="Index.php" hash="eb7bbef5fa26a53748596e145c3677c4"/><dir name="Jobs"><file name="Grid.php" hash="67255d982ac3d50b38d7a2a525c2b922"/><file name="Status.php" hash="f1b197bf6fdc392bed93ff0734a54ad6"/></dir><file name="Jobs.php" hash="84801c6008802496e168e763a7e6d71f"/><file name="Login.php" hash="2e4d8baead482d404ed40f7d5f3d902c"/><file name="Logout.php" hash="b75af51891b751b9d070e1e784dd6914"/><file name="Logs.php" hash="686e958b553c1e3fcf74841eab30fffb"/><file name="Notifications.php" hash="9643c809802b0596de2fb5fb12b9674e"/><dir name="Order"><file name="Marketplaces.php" hash="cf241263dc2d6b74b53b54a2d1500a49"/></dir><file name="Status.php" hash="9b67a20f0ee00608029d24850cefda4d"/><file name="Tabs.php" hash="6f93d5c6bd5208a99637c06118c6c630"/></dir></dir><dir name="Helper"><file name="Account.php" hash="c41f40e6f58abd3b8486e0e92cc079d8"/><file name="Data.php" hash="dca14b137de1e2734a377ca645eeddbe"/><file name="PluginStatus.php" hash="9de073079a7ee90a43acd9807a4adc56"/></dir><dir name="Model"><file name="Bmbleb.php" hash="700d11c3006f2dcd2e80cd8bbbab15f9"/><file name="Observer.php" hash="675a90ca08e7b8cd87656d15513e7bb0"/><file name="Status.php" hash="9409d26c7884be6b8075ba97dbf71f78"/><file name="Sync.php" hash="a800b6064a88f37957392cd967f2b3cb"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Bmbleb"><file name="HelpController.php" hash="cda8111aaec6f9155aac1f2e0afb8b32"/><file name="IndexController.php" hash="174d93cdc2d881f2f183e69a8ad151d5"/><file name="JobsController.php" hash="1feb95dd4b477910165a250826e49145"/><file name="LoginController.php" hash="6b56c101ddd0316d9a8f1e832c27683f"/><file name="LogsController.php" hash="d31f21a550cac8b5bfa5af6b6bdfd412"/><file name="SettingsController.php" hash="8bce329eed695d7403e874b73fe30ceb"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="dd106e93b300a7d872498397f6135d21"/></dir></dir><file name="Boss.php" hash="446dbbf01f05f72328cbc033769e2354"/><file name="Cli.php" hash="36bb25a8314c24e5aa49df8b78111a55"/><file name="Log.php" hash="172ef37dda5b5e495e97872ef48754c4"/><dir name="Combine"><dir name="Helper"><file name="Attributes.php" hash="b3cedc8aecd0c57f4ed4aa8a0158caa1"/><file name="Cart.php" hash="07ce5f461ecded3b9b00ed5c30faa266"/><file name="Data.php" hash="bba3915380a71aaacacc306f10396ef1"/><file name="Harvest.php" hash="dabc1f514d2378d2b723856c732b1253"/><file name="Marketplaces.php" hash="5b080bf0649759b563a90ae5992091fd"/><file name="Parser.php" hash="480f573160e775654555022a5fee1450"/><file name="Redirect.php" hash="92ffe4e71329c1418143d295ae71d18a"/><file name="Store.php" hash="8db94d157d7e497e7612844da43a6c11"/><file name="Trackable.php" hash="a042cb0d176730ec87353b1c5c6d21f7"/></dir><dir name="Model"><file name="Action.php" hash="6375461263bdf7fe26e71235d2449c21"/><file name="Api.php" hash="1c38e0ef61c84be1bf997b7143238f27"/><dir name="Cron"><file name="Count.php" hash="57552740b6ffdd9a4e879191a51043b0"/><dir name="Manager"><file name="Status.php" hash="aeb4445bc2d4b1b7e0e19c09172f0483"/></dir><dir name="Queue"><dir name="Batch"><file name="Row.php" hash="25f4ed809a9190f5d41c6c210cd8a537"/></dir><file name="Batch.php" hash="fa905d2781aab5881e881e3b12d25e0c"/></dir><file name="Queue.php" hash="52fae6cb137515dd59f0e8a612a90adb"/><file name="Worker.php" hash="4a825f89f340c34cd5feff2cfb859a7a"/></dir><file name="Cron.php" hash="92641d27ee653b22eeb9f6b995abde0b"/><dir name="File"><file name="Io.php" hash="6d1f79eaf45897bf0525b0f3f3ac69d2"/><file name="Path.php" hash="24900b670c07fcdc4e54bae585f20002"/></dir><dir name="Harvest"><file name="AttributeSets.php" hash="479dfb30912b74183b396fa4e62323b2"/><file name="Carts.php" hash="0b303b2b7d4458a9a0cbf0653b9d660f"/><file name="Categories.php" hash="fd5f13ad449a320616569f64c82327ff"/><file name="Coupons.php" hash="14112f9063bbf20cea7ff3649f238524"/><file name="CustomerAttributeSets.php" hash="044f426226165ee86b0f822c00ec7712"/><file name="Customers.php" hash="c7850418a39abf09c10fbfafcb96f8e1"/><file name="Guests.php" hash="3685b3220b724e518dc83daad015577f"/><file name="Inventories.php" hash="15dc9f8c38dd7ab626eb3154c6b1b0f2"/><file name="Products.php" hash="da471abcc04837391b5270464164aefd"/><file name="Purchases.php" hash="427d38d1f6579f63730aa6bdf6b7bba4"/><file name="Rules.php" hash="fd1789174225c4ed6ad1e1137fe2aee5"/><file name="Subscribers.php" hash="e499e299612a6e2ce07ee19228cf43c5"/></dir><file name="Harvest.php" hash="73e9f8c899fab89ef9ce90f8acfe9de7"/><dir name="Marketplaces"><dir name="Order"><file name="Builder.php" hash="a3107ccf23ea1f36f6990e835b8f028a"/><file name="Customer.php" hash="83e02326c7a00f3df20f217d7ce3ea9e"/><file name="Item.php" hash="8f285f1648bf52b9fa95dfa3c68d3011"/><file name="Parser.php" hash="55dad7d4feb487f3c8d3094423245cde"/></dir><file name="OrderService.php" hash="28251d154f69ea6ba31a6768f8753492"/><file name="Payment.php" hash="f3accd929ab4ddbc1ae4872a20c705a8"/><dir name="Remote"><file name="Order.php" hash="c687a441bc08ed2e967e30a2c0235624"/></dir><file name="Shipping.php" hash="f4aa773729c7058c9789537c8da79694"/></dir><dir name="Mysql4"><dir name="Action"><file name="Collection.php" hash="830a7db2ea307d594fe945701654d883"/></dir><file name="Action.php" hash="5b18cc8842c83d981575b7b2de496f66"/><dir name="Cron"><file name="Count.php" hash="acbbb7ec28afbbe98101f5d114cb30b3"/><dir name="Queue"><file name="Collection.php" hash="b26806c9e7cefd052bb784f5a6ce814c"/></dir><file name="Queue.php" hash="4add10644bfc94b88ef5042b23c82ae7"/></dir><dir name="Redirect"><file name="Collection.php" hash="3bbe4f8729c603f8d8131154a0a117c1"/><dir name="Order"><file name="Collection.php" hash="88c0cfcce31b0eed8c035dee4e7e86df"/></dir><file name="Order.php" hash="852bea330edac3372ec5c168111301a8"/></dir><file name="Redirect.php" hash="842e4ba35c6b049c8eaa64704588ca76"/><file name="Setup.php" hash="3fdec335980846a4c3adbc6f4e3478eb"/><dir name="Trackable"><file name="Collection.php" hash="8799c5bf630d267b551cf9dba986cbb0"/></dir><file name="Trackable.php" hash="b38749697b641874b42dceae38ab4a30"/></dir><dir name="Parser"><file name="AttributeSet.php" hash="9ae4013d42da5de0e9c8492fb29cd8d6"/><file name="Category.php" hash="0c3c71ff784307b9120d7cf781005069"/><file name="Coupon.php" hash="a66b3d4c8397610863cd74e35cbd5b62"/><file name="Customer.php" hash="99233c3da1eb28f1ec15e20e837d764a"/><file name="CustomerAttributeSet.php" hash="1b51f9300a9ee102872ff9d7f9bbccbc"/><file name="Guest.php" hash="002c900d3722f761e3e3ac63be84014f"/><file name="Inventory.php" hash="6f9ea827ee304f72b13bce3d7316efbc"/><file name="Product.php" hash="7e0fa4a55ca45fc876e588442cce72eb"/><dir name="Purchase"><file name="Item.php" hash="ca7facc8c81504ea990fdb1feeba64dd"/><file name="Shipment.php" hash="15f75c4443f41ed79fed37611912ce6d"/></dir><file name="Purchase.php" hash="d718ed744e15b9faaec2eaf3c2fb7b3b"/><dir name="Quote"><file name="Item.php" hash="37cbc74a49a16e67e02f421978e1741f"/></dir><file name="Quote.php" hash="fa0e008c67f15d1a4c7866a407aaaeaf"/><file name="Rule.php" hash="0a0f70172aeff0e5157f2f1652c3ae09"/><file name="Subscriber.php" hash="357aae3d07af49ad69e6df273ae2548b"/></dir><file name="Parser.php" hash="2e10487d6e00e3d2c3ec075c68e25d52"/><dir name="Redirect"><file name="Order.php" hash="e3ada1549e933dc4d247416c86f44266"/></dir><file name="Redirect.php" hash="9cb73f08f55f70335b1434c5a917ba1a"/><dir name="Resource"><file name="Abstract.php" hash="dfb049670e71971990e7920952fc9a39"/><dir name="Action"><file name="Collection.php" hash="22e278b8cbc5d18d4faa48c4f224d145"/></dir><file name="Action.php" hash="83b00531db5ec3a51ea7c0fc65a1d083"/><dir name="Cron"><dir name="Count"><file name="Collection.php" hash="c5cb4ab406c1d008c1bc22bb95b3ba28"/></dir><file name="Count.php" hash="6a356b5d92b509945c4567f479b9bfdd"/><dir name="Queue"><file name="Collection.php" hash="e6655bdbc5920eeb9178adfcb905ac36"/></dir><file name="Queue.php" hash="f9eae90970e4d935b5e5335c8e57e71b"/></dir><file name="Debug.php" hash="976156dc1ff783a26174bdac79decde2"/><dir name="Marketplaces"><dir name="Remote"><dir name="Order"><file name="Collection.php" hash="f94042d6a8ed87de18e64776f8aa0caf"/></dir><file name="Order.php" hash="08dfd41765ce0045b25bfb1e76a7aaac"/></dir></dir><dir name="Redirect"><file name="Collection.php" hash="df6662f064b3170aab46d69d42c514a3"/><dir name="Order"><file name="Collection.php" hash="162359ed9499b6f976f5c341fd0585c3"/></dir><file name="Order.php" hash="7ea4477380a5215dc0efe561ede359d9"/></dir><file name="Redirect.php" hash="d239af442388bb9fa80db81a7fc43711"/><file name="Setup.php" hash="3177eb8b02a951e0b988abcfd3eb92a1"/><dir name="Trackable"><file name="Collection.php" hash="6f060c3537b49710302e38e881885a69"/></dir><file name="Trackable.php" hash="764b0d21c492dd69b9f85ae3c647666e"/></dir><file name="Rewrite.php" hash="a10802e5fa677fc9e6c106ef32a615c8"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Harvestertype.php" hash="2f8c8f285df356013c15c1441bb5de3e"/><file name="LogFormat.php" hash="828680dafe5a7042221900cb6d9dfa17"/><file name="LogLevel.php" hash="b86c793ca04205f045efd9ea42d02a10"/><file name="Stability.php" hash="830e5bc4e8ce9657221224dbaf99cee6"/><file name="UrlType.php" hash="28f9a5bc024afe5526685d429a751ad8"/></dir></dir></dir><file name="Trackable.php" hash="9a78a576f6df1d2c535200b9c6069ba8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="794fc8a1d67ac3e6b5d71c707a0c7cad"/><file name="config.xml" hash="f55ae4ab035897134867c596bb0c842c"/><file name="system.xml" hash="29876070fa3148b4905477207c5b8bb9"/></dir><dir name="sql"><dir name="combine_setup"><file name="mysql4-install-1.0.0.70.php" hash="a2039a52ee797d6b7bb059a778964e37"/><file name="mysql4-upgrade-1.0.0.70-1.0.0.84.php" hash="e51deaff9e65f43483ab00573605329d"/><file name="mysql4-upgrade-1.0.0.84-1.0.0.88.php" hash="89bd8a585c0d351aae6838ace48f608d"/><file name="mysql4-upgrade-1.0.0.88-1.2.0.0.php" hash="6935370d864865461a4d3c3c4f5f7852"/><file name="mysql4-upgrade-1.2.0.0-1.2.0.1.php" hash="01a7ef2466b9f676884db4d7a7c562a9"/><file name="mysql4-upgrade-1.2.0.1-1.2.1.0.php" hash="46028e3aafb6558e2e15bef932468cb4"/><file name="mysql4-upgrade-1.3.9.9-1.4.0.0.php" hash="6db20f53ea3551243dc024aa207aaaa7"/><file name="mysql4-upgrade-1.4.7.0-1.5.0.0.php" hash="0251b062192af9015dc20f9261795f06"/></dir></dir></dir><dir name="BoneCollector"><dir name="Model"><file name="HarvestAbstract.php" hash="fecaefad7d4fc279e3a54b4c8cac54ae"/><dir name="HarvestAttribute"><file name="Observer.php" hash="e54c6434c56db411d1a95f55eacc1a7b"/></dir><dir name="HarvestCart"><file name="Observer.php" hash="c4bf9096fce93dc167a7204d3eaa4c24"/></dir><dir name="HarvestCategory"><file name="Observer.php" hash="2072d69344379f4de67b60c209a24875"/></dir><dir name="HarvestCustomer"><file name="Observer.php" hash="e99f1e144447b794f821e41abffb5b7e"/></dir><dir name="HarvestInventoryItem"><file name="Observer.php" hash="df82aade901d3098695d26ed5697455f"/></dir><dir name="HarvestProduct"><file name="Observer.php" hash="30d353b22e2a5e61374e4c679fed6da9"/></dir><dir name="HarvestPurchase"><file name="Observer.php" hash="78ed47e474ddebd7e48527df3b4c7b1f"/></dir><dir name="HarvestRule"><file name="Observer.php" hash="3511954dd9842dcc1defa0c0237b4b49"/></dir><dir name="HarvestSubscriber"><file name="Observer.php" hash="4fa55a9ad34b47118c8aa43d55fa383b"/></dir></dir><dir name="etc"><file name="config.xml" hash="b1a43d80a3326ef2c26f20660d7f0a3b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Springbot.xml" hash="1376424af56bb8add0a97f9f8da2ba93"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="bmbleb.xml" hash="69aa1b64c5349cbb53fcdc385b0adce4"/></dir><dir name="template"><dir name="bmbleb"><file name="auth.phtml" hash="bf509b53c49cd69ec3ea60e3effe69c3"/><file name="dashboard_loggedout.phtml" hash="19281143b19a544d4e3072dc754ada2d"/><dir name="help"><file name="index.phtml" hash="e9d3f11c623c735c3e699e406ff9e0e7"/></dir><dir name="index"><file name="messages.phtml" hash="fcbbb47d2cc30c493ed2316a8b888f5d"/><file name="terms.phtml" hash="dfff1182d2fe7d8eee69b9b302c4cbc7"/></dir><dir name="jobs"><file name="status.phtml" hash="77f0b0ae7c3c6c42031675cfc959e270"/></dir><file name="jobs.phtml" hash="961ac83f56bf8703dbc433894da4933e"/><file name="login.phtml" hash="0a1a20dfaffe8646bb56323ab811d46a"/><file name="logout.phtml" hash="09b92790c5e124a01086d6929ed7e8de"/><dir name="logs"><file name="index.phtml" hash="d7ca20d89a393bbc8cd31e98f73c0ea9"/></dir><file name="notifications.phtml" hash="45f8767a090a4f7a7e177151bbc43f4f"/><dir name="order"><file name="marketplaces.phtml" hash="03857d6c46acb08886cb597e6f3ba5e5"/></dir><dir name="problems"><file name="index.phtml" hash="b6ad14ab59fc3a06fda655d57faeab23"/></dir><file name="status.phtml" hash="1acc630a6549b234bc1fa5923e04b8ce"/><file name="tabs.phtml" hash="779c335a284b9bab18b36859011d673f"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="shadow.xml" hash="3f29bebbcf7e42c57dcac9150c6b7d68"/></dir><dir name="template"><dir name="shadow"><file name="async.phtml" hash="af147801ed74d45bb0580b0bb69ce0fd"/><file name="conversion.phtml" hash="c1eff343cf8d9a2189caaf1387ddc225"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="bmbleb"><file name="bmbleb.css" hash="d929b5f42085c25b86101379f286f55f"/><dir name="images"><file name="arrows_up-down-large.png" hash="72c27995e1ab1d182891dad0a4d1dae2"/><file name="bmb-ctl.png" hash="de59a694a82b8699560df5146b2e315f"/><file name="check.png" hash="126f33ed483549e79a16186b7499c190"/><file name="grn-bg.png" hash="f681a524e2b4561dbe94152a2d24d60b"/><file name="h3-bg.png" hash="b93df0b0bdba8e8f6e0a07cc31fcc180"/><file name="icon-alert.png" hash="ac2e70efdcebc3813222d0d3ee62a6d9"/><file name="icon-bmbleb.png" hash="fb5574b5e63ee33b84eee26b3d8ef8e3"/><file name="icon-insights.png" hash="725fd29fe1b705e358c9080408693d3d"/><file name="icon-status.png" hash="bd13429f23166a6d431739010ea1b2cd"/><file name="left-ico1.png" hash="7d188f5e6021569750756f58067f0a3b"/><file name="left-ico2.png" hash="d2f6379a73290a8ffa4cb3e19a809d25"/><file name="left-ico3.png" hash="73bc75f7a746e54a75f14eda7a28a6b9"/><file name="left-ico4.png" hash="1da2c26187fed26b6c61599682b2dc4b"/><file name="left-ico5.png" hash="ada61cb32805f2cb8e8dace46361613e"/><file name="left-ico6.png" hash="1e62822267f72589ffa0771352a002da"/><file name="left-ico7.png" hash="16118412d581f0c83ce45c44f62f25a1"/><file name="left-ico8.png" hash="c7de2fe523c892b432b575648cc05631"/><file name="left-ico_demographics.png" hash="3fe23a2dea68f6c65114f248a8bdaa5e"/><file name="login-icn-b.png" hash="64e72070f595e215ece79736ac77ee2f"/><file name="login-icn.png" hash="6142cc2fc8ee2d1c40bf3c8f9ac1fa85"/><file name="logo.png" hash="8fb783f7d68fca3914123f56b8c066a4"/><file name="orng-bg.png" hash="074a6912ca2a139df537e3d15b6bc9b2"/><file name="plugin_dashboard_syncing.jpg" hash="8511648541f6f1b96ff1c53dda3a439b"/><file name="register.png" hash="f73fe51cf7df27ab11089385fa50714e"/><file name="registration-bg-25.png" hash="9d2cf77619cc8fce3ae4d44b0aae30c1"/><file name="registration-bg-50.png" hash="99942fdc8c3f88b0d4b09f87c9e39045"/><file name="registration-bg.png" hash="96365b39495e56ffe491dd9930fe221d"/><file name="spinner.gif" hash="add667817f25bce331a213ab3cc9621f"/><file name="springbot-ctl.png" hash="de59a694a82b8699560df5146b2e315f"/><file name="submit-btn-bg.png" hash="d98aa287b7b73dad9f780b22cb53fbdb"/><file name="sync_icon.png" hash="cb12f2e8943c8e324e3456375f953c86"/><file name="white-check.png" hash="126f33ed483549e79a16186b7499c190"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="shell"><file name="springbot.php" hash="4b36425179a2db3bf63cf706f4989f80"/></dir></target></contents>
61
  <compatible/>
62
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
63
  </package>