dotmailermagento - Version 3.0.0

Version Notes

Transactional Emails, Custom Customer Attributes, Reports & More

This release includes some great new functionality as well as including a number of fixes.

##IMPORTANT## Dynamic content URL's have been changed so will need updating within your dotMailer account to ensure they continue working correctly. ##IMPORTANT##

Release Highlights:

+ Transactional Emails: Replace the standard emails Magento currently sends to your customers and guests with beautifully created campaigns from dotMailer. Emails include new account, new order, dispatch, cancel and refund emails. **A dotMailer child account is required to enable this functionality**

+ Custom Customer Attributes: Sync your custom created customer attributes to dotMailer

+ Dynamic Content Styling: Apply custom CSS to all dynamic content pages e.g. font size, colour and type.

+ Reporting: Now within the Newsletter section in Magento you can view the import status of contacts and orders, as well as the sending status of transactional and lost basket emails.

Download this release

Release Info

Developer Calin Diacon
Extension dotmailermagento
Version 3.0.0
Comparing to
See all releases


Code changes from version 1.5.1 to 3.0.0

Files changed (244) hide show
  1. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign.php +14 -0
  2. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign/Edit.php +30 -0
  3. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign/Edit/Form.php +58 -0
  4. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign/Grid.php +139 -0
  5. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Column/Renderer/Imported.php +9 -0
  6. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Column/Renderer/Status.php +12 -0
  7. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Config/Customdatafields.php +106 -0
  8. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Config/Select.php +14 -0
  9. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact.php +14 -0
  10. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact/Edit.php +29 -0
  11. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact/Edit/Form.php +69 -0
  12. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact/Grid.php +151 -0
  13. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Dashboard.php +33 -0
  14. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Dashboard/Content.php +11 -0
  15. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Order.php +17 -0
  16. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Order/Grid.php +69 -0
  17. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Sales/Order/Creditmemo/View.php +198 -0
  18. app/code/{local/Dotdigitalgroup/Email/Block/Debug/Initialsync.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Deletecontactids.php} +5 -5
  19. app/code/{local/Dotdigitalgroup/Email/Block/Debug/Countcontacts.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Reimportorders.php} +3 -4
  20. app/code/{local/Dotdigitalgroup/Email/Block/Debug/Deletecontacts.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Reimportsubscribers.php} +3 -4
  21. app/code/{local/Dotdigitalgroup/Email/Block/Debug/Transactionalsync.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Setupdatafields.php} +5 -4
  22. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Suppressedcontacts.php +21 -0
  23. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Password.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Ajaxvalidate.php} +1 -1
  24. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Addressbook.php +32 -0
  25. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Datafield.php +34 -0
  26. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Validator.php +5 -10
  27. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Waitingfield.php +14 -6
  28. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Wrapper.php +52 -0
  29. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Addressbookbutton.php +21 -0
  30. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Bestsellers.php +25 -0
  31. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Couponinfo.php +27 -0
  32. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Creditmemonew.php +27 -0
  33. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Crosssell.php +25 -0
  34. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Datafieldbutton.php +20 -0
  35. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Gridlist.php +99 -0
  36. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Lostbasket.php +25 -0
  37. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Mostviewed.php +24 -0
  38. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Productpush.php +24 -0
  39. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Recentlyviewed.php +24 -0
  40. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Related.php +26 -0
  41. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Upsell.php +24 -0
  42. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Wrapper.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Emailapivalidate.php} +8 -6
  43. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms/Smsmessagefour.php +20 -0
  44. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms}/Smsmessageone.php +4 -4
  45. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms/Smsmessagethree.php +21 -0
  46. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms/Smsmessagetwo.php +20 -0
  47. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Creditmemoupdate.php +26 -0
  48. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Creditmemoupdateguest.php +25 -0
  49. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Customerconfirmation.php +29 -0
  50. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Customerconfirmed.php +29 -0
  51. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Customernew.php +29 -0
  52. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Invoiceupdate.php +26 -0
  53. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Invoiceupdateguest.php +26 -0
  54. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newcreditmemo.php +27 -0
  55. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newcreditmemoguest.php +27 -0
  56. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newinvoice.php +27 -0
  57. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newinvoiceguest.php +27 -0
  58. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Neworder.php +26 -0
  59. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Neworderguest.php +25 -0
  60. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newshipment.php +27 -0
  61. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newshipmentguest.php +26 -0
  62. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Orderupdate.php +24 -0
  63. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Orderupdateguest.php +24 -0
  64. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Shipmentupdate.php +26 -0
  65. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Shipmentupdateguest.php +25 -0
  66. app/code/{local → community}/Dotdigitalgroup/Email/Block/Basket.php +6 -2
  67. app/code/{local → community}/Dotdigitalgroup/Email/Block/Coupon.php +0 -0
  68. app/code/community/Dotdigitalgroup/Email/Block/Customer.php +82 -0
  69. app/code/community/Dotdigitalgroup/Email/Block/Order.php +32 -0
  70. app/code/community/Dotdigitalgroup/Email/Block/Order/Creditmemo.php +34 -0
  71. app/code/community/Dotdigitalgroup/Email/Block/Order/Invoice.php +31 -0
  72. app/code/community/Dotdigitalgroup/Email/Block/Order/Shipping.php +35 -0
  73. app/code/{local → community}/Dotdigitalgroup/Email/Block/Products.php +15 -19
  74. app/code/community/Dotdigitalgroup/Email/Block/Recommended/Bestsellers.php +52 -0
  75. app/code/community/Dotdigitalgroup/Email/Block/Recommended/Mostviewed.php +48 -0
  76. app/code/community/Dotdigitalgroup/Email/Block/Recommended/Products.php +110 -0
  77. app/code/community/Dotdigitalgroup/Email/Block/Recommended/Push.php +53 -0
  78. app/code/community/Dotdigitalgroup/Email/Block/Recommended/Recentlyviewed.php +52 -0
  79. app/code/community/Dotdigitalgroup/Email/Helper/Config.php +70 -0
  80. app/code/community/Dotdigitalgroup/Email/Helper/Data.php +257 -0
  81. app/code/{local → community}/Dotdigitalgroup/Email/Helper/File.php +20 -6
  82. app/code/community/Dotdigitalgroup/Email/Helper/Recommended.php +177 -0
  83. app/code/community/Dotdigitalgroup/Email/Helper/Transactional.php +128 -0
  84. app/code/{local/Dotdigitalgroup/Email/Helper/Api/Restrequest.php → community/Dotdigitalgroup/Email/Model/Abstract/Rest.php} +60 -51
  85. app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Observer.php +95 -0
  86. app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Addressbooks.php +40 -0
  87. app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source/Orderlimit.php → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Advanced/Transdata.php} +1 -1
  88. app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Campaigns.php +38 -0
  89. app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Customer/Attributes/Select.php +28 -0
  90. app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Datafields.php +49 -0
  91. app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Datamapping/Datafieldtype.php +22 -0
  92. app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Dynamic}/Displaytype.php +1 -1
  93. app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Dynamic}/Gridview.php +4 -1
  94. app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Lostbaskets/Interval.php +38 -0
  95. app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source/Lostbasket.php → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Lostbaskets/Intervalminute.php} +1 -1
  96. app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Transactional/Campaigns.php +39 -0
  97. app/code/community/Dotdigitalgroup/Email/Model/Apiconnector/Client.php +652 -0
  98. app/code/community/Dotdigitalgroup/Email/Model/Apiconnector/Contact.php +192 -0
  99. app/code/community/Dotdigitalgroup/Email/Model/Apiconnector/Test.php +59 -0
  100. app/code/community/Dotdigitalgroup/Email/Model/Campaign.php +227 -0
  101. app/code/{local → community}/Dotdigitalgroup/Email/Model/Connector/Account.php +10 -7
  102. app/code/community/Dotdigitalgroup/Email/Model/Connector/Campaign.php +103 -0
  103. app/code/{local → community}/Dotdigitalgroup/Email/Model/Connector/Customer.php +63 -121
  104. app/code/community/Dotdigitalgroup/Email/Model/Connector/Datafield.php +285 -0
  105. app/code/community/Dotdigitalgroup/Email/Model/Connector/Order.php +182 -0
  106. app/code/community/Dotdigitalgroup/Email/Model/Contact.php +175 -0
  107. app/code/community/Dotdigitalgroup/Email/Model/Cron.php +69 -0
  108. app/code/community/Dotdigitalgroup/Email/Model/Customer/Guest.php +52 -0
  109. app/code/community/Dotdigitalgroup/Email/Model/Customer/Observer.php +28 -0
  110. app/code/{local/Dotdigitalgroup/Email/Model/Connector → community/Dotdigitalgroup/Email/Model/Customer}/Wishlist.php +11 -30
  111. app/code/{local → community}/Dotdigitalgroup/Email/Model/Customer/Wishlist/Item.php +18 -10
  112. app/code/community/Dotdigitalgroup/Email/Model/Email/Template.php +27 -0
  113. app/code/community/Dotdigitalgroup/Email/Model/Email/Template/Mailer.php +118 -0
  114. app/code/community/Dotdigitalgroup/Email/Model/Newsletter/Observer.php +51 -0
  115. app/code/community/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php +137 -0
  116. app/code/community/Dotdigitalgroup/Email/Model/Order.php +80 -0
  117. app/code/community/Dotdigitalgroup/Email/Model/Resource/Campaign.php +10 -0
  118. app/code/community/Dotdigitalgroup/Email/Model/Resource/Campaign/Collection.php +10 -0
  119. app/code/community/Dotdigitalgroup/Email/Model/Resource/Contact.php +17 -0
  120. app/code/community/Dotdigitalgroup/Email/Model/Resource/Contact/Collection.php +23 -0
  121. app/code/community/Dotdigitalgroup/Email/Model/Resource/Order.php +9 -0
  122. app/code/community/Dotdigitalgroup/Email/Model/Resource/Order/Collection.php +15 -0
  123. app/code/community/Dotdigitalgroup/Email/Model/Resource/Setup.php +26 -0
  124. app/code/community/Dotdigitalgroup/Email/Model/Sales/Observer.php +120 -0
  125. app/code/community/Dotdigitalgroup/Email/Model/Sales/Order.php +123 -0
  126. app/code/community/Dotdigitalgroup/Email/Model/Sales/Quote.php +160 -0
  127. app/code/community/Dotdigitalgroup/Email/Model/Sms/Campaign.php +86 -0
  128. app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/ConnectorController.php +158 -0
  129. app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/CampaignController.php +177 -0
  130. app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/ContactController.php +159 -0
  131. app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/DashboardController.php +18 -0
  132. app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/OrderController.php +24 -0
  133. app/code/community/Dotdigitalgroup/Email/controllers/CreditmemoController.php +73 -0
  134. app/code/community/Dotdigitalgroup/Email/controllers/CustomerController.php +38 -0
  135. app/code/community/Dotdigitalgroup/Email/controllers/EmailController.php +44 -0
  136. app/code/community/Dotdigitalgroup/Email/controllers/InvoiceController.php +71 -0
  137. app/code/community/Dotdigitalgroup/Email/controllers/OrderController.php +70 -0
  138. app/code/community/Dotdigitalgroup/Email/controllers/ProductsController.php +71 -0
  139. app/code/community/Dotdigitalgroup/Email/controllers/ReportController.php +63 -0
  140. app/code/community/Dotdigitalgroup/Email/controllers/ShippingController.php +79 -0
  141. app/code/community/Dotdigitalgroup/Email/etc/adminhtml.xml +98 -0
  142. app/code/community/Dotdigitalgroup/Email/etc/config.xml +438 -0
  143. app/code/{local → community}/Dotdigitalgroup/Email/etc/system.xml +981 -586
  144. app/code/{local/Dotdigitalgroup/Email/sql/connector_setup → community/Dotdigitalgroup/Email/sql/email_connector_setup}/mysql4-install-0.1.0.php +4 -11
  145. app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-install-3.0.0.php +287 -0
  146. app/code/{local/Dotdigitalgroup/Email/sql/connector_setup → community/Dotdigitalgroup/Email/sql/email_connector_setup}/mysql4-upgrade-1.1.1-1.1.2.php +0 -0
  147. app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-1.1.2-1.5.0.php +8 -0
  148. app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-1.5.0-2.0.0.php +75 -0
  149. app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.0-2.0.1.php +9 -0
  150. app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.1-2.0.2.php +52 -0
  151. app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.3-2.0.4.php +28 -0
  152. app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.4-2.0.5.php +9 -0
  153. app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.5-2.0.6.php +103 -0
  154. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Bestsellers.php +0 -18
  155. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Gridlist.php +0 -104
  156. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Insertvariable.php +0 -13
  157. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Messagedefault.php +0 -46
  158. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagefour.php +0 -23
  159. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagethree.php +0 -23
  160. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagetwo.php +0 -23
  161. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Couponinfo.php +0 -18
  162. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Crosssell.php +0 -20
  163. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Lostbasket.php +0 -19
  164. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Mostviewed.php +0 -18
  165. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Productpush.php +0 -19
  166. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Recentlyviewed.php +0 -20
  167. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Related.php +0 -19
  168. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Upsell.php +0 -19
  169. app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcecustomersync.php +0 -21
  170. app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcelostbasketsync.php +0 -21
  171. app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcesuppressedsync.php +0 -21
  172. app/code/local/Dotdigitalgroup/Email/Block/Debug/Rescuenow.php +0 -21
  173. app/code/local/Dotdigitalgroup/Email/Block/Debug/Testcredentials.php +0 -21
  174. app/code/local/Dotdigitalgroup/Email/Helper/Api/DotNetExample.php +0 -182
  175. app/code/local/Dotdigitalgroup/Email/Helper/Data.php +0 -96
  176. app/code/local/Dotdigitalgroup/Email/Helper/Recommended.php +0 -191
  177. app/code/local/Dotdigitalgroup/Email/Model/Account/Test.php +0 -40
  178. app/code/local/Dotdigitalgroup/Email/Model/Api/Rest.php +0 -729
  179. app/code/local/Dotdigitalgroup/Email/Model/Connector/Order.php +0 -118
  180. app/code/local/Dotdigitalgroup/Email/Model/Connector/Quote.php +0 -75
  181. app/code/local/Dotdigitalgroup/Email/Model/Cron.php +0 -58
  182. app/code/local/Dotdigitalgroup/Email/Model/Customer/Customer.php +0 -480
  183. app/code/local/Dotdigitalgroup/Email/Model/Customer/Suppressed.php +0 -85
  184. app/code/local/Dotdigitalgroup/Email/Model/Dynamic/Product/Mapper.php +0 -90
  185. app/code/local/Dotdigitalgroup/Email/Model/Dynamic/Recommended.php +0 -228
  186. app/code/local/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php +0 -19
  187. app/code/local/Dotdigitalgroup/Email/Model/Observer.php +0 -189
  188. app/code/local/Dotdigitalgroup/Email/Model/Order.php +0 -33
  189. app/code/local/Dotdigitalgroup/Email/Model/Sales/Order.php +0 -96
  190. app/code/local/Dotdigitalgroup/Email/Model/Sales/Quote.php +0 -289
  191. app/code/local/Dotdigitalgroup/Email/Model/Sales/Sms.php +0 -70
  192. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Customer.php +0 -50
  193. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Suppressed.php +0 -54
  194. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Activebasket.php +0 -12
  195. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Addressbooks.php +0 -30
  196. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Campaigns.php +0 -30
  197. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Datafields.php +0 -35
  198. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Displayifnot.php +0 -12
  199. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Orderstatus.php +0 -16
  200. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Sendcampain.php +0 -30
  201. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Syncfrequency.php +0 -40
  202. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Timeperiod.php +0 -13
  203. app/code/local/Dotdigitalgroup/Email/Test/Model/Product.php +0 -18
  204. app/code/local/Dotdigitalgroup/Email/controllers/Adminhtml/DebugController.php +0 -125
  205. app/code/local/Dotdigitalgroup/Email/controllers/EmailController.php +0 -133
  206. app/code/local/Dotdigitalgroup/Email/etc/adminhtml.xml +0 -43
  207. app/code/local/Dotdigitalgroup/Email/etc/config.xml +0 -289
  208. app/code/local/Varien/Data/Collection.php +0 -818
  209. app/design/adminhtml/default/default/layout/connector/email.xml +77 -0
  210. app/design/adminhtml/default/default/template/connector/dashboard/accountbar.phtml +10 -0
  211. app/design/adminhtml/default/default/template/connector/dashboard/content.phtml +8 -0
  212. app/design/adminhtml/default/default/template/connector/dashboard/switcher.phtml +24 -0
  213. app/design/adminhtml/default/default/template/connector/grid.phtml +16 -0
  214. app/design/adminhtml/default/default/template/connector/system/config/createdatafield.phtml +17 -0
  215. app/design/frontend/base/default/layout/connector.xml +5 -12
  216. app/design/frontend/base/default/template/connector/basket.phtml +1 -1
  217. app/design/frontend/base/default/template/connector/creditmemo/items.phtml +140 -0
  218. app/design/frontend/base/default/template/connector/creditmemo/new.phtml +77 -0
  219. app/design/frontend/base/default/template/connector/creditmemo/newguest.phtml +78 -0
  220. app/design/frontend/base/default/template/connector/creditmemo/update.phtml +31 -0
  221. app/design/frontend/base/default/template/connector/creditmemo/updateguest.phtml +31 -0
  222. app/design/frontend/base/default/template/connector/customer.phtml +30 -0
  223. app/design/frontend/base/default/template/connector/invoice/new.phtml +86 -0
  224. app/design/frontend/base/default/template/connector/invoice/newguest.phtml +79 -0
  225. app/design/frontend/base/default/template/connector/invoice/update.phtml +33 -0
  226. app/design/frontend/base/default/template/connector/invoice/updateguest.phtml +33 -0
  227. app/design/frontend/base/default/template/connector/order/items.phtml +138 -0
  228. app/design/frontend/base/default/template/connector/order/new.phtml +78 -0
  229. app/design/frontend/base/default/template/connector/order/newguest.phtml +80 -0
  230. app/design/frontend/base/default/template/connector/order/update.phtml +32 -0
  231. app/design/frontend/base/default/template/connector/order/updateguest.phtml +33 -0
  232. app/design/frontend/base/default/template/connector/product/list.phtml +32 -0
  233. app/design/frontend/base/default/template/connector/{price.phtml → product/price.phtml} +0 -0
  234. app/design/frontend/base/default/template/connector/roi_code.phtml +10 -16
  235. app/design/frontend/base/default/template/connector/shipping/new.phtml +78 -0
  236. app/design/frontend/base/default/template/connector/shipping/newguest.phtml +79 -0
  237. app/design/frontend/base/default/template/connector/shipping/update.phtml +32 -0
  238. app/design/frontend/base/default/template/connector/shipping/updateguest.phtml +32 -0
  239. app/design/frontend/base/default/template/connector/tracking_code.phtml +10 -2
  240. app/design/frontend/base/default/template/page/blank.phtml +14 -1
  241. app/design/frontend/base/default/template/page/connector/products.phtml +0 -37
  242. app/etc/modules/Dotdigitalgroup_Email.xml +1 -1
  243. app/locale/en_US/Dotdigitalgroup_Email.csv +146 -0
  244. package.xml +19 -5
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Campaign extends Mage_Adminhtml_Block_Widget_Grid_Container
4
+ {
5
+ public function __construct(){
6
+ $this->_controller = 'adminhtml_campaign';
7
+ $this->_blockGroup = 'email_connector';
8
+ parent::__construct();
9
+ $this->_headerText = Mage::helper('connector')->__('Campaigns');
10
+ $this->_removeButton('add');
11
+
12
+ $this->setTemplate('connector/grid.phtml');
13
+ }
14
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign/Edit.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Campaign_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct(){
6
+ parent::__construct();
7
+ $this->_blockGroup = 'email_connector';
8
+ $this->_controller = 'adminhtml_campaign';
9
+ $this->_mode = 'edit';
10
+ $this->_updateButton('save', 'label', Mage::helper('connector')->__('Save Campaign'));
11
+ $this->_updateButton('delete', 'label', Mage::helper('connector')->__('Delete Campaign'));
12
+ $this->_addButton('saveandcontinue', array(
13
+ 'label' => Mage::helper('connector')->__('Save And Continue Edit'),
14
+ 'onclick' => 'saveAndContinueEdit()',
15
+ 'class' => 'save',
16
+ ), -100);
17
+ $this->_formScripts[] = "
18
+ function saveAndContinueEdit(){
19
+ editForm.submit($('edit_form').action+'back/edit/');
20
+ }
21
+ ";
22
+ }
23
+ public function getHeaderText(){
24
+ if( Mage::registry('email_campaign') && Mage::registry('email_campaign')->getId() ) {
25
+ return Mage::helper('connector')->__("Edit Campaign '%s'", $this->htmlEscape(Mage::registry('email_campaign')->getContact()));
26
+ }else {
27
+ return Mage::helper('connector')->__('Add Contact');
28
+ }
29
+ }
30
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign/Edit/Form.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Campaign_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ /**
6
+ * Init class
7
+ */
8
+ public function __construct()
9
+ {
10
+ parent::__construct();
11
+
12
+ $this->setId('id');
13
+ $this->setTitle($this->__('Campaign Information'));
14
+ }
15
+
16
+ /**
17
+ * Setup form fields for inserts/updates
18
+ *
19
+ * return Mage_Adminhtml_Block_Widget_Form
20
+ */
21
+ protected function _prepareForm()
22
+ {
23
+ $model = Mage::registry('email_campaign');
24
+
25
+ $form = new Varien_Data_Form(array(
26
+ 'id' => 'edit_form',
27
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
28
+ 'method' => 'post'
29
+ ));
30
+
31
+ $fieldset = $form->addFieldset('base_fieldset', array(
32
+ 'legend' => Mage::helper('connector')->__('Campaign Information')
33
+ ));
34
+
35
+ if ($model->getId()) {
36
+ $fieldset->addField('id', 'hidden', array(
37
+ 'name' => 'id',
38
+ ));
39
+ }
40
+
41
+
42
+
43
+ $fieldset->addField('name', 'text', array(
44
+ 'name' => 'name',
45
+ 'label' => Mage::helper('connector')->__('Name'),
46
+ 'title' => Mage::helper('connector')->__('Name'),
47
+ 'required' => true,
48
+ ));
49
+
50
+ $form->setValues($model->getData());
51
+ $form->setUseContainer(true);
52
+ $this->setForm($form);
53
+
54
+ return parent::_prepareForm();
55
+ }
56
+
57
+
58
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign/Grid.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Campaign_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct(){
6
+ parent::__construct();
7
+ $this->setId('id');
8
+ $this->setDefaultSort('entity_id');
9
+ $this->setDefaultDir('ASC');
10
+ $this->setSaveParametersInSession(true);
11
+ $this->setUseAjax(true);
12
+ }
13
+
14
+ protected function _prepareCollection(){
15
+
16
+ $collection = Mage::getModel('email_connector/campaign')->getCollection();
17
+ $this->setCollection($collection);
18
+ $this->setDefaultSort('updated_at');
19
+ $this->setDefaultDir('DESC');
20
+ return parent::_prepareCollection();
21
+ }
22
+
23
+
24
+
25
+ protected function _prepareColumns(){
26
+ $this->addColumn('id', array(
27
+ 'header' => Mage::helper('connector')->__('Campaign ID'),
28
+ 'width' => '20px',
29
+ 'index' => 'id',
30
+ 'type' => 'number',
31
+ 'truncate' => 50,
32
+ 'escape' => true,
33
+ ));
34
+
35
+ $this->addColumn('email', array(
36
+ 'header' => Mage::helper('connector')->__('Email'),
37
+ 'align' => 'left',
38
+ 'width' => '50px',
39
+ 'index' => 'email',
40
+ 'type' => 'text',
41
+ 'escape' => true
42
+ ));
43
+ $this->addColumn('is_sent', array(
44
+ 'header' => Mage::helper('connector')->__('Is Sent'),
45
+ 'align' => 'center',
46
+ 'width' => '20px',
47
+ 'index' => 'is_sent',
48
+ 'type' => 'number',
49
+ 'escape' => true,
50
+ 'renderer' => 'email_connector/adminhtml_column_renderer_imported'
51
+ ));
52
+ $this->addColumn('order_increment_id', array(
53
+ 'header' => Mage::helper('connector')->__('Increment ID'),
54
+ 'align' => 'left',
55
+ 'width' => '50px',
56
+ 'index' => 'order_increment_id',
57
+ 'type' => 'number',
58
+ 'escape' => true
59
+ ));
60
+
61
+ $this->addColumn('message', array(
62
+ 'header' => Mage::helper('connector')->__('Message'),
63
+ 'align' => 'left',
64
+ 'width' => '300px',
65
+ 'index' => 'message',
66
+ 'type' => 'text',
67
+ 'escape' => true
68
+ ));
69
+ $this->addColumn('event_name', array(
70
+ 'header' => Mage::helper('connector')->__('Event Name'),
71
+ 'align' => 'left',
72
+ 'index' => 'event_name',
73
+ 'width' => '100px',
74
+ 'type' => 'string',
75
+ 'escape' => true,
76
+ ));
77
+ $this->addColumn('created_at', array(
78
+ 'header' => Mage::helper('connector')->__('Created At'),
79
+ 'align' => 'center',
80
+ 'width' => '100px',
81
+ 'index' => 'created_at',
82
+ 'type' => 'datetime',
83
+ 'escape' => true
84
+ ));
85
+ $this->addColumn('sent_at', array(
86
+ 'header' => Mage::helper('connector')->__('Sent At'),
87
+ 'align' => 'center',
88
+ 'width' => '100px',
89
+ 'index' => 'sent_at',
90
+ 'type' => 'datetime',
91
+ 'escape' => true
92
+ ));
93
+ if (!Mage::app()->isSingleStoreMode()) {
94
+ $this->addColumn('website_id', array(
95
+ 'header' => Mage::helper('customer')->__('Website'),
96
+ 'align' => 'center',
97
+ 'width' => '80px',
98
+ 'type' => 'options',
99
+ 'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true),
100
+ 'index' => 'website_id',
101
+ ));
102
+ }
103
+
104
+ $this->addExportType('*/*/exportCsv', Mage::helper('connector')->__('CSV'));
105
+ //$this->addExportType('*/*/exportExcel', Mage::helper('connector')->__('Excel'));
106
+ //$this->addExportType('*/*/exportXml', Mage::helper('connector')->__('XML'));
107
+ return parent::_prepareColumns();
108
+ }
109
+
110
+ protected function _getStore(){
111
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
112
+ return Mage::app()->getStore($storeId);
113
+ }
114
+
115
+
116
+ protected function _prepareMassaction(){
117
+ $this->setMassactionIdField('id');
118
+ $this->getMassactionBlock()->setFormFieldName('campaign');
119
+ $this->getMassactionBlock()->addItem('delete', array(
120
+ 'label'=> Mage::helper('connector')->__('Delete'),
121
+ 'url' => $this->getUrl('*/*/massDelete'),
122
+ 'confirm' => Mage::helper('connector')->__('Are you sure?')
123
+ ));
124
+ $this->getMassactionBlock()->addItem('run', array('label'=>Mage::helper('connector')->__('Resend'),
125
+ 'url'=>$this->getUrl('*/*/massResend')));
126
+ return $this;
127
+ }
128
+
129
+
130
+ public function getRowUrl($row){
131
+ //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
132
+ }
133
+
134
+
135
+ public function getGridUrl(){
136
+ return $this->getUrl('*/*/grid', array('_current'=>true));
137
+ }
138
+
139
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Column/Renderer/Imported.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Column_Renderer_Imported extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row){
6
+ return '<img style="padding-top:2px" '.(($this->_getValue($row)=='1' || $this->_getValue($row)==true) ? 'src="'.$this->getSkinUrl('images/success_msg_icon.gif').'" alt="YES" ' : 'src="'.
7
+ $this->getSkinUrl('images/error_msg_icon.gif').'" alt="NO" ').'>';
8
+ }
9
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Column/Renderer/Status.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Column_Renderer_Status extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row){
6
+
7
+ if($this->getValue($row) == '1')
8
+ return 'Subscribed';
9
+ return 'Unsubscribed';
10
+ }
11
+
12
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Config/Customdatafields.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Config_Customdatafields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ /**
6
+ * Customer attribute
7
+ *
8
+ */
9
+ protected $_getAttributeRenderer;
10
+
11
+ /**
12
+ * Datafields
13
+ */
14
+ protected $_getDatafieldRenderer;
15
+
16
+
17
+ public function __construct()
18
+ {
19
+ $this->_addAfter = false;
20
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add New Attribute');
21
+ parent::__construct();
22
+
23
+ }
24
+
25
+ public function _prepareToRender()
26
+ {
27
+ $this->_getDatafieldRenderer = null;
28
+ $this->_getAttributeRenderer = null;
29
+ $this->addColumn('attribute', array('label' => Mage::helper('adminhtml')->__('Attribute'),
30
+ 'style' => 'width:120px',
31
+ ));
32
+ $this->addColumn('datafield', array('label' => Mage::helper('adminhtml')->__('DataField'),
33
+ 'style' => 'width:120px',
34
+ ));
35
+ }
36
+
37
+ protected function _renderCellTemplate($columnName)
38
+ {
39
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
40
+ if ($columnName=="attribute") {
41
+ return $this->_getAttributeRenderer()
42
+ ->setName($inputName)
43
+ ->setTitle($columnName)
44
+ ->setExtraParams('style="width:160px"')
45
+ ->setOptions(
46
+ $this->getElement()->getValues())
47
+
48
+ ->toHtml();
49
+ } else if($columnName == "datafield") {
50
+ return $this->_getDatafieldRenderer()
51
+ ->setName($inputName)
52
+ ->setTitle($columnName)
53
+ ->setExtraParams('style="width:160px"')
54
+ ->setOptions(
55
+ // The source model defined in system config XML!
56
+ Mage::getModel('email_connector/adminhtml_source_datafields')->toOptionArray()
57
+ )
58
+ ->toHtml();
59
+ }
60
+ return parent::_renderCellTemplate($columnName);
61
+ }
62
+
63
+ /**
64
+ * Assign extra parameters to row
65
+ *
66
+ * @param Varien_Object $row
67
+ */
68
+ protected function _prepareArrayRow(Varien_Object $row)
69
+ {
70
+
71
+ $row->setData(
72
+ 'option_extra_attr_' . $this->_getAttributeRenderer()->calcOptionHash($row->getData('attribute')),
73
+ 'selected="selected"'
74
+ );
75
+
76
+ $row->setData(
77
+ 'option_extra_attr_' . $this->_getDatafieldRenderer()->calcOptionHash($row->getData('datafield')),
78
+ 'selected="selected"'
79
+ );
80
+ }
81
+ protected function _getAttributeRenderer()
82
+ {
83
+ if (!$this->_getAttributeRenderer) {
84
+ $this->_getAttributeRenderer = $this->getLayout()
85
+ ->createBlock('email_connector/adminhtml_config_select')
86
+ ->setIsRenderToJsTemplate(true);
87
+ }
88
+ return $this->_getAttributeRenderer;
89
+ }
90
+
91
+ protected function _getDatafieldRenderer()
92
+ {
93
+ if (!$this->_getDatafieldRenderer) {
94
+ $this->_getDatafieldRenderer = $this->getLayout()
95
+ ->createBlock('email_connector/adminhtml_config_select')
96
+ ->setIsRenderToJsTemplate(true);
97
+ }
98
+ return $this->_getDatafieldRenderer;
99
+ }
100
+
101
+ public function _toHtml(){
102
+ return '<input type="hidden" id="'.$this->getElement()->getHtmlId().'"/>'.parent::_toHtml();
103
+
104
+ }
105
+
106
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Config/Select.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Config_Select extends Mage_Core_Block_Html_Select
4
+ {
5
+ /**
6
+ * Return output in one line
7
+ *
8
+ * @return string
9
+ */
10
+ public function _toHtml()
11
+ {
12
+ return trim(preg_replace('/\s+/', ' ',parent::_toHtml()));
13
+ }
14
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Contact extends Mage_Adminhtml_Block_Widget_Grid_Container
4
+ {
5
+ public function __construct(){
6
+ $this->_controller = 'adminhtml_contact';
7
+ $this->_blockGroup = 'email_connector';
8
+ parent::__construct();
9
+ $this->_headerText = Mage::helper('connector')->__('Contacts');
10
+ $this->_removeButton('add');
11
+
12
+ $this->setTemplate('connector/grid.phtml');
13
+ }
14
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact/Edit.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Contact_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct(){
6
+ parent::__construct();
7
+ $this->_blockGroup = 'email_connector';
8
+ $this->_controller = 'adminhtml_contact';
9
+ $this->_updateButton('save', 'label', Mage::helper('connector')->__('Save Contact'));
10
+ $this->_updateButton('delete', 'label', Mage::helper('connector')->__('Delete Contact'));
11
+ $this->_addButton('saveandcontinue', array(
12
+ 'label' => Mage::helper('connector')->__('Save And Continue Edit'),
13
+ 'onclick' => 'saveAndContinueEdit()',
14
+ 'class' => 'save',
15
+ ), -100);
16
+ $this->_formScripts[] = "
17
+ function saveAndContinueEdit(){
18
+ editForm.submit($('edit_form').action+'back/edit/');
19
+ }
20
+ ";
21
+ }
22
+ public function getHeaderText(){
23
+ if( Mage::registry('contact_data') && Mage::registry('contact_data')->getId() ) {
24
+ return Mage::helper('connnector')->__("Edit Contact '%s'", $this->htmlEscape(Mage::registry('contact_data')->getContact()));
25
+ }else {
26
+ return Mage::helper('connector')->__('Add Contact');
27
+ }
28
+ }
29
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact/Edit/Form.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Contact_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+
6
+ protected function _prepareForm() {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'), 'store' => $this->getRequest()->getParam('store'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+ $form->setUseContainer(true);
15
+ $this->setForm($form);
16
+ return parent::_prepareForm();
17
+ }
18
+
19
+ /**
20
+ * Init class
21
+ */
22
+ // public function __construct()
23
+ // {
24
+ // parent::__construct();
25
+ //
26
+ // $this->setId('email_contact_id');
27
+ // $this->setTitle($this->__('Contact Information'));
28
+ // }
29
+
30
+ /**
31
+ * Setup form fields for inserts/updates
32
+ *
33
+ * return Mage_Adminhtml_Block_Widget_Form
34
+ */
35
+ // protected function _prepareForm()
36
+ // {
37
+ // $model = Mage::registry('email_contact');
38
+ //
39
+ // $form = new Varien_Data_Form(array(
40
+ // 'id' => 'edit_form',
41
+ // 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
42
+ // 'method' => 'post'
43
+ // ));
44
+ //
45
+ // $fieldset = $form->addFieldset('base_fieldset', array(
46
+ // 'legend' => Mage::helper('checkout')->__('Contact Information'),
47
+ // 'class' => 'fieldset-wide',
48
+ // ));
49
+ //
50
+ // if ($model->getId()) {
51
+ // $fieldset->addField('id', 'hidden', array(
52
+ // 'name' => 'id',
53
+ // ));
54
+ // }
55
+ //
56
+ // $fieldset->addField('name', 'text', array(
57
+ // 'name' => 'name',
58
+ // 'label' => Mage::helper('checkout')->__('Name'),
59
+ // 'title' => Mage::helper('checkout')->__('Name'),
60
+ // 'required' => true,
61
+ // ));
62
+ //
63
+ // $form->setValues($model->getData());
64
+ // $form->setUseContainer(true);
65
+ // $this->setForm($form);
66
+ //
67
+ // return parent::_prepareForm();
68
+ // }
69
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact/Grid.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Contact_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+
7
+ public function __construct(){
8
+ parent::__construct();
9
+ $this->setId('email_contact_id');
10
+ $this->setDefaultSort('entity_id');
11
+ $this->setDefaultDir('ASC');
12
+ $this->setSaveParametersInSession(true);
13
+ $this->setUseAjax(true);
14
+ }
15
+
16
+ protected function _prepareCollection(){
17
+
18
+ $collection = Mage::getModel('email_connector/contact')->getCollection();
19
+ $this->setCollection($collection);
20
+ $this->setDefaultSort('updated_at');
21
+ $this->setDefaultDir('DESC');
22
+ return parent::_prepareCollection();
23
+ }
24
+
25
+
26
+
27
+ protected function _prepareColumns(){
28
+
29
+ $this->addColumn('email_contact_id', array(
30
+ 'header' => Mage::helper('connector')->__('Email Contact ID'),
31
+ 'width' => '20px',
32
+ 'index' => 'email_contact_id',
33
+ 'type' => 'number',
34
+ 'escape' => true,
35
+ ));
36
+
37
+ $this->addColumn('email', array(
38
+ 'header' => Mage::helper('connector')->__('Email'),
39
+ 'align' => 'left',
40
+ 'width' => '50px',
41
+ 'index' => 'email',
42
+ 'type' => 'text',
43
+ 'escape' => true
44
+ ));
45
+ $this->addColumn('is_guest', array(
46
+ 'header' => Mage::helper('connector')->__('Is Guest'),
47
+ 'align' => 'right',
48
+ 'width' => '50px',
49
+ 'index' => 'is_guest',
50
+ 'type' => 'string',
51
+ 'escape' => true,
52
+ ));
53
+
54
+ $this->addColumn('customer_id', array(
55
+ 'header' => Mage::helper('connector')->__('Customer ID'),
56
+ 'align' => 'left',
57
+ 'width' => '20px',
58
+ 'index' => 'customer_id',
59
+ 'type' => 'number',
60
+ 'escape' => true
61
+ ));
62
+ $this->addColumn('is_subscrier', array(
63
+ 'header' => Mage::helper('connector')->__('Is Subscriber'),
64
+ 'width' => '50px',
65
+ 'align' => 'right',
66
+ 'index' => 'is_subscriber',
67
+ 'type' => 'string',
68
+ 'escape' => true,
69
+ ));
70
+
71
+ $this->addColumn('subscribe_status', array(
72
+ 'header' => Mage::helper('connector')->__('Subscriber Status'),
73
+ 'align' => 'center',
74
+ 'width' => '50px',
75
+ 'index' => 'subscriber_status',
76
+ 'type' => 'string',
77
+ 'escape' => true,
78
+ 'renderer' => 'email_connector/adminhtml_column_renderer_status'
79
+
80
+ ));
81
+ $this->addColumn('email_imported', array(
82
+ 'header' => Mage::helper('connector')->__('Email Imported'),
83
+ 'width' => '20px',
84
+ 'align' => 'center',
85
+ 'index' => 'email_imported',
86
+ 'type' => 'string',
87
+ 'escape' => true,
88
+ 'renderer' => 'email_connector/adminhtml_column_renderer_imported'
89
+ ));
90
+
91
+ $this->addColumn('subscriber_imported', array(
92
+ 'header' => Mage::helper('connector')->__('Subscriber Imported'),
93
+ 'width' => '20px',
94
+ 'align' => 'center',
95
+ 'index' => 'subscriber_imported',
96
+ 'type' => 'string',
97
+ 'escape' => true,
98
+ 'renderer' => 'email_connector/adminhtml_column_renderer_imported'
99
+ ));
100
+ $this->addColumn('suppressed', array(
101
+ 'header' => Mage::helper('connector')->__('Suppressed'),
102
+ 'align' => 'right',
103
+ 'width' => '50px',
104
+ 'index' => 'suppressed',
105
+ 'type' => 'string',
106
+ 'escape' => true
107
+ ));
108
+ if (!Mage::app()->isSingleStoreMode()) {
109
+ $this->addColumn('website_id', array(
110
+ 'header' => Mage::helper('customer')->__('Website'),
111
+ 'align' => 'center',
112
+ 'width' => '80px',
113
+ 'type' => 'options',
114
+ 'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true),
115
+ 'index' => 'website_id',
116
+ ));
117
+ }
118
+
119
+ $this->addExportType('*/*/exportCsv', Mage::helper('connector')->__('CSV'));
120
+ //$this->addExportType('*/*/exportExcel', Mage::helper('connector')->__('Excel'));
121
+ //$this->addExportType('*/*/exportXml', Mage::helper('connector')->__('XML'));
122
+ return parent::_prepareColumns();
123
+ }
124
+
125
+ protected function _getStore(){
126
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
127
+ return Mage::app()->getStore($storeId);
128
+ }
129
+
130
+
131
+ protected function _prepareMassaction(){
132
+ $this->setMassactionIdField('email_contact_id');
133
+ $this->getMassactionBlock()->setFormFieldName('contact');
134
+ $this->getMassactionBlock()->addItem('delete', array(
135
+ 'label'=> Mage::helper('connector')->__('Delete'),
136
+ 'url' => $this->getUrl('*/*/massDelete'),
137
+ 'confirm' => Mage::helper('connector')->__('Are you sure?')
138
+ ));
139
+ return $this;
140
+ }
141
+
142
+
143
+ public function getRowUrl($row){
144
+ //return $this->getUrl('*/*/edit', array('id' => $row->getEmailContactId()));
145
+ }
146
+
147
+ public function getGridUrl(){
148
+ return $this->getUrl('*/*/grid', array('_current'=>true));
149
+ }
150
+
151
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Dashboard.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Dashboard extends Mage_Adminhtml_Block_Dashboard_Bar
4
+
5
+ {
6
+ public function __construct()
7
+ {
8
+ parent::_construct();
9
+
10
+ $this->setTemplate('connector/dashboard/accountbar.phtml');
11
+ }
12
+
13
+ protected function _prepareLayout()
14
+ {
15
+ $website = 0;
16
+ if ($store = $this->getRequest()->getParam('store')) {
17
+ $website = Mage::app()->getStore($store)->getWebsite();
18
+ }elseif($this->getRequest()->getParam('website')){
19
+ $website = $this->getRequest()->getParam('website');
20
+ }
21
+ $apiUsername = Mage::helper('connector')->getApiUsername($website);
22
+ $apiPassword = Mage::helper('connector')->getApiPassword($website);
23
+ $data = Mage::getModel('email_connector/apiconnector_client')
24
+ ->setApiUsername($apiUsername)
25
+ ->setApiPassword($apiPassword)
26
+ ->getAccountInfo();
27
+ foreach ($data->properties as $one) {
28
+ $this->addTotal($this->__($one->name), $one->value, true);
29
+ }
30
+
31
+ }
32
+
33
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Dashboard/Content.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Dashboard_Content extends Mage_Adminhtml_Block_Widget_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_headerText = Mage::helper('connector')->__('Account Managment.');
9
+
10
+ }
11
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Order.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Widget_Grid_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+
8
+ parent::__construct();
9
+
10
+ $this->_blockGroup = 'email_connector';
11
+ $this->_controller = 'adminhtml_order';
12
+ $this->_headerText = Mage::helper('connector')->__('Email Order(s)');
13
+
14
+
15
+ $this->_removeButton('add');
16
+ }
17
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Order/Grid.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ // Set some defaults for our grid
10
+ $this->setDefaultSort('email_order_id');
11
+ $this->setId('email_order_id');
12
+ $this->setDefaultDir('asc');
13
+ }
14
+
15
+ protected function _getCollectionClass(){
16
+ // This is the model we are using for the grid
17
+ return 'email_connector/order_collection';
18
+ }
19
+
20
+ protected function _prepareCollection(){
21
+ // Get and set our collection for the grid
22
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
23
+ $this->setCollection($collection);
24
+ return parent::_prepareCollection();
25
+ }
26
+
27
+
28
+ protected function _prepareColumns(){
29
+
30
+ $this->addColumn('order_id', array(
31
+ 'header' => Mage::helper('connector')->__('Order ID'),
32
+ 'align' => 'left',
33
+ 'width' => '50px',
34
+ 'index' => 'order_id',
35
+ 'type' => 'number',
36
+ 'escape' => true
37
+ ));
38
+ $this->addColumn('store_id', array(
39
+ 'header' => Mage::helper('connector')->__('Store ID'),
40
+ 'width' => '50px',
41
+ 'index' => 'store_id',
42
+ 'type' => 'number',
43
+ 'escape' => true,
44
+ ));
45
+
46
+ $this->addColumn('email_imported', array(
47
+ 'header' => Mage::helper('connector')->__('Email Imported'),
48
+ 'align' => 'center',
49
+ 'width' => '50px',
50
+ 'index' => 'email_imported',
51
+ 'type' => 'string',
52
+ 'escape' => true,
53
+ 'renderer' => 'email_connector/adminhtml_column_renderer_imported'
54
+ ));
55
+
56
+ $this->addColumn('updated_at', array(
57
+ 'header' => Mage::helper('connector')->__('Updated At'),
58
+ 'width' => '50px',
59
+ 'align' => 'center',
60
+ 'index' => 'updated_at',
61
+ 'type' => 'datetime',
62
+ 'escape' => true,
63
+ ));
64
+
65
+
66
+
67
+ return parent::_prepareColumns();
68
+ }
69
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Sales/Order/Creditmemo/View.php ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_Sales_Order_Creditmemo_View extends Mage_Adminhtml_Block_Widget_Form_Container
3
+ {
4
+
5
+ /**
6
+ * Add & remove control buttons
7
+ *
8
+ */
9
+ public function __construct()
10
+ {
11
+ $this->_objectId = 'creditmemo_id';
12
+ $this->_controller = 'sales_order_creditmemo';
13
+ $this->_mode = 'view';
14
+
15
+ parent::__construct();
16
+
17
+ $this->_removeButton('save');
18
+ $this->_removeButton('reset');
19
+ $this->_removeButton('delete');
20
+
21
+ if ($this->getCreditmemo()->canCancel()) {
22
+ $this->_addButton('cancel', array(
23
+ 'label' => Mage::helper('sales')->__('Cancel'),
24
+ 'class' => 'delete',
25
+ 'onclick' => 'setLocation(\''.$this->getCancelUrl().'\')'
26
+ )
27
+ );
28
+ }
29
+
30
+ if ($this->_isAllowedAction('emails')) {
31
+ $this->addButton('send_notification', array(
32
+ 'label' => Mage::helper('sales')->__('Send Email'),
33
+ 'onclick' => 'confirmSetLocation(\''
34
+ . Mage::helper('sales')->__('Are you sure you want to send Creditmemo email to customer?')
35
+ . '\', \'' . $this->getEmailUrl() . '\')'
36
+ ));
37
+ }
38
+
39
+ if ($this->getCreditmemo()->canRefund()) {
40
+ $this->_addButton('refund', array(
41
+ 'label' => Mage::helper('sales')->__('Refund'),
42
+ 'class' => 'save',
43
+ 'onclick' => 'setLocation(\''.$this->getRefundUrl().'\')'
44
+ )
45
+ );
46
+ }
47
+
48
+ if ($this->getCreditmemo()->canVoid()) {
49
+ $this->_addButton('void', array(
50
+ 'label' => Mage::helper('sales')->__('Void'),
51
+ 'class' => 'save',
52
+ 'onclick' => 'setLocation(\''.$this->getVoidUrl().'\')'
53
+ )
54
+ );
55
+ }
56
+
57
+ if ($this->getCreditmemo()->getId()) {
58
+ $this->_addButton('print', array(
59
+ 'label' => Mage::helper('sales')->__('Print'),
60
+ 'class' => 'save',
61
+ 'onclick' => 'setLocation(\''.$this->getPrintUrl().'\')'
62
+ )
63
+ );
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Retrieve creditmemo model instance
69
+ *
70
+ * @return Mage_Sales_Model_Order_Creditmemo
71
+ */
72
+ public function getCreditmemo()
73
+ {
74
+ return Mage::registry('current_creditmemo');
75
+ }
76
+
77
+ /**
78
+ * Retrieve text for header
79
+ *
80
+ * @return string
81
+ */
82
+ public function getHeaderText()
83
+ {
84
+ if ($this->getCreditmemo()->getEmailSent()) {
85
+ $emailSent = Mage::helper('sales')->__('the credit memo email was sent');
86
+ }
87
+ else {
88
+ $emailSent = Mage::helper('sales')->__('the credit memo email is not sent');
89
+ }
90
+ return Mage::helper('sales')->__('Credit Memo #%1$s | %3$s | %2$s (%4$s)', $this->getCreditmemo()->getIncrementId(), $this->formatDate($this->getCreditmemo()->getCreatedAtDate(), 'medium', true), $this->getCreditmemo()->getStateName(), $emailSent);
91
+ }
92
+
93
+ /**
94
+ * Retrieve back url
95
+ *
96
+ * @return string
97
+ */
98
+ public function getBackUrl()
99
+ {
100
+ return $this->getUrl(
101
+ '*/sales_order/view',
102
+ array(
103
+ 'order_id' => $this->getCreditmemo()->getOrderId(),
104
+ 'active_tab'=> 'order_creditmemos'
105
+ ));
106
+ }
107
+
108
+ /**
109
+ * Retrieve capture url
110
+ *
111
+ * @return string
112
+ */
113
+ public function getCaptureUrl()
114
+ {
115
+ return $this->getUrl('*/*/capture', array('creditmemo_id'=>$this->getCreditmemo()->getId()));
116
+ }
117
+
118
+ /**
119
+ * Retrieve void url
120
+ *
121
+ * @return string
122
+ */
123
+ public function getVoidUrl()
124
+ {
125
+ return $this->getUrl('*/*/void', array('creditmemo_id'=>$this->getCreditmemo()->getId()));
126
+ }
127
+
128
+ /**
129
+ * Retrieve cancel url
130
+ *
131
+ * @return string
132
+ */
133
+ public function getCancelUrl()
134
+ {
135
+ return $this->getUrl('*/*/cancel', array('creditmemo_id'=>$this->getCreditmemo()->getId()));
136
+ }
137
+
138
+ /**
139
+ * Retrieve email url
140
+ *
141
+ * @return string
142
+ */
143
+ public function getEmailUrl()
144
+ {
145
+ return $this->getUrl('*/*/email', array(
146
+ 'creditmemo_id' => $this->getCreditmemo()->getId(),
147
+ 'order_id' => $this->getCreditmemo()->getOrderId()
148
+ ));
149
+ }
150
+
151
+ /**
152
+ * Retrieve print url
153
+ *
154
+ * @return string
155
+ */
156
+ public function getPrintUrl()
157
+ {
158
+ return $this->getUrl('*/*/print', array(
159
+ 'creditmemo_id' => $this->getCreditmemo()->getId()
160
+ ));
161
+ }
162
+
163
+ /**
164
+ * Update 'back' button url
165
+ *
166
+ * @return Mage_Adminhtml_Block_Widget_Container | Mage_Adminhtml_Block_Sales_Order_Creditmemo_View
167
+ */
168
+ public function updateBackButtonUrl($flag)
169
+ {
170
+ if ($flag) {
171
+ if ($this->getCreditmemo()->getBackUrl()) {
172
+ return $this->_updateButton(
173
+ 'back',
174
+ 'onclick',
175
+ 'setLocation(\'' . $this->getCreditmemo()->getBackUrl() . '\')'
176
+ );
177
+ }
178
+
179
+ return $this->_updateButton(
180
+ 'back',
181
+ 'onclick',
182
+ 'setLocation(\'' . $this->getUrl('*/sales_creditmemo/') . '\')'
183
+ );
184
+ }
185
+ return $this;
186
+ }
187
+
188
+ /**
189
+ * Check whether action is allowed
190
+ *
191
+ * @param string $action
192
+ * @return bool
193
+ */
194
+ public function _isAllowedAction($action)
195
+ {
196
+ return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/' . $action);
197
+ }
198
+ }
app/code/{local/Dotdigitalgroup/Email/Block/Debug/Initialsync.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Deletecontactids.php} RENAMED
@@ -1,14 +1,15 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Block_Debug_Initialsync extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
 
5
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
6
  $this->setElement($element);
7
- return $this->_getAddRowButtonHtml($this->__('Run Initialisation Synchronization'));
8
  }
9
 
10
  protected function _getAddRowButtonHtml($title) {
11
- $url = Mage::helper('adminhtml')->getUrl("connector/debug/initialSync");
12
 
13
  return $this->getLayout()->createBlock('adminhtml/widget_button')
14
  ->setType('button')
@@ -16,5 +17,4 @@ class Dotdigitalgroup_Email_Block_Debug_Initialsync extends Mage_Adminhtml_Block
16
  ->setOnClick("window.location.href='" . $url . "'")
17
  ->toHtml();
18
  }
19
-
20
- }
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Advanced_Deletecontactids extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
+
6
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
  $this->setElement($element);
8
+ return $this->_getAddRowButtonHtml($this->__("Run Now"));
9
  }
10
 
11
  protected function _getAddRowButtonHtml($title) {
12
+ $url = Mage::helper('adminhtml')->getUrl("*/connector/deletecontactids");
13
 
14
  return $this->getLayout()->createBlock('adminhtml/widget_button')
15
  ->setType('button')
17
  ->setOnClick("window.location.href='" . $url . "'")
18
  ->toHtml();
19
  }
20
+ }
 
app/code/{local/Dotdigitalgroup/Email/Block/Debug/Countcontacts.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Reimportorders.php} RENAMED
@@ -1,15 +1,14 @@
1
  <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Debug_Countcontacts extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
 
6
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
  $this->setElement($element);
8
- return $this->_getAddRowButtonHtml($this->__('Check Customers Now'));
9
  }
10
 
11
  protected function _getAddRowButtonHtml($title) {
12
- $url = Mage::helper('adminhtml')->getUrl("connector/debug/countcontacts");
13
 
14
  return $this->getLayout()->createBlock('adminhtml/widget_button')
15
  ->setType('button')
1
  <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Advanced_Reimportorders extends Mage_Adminhtml_Block_System_Config_Form_Field
 
3
  {
4
 
5
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
6
  $this->setElement($element);
7
+ return $this->_getAddRowButtonHtml($this->__("Run Now"));
8
  }
9
 
10
  protected function _getAddRowButtonHtml($title) {
11
+ $url = $this->getUrl("*/connector/resetorders");
12
 
13
  return $this->getLayout()->createBlock('adminhtml/widget_button')
14
  ->setType('button')
app/code/{local/Dotdigitalgroup/Email/Block/Debug/Deletecontacts.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Reimportsubscribers.php} RENAMED
@@ -1,15 +1,14 @@
1
  <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Debug_Deletecontacts extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
 
6
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
  $this->setElement($element);
8
- return $this->_getAddRowButtonHtml($this->__("Delete ID's Now"));
9
  }
10
 
11
  protected function _getAddRowButtonHtml($title) {
12
- $url = Mage::helper('adminhtml')->getUrl("connector/debug/deletecontactsid");
13
 
14
  return $this->getLayout()->createBlock('adminhtml/widget_button')
15
  ->setType('button')
1
  <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Advanced_Reimportsubscribers extends Mage_Adminhtml_Block_System_Config_Form_Field
 
3
  {
4
 
5
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
6
  $this->setElement($element);
7
+ return $this->_getAddRowButtonHtml($this->__("Run Now"));
8
  }
9
 
10
  protected function _getAddRowButtonHtml($title) {
11
+ $url = $this->getUrl("*/connector/reimoprtsubscribers");
12
 
13
  return $this->getLayout()->createBlock('adminhtml/widget_button')
14
  ->setType('button')
app/code/{local/Dotdigitalgroup/Email/Block/Debug/Transactionalsync.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Setupdatafields.php} RENAMED
@@ -1,14 +1,15 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Block_Debug_Transactionalsync extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
 
5
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
6
  $this->setElement($element);
7
- return $this->_getAddRowButtonHtml($this->__('Run Baskets/Orders Synchronization'));
8
  }
9
 
10
  protected function _getAddRowButtonHtml($title) {
11
- $url = Mage::helper('adminhtml')->getUrl("connector/debug/transactionalSync");
12
 
13
  return $this->getLayout()->createBlock('adminhtml/widget_button')
14
  ->setType('button')
@@ -17,4 +18,4 @@ class Dotdigitalgroup_Email_Block_Debug_Transactionalsync extends Mage_Adminhtml
17
  ->toHtml();
18
  }
19
 
20
- }
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Advanced_Setupdatafields extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
+
6
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
  $this->setElement($element);
8
+ return $this->_getAddRowButtonHtml($this->__("Run Now"));
9
  }
10
 
11
  protected function _getAddRowButtonHtml($title) {
12
+ $url = $this->getUrl("*/connector/setupdatafields");
13
 
14
  return $this->getLayout()->createBlock('adminhtml/widget_button')
15
  ->setType('button')
18
  ->toHtml();
19
  }
20
 
21
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Suppressedcontacts.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Advanced_Suppressedcontacts extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
+ $this->setElement($element);
8
+ return $this->_getAddRowButtonHtml($this->__('Run Now'));
9
+ }
10
+
11
+ protected function _getAddRowButtonHtml($title) {
12
+ $url = $this->getUrl("*/connector/suppresscontacts");
13
+
14
+ return $this->getLayout()->createBlock('adminhtml/widget_button')
15
+ ->setType('button')
16
+ ->setLabel($this->__($title))
17
+ ->setOnClick("window.location.href='" . $url . "'")
18
+ ->toHtml();
19
+ }
20
+
21
+ }
app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Password.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Ajaxvalidate.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Password extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
  public function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
6
 
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Ajaxvalidate extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
  public function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
6
 
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Addressbook.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Addressbook extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $url = Mage::helper('adminhtml')->getUrl('*/connector/createnewaddressbook');
9
+ $website = Mage::app()->getRequest()->getParam('website', 0);
10
+
11
+ $element->setData('after_element_html',
12
+ "<script>
13
+ function createAddressbook(form, element) {
14
+ var name = $('connector_sync_settings_dynamic_addressbook_addressbook_name').value;
15
+ var reloadurl = '{$url}';
16
+ if(name){
17
+ new Ajax.Request(reloadurl, {
18
+ method: 'post',
19
+ parameters: {'name' : name, 'website': '$website'},
20
+ onComplete: function(transport) {
21
+ window.location.reload();
22
+ }
23
+ });
24
+ }
25
+ return false;
26
+ }
27
+ </script>"
28
+ );
29
+
30
+ return parent::_getElementHtml($element);
31
+ }
32
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Datafield.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Datafield extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $url = Mage::helper('adminhtml')->getUrl('*/connector/createnewdatafield');
9
+ $website = Mage::app()->getRequest()->getParam('website', 0);
10
+
11
+ $element->setData('after_element_html',
12
+ "<script>
13
+ function createDatafield(form, element) {
14
+ var datafield_name = $('connector_data_mapping_dynamic_datafield_datafield_name').value;
15
+ var datafield_type = $('connector_data_mapping_dynamic_datafield_datafield_type').value;
16
+ var reloadurl = '{$url}';
17
+
18
+ if(datafield_name && datafield_type){
19
+ new Ajax.Request(reloadurl, {
20
+ method: 'post',
21
+ parameters: {'name' : datafield_name, 'type' : datafield_type, 'website': '$website'},
22
+ onComplete: function(transport) {
23
+ window.location.reload();
24
+ }
25
+ });
26
+ }
27
+ return false;
28
+ }
29
+ </script>"
30
+ );
31
+
32
+ return parent::_getElementHtml($element);
33
+ }
34
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Validator.php RENAMED
@@ -16,8 +16,8 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Validator extends Mage
16
 
17
  $html .=$jquery;
18
 
19
- $javaScript = "
20
- <script type=\"text/javascript\">
21
 
22
  jQuery.noConflict();
23
 
@@ -25,10 +25,11 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Validator extends Mage
25
  // Handler for .ready() called.
26
 
27
  // Hide our validation block
28
- jQuery('#row_connector_data_field_settings_customer_data_validator').hide();
29
 
30
  // Add listener for changing select box
31
- jQuery('#connector_data_field_settings_customer_data select').on('change', function() {
 
32
 
33
  var currentSelection = jQuery(this).val();
34
  var currentDropdownId = jQuery(this).attr('id');
@@ -54,16 +55,10 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Validator extends Mage
54
  break;
55
  break;
56
  }
57
-
58
  }
59
-
60
  });
61
-
62
  });
63
-
64
  });
65
-
66
-
67
  </script>";
68
 
69
  $html .= $javaScript;
16
 
17
  $html .=$jquery;
18
 
19
+ $javaScript =
20
+ "<script type=\"text/javascript\">
21
 
22
  jQuery.noConflict();
23
 
25
  // Handler for .ready() called.
26
 
27
  // Hide our validation block
28
+ jQuery('#row_connector_data_mapping_customer_data_validator').hide();
29
 
30
  // Add listener for changing select box
31
+
32
+ jQuery('#connector_data_mapping_customer_data select').on('change', function() {
33
 
34
  var currentSelection = jQuery(this).val();
35
  var currentDropdownId = jQuery(this).attr('id');
55
  break;
56
  break;
57
  }
 
58
  }
 
59
  });
 
60
  });
 
61
  });
 
 
62
  </script>";
63
 
64
  $html .= $javaScript;
app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Waitingfield.php RENAMED
@@ -2,12 +2,20 @@
2
 
3
  class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Waitingfield extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
 
 
 
 
 
 
 
5
 
6
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
  {
8
  // Get the default HTML for this option
9
  $html = parent::_getElementHtml($element);
10
 
 
11
  $html .= sprintf('<div id="loadingmask" style="position: fixed;">
12
  <div class="loader" id="loading-mask-loader">
13
  <img src="%sskin/adminhtml/default/default/images/ajax-loader-tr.gif" alt="%s"/>%s', preg_replace('/index.php\//', '', $this->getBaseUrl()), $this->__('Loading...'), $this->__('Loading...'))
@@ -15,20 +23,20 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Waitingfield extends M
15
 
16
  $jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
17
 
18
- $jQuery .='
19
- <script type="text/javascript">
20
  jQuery.noConflict();
21
  jQuery(document).ready(function() {
22
  //hide the load image field
23
- jQuery("#row_connector_api_settings_api_credentials_validator .scope-label").hide();
 
24
  var loadingmask = jQuery("#loadingmask");
25
  loadingmask.hide();
26
  loadingmask.css({top : "50\%", left: "50\%"})
27
-
28
  jQuery("button").click(function(){
29
-
30
  jQuery("body").css({"background-color": "black", "opacity": "0.4"});
31
-
 
32
  loadingmask.show();
33
  loadingmask.css({"display": "block", "opacity" : "1"});
34
  })
2
 
3
  class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Waitingfield extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
+ public function render(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+
8
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
9
+ return parent::render($element);
10
+
11
+ }
12
 
13
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
14
  {
15
  // Get the default HTML for this option
16
  $html = parent::_getElementHtml($element);
17
 
18
+
19
  $html .= sprintf('<div id="loadingmask" style="position: fixed;">
20
  <div class="loader" id="loading-mask-loader">
21
  <img src="%sskin/adminhtml/default/default/images/ajax-loader-tr.gif" alt="%s"/>%s', preg_replace('/index.php\//', '', $this->getBaseUrl()), $this->__('Loading...'), $this->__('Loading...'))
23
 
24
  $jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
25
 
26
+ $jQuery .=
27
+ '<script type="text/javascript">
28
  jQuery.noConflict();
29
  jQuery(document).ready(function() {
30
  //hide the load image field
31
+ jQuery("#row_connector_api_credentials_api_credentials_validator").hide();
32
+ jQuery("#row_connector_sync_settings_sync_customer_schedule_validator").hide();
33
  var loadingmask = jQuery("#loadingmask");
34
  loadingmask.hide();
35
  loadingmask.css({top : "50\%", left: "50\%"})
 
36
  jQuery("button").click(function(){
 
37
  jQuery("body").css({"background-color": "black", "opacity": "0.4"});
38
+ jQuery("#row_connector_api_settings_api_credentials_validator").show();
39
+ jQuery("#row_connector_sync_settings_sync_customer_schedule_validator").show();
40
  loadingmask.show();
41
  loadingmask.css({"display": "block", "opacity" : "1"});
42
  })
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Wrapper.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Wrapper extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $element->setData('onchange', "apiValidation(this.form, this);");
9
+
10
+ $url = Mage::helper('adminhtml')->getUrl('*/connector/ajaxvalidation');
11
+
12
+ $element->setData('after_element_html', "
13
+ <script>
14
+ document.observe('dom:loaded', function(){
15
+ apiValidation();
16
+ });
17
+ function apiValidation(form, element) {
18
+ var api_username = $('connector_api_credentials_api_username');
19
+ var api_password = $('connector_api_credentials_api_password');
20
+ var reloadurl = '{$url}';
21
+
22
+ if(api_username.value && api_password.value){
23
+ new Ajax.Request(reloadurl, {
24
+ method: 'post',
25
+ parameters: {'api_username' : api_username.value, 'api_password' : api_password.value},
26
+ onComplete: function(transport) {
27
+ Element.hide('loadingmask');
28
+ if(transport.responseText == '\"Credentials Valid.\"'){
29
+ api_username.setStyle({
30
+ fontWeight: 'bold',
31
+ color: 'green' ,
32
+ background: 'transparent url(\"" . $this->getSkinUrl('images/success_msg_icon.gif') . "\") no-repeat right center'
33
+ })
34
+ }else{
35
+ api_username.setStyle({
36
+ fontWeight: 'bold',
37
+ color: 'red',
38
+ background: 'transparent url(\"" . $this->getSkinUrl('images/error_msg_icon.gif') . "\") no-repeat right center'
39
+ });
40
+ }
41
+ }
42
+ });
43
+ }
44
+ return false;
45
+ }
46
+ </script>
47
+ ");
48
+
49
+ return parent::_getElementHtml($element);
50
+
51
+ }
52
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Addressbookbutton.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Addressbookbutton extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getAddRowButtonHtml($title) {
7
+
8
+ return $this->getLayout()->createBlock('adminhtml/widget_button')
9
+ ->setType('button')
10
+ ->setLabel($this->__($title))
11
+ ->setOnClick("createAddressbook(this.form, this);")
12
+ ->toHtml();
13
+ }
14
+
15
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
16
+ $this->setElement($element);
17
+ $originalData = $element->getOriginalData();
18
+
19
+ return $this->_getAddRowButtonHtml($this->__($originalData['button_label']));
20
+ }
21
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Bestsellers.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Bestsellers extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /** label */
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $website = Mage::app()->getRequest()->getParam('website', false);
10
+
11
+ if($website){
12
+ $website = Mage::app()->getWebsite($website);
13
+ $baseUrl = $website->getConfig('web/secure/base_url');
14
+ }
15
+ $passcode = Mage::helper('connector')->getPasscode();
16
+
17
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
18
+
19
+ $text = sprintf('%sconnector/report/bestsellers/code/%s', $baseUrl, $passcode);
20
+ $element->setData('value', $text);
21
+ $element->setData('disabled', 'disabled');
22
+
23
+ return parent::_getElementHtml($element);
24
+ }
25
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Couponinfo.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Couponinfo extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /** label */
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $website = Mage::app()->getRequest()->getParam('website', false);
10
+
11
+ if($website){
12
+ $website = Mage::app()->getWebsite($website);
13
+ $baseUrl = $website->getConfig('web/secure/base_url');
14
+ }
15
+
16
+
17
+ $code = Mage::helper('connector')->getPasscode();
18
+ if(!strlen($code))
19
+ $code = '[PLEASE SET UP A PASSCODE]';
20
+ $text = $baseUrl . 'connector/email/coupon/id/[INSERT ID HERE]/code/'. $code;
21
+
22
+ $element->setData('value', $text);
23
+ $element->setData('disabled', 'disabled');
24
+ return parent::_getElementHtml($element);
25
+ }
26
+
27
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Creditmemonew.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Creditmemonew extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
6
+
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $code = $helper->getPasscode();
16
+ $orderId = $helper->getMappedOrderId();
17
+
18
+ if(!strlen($code))
19
+ $code = '[PLEASE SET UP A PASSCODE]';
20
+ $text = sprintf('%s/connector/creditmemo/new/code/%s/id/@%s@', $baseUrl, $code, $orderId);
21
+
22
+ $element->setData('value', $text);
23
+
24
+ return parent::_getElementHtml($element);
25
+ }
26
+
27
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Crosssell.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Crosssell extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $passcode = Mage::helper('connector')->getPasscode();
15
+ $lastOrderId = Mage::helper('connector')->getLastOrderId();
16
+
17
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
18
+ if(!$lastOrderId) $lastOrderId = '[PLEASE MAP THE LAST ORDER ID]';
19
+
20
+ $text = sprintf('%sconnector/products/crosssell/code/%s/order_id/@%s@', $baseUrl, $passcode, $lastOrderId);
21
+ $element->setData('value', $text);
22
+
23
+ return parent::_getElementHtml($element);
24
+ }
25
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Datafieldbutton.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Datafieldbutton extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getAddRowButtonHtml($title) {
6
+
7
+ return $this->getLayout()->createBlock('adminhtml/widget_button')
8
+ ->setType('button')
9
+ ->setLabel($this->__($title))
10
+ ->setOnClick("createDatafield(this.form, this);")
11
+ ->toHtml();
12
+ }
13
+
14
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
15
+ $this->setElement($element);
16
+ $originalData = $element->getOriginalData();
17
+
18
+ return $this->_getAddRowButtonHtml($this->__($originalData['button_label']));
19
+ }
20
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Gridlist.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Gridlist extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ // Get the default HTML for this option
8
+ $html = parent::_getElementHtml($element);
9
+
10
+
11
+ $jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
12
+
13
+ $jQuery .=
14
+ '<script type="text/javascript">
15
+ jQuery.noConflict();
16
+ jQuery(document).ready(function() {
17
+ var gridOptions = {
18
+ "4" : "4",
19
+ "8" : "8",
20
+ "12" : "12",
21
+ "16" : "16",
22
+ "20" : "20",
23
+ "24" : "24",
24
+ "28" : "28",
25
+ "32" : "32"
26
+
27
+ };
28
+ var listOptions = {
29
+ "2" : "2",
30
+ "4" : "4",
31
+ "6" : "6",
32
+ "8" : "8"
33
+ }
34
+
35
+ jQuery("#connector_dynamic_content_products_related_display_type").change(function(){
36
+ var display_type = jQuery(this).closest("tr").next().find("select");
37
+ var display_mode = jQuery(this).val();
38
+ changeOptions(display_type, display_mode);
39
+ });
40
+
41
+ jQuery("#connector_dynamic_content_products_upsell_display_type").change(function(){
42
+ var display_type = jQuery(this).closest("tr").next().find("select");
43
+ var display_mode = jQuery(this).val();
44
+ changeOptions(display_type, display_mode);
45
+
46
+ });
47
+ jQuery("#connector_dynamic_content_products_crosssell_display_type").change(function(){
48
+ var display_type = jQuery(this).closest("tr").next().find("select");
49
+ var display_mode = jQuery(this).val();
50
+ changeOptions(display_type, display_mode);
51
+ });
52
+ jQuery("#connector_dynamic_content_products_bestsellers_display_type").change(function(){
53
+ var display_type = jQuery(this).closest("tr").next().find("select");
54
+ var display_mode = jQuery(this).val();
55
+ changeOptions(display_type, display_mode);
56
+ });
57
+ jQuery("#connector_dynamic_content_products_most_viewed_display_type").change(function(){
58
+ var display_type = jQuery(this).closest("tr").next().find("select");
59
+ var display_mode = jQuery(this).val();
60
+ changeOptions(display_type, display_mode);
61
+ });
62
+ jQuery("#connector_dynamic_content_products_recently_viewed_display_type").change(function(){
63
+ var display_type = jQuery(this).closest("tr").next().find("select");
64
+ var display_mode = jQuery(this).val();
65
+ changeOptions(display_type, display_mode);
66
+ });
67
+ jQuery("#connector_dynamic_content_manual_product_search_display_type").change(function(){
68
+ var display_type = jQuery(this).closest("tr").next().find("select");
69
+ var display_mode = jQuery(this).val();
70
+ changeOptions(display_type, display_mode);
71
+ });
72
+ function changeOptions(display_type, display_mode){
73
+ if(display_mode == "list"){
74
+ display_type.empty();
75
+
76
+ jQuery.each(listOptions, function(key, value) {
77
+ display_type.append(jQuery("<option></option>")
78
+ .attr("value", value).text(key));
79
+ });
80
+
81
+ }
82
+ if(display_mode == "grid"){
83
+ display_type.empty();
84
+ jQuery.each(gridOptions, function(key, value) {
85
+ display_type.append(jQuery("<option></option>")
86
+ .attr("value", value).text(key));
87
+ });
88
+ }
89
+ }
90
+ });
91
+ </script>';
92
+
93
+ $html .= $jQuery;
94
+
95
+ return $html;
96
+ }
97
+
98
+
99
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Lostbasket.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Lostbasket extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ /** label */
7
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
8
+ {
9
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
10
+ $website = Mage::app()->getRequest()->getParam('website', false);
11
+
12
+ if($website){
13
+ $website = Mage::app()->getWebsite($website);
14
+ $baseUrl = $website->getConfig('web/secure/base_url');
15
+ }
16
+ $code = Mage::helper('connector')->getPasscode();
17
+ if(!strlen($code))
18
+ $code = '[PLEASE SET UP A PASSCODE]';
19
+ $text = $baseUrl . 'connector/email/basket/email/@EMAIL@/code/'. $code;
20
+
21
+ $element->setData('value', $text);
22
+ return parent::_getElementHtml($element);
23
+ }
24
+
25
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Mostviewed.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Mostviewed extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /** label */
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $website = Mage::app()->getRequest()->getParam('website', false);
10
+
11
+ if($website){
12
+ $website = Mage::app()->getWebsite($website);
13
+ $baseUrl = $website->getConfig('web/secure/base_url');
14
+ }
15
+ $passcode = Mage::helper('connector')->getPasscode();
16
+
17
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
18
+
19
+ $text = sprintf('%sconnector/report/mostviewed/code/%s', $baseUrl, $passcode);
20
+ $element->setData('value', $text);
21
+
22
+ return parent::_getElementHtml($element);
23
+ }
24
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Productpush.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Productpush extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /** label */
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $website = Mage::app()->getRequest()->getParam('website', false);
10
+
11
+ if($website){
12
+ $website = Mage::app()->getWebsite($website);
13
+ $baseUrl = $website->getConfig('web/secure/base_url');
14
+ }
15
+ $passcode = Mage::helper('connector')->getPasscode();
16
+
17
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
18
+
19
+ $text = sprintf('%sconnector/products/push/code/%s', $baseUrl, $passcode);
20
+ $element->setData('value', $text);
21
+
22
+ return parent::_getElementHtml($element);
23
+ }
24
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Recentlyviewed.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Recentlyviewed extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
7
+ $website = Mage::app()->getRequest()->getParam('website', false);
8
+
9
+ if($website){
10
+ $website = Mage::app()->getWebsite($website);
11
+ $baseUrl = $website->getConfig('web/secure/base_url');
12
+ }
13
+ $passcode = Mage::helper('connector')->getPasscode();
14
+ $customerId = Mage::helper('connector')->getMappedCustomerId();
15
+
16
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
17
+ if(!$customerId) $customerId = '[PLEASE MAP THE CUSTOMER ID]';
18
+ $text = sprintf('%sconnector/report/recentlyviewed/code/%s/customer_id/@%s@', $baseUrl, $passcode, $customerId);
19
+ $element->setData('value', $text);
20
+
21
+ return parent::_getElementHtml($element);
22
+
23
+ }
24
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Related.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Related extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $passcode = Mage::helper('connector')->getPasscode();
15
+ $lastOrderId = Mage::helper('connector')->getLastOrderId();
16
+
17
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
18
+ if(!$lastOrderId) $lastOrderId = '[PLEASE MAP THE LAST ORDER ID]';
19
+
20
+ $text = sprintf('%sconnector/products/related/code/%s/order_id/@%s@', $baseUrl, $passcode, $lastOrderId);
21
+ $element->setData('value', $text);
22
+
23
+ return parent::_getElementHtml($element);
24
+
25
+ }
26
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Upsell.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Upsell extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
7
+ $website = Mage::app()->getRequest()->getParam('website', false);
8
+
9
+ if($website){
10
+ $website = Mage::app()->getWebsite($website);
11
+ $baseUrl = $website->getConfig('web/secure/base_url');
12
+ }
13
+ $passcode = Mage::helper('connector')->getPasscode();
14
+ $lastOrderid = Mage::helper('connector')->getLastOrderId();
15
+
16
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
17
+ if(!$lastOrderid) $lastOrderid = '[PLEASE MAP THE LAST ORDER ID]';
18
+
19
+ $text = sprintf('%sconnector/products/upsell/code/%s/order_id/@%s@', $baseUrl, $passcode, $lastOrderid);
20
+ $element->setData('value', $text);
21
+
22
+ return parent::_getElementHtml($element);
23
+ }
24
+ }
app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Wrapper.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Emailapivalidate.php} RENAMED
@@ -1,12 +1,14 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Wrapper extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
 
6
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
  {
8
  $element->setData('onchange', "apiValidation(this.form, this);");
9
 
 
 
10
  $element->setData('after_element_html', "
11
  <script>
12
  document.observe('dom:loaded', function(){
@@ -14,17 +16,17 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Wrapper extends Mage_A
14
 
15
  });
16
  function apiValidation(form, element) {
17
- var api_user = $('connector_api_settings_api_credentials_username');
18
- var api_password = $('connector_api_settings_api_credentials_password');
19
 
20
- var reloadurl = '{$this->getUrl('connector/debug/ajaxvalidation')}';
21
 
22
  new Ajax.Request(reloadurl, {
23
  method: 'post',
24
- parameters: {'api_user' : api_user.value, 'api_password' : api_password.value},
25
  onComplete: function(transport) {
26
  Element.hide('loadingmask');
27
- if(transport.responseText == '\"Valid\"'){
28
  api_user.setStyle({
29
  fontWeight: 'bold',
30
  color: 'green' ,
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Emailapivalidate extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
 
6
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
  {
8
  $element->setData('onchange', "apiValidation(this.form, this);");
9
 
10
+ $url = Mage::helper('adminhtml')->getUrl('*/connector/ajaxvalidation');
11
+
12
  $element->setData('after_element_html', "
13
  <script>
14
  document.observe('dom:loaded', function(){
16
 
17
  });
18
  function apiValidation(form, element) {
19
+ var api_user = $('connector_transactional_emails_credentials_api_username');
20
+ var api_password = $('connector_transactional_emails_credentials_api_password');
21
 
22
+ var reloadurl = '{$url}';
23
 
24
  new Ajax.Request(reloadurl, {
25
  method: 'post',
26
+ parameters: {'api_username' : api_user.value, 'api_password' : api_password.value},
27
  onComplete: function(transport) {
28
  Element.hide('loadingmask');
29
+ if(transport.responseText == '\"Credentials Valid.\"'){
30
  api_user.setStyle({
31
  fontWeight: 'bold',
32
  color: 'green' ,
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms/Smsmessagefour.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Sms_Smsmessagefour extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ const DEFAULT_TEXT = 'Default SMS Text';
6
+
7
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
8
+
9
+
10
+ $element->setData('placeholder', self::DEFAULT_TEXT);
11
+
12
+ $element->setData('after_element_html',
13
+ "<a href='#' onclick=\"injectText('connector_sms_sms_four_message', '{{var order_number}}');return false;\">Insert Order Number</a>
14
+ <a href='#' onclick=\"injectText('connector_sms_sms_four_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>"
15
+ );
16
+ return parent::_getElementHtml($element);
17
+ }
18
+
19
+
20
+ }
app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms}/Smsmessageone.php RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessageone extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
  const DEFAULT_TEXT = 'Default SMS Text';
6
 
@@ -9,10 +9,10 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessageone extends
9
 
10
  $element->setData('placeholder', self::DEFAULT_TEXT);
11
 
12
- $element->setData('after_element_html', "
13
 
14
- <a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var order_number}}');return false;\">Insert Order Number</a>
15
- <a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
16
 
17
  <script type='text/javascript'>
18
  function injectText(element,value){
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Sms_Smsmessageone extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
  const DEFAULT_TEXT = 'Default SMS Text';
6
 
9
 
10
  $element->setData('placeholder', self::DEFAULT_TEXT);
11
 
12
+ $element->setData('after_element_html',
13
 
14
+ "<a href='#' onclick=\"injectText('connector_sms_sms_one_message', '{{var order_number}}');return false;\">Insert Order Number</a>
15
+ <a href='#' onclick=\"injectText('connector_sms_sms_one_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
16
 
17
  <script type='text/javascript'>
18
  function injectText(element,value){
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms/Smsmessagethree.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Sms_Smsmessagethree extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ const DEFAULT_TEXT = 'Default SMS Text';
6
+
7
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
8
+
9
+
10
+ $element->setData('placeholder', self::DEFAULT_TEXT);
11
+
12
+ $element->setData('after_element_html',
13
+
14
+ "<a href='#' onclick=\"injectText('connector_sms_sms_three_message', '{{var order_number}}');return false;\">Insert Order Number</a>
15
+ <a href='#' onclick=\"injectText('connector_sms_sms_three_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>"
16
+ );
17
+ return parent::_getElementHtml($element);
18
+ }
19
+
20
+
21
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms/Smsmessagetwo.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Sms_Smsmessagetwo extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ const DEFAULT_TEXT = 'Default SMS Text';
6
+
7
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
8
+
9
+
10
+ $element->setData('placeholder', self::DEFAULT_TEXT);
11
+
12
+ $element->setData('after_element_html',
13
+ "<a href='#' onclick=\"injectText('connector_sms_sms_two_message', '{{var order_number}}');return false;\">Insert Order Number</a>
14
+ <a href='#' onclick=\"injectText('connector_sms_sms_two_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>"
15
+ );
16
+ return parent::_getElementHtml($element);
17
+ }
18
+
19
+
20
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Creditmemoupdate.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Creditmemoupdate extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
19
+
20
+ $text = sprintf('%sconnector/creditmemo/update/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
21
+
22
+ $element->setData('value', $text);
23
+
24
+ return parent::_getElementHtml($element);
25
+ }
26
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Creditmemoupdateguest.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Creditmemoupdateguest extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
18
+
19
+ $text = sprintf('%sconnector/creditmemo/updateguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
20
+
21
+ $element->setData('value', $text);
22
+
23
+ return parent::_getElementHtml($element);
24
+ }
25
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Customerconfirmation.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Customerconfirmation extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ /** label */
7
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
8
+ {
9
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
10
+ $website = Mage::app()->getRequest()->getParam('website', false);
11
+
12
+ if($website){
13
+ $website = Mage::app()->getWebsite($website);
14
+ $baseUrl = $website->getConfig('web/secure/base_url');
15
+ }
16
+ $helper = Mage::helper('connector');
17
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
18
+ $customerId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_ID, $website);
19
+
20
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
21
+
22
+ $text = sprintf('%sconnector/customer/confirmation/code/%s/customer_id/@%s@', $baseUrl, $passcode, $customerId);
23
+ $element->setData('value', $text);
24
+
25
+ return parent::_getElementHtml($element);
26
+ }
27
+
28
+
29
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Customerconfirmed.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Customerconfirmed extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ /** label */
7
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
8
+ {
9
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
10
+ $website = Mage::app()->getRequest()->getParam('website', false);
11
+
12
+ if($website){
13
+ $website = Mage::app()->getWebsite($website);
14
+ $baseUrl = $website->getConfig('web/secure/base_url');
15
+ }
16
+ $helper = Mage::helper('connector');
17
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
18
+ $customerId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_ID, $website);
19
+
20
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
21
+
22
+ $text = sprintf('%sconnector/customer/confirmed/code/%s/customer_id/@%s@', $baseUrl, $passcode, $customerId);
23
+ $element->setData('value', $text);
24
+
25
+ return parent::_getElementHtml($element);
26
+ }
27
+
28
+
29
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Customernew.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Customernew extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ /** label */
7
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
8
+ {
9
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
10
+ $website = Mage::app()->getRequest()->getParam('website', false);
11
+
12
+ if($website){
13
+ $website = Mage::app()->getWebsite($website);
14
+ $baseUrl = $website->getConfig('web/secure/base_url');
15
+ }
16
+ $helper = Mage::helper('connector');
17
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
18
+ $customerId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_ID, $website);
19
+
20
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
21
+
22
+ $text = sprintf('%sconnector/customer/new/code/%s/customer_id/@%s@', $baseUrl, $passcode, $customerId);
23
+ $element->setData('value', $text);
24
+
25
+ return parent::_getElementHtml($element);
26
+ }
27
+
28
+
29
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Invoiceupdate.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Invoiceupdate extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /** label */
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $website = Mage::app()->getRequest()->getParam('website', false);
10
+
11
+ if($website){
12
+ $website = Mage::app()->getWebsite($website);
13
+ $baseUrl = $website->getConfig('web/secure/base_url');
14
+ }
15
+ $helper = Mage::helper('connector');
16
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
17
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
18
+
19
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
20
+
21
+ $text = sprintf('%sconnector/invoice/update/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
22
+ $element->setData('value', $text);
23
+
24
+ return parent::_getElementHtml($element);
25
+ }
26
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Invoiceupdateguest.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Invoiceupdateguest extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /** label */
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $website = Mage::app()->getRequest()->getParam('website', false);
10
+
11
+ if($website){
12
+ $website = Mage::app()->getWebsite($website);
13
+ $baseUrl = $website->getConfig('web/secure/base_url');
14
+ }
15
+ $helper = Mage::helper('connector');
16
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
17
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
18
+
19
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
20
+
21
+ $text = sprintf('%sconnector/invoice/updateguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
22
+ $element->setData('value', $text);
23
+
24
+ return parent::_getElementHtml($element);
25
+ }
26
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newcreditmemo.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newcreditmemo extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
6
+
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+
19
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
20
+
21
+ $text = sprintf('%sconnector/creditmemo/new/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
22
+ $element->setData('value', $text);
23
+
24
+ return parent::_getElementHtml($element);
25
+ }
26
+
27
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newcreditmemoguest.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newcreditmemoguest extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
6
+
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+
19
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
20
+
21
+ $text = sprintf('%sconnector/creditmemo/newguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
22
+ $element->setData('value', $text);
23
+
24
+ return parent::_getElementHtml($element);
25
+ }
26
+
27
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newinvoice.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newinvoice extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /** label */
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $website = Mage::app()->getRequest()->getParam('website', false);
10
+
11
+ if($website){
12
+ $website = Mage::app()->getWebsite($website);
13
+ $baseUrl = $website->getConfig('web/secure/base_url');
14
+ }
15
+ $helper = Mage::helper('connector');
16
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
17
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
18
+
19
+
20
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
21
+
22
+ $text = sprintf('%sconnector/invoice/new/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
23
+ $element->setData('value', $text);
24
+
25
+ return parent::_getElementHtml($element);
26
+ }
27
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newinvoiceguest.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newinvoiceguest extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /** label */
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $website = Mage::app()->getRequest()->getParam('website', false);
10
+
11
+ if($website){
12
+ $website = Mage::app()->getWebsite($website);
13
+ $baseUrl = $website->getConfig('web/secure/base_url');
14
+ }
15
+ $helper = Mage::helper('connector');
16
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
17
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
18
+
19
+
20
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
21
+
22
+ $text = sprintf('%sconnector/invoice/newguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
23
+ $element->setData('value', $text);
24
+
25
+ return parent::_getElementHtml($element);
26
+ }
27
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Neworder.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Neworder extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+
19
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
20
+
21
+ $text = sprintf('%sconnector/order/new/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
22
+ $element->setData('value', $text);
23
+
24
+ return parent::_getElementHtml($element);
25
+ }
26
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Neworderguest.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Neworderguest extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
19
+
20
+ $text = sprintf('%sconnector/order/newguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
21
+ $element->setData('value', $text);
22
+
23
+ return parent::_getElementHtml($element);
24
+ }
25
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newshipment.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newshipment extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
19
+
20
+ $text = sprintf('%sconnector/shipping/new/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
21
+
22
+
23
+ $element->setData('value', $text);
24
+
25
+ return parent::_getElementHtml($element);
26
+ }
27
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newshipmentguest.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newshipmentguest extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
19
+
20
+ $text = sprintf('%sconnector/shipping/newguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
21
+
22
+ $element->setData('value', $text);
23
+
24
+ return parent::_getElementHtml($element);
25
+ }
26
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Orderupdate.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Orderupdate extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
19
+ $text = sprintf('%sconnector/order/update/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
20
+ $element->setData('value', $text);
21
+
22
+ return parent::_getElementHtml($element);
23
+ }
24
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Orderupdateguest.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Orderupdateguest extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
19
+ $text = sprintf('%sconnector/order/updateguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
20
+ $element->setData('value', $text);
21
+
22
+ return parent::_getElementHtml($element);
23
+ }
24
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Shipmentupdate.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Shipmentupdate extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
19
+
20
+ $text = sprintf('%sconnector/shipping/update/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
21
+
22
+ $element->setData('value', $text);
23
+
24
+ return parent::_getElementHtml($element);
25
+ }
26
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Shipmentupdateguest.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Shipmentupdateguest extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
8
+ $website = Mage::app()->getRequest()->getParam('website', false);
9
+
10
+ if($website){
11
+ $website = Mage::app()->getWebsite($website);
12
+ $baseUrl = $website->getConfig('web/secure/base_url');
13
+ }
14
+ $helper = Mage::helper('connector');
15
+ $passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
16
+ $orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
17
+
18
+ if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
19
+
20
+ $text = sprintf('%sconnector/shipping/updateguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
21
+ $element->setData('value', $text);
22
+
23
+ return parent::_getElementHtml($element);
24
+ }
25
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Block/Basket.php RENAMED
@@ -17,9 +17,13 @@ class Dotdigitalgroup_Email_Block_Basket extends Mage_Core_Block_Template
17
  $customer = Mage::getModel('customer/customer');
18
  $customer->setWebsiteId(Mage::app()->getWebsite()->getId())->loadByEmail($email);
19
 
 
 
 
 
20
  //last active guest basket
21
  $quoteModel = Mage::getResourceModel('sales/quote_collection')
22
- ->addFieldToFilter('is_active',1)
23
  ->addFieldToFilter('items_count', array('gt' => 0))
24
  ->addFieldToFilter('customer_email', $email)
25
  ->setOrder('updated_at' , 'DESC')
@@ -32,7 +36,7 @@ class Dotdigitalgroup_Email_Block_Basket extends Mage_Core_Block_Template
32
  $store_id = $quoteModel->getStoreId();
33
  Mage::app()->setCurrentStore($store_id);
34
 
35
- return $quoteModel->getAllItems();;
36
  }
37
 
38
  public function getGrandTotal()
17
  $customer = Mage::getModel('customer/customer');
18
  $customer->setWebsiteId(Mage::app()->getWebsite()->getId())->loadByEmail($email);
19
 
20
+ if(! $customer->getId()){
21
+ Mage::helper('connector')->log('Lost basket : customer not found : ' . $email);
22
+ exit();
23
+ }
24
  //last active guest basket
25
  $quoteModel = Mage::getResourceModel('sales/quote_collection')
26
+ ->addFieldToFilter('is_active', 1)
27
  ->addFieldToFilter('items_count', array('gt' => 0))
28
  ->addFieldToFilter('customer_email', $email)
29
  ->setOrder('updated_at' , 'DESC')
36
  $store_id = $quoteModel->getStoreId();
37
  Mage::app()->setCurrentStore($store_id);
38
 
39
+ return $quoteModel->getAllItems();
40
  }
41
 
42
  public function getGrandTotal()
app/code/{local → community}/Dotdigitalgroup/Email/Block/Coupon.php RENAMED
File without changes
app/code/community/Dotdigitalgroup/Email/Block/Customer.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Customer extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected function _prepareLayout()
7
+ {
8
+ if ($root = $this->getLayout()->getBlock('root')) {
9
+ $root->setTemplate('page/blank.phtml');
10
+ }
11
+ }
12
+
13
+ public function getRecommendedProducts()
14
+ {
15
+ $customerId = $this->getRequest()->getParam('customer_id', false);
16
+ $mode = $this->getRequest()->getParam('mode', false);
17
+ if($mode && $customerId){
18
+ $customerModel = Mage::getModel('customer/customer')->load($customerId);
19
+ Mage::app()->setCurrentStore($customerModel->getStoreId());
20
+ if($customerModel->getId()){
21
+ //order products
22
+ $dynamicReport = Mage::getModel('email_connector/dynamic_report');
23
+ $dynamicReport->setMode($mode)
24
+ ->setCustomer($customerModel);
25
+ }else{
26
+ Mage::helper('connector')->log('ERROR Dynamic content : Customer not found '. $customerId);
27
+ return array();
28
+ }
29
+ }else{
30
+ //load the reports from dynamic
31
+ $dynamicReport = Mage::getModel('email_connector/dynamic_report');
32
+ $dynamicReport->setMode($mode);
33
+
34
+ }
35
+ $productsToDisplay = $dynamicReport->getProducts();
36
+
37
+ return $productsToDisplay;
38
+ }
39
+
40
+ public function getCustomer()
41
+ {
42
+ $message = new Varien_Object();
43
+ $customerId = Mage::app()->getRequest()->getParam('customer_id', false);
44
+ if($customerId){
45
+ $customerModel = Mage::getModel('customer/customer')->load($customerId);
46
+ if(! $customerModel->getId()){
47
+ Mage::helper('connector')->log('Error: New customer, no custoemr found : ' . $customerId);
48
+ return $message->setError('No customer found : ' . $customerId);
49
+ }
50
+ return $customerModel;
51
+
52
+ }else{
53
+ return $message->setError('No customer id in param request : ' . $customerId);
54
+ }
55
+ }
56
+
57
+
58
+
59
+ public function getDisplayType()
60
+ {
61
+ return Mage::helper('connector/recommended')->getDisplayType();
62
+
63
+ }
64
+
65
+ public function getStore()
66
+ {
67
+ $customerId = Mage::app()->getRequest()->getParam('customer_id', false);
68
+ return Mage::app()->getStore(Mage::getModel('customer/customer')->load($customerId)->getStoreId());
69
+ }
70
+
71
+ public function getConfirmation()
72
+ {
73
+ $customerId = Mage::app()->getRequest()->getParam('customer_id', false);
74
+ $customerModel = Mage::getModel('customer/customer')->load($customerId);
75
+
76
+ if($confirmation = $customerModel->getConfirmation()){
77
+ return $confirmation;
78
+ }
79
+ Mage::helper('connector')->log('Customer already confirmed the account');
80
+ }
81
+
82
+ }
app/code/community/Dotdigitalgroup/Email/Block/Order.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Order extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected function _prepareLayout()
7
+ {
8
+ if ($root = $this->getLayout()->getBlock('root')) {
9
+ $root->setTemplate('page/blank.phtml');
10
+
11
+ }
12
+ if ($headBlock = $this->getLayout()->getBlock('head')) {
13
+ $headBlock->setTitle($this->__('Order # %s', $this->getOrder()->getRealOrderId()));
14
+ }
15
+ }
16
+
17
+ public function getOrder()
18
+ {
19
+ $orderId = Mage::registry('order_id');
20
+ $order = Mage::registry('current_order');
21
+ if(! $orderId){
22
+ $orderId = Mage::app()->getRequest()->getParam('order_id');
23
+ Mage::register('order_id', $orderId);
24
+ }
25
+ if(! $order){
26
+ $order = Mage::getModel('sales/order')->load($orderId);
27
+ Mage::register('current_order', $order);
28
+ }
29
+
30
+ return $order;
31
+ }
32
+ }
app/code/community/Dotdigitalgroup/Email/Block/Order/Creditmemo.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Order_Creditmemo extends Mage_Sales_Block_Order_Creditmemo_Items
3
+ {
4
+ protected function _prepareLayout()
5
+ {
6
+ if ($root = $this->getLayout()->getBlock('root')) {
7
+ $root->setTemplate('page/blank.phtml');
8
+ }
9
+ }
10
+
11
+ public function getOrder()
12
+ {
13
+ $orderId = Mage::registry('order_id');
14
+ $order = Mage::registry('current_order');
15
+ if(! $orderId){
16
+ $orderId = Mage::app()->getRequest()->getParam('order_id');
17
+ Mage::register('order_id', $orderId);
18
+ }
19
+ if(! $order){
20
+ $order = Mage::getModel('sales/order')->load($orderId);
21
+ Mage::register('current_order', $order);
22
+ }
23
+ if(! $order->hasCreditmemos()){
24
+ Mage::helper('connector')->log('TE - no creditmemo for order : '. $orderId);
25
+ exit;
26
+ }
27
+
28
+ return $order;
29
+ }
30
+ public function getCreditmemoItems()
31
+ {
32
+ return Mage::registry('current_order')->getItemsCollection();
33
+ }
34
+ }
app/code/community/Dotdigitalgroup/Email/Block/Order/Invoice.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Order_Invoice extends Mage_Sales_Block_Order_Invoice_Items
3
+ {
4
+ protected function _prepareLayout()
5
+ {
6
+ if ($root = $this->getLayout()->getBlock('root')) {
7
+ $root->setTemplate('page/blank.phtml');
8
+ }
9
+ }
10
+
11
+ public function getOrder()
12
+ {
13
+ $orderId = Mage::registry('order_id');
14
+ $order = Mage::registry('current_order');
15
+ if(! $orderId){
16
+ $orderId = Mage::app()->getRequest()->getParam('order_id');
17
+ Mage::register('order_id', $orderId);
18
+ }
19
+ if(! $order){
20
+ $order = Mage::getModel('sales/order')->load($orderId);
21
+ Mage::register('current_order', $order);
22
+ }
23
+ if(! $order->hasInvoices()){
24
+ Mage::helper('connector')->log('TE - no invoice for order : '. $orderId);
25
+ exit;
26
+ }
27
+
28
+ return $order;
29
+ }
30
+
31
+ }
app/code/community/Dotdigitalgroup/Email/Block/Order/Shipping.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Order_Shipping extends Mage_Sales_Block_Order_Creditmemo_Items
3
+ {
4
+ protected function _prepareLayout()
5
+ {
6
+ if ($root = $this->getLayout()->getBlock('root')) {
7
+ $root->setTemplate('page/blank.phtml');
8
+ }
9
+ }
10
+
11
+ public function getOrder()
12
+ {
13
+ $orderId = Mage::registry('order_id');
14
+ $order = Mage::registry('current_order');
15
+ if(! $orderId){
16
+ $orderId = Mage::app()->getRequest()->getParam('order_id');
17
+ Mage::register('order_id', $orderId);
18
+ }
19
+ if(! $order){
20
+ $order = Mage::getModel('sales/order')->load($orderId);
21
+ Mage::register('current_order', $order);
22
+ }
23
+ if(! $order->hasShipments()){
24
+ Mage::helper('connector')->log('TE - no shipments for order : '. $orderId);
25
+ exit;
26
+ }
27
+
28
+ return $order;
29
+
30
+ }
31
+ public function getShipment()
32
+ {
33
+ return $shipment = Mage::registry('current_order')->getShipmentsCollection()->getFirstItem();
34
+ }
35
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Block/Products.php RENAMED
@@ -2,32 +2,28 @@
2
 
3
  class Dotdigitalgroup_Email_Block_Products extends Mage_Core_Block_Template
4
  {
 
 
 
 
 
 
 
5
  /**
6
  * get the products to display for table
7
  */
8
  public function getRecommendedProducts()
9
  {
10
- //get all params
11
- $params = $this->getRequest()->getParams();
12
  $productsToDisplay = array();
13
-
14
- if(isset($params['customer'])){
15
- $productRecommended = new Dotdigitalgroup_Email_Model_Dynamic_Recommended();
16
- $productsToDisplay = $productRecommended->getProducts();
17
- $orderId = false;
18
-
19
- }else{
20
-
21
- $orderId = $params['order'];
22
- }
23
-
24
-
25
-
26
- if($orderId){
27
  $orderModel = Mage::getModel('sales/order')->load($orderId);
28
  if($orderModel->getId()){
 
29
  //order products
30
- $productRecommended = new Dotdigitalgroup_Email_Model_Dynamic_Recommended($orderModel);
 
31
 
32
  //get the order items recommendations
33
  $productsToDisplay = $productRecommended->getProducts();
@@ -45,9 +41,9 @@ class Dotdigitalgroup_Email_Block_Products extends Mage_Core_Block_Template
45
  return $this->toHtml();
46
  }
47
 
48
- public function getMode()
49
  {
50
- return Mage::helper('connector/recommended')->getMode();
51
 
52
  }
53
  }
2
 
3
  class Dotdigitalgroup_Email_Block_Products extends Mage_Core_Block_Template
4
  {
5
+ protected function _prepareLayout()
6
+ {
7
+ if ($root = $this->getLayout()->getBlock('root')) {
8
+ $root->setTemplate('page/blank.phtml');
9
+ }
10
+ }
11
+
12
  /**
13
  * get the products to display for table
14
  */
15
  public function getRecommendedProducts()
16
  {
 
 
17
  $productsToDisplay = array();
18
+ $orderId = $this->getRequest()->getParam('order', false);
19
+ $mode = $this->getRequest()->getParam('mode', false);
20
+ if($orderId && $mode){
 
 
 
 
 
 
 
 
 
 
 
21
  $orderModel = Mage::getModel('sales/order')->load($orderId);
22
  if($orderModel->getId()){
23
+ Mage::app()->setCurrentStore($orderModel->getStoreId());
24
  //order products
25
+ $productRecommended = Mage::getModel('email_connector/dynamic_recommended', $orderModel);
26
+ $productRecommended->setMode($mode);
27
 
28
  //get the order items recommendations
29
  $productsToDisplay = $productRecommended->getProducts();
41
  return $this->toHtml();
42
  }
43
 
44
+ public function getDisplayType()
45
  {
46
+ return Mage::helper('connector/recommended')->getDisplayType();
47
 
48
  }
49
  }
app/code/community/Dotdigitalgroup/Email/Block/Recommended/Bestsellers.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Recommended_Bestsellers extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected function _prepareLayout()
7
+ {
8
+ if ($root = $this->getLayout()->getBlock('root')) {
9
+ $root->setTemplate('page/blank.phtml');
10
+ }
11
+ }
12
+
13
+
14
+ public function getLoadedProductCollection()
15
+ {
16
+ $productsToDisplay = array();
17
+ $mode = $this->getRequest()->getActionName();
18
+ $limit = Mage::helper('connector/recommended')->getDisplayLimitByMode($mode);
19
+ $from = Mage::helper('connector/recommended')->getTimeFromConfig($mode);
20
+ $to = Zend_Date::now()->toString(Zend_Date::ISO_8601);
21
+
22
+ $productCollection = Mage::getResourceModel('reports/product_collection')
23
+ ->addOrderedQty($from, $to)
24
+ ->addAttributeToSelect('*')
25
+ ->addAttributeToSelect(array('name', 'price', 'small_image'))
26
+ ->setPageSize($limit)
27
+ ->setOrder('ordered_qty', 'desc');
28
+ foreach ($productCollection as $_product) {
29
+ $productId = $_product->getId();
30
+ $product = Mage::getModel('catalog/product')->load($productId);
31
+ if($product->isSalable())
32
+ $productsToDisplay[] = $product;
33
+ }
34
+
35
+ return $productsToDisplay;
36
+ }
37
+
38
+ public function getMode()
39
+ {
40
+ return Mage::helper('connector/recommended')->getDisplayType();
41
+
42
+ }
43
+
44
+
45
+ public function getPriceHtml($product)
46
+ {
47
+ $this->setTemplate('connector/product/price.phtml');
48
+ $this->setProduct($product);
49
+ return $this->toHtml();
50
+ }
51
+
52
+ }
app/code/community/Dotdigitalgroup/Email/Block/Recommended/Mostviewed.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Recommended_Mostviewed extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected function _prepareLayout()
7
+ {
8
+ if ($root = $this->getLayout()->getBlock('root')) {
9
+ $root->setTemplate('page/blank.phtml');
10
+ }
11
+ }
12
+
13
+ public function getLoadedProductCollection(){
14
+ $productsToDisplay = array();
15
+ $mode = $this->getRequest()->getActionName();
16
+ $limit = Mage::helper('connector/recommended')->getDisplayLimitByMode($mode);
17
+ $from = Mage::helper('connector/recommended')->getTimeFromConfig($mode);
18
+ $to = Zend_Date::now()->toString(Zend_Date::ISO_8601);
19
+
20
+ $productCollection = Mage::getResourceModel('reports/product_collection')
21
+ ->addViewsCount($from, $to)
22
+ ->setPageSize($limit);
23
+
24
+ foreach ($productCollection as $_product) {
25
+ $productId = $_product->getId();
26
+ $product = Mage::getModel('catalog/product')->load($productId);
27
+ if($product->isSalable())
28
+ $productsToDisplay[] = $product;
29
+ }
30
+
31
+ return $productsToDisplay;
32
+
33
+ }
34
+
35
+
36
+ public function getMode()
37
+ {
38
+ return Mage::helper('connector/recommended')->getDisplayType();
39
+
40
+ }
41
+
42
+ public function getPriceHtml($product)
43
+ {
44
+ $this->setTemplate('connector/product/price.phtml');
45
+ $this->setProduct($product);
46
+ return $this->toHtml();
47
+ }
48
+ }
app/code/community/Dotdigitalgroup/Email/Block/Recommended/Products.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Recommended_Products extends Mage_Core_Block_Template
4
+ {
5
+ protected function _prepareLayout()
6
+ {
7
+ if ($root = $this->getLayout()->getBlock('root')) {
8
+ $root->setTemplate('page/blank.phtml');
9
+ }
10
+ }
11
+
12
+ /**
13
+ * get the products to display for table
14
+ */
15
+ public function getLoadedProductCollection()
16
+ {
17
+ $productsToDisplay = array();
18
+ $orderId = $this->getRequest()->getParam('order_id');
19
+ $mode = $this->getRequest()->getActionName();
20
+ $orderModel = Mage::getModel('sales/order')->load($orderId);
21
+
22
+ if($orderModel->getId()){
23
+ $limit = Mage::helper('connector/recommended')->getDisplayLimitByMode($mode);
24
+ $orderItems = $orderModel->getAllItems();
25
+ if(count($orderItems) > $limit){
26
+ $max_per_child = 1;
27
+ }else
28
+ $max_per_child = number_format($limit / count($orderItems));
29
+
30
+ Mage::helper('connector')->log('DYNAMIC PRODUCTS : limit ' . $limit . ' products : ' . count($orderItems) . ', max per child : '. $max_per_child);
31
+
32
+ foreach ($orderItems as $item){
33
+ $productId = $item->getProductId();
34
+ /** @var Mage_Catalog_Model_Product $productModel */
35
+ $productModel = Mage::getModel('catalog/product')->load($productId);
36
+ if($productModel->getId()){
37
+ $recommendedProducts = $this->_getRecommendedProduct($productModel, $mode);
38
+ $i = 0;
39
+ foreach ($recommendedProducts as $product) {
40
+ $product = Mage::getModel('catalog/product')->load($product->getId());
41
+ if(count($productsToDisplay) < $limit){
42
+ if($i <= $max_per_child && $product->isSaleable() && !$product->getParentId()){
43
+ $productsToDisplay[$product->getId()] = $product;
44
+ $i++;
45
+ }
46
+ }
47
+ }
48
+ }
49
+ if(count($productsToDisplay) == $limit){
50
+ break;
51
+ }
52
+
53
+ }
54
+
55
+ //fill up the table with fallback products
56
+ if(count($productsToDisplay) < $limit){
57
+ $fallbackIds = Mage::helper('connector/recommended')->getFallbackIds();
58
+ foreach ($fallbackIds as $productId) {
59
+ $product = Mage::getModel('catalog/product')->load($productId);
60
+ if($product->isSaleable())
61
+ $productsToDisplay[$product->getId()] = $product;
62
+ //stop the limit was reached
63
+ if(count($productsToDisplay) == $limit){
64
+ break;
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ Mage::helper('connector')->log('loaded product to display ' . count($productsToDisplay));
71
+ return $productsToDisplay;
72
+ }
73
+
74
+ private function _getRecommendedProduct(Mage_Catalog_Model_Product $productModel, $mode){
75
+ //array of products to display
76
+ $products = array();
77
+ switch($mode){
78
+ case 'related':
79
+ $products = $productModel->getRelatedProducts();
80
+ break;
81
+ case 'upsell':
82
+ $products = $productModel->getUpSellProducts();
83
+ break;
84
+ case 'crosssell':
85
+ $products = $productModel->getCrossSellProducts();
86
+ break;
87
+
88
+ }
89
+
90
+ return $products;
91
+ }
92
+
93
+
94
+ public function getMode()
95
+ {
96
+ return Mage::helper('connector/recommended')->getDisplayType();
97
+
98
+ }
99
+
100
+ public function getColumnCount()
101
+ {
102
+ return Mage::helper('connector/recommended')->getDisplayLimitByMode($this->getRequest()->getActionName());
103
+ }
104
+ public function getPriceHtml($product)
105
+ {
106
+ $this->setTemplate('connector/product/price.phtml');
107
+ $this->setProduct($product);
108
+ return $this->toHtml();
109
+ }
110
+ }
app/code/community/Dotdigitalgroup/Email/Block/Recommended/Push.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Recommended_Push extends Mage_Core_Block_Template
4
+ {
5
+ protected function _prepareLayout()
6
+ {
7
+ if ($root = $this->getLayout()->getBlock('root')) {
8
+ $root->setTemplate('page/blank.phtml');
9
+ }
10
+ }
11
+
12
+ /**
13
+ * get the products to display for table
14
+ */
15
+ public function getLoadedProductCollection()
16
+ {
17
+ $productsToDisplay = array();
18
+ $mode = $this->getRequest()->getActionName();
19
+ $limit = Mage::helper('connector/recommended')->getDisplayLimitByMode($mode);
20
+
21
+ $productIds = Mage::helper('connector/recommended')->getProductPushIds();
22
+
23
+ $productCollection = Mage::getResourceModel('catalog/product_collection')
24
+ ->addAttributeToFilter('entity_id', array('in' => $productIds))
25
+ ->setPageSize($limit)
26
+ ;
27
+ foreach ($productCollection as $_product) {
28
+ $productId = $_product->getId();
29
+ $product = Mage::getModel('catalog/product')->load($productId);
30
+ if($product->isSaleable())
31
+ $productsToDisplay[] = $product;
32
+
33
+ }
34
+
35
+ return $productsToDisplay;
36
+
37
+ }
38
+
39
+
40
+ public function getMode()
41
+ {
42
+ return Mage::helper('connector/recommended')->getDisplayType();
43
+
44
+ }
45
+
46
+
47
+ public function getPriceHtml($product)
48
+ {
49
+ $this->setTemplate('connector/product/price.phtml');
50
+ $this->setProduct($product);
51
+ return $this->toHtml();
52
+ }
53
+ }
app/code/community/Dotdigitalgroup/Email/Block/Recommended/Recentlyviewed.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Recommended_Recentlyviewed extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected function _prepareLayout()
7
+ {
8
+ if ($root = $this->getLayout()->getBlock('root')) {
9
+ $root->setTemplate('page/blank.phtml');
10
+ }
11
+ }
12
+
13
+ public function getLoadedProductCollection()
14
+ {
15
+ $productsToDisplay = array();
16
+ $mode = $this->getRequest()->getActionName();
17
+ $customerId = $this->getRequest()->getParam('customer_id');
18
+ $limit = Mage::helper('connector/recommended')->getDisplayLimitByMode($mode);
19
+ //login customer to receive the recent products
20
+ $session = Mage::getSingleton('customer/session');
21
+ $isLoggedIn = $session->loginById($customerId);
22
+ /** @var Mage_Reports_Block_Product_Viewed $collection */
23
+ $collection = Mage::getSingleton('Mage_Reports_Block_Product_Viewed');
24
+ $items = $collection->getItemsCollection()
25
+ ->setPageSize($limit);
26
+ Mage::helper('connector')->log('Recentlyviewed customer : ' . $customerId . ', mode ' . $mode . ', limit : ' . $limit .
27
+ ', items found : ' . count($items) . ', is customer logged in : ' . $isLoggedIn . ', products :' . count($productsToDisplay));
28
+ foreach ($items as $product) {
29
+ $product = Mage::getModel('catalog/product')->load($product->getId());
30
+ if($product->isSalable())
31
+ $productsToDisplay[$product->getId()] = $product;
32
+
33
+ }
34
+ $session->logout();
35
+
36
+ return $productsToDisplay;
37
+ }
38
+
39
+
40
+ public function getMode()
41
+ {
42
+ return Mage::helper('connector/recommended')->getDisplayType();
43
+
44
+ }
45
+
46
+ public function getPriceHtml($product)
47
+ {
48
+ $this->setTemplate('connector/product/price.phtml');
49
+ $this->setProduct($product);
50
+ return $this->toHtml();
51
+ }
52
+ }
app/code/community/Dotdigitalgroup/Email/Helper/Config.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Helper_Config
4
+ {
5
+
6
+ /**
7
+ * API SECTION.
8
+ */
9
+ //API settings
10
+ const XML_PATH_CONNECTOR_API_ENABLED = 'connector_api_credentials/api/enabled';
11
+ const XML_PATH_CONNECTOR_API_USERNAME = 'connector_api_credentials/api/username';
12
+ const XML_PATH_CONNECTOR_API_PASSWORD = 'connector_api_credentials/api/password';
13
+ /**
14
+ * SMS SECTION.
15
+ */
16
+ //enabled
17
+ const XML_PATH_CONNECTOR_SMS_ENABLED_1 = 'connector_sms/sms_one/enabled';
18
+ const XML_PATH_CONNECTOR_SMS_ENABLED_2 = 'connector_sms/sms_two/enabled';
19
+ const XML_PATH_CONNECTOR_SMS_ENABLED_3 = 'connector_sms/sms_three/enabled';
20
+ const XML_PATH_CONNECTOR_SMS_ENABLED_4 = 'connector_sms/sms_four/enabled';
21
+ //status
22
+ const XML_PATH_CONNECTOR_SMS_STATUS_1 = 'connector_sms/sms_one/status';
23
+ const XML_PATH_CONNECTOR_SMS_STATUS_2 = 'connector_sms/sms_two/status';
24
+ const XML_PATH_CONNECTOR_SMS_STATUS_3 = 'connector_sms/sms_three/status';
25
+ const XML_PATH_CONNECTOR_SMS_STATUS_4 = 'connector_sms/sms_four/status';
26
+ //message
27
+ const XML_PATH_CONNECTOR_SMS_MESSAGE_1 = 'connector_sms/sms_one/message';
28
+ const XML_PATH_CONNECTOR_SMS_MESSAGE_2 = 'connector_sms/sms_two/message';
29
+ const XML_PATH_CONNECTOR_SMS_MESSAGE_3 = 'connector_sms/sms_three/message';
30
+ const XML_PATH_CONNECTOR_SMS_MESSAGE_4 = 'connector_sms/sms_four/message';
31
+
32
+ /**
33
+ * SYNC SECTION.
34
+ */
35
+
36
+ const XML_PATH_CONNECTOR_SYNC_CONTACT_ENABLED = 'connector_sync_settings/sync/contact_enabled';
37
+ const XML_PATH_CONNECTOR_SYNC_SUBSCRIBER_ENABLED = 'connector_sync_settings/sync/subscriber_enabled';
38
+ const XML_PATH_CONNECTOR_SYNC_ORDER_ENABLED = 'connector_sync_settings/sync/order_enabled';
39
+ const XML_PATH_CONNECTOR_SYNC_WISHLIST_ENABLED = 'connector_sync_settings/sync/wishlist_enabled';
40
+
41
+ const XML_PATH_CONNECTOR_CUSTOMERS_ADDRESS_BOOK_ID = 'connector_sync_settings/address_book/customers';
42
+ const XML_PATH_CONNECTOR_SUBSCRIBERS_ADDRESS_BOOK_ID = 'connector_sync_settings/address_book/subscribers';
43
+ const XML_PATH_CONNECTOR_GUEST_ADDRESS_BOOK_ID = 'connector_sync_settings/address_book/guests';
44
+ // Mapping
45
+ const XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID = 'connector_data_mapping/customer_data/last_order_id';
46
+ const XML_PATH_CONNECTOR_MAPPING_CUSTOMER_ID = 'connector_data_mapping/customer_data/customer_id';
47
+ const XML_PATH_CONNECTOR_MAPPING_CUSTOM_DATAFIELDS = 'connector_data_mapping/customer_data/custom_attributes';
48
+ const XML_PATH_CONNECTOR_MAPPING_CUSTOMER_STORENAME = 'connector_data_mapping/customer_data/store_name';
49
+ // Dynamic
50
+ const XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE = 'connector_dynamic_content/external_dynamic_content_urls/passcode';
51
+
52
+ /**
53
+ * ADVANCED SECTION.
54
+ */
55
+ const XML_PATH_CONNECTOR_ADVANCED_DEBUG_ENABLED = 'connector_advanced_settings/admin/debug_enabled';
56
+ const XML_PATH_CONNECTOR_SYNC_LIMIT = 'connector_advanced_settings/admin/batch_size';
57
+ const XML_PATH_CONNECTOR_RESOURCE_ALLOCATION = 'connector_advanced_settings/admin/memory_limit';
58
+ const XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT = 'connector_advanced_settings/sync_limits/orders';
59
+ const XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING = 'connector_advanced_settings/admin/inline_styling';
60
+ const XML_PATH_CONNECTOR_RECOMMENDED_STYLING = 'connector_advanced_settings/admin/recommended_inline';
61
+
62
+ /**
63
+ * ROI SECTION.
64
+ */
65
+ const XML_PATH_CONNECTOR_ROI_TRACKING_ENABLED = 'connector_roi_tracking/roi_tracking/enabled';
66
+ const XML_PATH_CONNECTOR_PAGE_TRACKING_ENABLED = 'connector_roi_tracking/page_tracking/enabled';
67
+
68
+
69
+
70
+ }
app/code/community/Dotdigitalgroup/Email/Helper/Data.php ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ public function isEnabled($website = 0)
7
+ {
8
+ $website = Mage::app()->getWebsite($website);
9
+ return (bool)$website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_ENABLED);
10
+ }
11
+
12
+ /**
13
+ * @param int/object $website
14
+ * @return mixed
15
+ */
16
+ public function getApiUsername($website = 0)
17
+ {
18
+ $website = Mage::app()->getWebsite($website);
19
+
20
+ return $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_USERNAME);
21
+ }
22
+
23
+ public function getApiPassword($website = 0)
24
+ {
25
+ $website = Mage::app()->getWebsite($website);
26
+
27
+ return $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_PASSWORD);
28
+ }
29
+
30
+ public function auth($authRequest)
31
+ {
32
+ if($authRequest != Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE)){
33
+ $this->log('Authenication failed : ' . $authRequest);
34
+ exit();
35
+ }
36
+ return true;
37
+ }
38
+
39
+ public function getMappedCustomerId()
40
+ {
41
+ return Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_ID);
42
+ }
43
+
44
+ public function getMappedOrderId()
45
+ {
46
+ return Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID);
47
+ }
48
+
49
+ public function getPasscode()
50
+ {
51
+ return Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE);
52
+ }
53
+
54
+ public function getLastOrderId()
55
+ {
56
+ return Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID);
57
+
58
+ }
59
+
60
+ public function log($data, $level = Zend_Log::DEBUG, $filename = 'api.log')
61
+ {
62
+ if($this->getDebugEnabled()){
63
+ $filename = 'connector_' . $filename;
64
+
65
+ Mage::log($data, $level, $filename, $force = true);
66
+ }
67
+ }
68
+
69
+ public function getDebugEnabled()
70
+ {
71
+ return (bool) Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_ADVANCED_DEBUG_ENABLED);
72
+ }
73
+
74
+ public function getConnectorVersion()
75
+ {
76
+ $modules = (array) Mage::getConfig()->getNode('modules')->children();
77
+ if(isset($modules['Dotdigitalgroup_Email'])){
78
+ $moduleName = $modules['Dotdigitalgroup_Email'];
79
+ return $moduleName->version;
80
+ }
81
+ return '';
82
+ }
83
+
84
+
85
+ public function getPageTrackingEnabled()
86
+ {
87
+ return (bool)Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_PAGE_TRACKING_ENABLED);
88
+ }
89
+
90
+ public function getRoiTrackingEnabled()
91
+ {
92
+ return (bool)Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_ROI_TRACKING_ENABLED);
93
+ }
94
+
95
+ public function getResourceAllocationEnabled()
96
+ {
97
+ return (bool)Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_RESOURCE_ALLOCATION);
98
+ }
99
+
100
+ public function getMappedStoreName($website)
101
+ {
102
+ $mapped = $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_STORENAME);
103
+ $storeName = ($mapped)? $mapped : '';
104
+ return $storeName;
105
+ }
106
+
107
+ /**
108
+ * Get the contact id for the custoemer based on website id.
109
+ * @param $email
110
+ * @param $websiteId
111
+ * @return bool
112
+ */
113
+ public function getContactId($email, $websiteId)
114
+ {
115
+ $client = $this->getWebsiteApiClient($websiteId);
116
+ $response = $client->postContacts($email);
117
+ return $response->id;
118
+ }
119
+
120
+ public function getCustomerAddressBook($website)
121
+ {
122
+ $website = Mage::app()->getWebsite($website);
123
+ return $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_CUSTOMERS_ADDRESS_BOOK_ID);
124
+ }
125
+
126
+ public function getSubscriberAddressBook($website)
127
+ {
128
+ $website = Mage::app()->getWebsite($website);
129
+ return $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SUBSCRIBERS_ADDRESS_BOOK_ID);
130
+ }
131
+
132
+ public function getGuestAddressBook($website)
133
+ {
134
+ $website = Mage::app()->getWebsite($website);
135
+ return $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_GUEST_ADDRESS_BOOK_ID);
136
+ }
137
+
138
+ /**
139
+ * Gets the datafield mapping hash from the system config.
140
+ * @param $website
141
+ * @return array
142
+ */
143
+ public function getMappingHash($website)
144
+ {
145
+ $result = array();
146
+ $website = Mage::app()->getWebsite($website);
147
+ $customerFields = $this->getCustomerDataFields();
148
+ foreach ($customerFields as $field) {
149
+ $path = 'connector_data_mapping/customer_data/' . $field;
150
+ $result[] = $website->getConfig($path);
151
+ }
152
+
153
+ return $result;
154
+ }
155
+
156
+ public function getCustomerDataFields(){
157
+
158
+ return array(
159
+ 'title',
160
+ 'firstname',
161
+ 'lastname',
162
+ 'dob',
163
+ 'gender',
164
+ 'website_name',
165
+ 'store_name',
166
+ 'created_at',
167
+ 'last_logged_date',
168
+ 'customer_group',
169
+ 'billing_address_1',
170
+ 'billing_address_2',
171
+ 'billing_city',
172
+ 'billing_country',
173
+ 'billing_postcode',
174
+ 'billing_telephone',
175
+ 'delivery_address_1',
176
+ 'delivery_address_2',
177
+ 'delivery_city',
178
+ 'delivery_country',
179
+ 'delivery_postcode',
180
+ 'delivery_telephone',
181
+ 'number_of_orders',
182
+ 'average_order_value',
183
+ 'total_spend',
184
+ 'last_order_date',
185
+ 'last_order_id',
186
+ 'customer_id',
187
+ );
188
+ }
189
+
190
+
191
+ /**
192
+ * @return $this
193
+ */
194
+ public function allowResourceFullExecution()
195
+ {
196
+ if($this->getResourceAllocationEnabled()){
197
+
198
+ /* it may be needed to set maximum execution time of the script to longer,
199
+ * like 60 minutes than usual */
200
+ set_time_limit(7200);
201
+
202
+ /* and memory to 512 megabytes */
203
+ ini_set('memory_limit', '512M');
204
+ }
205
+ return $this;
206
+ }
207
+ public function convert($size)
208
+ {
209
+ $unit=array('b','kb','mb','gb','tb','pb');
210
+ return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
211
+ }
212
+
213
+ /**
214
+ * @return string
215
+ */
216
+ public function getStringWebsiteApiAccounts()
217
+ {
218
+ $accounts = array();
219
+ foreach (Mage::app()->getWebsites() as $website) {
220
+ $websiteId = $website->getId();
221
+ $apiUsername = $this->getApiUsername($website);
222
+ $accounts[$apiUsername] = $apiUsername . ', websiteId: ' . $websiteId . ' name ' . $website->getName();
223
+ }
224
+ return implode('</br>', $accounts);
225
+ }
226
+
227
+ public function getCustomAttributes($website = 0)
228
+ {
229
+ $website = Mage::app()->getWebsite($website);
230
+ return unserialize($website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOM_DATAFIELDS));
231
+ }
232
+
233
+ /**
234
+ * @param $path
235
+ * @param null|string|bool|int|Mage_Core_Model_Website $websiteId
236
+ * @return mixed
237
+ */
238
+ public function getWebsiteConfig($path, $websiteId = 0)
239
+ {
240
+ $website = Mage::app()->getWebsite($websiteId);
241
+ return $website->getConfig($path);
242
+ }
243
+
244
+ /**
245
+ * Api client by website.
246
+ * @param int $website
247
+ * @return Dotdigitalgroup_Email_Model_Apiconnector_Client
248
+ */
249
+ public function getWebsiteApiClient($website = 0)
250
+ {
251
+ $client = Mage::getModel('email_connector/apiconnector_client');
252
+ $client->setApiUsername($this->getApiUsername($website))
253
+ ->setApiPassword($this->getApiPassword($website));
254
+
255
+ return $client;
256
+ }
257
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Helper/File.php RENAMED
@@ -1,7 +1,5 @@
1
  <?php
2
- /*
3
- empty helper to keep admin from breaking
4
- */
5
  class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Data
6
  {
7
 
@@ -47,9 +45,9 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
47
 
48
  /**
49
  * Moves the output file from one folder to the next
50
- *
51
- * @param string $source_folder
52
- * @param string $dest_folder
53
  */
54
  public function moveFile($source_folder, $dest_folder, $filename ){
55
 
@@ -155,5 +153,21 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
155
  array_map($class_func, glob($path.'/*')) == @rmdir($path);
156
  }
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
 
 
 
159
  }
1
  <?php
2
+
 
 
3
  class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Data
4
  {
5
 
45
 
46
  /**
47
  * Moves the output file from one folder to the next
48
+ * @param $source_folder
49
+ * @param $dest_folder
50
+ * @param $filename
51
  */
52
  public function moveFile($source_folder, $dest_folder, $filename ){
53
 
153
  array_map($class_func, glob($path.'/*')) == @rmdir($path);
154
  }
155
 
156
+ /**
157
+ * Create an array of columns we have chosen to map in our System->Config
158
+ * @param $website
159
+ * @return array
160
+ */
161
+ public function getCsvHeaderArray($website)
162
+ {
163
+ $website = Mage::app()->getWebsite($website);
164
+ $result = array();
165
+ $result[] = 'Email';
166
+ foreach (Mage::helper('connector')->getMappingHash($website) as $header) {
167
+ if($header != "0") $result[] = $header;
168
+ }
169
+ $result[] = 'emailType';
170
 
171
+ return $result;
172
+ }
173
  }
app/code/community/Dotdigitalgroup/Email/Helper/Recommended.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Helper_Recommended extends Mage_Core_Helper_Abstract
4
+ {
5
+ const XML_PATH_RELATED_PRODUCTS_TYPE = 'connector_dynamic_content/products/related_display_type';
6
+ const XML_PATH_UPSELL_PRODUCTS_TYPE = 'connector_dynamic_content/products/upsell_display_type';
7
+ const XML_PATH_CROSSSELL_PRODUCTS_TYPE = 'connector_dynamic_content/products/crosssell_display_type';
8
+ const XML_PATH_BESTSELLER_PRODUCT_TYPE = 'connector_dynamic_content/products/bestsellers_display_type';
9
+ const XML_PATH_MOSTVIEWED_PRODUCT_TYPE = 'connector_dynamic_content/products/most_viewed_display_type';
10
+ const XML_PATH_RECENTLYVIEWED_PRODUCT_TYPE = 'connector_dynamic_content/products/recently_viewed_display_type';
11
+ const XML_PATH_PRODUCTPUSH_TYPE = 'connector_dynamic_content/manual_product_search/display_type';
12
+
13
+
14
+ const XML_PATH_RELATED_PRODUCTS_ITEMS = 'connector_dynamic_content/products/related_items_to_display';
15
+ const XML_PATH_UPSELL_PRODUCTS_ITEMS = 'connector_dynamic_content/products/upsell_items_to_display';
16
+ const XML_PATH_CROSSSELL_PRODUCTS_ITEMS = 'connector_dynamic_content/products/crosssell_items_to_display';
17
+ const XML_PATH_BESTSELLER_PRODUCT_ITEMS = 'connector_dynamic_content/products/bestsellers_items_to_display';
18
+ const XML_PATH_MOSTVIEWED_PRODUCT_ITEMS = 'connector_dynamic_content/products/most_viewed_items_to_display';
19
+ const XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS = 'connector_dynamic_content/products/recently_viewed_items_to_display';
20
+
21
+ const XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS = 'connector_dynamic_content/manual_product_search/items_to_display';
22
+ const XML_PATH_BESTSELLER_TIME_PERIOD = 'connector_dynamic_content/products/best_time_period';
23
+ const XML_PATH_MOSTVIEWED_TIME_PERIOD = 'connector_dynamic_content/products/most_viewed_time_period';
24
+ const XML_PATH_PRODUCTPUSH_ITEMS = 'connector_dynamic_content/manual_product_search/products_push_items';
25
+ const XML_PATH_FALLBACK_PRODUCTS_ITEMS = 'connector_dynamic_content/fallback_products/product_list';
26
+
27
+ public $periods = array('week', 'month', 'year');
28
+
29
+ /**
30
+ * Dispay type
31
+ * @return mixed|string grid:list
32
+ */
33
+ public function getDisplayType()
34
+ {
35
+ $mode = Mage::app()->getRequest()->getActionName();
36
+ $type = '';
37
+
38
+ switch($mode){
39
+ case 'related':
40
+ $type = $this->getRelatedProductsType();
41
+ break;
42
+ case 'upsell':
43
+ $type = $this->getUpsellProductsType();
44
+ break;
45
+ case 'crosssell':
46
+ $type = $this->getCrosssellProductsType();
47
+ break;
48
+ case 'bestsellers':
49
+ $type = $this->getBestSellerProductsType();
50
+ break;
51
+ case 'mostviewed':
52
+ $type = $this->getMostViewedProductsType();
53
+ break;
54
+ case 'recentlyviewed':
55
+ $type = $this->getRecentlyviewedProductsType();
56
+ break;
57
+ case 'push':
58
+ $type = $this->getProductpushProductsType();
59
+ }
60
+
61
+ return $type;
62
+ }
63
+
64
+ public function getRelatedProductsType()
65
+ {
66
+ return Mage::getStoreConfig(self::XML_PATH_RELATED_PRODUCTS_TYPE);
67
+ }
68
+
69
+ public function getUpsellProductsType()
70
+ {
71
+ return Mage::getStoreConfig(self::XML_PATH_UPSELL_PRODUCTS_TYPE);
72
+
73
+ }
74
+
75
+ public function getCrosssellProductsType()
76
+ {
77
+ return Mage::getStoreConfig(self::XML_PATH_CROSSSELL_PRODUCTS_TYPE);
78
+ }
79
+
80
+ public function getBestSellerProductsType()
81
+ {
82
+ return Mage::getStoreConfig(self::XML_PATH_BESTSELLER_PRODUCT_TYPE);
83
+ }
84
+
85
+ public function getMostViewedProductsType()
86
+ {
87
+ return Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_PRODUCT_TYPE);
88
+ }
89
+
90
+ public function getRecentlyviewedProductsType()
91
+ {
92
+ return Mage::getStoreConfig(self::XML_PATH_RECENTLYVIEWED_PRODUCT_TYPE);
93
+ }
94
+
95
+ public function getProductpushProductsType()
96
+ {
97
+ return Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_TYPE);
98
+ }
99
+
100
+
101
+ /**
102
+ * Limit of products displayed.
103
+ * @param $mode
104
+ * @return int|mixed
105
+ */
106
+ public function getDisplayLimitByMode($mode)
107
+ {
108
+ $result = 0;
109
+ if($mode){
110
+ switch($mode){
111
+ case 'related':
112
+ $result = Mage::getStoreConfig(self::XML_PATH_RELATED_PRODUCTS_ITEMS);
113
+ break;
114
+ case 'upsell':
115
+ $result = Mage::getStoreConfig(self::XML_PATH_UPSELL_PRODUCTS_ITEMS);
116
+ break;
117
+ case 'crosssell':
118
+ $result = Mage::getStoreConfig(self::XML_PATH_CROSSSELL_PRODUCTS_ITEMS);
119
+ break;
120
+ case 'bestsellers':
121
+ $result = Mage::getStoreConfig(self::XML_PATH_BESTSELLER_PRODUCT_ITEMS);
122
+ break;
123
+ case 'mostviewed':
124
+ $result = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_PRODUCT_ITEMS);
125
+ break;
126
+ case 'recentlyviewed':
127
+ $result = Mage::getStoreConfig(self::XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS);
128
+ break;
129
+ case 'push':
130
+ $result = Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS);
131
+ }
132
+ }
133
+
134
+ return $result;
135
+ }
136
+
137
+ public function getFallbackIds(){
138
+ $fallbackIds = Mage::getStoreConfig(self::XML_PATH_FALLBACK_PRODUCTS_ITEMS);
139
+ if($fallbackIds)
140
+ return explode(',', Mage::getStoreConfig(self::XML_PATH_FALLBACK_PRODUCTS_ITEMS));
141
+ return array();
142
+ }
143
+
144
+ public function getTimeFromConfig($config)
145
+ {
146
+ $now = new Zend_Date();
147
+ $period = '';
148
+ if($config == 'mostviewed')
149
+ $period = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_TIME_PERIOD);
150
+ elseif($config == 'bestsellers')
151
+ $period = Mage::getStoreConfig(self::XML_PATH_BESTSELLER_TIME_PERIOD);
152
+ elseif($config == 'recentlyviewed')
153
+ $period = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_TIME_PERIOD);
154
+
155
+ if($period == 'week'){
156
+ $sub = Zend_Date::WEEK;
157
+ }elseif($period == 'month'){
158
+ $sub = Zend_Date::MONTH;
159
+ }elseif($period == 'year'){
160
+ $sub = Zend_Date::YEAR;
161
+ }
162
+
163
+ if(isset($sub)){
164
+ $period = $now->sub(1, $sub);
165
+
166
+ return $period->tostring(Zend_Date::ISO_8601);
167
+ }
168
+ }
169
+
170
+ public function getProductPushIds()
171
+ {
172
+ $productIds = Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_ITEMS);
173
+
174
+ return explode(',', $productIds);
175
+ }
176
+
177
+ }
app/code/community/Dotdigitalgroup/Email/Helper/Transactional.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Helper_Transactional extends Mage_Core_Helper_Abstract
4
+ {
5
+ const XML_PATH_TRANSACTIONAL_API_ENABLED = 'connector_transactional_emails/credentials/enabled';
6
+ const XML_PATH_TRANSACTIONAL_API_USERNAME = 'connector_transactional_emails/credentials/api_username';
7
+ const XML_PATH_TRANSACTIONAL_API_PASSWORD = 'connector_transactional_emails/credentials/api_password';
8
+ const XML_PATH_TRANSACTIONAL_MAPPING = 'connector_transactional_emails/email_mapping/';
9
+
10
+
11
+
12
+ public function isEnabled()
13
+ {
14
+ return Mage::getStoreConfig(self::XML_PATH_TRANSACTIONAL_API_ENABLED);
15
+ }
16
+
17
+ public function getApiUsername($website = 0)
18
+ {
19
+ $website = Mage::app()->getWebsite($website);
20
+
21
+ return $website->getConfig(self::XML_PATH_TRANSACTIONAL_API_USERNAME);
22
+ }
23
+
24
+ public function getApiPassword($website = 0)
25
+ {
26
+ $website = Mage::app()->getWebsite($website);
27
+
28
+ return $website->getConfig(self::XML_PATH_TRANSACTIONAL_API_PASSWORD);
29
+ }
30
+
31
+ public function getWebsiteByName($websiteName)
32
+ {
33
+ $website = Mage::getModel('core/website')->getCollection()
34
+ ->addFieldToFilter('code', $websiteName)->getFirstItem();
35
+
36
+ return $website;
37
+ }
38
+
39
+ /**
40
+ * Check if the template is mapped
41
+ * @param $templateId
42
+ * @return bool
43
+ */
44
+ public function isMapped($templateId)
45
+ {
46
+ $path = self::XML_PATH_TRANSACTIONAL_MAPPING . $templateId;
47
+
48
+ return '0' != Mage::getStoreConfig($path);
49
+ }
50
+
51
+ /**
52
+ * transactional mapped campaign id
53
+ * @param $templateId
54
+ * @param int $storeId
55
+ * @return mixed
56
+ */
57
+ public function getTransactionalCampaignId($templateId, $storeId = 0)
58
+ {
59
+ $path = self::XML_PATH_TRANSACTIONAL_MAPPING . $templateId;
60
+
61
+ return Mage::getStoreConfig($path, $storeId);
62
+ }
63
+
64
+ /**
65
+ * Get the contact id for the custoemer based on website id.
66
+ * @param $email
67
+ * @param $websiteId
68
+ * @return bool
69
+ */
70
+ public function getContactId($email, $websiteId)
71
+ {
72
+ $client = $this->getWebsiteApiClient($websiteId);
73
+ $response = $client->postContacts($email);
74
+ if(isset($response->message))
75
+ return $response->message;
76
+ return $response->id;
77
+ }
78
+
79
+ public function updateContactData($contacData)
80
+ {
81
+ $client = $this->getWebsiteApiClient($contacData->getWebsite());
82
+ $email = $contacData->getCustomerEmail();
83
+ /**
84
+ * Transactional account data default datafields.
85
+ */
86
+ $data = array(
87
+ array(
88
+ 'Key' => 'LAST_ORDER_ID',
89
+ 'Value' => $contacData->getOrderId()),
90
+ array(
91
+ 'Key' => 'CUSTOMER_ID',
92
+ 'Value' => $contacData->getCustomerId()),
93
+ array(
94
+ 'Key' => 'ORDER_INCREMENT_ID',
95
+ 'Value' => $contacData->getOrderIncrementId()),
96
+ array(
97
+ 'Key' => 'WEBSITE_NAME',
98
+ 'Value' => $contacData->getWebsiteName()),
99
+ array(
100
+ 'Key' => 'STORE_NAME',
101
+ 'Value' => $contacData->getStoreName()),
102
+ array(
103
+ 'Key' => 'LAST_ORDER_DATE',
104
+ 'Value' => $contacData->getOrderDate())
105
+ );
106
+
107
+
108
+ $client->updateContactDatafieldsByEmail($email, $data);
109
+ }
110
+
111
+ /**
112
+ * Api client by website.
113
+ * @param int $website
114
+ * @return Dotdigitalgroup_Email_Model_Apiconnector_Client
115
+ */
116
+ public function getWebsiteApiClient($website = 0)
117
+ {
118
+ $client = Mage::getModel('email_connector/apiconnector_client');
119
+ $website = Mage::app()->getWebsite($website);
120
+ if($website) {
121
+ $client->setApiUsername($this->getApiUsername($website))
122
+ ->setApiPassword($this->getApiPassword($website));
123
+ }
124
+ return $client;
125
+ }
126
+
127
+
128
+ }
app/code/{local/Dotdigitalgroup/Email/Helper/Api/Restrequest.php → community/Dotdigitalgroup/Email/Model/Abstract/Rest.php} RENAMED
@@ -1,25 +1,25 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email_Helper_Data
4
  {
5
  protected $url;
6
  protected $verb;
7
  protected $requestBody;
8
  protected $requestLength;
9
- protected $username;
10
- protected $password;
11
  protected $acceptType;
12
  protected $responseBody;
13
  protected $responseInfo;
14
 
15
- public function __construct() // ($url = null, $verb = 'GET', $requestBody = null)
16
  {
17
  $this->url = null; //$url;
18
- $this->verb = null; //$verb;
19
  $this->requestBody = null; //$requestBody;
20
  $this->requestLength = 0;
21
- $this->username = Mage::getStoreConfig('connector_api_settings/api_credentials/username');
22
- $this->password = Mage::getStoreConfig('connector_api_settings/api_credentials/password');
23
  $this->acceptType = 'application/json';
24
  $this->responseBody = null;
25
  $this->responseInfo = null;
@@ -28,11 +28,9 @@ class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email
28
  {
29
  $this->buildPostBody();
30
  }
31
-
32
- //parent::__construct();
33
  }
34
 
35
- private function prettyPrint( $json )
36
  {
37
  $result = '';
38
  $level = 0;
@@ -107,18 +105,20 @@ class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email
107
 
108
  public function flush ()
109
  {
 
 
110
  $this->requestBody = null;
111
  $this->requestLength = 0;
112
  $this->verb = 'GET';
113
  $this->responseBody = null;
114
  $this->responseInfo = null;
 
115
  }
116
 
117
- public function execute ()
118
  {
119
  $ch = curl_init();
120
  $this->setAuth($ch);
121
-
122
  try
123
  {
124
  switch (strtoupper($this->verb))
@@ -150,26 +150,22 @@ class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email
150
  throw $e;
151
  }
152
 
 
153
  }
154
 
155
  public function buildPostBody($data = null)
156
  {
157
- $data = ($data !== null)? $data : $this->requestBody;
158
-
159
- if (!is_array($data)){
160
- throw new InvalidArgumentException('Invalid data input for postBody. Array expected');
161
- }
162
 
163
- $data = http_build_query($data, '', '&');
164
- $this->requestBody = $data;
165
  }
166
 
167
- protected function executeGet ($ch)
168
  {
169
  $this->doExecute($ch);
170
  }
171
 
172
- protected function executePost ($ch)
173
  {
174
  if (!is_string($this->requestBody))
175
  {
@@ -177,10 +173,17 @@ class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email
177
  }
178
 
179
  curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
180
- curl_setopt($ch, CURLOPT_POST, 1);
181
 
182
  $this->doExecute($ch);
183
  }
 
 
 
 
 
 
 
184
 
185
  protected function executePut($ch)
186
  {
@@ -203,87 +206,92 @@ class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email
203
  fclose($fh);
204
  }
205
 
206
- protected function executeDelete ($ch)
207
  {
208
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
209
 
210
  $this->doExecute($ch);
211
  }
212
 
213
- protected function doExecute (&$curlHandle)
214
  {
215
- $this->setCurlOpts($curlHandle);
216
- $this->responseBody = curl_exec($curlHandle);
217
- $this->responseInfo = curl_getinfo($curlHandle);
218
 
219
- curl_close($curlHandle);
220
  }
221
 
222
- protected function setCurlOpts (&$curlHandle)
223
  {
224
- curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
225
- curl_setopt($curlHandle, CURLOPT_URL, $this->url);
226
- curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
227
- curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType ,'Content-Type: application/json'));
 
 
228
  }
229
 
230
- protected function setAuth (&$curlHandle)
231
  {
232
- if ($this->username !== null && $this->password !== null)
233
  {
234
- curl_setopt($curlHandle, CURLAUTH_BASIC, CURLAUTH_DIGEST);
235
- curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
236
  }
237
  }
238
 
239
- public function getAcceptType ()
240
  {
241
  return $this->acceptType;
242
  }
243
 
244
- public function setAcceptType ($acceptType)
245
  {
246
  $this->acceptType = $acceptType;
247
  }
248
 
249
- public function getPassword ()
250
  {
251
- return $this->password;
252
  }
253
 
254
- public function setPassword ($password)
255
  {
256
- $this->password = $password;
 
257
  }
258
 
259
- public function getResponseBody ()
260
  {
261
  return $this->responseBody;
262
  }
263
 
264
- public function getResponseInfo ()
265
  {
266
  return $this->responseInfo;
267
  }
268
 
269
- public function getUrl ()
270
  {
271
  return $this->url;
272
  }
273
 
274
- public function setUrl ($url)
275
  {
276
  $this->url = $url;
 
277
  }
278
 
279
- public function getUsername ()
280
  {
281
- return $this->username;
282
  }
283
 
284
- public function setUsername ($username)
285
  {
286
- $this->username = $username;
 
287
  }
288
 
289
  public function getVerb ()
@@ -294,5 +302,6 @@ class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email
294
  public function setVerb ($verb)
295
  {
296
  $this->verb = $verb;
 
297
  }
298
  }
1
  <?php
2
 
3
+ abstract class Dotdigitalgroup_Email_Model_Abstract_Rest
4
  {
5
  protected $url;
6
  protected $verb;
7
  protected $requestBody;
8
  protected $requestLength;
9
+ protected $_apiUsername;
10
+ protected $_apiPassword;
11
  protected $acceptType;
12
  protected $responseBody;
13
  protected $responseInfo;
14
 
15
+ public function __construct($website = 0) // ($url = null, $verb = 'GET', $requestBody = null)
16
  {
17
  $this->url = null; //$url;
18
+ $this->verb = 'GET'; //$verb;
19
  $this->requestBody = null; //$requestBody;
20
  $this->requestLength = 0;
21
+ $this->_apiUsername = (string)Mage::helper('connector')->getApiUsername($website);
22
+ $this->_apiPassword = (string)Mage::helper('connector')->getApiPassword($website);
23
  $this->acceptType = 'application/json';
24
  $this->responseBody = null;
25
  $this->responseInfo = null;
28
  {
29
  $this->buildPostBody();
30
  }
 
 
31
  }
32
 
33
+ private function prettyPrint($json)
34
  {
35
  $result = '';
36
  $level = 0;
105
 
106
  public function flush ()
107
  {
108
+ $this->_apiUsername = '';
109
+ $this->_apiPassword = '';
110
  $this->requestBody = null;
111
  $this->requestLength = 0;
112
  $this->verb = 'GET';
113
  $this->responseBody = null;
114
  $this->responseInfo = null;
115
+ return $this;
116
  }
117
 
118
+ public function execute()
119
  {
120
  $ch = curl_init();
121
  $this->setAuth($ch);
 
122
  try
123
  {
124
  switch (strtoupper($this->verb))
150
  throw $e;
151
  }
152
 
153
+ return $this->responseBody;
154
  }
155
 
156
  public function buildPostBody($data = null)
157
  {
 
 
 
 
 
158
 
159
+ $this->requestBody = json_encode($data);
160
+ return $this;
161
  }
162
 
163
+ protected function executeGet($ch)
164
  {
165
  $this->doExecute($ch);
166
  }
167
 
168
+ protected function executePost($ch)
169
  {
170
  if (!is_string($this->requestBody))
171
  {
173
  }
174
 
175
  curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
176
+ curl_setopt($ch, CURLOPT_POST, true);
177
 
178
  $this->doExecute($ch);
179
  }
180
+ protected function buildPostBodyFromFile($filename){
181
+
182
+ $this->requestBody = array (
183
+ 'file' => '@'.$filename
184
+ );
185
+
186
+ }
187
 
188
  protected function executePut($ch)
189
  {
206
  fclose($fh);
207
  }
208
 
209
+ protected function executeDelete($ch)
210
  {
211
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
212
 
213
  $this->doExecute($ch);
214
  }
215
 
216
+ protected function doExecute(&$ch)
217
  {
218
+ $this->setCurlOpts($ch);
219
+ $this->responseBody = json_decode(curl_exec($ch));
220
+ $this->responseInfo = curl_getinfo($ch);
221
 
222
+ curl_close($ch);
223
  }
224
 
225
+ protected function setCurlOpts(&$ch)
226
  {
227
+ curl_setopt($ch, CURLOPT_TIMEOUT, 10);
228
+ curl_setopt($ch, CURLOPT_URL, $this->url);
229
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
230
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
231
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
232
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType ,'Content-Type: application/json'));
233
  }
234
 
235
+ protected function setAuth(&$ch)
236
  {
237
+ if ($this->_apiUsername !== null && $this->_apiPassword !== null)
238
  {
239
+ curl_setopt($ch, CURLAUTH_BASIC, CURLAUTH_DIGEST);
240
+ curl_setopt($ch, CURLOPT_USERPWD, $this->_apiUsername . ':' . $this->_apiPassword);
241
  }
242
  }
243
 
244
+ public function getAcceptType()
245
  {
246
  return $this->acceptType;
247
  }
248
 
249
+ public function setAcceptType($acceptType)
250
  {
251
  $this->acceptType = $acceptType;
252
  }
253
 
254
+ public function getApiPassword()
255
  {
256
+ return $this->_apiPassword;
257
  }
258
 
259
+ public function setApiPassword($apiPassword)
260
  {
261
+ $this->_apiPassword = $apiPassword;
262
+ return $this;
263
  }
264
 
265
+ public function getResponseBody()
266
  {
267
  return $this->responseBody;
268
  }
269
 
270
+ public function getResponseInfo()
271
  {
272
  return $this->responseInfo;
273
  }
274
 
275
+ public function getUrl()
276
  {
277
  return $this->url;
278
  }
279
 
280
+ public function setUrl($url)
281
  {
282
  $this->url = $url;
283
+ return $this;
284
  }
285
 
286
+ public function getApiUsername()
287
  {
288
+ return $this->_apiUsername;
289
  }
290
 
291
+ public function setApiUsername($apiUsername)
292
  {
293
+ $this->_apiUsername = $apiUsername;
294
+ return $this;
295
  }
296
 
297
  public function getVerb ()
302
  public function setVerb ($verb)
303
  {
304
  $this->verb = $verb;
305
+ return $this;
306
  }
307
  }
app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Observer.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Observer
4
+ {
5
+
6
+ /**
7
+ * API Sync and Data Mapping.
8
+ * Reset contacts for reimport.
9
+ * @param Varien_Event_Observer $observer
10
+ * @return $this
11
+ */
12
+ public function actionConfigResetContacts(Varien_Event_Observer $observer)
13
+ {
14
+ $contactModel = Mage::getModel('email_connector/contact');
15
+ $numImported = $contactModel->getNumberOfImportedContacs();
16
+ $updated = $contactModel->resetAllContacts();
17
+ Mage::helper('connector')->log('-- Imported contacts: ' . $numImported . ' reseted : ' . $updated . '--');
18
+
19
+ return $this;
20
+ }
21
+
22
+ /**
23
+ * API Transactional Section.
24
+ * Default data fields for transactional account.
25
+ * @param Varien_Event_Observer $observer
26
+ * @return $this
27
+ */
28
+ public function actionConfigTransactional(Varien_Event_Observer $observer)
29
+ {
30
+ $client = Mage::getModel('email_connector/apiconnector_client');
31
+ $username = Mage::helper('connector/transactional')->getApiUsername();
32
+ $password = Mage::helper('connector/transactional')->getApiPassword();
33
+ $client->setApiUsername($username)->setApiPassword($password);
34
+ $dataFields = Mage::getModel('email_connector/connector_datafield')->getTransactionalDefaultDatafields();
35
+
36
+ foreach ($dataFields as $field) {
37
+ //create the datafields
38
+ $client->postDataFields($field);
39
+ }
40
+ return $this;
41
+ }
42
+
43
+ /**
44
+ * API Credentials.
45
+ * Installation and validation confirmation.
46
+ * @param Varien_Event_Observer $observer
47
+ * @return $this
48
+ */
49
+ public function actionConfigSaveApi(Varien_Event_Observer $observer)
50
+ {
51
+ $groups = Mage::app()->getRequest()->getPost('groups');
52
+ if(isset($groups['api']['fields']['username']['inherit']) || isset($groups['api']['fields']['password']['inherit']))
53
+ return $this;
54
+
55
+ $apiUsername = isset($groups['api']['fields']['username']['value'])? $groups['api']['fields']['username']['value'] : false;
56
+ $apiPassword = isset($groups['api']['fields']['password']['value'])? $groups['api']['fields']['password']['value'] : false;
57
+ //skip if the inherit option is selected
58
+ if($apiUsername && $apiPassword){
59
+ Mage::helper('connector')->log('----VALIDATING ACCOUNT---');
60
+ $testModel = Mage::getModel('email_connector/apiconnector_test');
61
+ $isValid = $testModel->validate($apiUsername, $apiPassword);
62
+ if($isValid){
63
+ /**
64
+ * Create account contact datafields
65
+ */
66
+ $client = Mage::getModel('email_connector/apiconnector_client')->setApiUsername($apiUsername)
67
+ ->setApiPassword($apiPassword);
68
+ $datafields = Mage::getModel('email_connector/connector_datafield')->getDefaultDataFields();
69
+ foreach ($datafields as $datafield) {
70
+ $client->postDataFields($datafield);
71
+ }
72
+ /**
73
+ * Send install info
74
+ */
75
+ $testModel->sendInstallConfirmation();
76
+ }else{
77
+ /**
78
+ * Disable invalid Api credentials
79
+ */
80
+ $scopeId = 0;
81
+ if($website = Mage::app()->getRequest()->getParam('website')) {
82
+ $scope = 'websites';
83
+ $scopeId = Mage::app()->getWebsite($website)->getId();
84
+ }else {
85
+ $scope = "default";
86
+ }
87
+ $config = Mage::getConfig();
88
+ $config->saveConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_ENABLED, 0, $scope, $scopeId);
89
+ $config->cleanCache();
90
+ }
91
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('connector')->__('API Credentials Valid.'));
92
+ }
93
+ return $this;
94
+ }
95
+ }
app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Addressbooks.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Addressbooks
4
+ {
5
+ // Returns the account's datafields
6
+ public function toOptionArray()
7
+ {
8
+ $fields = array();
9
+
10
+ $website = Mage::app()->getRequest()->getParam('website');
11
+ $client = Mage::getModel('email_connector/apiconnector_client');
12
+
13
+ $client->setApiUsername(Mage::helper('connector')->getApiUsername($website));
14
+ $client->setApiPassword(Mage::helper('connector')->getApiPassword($website));
15
+
16
+ // Add a "Do Not Map" Option
17
+ $fields[] = array('value' => 0, 'label' => Mage::helper('connector')->__('-- Please Select --'));
18
+ $savedAddressBooks = Mage::registry('addressbooks');
19
+ if($savedAddressBooks){
20
+ $addressBooks = $savedAddressBooks;
21
+ }else{
22
+ // api all address books
23
+ $addressBooks = $client->getAddressBooks();
24
+ Mage::register('addressbooks', $addressBooks);
25
+ }
26
+
27
+ if(isset($addressBooks->message)){
28
+ $fields[] = array('value' => 0, 'label' => Mage::helper('connector')->__('-- Please Select --'));
29
+ }
30
+
31
+ //set up fields with book id and label
32
+ foreach ($addressBooks as $book){
33
+ if(isset($book->id))
34
+ $fields[] = array('value' => $book->id, 'label' => $book->name);
35
+ }
36
+
37
+ return $fields;
38
+ }
39
+
40
+ }
app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source/Orderlimit.php → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Advanced/Transdata.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_Orderlimit
4
  {
5
  /**
6
  * @return array
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Advanced_Transdata
4
  {
5
  /**
6
  * @return array
app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Campaigns.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Campaigns
4
+ {
5
+
6
+ // Returns the account's datafields
7
+ public function toOptionArray()
8
+ {
9
+ $fields = array();
10
+ $websiteName = Mage::app()->getRequest()->getParam('website', false);
11
+ //admin
12
+ $website = 0;
13
+ if($websiteName){
14
+ $website = Mage::app()->getWebsite($websiteName);
15
+ }
16
+ $client = Mage::helper('connector')->getWebsiteApiClient($website);
17
+
18
+
19
+ $savedCampaigns = Mage::registry('savedcampigns');
20
+
21
+ if($savedCampaigns){
22
+ $campaigns = $savedCampaigns;
23
+ }else{
24
+ $campaigns = $client->getCampaigns();
25
+ Mage::register('savedcampigns', $campaigns);
26
+ }
27
+
28
+ $fields[] = array('value' => '0', 'label' => Mage::helper('connector')->__('-- Please Select --'));
29
+
30
+ foreach ($campaigns as $one){
31
+ if(isset($one->id))
32
+ $fields[] = array('value' => $one->id, 'label' => Mage::helper('connector')->__($one->name));
33
+ }
34
+
35
+ return $fields;
36
+ }
37
+
38
+ }
app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Customer/Attributes/Select.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Customer_Attributes_Select
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+
8
+ $options = array();
9
+ //exclude attributes from mapping
10
+ $excluded =
11
+ array('created_at', 'created_in', 'dob', 'dotmailer_contact_id', 'email', 'firstname', 'lastname', 'gender',
12
+ 'group_id', 'password_hash', 'prefix', 'rp_token', 'rp_token_create_at', 'website_id');
13
+ $attributes = Mage::getModel('customer/customer')->getAttributes();
14
+
15
+ foreach($attributes as $attribute){
16
+ if($attribute->getFrontendLabel()){
17
+ $code = $attribute->getAttributeCode();
18
+ if(!in_array($code, $excluded))
19
+ $options[] = array(
20
+ 'value' => $attribute->getAttributeCode(),
21
+ 'label' => $attribute->getFrontendLabel()
22
+ );
23
+ }
24
+ }
25
+
26
+ return $options;
27
+ }
28
+ }
app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Datafields.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Datafields
4
+ {
5
+ /**
6
+ * Returns the account's datafields.
7
+ * @return array
8
+ */
9
+ public function toOptionArray()
10
+ {
11
+ $fields = array();
12
+ $helper = Mage::helper('connector');
13
+
14
+ $website = Mage::app()->getRequest()->getParam('website');
15
+ $client = Mage::getModel('email_connector/apiconnector_client');
16
+
17
+ $client->setApiUsername($helper->getApiUsername($website));
18
+ $client->setApiPassword($helper->getApiPassword($website));
19
+
20
+
21
+ /**
22
+ * api get all datafields
23
+ */
24
+ $savedDatafields = Mage::registry('datafields');
25
+ if($savedDatafields){
26
+ $datafields = $savedDatafields;
27
+ }else{
28
+ $datafields = $client->getDataFields();
29
+ Mage::register('datafields', $datafields);
30
+ }
31
+
32
+ // Add a "Do Not Map" Option
33
+ $fields[] = array('value' => 0, 'label' => Mage::helper('connector')->__('-- Please Select --'));
34
+
35
+ if(isset($datafields->message)){
36
+ $fields[] = array('value' => 0, 'label' => $datafields->message);
37
+ }
38
+
39
+
40
+ foreach ($datafields as $datafield) {
41
+ if(isset($datafield->name))
42
+ $fields[] = array('value' => $datafield->name, 'label' => $datafield->name);
43
+ }
44
+
45
+ return $fields;
46
+ }
47
+
48
+
49
+ }
app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Datamapping/Datafieldtype.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Datamapping_Datafieldtype
4
+ {
5
+ /**
6
+ * Datafield model type.
7
+ * Data mapping.
8
+ * @return array
9
+ */
10
+ public function toOptionArray()
11
+ {
12
+ $dataType = array(
13
+ array('value' => 'String','label' => Mage::helper('connector')->__('String')),
14
+ array('value' => 'Numeric', 'label' => Mage::helper('connector')->__('Numeric')),
15
+ array('value' => 'Date', 'label' => Mage::helper('connector')->__('Date')),
16
+ array('value' => 'Boolean', 'label' => Mage::helper('connector')->__('Boolean'))
17
+ );
18
+
19
+ return $dataType;
20
+ }
21
+
22
+ }
app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Dynamic}/Displaytype.php RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_Displaytype
4
  {
5
  public function toOptionArray()
6
  {
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Dynamic_Displaytype
4
  {
5
  public function toOptionArray()
6
  {
app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Dynamic}/Gridview.php RENAMED
@@ -1,7 +1,10 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_Gridview
4
  {
 
 
 
5
  public function toOptionArray()
6
  {
7
  return array(
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Dynamic_Gridview
4
  {
5
+ /**
6
+ * @return array
7
+ */
8
  public function toOptionArray()
9
  {
10
  return array(
app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Lostbaskets/Interval.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Lostbaskets_Interval
4
+ {
5
+
6
+ /**
7
+ * available times
8
+ * @var array
9
+ */
10
+ protected $_times = array(1,2,3,4,5,6,12,36,48,60,72,84,96,108,120);
11
+
12
+
13
+ /**
14
+ * send to campain options hours
15
+ * @return array
16
+ */
17
+ public function toOptionArray()
18
+ {
19
+ $result = $row = array();
20
+ $i = 0;
21
+ foreach($this->_times as $one){
22
+
23
+ if($i == 0)
24
+ $row = array(
25
+ 'value' => $one,
26
+ 'label' => Mage::helper('connector')->__($one . ' Hour')
27
+ );
28
+ else
29
+ $row = array(
30
+ 'value' => $one,
31
+ 'label' => Mage::helper('connector')->__($one . ' Hours')
32
+ );
33
+ $result[] = $row;
34
+ }
35
+
36
+ return $result;
37
+ }
38
+ }
app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source/Lostbasket.php → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Lostbaskets/Intervalminute.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_Lostbasket
4
  {
5
  /**
6
  * lost basket hour options
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Lostbaskets_Intervalminute
4
  {
5
  /**
6
  * lost basket hour options
app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Transactional/Campaigns.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Adminhtml_Source_Transactional_Campaigns
4
+ {
5
+
6
+ // Returns the account's datafields
7
+ public function toOptionArray()
8
+ {
9
+ $fields = array();
10
+ $client = Mage::getModel('email_connector/apiconnector_client');
11
+
12
+ $websiteName = Mage::app()->getRequest()->getParam('website', false);
13
+ if($websiteName){
14
+ $website = Mage::app()->getWebsite($websiteName);
15
+ }else{
16
+ $website = 0;
17
+ }
18
+ $client->setApiUsername(Mage::helper('connector/transactional')->getApiUsername($website));
19
+ $client->setApiPassword(Mage::helper('connector/transactional')->getApiPassword($website));
20
+
21
+ $savedCampaigns = Mage::registry('savedcampigns');
22
+
23
+ if($savedCampaigns){
24
+ $campaigns = $savedCampaigns;
25
+ }else{
26
+ $campaigns = $client->getCampaigns();
27
+ Mage::register('savedcampigns', $campaigns);
28
+ }
29
+
30
+ $fields[] = array('value' => '0', 'label' => Mage::helper('connector')->__('-- Use system default --'));
31
+ foreach ($campaigns as $one){
32
+ if(isset($one->id))
33
+ $fields[] = array('value' => $one->id, 'label' => Mage::helper('connector')->__($one->name));
34
+ }
35
+
36
+ return $fields;
37
+ }
38
+
39
+ }
app/code/community/Dotdigitalgroup/Email/Model/Apiconnector/Client.php ADDED
@@ -0,0 +1,652 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Apiconnector_Client extends Dotdigitalgroup_Email_Model_Abstract_Rest
4
+ {
5
+ const APICONNECTOR_VERSION = 'V2';
6
+
7
+ const REST_WAIT_UPLOAD_TIME = 5;
8
+ //rest api data
9
+ const REST_ACCOUNT_INFO = 'https://apiconnector.com/v2/account-info';
10
+ const REST_CONTACTS = 'https://apiconnector.com/v2/contacts/';
11
+ const REST_CONTACTS_IMPORT = 'https://apiconnector.com/v2/contacts/import/';
12
+ const REST_ADDRESS_BOOKS = 'https://apiconnector.com/v2/address-books/';
13
+ const REST_DATA_FILEDS = 'https://apiconnector.com/v2/data-fields';
14
+ const REST_TRANSACTIONAL_DATA_IMPORT = 'https://apiconnector.com/v2/contacts/transactional-data/import/';
15
+ const REST_TRANSACTIONAL_DATA = 'https://apiconnector.com/v2/contacts/transactional-data/';
16
+ const REST_CAMPAIGN_SEND = 'https://apiconnector.com/v2/campaigns/send';
17
+ const REST_CONTACTS_SUPPRESSED_SINCE = 'https://apiconnector.com/v2/contacts/suppressed-since/';
18
+ const REST_DATA_FIELDS_CAMPAIGNS = 'https://apiconnector.com/v2/campaigns';
19
+ const REST_SMS_MESSAGE_SEND_TO = 'https://apiconnector.com/v2/sms-messages/send-to/';
20
+ //rest error responces
21
+ const REST_CONTACT_NOT_FOUND = 'Error: ERROR_CONTACT_NOT_FOUND';
22
+ const REST_SEND_MULTI_TRANSACTIONAL_DATA = 'Error: ERROR_FEATURENOTACTIVE';
23
+ const REST_STATUS_IMPORT_REPORT_NOT_FOUND = 'Import is not processed yet or completed with error. ERROR_IMPORT_REPORT_NOT_FOUND';
24
+ const REST_STATUS_REPORT_NOTFINISHED = 'NotFinished';
25
+ const REST_TRANSACTIONAL_DATA_NOT_EXISTS = 'Error: ERROR_TRANSACTIONAL_DATA_DOES_NOT_EXIST';
26
+ const REST_API_USAGE_EXCEEDED = 'Your account has generated excess API activity and is being temporarily capped. Please contact support. ERROR_APIUSAGE_EXCEEDED';
27
+ const REST_API_EMAIL_NOT_VALID = 'Email is not a valid email address. ERROR_PARAMETER_INVALID';
28
+ const REST_API_DATAFILEDS_EXISTS = 'Field already exists. ERROR_NON_UNIQUE_DATAFIELD';
29
+
30
+ protected $_customers_file_slug = 'customer_sync';
31
+ protected $_subscribers_file_slug = 'subscriber_sync';
32
+ protected $_api_helper;
33
+ protected $_subscribers_address_book_id;
34
+ protected $_customers_address_book_id;
35
+ protected $_filename;
36
+ protected $_subscribers_filename;
37
+ protected $_customers_filename;
38
+ protected $_limit = 10;
39
+ protected $_address_book_id;
40
+ public $fileHelper; /** @var Dotdigitalgroup_Email_Helper_File */
41
+ public $result = array('error' => false, 'message' => '');
42
+
43
+
44
+
45
+ public function __construct(){
46
+ parent::__construct();
47
+ }
48
+
49
+ /**
50
+ * @param $apiUsername
51
+ * @param $apiPassword
52
+ * @return bool|mixed
53
+ */
54
+ public function validate($apiUsername, $apiPassword)
55
+ {
56
+ if($apiUsername && $apiPassword){
57
+ $this->setApiUsername($apiUsername)
58
+ ->setApiPassword($apiPassword);
59
+ $accountInfo = $this->getAccountInfo();
60
+ if(isset($accountInfo->message)){
61
+ Mage::getSingleton('adminhtml/session')->addError($accountInfo->message);
62
+ Mage::helper('connector')->log('VALIDATION ERROR : ' . $accountInfo->message);
63
+ return false;
64
+ }
65
+ return $accountInfo;
66
+ }
67
+ return false;
68
+ }
69
+ /**
70
+ * Gets a contact by ID. Unsubscribed or suppressed contacts will not be retrieved.
71
+ * @param $id
72
+ * @return null
73
+ */
74
+ public function getContactById($id)
75
+ {
76
+ $url = self::REST_CONTACTS . $id;
77
+
78
+ $this->setUrl($url)
79
+ ->setVerb('GET');
80
+ $response = $this->execute();
81
+ if(isset($response->message))
82
+ Mage::helper('connector')->log('GET CONTACT INFO ID ' . $url . ', ' . $response->message);
83
+
84
+ return $response;
85
+ }
86
+
87
+ /**
88
+ * * Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel.
89
+ * Must include one column called "Email". Any other columns will attempt to map to your custom data fields.
90
+ * The ID of returned object can be used to query import progress.
91
+ * @param $filename
92
+ * @param $addressBookId
93
+ * @return mixed
94
+ */
95
+ public function postAddressBookContactsImport($filename, $addressBookId)
96
+ {
97
+ $url = "https://apiconnector.com/v2/address-books/{$addressBookId}/contacts/import";
98
+ $helper = Mage::helper('connector');
99
+
100
+ $ch = curl_init($url);
101
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
102
+ curl_setopt($ch, CURLOPT_USERPWD, $this->getApiUsername() . ':' . $this->getApiPassword());
103
+ curl_setopt($ch, CURLOPT_POSTFIELDS, array (
104
+ 'file' => '@'.Mage::helper('connector/file')->getFilePath($filename)
105
+ ));
106
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
107
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
108
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
109
+ 'Content-Type: multipart/form-data')
110
+ );
111
+
112
+ // send contacts to address book
113
+ $result = curl_exec($ch);
114
+ $result = json_decode($result);
115
+ if(isset($result->message)){
116
+ $helper->log('POST ADDRESS BOOK ' . $addressBookId . ', CONTACT IMPORT : ' . ' filename ' . $filename . ' Username ' . $this->getApiUsername() . $result->message);
117
+ Mage::helper('connector')->log($result);
118
+ }
119
+
120
+ return $result;
121
+ }
122
+
123
+ /**
124
+ * Adds a contact to a given address book.
125
+ * @param $addressBookId
126
+ * @param $apiContact
127
+ * @return mixed|null
128
+ */
129
+ public function postAddressBookContacts($addressBookId, $apiContact)
130
+ {
131
+ $url = self::REST_ADDRESS_BOOKS . $addressBookId . '/contacts';
132
+ $this->setUrl($url)
133
+ ->setVerb("POST")
134
+ ->buildPostBody($apiContact);
135
+
136
+ $response = $this->execute();
137
+ if(isset($response->message)){
138
+ Mage::helper('connector')->log('POST ADDRESS BOOK CONTACTS ' . $url . ', ' . $response->message);
139
+ Mage::helper('connector')->log($apiContact->email);
140
+ }
141
+
142
+ return $response;
143
+ }
144
+
145
+ /**
146
+ * Deletes all contacts from a given address book.
147
+ * @param $addressBookId
148
+ * @param $contactId
149
+ * @return null
150
+ */
151
+ public function deleteAddressBookContact($addressBookId, $contactId)
152
+ {
153
+ $url = self::REST_ADDRESS_BOOKS . $addressBookId . '/contacts/' . $contactId;
154
+ $this->setUrl($url)
155
+ ->setVerb('DELETE');
156
+ $response = $this->execute();
157
+ if(isset($response->message))
158
+ Mage::helper('connector')->log('DELETE ADDRESS BOOK CONTACT ' . $url . ', ' . $response->message);
159
+
160
+ return $response;
161
+ }
162
+
163
+ /**
164
+ * Gets a report with statistics about what was successfully imported, and what was unable to be imported.
165
+ * @param $importId
166
+ * @return mixed
167
+ */
168
+ public function getContactsImportReport($importId)
169
+ {
170
+ $url = self::REST_CONTACTS_IMPORT . $importId . "/report";
171
+ $this->setUrl($url)
172
+ ->setVerb('GET');
173
+ $response = $this->execute();
174
+ if(isset($response->message))
175
+ Mage::helper('connector')->log('GET CONTACTS IMPORT REPORT . ' . $url . ' message : ' . $response->message);
176
+ return $response;
177
+ }
178
+
179
+ /**
180
+ * Gets a contact by email address.
181
+ * @param $email
182
+ * @return mixed
183
+ */
184
+ public function getContactByEmail($email)
185
+ {
186
+ $url = self::REST_CONTACTS . $email;
187
+ $this->setUrl($url)
188
+ ->setVerb('GET');
189
+
190
+ $response = $this->execute();
191
+ if(isset($response->message))
192
+ Mage::helper('connector')->log('GET CONTACT BY EMAIL : ' . $email . ' ' . $response->message);
193
+
194
+ return $response;
195
+ }
196
+
197
+ /**
198
+ * Get all address books
199
+ * @return null
200
+ */
201
+ public function getAddressBooks()
202
+ {
203
+ $url = self::REST_ADDRESS_BOOKS;
204
+ $this->setUrl($url)
205
+ ->setVerb("GET");
206
+
207
+ $response = $this->execute();
208
+ if(isset($response->message))
209
+ Mage::helper('connector')->log('GET ALL ADDRESS BOOKS : ' . $url . ', ' . $response->message);
210
+ return $response;
211
+ }
212
+
213
+ /**
214
+ * Creates an address book.
215
+ * @param $name
216
+ * @return null
217
+ */
218
+ public function PostAddressBooks($name)
219
+ {
220
+ $data = array(
221
+ 'Name' => $name,
222
+ 'Visibility' => 'Public'
223
+ );
224
+ $url = self::REST_ADDRESS_BOOKS;
225
+ $this->setUrl($url)
226
+ ->setVerb('POST')
227
+ ->buildPostBody($data);
228
+
229
+ $response = $this->execute();
230
+
231
+ if(isset($response->message)) {
232
+ Mage::helper('connector')->log('POSTADDRESSBOOK ' . $url);
233
+ Mage::helper('connector')->log($response->message);
234
+ }
235
+ return $response;
236
+ }
237
+
238
+ /**
239
+ * Get list of all campaigns
240
+ * @return mixed
241
+ */
242
+ public function getCampaigns()
243
+ {
244
+ $url = self::REST_DATA_FIELDS_CAMPAIGNS;
245
+ $this->setUrl($url)
246
+ ->setVerb('GET');
247
+
248
+ $response = $this->execute();
249
+
250
+ if(isset($response->message))
251
+ Mage::helper('connector')->log('GET CAMPAINGS ' . $response->message . ' api user : ' . $this->getApiUsername());
252
+
253
+ return $response;
254
+ }
255
+
256
+ /**
257
+ * Creates a data field within the account.
258
+ * @param $data string/array
259
+ * @param string $type string, numeric, date, boolean
260
+ * @param string $visibility public, private
261
+ * @param bool $defaultValue
262
+ * @return mixed
263
+ */
264
+ public function postDataFields($data, $type = 'String', $visibility = 'public', $defaultValue = false)
265
+ {
266
+ $url = self::REST_DATA_FILEDS;
267
+ if($type == 'numeric' && !$defaultValue)
268
+ $defaultValue = 0;
269
+ if(is_string($data)){
270
+ $data = array(
271
+ 'Name' => $data,
272
+ 'Type' => $type,
273
+ 'Visibility' => $visibility
274
+ );
275
+ if($defaultValue)
276
+ $data['DefaultValue'] = $defaultValue;
277
+ }
278
+ $this->setUrl($url)
279
+ ->buildPostBody($data)
280
+ ->setVerb('POST');
281
+
282
+ $response = $this->execute();
283
+
284
+ if(isset($response->message)){
285
+ Mage::helper('connector')->log('POST CREATE DATAFIELDS ' . $response->message);
286
+ Mage::helper('connector')->log($data);
287
+ }
288
+
289
+ return $response;
290
+ }
291
+
292
+ public function deleteDataField($name)
293
+ {
294
+ $url = self::REST_DATA_FILEDS . '/' . $name;
295
+ $request = Mage::helper('connector/api_restrequest');
296
+ $request->setUrl($url)
297
+ ->setVerb('DELETE');
298
+
299
+ $response = $request->execute();
300
+ if(isset($response->message))
301
+ Mage::helper('connector')->log('DELETE DATA FIELD :' . $name . ' ' . $response->message);
302
+ return $request->execute();
303
+ }
304
+
305
+ /**
306
+ * Lists the data fields within the account.
307
+ * @return mixed
308
+ */
309
+ public function getDataFields()
310
+ {
311
+ $url = self::REST_DATA_FILEDS;
312
+ $this->setUrl($url)
313
+ ->setVerb('GET');
314
+
315
+ $response = $this->execute();
316
+ if(isset($response->message))
317
+ Mage::helper('connector')->log('GET ALL DATAFIELDS ' . $response->message);
318
+
319
+ return $response;
320
+ }
321
+
322
+ /**
323
+ * Updates a contact.
324
+ * @param $contactId
325
+ * @param $data
326
+ * @return object
327
+ */
328
+ public function updateContact($contactId, $data)
329
+ {
330
+ $url = self::REST_CONTACTS . $contactId;
331
+ $this->setUrl($url)
332
+ ->setVerb('PUT')
333
+ ->buildPostBody($data);
334
+
335
+ $response = $this->execute();
336
+ if(isset($response->message)){
337
+ Mage::helper('connector')->log('ERROR : UPDATE SINGLE CONTACT : ' . $url . ' message : ' . $response->message);
338
+ Mage::helper('connector')->log($data);
339
+ }
340
+
341
+ return $response;
342
+ }
343
+
344
+ public function updateContactDatafieldsByEmail($email, $dataFields)
345
+ {
346
+ $contactId = $this->postContacts($email)->id;
347
+ $data = array(
348
+ 'Email' => $email,
349
+ 'EmailType' => 'Html');
350
+ $data['DataFields'] = $dataFields;
351
+ $url = self::REST_CONTACTS . $contactId;
352
+ $this->setUrl($url)
353
+ ->setVerb('PUT')
354
+ ->buildPostBody($data);
355
+ $response = $this->execute();
356
+ if(isset($response->message)){
357
+ Mage::helper('connector')->log('ERROR: UPDATE CONTACT DATAFIELD ' . $url . ' message : ' . $response->message);
358
+ Mage::helper('connector')->log($data);
359
+ }
360
+
361
+ return $response;
362
+ }
363
+
364
+ /**
365
+ * Sends a specified campaign to one or more address books, segments or contacts at a specified time.
366
+ * Leave the address book array empty to send to All Contacts.
367
+ * @param $campaignId
368
+ * @param $contacts
369
+ * @return mixed
370
+ */
371
+ public function postCampaignsSend($campaignId, $contacts)
372
+ {
373
+ $helper = Mage::helper('connector');
374
+ $data = array(
375
+ 'username' => $this->getApiUsername(),
376
+ 'password' => $this->getApiPassword(),
377
+ "campaignId" => $campaignId,
378
+ "ContactIds" => $contacts
379
+ );
380
+ $this->setUrl(self::REST_CAMPAIGN_SEND)
381
+ ->setVerb('POST')
382
+ ->buildPostBody($data);
383
+
384
+ $response = $this->execute();
385
+ if(isset($response->message)){
386
+ $helper->log('SENDING CAMPAIGN ' . $response->message);
387
+ $helper->log($data);
388
+ }
389
+
390
+ return $response;
391
+ }
392
+
393
+ /**
394
+ * Creates a contact.
395
+ * @param $email
396
+ * @return mixed
397
+ */
398
+ public function postContacts($email)
399
+ {
400
+ $url = self::REST_CONTACTS;
401
+ $data = array(
402
+ 'Email' => $email,
403
+ 'EmailType' => 'Html',
404
+ );
405
+ $this->setUrl($url)
406
+ ->setVerb('POST')
407
+ ->buildPostBody($data);
408
+
409
+ $response = $this->execute();
410
+ if(isset($response->message)){
411
+ Mage::helper('connector')->log('CREATE A NEW CONTACT : ' . $email . ' , url ' . $url . ', ' . $response->message);
412
+ }
413
+
414
+ return $response;
415
+ }
416
+
417
+ /**
418
+ * @param $testEmail
419
+ * @param $contactId
420
+ * @param $campaignId
421
+ */
422
+ public function sendIntallInfo($testEmail, $contactId, $campaignId)
423
+ {
424
+ $helper = Mage::helper('connector');
425
+ $productSize= Mage::getModel('catalog/product')->getCollection()->getSize();
426
+ $customerSize = Mage::getModel('customer/customer')->getCollection()->getSize();
427
+
428
+ $data = array(
429
+ 'Email' => $testEmail,
430
+ 'EmailType' => 'Html',
431
+ 'DataFields' => array(
432
+ array(
433
+ 'Key' => 'INSTALLCUSTOMERS',
434
+ 'Value' => (string)$customerSize),
435
+ array(
436
+ 'Key' => 'INSTALLPRODUCTS',
437
+ 'Value' => (string)$productSize),
438
+ array(
439
+ 'Key' => 'INSTALLURL',
440
+ 'Value' => Mage::getBaseUrl('web')),
441
+ array(
442
+ 'Key' => 'INSTALLAPI',
443
+ 'Value' => Mage::helper('connector')->getStringWebsiteApiAccounts()),
444
+ array(
445
+ 'Key' => 'PHPMEMORY',
446
+ 'Value' => ini_get('memory_limit') . ', Version = ' . $helper->getConnectorVersion()
447
+ )
448
+ )
449
+ );
450
+ $helper->log('SENDING INSTALL INFO DATA...', Zend_Log::INFO, 'api.log');
451
+ $helper->log($data);
452
+ /**
453
+ * Update data fields for a contact
454
+ */
455
+ $this->updateContact($contactId, $data);
456
+ /**
457
+ * Send Install info campaign
458
+ */
459
+ $this->postCampaignsSend($campaignId, array($contactId));
460
+
461
+ return;
462
+ }
463
+
464
+
465
+ /**
466
+ * Gets a list of suppressed contacts after a given date along with the reason for suppression.
467
+ * @param $dateString
468
+ * @param $select
469
+ * @param $skip
470
+ * @return object
471
+ */
472
+ public function getContactsSuppressedSinceDate($dateString, $select = 1000, $skip = 0)
473
+ {
474
+ $url = self::REST_CONTACTS_SUPPRESSED_SINCE . $dateString . '?select=' . $select . '&skip=' . $skip;
475
+
476
+ $this->setUrl($url)
477
+ ->setVerb("GET");
478
+
479
+ $response = $this->execute();
480
+ if(isset($response->message))
481
+ Mage::helper('connector')->log('GET CONTACTS SUPPRESSED SINSE : ' . $dateString . ' select ' . $select . ' skip : ' . $skip . ' response : ' . $response->message);
482
+
483
+ return $response;
484
+ }
485
+
486
+ /**
487
+ * Adds multiple pieces of transactional data to contacts asynchronously, returning an identifier that can be used to check for import progress.
488
+ * @param $collectionName
489
+ * @param $transactionalData
490
+ * @return object
491
+ */
492
+ public function postContactsTransactionalDataImport($transactionalData, $collectionName = 'Orders')
493
+ {
494
+ $orders = array();
495
+ foreach($transactionalData as $one){
496
+ if(isset($one->email)){
497
+ $orders[] = array(
498
+ 'Key' => $one->id,
499
+ 'ContactIdentifier' => $one->email,
500
+ 'Json' => json_encode($one->expose())
501
+ );
502
+ }
503
+ }
504
+ $url = self::REST_TRANSACTIONAL_DATA_IMPORT . $collectionName;
505
+ $this->setURl($url)
506
+ ->setVerb('POST')
507
+ ->buildPostBody($orders);
508
+
509
+ $result = $this->execute();
510
+
511
+ if(isset($result->message)){
512
+ Mage::helper('connector')->log(' SEND MULTI TRANSACTIONAL DATA ' . $result->message);
513
+ //Mage::helper('connector')->log($orders);
514
+ }
515
+
516
+ return $result;
517
+ }
518
+
519
+ /**
520
+ * Adds a single piece of transactional data to a contact.
521
+ * @param $data
522
+ * @param string $name
523
+ * @return null
524
+ */
525
+ public function postContactsTransactionalData($data, $name = 'Orders')
526
+ {
527
+
528
+ $getData = $this->getContactsTransactionalDataByKey($name, $data->id);
529
+ if(isset($getData->message) && $getData->message == self::REST_TRANSACTIONAL_DATA_NOT_EXISTS){
530
+ $url = self::REST_TRANSACTIONAL_DATA . $name;
531
+ }else{
532
+ $url = self::REST_TRANSACTIONAL_DATA . $name . '/' . $getData->key ;
533
+ }
534
+ $apiData = array(
535
+ 'Key' => $data->id,
536
+ 'ContactIdentifier' => $data->connector_id,
537
+ 'Json' => json_encode($data->expose())
538
+ );
539
+
540
+ $this->setUrl($url)
541
+ ->setVerb('POST')
542
+ ->buildPostBody($apiData);
543
+ $response = $this->execute();
544
+ if(isset($response->message)){
545
+ Mage::helper('connector')->log('POST CONTACTS TRANSACTIONAL DATA ' . $response->message);
546
+ Mage::helper('connector')->log($apiData);
547
+ }
548
+
549
+ return $response;
550
+ }
551
+
552
+ /**
553
+ * Gets a piece of transactional data by key.
554
+ * @param $name
555
+ * @param $key
556
+ * @return null
557
+ */
558
+ public function getContactsTransactionalDataByKey($name, $key)
559
+ {
560
+ $url = self::REST_TRANSACTIONAL_DATA . $name . '/' . $key;
561
+ $this->setUrl($url)
562
+ ->setVerb('GET');
563
+
564
+ $response = $this->execute();
565
+ if(isset($response->message))
566
+ Mage::helper('connector')->log('GET CONTACTS TRANSACTIONAL DATA name: ' . $name . ' key: ' . $key . ' ' . $response->message);
567
+
568
+ return $response;
569
+ }
570
+
571
+ /**
572
+ * Deletes all transactional data for a contact.
573
+ * @param $email
574
+ * @param string $collectionName
575
+ * @return object
576
+ */
577
+ public function deleteContactTransactionalData($email, $collectionName = 'Orders')
578
+ {
579
+ $url = 'https://apiconnector.com/v2/contacts/' . $email . '/transactional-data/' . $collectionName ;
580
+ $this->setUrl($url)
581
+ ->setVerb('DELETE');
582
+
583
+ $response = $this->execute();
584
+ if(isset($response->message))
585
+ Mage::helper('connector')->log('DELETE CONTACT TRANSACTIONAL DATA : ' . $url . ' ' . $response->message);
586
+
587
+ return $response;
588
+ }
589
+
590
+ /**
591
+ * Gets a summary of information about the current status of the account.
592
+ * @return mixed
593
+ */
594
+ public function getAccountInfo()
595
+ {
596
+ $url = self::REST_ACCOUNT_INFO;
597
+ $this->setUrl($url)
598
+ ->setVerb('GET');
599
+ $response = $this->execute();
600
+
601
+ if(isset($response->message)){
602
+ Mage::helper('connector')->log('GET ACCOUNT INFO for api user : ' . $this->getApiUsername() . ' ' . $response->message);
603
+ }
604
+
605
+ return $response;
606
+ }
607
+
608
+ /**
609
+ * Send a single SMS message.
610
+ * @param $telephoneNumber
611
+ * @param $message
612
+ * @return object
613
+ */
614
+ public function postSmsMessagesSendTo($telephoneNumber, $message)
615
+ {
616
+ $data = array('Message' => $message);
617
+ $url = self::REST_SMS_MESSAGE_SEND_TO . $telephoneNumber;
618
+ $this->setUrl($url)
619
+ ->setVerb('POST')
620
+ ->buildPostBody($data);
621
+ $response = $this->execute();
622
+ if(isset($response->message))
623
+ Mage::helper('connector')->log('POST SMS MESSAGE SEND to ' . $telephoneNumber . ' message: ' . $message . ' error: ' . $response->message);
624
+
625
+ return $response;
626
+ }
627
+
628
+
629
+ /**
630
+ * Deletes multiple contacts from an address book
631
+ * @param $addressBookId
632
+ * @param $contactIds
633
+ * @return object
634
+ */
635
+ public function deleteAddressBookContactsInbulk($addressBookId, $contactIds)
636
+ {
637
+ $url = 'https://apiconnector.com/v2/address-books/' . $addressBookId . '/contacts/inbulk';
638
+
639
+ $data = array('ContactIds' => array($contactIds[0]));
640
+
641
+ $this->setUrl($url)
642
+ ->setVerb('DELETE')
643
+ ->buildPostBody($data);
644
+
645
+ $result = $this->execute();
646
+ if(isset($result->message)){
647
+ Mage::helper('connector')->log('DELETE BULK ADDRESS BOOK CONTACTS ' . $result->message . ' address book ' . $addressBookId);
648
+
649
+ }
650
+ return $result;
651
+ }
652
+ }
app/code/community/Dotdigitalgroup/Email/Model/Apiconnector/Contact.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Apiconnector_Contact
4
+ {
5
+ private $_start;
6
+ private $_countCustomers;
7
+ private $_wishlists;
8
+
9
+ public function sync()
10
+ {
11
+ $result = array('error' => false, 'message' => "Done.");
12
+ /** @var Dotdigitalgroup_Email_Helper_Data $helper */
13
+ $helper = Mage::helper('connector');
14
+ $helper->log('---------- Start customer sync ----------');
15
+ $this->_start = microtime(true);
16
+ //resourse allocation
17
+ $helper->allowResourceFullExecution();
18
+ foreach(Mage::app()->getWebsites(true) as $website){
19
+ $enabled = Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_ENABLED, $website);
20
+ $sync = Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_CONTACT_ENABLED, $website);
21
+ if($enabled && $sync)
22
+ $this->_exportCustomersForWebsite($website);
23
+ }
24
+ $helper->log('Total time for sync : ' . gmdate("H:i:s", microtime(true) - $this->_start));
25
+
26
+ return $result;
27
+ }
28
+
29
+ private function _exportCustomersForWebsite(Mage_Core_Model_Website $website){
30
+ $updated = 0;
31
+ $customers = array();
32
+ $helper = Mage::helper('connector');
33
+ $pageSize = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_LIMIT, $website);
34
+ //skip if the mapping field is missing
35
+ if(!$helper->getCustomerAddressBook($website))
36
+ return;
37
+ //reset wishlists
38
+ $this->_wishlists = array();
39
+ $fileHelper = Mage::helper('connector/file');
40
+ $contactModel = Mage::getModel('email_connector/contact');
41
+ $client = Mage::helper('connector')->getWebsiteApiClient($website);
42
+ $contacts = $contactModel->getContactsToImportForWebsite($website->getId(), $pageSize);
43
+
44
+ // no contacts for this webiste
45
+ if(!count($contacts))
46
+ return;
47
+ //create customer filename
48
+ $customersFile = strtolower($website->getCode() . '_customers_' . date('d_m_Y_Hi') . '.csv');
49
+ $helper->log('Customers file : ' . $customersFile);
50
+
51
+ //get customer ids
52
+ $customerIds = array();
53
+ foreach($contacts as $contact){
54
+ $customerIds[] = $contact->getCustomerId();
55
+ }
56
+ //customer collection
57
+ $customerCollection = Mage::getResourceModel('customer/customer_collection')
58
+ ->addNameToSelect()
59
+ ->addAttributeToSelect('*')
60
+ ->joinAttribute('billing_street', 'customer_address/street', 'default_billing', null, 'left')
61
+ ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
62
+ ->joinAttribute('billing_country_code', 'customer_address/country_id', 'default_billing', null, 'left')
63
+ ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
64
+ ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
65
+ ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
66
+ ->joinAttribute('shipping_street', 'customer_address/street', 'default_shipping', null, 'left')
67
+ ->joinAttribute('shipping_city', 'customer_address/city', 'default_shipping', null, 'left')
68
+ ->joinAttribute('shipping_country_code','customer_address/country_id', 'default_shipping', null, 'left')
69
+ ->joinAttribute('shipping_postcode', 'customer_address/postcode', 'default_shipping', null, 'left')
70
+ ->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
71
+ ->joinAttribute('shipping_region', 'customer_address/region', 'default_shipping', null, 'left')
72
+ ->addAttributeToFilter('entity_id', array('in' => $customerIds));
73
+ $customer_log = Mage::getSingleton('core/resource')->getTableName('log_customer');
74
+ $sales_flat_order_grid = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_grid');
75
+
76
+ // get the last login date from the log_customer table
77
+ $customerCollection->getSelect()->columns(
78
+ array('last_logged_date' => new Zend_Db_Expr ("(SELECT login_at FROM $customer_log WHERE customer_id =e.entity_id ORDER BY log_id DESC LIMIT 1)")));
79
+
80
+ // customer order information
81
+ $alias = 'subselect';
82
+ $subselect = Mage::getModel('Varien_Db_Select', Mage::getSingleton('core/resource')->getConnection('core_read'))
83
+ ->from($sales_flat_order_grid, array(
84
+ 'customer_id as s_customer_id',
85
+ 'sum(grand_total) as total_spend',
86
+ 'count(*) as number_of_orders',
87
+ 'avg(grand_total) as average_order_value',
88
+ )
89
+ )->group('customer_id')
90
+ ;
91
+ $customerCollection->getSelect()->columns(array(
92
+ 'last_order_date' => new Zend_Db_Expr("(SELECT created_at FROM $sales_flat_order_grid WHERE customer_id =e.entity_id ORDER BY created_at DESC LIMIT 1)"),
93
+ 'last_order_id' => new Zend_Db_Expr("(SELECT entity_id FROM $sales_flat_order_grid WHERE customer_id =e.entity_id ORDER BY created_at DESC LIMIT 1)")
94
+ )
95
+ );
96
+ $customerCollection->getSelect()
97
+ ->joinLeft(array($alias => $subselect), "{$alias}.s_customer_id = e.entity_id");
98
+
99
+ $headers = $fileHelper->getCsvHeaderArray($website);
100
+ $customAttributes = $helper->getCustomAttributes($website);
101
+ foreach ($customAttributes as $data) {
102
+ $headers[] = $data['datafield'];
103
+ }
104
+ //write the csv headers
105
+ $fileHelper->outputCSV($fileHelper->getFilePath($customersFile), $headers);
106
+ foreach($customerCollection as $customer){
107
+ $connectorCustomer = Mage::getModel('email_connector/connector_customer', $customer);
108
+ $contactModel = Mage::getModel('email_connector/contact')->loadByCustomerId($customer->getId());
109
+ //skip contacts without customer id
110
+ if(!$contactModel->getId())
111
+ continue;
112
+ $customers[] = $connectorCustomer;
113
+ //Send wishlist as transactional data
114
+ if($helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_WISHLIST_ENABLED, $website)){
115
+ $this->_setCustomerWishList($customer, $website);
116
+ }
117
+ $customerData = $connectorCustomer->toCSVArray();
118
+ foreach ($customAttributes as $data) {
119
+ $attribute = $data['attribute'];
120
+ $value = $customer->getData($attribute);
121
+ $connectorCustomer->$attribute = $value;
122
+ $customerData[] = $value;
123
+ }
124
+ // save csv file data for customers
125
+ $fileHelper->outputCSV($fileHelper->getFilePath($customersFile), $customerData);
126
+
127
+ //mark the contact as imported
128
+ $contactModel->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_IMPORTED);
129
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer->getEmail());
130
+ if($subscriber->isSubscribed()){
131
+ $contactModel->setIsSubscriber(1)
132
+ ->setSubscriberStatus($subscriber->getSubscriberStatus());
133
+ }
134
+
135
+ $contactModel->save();
136
+ $updated++;
137
+ }
138
+ //send wishlist as transactional data
139
+ if(isset($this->_wishlists[$website->getId()])){
140
+ //send wishlists as transactional data
141
+ $websiteWishlists = $this->_wishlists[$website->getId()];
142
+ //remove wishlists one by one
143
+ foreach ($websiteWishlists as $wishlist) {
144
+ $email = $wishlist->email;
145
+ $client->deleteContactTransactionalData($email, 'Wishlist');
146
+ }
147
+ //import wishlists in bulk
148
+ $client->postContactsTransactionalDataImport($websiteWishlists, $collectionName = 'Wishlist');
149
+ }
150
+
151
+ $helper->log('Website : ' . $website->getName() . ', customers = ' . count($customers));
152
+ $helper->log('---------------------------- execution time :' . gmdate("H:i:s", microtime(true) - $this->_start));
153
+
154
+ if(file_exists($fileHelper->getFilePath($customersFile))){
155
+ //import contacts
156
+ if($updated > 0)
157
+ $client->postAddressBookContactsImport($customersFile, $helper->getCustomerAddressBook($website));
158
+ //archive file on success
159
+ $fileHelper->archiveCSV($customersFile);
160
+ }
161
+ $this->_countCustomers = $updated;
162
+ return;
163
+ }
164
+
165
+ /**
166
+ * @param $customer
167
+ * @param $website
168
+ */
169
+ private function _setCustomerWishList($customer, $website)
170
+ {
171
+ $website = Mage::app()->getWebsite($website);
172
+ $customerId = $customer->getId();
173
+ $wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId);
174
+ /** @var $connectorWishlist */
175
+ $connectorWishlist = Mage::getModel('email_connector/customer_wishlist', $customer);
176
+ $connectorWishlist->setId($wishlist->getId());
177
+ $wishListItemCollection = $wishlist->getItemCollection();
178
+ if (count($wishListItemCollection)) {
179
+ foreach ($wishListItemCollection as $item) {
180
+ /* @var $product Mage_Catalog_Model_Product */
181
+ $product = $item->getProduct();
182
+ $wishlistItem = Mage::getModel('email_connector/customer_wishlist_item', $product)
183
+ ->setQty($item->getQty())
184
+ ->setPrice($product);
185
+ //store for wishlists
186
+ $connectorWishlist->setItem($wishlistItem);
187
+ }
188
+ //set wishlists for later use
189
+ $this->_wishlists[$website->getId()][] = $connectorWishlist;
190
+ }
191
+ }
192
+ }
app/code/community/Dotdigitalgroup/Email/Model/Apiconnector/Test.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Apiconnector_Test extends Dotdigitalgroup_Email_Model_Apiconnector_Client
4
+ {
5
+ const TEST_API_USERNAME = 'apiuser-8e3b8f244ec9@apiconnector.com';
6
+ const TEST_API_PASSWORD = 'Magento2013';
7
+ const TEST_API_CAMPAIGN = '2643928';
8
+ const TEST_CONTACT_ID = '13';
9
+ const TEST_CONTACT_EMAIL = 'ben.staveley@dotmailer.co.uk';
10
+
11
+
12
+ public function validate($apiUsername, $apiPassword)
13
+ {
14
+ if($apiUsername && $apiPassword){
15
+ $this->setApiUsername($apiUsername)
16
+ ->setApiPassword($apiPassword);
17
+
18
+ $accountInfo = $this->getAccountInfo();
19
+ if(isset($accountInfo->message)){
20
+ Mage::getSingleton('adminhtml/session')->addError($accountInfo->message);
21
+ Mage::helper('connector')->log('VALIDATION ERROR : ' . $accountInfo->message);
22
+ return false;
23
+ }
24
+ return $accountInfo;
25
+ }
26
+ return false;
27
+ }
28
+
29
+ public function ajaxvalidate($apiUsername, $apiPassword)
30
+ {
31
+ if($apiUsername && $apiPassword){
32
+ $message = 'Credentials Valid.';
33
+ $this->setApiUsername($apiUsername)
34
+ ->setApiPassword($apiPassword);
35
+ $response = $this->getAccountInfo();
36
+ if(isset($response->message)){
37
+ $message = 'API Username And API Password Do Not Match!';
38
+ Mage::helper('connector')->log($message);
39
+ }
40
+ return $message;
41
+ }
42
+ return false;
43
+ }
44
+
45
+ public function sendInstallConfirmation()
46
+ {
47
+ // set test credentials
48
+ $this->setApiUsername(self::TEST_API_USERNAME)
49
+ ->setApiPassword(self::TEST_API_PASSWORD);
50
+ $testEmail = self::TEST_CONTACT_EMAIL;
51
+ $contactId = self::TEST_CONTACT_ID;
52
+ $campaignId = self::TEST_API_CAMPAIGN;
53
+
54
+ /**
55
+ * send initial info
56
+ */
57
+ $this->sendIntallInfo($testEmail, $contactId, $campaignId);
58
+ }
59
+ }
app/code/community/Dotdigitalgroup/Email/Model/Campaign.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Campaign extends Mage_Core_Model_Abstract
4
+ {
5
+ //xml path configuration
6
+ const XML_PATH_LOSTBASKET_1_ENABLED = 'connector_lost_baskets/customers/enabled_1';
7
+ const XML_PATH_LOSTBASKET_2_ENABLED = 'connector_lost_baskets/customers/enabled_2';
8
+ const XML_PATH_LOSTBASKET_3_ENABLED = 'connector_lost_baskets/customers/enabled_3';
9
+
10
+ const XML_PATH_LOSTBASKET_1_INTERVAL = 'connector_lost_baskets/customers/send_after_1';
11
+ const XML_PATH_LOSTBASKET_2_INTERVAL = 'connector_lost_baskets/customers/send_after_2';
12
+ const XML_PATH_LOSTBASKET_3_INTERVAL = 'connector_lost_baskets/customers/send_after_3';
13
+
14
+ const XML_PATH_TRIGGER_1_CAMPAIGN = 'connector_lost_baskets/customers/campaign_1';
15
+ const XML_PATH_TRIGGER_2_CAMPAIGN = 'connector_lost_baskets/customers/campaign_2';
16
+ const XML_PATH_TRIGGER_3_CAMPAIGN = 'connector_lost_baskets/customers/campaign_3';
17
+
18
+ const XML_PATH_GUEST_LOSTBASKET_1_ENABLED = 'connector_lost_baskets/guests/enabled_1';
19
+ const XML_PATH_GUEST_LOSTBASKET_2_ENABLED = 'connector_lost_baskets/guests/enabled_2';
20
+ const XML_PATH_GUEST_LOSTBASKET_3_ENABLED = 'connector_lost_baskets/guests/enabled_3';
21
+
22
+ const XML_PATH_GUEST_LOSTBASKET_1_INTERVAL = 'connector_lost_baskets/guests/send_after_1';
23
+ const XML_PATH_GUEST_LOSTBASKET_2_INTERVAL = 'connector_lost_baskets/guests/send_after_2';
24
+ const XML_PATH_GUEST_LOSTBASKET_3_INTERVAL = 'connector_lost_baskets/guests/send_after_3';
25
+
26
+ const XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN = 'connector_lost_baskets/guests/campaign_1';
27
+ const XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN = 'connector_lost_baskets/guests/campaign_2';
28
+ const XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN = 'connector_lost_baskets/guests/campaign_3';
29
+
30
+
31
+ //error messages
32
+ const SEND_EMAIL_CONTACT_ID_MISSING = 'Error : missing contact id - will try later to send ';
33
+
34
+ public $transactionalClient;
35
+
36
+ /**
37
+ * constructor
38
+ */
39
+ public function _construct(){
40
+ parent::_construct();
41
+ $this->_init('email_connector/campaign');
42
+
43
+ $this->transactionalClient = Mage::helper('connector/transactional')->getWebsiteApiClient();
44
+ }
45
+
46
+ /**
47
+ * @return $this|Mage_Core_Model_Abstract
48
+ */
49
+ protected function _beforeSave(){
50
+ parent::_beforeSave();
51
+ $now = Mage::getSingleton('core/date')->gmtDate();
52
+ if ($this->isObjectNew()){
53
+ $this->setCreatedAt($now);
54
+ }
55
+ $this->setUpdatedAt($now);
56
+ return $this;
57
+ }
58
+
59
+ /**
60
+ * @param $quoteId
61
+ * @param $storeId
62
+ * @return mixed
63
+ */
64
+ public function loadByQuoteId($quoteId, $storeId)
65
+ {
66
+ $collection = $this->getCollection()
67
+ ->addFieldToFilter('quote_id', $quoteId)
68
+ ->addFieldToFilter('store_id', $storeId);
69
+
70
+ if($collection->count()){
71
+ return $collection->getFirstItem();
72
+ }else{
73
+ $this->setQuoteId($quoteId)
74
+ ->setStoreId($storeId);
75
+ }
76
+
77
+ return $this;
78
+ }
79
+
80
+
81
+ /**
82
+ * Sending the campaigns.
83
+ */
84
+ public function sendCampaigns()
85
+ {
86
+ //grab the emails not send
87
+ $emailsToSend = $this->_getEmailCampaigns();
88
+ foreach ($emailsToSend as $campaign) {
89
+ $email = $campaign->getEmail();
90
+ $storeId = $campaign->getStoreId();
91
+ $store = Mage::app()->getStore($storeId);
92
+ $websiteId = $store->getWebsiteId();
93
+ $storeName = $store->getName();
94
+ $websiteName = $store->getWebsite()->getName();
95
+ $campaignId = $campaign->getCampaignId();
96
+ if(!$campaignId){
97
+ $campaign->setMessage('Missing campaign id: ' . $campaignId)
98
+ ->setIsSent(1)
99
+ ->save();
100
+ continue;
101
+ }elseif(!$email){
102
+ $campaign->setMessage('Missing email : ' . $email)
103
+ ->setIsSent(1)
104
+ ->save();
105
+ }
106
+ try{
107
+ if($campaign->getEventName() == 'Lost Basket'){
108
+ $client = Mage::helper('connector')->getWebsiteApiClient($websiteId);
109
+ $contactId = Mage::helper('connector')->getContactId($campaign->getEmail(), $websiteId);
110
+ Mage::helper('connector')->log($contactId);
111
+ $response = $client->postCampaignsSend($campaignId, array($contactId));
112
+ if(isset($response->message)){
113
+ //update the failed to send email message
114
+ $campaign->setMessage($response->message)->setIsSent(1)->save();
115
+ }
116
+ $now = Mage::getSingleton('core/date')->gmtDate();
117
+ //record suscces
118
+ $campaign->setIsSent(1)
119
+ ->setMessage(NULL)
120
+ ->setSentAt($now)
121
+ ->save();
122
+
123
+ continue;
124
+ }elseif($campaign->getEventName() == 'New Customer Account'){
125
+
126
+ $contactId = Mage::helper('connector/transactional')->getContactId($campaign->getEmail(), $websiteId);
127
+ $customerId = $campaign->getCustomerId();
128
+ $customer = Mage::getModel('customer/customer')->load($customerId);
129
+ $firstname = $customer->getFirstname();
130
+ $lastname = $customer->getLastname();
131
+ $data = array(
132
+ array(
133
+ 'Key' => 'STORE_NAME',
134
+ 'Value' => $storeName),
135
+ array(
136
+ 'Key' => 'WEBSITE_NAME',
137
+ 'Value' => $websiteName),
138
+ array(
139
+ 'Key' => 'FIRSTNAME',
140
+ 'Value' => $firstname),
141
+ array(
142
+ 'Key' => 'LASTNAME',
143
+ 'Value' => $lastname),
144
+ array(
145
+ 'Key' => 'CUSTOMER_ID',
146
+ 'Value' => $customerId)
147
+ );
148
+ $this->transactionalClient->updateContactDatafieldsByEmail($email, $data);
149
+ $response = $this->transactionalClient->postCampaignsSend($campaignId, array($contactId));
150
+ if(isset($response->message)){
151
+ //update the failed to send email message
152
+ $campaign->setMessage($response->message)->setIsSent(1)->save();
153
+ }else{
154
+ $now = Mage::getSingleton('core/date')->gmtDate();
155
+ //record suscces
156
+ $campaign->setIsSent(1)
157
+ ->setMessage(NULL)
158
+ ->setSentAt($now)
159
+ ->save();
160
+ }
161
+ }else{
162
+ // transactional
163
+ $orderModel = Mage::getModel("sales/order")->loadByIncrementId($campaign->getOrderIncrementId());
164
+ $contactId = Mage::helper('connector/transactional')->getContactId($campaign->getEmail(), $websiteId);
165
+ if(is_numeric($contactId)){
166
+ if($orderModel->getCustomerId()){
167
+ $firstname = $orderModel->getCustomerFirstname();
168
+ $lastname = $orderModel->getCustomerLastname();
169
+ }else{
170
+ $billing = $orderModel->getBillingAddress();
171
+ $firstname = $billing->getFirstname();
172
+ $lastname = $billing->getLastname();
173
+ }
174
+ $data = array(
175
+ array(
176
+ 'Key' => 'STORE_NAME',
177
+ 'Value' => $storeName),
178
+ array(
179
+ 'Key' => 'WEBSITE_NAME',
180
+ 'Value' => $websiteName),
181
+ array(
182
+ 'Key' => 'FIRSTNAME',
183
+ 'Value' => $firstname),
184
+ array(
185
+ 'Key' => 'LASTNAME',
186
+ 'Value' => $lastname),
187
+ array(
188
+ 'Key' => 'LAST_ORDER_ID',
189
+ 'Value' => $orderModel->getId())
190
+ );
191
+ $this->transactionalClient->updateContactDatafieldsByEmail($email, $data);
192
+ }
193
+ $response = $this->transactionalClient->postCampaignsSend($campaignId, array($contactId));
194
+ if(isset($response->message)){
195
+ //update the failed to send email message
196
+ $campaign->setMessage($response->message)->save();
197
+ }else{
198
+ $now = Mage::getSingleton('core/date')->gmtDate();
199
+ //record suscces
200
+ $campaign->setIsSent(1)
201
+ ->setMessage(NULL)
202
+ ->setSentAt($now)
203
+ ->save();
204
+ }
205
+ }
206
+
207
+ }catch(Exception $e){
208
+ Mage::logException($e);
209
+ }
210
+ }
211
+ return;
212
+ }
213
+
214
+ /**
215
+ * @return mixed
216
+ */
217
+ private function _getEmailCampaigns(){
218
+ $emailCollection = $this->getCollection();
219
+ $emailCollection->addFieldToFilter('is_sent', array('null' => true))
220
+ ->addFieldToFilter('campaign_id', array('notnull' => true))
221
+ ;
222
+ $emailCollection->getSelect()->order('campaign_id');
223
+
224
+ return $emailCollection;
225
+ }
226
+
227
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Model/Connector/Account.php RENAMED
@@ -16,11 +16,13 @@ class Dotdigitalgroup_Email_Model_Connector_Account
16
  private $_orders = array();
17
 
18
  /**
19
- * @param mixed $api_password
 
20
  */
21
  public function setApiPassword($api_password)
22
  {
23
  $this->_api_password = $api_password;
 
24
  }
25
 
26
  /**
@@ -32,11 +34,13 @@ class Dotdigitalgroup_Email_Model_Connector_Account
32
  }
33
 
34
  /**
35
- * @param mixed $api_username
 
36
  */
37
  public function setApiUsername($api_username)
38
  {
39
  $this->_api_username = $api_username;
 
40
  }
41
 
42
  /**
@@ -68,12 +72,11 @@ class Dotdigitalgroup_Email_Model_Connector_Account
68
  */
69
  public function setContacts($contacts)
70
  {
71
- // if(!empty($this->_contacts)){
72
- // $this->_contacts += $contacts;
73
- // }else{
74
-
75
  $this->_contacts[] = $contacts;
76
- //}
77
  }
78
 
79
  /**
16
  private $_orders = array();
17
 
18
  /**
19
+ * @param $api_password
20
+ * @return $this
21
  */
22
  public function setApiPassword($api_password)
23
  {
24
  $this->_api_password = $api_password;
25
+ return $this;
26
  }
27
 
28
  /**
34
  }
35
 
36
  /**
37
+ * @param $api_username
38
+ * @return $this
39
  */
40
  public function setApiUsername($api_username)
41
  {
42
  $this->_api_username = $api_username;
43
+ return $this;
44
  }
45
 
46
  /**
72
  */
73
  public function setContacts($contacts)
74
  {
75
+ if(!empty($this->_contacts)){
76
+ $this->_contacts += $contacts;
77
+ }else{
 
78
  $this->_contacts[] = $contacts;
79
+ }
80
  }
81
 
82
  /**
app/code/community/Dotdigitalgroup/Email/Model/Connector/Campaign.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Connector_Campaign
4
+ {
5
+
6
+ public $id;
7
+ public $contacts = array();
8
+ public $emails = array();
9
+ public $emailSendId = array();
10
+ private $_storeId;
11
+
12
+ /**
13
+ * @param mixed $storeId
14
+ */
15
+ public function setStoreId($storeId)
16
+ {
17
+ $this->_storeId = $storeId;
18
+ }
19
+
20
+ /**
21
+ * @return mixed
22
+ */
23
+ public function getStoreId()
24
+ {
25
+ return $this->_storeId;
26
+ }
27
+
28
+ /**
29
+ * @param $emailSendId
30
+ * @return $this
31
+ */
32
+ public function setEmailSendId($emailSendId)
33
+ {
34
+ $this->emailSendId[] = $emailSendId;
35
+ return $this;
36
+ }
37
+
38
+ /**
39
+ * @return array
40
+ */
41
+ public function getEmailSendId()
42
+ {
43
+ return $this->emailSendId;
44
+ }
45
+
46
+ /**
47
+ * @param $contact
48
+ * @return $this
49
+ */
50
+ public function setContactId($contact)
51
+ {
52
+ $this->contacts[] = $contact;
53
+ return $this;
54
+ }
55
+
56
+ /**
57
+ * @return array
58
+ */
59
+ public function getContacts()
60
+ {
61
+ return $this->contacts;
62
+ }
63
+
64
+ /**
65
+ * @param $emails
66
+ * @return $this
67
+ */
68
+ public function setEmails($emails)
69
+ {
70
+ $this->emails = $emails;
71
+ return $this;
72
+ }
73
+
74
+ /**
75
+ * @return array
76
+ */
77
+ public function getEmails()
78
+ {
79
+ return $this->emails;
80
+ }
81
+
82
+ /**
83
+ * @param $id
84
+ * @return $this
85
+ */
86
+ public function setId($id)
87
+ {
88
+ $this->id = $id;
89
+ return $this;
90
+ }
91
+
92
+ /**
93
+ * @return mixed
94
+ */
95
+ public function getId()
96
+ {
97
+ return $this->id;
98
+ }
99
+
100
+
101
+
102
+
103
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Model/Connector/Customer.php RENAMED
@@ -11,10 +11,9 @@ class Dotdigitalgroup_Email_Model_Connector_Customer{
11
  private $_dob;
12
  private $_gender;
13
  private $_title;
14
- private $_website_created_on;
15
- private $_store_created_on;
16
- private $_account_created;
17
- private $_last_logged_in;
18
  private $_customer_group;
19
  // Customer Address Data
20
  private $_billing_address_1;
@@ -30,46 +29,15 @@ class Dotdigitalgroup_Email_Model_Connector_Customer{
30
  private $_delivery_postcode;
31
  private $_delivery_telephone;
32
  // Customer Sales Data
33
- private $_total_orders;
34
  private $_average_order_value;
35
  private $_total_spend;
36
- private $_last_order;
37
- private $_last_order_no;
38
- // Newletter subscriber?
39
- private $_is_subscribed_to_newsletter;
40
- private $_dotmailer_contact_id;
41
- private $_customer_id;
42
 
43
- /**
44
- 'firstname',
45
- 'lastname',
46
- 'dob',
47
- 'gender',
48
- 'title',
49
- 'website_created_on',
50
- 'store_created_on',
51
- 'account_created',
52
- 'last_logged_in',
53
- 'customer_group',
54
- 'billing_address_1',
55
- 'billing_address_2',
56
- 'billing_city',
57
- 'billing_country',
58
- 'billing_postcode',
59
- 'billing_telephone',
60
- 'delivery_address_1',
61
- 'delivery_address_2',
62
- 'delivery_city',
63
- 'delivery_country',
64
- 'delivery_postcode',
65
- 'delivery_telephone',
66
- 'total_orders',
67
- 'average_order_value',
68
- 'total_spend',
69
- 'last_order',
70
- 'last_order_no'
71
- *
72
- */
73
 
74
  public function getEmail()
75
  {
@@ -77,92 +45,63 @@ class Dotdigitalgroup_Email_Model_Connector_Customer{
77
  }
78
 
79
 
80
- public function setDotmailerContactId($dotmailer_contact_id)
81
- {
82
- $this->_dotmailer_contact_id = $dotmailer_contact_id;
83
- }
84
-
85
- public function getDotmailerContactId()
86
- {
87
- return $this->_dotmailer_contact_id;
88
- }
89
-
90
- public function isSubscribed()
91
- {
92
- return $this->_is_subscribed_to_newsletter;
93
- }
94
-
95
- private $_mapping_hash;
96
-
97
-
98
  // class constructor - takes
99
- public function __construct(Mage_Customer_Model_Customer $customer, $mapping_hash){
100
-
101
- $this->_mapping_hash = $mapping_hash;
102
 
 
103
  // map each attribute from the $customer parameter (collection item) to the corresponding scoped variable in this class
104
- $this->id = $customer->getId();
105
- $this->_email = $customer->getEmail();
106
- $this->_firstname = $customer->getFirstname();
107
- $this->_lastname = $customer->getLastname();
108
- $this->_dob = $customer->getDob();
109
- $this->_gender = $this->getCustomerGender($customer->getGender());
110
- $this->_title = $customer->getPrefix();
111
-
112
- $this->_website_created_on = $this->getWebsiteName($customer->getWebsiteId());
113
- $this->_store_created_on = $this->getStoreName($customer->getStoreId());
114
- $this->_account_created = $customer->getCreatedAt();
115
- $this->_last_logged_in = $customer->getLastLoggedIn();
116
- $this->_customer_group = $this->getCustomerGroup($customer->getGroupId());
117
- $this->_billing_address_1 = $this->getStreet($customer->getBillingStreet(), 1);
118
- $this->_billing_address_2 = $this->getStreet($customer->getBillingStreet(), 2);
119
-
120
- $this->_billing_city = $customer->getBillingCity();
121
- $this->_billing_country = $customer->getBillingCountryCode();
122
- $this->_billing_postcode = $customer->getBillingPostcode();
123
- $this->_billing_telephone = $customer->getBillingTelephone();
124
-
125
- $this->_delivery_address_1 = $this->getStreet($customer->getShippingStreet(), 1);
126
- $this->_delivery_address_2 = $this->getStreet($customer->getShippingStreet(), 2);
127
-
128
- $this->_delivery_city = $customer->getShippingCity();
129
- $this->_delivery_country = $customer->getShippingCountryCode();
130
- $this->_delivery_postcode = $customer->getShippingPostcode();
131
- $this->_delivery_telephone = $customer->getShippingTelephone();
132
-
133
- $this->_total_orders = $customer->getTotalOrders();
134
- $this->_average_order_value = $customer->getAverageOrderValue();
135
- $this->_total_spend = $customer->getTotalSpend();
136
-
137
- $lastOrder = new Zend_Date($customer->getLastPurchase());
138
- //$this->_last_order = $lastOrder->toString(Zend_Date::ISO_8601);
139
- $this->_last_order = $customer->getLastPurchase();
140
- $this->_last_order_no = $customer->getLastOrderNo();
141
-
142
- $this->_is_subscribed_to_newsletter = ($customer->getSubscriberStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)? true : false;
143
- $this->_dotmailer_contact_id = $customer->getDotmailerContactId();
144
- $this->_customer_id = $customer->getId();
145
  }
146
 
147
- public function toCSVArray() {
148
-
149
  // no iterating, just create an array()
150
-
151
  $result = array();
152
 
153
  // Email is the only required field in the CSV upload
154
  $result[] = $this->_email;
155
 
156
- if ($this->_mapping_hash[0]!="0") $result[] = $this->_firstname;
157
- if ($this->_mapping_hash[1]!="0") $result[] = $this->_lastname;
158
- if ($this->_mapping_hash[2]!="0") $result[] = $this->_dob;
159
- if ($this->_mapping_hash[3]!="0") $result[] = $this->_gender;
160
- if ($this->_mapping_hash[4]!="0") $result[] = $this->_title;
161
 
162
- if ($this->_mapping_hash[5]!="0") $result[] = $this->_website_created_on;
163
- if ($this->_mapping_hash[6]!="0") $result[] = $this->_store_created_on;
164
- if ($this->_mapping_hash[7]!="0") $result[] = $this->_account_created;
165
- if ($this->_mapping_hash[8]!="0") $result[] = $this->_last_logged_in;
166
  if ($this->_mapping_hash[9]!="0") $result[] = $this->_customer_group;
167
 
168
  if ($this->_mapping_hash[10]!="0") $result[] = $this->_billing_address_1;
@@ -179,17 +118,15 @@ class Dotdigitalgroup_Email_Model_Connector_Customer{
179
  if ($this->_mapping_hash[20]!="0") $result[] = $this->_delivery_postcode;
180
  if ($this->_mapping_hash[21]!="0") $result[] = $this->_delivery_telephone;
181
 
182
- if ($this->_mapping_hash[22]!="0") $result[] = $this->_total_orders;
183
  if ($this->_mapping_hash[23]!="0") $result[] = $this->_average_order_value;
184
  if ($this->_mapping_hash[24]!="0") $result[] = $this->_total_spend;
185
- if ($this->_mapping_hash[25]!="0") $result[] = $this->_last_order;
186
- if ($this->_mapping_hash[26]!="0") $result[] = $this->_last_order_no;
187
  if ($this->_mapping_hash[27]!="0") $result[] = $this->_customer_id;
188
-
189
- $result[] = 'Html';
190
 
191
  return $result;
192
-
193
  }
194
 
195
  // returns the object as JSON
@@ -283,4 +220,9 @@ class Dotdigitalgroup_Email_Model_Connector_Customer{
283
  return '';
284
  }
285
 
 
 
 
 
 
286
  }
11
  private $_dob;
12
  private $_gender;
13
  private $_title;
14
+ private $_website_name;
15
+ private $_store_name;
16
+ private $_created_at;
 
17
  private $_customer_group;
18
  // Customer Address Data
19
  private $_billing_address_1;
29
  private $_delivery_postcode;
30
  private $_delivery_telephone;
31
  // Customer Sales Data
32
+ private $_number_of_orders;
33
  private $_average_order_value;
34
  private $_total_spend;
35
+ private $_last_order_date;
36
+ private $_last_order_id;
 
 
 
 
37
 
38
+ private $_customer_id;
39
+ private $_last_logged_date;
40
+ private $_mapping_hash;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  public function getEmail()
43
  {
45
  }
46
 
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  // class constructor - takes
49
+ public function __construct( $customer){
 
 
50
 
51
+ $this->_mapping_hash = Mage::helper('connector')->getMappingHash($customer->getWebsiteId());
52
  // map each attribute from the $customer parameter (collection item) to the corresponding scoped variable in this class
53
+ $this->_email = $customer->getEmail();
54
+ $this->_firstname = $customer->getFirstname();
55
+ $this->_lastname = $customer->getLastname();
56
+ $this->_dob = $customer->getDob();
57
+ $this->_gender = $this->getCustomerGender($customer->getGender());
58
+ $this->_title = $customer->getPrefix();
59
+ $this->_website_name = $this->getWebsiteName($customer->getWebsiteId());
60
+ $this->_store_name = $this->getStoreName($customer->getStoreId());
61
+ $this->_created_at = $customer->getCreatedAt();
62
+ $this->_last_logged_date = $customer->getLastLoggedDate();
63
+ $this->_customer_group = $this->getCustomerGroup($customer->getGroupId());
64
+
65
+ $this->_billing_address_1 = $this->getStreet($customer->getBillingStreet(), 1);
66
+ $this->_billing_address_2 = $this->getStreet($customer->getBillingStreet(), 2);
67
+ $this->_billing_city = $customer->getBillingCity();
68
+ $this->_billing_country = $customer->getBillingCountryCode();
69
+ $this->_billing_postcode = $customer->getBillingPostcode();
70
+ $this->_billing_telephone = $customer->getBillingTelephone();
71
+
72
+ $this->_delivery_address_1 = $this->getStreet($customer->getShippingStreet(), 1);
73
+ $this->_delivery_address_2 = $this->getStreet($customer->getShippingStreet(), 2);
74
+ $this->_delivery_city = $customer->getShippingCity();
75
+ $this->_delivery_country = $customer->getShippingCountryCode();
76
+ $this->_delivery_postcode = $customer->getShippingPostcode();
77
+ $this->_delivery_telephone = $customer->getShippingTelephone();
78
+
79
+ $this->_number_of_orders = $customer->getNumberOfOrders();
80
+ $this->_average_order_value = $customer->getAverageOrderValue();
81
+ $this->_total_spend = $customer->getTotalSpend();
82
+ $this->_last_order_date = $customer->getLastOrderDate();
83
+ $this->_last_order_id = $customer->getLastOrderId();
84
+ $this->_customer_id = $customer->getId();
 
 
 
 
 
 
 
 
 
85
  }
86
 
87
+ public function toCSVArray()
88
+ {
89
  // no iterating, just create an array()
 
90
  $result = array();
91
 
92
  // Email is the only required field in the CSV upload
93
  $result[] = $this->_email;
94
 
95
+ if ($this->_mapping_hash[0]!="0") $result[] = $this->_title;
96
+ if ($this->_mapping_hash[1]!="0") $result[] = $this->_firstname;
97
+ if ($this->_mapping_hash[2]!="0") $result[] = $this->_lastname;
98
+ if ($this->_mapping_hash[3]!="0") $result[] = $this->_dob;
99
+ if ($this->_mapping_hash[4]!="0") $result[] = $this->_gender;
100
 
101
+ if ($this->_mapping_hash[5]!="0") $result[] = $this->_website_name;
102
+ if ($this->_mapping_hash[6]!="0") $result[] = $this->_store_name;
103
+ if ($this->_mapping_hash[7]!="0") $result[] = $this->_created_at;
104
+ if ($this->_mapping_hash[8]!="0") $result[] = $this->_last_logged_date;
105
  if ($this->_mapping_hash[9]!="0") $result[] = $this->_customer_group;
106
 
107
  if ($this->_mapping_hash[10]!="0") $result[] = $this->_billing_address_1;
118
  if ($this->_mapping_hash[20]!="0") $result[] = $this->_delivery_postcode;
119
  if ($this->_mapping_hash[21]!="0") $result[] = $this->_delivery_telephone;
120
 
121
+ if ($this->_mapping_hash[22]!="0") $result[] = $this->_number_of_orders;
122
  if ($this->_mapping_hash[23]!="0") $result[] = $this->_average_order_value;
123
  if ($this->_mapping_hash[24]!="0") $result[] = $this->_total_spend;
124
+ if ($this->_mapping_hash[25]!="0") $result[] = $this->_last_order_date;
125
+ if ($this->_mapping_hash[26]!="0") $result[] = $this->_last_order_id;
126
  if ($this->_mapping_hash[27]!="0") $result[] = $this->_customer_id;
127
+ $result[] = 'Html';
 
128
 
129
  return $result;
 
130
  }
131
 
132
  // returns the object as JSON
220
  return '';
221
  }
222
 
223
+ public function setMappigHash( $value)
224
+ {
225
+ $this->_mapping_hash[] = $value;
226
+ }
227
+
228
  }
app/code/community/Dotdigitalgroup/Email/Model/Connector/Datafield.php ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Connector_Datafield
4
+ {
5
+ /**
6
+ * Datafield entities
7
+ */
8
+ public $name;
9
+ public $type;
10
+ public $visibility;
11
+ public $defaultValue;
12
+
13
+ public $datafields = array();
14
+
15
+ public $data;
16
+
17
+ public function getData()
18
+ {
19
+ $this->data = Mage::getConfig()->loadModulesConfiguration('umc_source.xml')->applyExtends();
20
+
21
+ }
22
+ /**
23
+ * Default datafields
24
+ * @return array
25
+ */
26
+ protected $_defaultDataFields = array(
27
+ array(
28
+ 'name' => 'CUSTOMER_ID',
29
+ 'type' => 'string',
30
+ 'visibility' => 'private',
31
+ ),array(
32
+ 'name' => 'LAST_ORDER_ID',
33
+ 'type' => 'numeric',
34
+ 'visibility' => 'private',
35
+ ),array(
36
+ 'name' => 'ORDER_INCREMENT_ID',
37
+ 'type' => 'numeric',
38
+ 'visibility' => 'private',
39
+ )
40
+ );
41
+
42
+ private $_contactDatafields = array(
43
+ 'customer_id' => array(
44
+ 'name' => 'CUSTOMER_ID',
45
+ 'type' => 'numeric',
46
+ 'visibility' => 'public',
47
+ ),
48
+ 'firstname' => array(
49
+ 'name' => 'FIRSTNAME',
50
+ 'type' => 'string'
51
+ ),
52
+ 'lastname' => array(
53
+ 'name' => 'LASTNAME',
54
+ 'type' => 'string'
55
+ ),
56
+ 'gender' => array(
57
+ 'name' => 'GENDER',
58
+ 'type' => 'string'
59
+ ),
60
+ 'dob' => array(
61
+ 'name' => 'DOB',
62
+ 'type' => 'date',
63
+ 'visibility' => 'public',
64
+ ),
65
+ 'title' => array(
66
+ 'name' => 'TITLE',
67
+ 'type' => 'string',
68
+ 'visibility' => 'public',
69
+ ),
70
+ 'website_name' => array(
71
+ 'name' => 'WEBSITE_NAME',
72
+ 'type' => 'string',
73
+ 'visibility' => 'public',
74
+ ),
75
+ 'store_name' => array(
76
+ 'name' => 'STORE_NAME',
77
+ 'type' => 'string',
78
+ 'visibility' => 'public',
79
+ ),
80
+ 'created_at' => array(
81
+ 'name' => 'ACCOUNT_CREATED_DATE',
82
+ 'type' => 'date',
83
+ 'visibility' => 'public'
84
+ ),
85
+ 'last_logged_date' => array(
86
+ 'name' => 'LAST_LOGGEDIN_DATE',
87
+ 'type' => 'date',
88
+ 'visibility' => 'public'
89
+ ),
90
+ 'customer_group' => array(
91
+ 'name' => 'CUSTOMER_GROUP',
92
+ 'type' => 'string',
93
+ 'visibility' => 'public',
94
+ ),
95
+ 'billing_address_1' => array(
96
+ 'name' => 'BILLING_ADDRESS_1',
97
+ 'type' => 'string',
98
+ 'visibility' => 'private',
99
+ 'defaultValue' => ''
100
+ ),
101
+ 'billing_address_2' => array(
102
+ 'name' => 'BILLING_ADDRESS_2',
103
+ 'type' => 'string',
104
+ 'visibility' => 'public',
105
+ ),
106
+ 'billing_state' => array(
107
+ 'name' => 'BILLING_STATE',
108
+ 'type' => 'string',
109
+ 'visibility' => 'public'
110
+ ),
111
+ 'billing_city' => array(
112
+ 'name' => 'BILLING_CITY',
113
+ 'type' => 'string',
114
+ 'visibility' => 'public',
115
+ ),
116
+ 'billing_country' => array(
117
+ 'name' => 'BILLING_COUNTRY',
118
+ 'type' => 'string',
119
+ 'visibility' => 'public',
120
+ ),
121
+ 'billing_postcode' => array(
122
+ 'name' => 'BILLING_POSTCODE',
123
+ 'type' => 'string',
124
+ 'visibility' => 'public',
125
+ ),
126
+ 'billing_telephone' => array(
127
+ 'name' => 'BILLING_TELEPHONE',
128
+ 'type' => 'string',
129
+ 'visibility' => 'public',
130
+ ),
131
+ 'delivery_address_1' => array(
132
+ 'name' => 'DELIVERY_ADDRESS_1',
133
+ 'type' => 'string',
134
+ 'visibility' => 'public',
135
+ ),
136
+ 'delivery_address_2' => array(
137
+ 'name' => 'DELIVERY_ADDRESS_2',
138
+ 'type' => 'string',
139
+ 'visibility' => 'public',
140
+ ),
141
+ 'delivery_state' => array(
142
+ 'name' => 'DELIVERY_STATE',
143
+ 'type' => 'string',
144
+ 'visibility' => 'public'
145
+ ),
146
+ 'delivery_city' => array(
147
+ 'name' => 'DELIVERY_CITY',
148
+ 'type' => 'string',
149
+ 'visibility' => 'public',
150
+ ),
151
+ 'delivery_country' => array(
152
+ 'name' => 'DELIVERY_COUNTRY',
153
+ 'type' => 'string',
154
+ 'visibility' => 'public',
155
+ ),
156
+ 'delivery_postcode' => array(
157
+ 'name' => 'DELIVERY_POSTCODE',
158
+ 'type' => 'string',
159
+ 'visibility' => 'public',
160
+ ),
161
+ 'delivery_telephone' => array(
162
+ 'name' => 'DELIVERY_TELEPHONE',
163
+ 'type' => 'string',
164
+ 'visibility' => 'public',
165
+ ),
166
+ 'number_of_orders' => array(
167
+ 'name' => 'NUMBER_OF_ORDERS',
168
+ 'type' => 'numeric',
169
+ 'visibility' => 'public',
170
+ ),
171
+ 'total_spend' => array(
172
+ 'name' => 'TOTAL_SPEND',
173
+ 'type' => 'numeric',
174
+ 'visibility' => 'public',
175
+ ),
176
+ 'average_order_value' => array(
177
+ 'name' => 'AVERAGE_ORDER_VALUE',
178
+ 'type' => 'numeric',
179
+ 'visibility' => 'public',
180
+ ),
181
+ 'last_order_date' => array(
182
+ 'name' => 'LAST_ORDER_DATE',
183
+ 'type' => 'date',
184
+ 'visibility' => 'public',
185
+ ),
186
+ 'last_order_id' => array(
187
+ 'name' => 'LAST_ORDER_ID',
188
+ 'type' => 'numeric',
189
+ 'visibility' => 'private',
190
+ )
191
+ );
192
+
193
+ private $_transactionalDefaultDatafields = array(
194
+ array(
195
+ 'name' => 'CUSTOMER_ID',
196
+ 'type' => 'string',
197
+ 'visibility' => 'private',
198
+ ),array(
199
+ 'name' => 'LAST_ORDER_ID',
200
+ 'type' => 'numeric',
201
+ 'visibility' => 'private',
202
+ ),array(
203
+ 'name' => 'ORDER_INCREMENT_ID',
204
+ 'type' => 'numeric',
205
+ 'visibility' => 'private',
206
+ ),
207
+ array(
208
+ 'name' => 'WEBSITE_NAME',
209
+ 'type' => 'string',
210
+ 'visibility' => 'private',
211
+ ),
212
+ array(
213
+ 'name' => 'STORE_NAME',
214
+ 'type' => 'string',
215
+ 'visibility' => 'private',
216
+ ),
217
+ array(
218
+ 'name' => 'LAST_ORDER_DATE',
219
+ 'type' => 'date',
220
+ 'visibility' => 'private',
221
+ )
222
+ );
223
+
224
+
225
+
226
+ /**
227
+ * @param array $contactDatafields
228
+ */
229
+ public function setContactDatafields($contactDatafields)
230
+ {
231
+ $this->_contactDatafields = $contactDatafields;
232
+ }
233
+
234
+ /**
235
+ * @return array
236
+ */
237
+ public function getContactDatafields()
238
+ {
239
+ return $this->_contactDatafields;
240
+ }
241
+
242
+ /**
243
+ * @param array $transactionalDefaultDatafields
244
+ */
245
+ public function setTransactionalDefaultDatafields($transactionalDefaultDatafields)
246
+ {
247
+ $this->_transactionalDefaultDatafields = $transactionalDefaultDatafields;
248
+ }
249
+
250
+ /**
251
+ * @return array
252
+ */
253
+ public function getTransactionalDefaultDatafields()
254
+ {
255
+ return $this->_transactionalDefaultDatafields;
256
+ }
257
+
258
+ /**
259
+ * @param mixed $defaultDataFields
260
+ */
261
+ public function setDefaultDataFields($defaultDataFields)
262
+ {
263
+ $this->_defaultDataFields = $defaultDataFields;
264
+ }
265
+
266
+ /**
267
+ * @return mixed
268
+ */
269
+ public function getDefaultDataFields()
270
+ {
271
+ return $this->_defaultDataFields;
272
+ }
273
+
274
+ public function setDatafield($name, $value, $type = 'string', $visibility = 'public')
275
+ {
276
+ $this->datafields[] = array(
277
+ 'name' => $name,
278
+ 'value' => $value,
279
+ 'type' => $type,
280
+ 'visibility' => $visibility
281
+ );
282
+ return $this->datafields;
283
+ }
284
+
285
+ }
app/code/community/Dotdigitalgroup/Email/Model/Connector/Order.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Connector_Order
4
+ {
5
+ /**
6
+ * Order Increment ID
7
+ * @var string
8
+ */
9
+ public $id;
10
+ /**
11
+ * Email
12
+ * @var string
13
+ */
14
+ public $email;
15
+ /**
16
+ * @var int
17
+ */
18
+ public $quote_id;
19
+ /**
20
+ * @var string
21
+ */
22
+ public $store_name;
23
+ /**
24
+ * @var string
25
+ */
26
+ public $purchase_date;
27
+ /**
28
+ * @var string
29
+ */
30
+ public $delivery_address;
31
+ /**
32
+ * @var string
33
+ */
34
+ public $billing_address;
35
+ /**
36
+ * @var array
37
+ */
38
+ public $products = array();
39
+ /**
40
+ * @var float
41
+ */
42
+ public $order_subtotal;
43
+ /**
44
+ * @var float
45
+ */
46
+ public $discount_ammount;
47
+ /**
48
+ * @var float
49
+ */
50
+ public $order_total;
51
+ /**
52
+ * @var array
53
+ */
54
+ public $categories;
55
+ /**
56
+ * Payment name
57
+ * @var string
58
+ */
59
+ public $payment;
60
+ /**
61
+ * @var string
62
+ */
63
+ public $delivery_method;
64
+ /**
65
+ * @var float
66
+ */
67
+ public $delivery_total;
68
+ /**
69
+ * @var string
70
+ */
71
+ public $currency;
72
+
73
+ /**
74
+ * set the order information
75
+ * @param Mage_Sales_Model_Order $orderData
76
+ */
77
+ public function __construct(Mage_Sales_Model_Order $orderData)
78
+ {
79
+ $customerModel = Mage::getModel('customer/customer');
80
+ $customerModel->load($orderData->getCustomerId());
81
+
82
+ $this->id = $orderData->getIncrementId();
83
+ $this->quote_id = $orderData->getQuoteId();
84
+ $this->email = $orderData->getCustomerEmail();
85
+ $this->store_name = $orderData->getStoreName();
86
+ $created_at = new Zend_Date($orderData->getCreatedAt(), Zend_Date::ISO_8601);
87
+ $this->purchase_date = $created_at->toString(Zend_Date::ISO_8601);
88
+ $this->delivery_method = $orderData->getShippingDescription();
89
+ $this->delivery_total = $orderData->getShippingAmount();
90
+ $this->currency = $orderData->getStoreCurrencyCode();
91
+ $this->payment = $orderData->getPayment()->getMethodInstance()->getTitle();
92
+
93
+ /**
94
+ * Billing address.
95
+ */
96
+ if($orderData->getBillingAddress()){
97
+ $billingData = $orderData->getBillingAddress()->getData();
98
+ $this->billing_address = array(
99
+ 'billing_address_1' => $this->getStreet($billingData['street'], 1),
100
+ 'billing_address_2' => $this->getStreet($billingData['street'], 2),
101
+ 'billing_city' => $billingData['city'],
102
+ 'billing_region' => $billingData['region'],
103
+ 'billing_country' => $billingData['country_id'],
104
+ 'billing_postcode' => $billingData['postcode'],
105
+ );
106
+ }
107
+ /**
108
+ * Shipping address.
109
+ */
110
+ if($orderData->getShippingAddress()){
111
+ $shippingData = $orderData->getShippingAddress()->getData();
112
+
113
+ $this->delivery_address = array(
114
+ 'delivery_address_1' => $this->getStreet($shippingData['street'], 1),
115
+ 'delivery_address_2' => $this->getStreet($shippingData['street'], 2),
116
+ 'delivery_city' => $shippingData['city'],
117
+ 'delivery_region' => $shippingData['region'],
118
+ 'delivery_country' => $shippingData['country_id'],
119
+ 'delivery_postcode' => $shippingData['postcode']
120
+ );
121
+ }
122
+
123
+ /**
124
+ * Order items.
125
+ */
126
+ foreach ($orderData->getAllItems() as $productItem) {
127
+ $product = $productItem->getProduct();
128
+ if($product){
129
+ // category names
130
+ $categoryCollection = $product->getCategoryCollection()
131
+ ->addAttributeToSelect('name');
132
+
133
+ foreach ($categoryCollection as $cat) {
134
+ $categories = array();
135
+ $categories[] = $cat->getName();
136
+ $this->categories[]['Name'] = substr(implode(', ', $categories), 0, 244);
137
+ }
138
+ }
139
+
140
+ $this->products[] = array(
141
+ 'name' => $productItem->getName(),
142
+ 'sku' => $productItem->getSku(),
143
+ 'qty' => (int)number_format($productItem->getData('qty_ordered'), 2),
144
+ 'price' => (float)number_format($productItem->getPrice(), 2),
145
+ );
146
+ }
147
+
148
+ $this->order_subtotal = (float)number_format($orderData->getData('subtotal'), 2);
149
+ $this->discount_ammount = (float)number_format($orderData->getData('discount_amount'), 2);
150
+ $orderTotal = abs($orderData->getData('grand_total') - $orderData->getTotalRefunded());
151
+ $this->order_total = (float)number_format($orderTotal, 2);
152
+
153
+ return true;
154
+ }
155
+ /**
156
+ * get the street name by line number
157
+ * @param $street
158
+ * @param $line
159
+ * @return string
160
+ */
161
+ private function getStreet($street, $line)
162
+ {
163
+ $street = explode("\n", $street);
164
+ if($line == 1){
165
+ return $street[0];
166
+ }
167
+ if(isset($street[$line -1])){
168
+
169
+ return $street[$line - 1];
170
+ }else{
171
+
172
+ return '';
173
+ }
174
+ }
175
+ // exposes the class as an array of objects
176
+ public function expose() {
177
+
178
+ return get_object_vars($this);
179
+
180
+ }
181
+
182
+ }
app/code/community/Dotdigitalgroup/Email/Model/Contact.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+ * Contact model.
6
+ */
7
+ class Dotdigitalgroup_Email_Model_Contact extends Mage_Core_Model_Abstract
8
+ {
9
+
10
+ const EMAIL_CONTACT_IMPORTED = 1;
11
+ const EMAIL_CONTACT_NOT_IMPORTED = null;
12
+ const EMAIL_SUBSCRIBER_NOT_IMPORTED = null;
13
+ /**
14
+ * constructor
15
+ */
16
+ public function _construct(){
17
+ parent::_construct();
18
+ $this->_init('email_connector/contact');
19
+ }
20
+
21
+
22
+ /**
23
+ * @return $this|Mage_Core_Model_Abstract
24
+ */
25
+ protected function _beforeSave(){
26
+ parent::_beforeSave();
27
+ $now = Mage::getSingleton('core/date')->gmtDate();
28
+ if ($this->isObjectNew()){
29
+ $this->setCreatedAt($now);
30
+ }
31
+ return $this;
32
+ }
33
+
34
+ /**
35
+ * Reset the imported contacts
36
+ * @return int
37
+ */
38
+ public function resetAllContacts()
39
+ {
40
+
41
+ /** @var $coreResource Mage_Core_Model_Resource */
42
+ $coreResource = Mage::getSingleton('core/resource');
43
+
44
+ /** @var $conn Varien_Db_Adapter_Pdo_Mysql */
45
+ $conn = $coreResource->getConnection('core_write');
46
+
47
+ try{
48
+ $num = $conn->update($coreResource->getTableName('email_connector/contact'),
49
+ array('email_imported' => new Zend_Db_Expr('null')),
50
+ $conn->quoteInto('email_imported is ?', new Zend_Db_Expr('not null'))
51
+ );
52
+ }catch (Exception $e){
53
+ Mage::logException($e);
54
+ }
55
+ /**
56
+ * Reset subscribers.
57
+ */
58
+ $this->resetSubscribers();
59
+
60
+ return $num;
61
+ }
62
+
63
+
64
+ /**
65
+ * Load contact by customer id
66
+ * @param $customerId
67
+ * @return mixed
68
+ */
69
+ public function loadByCustomerId($customerId)
70
+ {
71
+ $collection = $this->getCollection()
72
+ ->addFieldToFilter('customer_id', $customerId);
73
+ if($collection->count())
74
+ return $collection->getFirstItem();
75
+ return $this;
76
+
77
+ }
78
+
79
+ public function getContactsToImportForWebsite($websiteId, $pageSize = 100)
80
+ {
81
+ $collection = $this->getCollection()
82
+ ->addFieldToFilter('website_id', $websiteId)
83
+ ->addFieldToFilter('email_imported', array('null' => true))
84
+ ->addFieldToFilter('customer_id', array('notnull' => true))
85
+ ;
86
+
87
+ $collection->getSelect()->limit($pageSize);
88
+
89
+ return $collection;
90
+ }
91
+
92
+ /**
93
+ * Get missing contacts.
94
+ * @param $websiteId
95
+ * @param int $pageSize
96
+ * @return mixed
97
+ */
98
+ public function getMissingContacts($websiteId, $pageSize = 100)
99
+ {
100
+ $collection = $this->getCollection()
101
+ ->addFieldToFilter('contact_id', array('null' => true))
102
+ ->addFieldToFilter('suppressed', null)
103
+ ->addFieldToFilter('website_id', $websiteId);
104
+
105
+ $collection->getSelect()->limit($pageSize);
106
+
107
+ return $collection->load();
108
+ }
109
+
110
+ /**
111
+ * Load Contact by Email.
112
+ * @param $email
113
+ * @param $websiteId
114
+ * @return $this
115
+ */
116
+ public function loadByCustomerEmail($email, $websiteId)
117
+ {
118
+ $collection = $this->getCollection()
119
+ ->addFieldToFilter('email', $email)
120
+ ->addFieldToFilter('website_id', $websiteId)
121
+ ;
122
+ if($collection->count()){
123
+ return $collection->getFirstItem();
124
+ }else{
125
+ $this->setEmail($email)
126
+ ->setWebsiteId($websiteId);
127
+ }
128
+ return $this;
129
+ }
130
+
131
+ public function getSubscribersToImport($website, $limit = 1000)
132
+ {
133
+ $storeIds = $website->getStoreIds();
134
+ $collection = $this->getCollection()
135
+ ->addFieldToFilter('is_subscriber', array('notnull' => true))
136
+ ->addFieldToFilter('subscriber_imported', array('null' => true))
137
+ ->addFieldToFilter('store_id', array('in' => $storeIds))
138
+ ;
139
+
140
+ $collection->getSelect()->limit($limit);
141
+
142
+ return $collection;
143
+ }
144
+
145
+ public function getGuests($website)
146
+ {
147
+ $guestCollection = $this->getCollection()
148
+ ->addFieldToFilter('is_guest', array('notnull' => true))
149
+ ->addFieldToFilter('email_imported', self::EMAIL_CONTACT_NOT_IMPORTED)
150
+ ->addFieldToFilter('website_id', $website->getId())
151
+ ;
152
+
153
+ return $guestCollection->load();
154
+ }
155
+
156
+ public function getNumberOfImportedContacs()
157
+ {
158
+
159
+ $collection = $this->getCollection()
160
+ ->addFieldToFilter('email_imported', array('notnull' => true));
161
+
162
+ return $collection->getSize();
163
+ }
164
+
165
+ public function resetSubscribers()
166
+ {
167
+ $collection = $this->getCollection()
168
+ ->addFieldToFilter('is_subscriber', array('notnull' => true))
169
+ ->addFieldToFilter('subscriber_imported', array('notnull' => true));
170
+ foreach ($collection as $contact) {
171
+ $contact->setSubscriberImported(null)->save();
172
+ }
173
+ return $collection->count();
174
+ }
175
+ }
app/code/community/Dotdigitalgroup/Email/Model/Cron.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Cron
4
+ {
5
+ /**
6
+ * CRON FOR CONTACTS SYNC
7
+ */
8
+ public function contactSync()
9
+ {
10
+ // send customers
11
+ Mage::getModel('email_connector/apiconnector_contact')->sync();
12
+ }
13
+
14
+ /**
15
+ * CRON FOR LOST BASKET
16
+ */
17
+ public function lostBaskets()
18
+ {
19
+ // send lost basket
20
+ Mage::getModel('email_connector/sales_quote')->proccessLostBaskets();
21
+
22
+ }
23
+
24
+ /**
25
+ * CRON FOR ORDER TRANSACTIONAL DATA
26
+ */
27
+ public function orderSync()
28
+ {
29
+ // send order
30
+ Mage::getModel('email_connector/sales_order')->sync();
31
+ }
32
+
33
+ /**
34
+ * CRON FOR SUBSCRIBERS AND GUEST CONTACTS
35
+ */
36
+ public function subscribersAndGuestSync()
37
+ {
38
+ //sync subscribers
39
+ Mage::getModel('email_connector/newsletter_subscriber')
40
+ ->sync()
41
+ ->unsubscribe();
42
+ //sync guests
43
+ Mage::getModel('email_connector/customer_guest')->sync();
44
+ }
45
+
46
+ /**
47
+ * CRON FOR EMAILS SENDING
48
+ */
49
+ public function sendMappedEmails()
50
+ {
51
+ Mage::getModel('email_connector/campaign')->sendCampaigns();
52
+
53
+ return $this;
54
+ }
55
+
56
+ /**
57
+ * CLEAN ARHIVED FOLDERS
58
+ */
59
+
60
+ public function cleaning()
61
+ {
62
+ $helper = Mage::helper('connector/file');
63
+ $archivedFolder = $helper->getArchiveFolder();
64
+ $result = $helper->deleteDir($archivedFolder);
65
+ $helper->log('Cleaning cronjob result : ' . $result);
66
+ return $result;
67
+ }
68
+
69
+ }
app/code/community/Dotdigitalgroup/Email/Model/Customer/Guest.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Customer_Guest
4
+ {
5
+ protected $_countGuests = 0;
6
+ protected $_start;
7
+
8
+ public function sync()
9
+ {
10
+ /** @var Dotdigitalgroup_Email_Helper_Data $helper */
11
+ $helper = Mage::helper('connector');
12
+ $helper->log('----------- Start guest sync ----------');
13
+ $this->_start = microtime(true);
14
+ foreach(Mage::app()->getWebsites() as $website)
15
+ $this->_exportGuestPerWebsite($website);
16
+ $helper->log('---- End Guest total time for guest sync : ' . gmdate("H:i:s", microtime(true) - $this->_start));
17
+ return;
18
+ }
19
+
20
+ public function _exportGuestPerWebsite(Mage_Core_Model_Website $website)
21
+ {
22
+ $helper = Mage::helper('connector');
23
+ $fileHelper = Mage::helper('connector/file');
24
+ $guests = Mage::getModel('email_connector/contact')->getGuests($website);
25
+ if($guests->getSize()){
26
+ $client = Mage::helper('connector')->getWebsiteApiClient($website);
27
+ $guestFilename = strtolower($website->getCode() . '_guest_' . date('d_m_Y_Hi') . '.csv');
28
+ $helper->log('Guest file: ' . $guestFilename);
29
+ $storeName = $helper->getMappedStoreName($website);
30
+ $fileHelper->outputCSV($fileHelper->getFilePath($guestFilename), array('Email', 'emailType', $storeName));
31
+ foreach ($guests as $guest) {
32
+ $email = $guest->getEmail();
33
+ try{
34
+ $guest->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_IMPORTED)
35
+ ->save();
36
+ $storeName = $website->getName();
37
+ // save data for guests
38
+ $fileHelper->outputCSV($fileHelper->getFilePath($guestFilename), array($email, 'Html', $storeName));
39
+ $this->_countGuests++;
40
+ }catch (Exception $e){
41
+ Mage::logException($e);
42
+ }
43
+ }
44
+ if($this->_countGuests){
45
+ //Add to guest address book
46
+ $client->postAddressBookContactsImport($guestFilename, $helper->getGuestAddressBook($website));
47
+ }
48
+ //arhive guest file
49
+ $fileHelper->archiveCSV($guestFilename);
50
+ }
51
+ }
52
+ }
app/code/community/Dotdigitalgroup/Email/Model/Customer/Observer.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Customer_Observer
4
+ {
5
+ /**
6
+ * Create new contact or update info, also check for email change
7
+ * event: customer_save_before
8
+ * @param Varien_Event_Observer $observer
9
+ * @return $this
10
+ */
11
+ public function handleCustomerSaveBefore(Varien_Event_Observer $observer)
12
+ {
13
+ $customer = $observer->getEvent()->getCustomer();
14
+ $email = $customer->getEmail();
15
+ $websiteId = $customer->getWebsiteId();
16
+ $customerId = $customer->getEntityId();
17
+ try{
18
+ $contactModel = Mage::getModel('email_connector/contact')->loadByCustomerEmail($email, $websiteId);
19
+ $contactModel->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_NOT_IMPORTED)
20
+ ->setCustomerId($customerId)
21
+ ->save();
22
+ }catch(Exception $e){
23
+ Mage::logException($e);
24
+ }
25
+
26
+ return $this;
27
+ }
28
+ }
app/code/{local/Dotdigitalgroup/Email/Model/Connector → community/Dotdigitalgroup/Email/Model/Customer}/Wishlist.php RENAMED
@@ -1,40 +1,21 @@
1
  <?php
2
 
3
- class Dotdigitalgroup_Email_Model_Connector_Wishlist
4
  {
5
- protected $id;
6
- protected $customer_id;
7
- protected $connector_id;
8
-
9
- public $name;
10
 
11
  public $items = array();
12
 
13
  protected $total_wishlist_value;
14
 
15
- public function __construct($customer){
16
 
17
- $this->setConnectorId($customer->getDotmailerContactId());
18
- $this->setCustomerId($customer->id);
19
  }
20
 
21
- /**
22
- * @param mixed $connector_id
23
- */
24
- public function setConnectorId($connector_id)
25
- {
26
- $this->connector_id = $connector_id;
27
- }
28
-
29
- /**
30
- * @return mixed
31
- */
32
- public function getConnectorId()
33
- {
34
- return $this->connector_id;
35
- }
36
-
37
-
38
  /**
39
  * @param mixed $customer_id
40
  */
@@ -53,11 +34,13 @@ class Dotdigitalgroup_Email_Model_Connector_Wishlist
53
  }
54
 
55
  /**
56
- * @param mixed $id
 
57
  */
58
  public function setId($id)
59
  {
60
  $this->id = $id;
 
61
  }
62
 
63
  /**
@@ -70,6 +53,7 @@ class Dotdigitalgroup_Email_Model_Connector_Wishlist
70
 
71
  public function setItem($item)
72
  {
 
73
  $this->items[] = $item->expose();
74
 
75
  $this->total_wishlist_value += $item->getTotalValueOfProduct();
@@ -80,7 +64,4 @@ class Dotdigitalgroup_Email_Model_Connector_Wishlist
80
  return get_object_vars($this);
81
 
82
  }
83
-
84
-
85
-
86
  }
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Model_Customer_Wishlist
4
  {
5
+ public $id;
6
+ public $customer_id;
7
+ public $email;
 
 
8
 
9
  public $items = array();
10
 
11
  protected $total_wishlist_value;
12
 
13
+ public function __construct(Mage_Customer_Model_Customer $customer){
14
 
15
+ $this->setCustomerId($customer->getId());
16
+ $this->email = $customer->getEmail();
17
  }
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  /**
20
  * @param mixed $customer_id
21
  */
34
  }
35
 
36
  /**
37
+ * @param $id
38
+ * @return $this
39
  */
40
  public function setId($id)
41
  {
42
  $this->id = $id;
43
+ return $this;
44
  }
45
 
46
  /**
53
 
54
  public function setItem($item)
55
  {
56
+
57
  $this->items[] = $item->expose();
58
 
59
  $this->total_wishlist_value += $item->getTotalValueOfProduct();
64
  return get_object_vars($this);
65
 
66
  }
 
 
 
67
  }
app/code/{local → community}/Dotdigitalgroup/Email/Model/Customer/Wishlist/Item.php RENAMED
@@ -8,6 +8,7 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
8
  protected $qty;
9
  protected $total_value_of_product;
10
 
 
11
  public function __construct($product)
12
  {
13
  $this->setSku($product->getSku());
@@ -15,11 +16,13 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
15
  }
16
 
17
  /**
18
- * @param mixed $name
 
19
  */
20
  public function setName($name)
21
  {
22
  $this->name = $name;
 
23
  }
24
 
25
  /**
@@ -31,11 +34,13 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
31
  }
32
 
33
  /**
34
- * @param mixed $qty
 
35
  */
36
  public function setQty($qty)
37
  {
38
  $this->qty = (int)$qty;
 
39
  }
40
 
41
  /**
@@ -55,7 +60,8 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
55
  }
56
 
57
  /**
58
- * @param mixed $price
 
59
  */
60
  public function setPrice($product)
61
  {
@@ -63,6 +69,7 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
63
  $total = $this->price * $this->qty;
64
 
65
  $this->total_value_of_product = number_format($total, 2);
 
66
  }
67
 
68
  /**
@@ -74,11 +81,13 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
74
  }
75
 
76
  /**
77
- * @param mixed $sku
 
78
  */
79
  public function setSku($sku)
80
  {
81
  $this->sku = $sku;
 
82
  }
83
 
84
  /**
@@ -88,13 +97,12 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
88
  {
89
  return $this->sku;
90
  }
91
- public function expose() {
92
 
 
 
 
 
 
93
  return get_object_vars($this);
94
-
95
  }
96
-
97
-
98
-
99
-
100
  }
8
  protected $qty;
9
  protected $total_value_of_product;
10
 
11
+
12
  public function __construct($product)
13
  {
14
  $this->setSku($product->getSku());
16
  }
17
 
18
  /**
19
+ * @param $name
20
+ * @return $this
21
  */
22
  public function setName($name)
23
  {
24
  $this->name = $name;
25
+ return $this;
26
  }
27
 
28
  /**
34
  }
35
 
36
  /**
37
+ * @param $qty
38
+ * @return $this
39
  */
40
  public function setQty($qty)
41
  {
42
  $this->qty = (int)$qty;
43
+ return $this;
44
  }
45
 
46
  /**
60
  }
61
 
62
  /**
63
+ * @param $product
64
+ * @return $this
65
  */
66
  public function setPrice($product)
67
  {
69
  $total = $this->price * $this->qty;
70
 
71
  $this->total_value_of_product = number_format($total, 2);
72
+ return $this;
73
  }
74
 
75
  /**
81
  }
82
 
83
  /**
84
+ * @param $sku
85
+ * @return $this
86
  */
87
  public function setSku($sku)
88
  {
89
  $this->sku = $sku;
90
+ return $this;
91
  }
92
 
93
  /**
97
  {
98
  return $this->sku;
99
  }
 
100
 
101
+ /**
102
+ * @return array
103
+ */
104
+ public function expose()
105
+ {
106
  return get_object_vars($this);
 
107
  }
 
 
 
 
108
  }
app/code/community/Dotdigitalgroup/Email/Model/Email/Template.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Email_Template extends Mage_Core_Model_Email_Template
4
+ {
5
+ /**
6
+ * Send transactional email to recipient
7
+ *
8
+ * @see Mage_Core_Model_Email_Template::sendTransactional()
9
+ * @param string $templateId
10
+ * @param string|array $sender sneder information, can be declared as part of config path
11
+ * @param string $email recipient email
12
+ * @param string $name recipient name
13
+ * @param array $vars varianles which can be used in template
14
+ * @param int|null $storeId
15
+ * @return Mage_Core_Model_Email_Template
16
+ */
17
+ public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null)
18
+ {
19
+ if (!Mage::helper('connector/transactional')->isMapped($templateId)) {
20
+ return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
21
+ } else {
22
+ $this->setSentSuccess(true);
23
+ return $this;
24
+ }
25
+ }
26
+
27
+ }
app/code/community/Dotdigitalgroup/Email/Model/Email/Template/Mailer.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Email_Template_Mailer extends Mage_Core_Model_Email_Template_Mailer
4
+ {
5
+ private $_registered = array(
6
+ 'sales_email_order_template' => 'New Order',
7
+ 'sales_email_order_guest_template' => 'New Order Guest',
8
+ 'sales_email_order_comment_template' => 'Order Update',
9
+ 'sales_email_order_comment_guest_template' => 'Order Update for Guest',
10
+ 'sales_email_invoice_template' => 'New Invoice',
11
+ 'sales_email_invoice_guest_template' => 'New Invoice for Guest',
12
+ 'sales_email_invoice_comment_template' => 'Invoice Update',
13
+ 'sales_email_invoice_comment_guest_template' => 'Invoice Update for Guest',
14
+ 'sales_email_creditmemo_template' => 'New Credit Memo',
15
+ 'sales_email_creditmemo_guest_template' => 'New Credit Memo for Guest',
16
+ 'sales_email_creditmemo_comment_template' => 'Credit Memo Update',
17
+ 'sales_email_creditmemo_comment_guest_template' => 'Credit Memo Update for Guest',
18
+ 'sales_email_shipment_template' => 'New Shipment',
19
+ 'sales_email_shipment_guest_template' => 'New Shipment for Guest',
20
+ 'sales_email_shipment_comment_template' => 'Shipment Update',
21
+ 'sales_email_shipment_comment_guest_template' => 'Shipment Update for Guest',
22
+ );
23
+ private $_registeredCustomer = array(
24
+ 'customer_create_account_email_template' => 'New Customer Account'
25
+ );
26
+
27
+
28
+ public function send()
29
+ {
30
+ Mage::helper('connector')->log('template id : ' . $this->getTemplateId());
31
+ $templateParams = $this->getTemplateParams();
32
+
33
+ //Disable the emails if the transactional data is mapped
34
+ if (Mage::helper('connector/transactional')->isMapped($this->getTemplateId())) {
35
+ if(array_key_exists($this->getTemplateId(), $this->_registered)){
36
+ $this->_registerOrderCampaign($templateParams);
37
+ }
38
+ if(array_key_exists($this->getTemplateId(), $this->_registeredCustomer)){
39
+ $this->_registerCustomer($templateParams);
40
+ }
41
+ return $this;
42
+ }
43
+
44
+ Mage::helper('connector')->log('NOT MAPPED : ' . $this->getTemplateId());
45
+
46
+ $emailTemplate = Mage::getModel('core/email_template');
47
+ // Send all emails from corresponding list
48
+ while (!empty($this->_emailInfos)) {
49
+ $emailInfo = array_pop($this->_emailInfos);
50
+ // Handle "Bcc" recepients of the current email
51
+ $emailTemplate->addBcc($emailInfo->getBccEmails());
52
+ // Set required design parameters and delegate email sending to Mage_Core_Model_Email_Template
53
+ $emailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $this->getStoreId()))
54
+ ->sendTransactional(
55
+ $this->getTemplateId(),
56
+ $this->getSender(),
57
+ $emailInfo->getToEmails(),
58
+ $emailInfo->getToNames(),
59
+ $this->getTemplateParams(),
60
+ $this->getStoreId()
61
+ );
62
+ }
63
+ return $this;
64
+ }
65
+
66
+
67
+ public function _registerOrderCampaign($data)
68
+ {
69
+ $order = $data['order'];
70
+ $storeId = $order->getStoreId();
71
+ $campaignId = Mage::helper('connector/transactional')->getTransactionalCampaignId($this->getTemplateId(), $storeId);
72
+ if($campaignId){
73
+ Mage::helper('connector')->log('-- Sales Order :' . $campaignId);
74
+ try{
75
+ $now = Mage::getSingleton('core/date')->gmtDate();
76
+ //save email for sending
77
+ $emailCampaign = Mage::getModel('email_connector/campaign');
78
+ $emailCampaign->setOrderIncrementId($order->getRealOrderId())
79
+ ->setQuoteId($order->getQuoteId())
80
+ ->setEmail($order->getCustomerEmail())
81
+ ->setCustomerId($order->getCustomerId())
82
+ ->setStoreId($storeId)
83
+ ->setCampaignId($campaignId)
84
+ ->setEventName($this->_registered[$this->getTemplateId()])
85
+ ->setCreatedAt($now)
86
+ ;
87
+ $emailCampaign->save();
88
+ }catch (Exception $e){
89
+ Mage::logException($e);
90
+ }
91
+ }
92
+ }
93
+
94
+ private function _registerCustomer($data){
95
+ $customer = $data['customer'];
96
+ $storeId = $customer->getStoreId();
97
+ $campaignId = Mage::helper('connector/transactional')->getTransactionalCampaignId($this->getTemplateId(), $storeId);
98
+ if($campaignId){
99
+ Mage::helper('connector')->log('-- Customer campaign: ' . $campaignId);
100
+ try{
101
+ $now = Mage::getSingleton('core/date')->gmtDate();
102
+ //save email for sending
103
+ $emailCampaign = Mage::getModel('email_connector/campaign');
104
+ $emailCampaign->setEmail($customer->getEmail())
105
+ ->setCustomerId($customer->getId())
106
+ ->setStoreId($customer->getStoreId())
107
+ ->setCampaignId($campaignId)
108
+ ->setEventName($this->_registeredCustomer[$this->getTemplateId()])
109
+ ->setCreatedAt($now)
110
+ ;
111
+ $emailCampaign->save();
112
+ }catch (Exception $e){
113
+ Mage::logException($e);
114
+ }
115
+ }
116
+ }
117
+
118
+ }
app/code/community/Dotdigitalgroup/Email/Model/Newsletter/Observer.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Newsletter_Observer
4
+ {
5
+
6
+ public function handleNewsletterSubscriberSave(Varien_Event_Observer $observer)
7
+ {
8
+ $subscriber = $observer->getEvent()->getSubscriber();
9
+ $storeId = $subscriber->getStoreId();
10
+ $email = $subscriber->getEmail();
11
+ $subscriberStatus = $subscriber->getSubscriberStatus();
12
+ $contactId = '';
13
+ $helper = Mage::helper('connector');
14
+ $websiteId = Mage::app()->getStore($subscriber->getStoreId())->getWebsiteId();
15
+ $contactEmail = Mage::getModel('email_connector/contact')->loadByCustomerEmail($email, $websiteId);
16
+ try{
17
+ /**
18
+ * Subscribe a contact
19
+ */
20
+ if($subscriberStatus == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED){
21
+ $contactEmail->setSubscriberStatus($subscriberStatus)
22
+ ->setIsSubscriber(1);
23
+ }else{
24
+ /**
25
+ * Unsubscribe contact
26
+ */
27
+ $client = Mage::helper('connector')->getWebsiteApiClient($websiteId);
28
+ if(!$contactEmail->getContactId()){
29
+ //if contact id is not set get the contact_id
30
+ $result = $client->postContacts($email);
31
+ $contactId = $result->id;
32
+ }else{
33
+ $contactId = $contactEmail->getContactId();
34
+ }
35
+ if(is_numeric($contactId)){
36
+ $client->deleteAddressBookContact($helper->getSubscriberAddressBook($websiteId), $contactId);
37
+ }else{
38
+ Mage::helper('connector')->log('CONTACT ID IS EMPTY : ' . $contactId . ' email : ' . $email);
39
+ }
40
+ $contactEmail->setIsSubscriber(null);
41
+ }
42
+ $contactEmail->setStoreId($storeId)
43
+ ->setContactId($contactId)
44
+ ->save();
45
+
46
+ }catch(Exception $e){
47
+ Mage::logException($e);
48
+ }
49
+ return $this;
50
+ }
51
+ }
app/code/community/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Newsletter_Subscriber
4
+ {
5
+ const STATUS_SUBSCRIBED = 1;
6
+ const STATUS_NOT_ACTIVE = 2;
7
+ const STATUS_UNSUBSCRIBED = 3;
8
+ const STATUS_UNCONFIRMED = 4;
9
+
10
+ protected $_start;
11
+
12
+ /**
13
+ * SUBSCRIBER SYNC.
14
+ * @return $this
15
+ */
16
+ public function sync()
17
+ {
18
+ /** @var Dotdigitalgroup_Email_Helper_Data $helper */
19
+ $helper = Mage::helper('connector');
20
+ $helper->log('---------------------- Start subscriber sync -------------------');
21
+ $this->_start = microtime(true);
22
+
23
+ foreach(Mage::app()->getWebsites(true) as $website){
24
+ if(Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_SUBSCRIBER_ENABLED, $website))
25
+ $this->_exportSubscribersPerWebsite($website);
26
+ }
27
+
28
+ return $this;
29
+ }
30
+
31
+ private function _exportSubscribersPerWebsite($website){
32
+ $updated = 0;
33
+ $helper = Mage::helper('connector');
34
+ $fileHelper = Mage::helper('connector/file');
35
+ $limit = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_LIMIT, $website);
36
+ $subscribers = Mage::getModel('email_connector/contact')->getSubscribersToImport($website, $limit);
37
+ if(count($subscribers)){
38
+ $client = Mage::helper('connector')->getWebsiteApiClient($website);
39
+ $subscribersFilename = strtolower($website->getCode() . '_subscribers_' . date('d_m_Y_Hi') . '.csv');
40
+ //get mapped storename
41
+ $subscriberStorename = $helper->getMappedStoreName($website);
42
+ //file headers
43
+ $fileHelper->outputCSV($fileHelper->getFilePath($subscribersFilename), array('Email', 'emailType', $subscriberStorename));
44
+ foreach ($subscribers as $subscriber) {
45
+ try{
46
+ $email = $subscriber->getEmail();
47
+ $subscriber->setSubscriberImported(1)->save();
48
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
49
+ $storeName = Mage::app()->getStore($subscriber->getStoreId())->getName();
50
+ // save data for subscribers
51
+ $fileHelper->outputCSV($fileHelper->getFilePath($subscribersFilename), array($email, 'Html', $storeName));
52
+ $updated++;
53
+ }catch (Exception $e){
54
+ Mage::logException($e);
55
+ }
56
+ }
57
+ $helper->log('Subscriber filename: ' . $subscribersFilename);
58
+ //Add to subscriber address book
59
+ $client->postAddressBookContactsImport($subscribersFilename, $helper->getSubscriberAddressBook($website));
60
+ $fileHelper->archiveCSV($subscribersFilename);
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Unsubscribe suppressed contacts.
66
+ * @param bool $force set 10years old
67
+ * @return mixed
68
+ */
69
+ public function unsubscribe($force = false)
70
+ {
71
+ $result['customers'] = 0;
72
+ $limit = 5;
73
+ $max_to_select = 1000;
74
+ $date = Zend_Date::now()->subHour(1);
75
+ $helper = Mage::helper('connector');
76
+ // force sync all customers
77
+ if($force)
78
+ $date = $date->subYear(10);
79
+ // datetime format string
80
+ $dateString = $date->toString(Zend_Date::W3C);
81
+
82
+ /**
83
+ * 1. Sync all suppressed for each store
84
+ */
85
+ foreach (Mage::app()->getWebsites(true) as $website) {
86
+ if(! Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_ENABLED, $website))
87
+ continue;
88
+ $contacts = array();
89
+ $skip = $i = 0;
90
+ $client = Mage::helper('connector')->getWebsiteApiClient($website);
91
+ //there is a maximum of request we need to loop to get more suppressed contacts
92
+ for($i=0; $i<= $limit;$i++){
93
+ $apiContacts = $client->getContactsSuppressedSinceDate($dateString, $max_to_select , $skip);
94
+ // skip no more contacts
95
+ if(empty($apiContacts))
96
+ break;
97
+ $contacts = array_merge($contacts, $apiContacts);
98
+ $skip += 1000;
99
+ }
100
+ $subscriberBookId = $helper->getSubscriberAddressBook($website);
101
+ // suppressed contacts to unsubscibe
102
+ foreach ($contacts as $apiContact){
103
+ if(isset($apiContact->suppressedContact)){
104
+ $suppressedContact = $apiContact->suppressedContact;
105
+ $email = $suppressedContact->email;
106
+ $contactId = $suppressedContact->id;
107
+ try{
108
+ /**
109
+ * 2. Unsubscribe customer.
110
+ */
111
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
112
+ if($subscriber->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED){
113
+ $subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED);
114
+ $subscriber->save();
115
+ // remove from subscriber address-book
116
+ $client->deleteAddressBookContact($subscriberBookId, $contactId);
117
+ }
118
+ //mark contact as suppressed and unsubscribe
119
+ $contactCollection = Mage::getModel('email_connector/contact')->getCollection()
120
+ ->addFieldToFilter('email', $email)
121
+ ->addFieldToFilter('website_id', $website->getId())
122
+ ;
123
+ //unsubscribe from the email contact table.
124
+ foreach ($contactCollection as $contact) {
125
+ $contact->setIsSubscriber(null)
126
+ ->setSuppressed(1)->save();
127
+ }
128
+ }catch (Exception $e){
129
+ Mage::logException($e);
130
+ }
131
+ }
132
+ }
133
+ }
134
+
135
+ return $result;
136
+ }
137
+ }
app/code/community/Dotdigitalgroup/Email/Model/Order.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Order extends Mage_Core_Model_Abstract
4
+ {
5
+ const EMAIL_ORDER_NOT_IMPORTED = null;
6
+ /**
7
+ * constructor
8
+ */
9
+ public function _construct(){
10
+ parent::_construct();
11
+ $this->_init('email_connector/order');
12
+ }
13
+
14
+ /**
15
+ * @return $this|Mage_Core_Model_Abstract
16
+ */
17
+ protected function _beforeSave(){
18
+ parent::_beforeSave();
19
+ $now = Mage::getSingleton('core/date')->gmtDate();
20
+ if ($this->isObjectNew()){
21
+ $this->setCreatedAt($now);
22
+ }
23
+ return $this;
24
+ }
25
+
26
+
27
+ /**
28
+ * Load the email order by quote id.
29
+ * @param $orderId
30
+ * @param $quoteId
31
+ * @return $this|Varien_Object
32
+ */
33
+ public function loadByOrderId($orderId, $quoteId)
34
+ {
35
+ $collection = $this->getCollection()
36
+ ->addFieldToFilter('order_id', $orderId)
37
+ ->addFieldToFilter('quote_id', $quoteId);
38
+ if($collection->count()){
39
+ return $collection->getFirstItem();
40
+ }else{
41
+ $this->setOrderId($orderId)
42
+ ->setQuoteId($quoteId);
43
+ }
44
+ return $this;
45
+ }
46
+
47
+
48
+ public function getEmailOrderRow($orderId, $quoteId, $storeId)
49
+ {
50
+
51
+ $collection = $this->getCollection()
52
+ ->addFieldToFilter('order_id', $orderId)
53
+ ->addFieldToFilter('quote_id', $quoteId)
54
+ ->addFieldToFilter('store_id', $storeId);
55
+
56
+ if($collection->count()){
57
+ return $collection->getFirstItem();
58
+ }else{
59
+ $now = Mage::getSingleton('core/date')->gmtDate();
60
+
61
+ $this->setOrderId($orderId)
62
+ ->setQuoteId($quoteId)
63
+ ->setStoreId($storeId)
64
+ ->setCreatedAt($now)
65
+ ;
66
+ }
67
+ return $this;
68
+
69
+ }
70
+ public function getOrdersToImport($storeIds, $limit)
71
+ {
72
+ $collection = $this->getCollection()
73
+ ->addFieldToFilter('email_imported', array('null' => true))
74
+ ->addFieldToFilter('store_id', array('in' => $storeIds))
75
+ ;
76
+
77
+ $collection->getSelect()->limit($limit);
78
+ return $collection->load();
79
+ }
80
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Campaign.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Campaign extends Mage_Core_Model_Resource_Db_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('email_connector/campaign', 'id');
8
+
9
+ }
10
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Campaign/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Campaign_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('email_connector/campaign');
9
+ }
10
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Contact.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Contact extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ $this->_init('email_connector/contact', 'email_contact_id');
9
+
10
+ }
11
+
12
+ public function getName()
13
+ {
14
+ return 'Calin';
15
+ }
16
+
17
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Contact/Collection.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Contact_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
4
+ {
5
+ protected function _construct(){
6
+ parent::_construct();
7
+ $this->_init('email_connector/contact');
8
+ }
9
+
10
+
11
+ /**
12
+ * @param $website
13
+ * @return $this
14
+ */
15
+ public function addWebsiteFilter($website)
16
+ {
17
+ $this->addFilter('website_id', $website);
18
+ return $this;
19
+ }
20
+
21
+
22
+
23
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Order.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Order extends Mage_Core_Model_Resource_Db_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('email_connector/order', 'email_order_id');
8
+ }
9
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Order/Collection.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->_init('email_connector/order');
10
+ }
11
+
12
+
13
+
14
+
15
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Setup.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup
4
+ {
5
+ /**
6
+ * This method returns true if the attribute exists.
7
+ *
8
+ * @param string|int $entityTypeId
9
+ * @param string|int $attributeId
10
+ * @return bool
11
+ */
12
+ public function attributeExists($entityTypeId, $attributeId)
13
+ {
14
+ try
15
+ {
16
+ $entityTypeId = $this->getEntityTypeId($entityTypeId);
17
+ $attributeId = $this->getAttributeId($entityTypeId, $attributeId);
18
+ return !empty($attributeId);
19
+ }
20
+ catch(Exception $e)
21
+ {
22
+ return FALSE;
23
+ }
24
+ }
25
+
26
+ }
app/code/community/Dotdigitalgroup/Email/Model/Sales/Observer.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Sales_Observer
4
+ {
5
+
6
+ /**
7
+ * Register the order status.
8
+ * @param $observer
9
+ * @return $this
10
+ */
11
+ public function handleSalesOrderSaveBefore($observer)
12
+ {
13
+ $order = $observer->getEvent()->getOrder();
14
+ // the reloaded status
15
+ $reloaded = Mage::getModel('sales/order')->load($order->getId());
16
+ Mage::register('sales_order_status_before', $reloaded->getStatus());
17
+ return $this;
18
+ }
19
+ /**
20
+ *
21
+ * @param Varien_Event_Observer $observer
22
+ * @return $this
23
+ */
24
+ public function handleSalesOrderSaveAfter(Varien_Event_Observer $observer)
25
+ {
26
+ try{
27
+ $order = $observer->getEvent()->getOrder();
28
+ $status = $order->getStatus();
29
+ $storeId = $order->getStoreId();
30
+ $emailOrder = Mage::getModel('email_connector/order')->loadByOrderId($order->getEntityId(), $order->getQuoteId());
31
+ //reimport email order
32
+ $emailOrder->setUpdatedAt($order->getUpdatedAt())
33
+ ->setEmailImported(null)
34
+ ->setStoreId($storeId)
35
+ ->save();
36
+ // check for order status change
37
+ $statusBefore = Mage::registry('sales_order_status_before');
38
+ Mage::helper('connector')->log('Order status : '. $status . ', before : '. $statusBefore);
39
+ if( $status!= $statusBefore){
40
+ $smsCampaign = Mage::getModel('email_connector/sms_campaign', $order);
41
+ $smsCampaign->setStatus($status);
42
+ $smsCampaign->sendSms();
43
+ }
44
+ //admin oder when editing the first one is canceled
45
+ Mage::unregister('sales_order_status_before');
46
+ }catch(Exception $e){
47
+ Mage::logException($e);
48
+ }
49
+ return $this;
50
+ }
51
+
52
+
53
+
54
+ public function handleSalesOrderPlaceAfter(Varien_Event_Observer $observer)
55
+ {
56
+ $data = new Varien_Object();
57
+ $order = $observer->getEvent()->getOrder();
58
+ $website = Mage::app()->getWebsite($order->getWebsiteId());
59
+ $websiteName = $website->getName();
60
+ if(Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Transactional::XML_PATH_TRANSACTIONAL_API_ENABLED, $website)){
61
+ $storeName = Mage::app()->getStore($order->getStoreId())->getName();
62
+ $data->setCustomerId($order->getCustomerId())
63
+ ->setCustomerEmail($order->getCustomerEmail())
64
+ ->setOrderId($order->getId())
65
+ ->setOrderIncrementId($order->getIncrementId())
66
+ ->setWebsiteName($websiteName)
67
+ ->setStoreName($storeName)
68
+ ->setWebsite($website)
69
+ ->setOrderDate($order->getCreatedAt());
70
+
71
+ Mage::helper('connector/transactional')->updateContactData($data);
72
+ }
73
+
74
+ return $this;
75
+ }
76
+
77
+ public function handleSalesOrderRefund(Varien_Event_Observer $observer)
78
+ {
79
+ Mage::helper('connector')->log('observer sales order refund');
80
+ $creditmemo = $observer->getEvent()->getCreditmemo();
81
+ $storeId = $creditmemo->getStoreId();
82
+ $order = $creditmemo->getOrder();
83
+ $orderId = $order->getEntityId();
84
+ $quoteId = $order->getQuoteId();
85
+
86
+ try{
87
+ /**
88
+ * Reimport transactional data.
89
+ */
90
+ $emailOrder = Mage::getModel('email_connector/order')->loadByOrderId($orderId, $quoteId, $storeId);
91
+ if(!$emailOrder->getId()){
92
+ Mage::helper('connector')->log('ERROR Creditmemmo Order not found :' . $orderId . ', quote id : ' . $quoteId . ', store id ' . $storeId);
93
+ return $this;
94
+ }
95
+ $emailOrder->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_NOT_IMPORTED)->save();
96
+ }catch (Exception $e){
97
+ Mage::logException($e);
98
+ }
99
+
100
+ return $this;
101
+ }
102
+
103
+ public function hangleSalesOrderCancel(Varien_Event_Observer $observer)
104
+ {
105
+ $order = $observer->getEvent()->getOrder();
106
+ $storeId = $order->getStoreId();
107
+ $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
108
+ $customerEmail = $order->getCustomerEmail();
109
+ $helper = Mage::helper('connector');
110
+ if($helper->isEnabled($websiteId)){
111
+ $client = Mage::getModel('email_connector/apiconnector_client');
112
+ $client->setApiUsername($helper->getApiUsername($websiteId));
113
+ $client->setApiPassword($helper->getApiPassword($websiteId));
114
+ // delete the order transactional data
115
+ $client->deleteContactTransactionalData($customerEmail, 'Orders');
116
+ }
117
+
118
+ return $this;
119
+ }
120
+ }
app/code/community/Dotdigitalgroup/Email/Model/Sales/Order.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Sales_Order
4
+ {
5
+ protected $accounts = array();
6
+ private $_apiUsername;
7
+ private $_apiPassword;
8
+
9
+ /**
10
+ * initial sync the transactional data
11
+ * @return array
12
+ */
13
+ public function sync()
14
+ {
15
+ $client = Mage::getModel('email_connector/apiconnector_client');
16
+ // Initialise a return hash containing results of our sync attempt
17
+ $this->_searchAccounts();
18
+
19
+ foreach($this->accounts as $account){
20
+ $orders = $account->getOrders();
21
+ if(count($orders)){
22
+ $client->setApiUsername($account->getApiUsername())
23
+ ->setApiPassword($account->getApiPassword());
24
+ Mage::helper('connector')->log('--------- Order sync ----------');
25
+ $client->postContactsTransactionalDataImport($orders, 'Orders');
26
+ Mage::helper('connector')->log('----------end order sync----------');
27
+ }
28
+ unset($this->accounts[$account->getApiUsername()]);
29
+ }
30
+ return $this;
31
+ }
32
+
33
+ /**
34
+ * Search the configuration data per website
35
+ */
36
+ private function _searchAccounts()
37
+ {
38
+ $helper = Mage::helper('connector');
39
+ foreach (Mage::app()->getWebsites(true) as $website){
40
+ if($helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_ORDER_ENABLED, $website)){
41
+ $this->_apiUsername = $helper->getApiUsername($website);
42
+ $this->_apiPassword = $helper->getApiPassword($website);
43
+ // limit for orders included to sync
44
+ $limit = Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT, $website);
45
+ if(!isset($this->accounts[$this->_apiUsername])){
46
+ $account = Mage::getModel('email_connector/connector_account')
47
+ ->setApiUsername($this->_apiUsername)
48
+ ->setApiPassword($this->_apiPassword);
49
+ $this->accounts[$this->_apiUsername] = $account;
50
+ }
51
+ $this->accounts[$this->_apiUsername]->setOrders($this->getConnectorOrders($website, $limit));
52
+ }
53
+ }
54
+ }
55
+
56
+ /**
57
+ * get all order to import.
58
+ * @param $website
59
+ * @param int $limit
60
+ * @return array
61
+ */
62
+ public function getConnectorOrders($website, $limit = 100)
63
+ {
64
+ $orders = $customers = array();
65
+ $storeIds = $website->getStoreIds();
66
+ $orderModel = Mage::getModel('email_connector/order');
67
+ if(empty($storeIds))
68
+ return;
69
+ $orderCollection = $orderModel->getOrdersToImport($storeIds, $limit);
70
+ foreach ($orderCollection as $order) {
71
+ try {
72
+ $salesOrder = Mage::getModel('sales/order')->load($order->getOrderId());
73
+ $storeId = $order->getStoreId();
74
+ $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
75
+ /**
76
+ * Add guest to contacts table.
77
+ */
78
+ if($salesOrder->getCustomerIsGuest()){
79
+ $this->_createGuestContact($salesOrder->getCustomerEmail(), $websiteId, $storeId);
80
+ }
81
+ if($salesOrder->getId()){
82
+ $connectorOrder = Mage::getModel('email_connector/connector_order', $salesOrder);
83
+ $orders[] = $connectorOrder;
84
+ }
85
+ $order->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_IMPORTED)
86
+ ->save();
87
+ }catch(Exception $e){
88
+ Mage::logException($e);
89
+ }
90
+ }
91
+ return $orders;
92
+ }
93
+
94
+ private function _createGuestContact($email, $websiteId, $storeId){
95
+ try{
96
+ $client = Mage::helper('connector')->getWebsiteApiClient($websiteId);
97
+ $contactApi = $client->getContactByEmail($email);
98
+ if(isset($contactApi->message) && $contactApi->message == Dotdigitalgroup_Email_Model_Apiconnector_Client::REST_CONTACT_NOT_FOUND){
99
+ //create a new contact.
100
+ $contactApi = $client->postContacts($email);
101
+ }elseif(isset($contactApi->message)){
102
+ return false;
103
+ }
104
+ // Add guest to address book
105
+ $response = $client->postAddressBookContacts(Mage::helper('connector')->getGuestAddressBook($websiteId), $contactApi);
106
+ $contactModel = Mage::getModel('email_connector/contact')->loadByCustomerEmail($email, $websiteId);
107
+ $contactModel->setIsGuest(1)
108
+ ->setStoreId($storeId)
109
+ ->setContactId($contactApi->id)
110
+ ->setEmailImported(1);
111
+
112
+ if(isset($response->message) && $response->message == 'Contact is suppressed. ERROR_CONTACT_SUPPRESSED')
113
+ $contactModel->setSuppressed(1);
114
+
115
+ $contactModel->save();
116
+ Mage::helper('connector')->log('-- guest found : ' . $email . ' website : ' . $websiteId . ' ,store : ' . $storeId);
117
+ }catch(Exception $e){
118
+ Mage::logException($e);
119
+ }
120
+
121
+ return true;
122
+ }
123
+ }
app/code/community/Dotdigitalgroup/Email/Model/Sales/Quote.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Sales_Quote
4
+ {
5
+ //customer
6
+ const XML_PATH_LOSTBASKET_CUSTOMER_ENABLED_1 = 'connector_lost_baskets/customers/enabled_1';
7
+ const XML_PATH_LOSTBASKET_CUSTOMER_ENABLED_2 = 'connector_lost_baskets/customers/enabled_2';
8
+ const XML_PATH_LOSTBASKET_CUSTOMER_ENABLED_3 = 'connector_lost_baskets/customers/enabled_3';
9
+ const XML_PATH_LOSTBASKET_CUSTOMER_INTERVAL_1 = 'connector_lost_baskets/customers/send_after_1';
10
+ const XML_PATH_LOSTBASKET_CUSTOMER_INTERVAL_2 = 'connector_lost_baskets/customers/send_after_2';
11
+ const XML_PATH_LOSTBASKET_CUSTOMER_INTERVAL_3 = 'connector_lost_baskets/customers/send_after_3';
12
+ const XML_PATH_LOSTBASKET_CUSTOMER_CAMPAIGN_1 = 'connector_lost_baskets/customers/campaign_1';
13
+ const XML_PATH_LOSTBASKET_CUSTOMER_CAMPAIGN_2 = 'connector_lost_baskets/customers/campaign_2';
14
+ const XML_PATH_LOSTBASKET_CUSTOMER_CAMPAIGN_3 = 'connector_lost_baskets/customers/campaign_3';
15
+
16
+ //guest
17
+ const XML_PATH_LOSTBASKET_GUEST_ENABLED_1 = 'connector_lost_baskets/guests/enabled_1';
18
+ const XML_PATH_LOSTBASKET_GUEST_ENABLED_2 = 'connector_lost_baskets/guests/enabled_2';
19
+ const XML_PATH_LOSTBASKET_GUEST_ENABLED_3 = 'connector_lost_baskets/guests/enabled_3';
20
+ const XML_PATH_LOSTBASKET_GUEST_INTERVAL_1 = 'connector_lost_baskets/guests/send_after_1';
21
+ const XML_PATH_LOSTBASKET_GUEST_INTERVAL_2 = 'connector_lost_baskets/guests/send_after_2';
22
+ const XML_PATH_LOSTBASKET_GUEST_INTERVAL_3 = 'connector_lost_baskets/guests/send_after_3';
23
+ const XML_PATH_LOSTBASKET_GUEST_CAMPAIGN_1 = 'connector_lost_baskets/guests/campaign_1';
24
+ const XML_PATH_LOSTBASKET_GUEST_CAMPAIGN_2 = 'connector_lost_baskets/guests/campaign_2';
25
+ const XML_PATH_LOSTBASKET_GUEST_CAMPAIGN_3 = 'connector_lost_baskets/guests/campaign_3';
26
+
27
+
28
+ public $lostBasketCustomers = array(1, 2, 3);
29
+ public $lostBasketGuests = array(1, 2, 3);
30
+
31
+
32
+ public function proccessLostBaskets()
33
+ {
34
+ /**
35
+ * Save lost baskets to be send in Send table.
36
+ */
37
+ foreach (Mage::app()->getStores() as $store){
38
+ $storeId = $store->getId();
39
+ $sendModel = Mage::getModel('email_connector/campaign');
40
+ /**
41
+ * Customers campaings
42
+ */
43
+ foreach ($this->lostBasketCustomers as $num) {
44
+ if($this->_getLostBasketCustomerEnabled($num, $storeId)){
45
+
46
+ if($num == 1)
47
+ $from = Zend_Date::now()->subMinute($this->_getLostBasketCustomerInterval($num, $storeId));
48
+ else
49
+ $from = Zend_Date::now()->subHour($this->_getLostBasketCustomerInterval($num, $storeId));
50
+ $to = clone($from);
51
+ $from->sub('5', Zend_Date::MINUTE);
52
+ $quoteCollection = $this->_getStoreQuotes($from->toString('YYYY-MM-dd HH:mm'), $to->toString('YYYY-MM-dd HH:mm'), $guest = false, $storeId);
53
+ if($quoteCollection->getSize())
54
+ Mage::helper('connector')->log('Customer lost baskets : ' . $num . ', from : ' . $from->toString('YYYY-MM-dd HH:mm') . ':' . $to->toString('YYYY-MM-dd HH:mm'));
55
+ $campaignId = $this->_getLostBasketCustomerCampaignId($num, $storeId);
56
+ foreach ($quoteCollection as $quote) {
57
+ //save lost basket for sending
58
+ $sendModel->loadByQuoteId($quote->getId(), $storeId)
59
+ ->setEmail($quote->getCustomerEmail())
60
+ ->setCustomerId($quote->getCustomerId())
61
+ ->setEventName('Lost Basket')
62
+ ->setCampaignId($campaignId)
63
+ ->setStoreId($storeId)
64
+ ->setIsSent(null)->save();
65
+ }
66
+ }
67
+
68
+ }
69
+ /**
70
+ * Guests campaigns
71
+ */
72
+ foreach ($this->lostBasketGuests as $num) {
73
+ if($this->_getLostBasketGuestEnabled($num, $storeId)){
74
+ if($num == 1)
75
+ $from = Zend_Date::now()->subMinute($this->_getLostBasketGuestIterval($num, $storeId));
76
+ else
77
+ $from = Zend_Date::now()->subHour($this->_getLostBasketGuestIterval($num, $storeId));
78
+ $to = clone($from);
79
+ $from->sub('5', Zend_Date::MINUTE);
80
+ $quoteCollection = $this->_getStoreQuotes($from->toString('YYYY-MM-dd HH:mm'), $to->toString('YYYY-MM-dd HH:mm'), $guest = true, $storeId);
81
+ if($quoteCollection->getSize())
82
+ Mage::helper('connector')->log('Guest lost baskets : ' . $num . ', from : ' . $from->toString('YYYY-MM-dd HH:mm') . ':' . $to->toString('YYYY-MM-dd HH:mm'));
83
+ $guestCampaignId = $this->_getLostBasketGuestCampaignId($num, $storeId);
84
+ foreach ($quoteCollection as $quote) {
85
+ //save lost basket for sending
86
+ $sendModel->loadByQuoteId($quote->getId(), $storeId)
87
+ ->setEmail($quote->getCustomerEmail())
88
+ ->setEventName('Lost Basket')
89
+ ->setCheckoutMethod('Guest')
90
+ ->setCampaignId($guestCampaignId)
91
+ ->setStoreId($storeId)
92
+ ->setIsSent(null)->save();
93
+ }
94
+ }
95
+ }
96
+
97
+ }
98
+ }
99
+
100
+ private function _getLostBasketCustomerCampaignId($num, $storeId){
101
+ $store = Mage::app()->getStore($storeId);
102
+ return $store->getConfig(constant('self::XML_PATH_LOSTBASKET_CUSTOMER_CAMPAIGN_' . $num));
103
+ }
104
+ private function _getLostBasketGuestCampaignId($num, $storeId){
105
+ $store = Mage::app()->getStore($storeId);
106
+ return $store->getConfig(constant('self::XML_PATH_LOSTBASKET_GUEST_CAMPAIGN_'. $num));
107
+ }
108
+
109
+ private function _getLostBasketCustomerInterval($num, $storeId){
110
+
111
+ $store = Mage::app()->getstore($storeId);
112
+ return $store->getConfig(constant('self::XML_PATH_LOSTBASKET_CUSTOMER_INTERVAL_' . $num));
113
+ }
114
+
115
+ private function _getLostBasketGuestIterval($num, $storeId){
116
+ $store = Mage::app()->getStore($storeId);
117
+ return $store->getConfig(constant('self::XML_PATH_LOSTBASKET_GUEST_INTERVAL_' . $num));
118
+ }
119
+
120
+
121
+ public function _getLostBasketCustomerEnabled($num, $storeId)
122
+ {
123
+ $store = Mage::app()->getStore($storeId);
124
+ $enabled = $store->getConfig(constant('self::XML_PATH_LOSTBASKET_CUSTOMER_ENABLED_' . $num));
125
+ return $enabled;
126
+
127
+ }
128
+
129
+ public function _getLostBasketGuestEnabled($num, $storeId)
130
+ {
131
+ $store = Mage::app()->getStore($storeId);
132
+ return $store->getConfig(constant('self::XML_PATH_LOSTBASKET_GUEST_ENABLED_' . $num));
133
+ }
134
+
135
+
136
+ /**
137
+ * @param string $from
138
+ * @param string $to
139
+ * @param bool $guest
140
+ * @param int $storeId
141
+ * @return Mage_Eav_Model_Entity_Collection_Abstract
142
+ */
143
+ private function _getStoreQuotes($from = null, $to = null, $guest = false, $storeId = 0){
144
+
145
+ $updated = array(
146
+ 'from' => $from,
147
+ 'to' => $to,
148
+ 'date' => true);
149
+
150
+ $salesCollection = Mage::getResourceModel('sales/quote_collection')
151
+ ->addFieldToFilter('is_active', 1)
152
+ ->addFieldToFilter('items_count', array('gt' => 0))
153
+ ->addFieldToFilter('customer_email', array('neq' => ''))
154
+ ->addFieldToFilter('store_id', $storeId)
155
+ ->addFieldToFilter('updated_at', $updated);
156
+ if($guest)
157
+ $salesCollection->addFieldToFilter('checkout_method' , Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);
158
+ return $salesCollection;
159
+ }
160
+ }
app/code/community/Dotdigitalgroup/Email/Model/Sms/Campaign.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Sms_Campaign
4
+ {
5
+ const UK_TELEPHONE_PATTERN = '/^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$/';
6
+
7
+ private $_storeId;
8
+ private $_status;
9
+ private $_customerFirstName;
10
+ private $_customerTelephone;
11
+
12
+ private $_incrementId;
13
+
14
+ private $_allsms = array(1, 2, 3, 4);
15
+ private $_vars = array('/customer_name/', '/order_number/', '/{{var /', '/}}/');
16
+
17
+
18
+ public function __construct($order)
19
+ {
20
+ $this->_storeId = $order->getStoreId();
21
+ Mage::app()->setCurrentStore($this->_storeId);
22
+ $billingAddress = $order->getBillingAddress();
23
+ $this->_customerTelephone = $billingAddress->getTelephone();
24
+ $this->_customerFirstName = $order->getCustomerFirstname();
25
+ $this->_incrementId = $order->getIncrementId();
26
+ }
27
+ /**
28
+ * @return mixed
29
+ */
30
+ public function getStatus()
31
+ {
32
+ return $this->_status;
33
+ }
34
+
35
+ /**
36
+ * @param mixed $status
37
+ */
38
+ public function setStatus($status)
39
+ {
40
+ $this->_status = $status;
41
+ }
42
+
43
+ public function sendSms()
44
+ {
45
+ $website = Mage::app()->getStore($this->_storeId)->getWebsite();
46
+ $client = Mage::helper('connector')->getWebsiteApiClient($website);
47
+ //all available sms in config
48
+ foreach ($this->_allsms as $num) {
49
+ $enabled = (bool)Mage::getStoreConfig(constant('Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SMS_ENABLED_' . $num));
50
+ if($enabled) {
51
+ $status = Mage::getStoreConfig(constant('Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SMS_STATUS_' . $num));
52
+ $message = $this->_processMessage(Mage::getStoreConfig(constant('Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SMS_MESSAGE_' . $num)));
53
+ $match = preg_match(self::UK_TELEPHONE_PATTERN, $this->_customerTelephone);
54
+ if($match != false) {
55
+ $codePhone = preg_replace('/\A(0){1}+/', '+44', $this->_customerTelephone);
56
+ //status and telephone valid
57
+ if ($this->_status == $status) {
58
+ Mage::helper('connector')->log('sending sms message with status : ' . $status . ' and ' . $codePhone);
59
+ $client->postSmsMessagesSendTo($codePhone, $message);
60
+ }
61
+ }else{
62
+ Mage::helper('connector')->log('SMS: phone not valid for UK : ' . $this->_customerTelephone);
63
+ }
64
+ }
65
+ }
66
+ }
67
+
68
+ /**
69
+ * @param $message
70
+ * @return mixed
71
+ */
72
+ protected function _processMessage($message)
73
+ {
74
+ $replacemant = array();
75
+ if(preg_match('/{{var/', $message)){
76
+ $replacemant[] = $this->_customerFirstName;
77
+ $replacemant[] = $this->_incrementId;
78
+ $replacemant[] = '';
79
+ $replacemant[] = '';
80
+ $message = preg_replace($this->_vars, $replacemant, $message);
81
+ }
82
+ return substr($message, 0, 160);
83
+ }
84
+
85
+
86
+ }
app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/ConnectorController.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Adminhtml_ConnectorController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ /**
6
+ * AutoCreate and map datafields.
7
+ */
8
+ public function setupdatafieldsAction()
9
+ {
10
+ $result = array('errors' => false, 'message' => '');
11
+ $apiModel = Mage::getModel('email_connector/apiconnector_client');
12
+ $redirectUrl = Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit', array('section' => 'connector_data_mapping'));
13
+
14
+ // get all possible datatifileds
15
+ $datafields = Mage::getModel('email_connector/connector_datafield')->getContactDatafields();
16
+ foreach ($datafields as $key => $datafield){
17
+ $response = $apiModel->postDataFields($datafield);
18
+
19
+ //ignore existing datafields message
20
+ if(isset($response->message) && $response->message != Dotdigitalgroup_Email_Model_Apiconnector_Client::REST_API_DATAFILEDS_EXISTS){
21
+ $result['errors'] = true;
22
+ $result['message'] .= ' Datafield ' . $datafield['name'] . ' - '. $response->message . '</br>';
23
+ }else{
24
+ $website = $this->getRequest()->getParam('website', false);
25
+ if($website){
26
+ $scope = 'website';
27
+ $scopeId = Mage::app()->getWebsite($website)->getId();
28
+ }else{
29
+ $scope = 'default';
30
+ $scopeId = '0';
31
+ }
32
+ /**
33
+ * map the succesful created datafield
34
+ */
35
+ $config = new Mage_Core_Model_Config();
36
+ $config->saveConfig('connector_data_mapping/customer_data/' . $key, strtoupper($datafield['name']), $scope, $scopeId);
37
+ Mage::helper('connector')->log('successfully connected : ' . $datafield['name']);
38
+ }
39
+ }
40
+ if($result['errors']){
41
+ Mage::getSingleton('adminhtml/session')->addNotice($result['message']);
42
+ }else{
43
+ Mage::getConfig()->cleanCache();
44
+ Mage::getSingleton('adminhtml/session')->addSuccess('All Datafields Created And Mapped.');
45
+ }
46
+
47
+ $this->_redirectUrl($redirectUrl);
48
+ }
49
+
50
+ /**
51
+ * Reset order for reimport.
52
+ */
53
+ public function resetordersAction()
54
+ {
55
+ /** @var $coreResource Mage_Core_Model_Resource */
56
+ $coreResource = Mage::getSingleton('core/resource');
57
+
58
+ /** @var $conn Varien_Db_Adapter_Pdo_Mysql */
59
+ $conn = $coreResource->getConnection('core_write');
60
+ try{
61
+ $num = $conn->update($coreResource->getTableName('email_connector/order'),
62
+ array('email_imported' => new Zend_Db_Expr('null')),
63
+ $conn->quoteInto('email_imported is ?', new Zend_Db_Expr('not null'))
64
+ );
65
+ }catch (Exception $e){
66
+ Mage::logException($e);
67
+ }
68
+ Mage::helper('connector')->log('-- Reset Orders for reimport : ' . $num);
69
+ Mage::getSingleton('adminhtml/session')->addSuccess('Done.');
70
+ $this->_redirectReferer();
71
+ }
72
+
73
+ /**
74
+ * Refresh suppressed contacts.
75
+ */
76
+ public function suppresscontactsAction()
77
+ {
78
+ Mage::getModel('email_connector/newsletter_subscriber')
79
+ ->unsubscribe(true);
80
+ Mage::getSingleton('adminhtml/session')->addSuccess('Done.');
81
+ $this->_redirectReferer();
82
+
83
+ }
84
+ /**
85
+ * Remove contact id's.
86
+ */
87
+ public function deletecontactidsAction()
88
+ {
89
+ /** @var $coreResource Mage_Core_Model_Resource */
90
+ $coreResource = Mage::getSingleton('core/resource');
91
+
92
+ /** @var $conn Varien_Db_Adapter_Pdo_Mysql */
93
+ $conn = $coreResource->getConnection('core_write');
94
+ try{
95
+ $num = $conn->update($coreResource->getTableName('email_connector/contact'),
96
+ array('contact_id' => new Zend_Db_Expr('null')),
97
+ $conn->quoteInto('contact_id is ?', new Zend_Db_Expr('not null'))
98
+ );
99
+ }catch (Exception $e){
100
+ Mage::logException($e);
101
+ }
102
+ Mage::getSingleton('adminhtml/session')->addSuccess('Number Of Contacts Id Removed: '. $num);
103
+ $this->_redirectReferer();
104
+ }
105
+ public function ajaxvalidationAction()
106
+ {
107
+ $params = $this->getRequest()->getParams();
108
+ $apiUsername = $params['api_username'];
109
+ $apiPassword = $params['api_password'];
110
+ $message = Mage::getModel('email_connector/apiconnector_test')->ajaxvalidate($apiUsername, $apiPassword);
111
+
112
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($message));
113
+ }
114
+
115
+ public function createnewdatafieldAction()
116
+ {
117
+ $params = $this->getRequest()->getParams();
118
+ $website = $this->getRequest()->getParam('website', 0);
119
+ $client = Mage::helper('connector')->getWebsiteApiClient($website);
120
+ if(strlen($params['name'])) {
121
+ $response = $client->postDataFields($params['name'], $params['type']);
122
+ if (isset($response->message)) {
123
+ Mage::getSingleton('adminhtml/session')->addError($response->message);
124
+ Mage::helper('connector')->log($response->message);
125
+ } else {
126
+ Mage::getSingleton('adminhtml/session')->addSuccess('Datafield created : ' . $params['name']);
127
+ }
128
+ }else{
129
+ Mage::getSingleton('adminhtml/session')->addError('Datafield cannot be empty.');
130
+ }
131
+ }
132
+
133
+ public function createnewaddressbookAction()
134
+ {
135
+ $addressBookName = $this->getRequest()->getParam('name');
136
+ $website = $this->getRequest()->getParam('website', 0);
137
+ $client = Mage::helper('connector')->getWebsiteApiClient($website);
138
+ if(strlen($addressBookName)) {
139
+ $response = $client->PostAddressBooks($addressBookName);
140
+ if(isset($response->message))
141
+ Mage::getSingleton('adminhtml/session')->addError($response->message);
142
+ else
143
+ Mage::getSingleton('adminhtml/session')->addSuccess('Address book : '. $addressBookName . ' created.');
144
+ }
145
+
146
+ }
147
+
148
+ public function reimoprtsubscribersAction()
149
+ {
150
+ $updated = Mage::getModel('email_connector/contact')->resetSubscribers();
151
+ if($updated){
152
+ Mage::getSingleton('adminhtml/session')->addSuccess('Subscribers updated : ' . $updated);
153
+ }else{
154
+ Mage::getSingleton('adminhtml/session')->addNotice('No subscribers imported!');
155
+ }
156
+ $this->_redirectReferer();
157
+ }
158
+ }
app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/CampaignController.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Adminhtml_Email_CampaignController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ /**
6
+ * constructor - set the used module name
7
+ */
8
+ protected function _construct(){
9
+ $this->setUsedModuleName('Dotdigitalgroup_Email');
10
+ }
11
+
12
+ public function indexAction(){
13
+ $this->_title($this->__('Email'))
14
+ ->_title($this->__('Manage Campaigns'));
15
+ $this->loadLayout();
16
+ $this->renderLayout();
17
+ }
18
+
19
+ public function newAction()
20
+ {
21
+ // We just forward the new action to a blank edit form
22
+ $this->_forward('edit');
23
+ }
24
+
25
+
26
+ public function editAction()
27
+ {
28
+ $contactId = (int) $this->getRequest()->getParam('id');
29
+ $contact = $this->_initAction();
30
+ if ($contactId && !$contact->getId()) {
31
+ $this->_getSession()->addError(Mage::helper('connector')->__('This campaign no longer exists.'));
32
+ $this->_redirect('*/*/');
33
+ return;
34
+ }
35
+ if ($data = Mage::getSingleton('adminhtml/session')->getCampaignData(true)){
36
+ $contact->setData($data);
37
+ }
38
+ Mage::dispatchEvent('email_campaign_controller_edit_action', array('contact' => $contact));
39
+ $this->loadLayout();
40
+ if ($contact->getId()){
41
+ if (!Mage::app()->isSingleStoreMode() && ($switchBlock = $this->getLayout()->getBlock('store_switcher'))) {
42
+ $switchBlock->setDefaultStoreName(Mage::helper('connector')->__('Default Values'))
43
+ ->setSwitchUrl($this->getUrl('*/*/*', array('_current'=>true, 'active_tab'=>null, 'tab' => null, 'store'=>null)));
44
+ }
45
+ }else{
46
+ $this->getLayout()->getBlock('left')->unsetChild('store_switcher');
47
+ }
48
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
49
+ $this->renderLayout();
50
+ }
51
+
52
+ public function saveAction(){
53
+ $storeId = $this->getRequest()->getParam('store');
54
+ $redirectBack = $this->getRequest()->getParam('back', false);
55
+ $contactId = $this->getRequest()->getParam('id');
56
+
57
+ $data = $this->getRequest()->getPost();
58
+ if ($data) {
59
+ $campaign = $this->_initAction();
60
+
61
+ $campaignData = $this->getRequest()->getPost('campaign', array());
62
+ $campaign->addData($campaignData);
63
+
64
+ try {
65
+ $campaign->save();
66
+ $campaignId = $campaign->getId();
67
+ $this->_getSession()->addSuccess(Mage::helper('connector')->__('Campaign was saved.'));
68
+ }catch (Mage_Core_Exception $e) {
69
+ Mage::logException($e);
70
+ $this->_getSession()->addError($e->getMessage())
71
+ ->setContactData($campaignData);
72
+ $redirectBack = true;
73
+ }
74
+ catch (Exception $e){
75
+ Mage::logException($e);
76
+ $this->_getSession()->addError(Mage::helper('connector')->__('Error saving campaign'))
77
+ ->setContactData($campaignData);
78
+ $redirectBack = true;
79
+ }
80
+ }
81
+ if ($redirectBack) {
82
+ $this->_redirect('*/*/edit', array(
83
+ 'id' => $contactId,
84
+ '_current'=>true
85
+ ));
86
+ }else {
87
+ $this->_redirect('*/*/', array('store'=>$storeId));
88
+ }
89
+ }
90
+
91
+ public function deleteAction(){
92
+ if ($id = $this->getRequest()->getParam('id')) {
93
+ $campaign = Mage::getModel('email_connector/campaign')->load($id);
94
+ try {
95
+ $campaign->delete();
96
+ $this->_getSession()->addSuccess(Mage::helper('connector')->__('The campaign has been deleted.'));
97
+ }
98
+ catch (Exception $e) {
99
+ $this->_getSession()->addError($e->getMessage());
100
+ }
101
+ }
102
+ $this->getResponse()->setRedirect($this->getUrl('*/*/', array('store'=>$this->getRequest()->getParam('store'))));
103
+ }
104
+
105
+ public function massDeleteAction() {
106
+ $campaignIds = $this->getRequest()->getParam('campaign');
107
+ if (!is_array($campaignIds)) {
108
+ $this->_getSession()->addError($this->__('Please select campaigns.'));
109
+ }else {
110
+ try {
111
+ foreach ($campaignIds as $campaignId) {
112
+ $campaign = Mage::getSingleton('email_connector/campaign')->load($campaignId);
113
+ Mage::dispatchEvent('connector_controller_campaign_delete', array('campaign' => $campaign));
114
+ $campaign->delete();
115
+ }
116
+ $this->_getSession()->addSuccess(
117
+ Mage::helper('connector')->__('Total of %d record(s) have been deleted.', count($campaignIds))
118
+ );
119
+ } catch (Exception $e) {
120
+ $this->_getSession()->addError($e->getMessage());
121
+ }
122
+ }
123
+ $this->_redirect('*/*/index');
124
+ }
125
+ public function massResendAction() {
126
+ $campaignIds = $this->getRequest()->getParam('campaign');
127
+ if (!is_array($campaignIds)) {
128
+ $this->_getSession()->addError($this->__('Please select campaigns.'));
129
+ }else {
130
+ try {
131
+ foreach ($campaignIds as $campaignId) {
132
+ $campaign = Mage::getSingleton('email_connector/campaign')->load($campaignId);
133
+ Mage::dispatchEvent('connector_controller_campaign_delete', array('campaign' => $campaign));
134
+ $campaign->setIsSent(null)->save();
135
+ }
136
+ $this->_getSession()->addSuccess(
137
+ Mage::helper('connector')->__('Total of %d record(s) have resend .', count($campaignIds))
138
+ );
139
+ } catch (Exception $e) {
140
+ $this->_getSession()->addError($e->getMessage());
141
+ }
142
+ }
143
+ $this->_redirect('*/*/index');
144
+ }
145
+
146
+
147
+ public function gridAction(){
148
+ $this->loadLayout();
149
+ $this->renderLayout();
150
+ }
151
+
152
+ protected function _initAction(){
153
+ $this->_title($this->__('Newsletter'))
154
+ ->_title($this->__('Manage Campaigns'));
155
+
156
+ $campaignId = (int) $this->getRequest()->getParam('id');
157
+ $campaign = Mage::getModel('email_connector/campaign');
158
+
159
+ if ($campaignId) {
160
+ $campaign->load($campaignId);
161
+ }
162
+ Mage::register('email_campaign', $campaign);
163
+ return $campaign;
164
+ }
165
+
166
+ public function exportCsvAction(){
167
+ $fileName = 'campaign.csv';
168
+ $content = $this->getLayout()->createBlock('email_connector/adminhtml_campaign_grid')
169
+ ->getCsvFile();
170
+ $this->_prepareDownloadResponse($fileName, $content);
171
+ }
172
+
173
+ protected function _isAllowed(){
174
+ return Mage::getSingleton('admin/session')->isAllowed('email_connector_campaign');
175
+ }
176
+
177
+ }
app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/ContactController.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Adminhtml_Email_ContactController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ /**
6
+ * constructor - set the used module name
7
+ */
8
+ protected function _construct(){
9
+ $this->setUsedModuleName('Dotdigitalgroup_Email');
10
+ }
11
+
12
+ public function indexAction(){
13
+ $this->_title($this->__('Email'))
14
+ ->_title($this->__('Manage Contacts'));
15
+ $this->loadLayout();
16
+ $this->renderLayout();
17
+ }
18
+
19
+ public function newAction()
20
+ {
21
+ // We just forward the new action to a blank edit form
22
+ $this->_forward('edit');
23
+ }
24
+
25
+
26
+ public function editAction()
27
+ {
28
+ $contactId = (int) $this->getRequest()->getParam('id');
29
+ $contact = $this->_initAction();
30
+ if ($contactId && !$contact->getId()) {
31
+ $this->_getSession()->addError(Mage::helper('connector')->__('This contact no longer exists.'));
32
+ $this->_redirect('*/*/');
33
+ return;
34
+ }
35
+ if ($data = Mage::getSingleton('adminhtml/session')->getContactData(true)){
36
+ $contact->setData($data);
37
+ }
38
+ Mage::dispatchEvent('email_contact_controller_edit_action', array('contact' => $contact));
39
+ $this->loadLayout();
40
+ if ($contact->getId()){
41
+ if (!Mage::app()->isSingleStoreMode() && ($switchBlock = $this->getLayout()->getBlock('store_switcher'))) {
42
+ $switchBlock->setDefaultStoreName(Mage::helper('connector')->__('Default Values'))
43
+ ->setSwitchUrl($this->getUrl('*/*/*', array('_current'=>true, 'active_tab'=>null, 'tab' => null, 'store'=>null)));
44
+ }
45
+ }else{
46
+ $this->getLayout()->getBlock('left')->unsetChild('store_switcher');
47
+ }
48
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
49
+ $this->renderLayout();
50
+ }
51
+
52
+ public function saveAction(){
53
+ $storeId = $this->getRequest()->getParam('store');
54
+ $redirectBack = $this->getRequest()->getParam('back', false);
55
+ $contactId = $this->getRequest()->getParam('id');
56
+
57
+ $data = $this->getRequest()->getPost();
58
+ if ($data) {
59
+ $contact = $this->_initAction();
60
+
61
+ $contactData = $this->getRequest()->getPost('contact', array());
62
+ $contact->addData($contactData);
63
+
64
+ try {
65
+ $contact->save();
66
+ $contactId = $contact->getId();
67
+ $this->_getSession()->addSuccess(Mage::helper('connector')->__('Contact was saved.'));
68
+ }catch (Mage_Core_Exception $e) {
69
+ Mage::logException($e);
70
+ $this->_getSession()->addError($e->getMessage())
71
+ ->setContactData($contactData);
72
+ $redirectBack = true;
73
+ }
74
+ catch (Exception $e){
75
+ Mage::logException($e);
76
+ $this->_getSession()->addError(Mage::helper('connector')->__('Error saving contact'))
77
+ ->setContactData($contactData);
78
+ $redirectBack = true;
79
+ }
80
+ }
81
+ if ($redirectBack) {
82
+ $this->_redirect('*/*/edit', array(
83
+ 'id' => $contactId,
84
+ '_current'=>true
85
+ ));
86
+ }
87
+ else {
88
+ $this->_redirect('*/*/', array('store'=>$storeId));
89
+ }
90
+ }
91
+
92
+ public function deleteAction(){
93
+ if ($id = $this->getRequest()->getParam('id')) {
94
+ $contact = Mage::getModel('email_connector/contact')->load($id);
95
+ try {
96
+ $contact->delete();
97
+ $this->_getSession()->addSuccess(Mage::helper('connector')->__('The contact has been deleted.'));
98
+ }
99
+ catch (Exception $e) {
100
+ $this->_getSession()->addError($e->getMessage());
101
+ }
102
+ }
103
+ $this->getResponse()->setRedirect($this->getUrl('*/*/', array('store'=>$this->getRequest()->getParam('store'))));
104
+ }
105
+
106
+ public function massDeleteAction() {
107
+ $contactIds = $this->getRequest()->getParam('contact');
108
+ if (!is_array($contactIds)) {
109
+ $this->_getSession()->addError($this->__('Please select contacts.'));
110
+ }else {
111
+ try {
112
+ foreach ($contactIds as $contactId) {
113
+ $contact = Mage::getSingleton('email_connector/contact')->load($contactId);
114
+ Mage::dispatchEvent('connector_controller_affiliate_delete', array('contact' => $contact));
115
+ $contact->delete();
116
+ }
117
+ $this->_getSession()->addSuccess(
118
+ Mage::helper('connector')->__('Total of %d record(s) have been deleted.', count($contactIds))
119
+ );
120
+ } catch (Exception $e) {
121
+ $this->_getSession()->addError($e->getMessage());
122
+ }
123
+ }
124
+ $this->_redirect('*/*/index');
125
+ }
126
+
127
+
128
+ public function gridAction(){
129
+ $this->loadLayout();
130
+ $this->renderLayout();
131
+ }
132
+
133
+ protected function _initAction(){
134
+ $this->_title($this->__('Newsletter'))
135
+ ->_title($this->__('Manage Contacts'));
136
+
137
+ $contactId = (int) $this->getRequest()->getParam('id');
138
+ $contact = Mage::getModel('email_connector/contact')
139
+ ->setStoreId($this->getRequest()->getParam('store', 0));
140
+
141
+ if ($contactId) {
142
+ $contact->load($contactId);
143
+ }
144
+ Mage::register('current_contact', $contact);
145
+ return $contact;
146
+ }
147
+
148
+ public function exportCsvAction(){
149
+ $fileName = 'contacts.csv';
150
+ $content = $this->getLayout()->createBlock('email_connector/adminhtml_contact_grid')
151
+ ->getCsvFile();
152
+ $this->_prepareDownloadResponse($fileName, $content);
153
+ }
154
+
155
+ protected function _isAllowed(){
156
+ return Mage::getSingleton('admin/session')->isAllowed('email_connector_contact');
157
+ }
158
+
159
+ }
app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/DashboardController.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Adminhtml_Email_DashboardController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ $this->_title($this->__('Dashboard'));
8
+
9
+ $this->loadLayout();
10
+ $this->_setActiveMenu('newsletter');
11
+ $this->_addContent($this->getLayout()->createBlock('email_connector/adminhtml_dashboard'));
12
+ $this->renderLayout();
13
+ }
14
+ protected function _isAllowed()
15
+ {
16
+ return Mage::getSingleton('admin/session')->isAllowed('email_connector_dashboard');
17
+ }
18
+ }
app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/OrderController.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Adminhtml_Email_OrderController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ $this->loadLayout();
8
+ $this->_setActiveMenu('newsletter');
9
+ $this->_addContent($this->getLayout()->createBlock('email_connector/adminhtml_order'));
10
+ $this->getLayout()->getBlock('head')->setTitle('Connector Orders');
11
+ $this->renderLayout();
12
+ }
13
+
14
+
15
+ /**
16
+ * Check currently called action by permissions for current user
17
+ *
18
+ * @return bool
19
+ */
20
+ protected function _isAllowed()
21
+ {
22
+ return Mage::getSingleton('admin/session')->isAllowed('newsletter/email_connector_order');
23
+ }
24
+ }
app/code/community/Dotdigitalgroup/Email/controllers/CreditmemoController.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_CreditmemoController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function preDispatch()
6
+ {
7
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
8
+ $orderId = $this->getRequest()->getParam('order_id', false);
9
+ if($orderId){
10
+ $order = Mage::getModel('sales/order')->load($orderId);
11
+ if($order->getId()){
12
+ Mage::app()->setCurrentStore($order->getStoreId());
13
+ }else{
14
+ Mage::helper('connector')->log('TE : order not found: ' . $orderId);
15
+ exit;
16
+ }
17
+ }else{
18
+ Mage::helper('connector')->log('TE : order_id missing :' . $orderId);
19
+ exit;
20
+ }
21
+ parent::preDispatch();
22
+ }
23
+ public function newAction()
24
+ {
25
+ $this->loadLayout();
26
+ $newOrder = $this->getLayout()->createBlock('email_connector/order_creditmemo', 'connector_creditmemo_new', array(
27
+ 'template' => 'connector/creditmemo/new.phtml'
28
+ ));
29
+ $this->getLayout()->getBlock('content')->append($newOrder);
30
+ $items = $this->getLayout()->createBlock('email_connector/order_creditmemo', 'connector_creditmemo_items', array(
31
+ 'template' => 'connector/creditmemo/items.phtml'
32
+ ));
33
+ $this->getLayout()->getBlock('connector_creditmemo_new')->append($items);
34
+ $this->renderLayout();
35
+ }
36
+
37
+ public function newguestAction()
38
+ {
39
+ $this->loadLayout();
40
+ $invoice = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_creditmemo_guest', array(
41
+ 'template' => 'connector/creditmemo/newguest.phtml'
42
+ ));
43
+ $this->getLayout()->getBlock('content')->append($invoice);
44
+ $items = $this->getLayout()->createBlock('email_connector/order_creditmemo', 'connector_creditmemo_items', array(
45
+ 'template' => 'connector/creditmemo/items.phtml'
46
+ ));
47
+ $this->getLayout()->getBlock('connector_creditmemo_guest')->append($items);
48
+
49
+ $this->renderLayout();
50
+
51
+ }
52
+
53
+ public function updateAction()
54
+ {
55
+ $this->loadLayout();
56
+ $newOrder = $this->getLayout()->createBlock('email_connector/order_creditmemo', 'connector_creditmemo_update', array(
57
+ 'template' => 'connector/creditmemo/update.phtml'
58
+ ));
59
+ $this->getLayout()->getBlock('content')->append($newOrder);
60
+
61
+ $this->renderLayout();
62
+ }
63
+
64
+ public function updateguestAction()
65
+ {
66
+ $this->loadLayout();
67
+ $newOrder = $this->getLayout()->createBlock('email_connector/order_creditmemo', 'connector_creditmemo_update_guest', array(
68
+ 'template' => 'connector/creditmemo/updateguest.phtml'
69
+ ));
70
+ $this->getLayout()->getBlock('content')->append($newOrder);
71
+ $this->renderLayout();
72
+ }
73
+ }
app/code/community/Dotdigitalgroup/Email/controllers/CustomerController.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_CustomerController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function preDispatch()
6
+ {
7
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
8
+ parent::preDispatch();
9
+ }
10
+ public function newAction()
11
+ {
12
+ $this->loadLayout();
13
+ $newCustomer = $this->getLayout()->createBlock('email_connector/customer', 'connector_customer', array(
14
+ 'template' => 'connector/customer/new.phtml'
15
+ ));
16
+ $this->getLayout()->getBlock('content')->append($newCustomer);
17
+ $this->renderLayout();
18
+ }
19
+
20
+ public function confirmationAction()
21
+ {
22
+ $this->loadLayout();
23
+ $newCustomer = $this->getLayout()->createBlock('email_connector/customer', 'connector_customer_confirmation', array(
24
+ 'template' => 'connector/customer/confirmation.phtml'
25
+ ));
26
+ $this->getLayout()->getBlock('content')->append($newCustomer);
27
+ $this->renderLayout();
28
+ }
29
+ public function confirmedAction()
30
+ {
31
+ $this->loadLayout();
32
+ $newCustomer = $this->getLayout()->createBlock('email_connector/customer', 'connector_customer_confirmed', array(
33
+ 'template' => 'connector/customer/confirmed.phtml'
34
+ ));
35
+ $this->getLayout()->getBlock('content')->append($newCustomer);
36
+ $this->renderLayout();
37
+ }
38
+ }
app/code/community/Dotdigitalgroup/Email/controllers/EmailController.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_EmailController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ //Get current layout state
8
+ $this->loadLayout();
9
+ $this->renderLayout();
10
+ }
11
+
12
+ public function couponAction()
13
+ {
14
+ $this->loadLayout();
15
+ $this->renderLayout();
16
+ }
17
+ public function basketAction()
18
+ {
19
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
20
+ $this->loadLayout();
21
+ if ($root = $this->getLayout()->getBlock('root')) {
22
+ $root->setTemplate('page/blank.phtml');
23
+ }
24
+ $basket = $this->getLayout()->createBlock('email_connector/basket', 'connector_basket', array(
25
+ 'template' => 'connector/basket.phtml'
26
+ ));
27
+ $this->getLayout()->getBlock('content')->append($basket);
28
+ $this->renderLayout();
29
+ }
30
+
31
+ public function logAction()
32
+ {
33
+ //file name param
34
+ $file = $this->getRequest()->getParam('file');
35
+ $fileName = $file . '.log';
36
+ $filePath = Mage::getBaseDir('log') . DIRECTORY_SEPARATOR . $fileName;
37
+
38
+ $this->_prepareDownloadResponse($fileName, array(
39
+ 'type' => 'filename',
40
+ 'value' => $filePath
41
+ ));
42
+ exit();
43
+ }
44
+ }
app/code/community/Dotdigitalgroup/Email/controllers/InvoiceController.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_InvoiceController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function preDispatch()
6
+ {
7
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
8
+ $orderId = $this->getRequest()->getParam('order_id', false);
9
+ if($orderId){
10
+ $order = Mage::getModel('sales/order')->load($orderId);
11
+ if($order->getId()){
12
+ Mage::app()->setCurrentStore($order->getStoreId());
13
+ }else{
14
+ Mage::helper('connector')->log('TE : order not found: ' . $orderId);
15
+ exit;
16
+ }
17
+ }else{
18
+ Mage::helper('connector')->log('TE : order_id missing :' . $orderId);
19
+ exit;
20
+ }
21
+ parent::preDispatch();
22
+ }
23
+ public function newAction()
24
+ {
25
+ $this->loadLayout();
26
+ $newOrder = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_invoice_new', array(
27
+ 'template' => 'connector/invoice/new.phtml'
28
+ ));
29
+ $this->getLayout()->getBlock('content')->append($newOrder);
30
+ $items = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_order_items', array(
31
+ 'template' => 'connector/order/items.phtml'
32
+ ));
33
+ $this->getLayout()->getBlock('connector_invoice_new')->append($items);
34
+ $this->renderLayout();
35
+ }
36
+
37
+ public function newguestAction()
38
+ {
39
+ $this->loadLayout();
40
+ $invoice = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_invoiceguest_new', array(
41
+ 'template' => 'connector/invoice/newguest.phtml'
42
+ ));
43
+ $this->getLayout()->getBlock('content')->append($invoice);
44
+ $items = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_order_items', array(
45
+ 'template' => 'connector/order/items.phtml'
46
+ ));
47
+ $this->getLayout()->getBlock('connector_invoiceguest_new')->append($items);
48
+
49
+ $this->renderLayout();
50
+
51
+ }
52
+ public function updateAction()
53
+ {
54
+ $this->loadLayout();
55
+ $invoice = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_invoice_update', array(
56
+ 'template' => 'connector/invoice/update.phtml'
57
+ ));
58
+ $this->getLayout()->getBlock('content')->append($invoice);
59
+ $this->renderLayout();
60
+ }
61
+ public function updateguestAction()
62
+ {
63
+ $this->loadLayout();
64
+ $invoice = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_invoice_updateguest', array(
65
+ 'template' => 'connector/invoice/updateguest.phtml'
66
+ ));
67
+ $this->getLayout()->getBlock('content')->append($invoice);
68
+ $this->renderLayout();
69
+ }
70
+
71
+ }
app/code/community/Dotdigitalgroup/Email/controllers/OrderController.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_OrderController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function preDispatch()
6
+ {
7
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
8
+ $orderId = $this->getRequest()->getParam('order_id', false);
9
+ if($orderId){
10
+ $order = Mage::getModel('sales/order')->load($orderId);
11
+ if($order->getId()){
12
+ Mage::app()->setCurrentStore($order->getStoreId());
13
+ }else{
14
+ Mage::helper('connector')->log('TE : order not found: ' . $orderId);
15
+ exit;
16
+ }
17
+ }else{
18
+ Mage::helper('connector')->log('TE : order_id missing :' . $orderId);
19
+ exit;
20
+ }
21
+ parent::preDispatch();
22
+ }
23
+ public function newAction()
24
+ {
25
+ $this->loadLayout();
26
+ $newOrder = $this->getLayout()->createBlock('email_connector/order', 'connector_order', array(
27
+ 'template' => 'connector/order/new.phtml'
28
+ ));
29
+ $this->getLayout()->getBlock('content')->append($newOrder);
30
+ $items = $this->getLayout()->createBlock('email_connector/order', 'connector_order_items', array(
31
+ 'template' => 'connector/order/items.phtml'
32
+ ));
33
+ $this->getLayout()->getBlock('connector_order')->append($items);
34
+ $this->renderLayout();
35
+ }
36
+
37
+ public function newguestAction()
38
+ {
39
+ $this->loadLayout();
40
+ $newOrder = $this->getLayout()->createBlock('email_connector/order', 'connector_order_guest', array(
41
+ 'template' => 'connector/order/newguest.phtml'
42
+ ));
43
+ $this->getLayout()->getBlock('content')->append($newOrder);
44
+ $items = $this->getLayout()->createBlock('email_connector/order', 'connector_order_items', array(
45
+ 'template' => 'connector/order/items.phtml'
46
+ ));
47
+ $this->getLayout()->getBlock('connector_order_guest')->append($items);
48
+ $this->renderLayout();
49
+
50
+ }
51
+ public function updateAction()
52
+ {
53
+ $this->loadLayout();
54
+ $newOrder = $this->getLayout()->createBlock('email_connector/order', 'connector_order_update', array(
55
+ 'template' => 'connector/order/update.phtml'
56
+ ));
57
+ $this->getLayout()->getBlock('content')->append($newOrder);
58
+ $this->renderLayout();
59
+ }
60
+ public function updateguestAction()
61
+ {
62
+ $this->loadLayout();
63
+ $newOrder = $this->getLayout()->createBlock('email_connector/order', 'connector_order_update_guest', array(
64
+ 'template' => 'connector/order/updateguest.phtml'
65
+ ));
66
+ $this->getLayout()->getBlock('content')->append($newOrder);
67
+ $this->renderLayout();
68
+ }
69
+
70
+ }
app/code/community/Dotdigitalgroup/Email/controllers/ProductsController.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_ProductsController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function preDispatch()
6
+ {
7
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
8
+ if($this->getRequest()->getActionName() != 'push'){
9
+ $orderId = $this->getRequest()->getParam('order_id', false);
10
+ if($orderId){
11
+ $order = Mage::getModel('sales/order')->load($orderId);
12
+ if($order->getId()){
13
+ Mage::app()->setCurrentStore($order->getStoreId());
14
+ }else{
15
+ Mage::helper('connector')->log('Dynamic : order not found: ' . $orderId);
16
+ exit;
17
+ }
18
+ }else{
19
+ Mage::helper('connector')->log('Dynamic : order_id missing :' . $orderId);
20
+ exit;
21
+ }
22
+ }
23
+
24
+ parent::preDispatch();
25
+ }
26
+ public function relatedAction()
27
+ {
28
+ $this->loadLayout();
29
+ $products = $this->getLayout()->createBlock('email_connector/recommended_products', 'connector_recommended', array(
30
+ 'template' => 'connector/product/list.phtml'
31
+ ));
32
+ $this->getLayout()->getBlock('content')->append($products);
33
+
34
+ $this->renderLayout();
35
+
36
+ }
37
+ public function crosssellAction()
38
+ {
39
+ $this->loadLayout();
40
+ $products = $this->getLayout()->createBlock('email_connector/recommended_products', 'connector_recommended', array(
41
+ 'template' => 'connector/product/list.phtml'
42
+ ));
43
+ $this->getLayout()->getBlock('content')->append($products);
44
+
45
+ $this->renderLayout();
46
+ }
47
+
48
+ public function upsellAction()
49
+ {
50
+ $this->loadLayout();
51
+ $products = $this->getLayout()->createBlock('email_connector/recommended_products', 'connector_recommended', array(
52
+ 'template' => 'connector/product/list.phtml'
53
+ ));
54
+ $this->getLayout()->getBlock('content')->append($products);
55
+
56
+ $this->renderLayout();
57
+ }
58
+
59
+
60
+ public function pushAction()
61
+ {
62
+ $this->loadLayout();
63
+ $products = $this->getLayout()->createBlock('email_connector/recommended_push', 'connector_product', array(
64
+ 'template' => 'connector/product/list.phtml'
65
+ ));
66
+ $this->getLayout()->getBlock('content')->append($products);
67
+ $this->renderLayout();
68
+ }
69
+
70
+
71
+ }
app/code/community/Dotdigitalgroup/Email/controllers/ReportController.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_ReportController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function preDispatch()
6
+ {
7
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
8
+
9
+
10
+ parent::preDispatch();
11
+ }
12
+
13
+ public function bestsellersAction()
14
+ {
15
+ $this->loadLayout();
16
+ $products = $this->getLayout()->createBlock('email_connector/recommended_bestsellers', 'connector_customer', array(
17
+ 'template' => 'connector/product/list.phtml'
18
+ ));
19
+ $this->getLayout()->getBlock('content')->append($products);
20
+ $this->renderLayout();
21
+
22
+ }
23
+
24
+ public function mostviewedAction()
25
+ {
26
+ $this->loadLayout();
27
+ $products = $this->getLayout()->createBlock('email_connector/recommended_mostviewed', 'connector_customer', array(
28
+ 'template' => 'connector/product/list.phtml'
29
+ ));
30
+ $this->getLayout()->getBlock('content')->append($products);
31
+ $this->renderLayout();
32
+
33
+ }
34
+
35
+ public function recentlyviewedAction()
36
+ {
37
+ $customerId = $this->getRequest()->getParam('customer_id');
38
+ if(!$customerId){
39
+ Mage::helper('connector')->log('Recentlyviewed : no customer id : ' . $customerId);
40
+ exit;
41
+ }
42
+
43
+ $this->loadLayout();
44
+ $products = $this->getLayout()->createBlock('email_connector/recommended_recentlyviewed', 'connector_customer', array(
45
+ 'template' => 'connector/product/list.phtml'
46
+ ));
47
+ $this->getLayout()->getBlock('content')->append($products);
48
+ $this->renderLayout();
49
+ }
50
+
51
+ public function customerAction()
52
+ {
53
+ $this->loadLayout();
54
+ $products = $this->getLayout()->createBlock('email_connector/customer', 'connector_customer', array(
55
+ 'template' => 'connector/products.phtml'
56
+ ));
57
+ $this->getLayout()->getBlock('content')->append($products);
58
+ $this->renderLayout();
59
+ }
60
+
61
+
62
+
63
+ }
app/code/community/Dotdigitalgroup/Email/controllers/ShippingController.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_ShippingController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function preDispatch()
6
+ {
7
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
8
+ $orderId = $this->getRequest()->getParam('order_id', false);
9
+ if($orderId){
10
+ $order = Mage::getModel('sales/order')->load($orderId);
11
+ if($order->getId()){
12
+ Mage::app()->setCurrentStore($order->getStoreId());
13
+ }else{
14
+ Mage::helper('connector')->log('TE : order not found: ' . $orderId);
15
+ exit;
16
+ }
17
+ }else{
18
+ Mage::helper('connector')->log('TE : order_id missing :' . $orderId);
19
+ exit;
20
+ }
21
+ parent::preDispatch();
22
+ }
23
+ public function newAction()
24
+ {
25
+ $this->loadLayout();
26
+ $newOrder = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_new', array(
27
+ 'template' => 'connector/shipping/new.phtml'
28
+ ));
29
+ $this->getLayout()->getBlock('content')->append($newOrder);
30
+ $items = $this->getLayout()->createBlock('email_connector/order', 'connector_shipping_items', array(
31
+ 'template' => 'connector/order/items.phtml'
32
+ ));
33
+ $this->getLayout()->getBlock('connector_shipping_new')->append($items);
34
+ $items = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_track', array(
35
+ 'template' => 'email/order/shipment/track.phtml'
36
+ ));
37
+ $this->getLayout()->getBlock('connector_shipping_new')->append($items);
38
+ $this->renderLayout();
39
+ }
40
+
41
+ public function newguestAction()
42
+ {
43
+ $this->loadLayout();
44
+ $newOrder = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_newguest', array(
45
+ 'template' => 'connector/shipping/newguest.phtml'
46
+ ));
47
+ $this->getLayout()->getBlock('content')->append($newOrder);
48
+ $items = $this->getLayout()->createBlock('email_connector/order', 'connector_shipping_items', array(
49
+ 'template' => 'connector/order/items.phtml'
50
+ ));
51
+ $this->getLayout()->getBlock('connector_shipping_newguest')->append($items);
52
+ $items = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_track', array(
53
+ 'template' => 'email/order/shipment/track.phtml'
54
+ ));
55
+ $this->getLayout()->getBlock('connector_shipping_newguest')->append($items);
56
+ $this->renderLayout();
57
+
58
+ }
59
+
60
+ public function updateAction()
61
+ {
62
+ $this->loadLayout();
63
+ $newOrder = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_update', array(
64
+ 'template' => 'connector/shipping/update.phtml'
65
+ ));
66
+ $this->getLayout()->getBlock('content')->append($newOrder);
67
+ $this->renderLayout();
68
+ }
69
+
70
+ public function updateguestAction()
71
+ {
72
+ $this->loadLayout();
73
+ $newOrder = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_updateguest', array(
74
+ 'template' => 'connector/shipping/updateguest.phtml'
75
+ ));
76
+ $this->getLayout()->getBlock('content')->append($newOrder);
77
+ $this->renderLayout();
78
+ }
79
+ }
app/code/community/Dotdigitalgroup/Email/etc/adminhtml.xml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <newsletter>
5
+ <children>
6
+ <email_connector translate="title">
7
+ <title>Email Orders</title>
8
+ <sort_order>1</sort_order>
9
+ <children>
10
+ <email_connector_dashboard translate="title">
11
+ <title>Dashboard</title>
12
+ <sort_order>10</sort_order>
13
+ <action>adminhtml/email_dashboard</action>
14
+ </email_connector_dashboard>
15
+ <email_connector_order translate="title">
16
+ <title>Email Connector Orders</title>
17
+ <sort_order>40</sort_order>
18
+ <action>adminhtml/email_order</action>
19
+ </email_connector_order>
20
+ <email_connector_campaign translate="title">
21
+ <title>Email Campaigns</title>
22
+ <sort_order>30</sort_order>
23
+ <action>adminhtml/email_campaign</action>
24
+ </email_connector_campaign>
25
+ <email_connector_contact translate="title">
26
+ <title>Email Contacts</title>
27
+ <sort_order>20</sort_order>
28
+ <action>adminhtml/email_contact</action>
29
+ </email_connector_contact>
30
+ </children>
31
+ </email_connector>
32
+ </children>
33
+ </newsletter>
34
+ </menu>
35
+ <acl>
36
+ <resources>
37
+ <newsetter>
38
+ <children>
39
+ <email_connector>
40
+ <childrend>
41
+ <email_connector_dashboard translate="title">
42
+ <title>Dashboard</title>
43
+ </email_connector_dashboard>
44
+ <email_connector_order translate="title">
45
+ <title>Email Connector Orders</title>
46
+ </email_connector_order>
47
+ <email_connector_campaign translate="title">
48
+ <title>Email Connector Campaigns</title>
49
+ </email_connector_campaign>
50
+ <email_connector_contact translate="title">
51
+ <title>Email Connector Contacts</title>
52
+ </email_connector_contact>
53
+ </childrend>
54
+ </email_connector>
55
+ </children>
56
+ </newsetter>
57
+ <admin>
58
+ <children>
59
+ <system>
60
+ <children>
61
+ <config>
62
+ <children>
63
+ <connector_api_credentials translate="title">
64
+ <title><![CDATA[API Credentials]]></title>
65
+ </connector_api_credentials>
66
+ <connector_sync_settings translate="title">
67
+ <title><![CDATA[Sync Settings]]></title>
68
+ </connector_sync_settings>
69
+ <connector_data_mapping translate="title">
70
+ <title><![CDATA[Data Field Mapping]]></title>
71
+ </connector_data_mapping>
72
+ <connector_roi_tracking translate="title">
73
+ <title><![CDATA[ROI & Tracking]]></title>
74
+ </connector_roi_tracking>
75
+ <connector_lost_baskets translate="title">
76
+ <title><![CDATA[Lost Baskets]]></title>
77
+ </connector_lost_baskets>
78
+ <connector_sms translate="title">
79
+ <title><![CDATA[SMS Section]]></title>
80
+ </connector_sms>
81
+ <connector_dynamic_content translate="title">
82
+ <title><![CDATA[Dynamic Content]]></title>
83
+ </connector_dynamic_content>
84
+ <connector_transactional_emails translate="title">
85
+ <title><![CDATA[Transactional Email]]></title>
86
+ </connector_transactional_emails>
87
+ <connector_advanced_settings translate="title">
88
+ <title><![CDATA[Advanced Settings]]></title>
89
+ </connector_advanced_settings>
90
+ </children>
91
+ </config>
92
+ </children>
93
+ </system>
94
+ </children>
95
+ </admin>
96
+ </resources>
97
+ </acl>
98
+ </config>
app/code/community/Dotdigitalgroup/Email/etc/config.xml ADDED
@@ -0,0 +1,438 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Dotdigitalgroup_Email>
5
+ <version>3.0.0</version>
6
+ </Dotdigitalgroup_Email>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <connector>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Dotdigitalgroup_Email</module>
14
+ <frontName>connector</frontName>
15
+ </args>
16
+ </connector>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <connector>
21
+ <file>connector.xml</file>
22
+ </connector>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <resources>
28
+ <email_connector_setup>
29
+ <setup>
30
+ <module>Dotdigitalgroup_Email</module>
31
+ <class>Dotdigitalgroup_Email_Model_Resource_Setup</class>
32
+ </setup>
33
+ </email_connector_setup>
34
+ </resources>
35
+ <models>
36
+ <email_connector>
37
+ <class>Dotdigitalgroup_Email_Model</class>
38
+ <resourceModel>email_connector_resource</resourceModel>
39
+ </email_connector>
40
+ <email_connector_resource>
41
+ <class>Dotdigitalgroup_Email_Model_Resource</class>
42
+ <entities>
43
+ <order>
44
+ <table>email_order</table>
45
+ </order>
46
+ <contact>
47
+ <table>email_contact</table>
48
+ </contact>
49
+ <campaign>
50
+ <table>email_campaign</table>
51
+ </campaign>
52
+ </entities>
53
+ </email_connector_resource>
54
+ <core>
55
+ <rewrite>
56
+ <email_template>Dotdigitalgroup_Email_Model_Email_Template</email_template>
57
+ <email_template_mailer>Dotdigitalgroup_Email_Model_Email_Template_Mailer</email_template_mailer>
58
+ </rewrite>
59
+ </core>
60
+ </models>
61
+ <helpers>
62
+ <connector>
63
+ <class>Dotdigitalgroup_Email_Helper</class>
64
+ </connector>
65
+ </helpers>
66
+ <blocks>
67
+ <email_connector>
68
+ <class>Dotdigitalgroup_Email_Block</class>
69
+ </email_connector>
70
+ </blocks>
71
+ <events>
72
+ <admin_system_config_changed_section_connector_api_credentials>
73
+ <observers>
74
+ <connector_api_save>
75
+ <class>Dotdigitalgroup_Email_Model_Adminhtml_Observer</class>
76
+ <method>actionConfigSaveApi</method>
77
+ </connector_api_save>
78
+ </observers>
79
+ </admin_system_config_changed_section_connector_api_credentials>
80
+ <admin_system_config_changed_section_connector_transactional_emails>
81
+ <observers>
82
+ <connector_transactional_api>
83
+ <class>Dotdigitalgroup_Email_Model_Adminhtml_Observer</class>
84
+ <method>actionConfigTransactional</method>
85
+ </connector_transactional_api>
86
+ </observers>
87
+ </admin_system_config_changed_section_connector_transactional_emails>
88
+ <admin_system_config_changed_section_connector_sync_settings>
89
+ <observers>
90
+ <connector_sync_reset>
91
+ <class>Dotdigitalgroup_Email_Model_Adminhtml_Observer</class>
92
+ <method>actionConfigResetContacts</method>
93
+ </connector_sync_reset>
94
+ </observers>
95
+ </admin_system_config_changed_section_connector_sync_settings>
96
+ <admin_system_config_changed_section_connector_data_mapping>
97
+ <observers>
98
+ <connector_data_mapping_reset>
99
+ <class>Dotdigitalgroup_Email_Model_Adminhtml_Observer</class>
100
+ <method>actionConfigResetContacts</method>
101
+ </connector_data_mapping_reset>
102
+ </observers>
103
+ </admin_system_config_changed_section_connector_data_mapping>
104
+ <customer_save_after>
105
+ <observers>
106
+ <connector_customer_save_after>
107
+ <class>Dotdigitalgroup_Email_Model_Customer_Observer</class>
108
+ <method>handleCustomerSaveBefore</method>
109
+ </connector_customer_save_after>
110
+ </observers>
111
+ </customer_save_after>
112
+ <newsletter_subscriber_save_before>
113
+ <observers>
114
+ <connector_newsletter_subscriber_save_after>
115
+ <class>Dotdigitalgroup_Email_Model_Newsletter_Observer</class>
116
+ <method>handleNewsletterSubscriberSave</method>
117
+ </connector_newsletter_subscriber_save_after>
118
+ </observers>
119
+ </newsletter_subscriber_save_before>
120
+ <sales_order_place_after>
121
+ <observers>
122
+ <connector_record_sale>
123
+ <type>singleton</type>
124
+ <class>Dotdigitalgroup_Email_Model_Sales_Observer</class>
125
+ <method>handleSalesOrderPlaceAfter</method>
126
+ </connector_record_sale>
127
+ </observers>
128
+ </sales_order_place_after>
129
+ <sales_order_save_before>
130
+ <observers>
131
+ <connector_sales_save_before>
132
+ <class>Dotdigitalgroup_Email_Model_Sales_Observer</class>
133
+ <method>handleSalesOrderSaveBefore</method>
134
+ </connector_sales_save_before>
135
+ </observers>
136
+ </sales_order_save_before>
137
+ <sales_order_save_after>
138
+ <observers>
139
+ <connector_checkout_type_onepage_save_order_after>
140
+ <class>Dotdigitalgroup_Email_Model_Sales_Observer</class>
141
+ <method>handleSalesOrderSaveAfter</method>
142
+ </connector_checkout_type_onepage_save_order_after>
143
+ </observers>
144
+ </sales_order_save_after>
145
+ <sales_order_creditmemo_save_after>
146
+ <observers>
147
+ <connector_sales_order_payment_refund>
148
+ <class>Dotdigitalgroup_Email_Model_Sales_Observer</class>
149
+ <method>handleSalesOrderRefund</method>
150
+ </connector_sales_order_payment_refund>
151
+ </observers>
152
+ </sales_order_creditmemo_save_after>
153
+ <order_cancel_after>
154
+ <observers>
155
+ <connector_sales_order_cancel>
156
+ <class>Dotdigitalgroup_Email_Model_Sales_Observer</class>
157
+ <method>hangleSalesOrderCancel</method>
158
+ </connector_sales_order_cancel>
159
+ </observers>
160
+ </order_cancel_after>
161
+ </events>
162
+ </global>
163
+ <adminhtml>
164
+ <layout>
165
+ <updates>
166
+ <connector_email>
167
+ <file>connector/email.xml</file>
168
+ </connector_email>
169
+ </updates>
170
+ </layout>
171
+ <translate>
172
+ <modules>
173
+ <Dotdigitalgroup_Email>
174
+ <files>
175
+ <default>Dotdigitalgroup_Email.csv</default>
176
+ </files>
177
+ </Dotdigitalgroup_Email>
178
+ </modules>
179
+ </translate>
180
+ </adminhtml>
181
+ <admin>
182
+ <routers>
183
+ <adminhtml>
184
+ <args>
185
+ <modules>
186
+ <Dotdigitalgroup_Email before="Mage_Adminhtml">Dotdigitalgroup_Email_Adminhtml</Dotdigitalgroup_Email>
187
+ </modules>
188
+ </args>
189
+ </adminhtml>
190
+ </routers>
191
+ </admin>
192
+ <crontab>
193
+ <jobs>
194
+ <connector_email_customer_sync>
195
+ <run><model>email_connector/cron::contactSync</model></run>
196
+ <schedule>
197
+ <cron_expr>*/15 * * * *</cron_expr>
198
+ </schedule>
199
+ </connector_email_customer_sync>
200
+ <connector_email_subscriber_and_guest_sync>
201
+ <run><model>email_connector/cron::subscribersAndGuestSync</model></run>
202
+ <schedule>
203
+ <cron_expr>*/15 * * * *</cron_expr>
204
+ </schedule>
205
+ </connector_email_subscriber_and_guest_sync>
206
+ <connector_email_lostbaskets>
207
+ <run><model>email_connector/cron::lostBaskets</model></run>
208
+ <schedule>
209
+ <cron_expr>*/5 * * * *</cron_expr>
210
+ </schedule>
211
+ </connector_email_lostbaskets>
212
+ <connector_email_campaign>
213
+ <run>
214
+ <model>email_connector/cron::sendMappedEmails</model>
215
+ </run>
216
+ <schedule>
217
+ <cron_expr>02,07,12,17,22,27,32,37,42,47,52,57 * * * *</cron_expr>
218
+ </schedule>
219
+ </connector_email_campaign>
220
+ <connector_email_order_sync>
221
+ <run><model>email_connector/cron::orderSync</model></run>
222
+ <schedule>
223
+ <cron_expr>*/15 * * * *</cron_expr>
224
+ </schedule>
225
+ </connector_email_order_sync>
226
+ <connector_email_cleaner>
227
+ <run><model>email_connector/cron::cleaning</model></run>
228
+ <schedule>
229
+ <cron_expr>0 0 1 * * </cron_expr>
230
+ </schedule>
231
+ </connector_email_cleaner>
232
+ </jobs>
233
+ </crontab>
234
+ <default>
235
+ <connector_api_credentials>
236
+ <api>
237
+ <enabled>0</enabled>
238
+ <username></username>
239
+ <password></password>
240
+ </api>
241
+ </connector_api_credentials>
242
+ <connector_sync_settings>
243
+ <address_book>
244
+ <customers></customers>
245
+ <subscribers></subscribers>
246
+ <guests></guests>
247
+ </address_book>
248
+ <sync>
249
+ <contact_enabled>0</contact_enabled>
250
+ <subscriber_enabled>0</subscriber_enabled>
251
+ <order_enabled>0</order_enabled>
252
+ <wishlist_enabled>0</wishlist_enabled>
253
+ </sync>
254
+ </connector_sync_settings>
255
+ <connector_data_mapping>
256
+ <customer_data>
257
+ <customer_id></customer_id>
258
+ <firstname></firstname>
259
+ <lastname></lastname>
260
+ <dob></dob>
261
+ <gender></gender>
262
+ <website_name></website_name>
263
+ <store_name></store_name>
264
+ <created_at></created_at>
265
+ <last_logged_date></last_logged_date>
266
+ <customer_group></customer_group>
267
+ <billing_address_1></billing_address_1>
268
+ <billing_address_2></billing_address_2>
269
+ <billing_city></billing_city>
270
+ <billing_state></billing_state>
271
+ <billing_country></billing_country>
272
+ <billing_postcode></billing_postcode>
273
+ <billing_telephone></billing_telephone>
274
+ <delivery_address_1></delivery_address_1>
275
+ <delivery_address_2></delivery_address_2>
276
+ <delivery_city></delivery_city>
277
+ <delivery_state></delivery_state>
278
+ <delivery_country></delivery_country>
279
+ <delivery_postcode></delivery_postcode>
280
+ <delivery_telephone></delivery_telephone>
281
+ <number_of_orders></number_of_orders>
282
+ <average_order_value></average_order_value>
283
+ <total_spend></total_spend>
284
+ <last_order_date></last_order_date>
285
+ <last_order_id></last_order_id>
286
+ <validator></validator>
287
+ </customer_data>
288
+ </connector_data_mapping>
289
+ <connector_roi_tracking>
290
+ <page_tracking>
291
+ <enabled>0</enabled>
292
+ </page_tracking>
293
+ <roi_tracking>
294
+ <enabled>0</enabled>
295
+ </roi_tracking>
296
+ </connector_roi_tracking>
297
+ <connector_lost_baskets>
298
+ <customers>
299
+ <enabled_1>0</enabled_1>
300
+ <send_after_1></send_after_1>
301
+ <campaign_1></campaign_1>
302
+ <enabled_2>0</enabled_2>
303
+ <send_after_2></send_after_2>
304
+ <campaign_2></campaign_2>
305
+ <enabled_3>0</enabled_3>
306
+ <send_after_3></send_after_3>
307
+ <campaign_3></campaign_3>
308
+ </customers>
309
+ <guests>
310
+ <enabled_1>0</enabled_1>
311
+ <send_after_1></send_after_1>
312
+ <campaign_1></campaign_1>
313
+ <enabled_2>0</enabled_2>
314
+ <send_after_2></send_after_2>
315
+ <campaign_2></campaign_2>
316
+ <enabled_3>0</enabled_3>
317
+ <send_after_3></send_after_3>
318
+ <campaign_3></campaign_3>
319
+ </guests>
320
+ </connector_lost_baskets>
321
+ <connector_sms>
322
+ <sms_message_one>
323
+ <enabled>0</enabled>
324
+ <order_status></order_status>
325
+ <message></message>
326
+ </sms_message_one>
327
+ <sms_message_two>
328
+ <enabled>0</enabled>
329
+ <order_status></order_status>
330
+ <message></message>
331
+ </sms_message_two>
332
+ <sms_message_three>
333
+ <enabled>0</enabled>
334
+ <order_status></order_status>
335
+ <message></message>
336
+ </sms_message_three>
337
+ <sms_message_four>
338
+ <enabled>0</enabled>
339
+ <order_status></order_status>
340
+ <message></message>
341
+ </sms_message_four>
342
+ </connector_sms>
343
+ <connector_dynamic_content>
344
+ <products>
345
+ <related></related>
346
+ <related_display_type>grid</related_display_type>
347
+ <related_items_to_display>4</related_items_to_display>
348
+ <upsell></upsell>
349
+ <upsell_display_type>grid</upsell_display_type>
350
+ <upsell_items_to_display>4</upsell_items_to_display>
351
+ <crosssell></crosssell>
352
+ <crosssell_display_type>grid</crosssell_display_type>
353
+ <crosssell_items_to_display>4</crosssell_items_to_display>
354
+ <bestsellers></bestsellers>
355
+ <bestsellers_display_type>grid</bestsellers_display_type>
356
+ <bestsellers_items_to_display>4</bestsellers_items_to_display>
357
+ <bestsellers_time_period></bestsellers_time_period>
358
+ <most_viewed></most_viewed>
359
+ <most_viewed_display_type>grid</most_viewed_display_type>
360
+ <most_viewed_items_to_display>4</most_viewed_items_to_display>
361
+ <most_viewed_time_period></most_viewed_time_period>
362
+ <recently_viewed></recently_viewed>
363
+ <recently_viewed_display_type>grid</recently_viewed_display_type>
364
+ <recently_viewed_items_to_display>4</recently_viewed_items_to_display>
365
+ <validator></validator>
366
+ </products>
367
+ <external_dynamic_content_urls>
368
+ <passcode>secret</passcode>
369
+ <lost_basket_url></lost_basket_url>
370
+ <coupon_code_url></coupon_code_url>
371
+ <dynamic_content_url></dynamic_content_url>
372
+ <related_products_url></related_products_url>
373
+ <upsell_products_url></upsell_products_url>
374
+ <crosssell_products_url></crosssell_products_url>
375
+ <best_sellers_url></best_sellers_url>
376
+ <most_viewed_url></most_viewed_url>
377
+ <product_push_url></product_push_url>
378
+ <recently_viewed_url></recently_viewed_url>
379
+ <transactional_customer_new_url></transactional_customer_new_url>
380
+ <transactional_order_new_url></transactional_order_new_url>
381
+ <transactional_order_creditmemo_new_url></transactional_order_creditmemo_new_url>
382
+ <transactional_order_update_url></transactional_order_update_url>
383
+ <transactional_invoice_new_url></transactional_invoice_new_url>
384
+ </external_dynamic_content_urls>
385
+ <manual_product_search>
386
+ <display_type></display_type>
387
+ <items_to_display></items_to_display>
388
+ <products_push_items></products_push_items>
389
+ </manual_product_search>
390
+ <fallback_products>
391
+ <product_list></product_list>
392
+ </fallback_products>
393
+ </connector_dynamic_content>
394
+ <connector_transactional_emails>
395
+ <transactional_email>
396
+ <email>
397
+ <api_username></api_username>
398
+ <api_password></api_password>
399
+ <validator></validator>
400
+ </email>
401
+ <email_mapping>
402
+ <new_creditmemo></new_creditmemo>
403
+ <new_creditmemo_guest></new_creditmemo_guest>
404
+ <creditmemo></creditmemo>
405
+ <new_invoice></new_invoice>
406
+ <invoice_update></invoice_update>
407
+ <sales_email_order_template></sales_email_order_template>
408
+ <order_update></order_update>
409
+ <new_shipment></new_shipment>
410
+ <shipment_update></shipment_update>
411
+ </email_mapping>
412
+ </transactional_email>
413
+ </connector_transactional_emails>
414
+ <connector_advanced_settings>
415
+ <sync_limits>
416
+ <orders>500</orders>
417
+ </sync_limits>
418
+ <admin>
419
+ <setup_data_fields></setup_data_fields>
420
+ <delete_contact></delete_contact>
421
+ <reimport_orders></reimport_orders>
422
+ <suppressed_contacts></suppressed_contacts>
423
+ <memory_limit>0</memory_limit>
424
+ <batch_size>10000</batch_size>
425
+ <debug_enabled></debug_enabled>
426
+ <inline_styling><![CDATA[table{font-family: arial, geneva, sans-serif; font-size:12px;}]]></inline_styling>
427
+ <recommended_inline><![CDATA[table{font-family: arial, geneva, sans-serif; font-size:12px;}]]></recommended_inline>
428
+ </admin>
429
+ </connector_advanced_settings>
430
+ </default>
431
+ <phpunit>
432
+ <suite>
433
+ <modules>
434
+ <Dotdigitalgroup_Email />
435
+ </modules>
436
+ </suite>
437
+ </phpunit>
438
+ </config>
app/code/{local → community}/Dotdigitalgroup/Email/etc/system.xml RENAMED
@@ -1,13 +1,13 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <config>
3
  <tabs>
4
- <connector translate="label">
5
  <label>EMAIL</label>
6
  <sort_order>1000</sort_order>
7
  </connector>
8
  </tabs>
9
  <sections>
10
- <connector_api_settings translate="label">
11
  <label><![CDATA[API Credentials]]></label>
12
  <tab>connector</tab>
13
  <frontend_type>text</frontend_type>
@@ -16,8 +16,8 @@
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>0</show_in_store>
18
  <groups>
19
- <api_credentials>
20
- <label>API Settings</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>10</sort_order>
23
  <show_in_default>1</show_in_default>
@@ -25,38 +25,38 @@
25
  <show_in_store>0</show_in_store>
26
  <expanded>1</expanded>
27
  <fields>
28
- <username>
29
- <label>API Username</label>
30
- <frontend_type>text</frontend_type>
31
- <frontend_model>connector/adminhtml_system_config_wrapper</frontend_model>
32
  <sort_order>10</sort_order>
33
  <show_in_default>1</show_in_default>
34
  <show_in_website>1</show_in_website>
35
  <show_in_store>0</show_in_store>
36
- <validate>validate-length minimum-length-36</validate>
37
- </username>
38
- <password>
39
- <label>API Password</label>
40
- <frontend_type>password</frontend_type>
41
- <frontend_model>connector/adminhtml_system_config_password</frontend_model>
42
  <sort_order>20</sort_order>
43
  <show_in_default>1</show_in_default>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>0</show_in_store>
46
- </password>
47
- <initialsync translate="label">
48
- <label>Test API Credentials</label>
49
- <frontend_model>connector/debug_testcredentials</frontend_model>
 
 
50
  <sort_order>30</sort_order>
51
  <show_in_default>1</show_in_default>
52
  <show_in_website>1</show_in_website>
53
  <show_in_store>0</show_in_store>
54
- <comment>*Please save your settings before clicking here! Use this button to test the account.</comment>
55
- </initialsync>
56
  <validator>
57
- <label></label>
58
  <frontend_type>hidden</frontend_type>
59
- <frontend_model>connector/adminhtml_system_config_waitingfield</frontend_model>
60
  <sort_order>50</sort_order>
61
  <show_in_default>1</show_in_default>
62
  <show_in_website>1</show_in_website>
@@ -64,13 +64,11 @@
64
  <can_be_empty>1</can_be_empty>
65
  </validator>
66
  </fields>
67
- </api_credentials>
68
  </groups>
69
- </connector_api_settings>
70
- <connector_sync_settings translate="label">
71
- <!-- you can put anything inbetween the CDATA tags (including image tags) -->
72
  <label><![CDATA[Sync Settings]]></label>
73
- <!-- this relates to the value in tab -->
74
  <tab>connector</tab>
75
  <frontend_type>text</frontend_type>
76
  <sort_order>3000</sort_order>
@@ -78,69 +76,45 @@
78
  <show_in_website>1</show_in_website>
79
  <show_in_store>0</show_in_store>
80
  <groups>
81
- <sync_customer_schedule>
82
- <label>Customer Data and Subscribers Sync Schedule</label>
83
- <frontend_type>text</frontend_type>
84
  <sort_order>10</sort_order>
85
  <show_in_default>1</show_in_default>
86
  <show_in_website>1</show_in_website>
87
  <show_in_store>0</show_in_store>
88
  <expanded>1</expanded>
89
  <fields>
90
- <enabled translate="label">
91
- <label>Enabled</label>
92
  <frontend_type>select</frontend_type>
93
- <source_model>adminhtml/system_config_source_yesno</source_model>
94
  <sort_order>10</sort_order>
95
  <show_in_default>1</show_in_default>
96
  <show_in_website>1</show_in_website>
97
  <show_in_store>0</show_in_store>
98
- </enabled>
99
- <time translate="label">
100
- <label>Start Time</label>
101
- <frontend_type>time</frontend_type>
102
- <backend_model>connector/system_config_backend_syncschedule_customer</backend_model>
103
  <sort_order>20</sort_order>
104
  <show_in_default>1</show_in_default>
105
- <show_in_website>0</show_in_website>
106
  <show_in_store>0</show_in_store>
107
- <depends><enabled>1</enabled></depends>
108
- </time>
109
- <frequency translate="label">
110
- <label>Frequency</label>
111
  <frontend_type>select</frontend_type>
112
- <source_model>connector/system_config_source_syncfrequency</source_model>
113
- <backend_model>connector/system_config_backend_syncschedule_customer</backend_model>
114
  <sort_order>30</sort_order>
115
  <show_in_default>1</show_in_default>
116
- <show_in_website>0</show_in_website>
117
- <show_in_store>0</show_in_store>
118
- <comment>Note: For Weekly and Monthly frequency, the day of the week/month will be today</comment>
119
- <depends><enabled>1</enabled></depends>
120
- </frequency>
121
- <force_sync translate="label">
122
- <label></label>
123
- <frontend_model>connector/debug_forcecustomersync</frontend_model>
124
- <sort_order>50</sort_order>
125
- <show_in_default>1</show_in_default>
126
- <show_in_website>0</show_in_website>
127
- <show_in_store>0</show_in_store>
128
- <comment>Use this button force the data synchronization to run now</comment>
129
- </force_sync>
130
- <validator>
131
- <label></label>
132
- <frontend_type>hidden</frontend_type>
133
- <frontend_model>connector/adminhtml_system_config_waitingfield</frontend_model>
134
- <sort_order>60</sort_order>
135
- <show_in_default>1</show_in_default>
136
- <show_in_website>0</show_in_website>
137
  <show_in_store>0</show_in_store>
138
- <can_be_empty>1</can_be_empty>
139
- </validator>
140
  </fields>
141
- </sync_customer_schedule>
142
- <sync_suppressed_schedule>
143
- <label>Suppressed Data Sync Schedule</label>
144
  <frontend_type>text</frontend_type>
145
  <sort_order>20</sort_order>
146
  <show_in_default>1</show_in_default>
@@ -148,95 +122,115 @@
148
  <show_in_store>0</show_in_store>
149
  <expanded>1</expanded>
150
  <fields>
151
- <enabled translate="label">
 
 
 
 
 
 
 
 
152
  <label>Enabled</label>
153
  <frontend_type>select</frontend_type>
154
  <source_model>adminhtml/system_config_source_yesno</source_model>
155
- <sort_order>2</sort_order>
156
  <show_in_default>1</show_in_default>
157
  <show_in_website>1</show_in_website>
158
  <show_in_store>0</show_in_store>
159
- </enabled>
160
- <time translate="label">
161
- <label>Start Time</label>
162
- <frontend_type>time</frontend_type>
163
- <backend_model>connector/system_config_backend_syncschedule_suppressed</backend_model>
164
- <sort_order>3</sort_order>
165
  <show_in_default>1</show_in_default>
166
- <show_in_website>0</show_in_website>
167
  <show_in_store>0</show_in_store>
168
- <depends><enabled>1</enabled></depends>
169
- </time>
170
- <frequency translate="label">
171
- <label>Frequency</label>
172
  <frontend_type>select</frontend_type>
173
- <source_model>connector/system_config_source_syncfrequency</source_model>
174
- <backend_model>connector/system_config_backend_syncschedule_suppressed</backend_model>
175
- <sort_order>4</sort_order>
176
- <show_in_default>1</show_in_default>
177
- <show_in_website>0</show_in_website>
178
- <show_in_store>0</show_in_store>
179
- <comment>Note: For Weekly and Monthly frequency, the day of the week/month will be today</comment>
180
- <depends><enabled>1</enabled></depends>
181
- </frequency>
182
- <force_sync translate="label">
183
- <label></label>
184
- <frontend_model>connector/debug_forcesuppressedsync</frontend_model>
185
- <sort_order>20</sort_order>
186
  <show_in_default>1</show_in_default>
187
- <show_in_website>0</show_in_website>
188
  <show_in_store>0</show_in_store>
189
- <comment>Use this button force the suppressed data synchronization to run now</comment>
190
- </force_sync>
191
- </fields>
192
- </sync_suppressed_schedule>
193
- <transactional_data translate="label">
194
- <label><![CDATA[ Transactional data settings]]></label>
195
- <frontend_type>text</frontend_type>
196
- <sort_order>30</sort_order>
197
- <show_in_default>1</show_in_default>
198
- <show_in_website>1</show_in_website>
199
- <show_in_store>0</show_in_store>
200
- <fields>
201
- <order_info_title translate="label">
202
- <label>Order/Basket Information</label>
203
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
204
- <sort_order>10</sort_order>
205
  <show_in_default>1</show_in_default>
206
  <show_in_website>1</show_in_website>
207
  <show_in_store>0</show_in_store>
208
- </order_info_title>
209
- <order_enabled translate="label">
210
  <label>Enabled</label>
211
  <frontend_type>select</frontend_type>
212
  <source_model>adminhtml/system_config_source_yesno</source_model>
213
- <sort_order>20</sort_order>
214
  <show_in_default>1</show_in_default>
215
  <show_in_website>1</show_in_website>
216
  <show_in_store>0</show_in_store>
217
  </order_enabled>
218
- <wishlist_tile translate="label">
219
- <label>Wish List Information</label>
220
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
221
- <sort_order>30</sort_order>
222
  <show_in_default>1</show_in_default>
223
  <show_in_website>1</show_in_website>
224
  <show_in_store>0</show_in_store>
225
- </wishlist_tile>
226
- <wishlist_enabled translate="label">
227
  <label>Enabled</label>
228
  <frontend_type>select</frontend_type>
229
  <source_model>adminhtml/system_config_source_yesno</source_model>
230
- <sort_order>40</sort_order>
231
  <show_in_default>1</show_in_default>
232
  <show_in_website>1</show_in_website>
233
  <show_in_store>0</show_in_store>
234
  </wishlist_enabled>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  </fields>
236
- </transactional_data>
237
  </groups>
238
  </connector_sync_settings>
239
- <connector_data_field_settings translate="label">
240
  <label><![CDATA[Data Mapping]]></label>
241
  <tab>connector</tab>
242
  <frontend_type>text</frontend_type>
@@ -245,16 +239,17 @@
245
  <show_in_website>1</show_in_website>
246
  <show_in_store>0</show_in_store>
247
  <groups>
248
- <customer_data>
249
- <label>Data Field Mapping</label>
250
  <frontend_type>text</frontend_type>
251
  <sort_order>20</sort_order>
252
  <show_in_default>1</show_in_default>
253
  <show_in_website>1</show_in_website>
254
  <show_in_store>0</show_in_store>
255
  <expanded>1</expanded>
 
256
  <fields>
257
- <customer_title translate="label">
258
  <label>Customer Information</label>
259
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
260
  <sort_order>10</sort_order>
@@ -262,283 +257,316 @@
262
  <show_in_website>1</show_in_website>
263
  <show_in_store>0</show_in_store>
264
  </customer_title>
265
-
266
- <customer_id translate="label">
267
- <label>Customer ID</label>
268
  <frontend_type>select</frontend_type>
269
- <source_model>connector/system_config_source_datafields</source_model>
270
  <sort_order>20</sort_order>
271
  <show_in_default>1</show_in_default>
272
  <show_in_website>1</show_in_website>
273
  <show_in_store>0</show_in_store>
274
- <comment>Please map the customer id, if you want to use the dynamic content.</comment>
275
- </customer_id>
276
- <title>
277
- <label>Title</label>
278
  <frontend_type>select</frontend_type>
279
- <source_model>connector/system_config_source_datafields</source_model>
280
  <sort_order>30</sort_order>
281
  <show_in_default>1</show_in_default>
282
  <show_in_website>1</show_in_website>
283
  <show_in_store>0</show_in_store>
284
- </title>
285
-
286
- <firstname>
287
  <label>First Name</label>
288
  <frontend_type>select</frontend_type>
289
- <source_model>connector/system_config_source_datafields</source_model>
290
  <sort_order>40</sort_order>
291
  <show_in_default>1</show_in_default>
292
  <show_in_website>1</show_in_website>
293
  <show_in_store>0</show_in_store>
294
  </firstname>
295
- <lastname>
296
  <label>Last Name</label>
297
  <frontend_type>select</frontend_type>
298
- <source_model>connector/system_config_source_datafields</source_model>
299
  <sort_order>50</sort_order>
300
  <show_in_default>1</show_in_default>
301
  <show_in_website>1</show_in_website>
302
  <show_in_store>0</show_in_store>
303
  </lastname>
304
- <dob>
305
  <label>D.O.B.</label>
306
  <frontend_type>select</frontend_type>
307
- <source_model>connector/system_config_source_datafields</source_model>
308
  <sort_order>60</sort_order>
309
  <show_in_default>1</show_in_default>
310
  <show_in_website>1</show_in_website>
311
  <show_in_store>0</show_in_store>
312
  </dob>
313
- <gender>
314
  <label>Gender</label>
315
  <frontend_type>select</frontend_type>
316
- <source_model>connector/system_config_source_datafields</source_model>
317
  <sort_order>70</sort_order>
318
  <show_in_default>1</show_in_default>
319
  <show_in_website>1</show_in_website>
320
  <show_in_store>0</show_in_store>
321
  </gender>
322
- <website_created_on>
323
  <label>Website Created On</label>
324
  <frontend_type>select</frontend_type>
325
- <source_model>connector/system_config_source_datafields</source_model>
326
  <sort_order>80</sort_order>
327
  <show_in_default>1</show_in_default>
328
  <show_in_website>1</show_in_website>
329
  <show_in_store>0</show_in_store>
330
- </website_created_on>
331
- <store_created_on>
332
  <label>Store Created On</label>
333
  <frontend_type>select</frontend_type>
334
- <source_model>connector/system_config_source_datafields</source_model>
335
  <sort_order>90</sort_order>
336
  <show_in_default>1</show_in_default>
337
  <show_in_website>1</show_in_website>
338
  <show_in_store>0</show_in_store>
339
- </store_created_on>
340
- <account_created>
341
  <label>Account Created Date</label>
342
  <frontend_type>select</frontend_type>
343
- <source_model>connector/system_config_source_datafields</source_model>
344
  <sort_order>100</sort_order>
345
  <show_in_default>1</show_in_default>
346
  <show_in_website>1</show_in_website>
347
  <show_in_store>0</show_in_store>
348
- </account_created>
349
- <last_logged_in>
350
  <label>Last Logged In Date</label>
351
  <frontend_type>select</frontend_type>
352
- <source_model>connector/system_config_source_datafields</source_model>
353
  <sort_order>110</sort_order>
354
  <show_in_default>1</show_in_default>
355
  <show_in_website>1</show_in_website>
356
  <show_in_store>0</show_in_store>
357
- </last_logged_in>
358
- <customer_group>
359
  <label>Customer Group</label>
360
  <frontend_type>select</frontend_type>
361
- <source_model>connector/system_config_source_datafields</source_model>
362
  <sort_order>120</sort_order>
363
  <show_in_default>1</show_in_default>
364
  <show_in_website>1</show_in_website>
365
  <show_in_store>0</show_in_store>
366
  </customer_group>
367
- <address_title translate="label">
368
- <label>Address Information</label>
369
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
370
  <sort_order>130</sort_order>
371
  <show_in_default>1</show_in_default>
372
  <show_in_website>1</show_in_website>
373
  <show_in_store>0</show_in_store>
374
  </address_title>
375
- <billing_address_1>
376
  <label>Billing Address Line 1</label>
377
  <frontend_type>select</frontend_type>
378
- <source_model>connector/system_config_source_datafields</source_model>
379
  <sort_order>140</sort_order>
380
  <show_in_default>1</show_in_default>
381
  <show_in_website>1</show_in_website>
382
  <show_in_store>0</show_in_store>
383
  </billing_address_1>
384
- <billing_address_2>
385
  <label>Billing Address Line 2</label>
386
  <frontend_type>select</frontend_type>
387
- <source_model>connector/system_config_source_datafields</source_model>
388
  <sort_order>150</sort_order>
389
  <show_in_default>1</show_in_default>
390
  <show_in_website>1</show_in_website>
391
  <show_in_store>0</show_in_store>
392
  </billing_address_2>
393
- <billing_city>
394
  <label>Billing City</label>
395
  <frontend_type>select</frontend_type>
396
- <source_model>connector/system_config_source_datafields</source_model>
397
  <sort_order>160</sort_order>
398
  <show_in_default>1</show_in_default>
399
  <show_in_website>1</show_in_website>
400
  <show_in_store>0</show_in_store>
401
  </billing_city>
402
- <billing_country>
 
 
 
 
 
 
 
 
 
403
  <label>Billing Country</label>
404
  <frontend_type>select</frontend_type>
405
- <source_model>connector/system_config_source_datafields</source_model>
406
  <sort_order>170</sort_order>
407
  <show_in_default>1</show_in_default>
408
  <show_in_website>1</show_in_website>
409
  <show_in_store>0</show_in_store>
410
  </billing_country>
411
- <billing_postcode>
412
  <label>Billing Zip/Postcode</label>
413
  <frontend_type>select</frontend_type>
414
- <source_model>connector/system_config_source_datafields</source_model>
415
  <sort_order>180</sort_order>
416
  <show_in_default>1</show_in_default>
417
  <show_in_website>1</show_in_website>
418
  <show_in_store>0</show_in_store>
419
  </billing_postcode>
420
- <billing_telephone>
421
  <label>Billing Telephone</label>
422
  <frontend_type>select</frontend_type>
423
- <source_model>connector/system_config_source_datafields</source_model>
424
  <sort_order>190</sort_order>
425
  <show_in_default>1</show_in_default>
426
  <show_in_website>1</show_in_website>
427
  <show_in_store>0</show_in_store>
428
  </billing_telephone>
429
- <delivery_address_1>
430
  <label>Delivery Address Line 1</label>
431
  <frontend_type>select</frontend_type>
432
- <source_model>connector/system_config_source_datafields</source_model>
433
  <sort_order>200</sort_order>
434
  <show_in_default>1</show_in_default>
435
  <show_in_website>1</show_in_website>
436
  <show_in_store>0</show_in_store>
437
  </delivery_address_1>
438
- <delivery_address_2>
439
  <label>Delivery Address Line 2</label>
440
  <frontend_type>select</frontend_type>
441
- <source_model>connector/system_config_source_datafields</source_model>
442
  <sort_order>210</sort_order>
443
  <show_in_default>1</show_in_default>
444
  <show_in_website>1</show_in_website>
445
  <show_in_store>0</show_in_store>
446
  </delivery_address_2>
447
- <delivery_city>
448
  <label>Delivery City</label>
449
  <frontend_type>select</frontend_type>
450
- <source_model>connector/system_config_source_datafields</source_model>
451
  <sort_order>220</sort_order>
452
  <show_in_default>1</show_in_default>
453
  <show_in_website>1</show_in_website>
454
  <show_in_store>0</show_in_store>
455
  </delivery_city>
456
- <delivery_country>
 
 
 
 
 
 
 
 
 
457
  <label>Delivery Country</label>
458
  <frontend_type>select</frontend_type>
459
- <source_model>connector/system_config_source_datafields</source_model>
460
  <sort_order>230</sort_order>
461
  <show_in_default>1</show_in_default>
462
  <show_in_website>1</show_in_website>
463
  <show_in_store>0</show_in_store>
464
  </delivery_country>
465
- <delivery_postcode>
466
  <label>Delivery Zip/Postcode</label>
467
  <frontend_type>select</frontend_type>
468
- <source_model>connector/system_config_source_datafields</source_model>
469
  <sort_order>240</sort_order>
470
  <show_in_default>1</show_in_default>
471
  <show_in_website>1</show_in_website>
472
  <show_in_store>0</show_in_store>
473
  </delivery_postcode>
474
- <delivery_telephone>
475
  <label>Delivery Telephone</label>
476
  <frontend_type>select</frontend_type>
477
- <source_model>connector/system_config_source_datafields</source_model>
478
  <sort_order>250</sort_order>
479
  <show_in_default>1</show_in_default>
480
  <show_in_website>1</show_in_website>
481
  <show_in_store>0</show_in_store>
482
  </delivery_telephone>
483
- <sales_title translate="label">
484
- <label>Sales Information</label>
485
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
486
  <sort_order>260</sort_order>
487
  <show_in_default>1</show_in_default>
488
  <show_in_website>1</show_in_website>
489
  <show_in_store>0</show_in_store>
490
  </sales_title>
491
- <total_orders>
492
  <label>Total Number of Orders</label>
493
  <frontend_type>select</frontend_type>
494
- <source_model>connector/system_config_source_datafields</source_model>
495
  <sort_order>270</sort_order>
496
  <show_in_default>1</show_in_default>
497
  <show_in_website>1</show_in_website>
498
  <show_in_store>0</show_in_store>
499
- </total_orders>
500
- <average_order_value>
501
  <label>Average Order Value</label>
502
  <frontend_type>select</frontend_type>
503
- <source_model>connector/system_config_source_datafields</source_model>
504
  <sort_order>280</sort_order>
505
  <show_in_default>1</show_in_default>
506
  <show_in_website>1</show_in_website>
507
  <show_in_store>0</show_in_store>
508
  </average_order_value>
509
- <total_spend>
510
  <label>Total Spend</label>
511
  <frontend_type>select</frontend_type>
512
- <source_model>connector/system_config_source_datafields</source_model>
513
  <sort_order>290</sort_order>
514
  <show_in_default>1</show_in_default>
515
  <show_in_website>1</show_in_website>
516
  <show_in_store>0</show_in_store>
517
  </total_spend>
518
- <last_order translate="label">
519
  <label>Last Purchase Date</label>
520
  <frontend_type>select</frontend_type>
521
- <source_model>connector/system_config_source_datafields</source_model>
522
  <sort_order>300</sort_order>
523
  <show_in_default>1</show_in_default>
524
  <show_in_website>1</show_in_website>
525
  <show_in_store>0</show_in_store>
526
- </last_order>
527
- <last_order_no translate="label">
528
- <label>Last Order No</label>
529
  <frontend_type>select</frontend_type>
530
- <source_model>connector/system_config_source_datafields</source_model>
531
  <sort_order>310</sort_order>
532
  <show_in_default>1</show_in_default>
533
  <show_in_website>1</show_in_website>
534
  <show_in_store>0</show_in_store>
535
- </last_order_no>
536
- <validator>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
537
  <label>Validation Block</label>
538
  <frontend_type>select</frontend_type>
539
- <source_model>connector/system_config_source_datafields</source_model>
540
- <frontend_model>connector/adminhtml_system_config_validator</frontend_model>
541
- <sort_order>320</sort_order>
542
  <show_in_default>1</show_in_default>
543
  <show_in_website>1</show_in_website>
544
  <show_in_store>0</show_in_store>
@@ -547,46 +575,46 @@
547
  </validator>
548
  </fields>
549
  </customer_data>
550
- <address_book translate="label">
551
- <label>Address Book Mapping</label>
552
- <sort_order>10</sort_order>
553
  <show_in_default>1</show_in_default>
554
  <show_in_website>1</show_in_website>
555
  <show_in_store>0</show_in_store>
556
- <expanded>1</expanded>
557
  <fields>
558
- <customers>
559
- <label>Add Customers to</label>
560
- <frontend_type>select</frontend_type>
561
- <source_model>connector/system_config_source_addressbooks</source_model>
562
  <sort_order>10</sort_order>
563
  <show_in_default>1</show_in_default>
564
  <show_in_website>1</show_in_website>
565
  <show_in_store>0</show_in_store>
566
- </customers>
567
- <subscribers>
568
- <label>Add Subscribers to</label>
569
  <frontend_type>select</frontend_type>
570
- <source_model>connector/system_config_source_addressbooks</source_model>
571
  <sort_order>20</sort_order>
572
  <show_in_default>1</show_in_default>
573
  <show_in_website>1</show_in_website>
574
  <show_in_store>0</show_in_store>
575
- </subscribers>
576
- <guest>
577
- <label>Add Guests to</label>
578
- <frontend_type>select</frontend_type>
579
- <source_model>connector/system_config_source_addressbooks</source_model>
 
580
  <sort_order>30</sort_order>
581
  <show_in_default>1</show_in_default>
582
  <show_in_website>1</show_in_website>
583
  <show_in_store>0</show_in_store>
584
- </guest>
585
  </fields>
586
- </address_book>
587
  </groups>
588
- </connector_data_field_settings>
589
- <connector_roi_page_tracking_settings translate="label">
590
  <label><![CDATA[ROI & Tracking]]></label>
591
  <tab>connector</tab>
592
  <frontend_type>text</frontend_type>
@@ -595,7 +623,7 @@
595
  <show_in_website>1</show_in_website>
596
  <show_in_store>0</show_in_store>
597
  <groups>
598
- <page_tracking>
599
  <label>Page Tracking</label>
600
  <frontend_type>text</frontend_type>
601
  <sort_order>10</sort_order>
@@ -604,7 +632,7 @@
604
  <show_in_store>0</show_in_store>
605
  <expanded>1</expanded>
606
  <fields>
607
- <enabled translate="label">
608
  <label>Enabled</label>
609
  <frontend_type>select</frontend_type>
610
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -615,7 +643,7 @@
615
  </enabled>
616
  </fields>
617
  </page_tracking>
618
- <roi_tracking>
619
  <label>ROI Tracking</label>
620
  <frontend_type>text</frontend_type>
621
  <sort_order>20</sort_order>
@@ -624,7 +652,7 @@
624
  <show_in_store>0</show_in_store>
625
  <expanded>1</expanded>
626
  <fields>
627
- <enabled translate="label">
628
  <label>Enabled</label>
629
  <frontend_type>select</frontend_type>
630
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -636,36 +664,17 @@
636
  </fields>
637
  </roi_tracking>
638
  </groups>
639
- </connector_roi_page_tracking_settings>
640
- <lost_basket_settings translate="label">
641
  <label><![CDATA[Lost Baskets]]></label>
642
  <tab>connector</tab>
643
  <frontend_type>text</frontend_type>
644
  <sort_order>6000</sort_order>
645
  <show_in_default>1</show_in_default>
646
  <show_in_website>1</show_in_website>
647
- <show_in_store>1</show_in_store>
648
  <groups>
649
- <active>
650
- <label>Lost Baskets Settings</label>
651
- <frontend_type>text</frontend_type>
652
- <sort_order>100</sort_order>
653
- <show_in_default>0</show_in_default>
654
- <show_in_website>0</show_in_website>
655
- <show_in_store>0</show_in_store>
656
- <fields>
657
- <active translate="label">
658
- <label>Consider Order complete for lost baskets</label>
659
- <frontend_type>select</frontend_type>
660
- <source_model>connector/system_config_source_activebasket</source_model>
661
- <sort_order>10</sort_order>
662
- <show_in_default>1</show_in_default>
663
- <show_in_website>1</show_in_website>
664
- <show_in_store>0</show_in_store>
665
- </active>
666
- </fields>
667
- </active>
668
- <customers>
669
  <label>Customers</label>
670
  <frontend_type>text</frontend_type>
671
  <sort_order>10</sort_order>
@@ -674,109 +683,106 @@
674
  <show_in_store>1</show_in_store>
675
  <expanded>1</expanded>
676
  <fields>
677
- <heading_1 translate="label">
678
- <label>Lost basket 1</label>
679
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
680
  <sort_order>10</sort_order>
681
  <show_in_default>1</show_in_default>
682
  <show_in_website>1</show_in_website>
683
  <show_in_store>1</show_in_store>
684
  </heading_1>
685
- <enabled_1 translate="label">
686
  <label>Enabled/Disabled</label>
687
  <frontend_type>select</frontend_type>
688
- <config_path>lostbaskets/customers/enabled_1</config_path>
689
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
690
  <sort_order>20</sort_order>
691
  <show_in_default>1</show_in_default>
692
  <show_in_website>1</show_in_website>
693
  <show_in_store>1</show_in_store>
694
  </enabled_1>
695
- <send_after_1>
696
- <label>Send after (min)</label>
697
  <frontend_type>select</frontend_type>
698
- <source_model>connector/system_config_source_lostbasket</source_model>
699
  <sort_order>30</sort_order>
700
  <show_in_default>1</show_in_default>
701
  <show_in_website>1</show_in_website>
702
  <show_in_store>1</show_in_store>
703
  </send_after_1>
704
- <campaign_1>
705
  <label>Campaign To Send</label>
706
  <frontend_type>select</frontend_type>
707
- <source_model>connector/system_config_source_campaigns</source_model>
708
  <sort_order>40</sort_order>
709
  <show_in_default>1</show_in_default>
710
  <show_in_website>1</show_in_website>
711
  <show_in_store>1</show_in_store>
712
  </campaign_1>
713
- <heading_2 translate="label">
714
- <label>Lost basket 2</label>
715
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
716
  <sort_order>50</sort_order>
717
  <show_in_default>1</show_in_default>
718
  <show_in_website>1</show_in_website>
719
  <show_in_store>1</show_in_store>
720
  </heading_2>
721
- <enabled_2 translate="label">
722
  <label>Enabled/Disabled</label>
723
  <frontend_type>select</frontend_type>
724
- <config_path>lostbaskets/customers/enabled_2</config_path>
725
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
726
  <sort_order>60</sort_order>
727
  <show_in_default>1</show_in_default>
728
  <show_in_website>1</show_in_website>
729
  <show_in_store>1</show_in_store>
730
  </enabled_2>
731
- <send_after_2>
732
- <label>Send after (hrs)</label>
733
  <frontend_type>select</frontend_type>
734
- <source_model>connector/system_config_source_sendcampain</source_model>
735
  <sort_order>70</sort_order>
736
  <show_in_default>1</show_in_default>
737
  <show_in_website>1</show_in_website>
738
  <show_in_store>1</show_in_store>
739
  </send_after_2>
740
- <campaign_2>
741
- <label>Campaign to send</label>
742
  <frontend_type>select</frontend_type>
743
- <source_model>connector/system_config_source_campaigns</source_model>
744
  <sort_order>80</sort_order>
745
  <show_in_default>1</show_in_default>
746
  <show_in_website>1</show_in_website>
747
  <show_in_store>1</show_in_store>
748
  </campaign_2>
749
- <heading_3 translate="label">
750
- <label>Lost basket 3 </label>
751
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
752
  <sort_order>90</sort_order>
753
  <show_in_default>1</show_in_default>
754
  <show_in_website>1</show_in_website>
755
  <show_in_store>1</show_in_store>
756
  </heading_3>
757
- <enabled_3 translate="label">
758
  <label>Enabled/Disabled</label>
759
  <frontend_type>select</frontend_type>
760
- <config_path>lostbaskets/customers/enabled_3</config_path>
761
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
762
  <sort_order>100</sort_order>
763
  <show_in_default>1</show_in_default>
764
  <show_in_website>1</show_in_website>
765
  <show_in_store>1</show_in_store>
766
  </enabled_3>
767
- <send_after_3>
768
- <label>Send after (hrs)</label>
769
  <frontend_type>select</frontend_type>
770
- <source_model>connector/system_config_source_sendcampain</source_model>
771
  <sort_order>110</sort_order>
772
  <show_in_default>1</show_in_default>
773
  <show_in_website>1</show_in_website>
774
  <show_in_store>1</show_in_store>
775
  </send_after_3>
776
- <campaign_3>
777
- <label>Campaign to send</label>
778
  <frontend_type>select</frontend_type>
779
- <source_model>connector/system_config_source_campaigns</source_model>
780
  <sort_order>120</sort_order>
781
  <show_in_default>1</show_in_default>
782
  <show_in_website>1</show_in_website>
@@ -784,157 +790,124 @@
784
  </campaign_3>
785
  </fields>
786
  </customers>
787
- <guests>
788
  <label>Guests</label>
789
  <frontend_type>text</frontend_type>
790
  <sort_order>20</sort_order>
791
  <show_in_default>1</show_in_default>
792
  <show_in_website>1</show_in_website>
793
- <show_in_store>1</show_in_store>
794
  <fields>
795
- <heading_1 translate="label">
796
- <label>Lost basket 1</label>
797
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
798
  <sort_order>10</sort_order>
799
  <show_in_default>1</show_in_default>
800
  <show_in_website>1</show_in_website>
801
- <show_in_store>1</show_in_store>
802
  </heading_1>
803
- <enabled_1 translate="label">
804
  <label>Enabled/Disabled</label>
805
  <frontend_type>select</frontend_type>
806
- <config_path>lostbaskets/guests/enabled_1</config_path>
807
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
808
  <sort_order>20</sort_order>
809
  <show_in_default>1</show_in_default>
810
  <show_in_website>1</show_in_website>
811
- <show_in_store>1</show_in_store>
812
  </enabled_1>
813
- <send_after_1>
814
- <label>Send after (min)</label>
815
  <frontend_type>select</frontend_type>
816
- <source_model>connector/system_config_source_lostbasket</source_model>
817
  <sort_order>30</sort_order>
818
  <show_in_default>1</show_in_default>
819
  <show_in_website>1</show_in_website>
820
- <show_in_store>1</show_in_store>
821
  </send_after_1>
822
- <campaign_1>
823
  <label>Campaign To Send</label>
824
  <frontend_type>select</frontend_type>
825
- <source_model>connector/system_config_source_campaigns</source_model>
826
  <sort_order>40</sort_order>
827
  <show_in_default>1</show_in_default>
828
  <show_in_website>1</show_in_website>
829
- <show_in_store>1</show_in_store>
830
  </campaign_1>
831
-
832
- <heading_2 translate="label">
833
- <label>Lost basket 2</label>
834
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
835
  <sort_order>50</sort_order>
836
  <show_in_default>1</show_in_default>
837
  <show_in_website>1</show_in_website>
838
- <show_in_store>1</show_in_store>
839
  </heading_2>
840
- <enabled_2 translate="label">
841
  <label>Enabled/Disabled</label>
842
  <frontend_type>select</frontend_type>
843
- <config_path>lostbaskets/guests/enabled_2</config_path>
844
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
845
  <sort_order>60</sort_order>
846
  <show_in_default>1</show_in_default>
847
  <show_in_website>1</show_in_website>
848
- <show_in_store>1</show_in_store>
849
  </enabled_2>
850
- <send_after_2>
851
- <label>Send after (hrs)</label>
852
  <frontend_type>select</frontend_type>
853
- <source_model>connector/system_config_source_sendcampain</source_model>
854
  <sort_order>70</sort_order>
855
  <show_in_default>1</show_in_default>
856
  <show_in_website>1</show_in_website>
857
- <show_in_store>1</show_in_store>
858
  </send_after_2>
859
- <campaign_2>
860
- <label>Campaign to send</label>
861
  <frontend_type>select</frontend_type>
862
- <source_model>connector/system_config_source_campaigns</source_model>
863
  <sort_order>80</sort_order>
864
  <show_in_default>1</show_in_default>
865
  <show_in_website>1</show_in_website>
866
- <show_in_store>1</show_in_store>
867
  </campaign_2>
868
-
869
- <heading_3 translate="label">
870
- <label>Lost basket 3 </label>
871
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
872
  <sort_order>90</sort_order>
873
  <show_in_default>1</show_in_default>
874
  <show_in_website>1</show_in_website>
875
- <show_in_store>1</show_in_store>
876
  </heading_3>
877
- <enabled_3 translate="label">
878
  <label>Enabled/Disabled</label>
879
  <frontend_type>select</frontend_type>
880
- <config_path>lostbaskets/guests/enabled_3</config_path>
881
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
882
  <sort_order>100</sort_order>
883
  <show_in_default>1</show_in_default>
884
  <show_in_website>1</show_in_website>
885
- <show_in_store>1</show_in_store>
886
  </enabled_3>
887
- <send_after_3>
888
- <label>Send after (hrs)</label>
889
  <frontend_type>select</frontend_type>
890
- <source_model>connector/system_config_source_sendcampain</source_model>
891
  <sort_order>110</sort_order>
892
  <show_in_default>1</show_in_default>
893
  <show_in_website>1</show_in_website>
894
- <show_in_store>1</show_in_store>
895
  </send_after_3>
896
- <campaign_3>
897
- <label>Campaign to send</label>
898
  <frontend_type>select</frontend_type>
899
- <source_model>connector/system_config_source_campaigns</source_model>
900
  <sort_order>120</sort_order>
901
  <show_in_default>1</show_in_default>
902
  <show_in_website>1</show_in_website>
903
- <show_in_store>1</show_in_store>
904
  </campaign_3>
905
  </fields>
906
  </guests>
907
- <test>
908
- <label>Test</label>
909
- <frontend_type>text</frontend_type>
910
- <sort_order>30</sort_order>
911
- <show_in_default>1</show_in_default>
912
- <show_in_website>1</show_in_website>
913
- <show_in_store>1</show_in_store>
914
- <fields>
915
- <email translate="label">
916
- <label>Test Email</label>
917
- <frontend_type>text</frontend_type>
918
- <sort_order>10</sort_order>
919
- <show_in_default>1</show_in_default>
920
- <show_in_website>1</show_in_website>
921
- <show_in_store>0</show_in_store>
922
- <comment>Enter the email for customer to test lost basket, with the first lost basket campaign.</comment>
923
- </email>
924
- <force_test translate="label">
925
- <label></label>
926
- <frontend_model>connector/debug_forcelostbasketsync</frontend_model>
927
- <sort_order>50</sort_order>
928
- <show_in_default>1</show_in_default>
929
- <show_in_website>0</show_in_website>
930
- <show_in_store>0</show_in_store>
931
- <comment>Use this button force the data synchronization to run now</comment>
932
- </force_test>
933
- </fields>
934
- </test>
935
  </groups>
936
- </lost_basket_settings>
937
- <sms_section translate="label">
938
  <label><![CDATA[SMS]]></label>
939
  <tab>connector</tab>
940
  <frontend_type>text</frontend_type>
@@ -943,7 +916,7 @@
943
  <show_in_website>1</show_in_website>
944
  <show_in_store>1</show_in_store>
945
  <groups>
946
- <sms_message_one translate="label">
947
  <label>SMS Message 1</label>
948
  <frontend_type>text</frontend_type>
949
  <sort_order>10</sort_order>
@@ -951,7 +924,7 @@
951
  <show_in_website>1</show_in_website>
952
  <show_in_store>1</show_in_store>
953
  <fields>
954
- <enabled translate="label">
955
  <label>Enabled</label>
956
  <frontend_type>select</frontend_type>
957
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -960,29 +933,28 @@
960
  <show_in_website>1</show_in_website>
961
  <show_in_store>1</show_in_store>
962
  </enabled>
963
- <order_status translate="label">
964
  <label>Order Status</label>
965
  <sort_order>20</sort_order>
966
  <frontend_type>select</frontend_type>
967
- <source_model>connector/system_config_source_orderstatus</source_model>
968
  <show_in_default>1</show_in_default>
969
  <show_in_website>1</show_in_website>
970
  <show_in_store>1</show_in_store>
971
- </order_status>
972
- <message translate="label">
973
  <label>Message</label>
974
  <frontend_type>textarea</frontend_type>
975
- <frontend_model>connector/adminhtml_system_config_smsmessageone</frontend_model>
976
  <sort_order>30</sort_order>
977
  <show_in_default>1</show_in_default>
978
  <show_in_website>1</show_in_website>
979
  <show_in_store>1</show_in_store>
980
- <validate>validate-length maximum-length-110</validate>
981
  </message>
982
  </fields>
983
-
984
- </sms_message_one>
985
- <sms_message_two translate="label">
986
  <label>SMS Message 2</label>
987
  <frontend_type>text</frontend_type>
988
  <sort_order>20</sort_order>
@@ -990,7 +962,7 @@
990
  <show_in_website>1</show_in_website>
991
  <show_in_store>1</show_in_store>
992
  <fields>
993
- <enabled translate="label">
994
  <label>Enabled</label>
995
  <frontend_type>select</frontend_type>
996
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -999,29 +971,28 @@
999
  <show_in_website>1</show_in_website>
1000
  <show_in_store>1</show_in_store>
1001
  </enabled>
1002
- <order_status translate="label">
1003
  <label>Order Status</label>
1004
  <sort_order>20</sort_order>
1005
  <frontend_type>select</frontend_type>
1006
- <source_model>connector/system_config_source_orderstatus</source_model>
1007
  <show_in_default>1</show_in_default>
1008
  <show_in_website>1</show_in_website>
1009
  <show_in_store>1</show_in_store>
1010
- </order_status>
1011
- <message translate="label">
1012
  <label>Message</label>
1013
  <frontend_type>textarea</frontend_type>
1014
- <frontend_model>connector/adminhtml_system_config_smsmessagetwo</frontend_model>
1015
  <sort_order>30</sort_order>
1016
  <show_in_default>1</show_in_default>
1017
  <show_in_website>1</show_in_website>
1018
  <show_in_store>1</show_in_store>
1019
- <validate>validate-length maximum-length-110</validate>
1020
  </message>
1021
  </fields>
1022
-
1023
- </sms_message_two>
1024
- <sms_message_three translate="label">
1025
  <label>SMS Message 3</label>
1026
  <frontend_type>text</frontend_type>
1027
  <sort_order>30</sort_order>
@@ -1029,7 +1000,7 @@
1029
  <show_in_website>1</show_in_website>
1030
  <show_in_store>1</show_in_store>
1031
  <fields>
1032
- <enabled translate="label">
1033
  <label>Enabled</label>
1034
  <frontend_type>select</frontend_type>
1035
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -1038,28 +1009,28 @@
1038
  <show_in_website>1</show_in_website>
1039
  <show_in_store>1</show_in_store>
1040
  </enabled>
1041
- <order_status translate="label">
1042
  <label>Order Status</label>
1043
  <sort_order>20</sort_order>
1044
  <frontend_type>select</frontend_type>
1045
- <source_model>connector/system_config_source_orderstatus</source_model>
1046
  <show_in_default>1</show_in_default>
1047
  <show_in_website>1</show_in_website>
1048
  <show_in_store>1</show_in_store>
1049
- </order_status>
1050
- <message translate="label">
1051
  <label>Message</label>
1052
  <frontend_type>textarea</frontend_type>
1053
- <frontend_model>connector/adminhtml_system_config_smsmessagethree</frontend_model>
1054
  <sort_order>30</sort_order>
1055
  <show_in_default>1</show_in_default>
1056
  <show_in_website>1</show_in_website>
1057
  <show_in_store>1</show_in_store>
1058
- <validate>validate-length maximum-length-110</validate>
1059
  </message>
1060
  </fields>
1061
- </sms_message_three>
1062
- <sms_message_four translate="label">
1063
  <label>SMS Message 4</label>
1064
  <frontend_type>text</frontend_type>
1065
  <sort_order>40</sort_order>
@@ -1067,7 +1038,7 @@
1067
  <show_in_website>1</show_in_website>
1068
  <show_in_store>1</show_in_store>
1069
  <fields>
1070
- <enabled translate="label">
1071
  <label>Enabled</label>
1072
  <frontend_type>select</frontend_type>
1073
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -1076,31 +1047,30 @@
1076
  <show_in_website>1</show_in_website>
1077
  <show_in_store>1</show_in_store>
1078
  </enabled>
1079
- <order_status translate="label">
1080
  <label>Order Status</label>
1081
  <sort_order>20</sort_order>
1082
  <frontend_type>select</frontend_type>
1083
- <source_model>connector/system_config_source_orderstatus</source_model>
1084
  <show_in_default>1</show_in_default>
1085
  <show_in_website>1</show_in_website>
1086
  <show_in_store>1</show_in_store>
1087
- </order_status>
1088
- <message translate="label">
1089
  <label>Message</label>
1090
  <frontend_type>textarea</frontend_type>
1091
- <frontend_model>connector/adminhtml_system_config_smsmessagefour</frontend_model>
1092
  <sort_order>30</sort_order>
1093
  <show_in_default>1</show_in_default>
1094
  <show_in_website>1</show_in_website>
1095
  <show_in_store>1</show_in_store>
1096
- <validate>validate-length maximum-length-110</validate>
1097
  </message>
1098
  </fields>
1099
-
1100
- </sms_message_four>
1101
  </groups>
1102
- </sms_section>
1103
- <dynamic_content translate="label">
1104
  <label><![CDATA[Dynamic Content]]></label>
1105
  <tab>connector</tab>
1106
  <frontend_type>text</frontend_type>
@@ -1109,16 +1079,15 @@
1109
  <show_in_website>1</show_in_website>
1110
  <show_in_store>0</show_in_store>
1111
  <groups>
1112
- <products translate="label">
1113
  <label>Dynamic Products</label>
1114
  <frontend_type>text</frontend_type>
1115
- <sort_order>10</sort_order>
1116
  <show_in_default>1</show_in_default>
1117
  <show_in_website>1</show_in_website>
1118
  <show_in_store>0</show_in_store>
1119
- <expanded>1</expanded>
1120
  <fields>
1121
- <related translate="label">
1122
  <label>Related Products</label>
1123
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1124
  <sort_order>10</sort_order>
@@ -1126,26 +1095,25 @@
1126
  <show_in_website>1</show_in_website>
1127
  <show_in_store>0</show_in_store>
1128
  </related>
1129
- <related_display_type translate="label">
1130
  <label>Display Type</label>
1131
  <frontend_type>select</frontend_type>
1132
- <source_model>connector/system_config_source_displaytype</source_model>
1133
  <sort_order>20</sort_order>
1134
  <show_in_default>1</show_in_default>
1135
  <show_in_website>1</show_in_website>
1136
  <show_in_store>0</show_in_store>
1137
  </related_display_type>
1138
- <related_items_to_display translate="label">
1139
  <label>Items To Display</label>
1140
  <frontend_type>select</frontend_type>
1141
- <source_model>connector/system_config_source_gridview</source_model>
1142
  <sort_order>30</sort_order>
1143
  <show_in_website>1</show_in_website>
1144
  <show_in_default>1</show_in_default>
1145
  <show_in_store>0</show_in_store>
1146
  </related_items_to_display>
1147
-
1148
- <upsell translate="label">
1149
  <label>Up Sell Products</label>
1150
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1151
  <sort_order>40</sort_order>
@@ -1153,26 +1121,25 @@
1153
  <show_in_website>1</show_in_website>
1154
  <show_in_store>0</show_in_store>
1155
  </upsell>
1156
- <upsell_display_type translate="label">
1157
  <label>Display Type</label>
1158
  <frontend_type>select</frontend_type>
1159
- <source_model>connector/system_config_source_displaytype</source_model>
1160
  <sort_order>50</sort_order>
1161
  <show_in_default>1</show_in_default>
1162
  <show_in_website>1</show_in_website>
1163
  <show_in_store>0</show_in_store>
1164
  </upsell_display_type>
1165
- <upsell_items_to_display translate="label">
1166
  <label>Items To Display</label>
1167
  <frontend_type>select</frontend_type>
1168
- <source_model>connector/system_config_source_gridview</source_model>
1169
  <sort_order>60</sort_order>
1170
  <show_in_website>1</show_in_website>
1171
  <show_in_default>1</show_in_default>
1172
  <show_in_store>0</show_in_store>
1173
  </upsell_items_to_display>
1174
-
1175
- <crosssell translate="label">
1176
  <label>Cross Sell Products</label>
1177
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1178
  <sort_order>70</sort_order>
@@ -1180,62 +1147,60 @@
1180
  <show_in_website>1</show_in_website>
1181
  <show_in_store>0</show_in_store>
1182
  </crosssell>
1183
- <crosssell_display_type translate="label">
1184
  <label>Display Type</label>
1185
  <frontend_type>select</frontend_type>
1186
- <source_model>connector/system_config_source_displaytype</source_model>
1187
  <sort_order>80</sort_order>
1188
  <show_in_default>1</show_in_default>
1189
  <show_in_website>1</show_in_website>
1190
  <show_in_store>0</show_in_store>
1191
  </crosssell_display_type>
1192
- <crosssell_items_to_display translate="label">
1193
  <label>Items To Display</label>
1194
  <frontend_type>select</frontend_type>
1195
- <source_model>connector/system_config_source_gridview</source_model>
1196
  <sort_order>90</sort_order>
1197
  <show_in_website>1</show_in_website>
1198
  <show_in_default>1</show_in_default>
1199
  <show_in_store>0</show_in_store>
1200
  </crosssell_items_to_display>
1201
-
1202
- <best translate="label">
1203
  <label>Best Sellers</label>
1204
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1205
  <sort_order>100</sort_order>
1206
  <show_in_default>1</show_in_default>
1207
  <show_in_website>1</show_in_website>
1208
  <show_in_store>0</show_in_store>
1209
- </best>
1210
- <best_display_type translate="label">
1211
  <label>Display Type</label>
1212
  <frontend_type>select</frontend_type>
1213
- <source_model>connector/system_config_source_displaytype</source_model>
1214
  <sort_order>110</sort_order>
1215
  <show_in_default>1</show_in_default>
1216
  <show_in_website>1</show_in_website>
1217
  <show_in_store>0</show_in_store>
1218
- </best_display_type>
1219
- <best_items_to_display translate="label">
1220
  <label>Items To Display</label>
1221
  <frontend_type>select</frontend_type>
1222
- <source_model>connector/system_config_source_gridview</source_model>
1223
  <sort_order>120</sort_order>
1224
  <show_in_website>1</show_in_website>
1225
  <show_in_default>1</show_in_default>
1226
  <show_in_store>0</show_in_store>
1227
- </best_items_to_display>
1228
- <best_time_period translate="label">
1229
  <label>Time Period</label>
1230
  <frontend_type>select</frontend_type>
1231
- <source_model>connector/system_config_source_timeperiod</source_model>
1232
  <sort_order>130</sort_order>
1233
  <show_in_default>1</show_in_default>
1234
  <show_in_website>1</show_in_website>
1235
  <show_in_store>0</show_in_store>
1236
- </best_time_period>
1237
-
1238
- <most_viewed translate="label">
1239
  <label>Most Viewed</label>
1240
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1241
  <sort_order>140</sort_order>
@@ -1243,35 +1208,34 @@
1243
  <show_in_website>1</show_in_website>
1244
  <show_in_store>0</show_in_store>
1245
  </most_viewed>
1246
- <most_viewed_display_type translate="label">
1247
  <label>Display Type</label>
1248
  <frontend_type>select</frontend_type>
1249
- <source_model>connector/system_config_source_displaytype</source_model>
1250
  <sort_order>150</sort_order>
1251
  <show_in_default>1</show_in_default>
1252
  <show_in_website>1</show_in_website>
1253
  <show_in_store>0</show_in_store>
1254
  </most_viewed_display_type>
1255
- <most_viewed_items_to_display translate="label">
1256
  <label>Items To Display</label>
1257
  <frontend_type>select</frontend_type>
1258
- <source_model>connector/system_config_source_gridview</source_model>
1259
  <sort_order>160</sort_order>
1260
  <show_in_website>1</show_in_website>
1261
  <show_in_default>1</show_in_default>
1262
  <show_in_store>0</show_in_store>
1263
  </most_viewed_items_to_display>
1264
- <most_viewed_time_period translate="label">
1265
  <label>Time Period</label>
1266
  <frontend_type>select</frontend_type>
1267
- <source_model>connector/system_config_source_timeperiod</source_model>
1268
  <sort_order>170</sort_order>
1269
  <show_in_default>1</show_in_default>
1270
  <show_in_website>1</show_in_website>
1271
  <show_in_store>0</show_in_store>
1272
  </most_viewed_time_period>
1273
-
1274
- <recently_viewed translate="label">
1275
  <label>Recently Viewed</label>
1276
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1277
  <sort_order>180</sort_order>
@@ -1279,29 +1243,27 @@
1279
  <show_in_website>1</show_in_website>
1280
  <show_in_store>0</show_in_store>
1281
  </recently_viewed>
1282
- <recently_viewed_display_type translate="label">
1283
  <label>Display Type</label>
1284
  <frontend_type>select</frontend_type>
1285
- <source_model>connector/system_config_source_displaytype</source_model>
1286
  <sort_order>190</sort_order>
1287
  <show_in_default>1</show_in_default>
1288
  <show_in_website>1</show_in_website>
1289
  <show_in_store>0</show_in_store>
1290
  </recently_viewed_display_type>
1291
- <recently_viewed_items_to_display translate="label">
1292
  <label>items To Display</label>
1293
  <frontend_type>select</frontend_type>
1294
- <source_model>connector/system_config_source_gridview</source_model>
1295
  <sort_order>200</sort_order>
1296
  <show_in_default>1</show_in_default>
1297
  <show_in_website>1</show_in_website>
1298
  <show_in_store>0</show_in_store>
1299
  </recently_viewed_items_to_display>
1300
-
1301
  <validator>
1302
- <label></label>
1303
  <frontend_type>hidden</frontend_type>
1304
- <frontend_model>connector/adminhtml_system_config_gridlist</frontend_model>
1305
  <sort_order>210</sort_order>
1306
  <show_in_default>1</show_in_default>
1307
  <show_in_website>1</show_in_website>
@@ -1309,54 +1271,329 @@
1309
  <can_be_empty>1</can_be_empty>
1310
  </validator>
1311
  </fields>
1312
-
1313
  </products>
1314
- <manual_product_search translate="label">
1315
- <label>Manual Product Push</label>
1316
  <frontend_type>text</frontend_type>
1317
- <sort_order>20</sort_order>
1318
  <show_in_default>1</show_in_default>
1319
  <show_in_website>1</show_in_website>
1320
  <show_in_store>0</show_in_store>
1321
- <expanded>1</expanded>
1322
  <fields>
1323
- <settings tranlate="label">
1324
- <label>Settings</label>
1325
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1326
  <sort_order>10</sort_order>
1327
  <show_in_default>1</show_in_default>
1328
  <show_in_website>1</show_in_website>
1329
  <show_in_store>0</show_in_store>
1330
- </settings>
1331
- <display_type translate="label">
1332
- <label>Display Type</label>
1333
- <frontend_type>select</frontend_type>
1334
- <source_model>connector/system_config_source_displaytype</source_model>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1335
  <sort_order>50</sort_order>
1336
  <show_in_default>1</show_in_default>
1337
  <show_in_website>1</show_in_website>
1338
  <show_in_store>0</show_in_store>
1339
- </display_type>
1340
- <items_to_display translate="label">
1341
- <label>Items To Display</label>
1342
- <frontend_type>select</frontend_type>
1343
- <source_model>connector/system_config_source_gridview</source_model>
1344
  <sort_order>60</sort_order>
 
1345
  <show_in_website>1</show_in_website>
 
 
 
 
 
 
 
1346
  <show_in_default>1</show_in_default>
 
1347
  <show_in_store>0</show_in_store>
1348
- </items_to_display>
1349
- <products_push translate="label">
1350
- <label>Products</label>
1351
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
 
1352
  <sort_order>80</sort_order>
1353
  <show_in_default>1</show_in_default>
1354
  <show_in_website>1</show_in_website>
1355
  <show_in_store>0</show_in_store>
1356
- </products_push>
1357
- <products_push_items translate="label">
1358
- <label>Products</label>
1359
- <frontend_type>text</frontend_type>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1360
  <sort_order>90</sort_order>
1361
  <show_in_default>1</show_in_default>
1362
  <show_in_website>1</show_in_website>
@@ -1365,15 +1602,15 @@
1365
  </products_push_items>
1366
  </fields>
1367
  </manual_product_search>
1368
- <fallback_products translate="label">
1369
  <label>Fallback Products</label>
1370
  <frontend_type>text</frontend_type>
1371
- <sort_order>30</sort_order>
1372
  <show_in_default>1</show_in_default>
1373
  <show_in_website>1</show_in_website>
1374
  <show_in_store>0</show_in_store>
1375
  <fields>
1376
- <product_list translate="label">
1377
  <label>Products</label>
1378
  <frontend_type>text</frontend_type>
1379
  <sort_order>10</sort_order>
@@ -1385,223 +1622,381 @@
1385
  </fields>
1386
  </fallback_products>
1387
  </groups>
1388
- </dynamic_content>
1389
- <connector_advanced_settings translate="label">
1390
- <label><![CDATA[Advanced Settings]]></label>
1391
  <tab>connector</tab>
1392
  <frontend_type>text</frontend_type>
1393
- <sort_order>9000</sort_order>
1394
  <show_in_default>1</show_in_default>
1395
  <show_in_website>1</show_in_website>
1396
- <show_in_store>1</show_in_store>
 
1397
  <groups>
1398
- <sync_limits>
1399
- <label>Transactional Sync Limit</label>
1400
  <frontend_type>text</frontend_type>
1401
- <sort_order>10</sort_order>
1402
  <show_in_default>1</show_in_default>
1403
  <show_in_website>1</show_in_website>
1404
  <show_in_store>0</show_in_store>
 
1405
  <fields>
1406
- <orders translate="label">
1407
- <label>Historical import limit</label>
1408
  <frontend_type>select</frontend_type>
1409
- <source_model>connector/system_config_source_orderlimit</source_model>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1410
  <sort_order>40</sort_order>
1411
  <show_in_default>1</show_in_default>
1412
  <show_in_website>1</show_in_website>
1413
  <show_in_store>0</show_in_store>
1414
- </orders>
 
1415
  </fields>
1416
- </sync_limits>
1417
- <external translate="label">
1418
- <label><![CDATA[External Dynamic Content]]></label>
1419
  <frontend_type>text</frontend_type>
1420
- <sort_order>20</sort_order>
1421
  <show_in_default>1</show_in_default>
1422
  <show_in_website>1</show_in_website>
1423
- <show_in_store>0</show_in_store>
 
1424
  <fields>
1425
- <passcode translate="label">
1426
- <label>Passcode</label>
1427
- <frontend_type>text</frontend_type>
 
1428
  <sort_order>10</sort_order>
1429
  <show_in_default>1</show_in_default>
1430
  <show_in_website>1</show_in_website>
1431
  <show_in_store>0</show_in_store>
1432
- <comment><![CDATA[Recommended: Set a passcode so that basket contents and coupon codes can only be viewed if the following passcode is sent with the request.]]></comment>
1433
- </passcode>
1434
- <lost_basket_title translate="label">
1435
- <label>Lost Baskets</label>
1436
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1437
  <sort_order>20</sort_order>
 
 
1438
  <show_in_default>1</show_in_default>
1439
  <show_in_website>1</show_in_website>
1440
  <show_in_store>0</show_in_store>
1441
- </lost_basket_title>
1442
-
1443
- <lost_basket_url translate="label">
1444
- <label>Baskets Content URL</label>
1445
- <frontend_type>label</frontend_type>
1446
- <frontend_model>connector/adminhtml_system_lostbasket</frontend_model>
1447
  <sort_order>30</sort_order>
 
 
1448
  <show_in_default>1</show_in_default>
1449
  <show_in_website>1</show_in_website>
1450
  <show_in_store>0</show_in_store>
1451
- </lost_basket_url>
1452
- <coupon_code_title title="label">
1453
- <label>Coupon Codes</label>
1454
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1455
  <sort_order>40</sort_order>
1456
- <show_in_website>1</show_in_website>
 
1457
  <show_in_default>1</show_in_default>
 
1458
  <show_in_store>0</show_in_store>
1459
- </coupon_code_title>
1460
- <coupon_code_url translate="label">
1461
- <label>Coupon Codes URL</label>
1462
- <frontend_type>label</frontend_type>
1463
- <frontend_model>connector/adminhtml_system_couponinfo</frontend_model>
1464
  <sort_order>50</sort_order>
 
 
1465
  <show_in_default>1</show_in_default>
1466
  <show_in_website>1</show_in_website>
1467
  <show_in_store>0</show_in_store>
1468
- </coupon_code_url>
1469
-
1470
- <dynamic_content_url translate="label">
1471
- <label>Dynamic Content</label>
1472
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1473
  <sort_order>60</sort_order>
 
 
1474
  <show_in_default>1</show_in_default>
1475
  <show_in_website>1</show_in_website>
1476
  <show_in_store>0</show_in_store>
1477
- </dynamic_content_url>
1478
- <related_products_url translate="label">
1479
- <label>Related Products URL</label>
1480
- <frontend_type>label</frontend_type>
1481
- <frontend_model>connector/adminhtml_system_related</frontend_model>
1482
  <sort_order>70</sort_order>
 
 
1483
  <show_in_default>1</show_in_default>
1484
  <show_in_website>1</show_in_website>
1485
  <show_in_store>0</show_in_store>
1486
- </related_products_url>
1487
- <upsell_products_url translate="label">
1488
- <label>Up Sell Products URL</label>
1489
- <frontend_type>label</frontend_type>
1490
- <frontend_model>connector/adminhtml_system_upsell</frontend_model>
1491
  <sort_order>80</sort_order>
 
 
1492
  <show_in_default>1</show_in_default>
1493
  <show_in_website>1</show_in_website>
1494
  <show_in_store>0</show_in_store>
1495
- </upsell_products_url>
1496
- <crosssell_products_url translate="label">
1497
- <label>Cross Sell Products URL</label>
1498
- <frontend_type>label</frontend_type>
1499
- <frontend_model>connector/adminhtml_system_crosssell</frontend_model>
1500
  <sort_order>90</sort_order>
 
 
1501
  <show_in_default>1</show_in_default>
1502
  <show_in_website>1</show_in_website>
1503
  <show_in_store>0</show_in_store>
1504
- </crosssell_products_url>
1505
-
1506
- <best_sellers_url translate="label">
1507
- <label>Best Sellers URL</label>
1508
- <frontend_type>label</frontend_type>
1509
- <frontend_model>connector/adminhtml_system_bestsellers</frontend_model>
1510
  <sort_order>100</sort_order>
 
 
1511
  <show_in_default>1</show_in_default>
1512
  <show_in_website>1</show_in_website>
1513
  <show_in_store>0</show_in_store>
1514
- </best_sellers_url>
1515
- <most_viewed_url translate="label">
1516
- <label>Most Viewed URL</label>
1517
- <frontend_type>label</frontend_type>
1518
- <frontend_model>connector/adminhtml_system_mostviewed</frontend_model>
1519
  <sort_order>110</sort_order>
 
 
1520
  <show_in_default>1</show_in_default>
1521
  <show_in_website>1</show_in_website>
1522
  <show_in_store>0</show_in_store>
1523
- </most_viewed_url>
1524
- <product_push_url translate="label">
1525
- <label>Product Push URL</label>
1526
- <frontend_type>label</frontend_type>
1527
- <frontend_model>connector/adminhtml_system_productpush</frontend_model>
1528
  <sort_order>120</sort_order>
 
 
1529
  <show_in_default>1</show_in_default>
1530
  <show_in_website>1</show_in_website>
1531
  <show_in_store>0</show_in_store>
1532
- </product_push_url>
1533
- <recently_viewed_url translate="label">
1534
- <label>Recently Viewed</label>
1535
- <frontend_type>label</frontend_type>
1536
- <frontend_model>connector/adminhtml_system_recentlyviewed</frontend_model>
1537
  <sort_order>130</sort_order>
 
 
1538
  <show_in_default>1</show_in_default>
1539
  <show_in_website>1</show_in_website>
1540
  <show_in_store>0</show_in_store>
1541
- </recently_viewed_url>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1542
  </fields>
1543
- </external>
1544
- <admin translate="label">
1545
  <label>Admin</label>
1546
  <frontend_type>text</frontend_type>
1547
  <sort_order>30</sort_order>
1548
  <show_in_default>1</show_in_default>
1549
- <show_in_default>1</show_in_default>
1550
  <show_in_store>0</show_in_store>
 
 
1551
  <fields>
1552
- <admin_title translate="label">
1553
- <label>Contacts ID's</label>
1554
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1555
  <sort_order>10</sort_order>
1556
  <show_in_default>1</show_in_default>
1557
  <show_in_website>1</show_in_website>
1558
  <show_in_store>0</show_in_store>
1559
- </admin_title>
1560
- <count_customers translate="label">
1561
- <label>Count Customers with ID</label>
1562
- <frontend_model>connector/debug_countcontacts</frontend_model>
 
1563
  <sort_order>20</sort_order>
1564
  <show_in_default>1</show_in_default>
1565
  <show_in_website>1</show_in_website>
1566
  <show_in_store>0</show_in_store>
1567
- </count_customers>
1568
- <delete_contact translate="label">
1569
- <label>Delete All Contact ID's</label>
1570
- <frontend_model>connector/debug_deletecontacts</frontend_model>
 
1571
  <sort_order>30</sort_order>
1572
  <show_in_default>1</show_in_default>
1573
  <show_in_website>1</show_in_website>
1574
  <show_in_store>0</show_in_store>
1575
- </delete_contact>
1576
- <memory_limit translate="label">
1577
- <label>Memory Limit</label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1578
  <frontend_type>select</frontend_type>
1579
  <source_model>adminhtml/system_config_source_yesno</source_model>
 
1580
  <show_in_default>1</show_in_default>
1581
  <show_in_website>0</show_in_website>
1582
  <show_in_store>0</show_in_store>
1583
- <sort_order>40</sort_order>
1584
  <comment>Set to NO to use system default memory.</comment>
1585
  </memory_limit>
1586
- <batch_size translate="label">
1587
  <label>Customer Sync Batch Size</label>
1588
  <frontend_type>text</frontend_type>
1589
  <show_in_default>1</show_in_default>
1590
  <show_in_website>1</show_in_website>
1591
  <show_in_store>0</show_in_store>
1592
- <sort_order>50</sort_order>
1593
- <comment>Set the limit size for customers loaded in memory.</comment>
1594
  </batch_size>
1595
- <debug translate="label">
1596
  <label>Debug Mode</label>
1597
  <frontend_type>select</frontend_type>
1598
  <source_model>adminhtml/system_config_source_yesno</source_model>
1599
- <sort_order>50</sort_order>
1600
  <show_in_default>1</show_in_default>
1601
  <show_in_website>1</show_in_website>
1602
- <show_in_store>1</show_in_store>
1603
- <comment>Set to YES to allow creating log files</comment>
1604
- </debug>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1605
  </fields>
1606
  </admin>
1607
  </groups>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <config>
3
  <tabs>
4
+ <connector translate="label" module="connector">
5
  <label>EMAIL</label>
6
  <sort_order>1000</sort_order>
7
  </connector>
8
  </tabs>
9
  <sections>
10
+ <connector_api_credentials translate="label" module="connector">
11
  <label><![CDATA[API Credentials]]></label>
12
  <tab>connector</tab>
13
  <frontend_type>text</frontend_type>
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>0</show_in_store>
18
  <groups>
19
+ <api translate="label" module="connector">
20
+ <label>Settings</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>10</sort_order>
23
  <show_in_default>1</show_in_default>
25
  <show_in_store>0</show_in_store>
26
  <expanded>1</expanded>
27
  <fields>
28
+ <enabled translate="label" module="connector">
29
+ <label>Enabled</label>
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_yesno</source_model>
32
  <sort_order>10</sort_order>
33
  <show_in_default>1</show_in_default>
34
  <show_in_website>1</show_in_website>
35
  <show_in_store>0</show_in_store>
36
+ </enabled>
37
+ <username translate="label" module="connector">
38
+ <label>API Username</label>
39
+ <frontend_type>text</frontend_type>
40
+ <frontend_model>email_connector/adminhtml_system_config_wrapper</frontend_model>
 
41
  <sort_order>20</sort_order>
42
  <show_in_default>1</show_in_default>
43
  <show_in_website>1</show_in_website>
44
  <show_in_store>0</show_in_store>
45
+ <depends><enabled>1</enabled></depends>
46
+ </username>
47
+ <password translate="label" module="connector">
48
+ <label>API Password</label>
49
+ <frontend_type>password</frontend_type>
50
+ <frontend_model>email_connector/adminhtml_system_ajaxvalidate</frontend_model>
51
  <sort_order>30</sort_order>
52
  <show_in_default>1</show_in_default>
53
  <show_in_website>1</show_in_website>
54
  <show_in_store>0</show_in_store>
55
+ <depends><enabled>1</enabled></depends>
56
+ </password>
57
  <validator>
 
58
  <frontend_type>hidden</frontend_type>
59
+ <frontend_model>email_connector/adminhtml_system_config_waitingfield</frontend_model>
60
  <sort_order>50</sort_order>
61
  <show_in_default>1</show_in_default>
62
  <show_in_website>1</show_in_website>
64
  <can_be_empty>1</can_be_empty>
65
  </validator>
66
  </fields>
67
+ </api>
68
  </groups>
69
+ </connector_api_credentials>
70
+ <connector_sync_settings translate="label" module="connector">
 
71
  <label><![CDATA[Sync Settings]]></label>
 
72
  <tab>connector</tab>
73
  <frontend_type>text</frontend_type>
74
  <sort_order>3000</sort_order>
76
  <show_in_website>1</show_in_website>
77
  <show_in_store>0</show_in_store>
78
  <groups>
79
+ <address_book translate="label" module="connector">
80
+ <label>Address Book Mapping</label>
 
81
  <sort_order>10</sort_order>
82
  <show_in_default>1</show_in_default>
83
  <show_in_website>1</show_in_website>
84
  <show_in_store>0</show_in_store>
85
  <expanded>1</expanded>
86
  <fields>
87
+ <customers translate="label" module="connector">
88
+ <label>Add Customers To</label>
89
  <frontend_type>select</frontend_type>
90
+ <source_model>email_connector/adminhtml_source_addressbooks</source_model>
91
  <sort_order>10</sort_order>
92
  <show_in_default>1</show_in_default>
93
  <show_in_website>1</show_in_website>
94
  <show_in_store>0</show_in_store>
95
+ </customers>
96
+ <subscribers translate="label" module="connector">
97
+ <label>Add Subscribers To</label>
98
+ <frontend_type>select</frontend_type>
99
+ <source_model>email_connector/adminhtml_source_addressbooks</source_model>
100
  <sort_order>20</sort_order>
101
  <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
  <show_in_store>0</show_in_store>
104
+ </subscribers>
105
+ <guests translate="label" module="connector">
106
+ <label>Add Guests To</label>
 
107
  <frontend_type>select</frontend_type>
108
+ <source_model>email_connector/adminhtml_source_addressbooks</source_model>
 
109
  <sort_order>30</sort_order>
110
  <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  <show_in_store>0</show_in_store>
113
+ </guests>
 
114
  </fields>
115
+ </address_book>
116
+ <sync translate="label" module="connector">
117
+ <label>Sync</label>
118
  <frontend_type>text</frontend_type>
119
  <sort_order>20</sort_order>
120
  <show_in_default>1</show_in_default>
122
  <show_in_store>0</show_in_store>
123
  <expanded>1</expanded>
124
  <fields>
125
+ <contact_title translate="label" module="connector">
126
+ <label>Contact Sync</label>
127
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
128
+ <sort_order>10</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>0</show_in_store>
132
+ </contact_title>
133
+ <contact_enabled translate="label" module="connector">
134
  <label>Enabled</label>
135
  <frontend_type>select</frontend_type>
136
  <source_model>adminhtml/system_config_source_yesno</source_model>
137
+ <sort_order>20</sort_order>
138
  <show_in_default>1</show_in_default>
139
  <show_in_website>1</show_in_website>
140
  <show_in_store>0</show_in_store>
141
+ </contact_enabled>
142
+ <subscriber_title translate="label" module="connector">
143
+ <label>Subscriber Sync</label>
144
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
145
+ <sort_order>50</sort_order>
 
146
  <show_in_default>1</show_in_default>
147
+ <show_in_website>1</show_in_website>
148
  <show_in_store>0</show_in_store>
149
+ </subscriber_title>
150
+ <subscriber_enabled translate="label" module="connector">
151
+ <label>Enabled</label>
 
152
  <frontend_type>select</frontend_type>
153
+ <source_model>adminhtml/system_config_source_yesno</source_model>
154
+ <sort_order>60</sort_order>
 
 
 
 
 
 
 
 
 
 
 
155
  <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
  <show_in_store>0</show_in_store>
158
+ </subscriber_enabled>
159
+ <order_title translate="label" module="connector">
160
+ <label>Order Sync</label>
 
 
 
 
 
 
 
 
 
 
 
161
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
162
+ <sort_order>70</sort_order>
163
  <show_in_default>1</show_in_default>
164
  <show_in_website>1</show_in_website>
165
  <show_in_store>0</show_in_store>
166
+ </order_title>
167
+ <order_enabled translate="label" module="connector">
168
  <label>Enabled</label>
169
  <frontend_type>select</frontend_type>
170
  <source_model>adminhtml/system_config_source_yesno</source_model>
171
+ <sort_order>80</sort_order>
172
  <show_in_default>1</show_in_default>
173
  <show_in_website>1</show_in_website>
174
  <show_in_store>0</show_in_store>
175
  </order_enabled>
176
+ <wishlist_title translate="label" module="connector">
177
+ <label>Wishlist Sync</label>
178
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
179
+ <sort_order>90</sort_order>
180
  <show_in_default>1</show_in_default>
181
  <show_in_website>1</show_in_website>
182
  <show_in_store>0</show_in_store>
183
+ </wishlist_title>
184
+ <wishlist_enabled translate="label" module="connector">
185
  <label>Enabled</label>
186
  <frontend_type>select</frontend_type>
187
  <source_model>adminhtml/system_config_source_yesno</source_model>
188
+ <sort_order>100</sort_order>
189
  <show_in_default>1</show_in_default>
190
  <show_in_website>1</show_in_website>
191
  <show_in_store>0</show_in_store>
192
  </wishlist_enabled>
193
+ <validator>
194
+ <frontend_type>hidden</frontend_type>
195
+ <frontend_model>email_connector/adminhtml_system_config_waitingfield</frontend_model>
196
+ <sort_order>110</sort_order>
197
+ <show_in_default>1</show_in_default>
198
+ <show_in_website>1</show_in_website>
199
+ <show_in_store>0</show_in_store>
200
+ <can_be_empty>1</can_be_empty>
201
+ </validator>
202
+ </fields>
203
+ </sync>
204
+ <dynamic_addressbook translate="label" module="connector">
205
+ <label>Create Address Book</label>
206
+ <sort_order>30</sort_order>
207
+ <show_in_default>1</show_in_default>
208
+ <show_in_website>1</show_in_website>
209
+ <show_in_store>0</show_in_store>
210
+ <fields>
211
+ <addressbook_name module="connector">
212
+ <label>Address Book Name</label>
213
+ <frontend_type>text</frontend_type>
214
+ <frontend_model>email_connector/adminhtml_system_config_addressbook</frontend_model>
215
+ <sort_order>10</sort_order>
216
+ <show_in_default>1</show_in_default>
217
+ <show_in_website>1</show_in_website>
218
+ <show_in_store>0</show_in_store>
219
+ </addressbook_name>
220
+ <addresbook_button translate="label" module="connector">
221
+ <label />
222
+ <button_label>Create New Address book</button_label>
223
+ <frontend_model>email_connector/adminhtml_system_dynamic_addressbookbutton</frontend_model>
224
+ <sort_order>30</sort_order>
225
+ <show_in_default>1</show_in_default>
226
+ <show_in_website>1</show_in_website>
227
+ <show_in_store>0</show_in_store>
228
+ </addresbook_button>
229
  </fields>
230
+ </dynamic_addressbook>
231
  </groups>
232
  </connector_sync_settings>
233
+ <connector_data_mapping translate="label" module="connector">
234
  <label><![CDATA[Data Mapping]]></label>
235
  <tab>connector</tab>
236
  <frontend_type>text</frontend_type>
239
  <show_in_website>1</show_in_website>
240
  <show_in_store>0</show_in_store>
241
  <groups>
242
+ <customer_data translate="label" module="connector">
243
+ <label>Data Fields Mapping</label>
244
  <frontend_type>text</frontend_type>
245
  <sort_order>20</sort_order>
246
  <show_in_default>1</show_in_default>
247
  <show_in_website>1</show_in_website>
248
  <show_in_store>0</show_in_store>
249
  <expanded>1</expanded>
250
+ <comment><![CDATA[<p class="notice">AUTOMAP AVAILABLE IN ADVANCED SECTION TO MAP ALL DATAFIELDS.</p>]]></comment>
251
  <fields>
252
+ <customer_title translate="label" module="connector">
253
  <label>Customer Information</label>
254
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
255
  <sort_order>10</sort_order>
257
  <show_in_website>1</show_in_website>
258
  <show_in_store>0</show_in_store>
259
  </customer_title>
260
+ <title translate="label" module="connector">
261
+ <label>Title</label>
 
262
  <frontend_type>select</frontend_type>
263
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
264
  <sort_order>20</sort_order>
265
  <show_in_default>1</show_in_default>
266
  <show_in_website>1</show_in_website>
267
  <show_in_store>0</show_in_store>
268
+ </title>
269
+ <customer_id translate="label" module="connector">
270
+ <label>Customer ID</label>
 
271
  <frontend_type>select</frontend_type>
272
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
273
  <sort_order>30</sort_order>
274
  <show_in_default>1</show_in_default>
275
  <show_in_website>1</show_in_website>
276
  <show_in_store>0</show_in_store>
277
+ </customer_id>
278
+ <firstname translate="label" module="connector">
 
279
  <label>First Name</label>
280
  <frontend_type>select</frontend_type>
281
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
282
  <sort_order>40</sort_order>
283
  <show_in_default>1</show_in_default>
284
  <show_in_website>1</show_in_website>
285
  <show_in_store>0</show_in_store>
286
  </firstname>
287
+ <lastname translate="label" module="connector">
288
  <label>Last Name</label>
289
  <frontend_type>select</frontend_type>
290
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
291
  <sort_order>50</sort_order>
292
  <show_in_default>1</show_in_default>
293
  <show_in_website>1</show_in_website>
294
  <show_in_store>0</show_in_store>
295
  </lastname>
296
+ <dob translate="label" module="connector">
297
  <label>D.O.B.</label>
298
  <frontend_type>select</frontend_type>
299
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
300
  <sort_order>60</sort_order>
301
  <show_in_default>1</show_in_default>
302
  <show_in_website>1</show_in_website>
303
  <show_in_store>0</show_in_store>
304
  </dob>
305
+ <gender translate="label" module="connector">
306
  <label>Gender</label>
307
  <frontend_type>select</frontend_type>
308
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
309
  <sort_order>70</sort_order>
310
  <show_in_default>1</show_in_default>
311
  <show_in_website>1</show_in_website>
312
  <show_in_store>0</show_in_store>
313
  </gender>
314
+ <website_name translate="label" module="connector">
315
  <label>Website Created On</label>
316
  <frontend_type>select</frontend_type>
317
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
318
  <sort_order>80</sort_order>
319
  <show_in_default>1</show_in_default>
320
  <show_in_website>1</show_in_website>
321
  <show_in_store>0</show_in_store>
322
+ </website_name>
323
+ <store_name translate="label" module="connector">
324
  <label>Store Created On</label>
325
  <frontend_type>select</frontend_type>
326
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
327
  <sort_order>90</sort_order>
328
  <show_in_default>1</show_in_default>
329
  <show_in_website>1</show_in_website>
330
  <show_in_store>0</show_in_store>
331
+ </store_name>
332
+ <created_at translate="label" module="connector">
333
  <label>Account Created Date</label>
334
  <frontend_type>select</frontend_type>
335
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
336
  <sort_order>100</sort_order>
337
  <show_in_default>1</show_in_default>
338
  <show_in_website>1</show_in_website>
339
  <show_in_store>0</show_in_store>
340
+ </created_at>
341
+ <last_logged_date translate="label" module="connector">
342
  <label>Last Logged In Date</label>
343
  <frontend_type>select</frontend_type>
344
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
345
  <sort_order>110</sort_order>
346
  <show_in_default>1</show_in_default>
347
  <show_in_website>1</show_in_website>
348
  <show_in_store>0</show_in_store>
349
+ </last_logged_date>
350
+ <customer_group translate="label" module="connector">
351
  <label>Customer Group</label>
352
  <frontend_type>select</frontend_type>
353
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
354
  <sort_order>120</sort_order>
355
  <show_in_default>1</show_in_default>
356
  <show_in_website>1</show_in_website>
357
  <show_in_store>0</show_in_store>
358
  </customer_group>
359
+ <address_title translate="label" module="connector">
360
+ <label>Address</label>
361
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
362
  <sort_order>130</sort_order>
363
  <show_in_default>1</show_in_default>
364
  <show_in_website>1</show_in_website>
365
  <show_in_store>0</show_in_store>
366
  </address_title>
367
+ <billing_address_1 translate="label" module="connector">
368
  <label>Billing Address Line 1</label>
369
  <frontend_type>select</frontend_type>
370
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
371
  <sort_order>140</sort_order>
372
  <show_in_default>1</show_in_default>
373
  <show_in_website>1</show_in_website>
374
  <show_in_store>0</show_in_store>
375
  </billing_address_1>
376
+ <billing_address_2 translate="label" module="connector">
377
  <label>Billing Address Line 2</label>
378
  <frontend_type>select</frontend_type>
379
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
380
  <sort_order>150</sort_order>
381
  <show_in_default>1</show_in_default>
382
  <show_in_website>1</show_in_website>
383
  <show_in_store>0</show_in_store>
384
  </billing_address_2>
385
+ <billing_city translate="label" module="connector">
386
  <label>Billing City</label>
387
  <frontend_type>select</frontend_type>
388
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
389
  <sort_order>160</sort_order>
390
  <show_in_default>1</show_in_default>
391
  <show_in_website>1</show_in_website>
392
  <show_in_store>0</show_in_store>
393
  </billing_city>
394
+ <billing_state translate="label" module="connector">
395
+ <label>Billing State/Region</label>
396
+ <frontend_type>select</frontend_type>
397
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
398
+ <sort_order>155</sort_order>
399
+ <show_in_default>1</show_in_default>
400
+ <show_in_website>1</show_in_website>
401
+ <show_in_store>0</show_in_store>
402
+ </billing_state>
403
+ <billing_country translate="label" module="connector">
404
  <label>Billing Country</label>
405
  <frontend_type>select</frontend_type>
406
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
407
  <sort_order>170</sort_order>
408
  <show_in_default>1</show_in_default>
409
  <show_in_website>1</show_in_website>
410
  <show_in_store>0</show_in_store>
411
  </billing_country>
412
+ <billing_postcode translate="label" module="connector">
413
  <label>Billing Zip/Postcode</label>
414
  <frontend_type>select</frontend_type>
415
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
416
  <sort_order>180</sort_order>
417
  <show_in_default>1</show_in_default>
418
  <show_in_website>1</show_in_website>
419
  <show_in_store>0</show_in_store>
420
  </billing_postcode>
421
+ <billing_telephone translate="label" module="connector">
422
  <label>Billing Telephone</label>
423
  <frontend_type>select</frontend_type>
424
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
425
  <sort_order>190</sort_order>
426
  <show_in_default>1</show_in_default>
427
  <show_in_website>1</show_in_website>
428
  <show_in_store>0</show_in_store>
429
  </billing_telephone>
430
+ <delivery_address_1 translate="label" module="connector">
431
  <label>Delivery Address Line 1</label>
432
  <frontend_type>select</frontend_type>
433
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
434
  <sort_order>200</sort_order>
435
  <show_in_default>1</show_in_default>
436
  <show_in_website>1</show_in_website>
437
  <show_in_store>0</show_in_store>
438
  </delivery_address_1>
439
+ <delivery_address_2 translate="label" module="connector">
440
  <label>Delivery Address Line 2</label>
441
  <frontend_type>select</frontend_type>
442
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
443
  <sort_order>210</sort_order>
444
  <show_in_default>1</show_in_default>
445
  <show_in_website>1</show_in_website>
446
  <show_in_store>0</show_in_store>
447
  </delivery_address_2>
448
+ <delivery_city translate="label" module="connector">
449
  <label>Delivery City</label>
450
  <frontend_type>select</frontend_type>
451
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
452
  <sort_order>220</sort_order>
453
  <show_in_default>1</show_in_default>
454
  <show_in_website>1</show_in_website>
455
  <show_in_store>0</show_in_store>
456
  </delivery_city>
457
+ <delivery_state translate="label" module="connector">
458
+ <label>Delivery State/Region</label>
459
+ <frontend_type>select</frontend_type>
460
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
461
+ <sort_order>215</sort_order>
462
+ <show_in_default>1</show_in_default>
463
+ <show_in_website>1</show_in_website>
464
+ <show_in_store>0</show_in_store>
465
+ </delivery_state>
466
+ <delivery_country translate="label" module="connector">
467
  <label>Delivery Country</label>
468
  <frontend_type>select</frontend_type>
469
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
470
  <sort_order>230</sort_order>
471
  <show_in_default>1</show_in_default>
472
  <show_in_website>1</show_in_website>
473
  <show_in_store>0</show_in_store>
474
  </delivery_country>
475
+ <delivery_postcode translate="label" module="connector">
476
  <label>Delivery Zip/Postcode</label>
477
  <frontend_type>select</frontend_type>
478
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
479
  <sort_order>240</sort_order>
480
  <show_in_default>1</show_in_default>
481
  <show_in_website>1</show_in_website>
482
  <show_in_store>0</show_in_store>
483
  </delivery_postcode>
484
+ <delivery_telephone translate="label" module="connector">
485
  <label>Delivery Telephone</label>
486
  <frontend_type>select</frontend_type>
487
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
488
  <sort_order>250</sort_order>
489
  <show_in_default>1</show_in_default>
490
  <show_in_website>1</show_in_website>
491
  <show_in_store>0</show_in_store>
492
  </delivery_telephone>
493
+ <sales_title translate="label" module="connector">
494
+ <label>Sales</label>
495
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
496
  <sort_order>260</sort_order>
497
  <show_in_default>1</show_in_default>
498
  <show_in_website>1</show_in_website>
499
  <show_in_store>0</show_in_store>
500
  </sales_title>
501
+ <number_of_orders translate="label" module="connector">
502
  <label>Total Number of Orders</label>
503
  <frontend_type>select</frontend_type>
504
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
505
  <sort_order>270</sort_order>
506
  <show_in_default>1</show_in_default>
507
  <show_in_website>1</show_in_website>
508
  <show_in_store>0</show_in_store>
509
+ </number_of_orders>
510
+ <average_order_value translate="label" module="connector">
511
  <label>Average Order Value</label>
512
  <frontend_type>select</frontend_type>
513
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
514
  <sort_order>280</sort_order>
515
  <show_in_default>1</show_in_default>
516
  <show_in_website>1</show_in_website>
517
  <show_in_store>0</show_in_store>
518
  </average_order_value>
519
+ <total_spend translate="label" module="connector">
520
  <label>Total Spend</label>
521
  <frontend_type>select</frontend_type>
522
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
523
  <sort_order>290</sort_order>
524
  <show_in_default>1</show_in_default>
525
  <show_in_website>1</show_in_website>
526
  <show_in_store>0</show_in_store>
527
  </total_spend>
528
+ <last_order_date translate="label" module="connector">
529
  <label>Last Purchase Date</label>
530
  <frontend_type>select</frontend_type>
531
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
532
  <sort_order>300</sort_order>
533
  <show_in_default>1</show_in_default>
534
  <show_in_website>1</show_in_website>
535
  <show_in_store>0</show_in_store>
536
+ </last_order_date>
537
+ <last_order_id translate="label" module="connector">
538
+ <label>Last Order ID</label>
539
  <frontend_type>select</frontend_type>
540
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
541
  <sort_order>310</sort_order>
542
  <show_in_default>1</show_in_default>
543
  <show_in_website>1</show_in_website>
544
  <show_in_store>0</show_in_store>
545
+ </last_order_id>
546
+ <custom_title translate="label" module="connector">
547
+ <label>Custom Attributes</label>
548
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
549
+ <sort_order>330</sort_order>
550
+ <show_in_default>1</show_in_default>
551
+ <show_in_website>1</show_in_website>
552
+ <show_in_store>0</show_in_store>
553
+ </custom_title>
554
+ <custom_attributes translate="label" module="connector">
555
+ <label>Customer</label>
556
+ <frontend_model>email_connector/adminhtml_config_customdatafields</frontend_model>
557
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
558
+ <source_model>email_connector/adminhtml_source_customer_attributes_select</source_model>
559
+ <sort_order>340</sort_order>
560
+ <show_in_default>1</show_in_default>
561
+ <show_in_website>1</show_in_website>
562
+ <show_in_store>0</show_in_store>
563
+ </custom_attributes>
564
+ <validator translate="label" module="connector">
565
  <label>Validation Block</label>
566
  <frontend_type>select</frontend_type>
567
+ <source_model>email_connector/adminhtml_source_datafields</source_model>
568
+ <frontend_model>email_connector/adminhtml_system_config_validator</frontend_model>
569
+ <sort_order>920</sort_order>
570
  <show_in_default>1</show_in_default>
571
  <show_in_website>1</show_in_website>
572
  <show_in_store>0</show_in_store>
575
  </validator>
576
  </fields>
577
  </customer_data>
578
+ <dynamic_datafield translate="label" module="connector">
579
+ <label>Create Data Field</label>
580
+ <sort_order>30</sort_order>
581
  <show_in_default>1</show_in_default>
582
  <show_in_website>1</show_in_website>
583
  <show_in_store>0</show_in_store>
 
584
  <fields>
585
+ <datafield_name module="connector">
586
+ <label>Data Field Name</label>
587
+ <frontend_type>text</frontend_type>
588
+ <frontend_model>email_connector/adminhtml_system_config_datafield</frontend_model>
589
  <sort_order>10</sort_order>
590
  <show_in_default>1</show_in_default>
591
  <show_in_website>1</show_in_website>
592
  <show_in_store>0</show_in_store>
593
+ </datafield_name>
594
+ <datafield_type translate="label" module="connector">
595
+ <label>Data Field Type</label>
596
  <frontend_type>select</frontend_type>
597
+ <source_model>email_connector/adminhtml_source_datamapping_datafieldtype</source_model>
598
  <sort_order>20</sort_order>
599
  <show_in_default>1</show_in_default>
600
  <show_in_website>1</show_in_website>
601
  <show_in_store>0</show_in_store>
602
+ <expended>1</expended>
603
+ </datafield_type>
604
+ <datafield_button translate="label" module="connector">
605
+ <label />
606
+ <button_label>Create New Data Field</button_label>
607
+ <frontend_model>email_connector/adminhtml_system_dynamic_datafieldbutton</frontend_model>
608
  <sort_order>30</sort_order>
609
  <show_in_default>1</show_in_default>
610
  <show_in_website>1</show_in_website>
611
  <show_in_store>0</show_in_store>
612
+ </datafield_button>
613
  </fields>
614
+ </dynamic_datafield>
615
  </groups>
616
+ </connector_data_mapping>
617
+ <connector_roi_tracking translate="label" module="connector">
618
  <label><![CDATA[ROI & Tracking]]></label>
619
  <tab>connector</tab>
620
  <frontend_type>text</frontend_type>
623
  <show_in_website>1</show_in_website>
624
  <show_in_store>0</show_in_store>
625
  <groups>
626
+ <page_tracking translate="label" module="connector">
627
  <label>Page Tracking</label>
628
  <frontend_type>text</frontend_type>
629
  <sort_order>10</sort_order>
632
  <show_in_store>0</show_in_store>
633
  <expanded>1</expanded>
634
  <fields>
635
+ <enabled translate="label" module="connector">
636
  <label>Enabled</label>
637
  <frontend_type>select</frontend_type>
638
  <source_model>adminhtml/system_config_source_yesno</source_model>
643
  </enabled>
644
  </fields>
645
  </page_tracking>
646
+ <roi_tracking translate="label" module="connector">
647
  <label>ROI Tracking</label>
648
  <frontend_type>text</frontend_type>
649
  <sort_order>20</sort_order>
652
  <show_in_store>0</show_in_store>
653
  <expanded>1</expanded>
654
  <fields>
655
+ <enabled translate="label" module="connector">
656
  <label>Enabled</label>
657
  <frontend_type>select</frontend_type>
658
  <source_model>adminhtml/system_config_source_yesno</source_model>
664
  </fields>
665
  </roi_tracking>
666
  </groups>
667
+ </connector_roi_tracking>
668
+ <connector_lost_baskets translate="label" module="connector">
669
  <label><![CDATA[Lost Baskets]]></label>
670
  <tab>connector</tab>
671
  <frontend_type>text</frontend_type>
672
  <sort_order>6000</sort_order>
673
  <show_in_default>1</show_in_default>
674
  <show_in_website>1</show_in_website>
675
+ <show_in_store>0</show_in_store>
676
  <groups>
677
+ <customers translate="label" module="connector">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  <label>Customers</label>
679
  <frontend_type>text</frontend_type>
680
  <sort_order>10</sort_order>
683
  <show_in_store>1</show_in_store>
684
  <expanded>1</expanded>
685
  <fields>
686
+ <heading_1 translate="label" module="connector">
687
+ <label>Lost Basket 1</label>
688
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
689
  <sort_order>10</sort_order>
690
  <show_in_default>1</show_in_default>
691
  <show_in_website>1</show_in_website>
692
  <show_in_store>1</show_in_store>
693
  </heading_1>
694
+ <enabled_1 translate="label" module="connector">
695
  <label>Enabled/Disabled</label>
696
  <frontend_type>select</frontend_type>
 
697
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
698
  <sort_order>20</sort_order>
699
  <show_in_default>1</show_in_default>
700
  <show_in_website>1</show_in_website>
701
  <show_in_store>1</show_in_store>
702
  </enabled_1>
703
+ <send_after_1 translate="label" module="connector">
704
+ <label>Send After (min)</label>
705
  <frontend_type>select</frontend_type>
706
+ <source_model>email_connector/adminhtml_source_lostbaskets_intervalminute</source_model>
707
  <sort_order>30</sort_order>
708
  <show_in_default>1</show_in_default>
709
  <show_in_website>1</show_in_website>
710
  <show_in_store>1</show_in_store>
711
  </send_after_1>
712
+ <campaign_1 translate="label" module="connector">
713
  <label>Campaign To Send</label>
714
  <frontend_type>select</frontend_type>
715
+ <source_model>email_connector/adminhtml_source_campaigns</source_model>
716
  <sort_order>40</sort_order>
717
  <show_in_default>1</show_in_default>
718
  <show_in_website>1</show_in_website>
719
  <show_in_store>1</show_in_store>
720
  </campaign_1>
721
+ <heading_2 translate="label" module="connector">
722
+ <label>Lost Basket 2</label>
723
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
724
  <sort_order>50</sort_order>
725
  <show_in_default>1</show_in_default>
726
  <show_in_website>1</show_in_website>
727
  <show_in_store>1</show_in_store>
728
  </heading_2>
729
+ <enabled_2 translate="label" module="connector">
730
  <label>Enabled/Disabled</label>
731
  <frontend_type>select</frontend_type>
 
732
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
733
  <sort_order>60</sort_order>
734
  <show_in_default>1</show_in_default>
735
  <show_in_website>1</show_in_website>
736
  <show_in_store>1</show_in_store>
737
  </enabled_2>
738
+ <send_after_2 translate="label" module="connector">
739
+ <label>Send After (hrs)</label>
740
  <frontend_type>select</frontend_type>
741
+ <source_model>email_connector/adminhtml_source_lostbaskets_interval</source_model>
742
  <sort_order>70</sort_order>
743
  <show_in_default>1</show_in_default>
744
  <show_in_website>1</show_in_website>
745
  <show_in_store>1</show_in_store>
746
  </send_after_2>
747
+ <campaign_2 translate="label" module="connector">
748
+ <label>Campaign To Send</label>
749
  <frontend_type>select</frontend_type>
750
+ <source_model>email_connector/adminhtml_source_campaigns</source_model>
751
  <sort_order>80</sort_order>
752
  <show_in_default>1</show_in_default>
753
  <show_in_website>1</show_in_website>
754
  <show_in_store>1</show_in_store>
755
  </campaign_2>
756
+ <heading_3 translate="label" module="connector">
757
+ <label>Lost Basket 3</label>
758
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
759
  <sort_order>90</sort_order>
760
  <show_in_default>1</show_in_default>
761
  <show_in_website>1</show_in_website>
762
  <show_in_store>1</show_in_store>
763
  </heading_3>
764
+ <enabled_3 translate="label" module="connector">
765
  <label>Enabled/Disabled</label>
766
  <frontend_type>select</frontend_type>
 
767
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
768
  <sort_order>100</sort_order>
769
  <show_in_default>1</show_in_default>
770
  <show_in_website>1</show_in_website>
771
  <show_in_store>1</show_in_store>
772
  </enabled_3>
773
+ <send_after_3 translate="label" module="connector">
774
+ <label>Send After (hrs)</label>
775
  <frontend_type>select</frontend_type>
776
+ <source_model>email_connector/adminhtml_source_lostbaskets_interval</source_model>
777
  <sort_order>110</sort_order>
778
  <show_in_default>1</show_in_default>
779
  <show_in_website>1</show_in_website>
780
  <show_in_store>1</show_in_store>
781
  </send_after_3>
782
+ <campaign_3 translate="label" module="connector">
783
+ <label>Campaign To Send</label>
784
  <frontend_type>select</frontend_type>
785
+ <source_model>email_connector/adminhtml_source_campaigns</source_model>
786
  <sort_order>120</sort_order>
787
  <show_in_default>1</show_in_default>
788
  <show_in_website>1</show_in_website>
790
  </campaign_3>
791
  </fields>
792
  </customers>
793
+ <guests translate="label" module="connector">
794
  <label>Guests</label>
795
  <frontend_type>text</frontend_type>
796
  <sort_order>20</sort_order>
797
  <show_in_default>1</show_in_default>
798
  <show_in_website>1</show_in_website>
799
+ <show_in_store>0</show_in_store>
800
  <fields>
801
+ <heading_1 translate="label" module="connector">
802
+ <label>Lost Basket 1</label>
803
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
804
  <sort_order>10</sort_order>
805
  <show_in_default>1</show_in_default>
806
  <show_in_website>1</show_in_website>
807
+ <show_in_store>0</show_in_store>
808
  </heading_1>
809
+ <enabled_1 translate="label" module="connector">
810
  <label>Enabled/Disabled</label>
811
  <frontend_type>select</frontend_type>
 
812
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
813
  <sort_order>20</sort_order>
814
  <show_in_default>1</show_in_default>
815
  <show_in_website>1</show_in_website>
816
+ <show_in_store>0</show_in_store>
817
  </enabled_1>
818
+ <send_after_1 translate="label" module="connector">
819
+ <label>Send After (min)</label>
820
  <frontend_type>select</frontend_type>
821
+ <source_model>email_connector/adminhtml_source_lostbaskets_intervalminute</source_model>
822
  <sort_order>30</sort_order>
823
  <show_in_default>1</show_in_default>
824
  <show_in_website>1</show_in_website>
825
+ <show_in_store>0</show_in_store>
826
  </send_after_1>
827
+ <campaign_1 translate="label" module="connector">
828
  <label>Campaign To Send</label>
829
  <frontend_type>select</frontend_type>
830
+ <source_model>email_connector/adminhtml_source_campaigns</source_model>
831
  <sort_order>40</sort_order>
832
  <show_in_default>1</show_in_default>
833
  <show_in_website>1</show_in_website>
834
+ <show_in_store>0</show_in_store>
835
  </campaign_1>
836
+ <heading_2 translate="label" module="connector">
837
+ <label>Lost Basket 2</label>
 
838
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
839
  <sort_order>50</sort_order>
840
  <show_in_default>1</show_in_default>
841
  <show_in_website>1</show_in_website>
842
+ <show_in_store>0</show_in_store>
843
  </heading_2>
844
+ <enabled_2 translate="label" module="connector">
845
  <label>Enabled/Disabled</label>
846
  <frontend_type>select</frontend_type>
 
847
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
848
  <sort_order>60</sort_order>
849
  <show_in_default>1</show_in_default>
850
  <show_in_website>1</show_in_website>
851
+ <show_in_store>0</show_in_store>
852
  </enabled_2>
853
+ <send_after_2 translate="label" module="connector">
854
+ <label>Send After (hrs)</label>
855
  <frontend_type>select</frontend_type>
856
+ <source_model>email_connector/adminhtml_source_lostbaskets_interval</source_model>
857
  <sort_order>70</sort_order>
858
  <show_in_default>1</show_in_default>
859
  <show_in_website>1</show_in_website>
860
+ <show_in_store>0</show_in_store>
861
  </send_after_2>
862
+ <campaign_2 translate="label" module="connector">
863
+ <label>Campaign To Send</label>
864
  <frontend_type>select</frontend_type>
865
+ <source_model>email_connector/adminhtml_source_campaigns</source_model>
866
  <sort_order>80</sort_order>
867
  <show_in_default>1</show_in_default>
868
  <show_in_website>1</show_in_website>
869
+ <show_in_store>0</show_in_store>
870
  </campaign_2>
871
+ <heading_3 translate="label" module="connector">
872
+ <label>Lost Basket 3</label>
 
873
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
874
  <sort_order>90</sort_order>
875
  <show_in_default>1</show_in_default>
876
  <show_in_website>1</show_in_website>
877
+ <show_in_store>0</show_in_store>
878
  </heading_3>
879
+ <enabled_3 translate="label" module="connector">
880
  <label>Enabled/Disabled</label>
881
  <frontend_type>select</frontend_type>
 
882
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
883
  <sort_order>100</sort_order>
884
  <show_in_default>1</show_in_default>
885
  <show_in_website>1</show_in_website>
886
+ <show_in_store>0</show_in_store>
887
  </enabled_3>
888
+ <send_after_3 translate="label" module="connector">
889
+ <label>Send After (hrs)</label>
890
  <frontend_type>select</frontend_type>
891
+ <source_model>email_connector/adminhtml_source_lostbaskets_interval</source_model>
892
  <sort_order>110</sort_order>
893
  <show_in_default>1</show_in_default>
894
  <show_in_website>1</show_in_website>
895
+ <show_in_store>0</show_in_store>
896
  </send_after_3>
897
+ <campaign_3 translate="label" module="connector">
898
+ <label>Campaign To Send</label>
899
  <frontend_type>select</frontend_type>
900
+ <source_model>email_connector/adminhtml_source_campaigns</source_model>
901
  <sort_order>120</sort_order>
902
  <show_in_default>1</show_in_default>
903
  <show_in_website>1</show_in_website>
904
+ <show_in_store>0</show_in_store>
905
  </campaign_3>
906
  </fields>
907
  </guests>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
908
  </groups>
909
+ </connector_lost_baskets>
910
+ <connector_sms translate="label" module="connector">
911
  <label><![CDATA[SMS]]></label>
912
  <tab>connector</tab>
913
  <frontend_type>text</frontend_type>
916
  <show_in_website>1</show_in_website>
917
  <show_in_store>1</show_in_store>
918
  <groups>
919
+ <sms_one translate="label" module="connector">
920
  <label>SMS Message 1</label>
921
  <frontend_type>text</frontend_type>
922
  <sort_order>10</sort_order>
924
  <show_in_website>1</show_in_website>
925
  <show_in_store>1</show_in_store>
926
  <fields>
927
+ <enabled translate="label" module="connector">
928
  <label>Enabled</label>
929
  <frontend_type>select</frontend_type>
930
  <source_model>adminhtml/system_config_source_yesno</source_model>
933
  <show_in_website>1</show_in_website>
934
  <show_in_store>1</show_in_store>
935
  </enabled>
936
+ <status translate="label" module="connector">
937
  <label>Order Status</label>
938
  <sort_order>20</sort_order>
939
  <frontend_type>select</frontend_type>
940
+ <source_model>adminhtml/system_config_source_order_status</source_model>
941
  <show_in_default>1</show_in_default>
942
  <show_in_website>1</show_in_website>
943
  <show_in_store>1</show_in_store>
944
+ </status>
945
+ <message translate="label" module="connector">
946
  <label>Message</label>
947
  <frontend_type>textarea</frontend_type>
948
+ <frontend_model>email_connector/adminhtml_system_sms_smsmessageone</frontend_model>
949
  <sort_order>30</sort_order>
950
  <show_in_default>1</show_in_default>
951
  <show_in_website>1</show_in_website>
952
  <show_in_store>1</show_in_store>
953
+ <validate>validate-length maximum-length-160</validate>
954
  </message>
955
  </fields>
956
+ </sms_one>
957
+ <sms_two translate="label" module="connector">
 
958
  <label>SMS Message 2</label>
959
  <frontend_type>text</frontend_type>
960
  <sort_order>20</sort_order>
962
  <show_in_website>1</show_in_website>
963
  <show_in_store>1</show_in_store>
964
  <fields>
965
+ <enabled translate="label" module="connector">
966
  <label>Enabled</label>
967
  <frontend_type>select</frontend_type>
968
  <source_model>adminhtml/system_config_source_yesno</source_model>
971
  <show_in_website>1</show_in_website>
972
  <show_in_store>1</show_in_store>
973
  </enabled>
974
+ <status translate="label" module="connector">
975
  <label>Order Status</label>
976
  <sort_order>20</sort_order>
977
  <frontend_type>select</frontend_type>
978
+ <source_model>adminhtml/system_config_source_order_status</source_model>
979
  <show_in_default>1</show_in_default>
980
  <show_in_website>1</show_in_website>
981
  <show_in_store>1</show_in_store>
982
+ </status>
983
+ <message translate="label" module="connector">
984
  <label>Message</label>
985
  <frontend_type>textarea</frontend_type>
986
+ <frontend_model>email_connector/adminhtml_system_sms_smsmessagetwo</frontend_model>
987
  <sort_order>30</sort_order>
988
  <show_in_default>1</show_in_default>
989
  <show_in_website>1</show_in_website>
990
  <show_in_store>1</show_in_store>
991
+ <validate>validate-length maximum-length-160</validate>
992
  </message>
993
  </fields>
994
+ </sms_two>
995
+ <sms_three translate="label" module="connector">
 
996
  <label>SMS Message 3</label>
997
  <frontend_type>text</frontend_type>
998
  <sort_order>30</sort_order>
1000
  <show_in_website>1</show_in_website>
1001
  <show_in_store>1</show_in_store>
1002
  <fields>
1003
+ <enabled translate="label" module="connector">
1004
  <label>Enabled</label>
1005
  <frontend_type>select</frontend_type>
1006
  <source_model>adminhtml/system_config_source_yesno</source_model>
1009
  <show_in_website>1</show_in_website>
1010
  <show_in_store>1</show_in_store>
1011
  </enabled>
1012
+ <status translate="label" module="connector">
1013
  <label>Order Status</label>
1014
  <sort_order>20</sort_order>
1015
  <frontend_type>select</frontend_type>
1016
+ <source_model>adminhtml/system_config_source_order_status</source_model>
1017
  <show_in_default>1</show_in_default>
1018
  <show_in_website>1</show_in_website>
1019
  <show_in_store>1</show_in_store>
1020
+ </status>
1021
+ <message translate="label" module="connector">
1022
  <label>Message</label>
1023
  <frontend_type>textarea</frontend_type>
1024
+ <frontend_model>email_connector/adminhtml_system_sms_smsmessagethree</frontend_model>
1025
  <sort_order>30</sort_order>
1026
  <show_in_default>1</show_in_default>
1027
  <show_in_website>1</show_in_website>
1028
  <show_in_store>1</show_in_store>
1029
+ <validate>validate-length maximum-length-160</validate>
1030
  </message>
1031
  </fields>
1032
+ </sms_three>
1033
+ <sms_four translate="label" module="connector">
1034
  <label>SMS Message 4</label>
1035
  <frontend_type>text</frontend_type>
1036
  <sort_order>40</sort_order>
1038
  <show_in_website>1</show_in_website>
1039
  <show_in_store>1</show_in_store>
1040
  <fields>
1041
+ <enabled translate="label" module="connector">
1042
  <label>Enabled</label>
1043
  <frontend_type>select</frontend_type>
1044
  <source_model>adminhtml/system_config_source_yesno</source_model>
1047
  <show_in_website>1</show_in_website>
1048
  <show_in_store>1</show_in_store>
1049
  </enabled>
1050
+ <status translate="label" module="connector">
1051
  <label>Order Status</label>
1052
  <sort_order>20</sort_order>
1053
  <frontend_type>select</frontend_type>
1054
+ <source_model>adminhtml/system_config_source_order_status</source_model>
1055
  <show_in_default>1</show_in_default>
1056
  <show_in_website>1</show_in_website>
1057
  <show_in_store>1</show_in_store>
1058
+ </status>
1059
+ <message translate="label" module="connector">
1060
  <label>Message</label>
1061
  <frontend_type>textarea</frontend_type>
1062
+ <frontend_model>email_connector/adminhtml_system_sms_smsmessagefour</frontend_model>
1063
  <sort_order>30</sort_order>
1064
  <show_in_default>1</show_in_default>
1065
  <show_in_website>1</show_in_website>
1066
  <show_in_store>1</show_in_store>
1067
+ <validate>validate-length maximum-length-160</validate>
1068
  </message>
1069
  </fields>
1070
+ </sms_four>
 
1071
  </groups>
1072
+ </connector_sms>
1073
+ <connector_dynamic_content translate="label" module="connector">
1074
  <label><![CDATA[Dynamic Content]]></label>
1075
  <tab>connector</tab>
1076
  <frontend_type>text</frontend_type>
1079
  <show_in_website>1</show_in_website>
1080
  <show_in_store>0</show_in_store>
1081
  <groups>
1082
+ <products translate="label" module="connector">
1083
  <label>Dynamic Products</label>
1084
  <frontend_type>text</frontend_type>
1085
+ <sort_order>20</sort_order>
1086
  <show_in_default>1</show_in_default>
1087
  <show_in_website>1</show_in_website>
1088
  <show_in_store>0</show_in_store>
 
1089
  <fields>
1090
+ <related translate="label" module="connector">
1091
  <label>Related Products</label>
1092
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1093
  <sort_order>10</sort_order>
1095
  <show_in_website>1</show_in_website>
1096
  <show_in_store>0</show_in_store>
1097
  </related>
1098
+ <related_display_type translate="label" module="connector">
1099
  <label>Display Type</label>
1100
  <frontend_type>select</frontend_type>
1101
+ <source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
1102
  <sort_order>20</sort_order>
1103
  <show_in_default>1</show_in_default>
1104
  <show_in_website>1</show_in_website>
1105
  <show_in_store>0</show_in_store>
1106
  </related_display_type>
1107
+ <related_items_to_display translate="label" module="connector">
1108
  <label>Items To Display</label>
1109
  <frontend_type>select</frontend_type>
1110
+ <source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
1111
  <sort_order>30</sort_order>
1112
  <show_in_website>1</show_in_website>
1113
  <show_in_default>1</show_in_default>
1114
  <show_in_store>0</show_in_store>
1115
  </related_items_to_display>
1116
+ <upsell translate="label" module="connector">
 
1117
  <label>Up Sell Products</label>
1118
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1119
  <sort_order>40</sort_order>
1121
  <show_in_website>1</show_in_website>
1122
  <show_in_store>0</show_in_store>
1123
  </upsell>
1124
+ <upsell_display_type translate="label" module="connector">
1125
  <label>Display Type</label>
1126
  <frontend_type>select</frontend_type>
1127
+ <source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
1128
  <sort_order>50</sort_order>
1129
  <show_in_default>1</show_in_default>
1130
  <show_in_website>1</show_in_website>
1131
  <show_in_store>0</show_in_store>
1132
  </upsell_display_type>
1133
+ <upsell_items_to_display translate="label" module="connector">
1134
  <label>Items To Display</label>
1135
  <frontend_type>select</frontend_type>
1136
+ <source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
1137
  <sort_order>60</sort_order>
1138
  <show_in_website>1</show_in_website>
1139
  <show_in_default>1</show_in_default>
1140
  <show_in_store>0</show_in_store>
1141
  </upsell_items_to_display>
1142
+ <crosssell translate="label" module="connector">
 
1143
  <label>Cross Sell Products</label>
1144
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1145
  <sort_order>70</sort_order>
1147
  <show_in_website>1</show_in_website>
1148
  <show_in_store>0</show_in_store>
1149
  </crosssell>
1150
+ <crosssell_display_type translate="label" module="connector">
1151
  <label>Display Type</label>
1152
  <frontend_type>select</frontend_type>
1153
+ <source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
1154
  <sort_order>80</sort_order>
1155
  <show_in_default>1</show_in_default>
1156
  <show_in_website>1</show_in_website>
1157
  <show_in_store>0</show_in_store>
1158
  </crosssell_display_type>
1159
+ <crosssell_items_to_display translate="label" module="connector">
1160
  <label>Items To Display</label>
1161
  <frontend_type>select</frontend_type>
1162
+ <source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
1163
  <sort_order>90</sort_order>
1164
  <show_in_website>1</show_in_website>
1165
  <show_in_default>1</show_in_default>
1166
  <show_in_store>0</show_in_store>
1167
  </crosssell_items_to_display>
1168
+ <bestsellers translate="label" module="connector">
 
1169
  <label>Best Sellers</label>
1170
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1171
  <sort_order>100</sort_order>
1172
  <show_in_default>1</show_in_default>
1173
  <show_in_website>1</show_in_website>
1174
  <show_in_store>0</show_in_store>
1175
+ </bestsellers>
1176
+ <bestsellers_display_type translate="label" module="connector">
1177
  <label>Display Type</label>
1178
  <frontend_type>select</frontend_type>
1179
+ <source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
1180
  <sort_order>110</sort_order>
1181
  <show_in_default>1</show_in_default>
1182
  <show_in_website>1</show_in_website>
1183
  <show_in_store>0</show_in_store>
1184
+ </bestsellers_display_type>
1185
+ <bestsellers_items_to_display translate="label" module="connector">
1186
  <label>Items To Display</label>
1187
  <frontend_type>select</frontend_type>
1188
+ <source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
1189
  <sort_order>120</sort_order>
1190
  <show_in_website>1</show_in_website>
1191
  <show_in_default>1</show_in_default>
1192
  <show_in_store>0</show_in_store>
1193
+ </bestsellers_items_to_display>
1194
+ <bestsellers_time_period translate="label" module="connector">
1195
  <label>Time Period</label>
1196
  <frontend_type>select</frontend_type>
1197
+ <source_model>adminhtml/system_config_source_cron_frequency</source_model>
1198
  <sort_order>130</sort_order>
1199
  <show_in_default>1</show_in_default>
1200
  <show_in_website>1</show_in_website>
1201
  <show_in_store>0</show_in_store>
1202
+ </bestsellers_time_period>
1203
+ <most_viewed translate="label" module="connector">
 
1204
  <label>Most Viewed</label>
1205
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1206
  <sort_order>140</sort_order>
1208
  <show_in_website>1</show_in_website>
1209
  <show_in_store>0</show_in_store>
1210
  </most_viewed>
1211
+ <most_viewed_display_type translate="label" module="connector">
1212
  <label>Display Type</label>
1213
  <frontend_type>select</frontend_type>
1214
+ <source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
1215
  <sort_order>150</sort_order>
1216
  <show_in_default>1</show_in_default>
1217
  <show_in_website>1</show_in_website>
1218
  <show_in_store>0</show_in_store>
1219
  </most_viewed_display_type>
1220
+ <most_viewed_items_to_display translate="label" module="connector">
1221
  <label>Items To Display</label>
1222
  <frontend_type>select</frontend_type>
1223
+ <source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
1224
  <sort_order>160</sort_order>
1225
  <show_in_website>1</show_in_website>
1226
  <show_in_default>1</show_in_default>
1227
  <show_in_store>0</show_in_store>
1228
  </most_viewed_items_to_display>
1229
+ <most_viewed_time_period translate="label" module="connector">
1230
  <label>Time Period</label>
1231
  <frontend_type>select</frontend_type>
1232
+ <source_model>adminhtml/system_config_source_cron_frequency</source_model>
1233
  <sort_order>170</sort_order>
1234
  <show_in_default>1</show_in_default>
1235
  <show_in_website>1</show_in_website>
1236
  <show_in_store>0</show_in_store>
1237
  </most_viewed_time_period>
1238
+ <recently_viewed translate="label" module="connector">
 
1239
  <label>Recently Viewed</label>
1240
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1241
  <sort_order>180</sort_order>
1243
  <show_in_website>1</show_in_website>
1244
  <show_in_store>0</show_in_store>
1245
  </recently_viewed>
1246
+ <recently_viewed_display_type translate="label" module="connector">
1247
  <label>Display Type</label>
1248
  <frontend_type>select</frontend_type>
1249
+ <source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
1250
  <sort_order>190</sort_order>
1251
  <show_in_default>1</show_in_default>
1252
  <show_in_website>1</show_in_website>
1253
  <show_in_store>0</show_in_store>
1254
  </recently_viewed_display_type>
1255
+ <recently_viewed_items_to_display translate="label" module="connector">
1256
  <label>items To Display</label>
1257
  <frontend_type>select</frontend_type>
1258
+ <source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
1259
  <sort_order>200</sort_order>
1260
  <show_in_default>1</show_in_default>
1261
  <show_in_website>1</show_in_website>
1262
  <show_in_store>0</show_in_store>
1263
  </recently_viewed_items_to_display>
 
1264
  <validator>
 
1265
  <frontend_type>hidden</frontend_type>
1266
+ <frontend_model>email_connector/adminhtml_system_dynamic_gridlist</frontend_model>
1267
  <sort_order>210</sort_order>
1268
  <show_in_default>1</show_in_default>
1269
  <show_in_website>1</show_in_website>
1271
  <can_be_empty>1</can_be_empty>
1272
  </validator>
1273
  </fields>
 
1274
  </products>
1275
+ <external_dynamic_content_urls translate="label" module="connector">
1276
+ <label><![CDATA[External Dynamic Content URL's]]></label>
1277
  <frontend_type>text</frontend_type>
1278
+ <sort_order>10</sort_order>
1279
  <show_in_default>1</show_in_default>
1280
  <show_in_website>1</show_in_website>
1281
  <show_in_store>0</show_in_store>
 
1282
  <fields>
1283
+ <passcode translate="label comment" module="connector">
1284
+ <label>Passcode</label>
1285
+ <frontend_type>text</frontend_type>
1286
  <sort_order>10</sort_order>
1287
  <show_in_default>1</show_in_default>
1288
  <show_in_website>1</show_in_website>
1289
  <show_in_store>0</show_in_store>
1290
+ <comment><![CDATA[Recommended: Set a passcode so that basket contents and coupon codes can only be viewed if the following passcode is sent with the request.]]></comment>
1291
+ </passcode>
1292
+ <lost_basket_title translate="label" module="connector">
1293
+ <label>Lost Baskets</label>
1294
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1295
+ <sort_order>20</sort_order>
1296
+ <show_in_default>1</show_in_default>
1297
+ <show_in_website>1</show_in_website>
1298
+ <show_in_store>0</show_in_store>
1299
+ </lost_basket_title>
1300
+ <lost_basket_url translate="label" module="connector">
1301
+ <label>Baskets Content URL</label>
1302
+ <frontend_type>label</frontend_type>
1303
+ <frontend_model>email_connector/adminhtml_system_dynamic_lostbasket</frontend_model>
1304
+ <sort_order>30</sort_order>
1305
+ <show_in_default>1</show_in_default>
1306
+ <show_in_website>1</show_in_website>
1307
+ <show_in_store>0</show_in_store>
1308
+ </lost_basket_url>
1309
+ <coupon_code_title title="label" module="connector">
1310
+ <label>Coupon Codes</label>
1311
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1312
+ <sort_order>40</sort_order>
1313
+ <show_in_website>1</show_in_website>
1314
+ <show_in_default>1</show_in_default>
1315
+ <show_in_store>0</show_in_store>
1316
+ </coupon_code_title>
1317
+ <coupon_code_url translate="label" module="connector">
1318
+ <label>Coupon Codes URL</label>
1319
+ <frontend_type>label</frontend_type>
1320
+ <frontend_model>email_connector/adminhtml_system_dynamic_couponinfo</frontend_model>
1321
  <sort_order>50</sort_order>
1322
  <show_in_default>1</show_in_default>
1323
  <show_in_website>1</show_in_website>
1324
  <show_in_store>0</show_in_store>
1325
+ </coupon_code_url>
1326
+ <dynamic_content_url translate="label" module="connector">
1327
+ <label>Product Recommendation</label>
1328
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
 
1329
  <sort_order>60</sort_order>
1330
+ <show_in_default>1</show_in_default>
1331
  <show_in_website>1</show_in_website>
1332
+ <show_in_store>0</show_in_store>
1333
+ </dynamic_content_url>
1334
+ <related_products_url translate="label" module="connector">
1335
+ <label>Related Products URL</label>
1336
+ <frontend_type>label</frontend_type>
1337
+ <frontend_model>email_connector/adminhtml_system_dynamic_related</frontend_model>
1338
+ <sort_order>70</sort_order>
1339
  <show_in_default>1</show_in_default>
1340
+ <show_in_website>1</show_in_website>
1341
  <show_in_store>0</show_in_store>
1342
+ </related_products_url>
1343
+ <upsell_products_url translate="label" module="connector">
1344
+ <label>Up-Sell Products URL</label>
1345
+ <frontend_type>label</frontend_type>
1346
+ <frontend_model>email_connector/adminhtml_system_dynamic_upsell</frontend_model>
1347
  <sort_order>80</sort_order>
1348
  <show_in_default>1</show_in_default>
1349
  <show_in_website>1</show_in_website>
1350
  <show_in_store>0</show_in_store>
1351
+ </upsell_products_url>
1352
+ <crosssell_products_url translate="label" module="connector">
1353
+ <label>Cross-Sell Products URL</label>
1354
+ <frontend_type>label</frontend_type>
1355
+ <frontend_model>email_connector/adminhtml_system_dynamic_crosssell</frontend_model>
1356
+ <sort_order>90</sort_order>
1357
+ <show_in_default>1</show_in_default>
1358
+ <show_in_website>1</show_in_website>
1359
+ <show_in_store>0</show_in_store>
1360
+ </crosssell_products_url>
1361
+ <best_sellers_url translate="label" module="connector">
1362
+ <label>Best Sellers URL</label>
1363
+ <frontend_type>label</frontend_type>
1364
+ <frontend_model>email_connector/adminhtml_system_dynamic_bestsellers</frontend_model>
1365
+ <sort_order>100</sort_order>
1366
+ <show_in_default>1</show_in_default>
1367
+ <show_in_website>1</show_in_website>
1368
+ <show_in_store>0</show_in_store>
1369
+ </best_sellers_url>
1370
+ <most_viewed_url translate="label" module="connector">
1371
+ <label>Most Viewed URL</label>
1372
+ <frontend_type>label</frontend_type>
1373
+ <frontend_model>email_connector/adminhtml_system_dynamic_mostviewed</frontend_model>
1374
+ <sort_order>110</sort_order>
1375
+ <show_in_default>1</show_in_default>
1376
+ <show_in_website>1</show_in_website>
1377
+ <show_in_store>0</show_in_store>
1378
+ </most_viewed_url>
1379
+ <product_push_url translate="label" module="connector">
1380
+ <label>Product Push URL</label>
1381
+ <frontend_type>label</frontend_type>
1382
+ <frontend_model>email_connector/adminhtml_system_dynamic_productpush</frontend_model>
1383
+ <sort_order>130</sort_order>
1384
+ <show_in_default>1</show_in_default>
1385
+ <show_in_website>1</show_in_website>
1386
+ <show_in_store>0</show_in_store>
1387
+ </product_push_url>
1388
+ <recently_viewed_url translate="label" module="connector">
1389
+ <label>Recently Viewed</label>
1390
+ <frontend_type>label</frontend_type>
1391
+ <frontend_model>email_connector/adminhtml_system_dynamic_recentlyviewed</frontend_model>
1392
+ <sort_order>120</sort_order>
1393
+ <show_in_default>1</show_in_default>
1394
+ <show_in_website>1</show_in_website>
1395
+ <show_in_store>0</show_in_store>
1396
+ </recently_viewed_url>
1397
+ <transactional_email_heading translate="label" module="connector">
1398
+ <label>Transactional Emails</label>
1399
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1400
+ <sort_order>140</sort_order>
1401
+ <show_in_default>1</show_in_default>
1402
+ <show_in_website>1</show_in_website>
1403
+ <show_in_store>0</show_in_store>
1404
+ </transactional_email_heading>
1405
+ <new_order_url translate="label" module="connector">
1406
+ <label>New Order</label>
1407
+ <frontend_type>label</frontend_type>
1408
+ <frontend_model>email_connector/adminhtml_system_url_neworder</frontend_model>
1409
+ <sort_order>150</sort_order>
1410
+ <show_in_default>1</show_in_default>
1411
+ <show_in_website>1</show_in_website>
1412
+ <show_in_store>0</show_in_store>
1413
+ </new_order_url>
1414
+ <new_order_guest_url translate="label" module="connector">
1415
+ <label>New Order for Guest</label>
1416
+ <frontend_type>label</frontend_type>
1417
+ <frontend_model>email_connector/adminhtml_system_url_neworderguest</frontend_model>
1418
+ <sort_order>160</sort_order>
1419
+ <show_in_default>1</show_in_default>
1420
+ <show_in_website>1</show_in_website>
1421
+ <show_in_store>0</show_in_store>
1422
+ </new_order_guest_url>
1423
+ <order_update_url translate="label" module="connector">
1424
+ <label>Order Update</label>
1425
+ <frontend_type>label</frontend_type>
1426
+ <frontend_model>email_connector/adminhtml_system_url_orderupdate</frontend_model>
1427
+ <sort_order>170</sort_order>
1428
+ <show_in_default>1</show_in_default>
1429
+ <show_in_website>1</show_in_website>
1430
+ <show_in_store>0</show_in_store>
1431
+ </order_update_url>
1432
+ <order_update_guest_url translate="label" module="connector">
1433
+ <label>Order Update for Guest</label>
1434
+ <frontend_type>label</frontend_type>
1435
+ <frontend_model>email_connector/adminhtml_system_url_orderupdateguest</frontend_model>
1436
+ <sort_order>180</sort_order>
1437
+ <show_in_default>1</show_in_default>
1438
+ <show_in_website>1</show_in_website>
1439
+ <show_in_store>0</show_in_store>
1440
+ </order_update_guest_url>
1441
+ <new_invoice_url translate="label" module="connector">
1442
+ <label>New Invoice</label>
1443
+ <frontend_type>label</frontend_type>
1444
+ <frontend_model>email_connector/adminhtml_system_url_newinvoice</frontend_model>
1445
+ <sort_order>190</sort_order>
1446
+ <show_in_default>1</show_in_default>
1447
+ <show_in_website>1</show_in_website>
1448
+ <show_in_store>0</show_in_store>
1449
+ </new_invoice_url>
1450
+ <new_invoice_guest_url translate="label" module="connector">
1451
+ <label>New Invoice for Guest</label>
1452
+ <frontend_type>label</frontend_type>
1453
+ <frontend_model>email_connector/adminhtml_system_url_newinvoiceguest</frontend_model>
1454
+ <sort_order>200</sort_order>
1455
+ <show_in_default>1</show_in_default>
1456
+ <show_in_website>1</show_in_website>
1457
+ <show_in_store>0</show_in_store>
1458
+ </new_invoice_guest_url>
1459
+ <invoice_update_url translate="label" module="connector">
1460
+ <label>Invoice Update</label>
1461
+ <frontend_type>label</frontend_type>
1462
+ <frontend_model>email_connector/adminhtml_system_url_invoiceupdate</frontend_model>
1463
+ <sort_order>210</sort_order>
1464
+ <show_in_default>1</show_in_default>
1465
+ <show_in_website>1</show_in_website>
1466
+ <show_in_store>0</show_in_store>
1467
+ </invoice_update_url>
1468
+ <invoice_update_guest_url translate="label" module="connector">
1469
+ <label>Invoice Update for Guest</label>
1470
+ <frontend_type>label</frontend_type>
1471
+ <frontend_model>email_connector/adminhtml_system_url_invoiceupdateguest</frontend_model>
1472
+ <sort_order>220</sort_order>
1473
+ <show_in_default>1</show_in_default>
1474
+ <show_in_website>1</show_in_website>
1475
+ <show_in_store>0</show_in_store>
1476
+ </invoice_update_guest_url>
1477
+ <new_creditmemo_url translate="label" module="connector">
1478
+ <label>New Credit Memo</label>
1479
+ <frontend_type>label</frontend_type>
1480
+ <frontend_model>email_connector/adminhtml_system_url_newcreditmemo</frontend_model>
1481
+ <sort_order>230</sort_order>
1482
+ <show_in_default>1</show_in_default>
1483
+ <show_in_website>1</show_in_website>
1484
+ <show_in_store>0</show_in_store>
1485
+ </new_creditmemo_url>
1486
+ <new_creditmemo_guest_url translate="label" module="connector">
1487
+ <label>New Credit Memo Guest</label>
1488
+ <frontend_type>label</frontend_type>
1489
+ <frontend_model>email_connector/adminhtml_system_url_newcreditmemoguest</frontend_model>
1490
+ <sort_order>240</sort_order>
1491
+ <show_in_default>1</show_in_default>
1492
+ <show_in_website>1</show_in_website>
1493
+ <show_in_store>0</show_in_store>
1494
+ </new_creditmemo_guest_url>
1495
+ <creditmemo_update_url translate="label" module="connector">
1496
+ <label>Credit Memo Update</label>
1497
+ <frontend_type>label</frontend_type>
1498
+ <frontend_model>email_connector/adminhtml_system_url_creditmemoupdate</frontend_model>
1499
+ <sort_order>250</sort_order>
1500
+ <show_in_default>1</show_in_default>
1501
+ <show_in_website>1</show_in_website>
1502
+ <show_in_store>0</show_in_store>
1503
+ </creditmemo_update_url>
1504
+ <creditmemo_update_guest_url translate="label" module="connector">
1505
+ <label>Credit Memo Update for Guest</label>
1506
+ <frontend_type>label</frontend_type>
1507
+ <frontend_model>email_connector/adminhtml_system_url_creditmemoupdateguest</frontend_model>
1508
+ <sort_order>260</sort_order>
1509
+ <show_in_default>1</show_in_default>
1510
+ <show_in_website>1</show_in_website>
1511
+ <show_in_store>0</show_in_store>
1512
+ </creditmemo_update_guest_url>
1513
+ <new_shipment_url translate="label" module="connector">
1514
+ <label>New Shipment</label>
1515
+ <frontend_type>label</frontend_type>
1516
+ <frontend_model>email_connector/adminhtml_system_url_newshipment</frontend_model>
1517
+ <sort_order>270</sort_order>
1518
+ <show_in_default>1</show_in_default>
1519
+ <show_in_website>1</show_in_website>
1520
+ <show_in_store>0</show_in_store>
1521
+ </new_shipment_url>
1522
+ <new_shipment_guest_url translate="label" module="connector">
1523
+ <label>New Shipment for Guest</label>
1524
+ <frontend_type>label</frontend_type>
1525
+ <frontend_model>email_connector/adminhtml_system_url_newshipmentguest</frontend_model>
1526
+ <sort_order>280</sort_order>
1527
+ <show_in_default>1</show_in_default>
1528
+ <show_in_website>1</show_in_website>
1529
+ <show_in_store>0</show_in_store>
1530
+ </new_shipment_guest_url>
1531
+ <shipment_update_url translate="label" module="connector">
1532
+ <label>Shipment Update</label>
1533
+ <frontend_type>label</frontend_type>
1534
+ <frontend_model>email_connector/adminhtml_system_url_shipmentupdate</frontend_model>
1535
+ <sort_order>290</sort_order>
1536
+ <show_in_default>1</show_in_default>
1537
+ <show_in_website>1</show_in_website>
1538
+ <show_in_store>0</show_in_store>
1539
+ </shipment_update_url>
1540
+ <shipment_update_guest_url translate="label" module="connector">
1541
+ <label>Shipment Update for Guest</label>
1542
+ <frontend_type>label</frontend_type>
1543
+ <frontend_model>email_connector/adminhtml_system_url_shipmentupdateguest</frontend_model>
1544
+ <sort_order>300</sort_order>
1545
+ <show_in_default>1</show_in_default>
1546
+ <show_in_website>1</show_in_website>
1547
+ <show_in_store>0</show_in_store>
1548
+ </shipment_update_guest_url>
1549
+ </fields>
1550
+ </external_dynamic_content_urls>
1551
+ <manual_product_search translate="label" module="connector">
1552
+ <label>Manual Product Push</label>
1553
+ <frontend_type>text</frontend_type>
1554
+ <sort_order>30</sort_order>
1555
+ <show_in_default>1</show_in_default>
1556
+ <show_in_website>1</show_in_website>
1557
+ <show_in_store>0</show_in_store>
1558
+ <expanded>1</expanded>
1559
+ <fields>
1560
+ <settings_title tranlate="label" module="connector">
1561
+ <label>Settings</label>
1562
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1563
+ <sort_order>10</sort_order>
1564
+ <show_in_default>1</show_in_default>
1565
+ <show_in_website>1</show_in_website>
1566
+ <show_in_store>0</show_in_store>
1567
+ </settings_title>
1568
+ <display_type translate="label" module="connector">
1569
+ <label>Display Type</label>
1570
+ <frontend_type>select</frontend_type>
1571
+ <source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
1572
+ <sort_order>50</sort_order>
1573
+ <show_in_default>1</show_in_default>
1574
+ <show_in_website>1</show_in_website>
1575
+ <show_in_store>0</show_in_store>
1576
+ </display_type>
1577
+ <items_to_display translate="label" module="connector">
1578
+ <label>Items To Display</label>
1579
+ <frontend_type>select</frontend_type>
1580
+ <source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
1581
+ <sort_order>60</sort_order>
1582
+ <show_in_website>1</show_in_website>
1583
+ <show_in_default>1</show_in_default>
1584
+ <show_in_store>0</show_in_store>
1585
+ </items_to_display>
1586
+ <products_push_title translate="label" module="connector">
1587
+ <label>Products</label>
1588
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1589
+ <sort_order>80</sort_order>
1590
+ <show_in_default>1</show_in_default>
1591
+ <show_in_website>1</show_in_website>
1592
+ <show_in_store>0</show_in_store>
1593
+ </products_push_title>
1594
+ <products_push_items translate="label comment" module="connector">
1595
+ <label>Products</label>
1596
+ <frontend_type>text</frontend_type>
1597
  <sort_order>90</sort_order>
1598
  <show_in_default>1</show_in_default>
1599
  <show_in_website>1</show_in_website>
1602
  </products_push_items>
1603
  </fields>
1604
  </manual_product_search>
1605
+ <fallback_products translate="label" module="connector">
1606
  <label>Fallback Products</label>
1607
  <frontend_type>text</frontend_type>
1608
+ <sort_order>40</sort_order>
1609
  <show_in_default>1</show_in_default>
1610
  <show_in_website>1</show_in_website>
1611
  <show_in_store>0</show_in_store>
1612
  <fields>
1613
+ <product_list translate="label comment" module="connector">
1614
  <label>Products</label>
1615
  <frontend_type>text</frontend_type>
1616
  <sort_order>10</sort_order>
1622
  </fields>
1623
  </fallback_products>
1624
  </groups>
1625
+ </connector_dynamic_content>
1626
+ <connector_transactional_emails translate="label" module="connector">
1627
+ <label>Transactional Emails</label>
1628
  <tab>connector</tab>
1629
  <frontend_type>text</frontend_type>
 
1630
  <show_in_default>1</show_in_default>
1631
  <show_in_website>1</show_in_website>
1632
+ <show_in_store>0</show_in_store>
1633
+ <sort_order>9000</sort_order>
1634
  <groups>
1635
+ <credentials translate="label" module="connector">
1636
+ <label>API</label>
1637
  <frontend_type>text</frontend_type>
1638
+ <sort_order>100</sort_order>
1639
  <show_in_default>1</show_in_default>
1640
  <show_in_website>1</show_in_website>
1641
  <show_in_store>0</show_in_store>
1642
+ <expanded>1</expanded>
1643
  <fields>
1644
+ <enabled translate="label" module="connector">
1645
+ <label>Enabled</label>
1646
  <frontend_type>select</frontend_type>
1647
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1648
+ <sort_order>10</sort_order>
1649
+ <show_in_default>1</show_in_default>
1650
+ <show_in_website>1</show_in_website>
1651
+ <show_in_store>0</show_in_store>
1652
+ </enabled>
1653
+ <api_username translate="label" module="connector">
1654
+ <label>API Username</label>
1655
+ <frontend_type>text</frontend_type>
1656
+ <frontend_model>email_connector/adminhtml_system_config_wrapper</frontend_model>
1657
+ <sort_order>10</sort_order>
1658
+ <show_in_default>1</show_in_default>
1659
+ <show_in_website>1</show_in_website>
1660
+ <show_in_store>0</show_in_store>
1661
+ <depends>
1662
+ <enabled>1</enabled>
1663
+ </depends>
1664
+ </api_username>
1665
+ <api_password translate="label" module="connector">
1666
+ <label>API Password</label>
1667
+ <frontend_type>password</frontend_type>
1668
+ <frontend_model>email_connector/adminhtml_system_emailapivalidate</frontend_model>
1669
+ <sort_order>20</sort_order>
1670
+ <show_in_default>1</show_in_default>
1671
+ <show_in_website>1</show_in_website>
1672
+ <show_in_store>0</show_in_store>
1673
+ <depends>
1674
+ <enabled>1</enabled>
1675
+ </depends>
1676
+ </api_password>
1677
+ <validator>
1678
+ <frontend_type>hidden</frontend_type>
1679
+ <frontend_model>email_connector/adminhtml_system_config_waitingfield</frontend_model>
1680
  <sort_order>40</sort_order>
1681
  <show_in_default>1</show_in_default>
1682
  <show_in_website>1</show_in_website>
1683
  <show_in_store>0</show_in_store>
1684
+ <can_be_empty>1</can_be_empty>
1685
+ </validator>
1686
  </fields>
1687
+ </credentials>
1688
+ <email_mapping translate="label" module="connector">
1689
+ <label>Email Mapping</label>
1690
  <frontend_type>text</frontend_type>
1691
+ <sort_order>200</sort_order>
1692
  <show_in_default>1</show_in_default>
1693
  <show_in_website>1</show_in_website>
1694
+ <show_in_store>1</show_in_store>
1695
+ <expanded>1</expanded>
1696
  <fields>
1697
+ <!--DO NOT CHANGE THE NAMING AS THIS ARE EVENT TRIGGERED-->
1698
+ <order_title translate="label" module="connector">
1699
+ <label>Order</label>
1700
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1701
  <sort_order>10</sort_order>
1702
  <show_in_default>1</show_in_default>
1703
  <show_in_website>1</show_in_website>
1704
  <show_in_store>0</show_in_store>
1705
+ </order_title>
1706
+ <sales_email_order_template translate="label" module="connector">
1707
+ <label>New Order</label>
 
 
1708
  <sort_order>20</sort_order>
1709
+ <frontend_type>select</frontend_type>
1710
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1711
  <show_in_default>1</show_in_default>
1712
  <show_in_website>1</show_in_website>
1713
  <show_in_store>0</show_in_store>
1714
+ </sales_email_order_template>
1715
+ <sales_email_order_guest_template translate="label" model="connector">
1716
+ <label>New Order for Guest</label>
 
 
 
1717
  <sort_order>30</sort_order>
1718
+ <frontend_type>select</frontend_type>
1719
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1720
  <show_in_default>1</show_in_default>
1721
  <show_in_website>1</show_in_website>
1722
  <show_in_store>0</show_in_store>
1723
+ </sales_email_order_guest_template>
1724
+ <sales_email_order_comment_template translate="label" model="connector">
1725
+ <label>Order Update</label>
 
1726
  <sort_order>40</sort_order>
1727
+ <frontend_type>select</frontend_type>
1728
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1729
  <show_in_default>1</show_in_default>
1730
+ <show_in_website>1</show_in_website>
1731
  <show_in_store>0</show_in_store>
1732
+ </sales_email_order_comment_template>
1733
+ <sales_email_order_comment_guest_template translate="label" model="connector">
1734
+ <label>Order Update for Guest</label>
 
 
1735
  <sort_order>50</sort_order>
1736
+ <frontend_type>select</frontend_type>
1737
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1738
  <show_in_default>1</show_in_default>
1739
  <show_in_website>1</show_in_website>
1740
  <show_in_store>0</show_in_store>
1741
+ </sales_email_order_comment_guest_template>
1742
+ <sales_email_invoice_template translate="label" model="connector">
1743
+ <label>New Invoice</label>
 
 
1744
  <sort_order>60</sort_order>
1745
+ <frontend_type>select</frontend_type>
1746
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1747
  <show_in_default>1</show_in_default>
1748
  <show_in_website>1</show_in_website>
1749
  <show_in_store>0</show_in_store>
1750
+ </sales_email_invoice_template>
1751
+ <sales_email_invoice_guest_template translate="label" model="connector">
1752
+ <label>New Invoice for Guest</label>
 
 
1753
  <sort_order>70</sort_order>
1754
+ <frontend_type>select</frontend_type>
1755
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1756
  <show_in_default>1</show_in_default>
1757
  <show_in_website>1</show_in_website>
1758
  <show_in_store>0</show_in_store>
1759
+ </sales_email_invoice_guest_template>
1760
+ <sales_email_invoice_comment_template translate="label" model="connector">
1761
+ <label>Invoice Update</label>
 
 
1762
  <sort_order>80</sort_order>
1763
+ <frontend_type>select</frontend_type>
1764
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1765
  <show_in_default>1</show_in_default>
1766
  <show_in_website>1</show_in_website>
1767
  <show_in_store>0</show_in_store>
1768
+ </sales_email_invoice_comment_template>
1769
+ <sales_email_invoice_comment_guest_template translate="label" module="connector">
1770
+ <label>Invoice Update for Guest</label>
 
 
1771
  <sort_order>90</sort_order>
1772
+ <frontend_type>select</frontend_type>
1773
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1774
  <show_in_default>1</show_in_default>
1775
  <show_in_website>1</show_in_website>
1776
  <show_in_store>0</show_in_store>
1777
+ </sales_email_invoice_comment_guest_template>
1778
+ <sales_email_creditmemo_template>
1779
+ <label>New Credit Memo</label>
 
 
 
1780
  <sort_order>100</sort_order>
1781
+ <frontend_type>select</frontend_type>
1782
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1783
  <show_in_default>1</show_in_default>
1784
  <show_in_website>1</show_in_website>
1785
  <show_in_store>0</show_in_store>
1786
+ </sales_email_creditmemo_template>
1787
+ <sales_email_creditmemo_guest_template>
1788
+ <label>New Credit Memo Guest</label>
 
 
1789
  <sort_order>110</sort_order>
1790
+ <frontend_type>select</frontend_type>
1791
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1792
  <show_in_default>1</show_in_default>
1793
  <show_in_website>1</show_in_website>
1794
  <show_in_store>0</show_in_store>
1795
+ </sales_email_creditmemo_guest_template>
1796
+ <sales_email_creditmemo_comment_template translate="label" module="connector">
1797
+ <label>Credit Memo Update</label>
 
 
1798
  <sort_order>120</sort_order>
1799
+ <frontend_type>select</frontend_type>
1800
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1801
  <show_in_default>1</show_in_default>
1802
  <show_in_website>1</show_in_website>
1803
  <show_in_store>0</show_in_store>
1804
+ </sales_email_creditmemo_comment_template>
1805
+ <sales_email_creditmemo_comment_guest_template translate="label" module="connector">
1806
+ <label>Credit Memo Update for Guest</label>
 
 
1807
  <sort_order>130</sort_order>
1808
+ <frontend_type>select</frontend_type>
1809
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1810
  <show_in_default>1</show_in_default>
1811
  <show_in_website>1</show_in_website>
1812
  <show_in_store>0</show_in_store>
1813
+ </sales_email_creditmemo_comment_guest_template>
1814
+ <sales_email_shipment_template translate="label" module="connector">
1815
+ <label>New Shipment</label>
1816
+ <sort_order>140</sort_order>
1817
+ <frontend_type>select</frontend_type>
1818
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1819
+ <show_in_default>1</show_in_default>
1820
+ <show_in_website>1</show_in_website>
1821
+ <show_in_store>0</show_in_store>
1822
+ </sales_email_shipment_template>
1823
+ <sales_email_shipment_guest_template translate="label" module="connector">
1824
+ <label>New Shipment for Guest</label>
1825
+ <sort_order>150</sort_order>
1826
+ <frontend_type>select</frontend_type>
1827
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1828
+ <show_in_default>1</show_in_default>
1829
+ <show_in_website>1</show_in_website>
1830
+ <show_in_store>0</show_in_store>
1831
+ </sales_email_shipment_guest_template>
1832
+ <sales_email_shipment_comment_template translate="label" module="connector">
1833
+ <label>Shipment Update</label>
1834
+ <sort_order>160</sort_order>
1835
+ <frontend_type>select</frontend_type>
1836
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1837
+ <show_in_default>1</show_in_default>
1838
+ <show_in_website>1</show_in_website>
1839
+ <show_in_store>0</show_in_store>
1840
+ </sales_email_shipment_comment_template>
1841
+ <sales_email_shipment_comment_guest_template translate="label" module="connector">
1842
+ <label>Shipment Update for Guest</label>
1843
+ <sort_order>170</sort_order>
1844
+ <frontend_type>select</frontend_type>
1845
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1846
+ <show_in_default>1</show_in_default>
1847
+ <show_in_website>1</show_in_website>
1848
+ <show_in_store>0</show_in_store>
1849
+ </sales_email_shipment_comment_guest_template>
1850
+ <customer_emails_heading translate="label" module="connector">
1851
+ <label>Customer</label>
1852
+ <sort_order>180</sort_order>
1853
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1854
+ <show_in_default>1</show_in_default>
1855
+ <show_in_website>1</show_in_website>
1856
+ <show_in_store>0</show_in_store>
1857
+ </customer_emails_heading>
1858
+ <customer_create_account_email_template translate="label" module="connector">
1859
+ <label>New Account</label>
1860
+ <sort_order>190</sort_order>
1861
+ <frontend_type>select</frontend_type>
1862
+ <source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
1863
+ <show_in_default>1</show_in_default>
1864
+ <show_in_website>1</show_in_website>
1865
+ <show_in_store>0</show_in_store>
1866
+ </customer_create_account_email_template>
1867
+ </fields>
1868
+ </email_mapping>
1869
+ </groups>
1870
+ </connector_transactional_emails>
1871
+ <connector_advanced_settings translate="label" module="connector">
1872
+ <label><![CDATA[Advanced Settings]]></label>
1873
+ <tab>connector</tab>
1874
+ <frontend_type>text</frontend_type>
1875
+ <sort_order>10000</sort_order>
1876
+ <show_in_default>1</show_in_default>
1877
+ <show_in_website>1</show_in_website>
1878
+ <show_in_store>0</show_in_store>
1879
+ <groups>
1880
+ <sync_limits translate="label" module="connector">
1881
+ <label>Transactional Data Sync Limit</label>
1882
+ <frontend_type>text</frontend_type>
1883
+ <sort_order>10</sort_order>
1884
+ <show_in_default>1</show_in_default>
1885
+ <show_in_website>1</show_in_website>
1886
+ <show_in_store>0</show_in_store>
1887
+ <fields>
1888
+ <orders translate="label" module="connector">
1889
+ <label>Transactional Data Import Limit Size</label>
1890
+ <frontend_type>select</frontend_type>
1891
+ <source_model>email_connector/adminhtml_source_advanced_transdata</source_model>
1892
+ <sort_order>40</sort_order>
1893
+ <show_in_default>1</show_in_default>
1894
+ <show_in_website>1</show_in_website>
1895
+ <show_in_store>0</show_in_store>
1896
+ </orders>
1897
  </fields>
1898
+ </sync_limits>
1899
+ <admin translate="label" module="connector">
1900
  <label>Admin</label>
1901
  <frontend_type>text</frontend_type>
1902
  <sort_order>30</sort_order>
1903
  <show_in_default>1</show_in_default>
1904
+ <show_in_website>1</show_in_website>
1905
  <show_in_store>0</show_in_store>
1906
+ <comment><![CDATA[<p class="notice">ADVANCED</p>]]>
1907
+ </comment>
1908
  <fields>
1909
+ <setup_data_fields translate="label comment" module="connector">
1910
+ <label>Automap Data Fields</label>
1911
+ <frontend_model>email_connector/adminhtml_system_advanced_setupdatafields</frontend_model>
1912
  <sort_order>10</sort_order>
1913
  <show_in_default>1</show_in_default>
1914
  <show_in_website>1</show_in_website>
1915
  <show_in_store>0</show_in_store>
1916
+ <comment><![CDATA[Create Datafields In Connector And Map Them. Including Customer, Address And Sales Information.]]></comment>
1917
+ </setup_data_fields>
1918
+ <delete_contact translate="label" module="connector">
1919
+ <label><![CDATA[Delete All Contact ID'S]]></label>
1920
+ <frontend_model>email_connector/adminhtml_system_advanced_deletecontactids</frontend_model>
1921
  <sort_order>20</sort_order>
1922
  <show_in_default>1</show_in_default>
1923
  <show_in_website>1</show_in_website>
1924
  <show_in_store>0</show_in_store>
1925
+ <comment><![CDATA[Remove the contact id's. When using different API username account from initial setup please click here to remove all.]]></comment>
1926
+ </delete_contact>
1927
+ <reimport_orders module="connector" translate="label">
1928
+ <label>Refresh Transactional Data</label>
1929
+ <frontend_model>email_connector/adminhtml_system_advanced_reimportorders</frontend_model>
1930
  <sort_order>30</sort_order>
1931
  <show_in_default>1</show_in_default>
1932
  <show_in_website>1</show_in_website>
1933
  <show_in_store>0</show_in_store>
1934
+ <comment><![CDATA[Refresh Order Transactional Data That Was Already Imported.]]></comment>
1935
+ </reimport_orders>
1936
+ <reimport_subscribers module="connector" translate="label">
1937
+ <label>Refresh Subscribers</label>
1938
+ <frontend_model>email_connector/adminhtml_system_advanced_reimportsubscribers</frontend_model>
1939
+ <sort_order>40</sort_order>
1940
+ <show_in_default>1</show_in_default>
1941
+ <show_in_website>1</show_in_website>
1942
+ <show_in_store>0</show_in_store>
1943
+ <comment><![CDATA[All Subscribers Will Be Marked For Import.]]></comment>
1944
+ </reimport_subscribers>
1945
+ <suppressed_contacts module="connector" translate="label">
1946
+ <label>Refresh Supressed Contacts</label>
1947
+ <frontend_model>email_connector/adminhtml_system_advanced_suppressedcontacts</frontend_model>
1948
+ <sort_order>40</sort_order>
1949
+ <show_in_default>1</show_in_default>
1950
+ <show_in_website>1</show_in_website>
1951
+ <show_in_store>0</show_in_store>
1952
+ <comment>Refresh Historically Suppressed contacts for 10years period.</comment>
1953
+ </suppressed_contacts>
1954
+ <memory_limit translate="label comment" module="connector">
1955
+ <label>Customer Sync Memory Default</label>
1956
  <frontend_type>select</frontend_type>
1957
  <source_model>adminhtml/system_config_source_yesno</source_model>
1958
+ <sort_order>50</sort_order>
1959
  <show_in_default>1</show_in_default>
1960
  <show_in_website>0</show_in_website>
1961
  <show_in_store>0</show_in_store>
 
1962
  <comment>Set to NO to use system default memory.</comment>
1963
  </memory_limit>
1964
+ <batch_size translate="label comment" module="connector">
1965
  <label>Customer Sync Batch Size</label>
1966
  <frontend_type>text</frontend_type>
1967
  <show_in_default>1</show_in_default>
1968
  <show_in_website>1</show_in_website>
1969
  <show_in_store>0</show_in_store>
1970
+ <sort_order>60</sort_order>
1971
+ <comment>Set the limit size for customers loaded for every sync.</comment>
1972
  </batch_size>
1973
+ <debug_enabled translate="label comment" module="connector">
1974
  <label>Debug Mode</label>
1975
  <frontend_type>select</frontend_type>
1976
  <source_model>adminhtml/system_config_source_yesno</source_model>
1977
+ <sort_order>70</sort_order>
1978
  <show_in_default>1</show_in_default>
1979
  <show_in_website>1</show_in_website>
1980
+ <show_in_store>0</show_in_store>
1981
+ </debug_enabled>
1982
+ <inline_styling translate="label" module="connector">
1983
+ <label>Transactional Emails Styling</label>
1984
+ <frontend_type>textarea</frontend_type>
1985
+ <sort_order>80</sort_order>
1986
+ <show_in_default>1</show_in_default>
1987
+ <show_in_website>1</show_in_website>
1988
+ <show_in_store>0</show_in_store>
1989
+ <comment>Styling entered here will apply to all dynamic content areas pulled from Magento for transactional emails.</comment>
1990
+ </inline_styling>
1991
+ <recommended_inline translate="label" module="connector">
1992
+ <label>Dynamic Content Styling</label>
1993
+ <frontend_type>textarea</frontend_type>
1994
+ <sort_order>90</sort_order>
1995
+ <show_in_default>1</show_in_default>
1996
+ <show_in_website>1</show_in_website>
1997
+ <show_in_store>0</show_in_store>
1998
+ <comment><![CDATA[Styling entered here will apply to all dynamic content areas pulled from Magento. Classes References Used : 'product-name', 'product-price', 'product-url']]></comment>
1999
+ </recommended_inline>
2000
  </fields>
2001
  </admin>
2002
  </groups>
app/code/{local/Dotdigitalgroup/Email/sql/connector_setup → community/Dotdigitalgroup/Email/sql/email_connector_setup}/mysql4-install-0.1.0.php RENAMED
@@ -1,12 +1,4 @@
1
  <?php
2
- /**
3
- * mag17.
4
- *
5
- * User: chrisroseuk
6
- * Date: 30/04/2013
7
- * Time: 14:17
8
- *
9
- */
10
 
11
  $installer = $this;
12
  $installer->startSetup();
@@ -24,6 +16,7 @@ $setup->addAttribute('customer', 'dotmailer_contact_id', array(
24
  'visible' => 1,
25
  'required' => 0,
26
  'user_defined' => 0,
 
27
  ));
28
 
29
  $setup->addAttributeToGroup(
@@ -42,9 +35,9 @@ $adminData = array();
42
  $adminData[] = array(
43
  'severity' => 4,
44
  'date_added' => gmdate('Y-m-d H:i:s', time()),
45
- 'title' => 'Email Connector was installed. Remmenber to enable cronjob to make it working.',
46
- 'description' => 'Connector synchronization is based on the cronjob please make sure this is setup before running through configuration.',
47
- 'url' => ''
48
  );
49
 
50
  Mage::getModel('adminnotification/inbox')->parse($adminData);
1
  <?php
 
 
 
 
 
 
 
 
2
 
3
  $installer = $this;
4
  $installer->startSetup();
16
  'visible' => 1,
17
  'required' => 0,
18
  'user_defined' => 0,
19
+ ''
20
  ));
21
 
22
  $setup->addAttributeToGroup(
35
  $adminData[] = array(
36
  'severity' => 4,
37
  'date_added' => gmdate('Y-m-d H:i:s', time()),
38
+ 'title' => 'Email Connector Was Installed. Please Enter Your API Credentials & Ensure Cron Jobs Are Running On Your Site (Find Out More)',
39
+ 'description' => 'Email Connector Was Installed. Please Enter Your API Credentials & Ensure Cron Jobs Are Running On Your Site.',
40
+ 'url' => 'http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job'
41
  );
42
 
43
  Mage::getModel('adminnotification/inbox')->parse($adminData);
app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-install-3.0.0.php ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** @var Mage_Eav_Model_Entity_Setup $installer */
4
+
5
+ $installer = $this;
6
+
7
+ $installer->startSetup();
8
+
9
+ /**
10
+ * create Contact table.
11
+ */
12
+ $contactTable = $installer->getTable('email_connector/contact');
13
+
14
+ if ($installer->getConnection()->isTableExists($contactTable)) {
15
+ $installer->getConnection()->dropTable($contactTable);
16
+ }
17
+
18
+ $table = $installer->getConnection()->newTable($contactTable);
19
+ $table->addColumn('email_contact_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
20
+ 'primary' => true,
21
+ 'identity' => true,
22
+ 'unsigned' => true,
23
+ 'nullable' => false
24
+ ), 'Primary Key')
25
+ ->addColumn('is_guest', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
26
+ 'unsigned' => true,
27
+ 'nullable' => true,
28
+ ), 'Is Guest')
29
+ ->addColumn('contact_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
30
+ 'unsigned' => true,
31
+ 'nullable' => true,
32
+ ), 'Connector Contact ID')
33
+ ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
34
+ 'unsigned' => true,
35
+ 'nullable' => false,
36
+ ), 'Customer ID')
37
+ ->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
38
+ 'unsigned' => true,
39
+ 'nullable' => false,
40
+ 'default' => '0'
41
+ ), 'Website ID')
42
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
43
+ 'unsigned' => true,
44
+ 'nullable' => false,
45
+ 'default' => '0'
46
+ ), 'Store ID')
47
+ ->addColumn('email', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
48
+ 'nullable' => false,
49
+ 'default' => ''
50
+ ), 'Customer Email')
51
+ ->addColumn('is_subscriber', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
52
+ 'unsigned' => true,
53
+ 'nullable' => true,
54
+ ), 'Is Subscriber')
55
+ ->addColumn('subscriber_status', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
56
+ 'unsigned' => true,
57
+ 'nullable' => true,
58
+ ), 'Subscriber status')
59
+ ->addColumn('email_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
60
+ 'unsigned' => true,
61
+ 'nullable' => true,
62
+ ), 'Is Imported')
63
+ ->addColumn('subscriber_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
64
+ 'unsigned' => true,
65
+ 'nullable' => true,
66
+ ), 'Subscriber Imported')
67
+ ->addColumn('suppressed', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
68
+ 'unsigned' => true,
69
+ 'nullable' => true,
70
+ ), 'Is Suppressed')
71
+ ->addIndex($this->getIdxName($contactTable, array('email_contact_id')),
72
+ array('email_contact_id'))
73
+ ->addIndex($this->getIdxName($contactTable, array('is_guest')),
74
+ array('is_guest'))
75
+ ->addIndex($this->getIdxName($contactTable, array('customer_id')),
76
+ array('customer_id'))
77
+ ->addIndex($this->getIdxName($contactTable, array('website_id')),
78
+ array('website_id'))
79
+ ->addIndex($this->getIdxName($contactTable, array('is_subscriber')),
80
+ array('is_subscriber'))
81
+ ->addIndex($this->getIdxName($contactTable, array('subscriber_status')),
82
+ array('subscriber_status'))
83
+ ->addIndex($this->getIdxName($contactTable, array('email_imported')),
84
+ array('email_imported'))
85
+ ->addIndex($this->getIdxName($contactTable, array('subscriber_imported')),
86
+ array('subscriber_imported'))
87
+ ->addIndex($this->getIdxName($contactTable, array('suppressed')),
88
+ array('suppressed'))
89
+
90
+ ->addForeignKey(
91
+ $installer->getFkName($contactTable, 'website_id', 'core/website', 'website_id'),
92
+ 'website_id', $installer->getTable('core/website'), 'website_id',
93
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
94
+ ->setComment('Connector Contacts');
95
+ $installer->getConnection()->createTable($table);
96
+
97
+
98
+ /**
99
+ * Order table
100
+ */
101
+ $orderTable = $installer->getTable('email_connector/order');
102
+
103
+ if ($installer->getConnection()->isTableExists($orderTable)) {
104
+ $installer->getConnection()->dropTable($orderTable);
105
+ }
106
+
107
+ $table = $installer->getConnection()->newTable($orderTable);
108
+ $table->addColumn('email_order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
109
+ 'primary' => true,
110
+ 'identity' => true,
111
+ 'unsigned' => true,
112
+ 'nullable' => false
113
+ ), 'Primary Key')
114
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
115
+ 'unsigned' => true,
116
+ 'nullable' => false,
117
+ ), 'Order ID')
118
+ ->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
119
+ 'unsigned' => true,
120
+ 'nullable' => false,
121
+ ), 'Sales Quote ID')
122
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
123
+ 'unsigned' => true,
124
+ 'nullable' => false,
125
+ 'default' => '0'
126
+ ), 'Store ID')
127
+ ->addColumn('email_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
128
+ 'unsigned' => true,
129
+ 'nullable' => true,
130
+ ), 'Is Order Imported')
131
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
132
+ ), 'Creation Time')
133
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
134
+ ), 'Update Time')
135
+ ->addIndex($this->getIdxName($orderTable, array('store_id')),
136
+ array('store_id'))
137
+ ->addIndex($this->getIdxName($orderTable, array('quote_id')),
138
+ array('quote_id'))
139
+
140
+ ->addForeignKey(
141
+ $installer->getFkName($orderTable, 'store_id', 'core/store', 'store_id'),
142
+ 'store_id', $installer->getTable('core/store'), 'store_id',
143
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
144
+ ->setComment('Transactional Orders Data');
145
+ $installer->getConnection()->createTable($table);
146
+
147
+
148
+ /**
149
+ * Campaign table.
150
+ */
151
+ $campaignTable = $installer->getTable('email_connector/campaign');
152
+
153
+ if ($installer->getConnection()->isTableExists($campaignTable)) {
154
+ $installer->getConnection()->dropTable($campaignTable);
155
+ }
156
+
157
+ $table = $installer->getConnection()->newTable($campaignTable);
158
+ $table->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
159
+ 'primary' => true,
160
+ 'identity' => true,
161
+ 'unsigned' => true,
162
+ 'nullable' => false
163
+ ), 'Primary Key')
164
+ ->addColumn('campaign_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
165
+ 'unsigned' => true,
166
+ 'nullable' => false,
167
+ ), 'Campaign ID')
168
+ ->addColumn('email', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
169
+ 'nullable' => false,
170
+ 'default' => ''
171
+ ), 'Contact Email')
172
+ ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
173
+ 'unsigned' => true,
174
+ 'nullable' => false,
175
+ ), 'Customer ID')
176
+ ->addColumn('is_sent', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
177
+ 'unsigned' => true,
178
+ 'nullable' => true,
179
+ ), 'Is Sent')
180
+ ->addColumn('sent_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
181
+ ), 'Send Date')
182
+ ->addColumn('order_increment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
183
+ 'unsigned' => true,
184
+ 'nullable' => false,
185
+ ), 'Order Increment ID')
186
+ ->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
187
+ 'unsigned' => true,
188
+ 'nullable' => false,
189
+ ), 'Sales Quote ID')
190
+ ->addColumn('message', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
191
+ 'nullable' => false,
192
+ 'default' => ''
193
+ ), 'Errror Message')
194
+ ->addColumn('checkout_method', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
195
+ 'nullable' => false,
196
+ 'default' => ''
197
+ ), 'Checkout Method Used')
198
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
199
+ 'unsigned' => true,
200
+ 'nullable' => false,
201
+ 'default' => '0'
202
+ ), 'Store ID')
203
+ ->addColumn('event_name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
204
+ 'nullable' => false,
205
+ 'default' => ''
206
+ ), 'Event Name')
207
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
208
+ ), 'Creation Time')
209
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
210
+ ), 'Update Time')
211
+
212
+ ->addIndex($this->getIdxName($campaignTable, array('store_id')),
213
+ array('store_id'))
214
+ ->addIndex($this->getIdxName($campaignTable, array('campaign_id')),
215
+ array('campaign_id'))
216
+ ->addIndex($this->getIdxName($campaignTable, array('email')),
217
+ array('email'))
218
+ ->addIndex($this->getIdxName($campaignTable, array('is_sent')),
219
+ array('is_sent'))
220
+ ->addForeignKey(
221
+ $installer->getFkName($campaignTable, 'store_id', 'core/store', 'store_id'),
222
+ 'store_id', $installer->getTable('core/store'), 'store_id',
223
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
224
+ ->setComment('Connector Campaigns');
225
+ $installer->getConnection()->createTable($table);
226
+
227
+ /**
228
+ * Admin notification message
229
+ */
230
+
231
+ $adminData = array();
232
+ $adminData[] = array(
233
+ 'severity' => 4,
234
+ 'date_added' => gmdate('Y-m-d H:i:s', time()),
235
+ 'title' => 'Email Connector Was Installed. Please Enter Your API Credentials & Ensure Cron Jobs Are Running On Your Site (Find Out More)',
236
+ 'description' => 'Email Connector Was Installed. Please Enter Your API Credentials & Ensure Cron Jobs Are Running On Your Site.',
237
+ 'url' => 'http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job'
238
+ );
239
+
240
+ Mage::getModel('adminnotification/inbox')->parse($adminData);
241
+
242
+ /**
243
+ * Populate tables
244
+ */
245
+
246
+ //customers populate
247
+ $select = $installer->getConnection()->select()
248
+ ->from(
249
+ array('customer' => $this->getTable('customer_entity')),
250
+ array('customer_id' => 'entity_id','email','website_id','store_id')
251
+ );
252
+
253
+ $insertArray = array('customer_id','email','website_id','store_id');
254
+ $sqlQuery = $select->insertFromSelect($contactTable, $insertArray, false);
255
+ $installer->getConnection()->query($sqlQuery);
256
+
257
+ // subscribers that are not customers
258
+ $select = $installer->getConnection()->select()
259
+ ->from(
260
+ array('subscriber' => $this->getTable('newsletter_subscriber')),
261
+ array(
262
+ 'email' => 'subscriber_email',
263
+ 'col2' => new Zend_Db_Expr('1'),
264
+ 'col3' => new Zend_Db_Expr('1'),
265
+ 'store_id'
266
+ )
267
+ )
268
+ ->where('customer_id =?', 0 )
269
+ ->where('subscriber_status =?', 1);
270
+ $insertArray = array('email','is_subscriber','subscriber_status','store_id');
271
+ $sqlQuery = $select->insertFromSelect($contactTable, $insertArray, false);
272
+ $installer->getConnection()->query($sqlQuery);
273
+
274
+ //Insert and populate email order the table
275
+ $select = $installer->getConnection()->select()
276
+ ->from(
277
+ $this->getTable('sales/order'),
278
+ array('order_id' => 'entity_id', 'quote_id', 'store_id', 'created_at', 'updated_at')
279
+ );
280
+ $insertArray =
281
+ array('order_id', 'quote_id', 'store_id', 'created_at', 'updated_at');
282
+
283
+ $sqlQuery = $select->insertFromSelect($orderTable, $insertArray, false);
284
+ $installer->getConnection()->query($sqlQuery);
285
+
286
+
287
+ $installer->endSetup();
app/code/{local/Dotdigitalgroup/Email/sql/connector_setup → community/Dotdigitalgroup/Email/sql/email_connector_setup}/mysql4-upgrade-1.1.1-1.1.2.php RENAMED
File without changes
app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-1.1.2-1.5.0.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+
8
+ $installer->endSetup();
app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-1.5.0-2.0.0.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+
8
+ try{
9
+
10
+ $installer->run(
11
+ "DROP TABLE IF EXISTS {$this->getTable('email_order')};
12
+ CREATE TABLE `{$this->getTable('email_order')}` (
13
+ `email_order_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
14
+ `order_id` int(15) unsigned DEFAULT NULL,
15
+ `quote_id` int(15) unsigned DEFAULT NULL,
16
+ `store_id` smallint(5) unsigned DEFAULT NULL,
17
+ `email_imported` tinyint(1) DEFAULT NULL,
18
+ `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
19
+ `updated_at` datetime DEFAULT NULL,
20
+ PRIMARY KEY (`email_order_id`),
21
+ KEY `IDX_EMAIL_STORE_ID` (`store_id`),
22
+ KEY `IDX_EMAIL_QUOTE_ID` (`quote_id`),
23
+ CONSTRAINT `FK_EMAIL_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core_store')}` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
25
+ );
26
+
27
+
28
+ //Insert and populate email order the table
29
+ $installer->run(
30
+ "INSERT IGNORE INTO `{$this->getTable('email_order')}` (`order_id`, `quote_id`, `store_id`, `created_at`, `updated_at`)
31
+ SELECT `entity_id`, `quote_id`, `store_id`, `created_at`, `updated_at`
32
+ FROM `{$this->getTable('sales/order')}`;"
33
+ );
34
+
35
+
36
+ $installer->run(
37
+ "DROP TABLE IF EXISTS {$this->getTable('email_contact')};
38
+ CREATE TABLE `{$this->getTable('email_contact')}` (
39
+ `email_contact_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
40
+ `is_guest` smallint(1) DEFAULT NULL,
41
+ `contact_id` int(15) unsigned DEFAULT NULL,
42
+ `customer_id` int(10) unsigned DEFAULT NULL,
43
+ `website_id` smallint(5) unsigned DEFAULT NULL COMMENT 'Website Id',
44
+ `email` varchar(255) DEFAULT NULL,
45
+ `is_subscriber` tinyint(1)unsigned DEFAULT NULL,
46
+ `subscriber_status` int(10) unsigned DEFAULT '0',
47
+ `email_id` smallint(5) unsigned DEFAULT NULL,
48
+ `email_imported` tinyint(1) unsigned DEFAULT NULL,
49
+ `suppressed` smallint(1) DEFAULT NULL,
50
+ PRIMARY KEY (`email_contact_id`),
51
+ KEY `IDX_EMAIL_CONTACT_WEBSITE_ID` (`website_id`),
52
+ CONSTRAINT `FK_EMAIL_CONTACT_WEBSITE_ID_CORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE SET NULL ON UPDATE CASCADE
53
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Email Contact Sync';"
54
+ );
55
+
56
+
57
+ //Insert and populate email contact table
58
+ $installer->run(
59
+ "INSERT IGNORE INTO `{$this->getTable('email_contact')}` (`customer_id`, `email`, `website_id`)
60
+ SELECT `entity_id`, `email`, `website_id`
61
+ FROM `{$this->getTable('customer_entity')}`;"
62
+ );
63
+
64
+ //Remove Order Attribute For Imported Data
65
+ $installer->removeAttribute('order', 'dotmailer_order_imported');
66
+ $installer->removeAttribute('customer', 'dotmailer_contact_id');
67
+
68
+
69
+ }catch (Exception $e){
70
+
71
+ Mage::log($e->getMessage());
72
+
73
+ }
74
+
75
+ $installer->endSetup();
app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.0-2.0.1.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+
8
+
9
+ $installer->endSetup();
app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.1-2.0.2.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+
8
+ $installer->run(
9
+ "DROP TABLE IF EXISTS {$this->getTable('email_contact')};
10
+ CREATE TABLE `{$this->getTable('email_contact')}` (
11
+ `email_contact_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
12
+ `is_guest` smallint(1) DEFAULT NULL,
13
+ `contact_id` int(15) unsigned DEFAULT NULL,
14
+ `customer_id` int(10) unsigned DEFAULT NULL,
15
+ `website_id` smallint(5) unsigned DEFAULT NULL COMMENT 'Website Id',
16
+ `email` varchar(255) DEFAULT NULL,
17
+ `is_subscriber` tinyint(1) unsigned DEFAULT NULL,
18
+ `subscriber_status` int(10) unsigned DEFAULT '0',
19
+ `subscriber_imported` tinyint(1) unsigned DEFAULT NULL,
20
+ `email_imported` tinyint(1) unsigned DEFAULT NULL,
21
+ `suppressed` smallint(1) DEFAULT NULL,
22
+ PRIMARY KEY (`email_contact_id`),
23
+ KEY `IDX_EMAIL_CONTACT_ID` (`email_contact_id`),
24
+ KEY `IDX_EMAIL_CONTACT_IS_GUEST` (`is_guest`),
25
+ KEY `IDX_EMAIL_CONTACT_CUSTOMER_ID` (`customer_id`),
26
+ KEY `IDX_EMAIL_CONTACT_WEBSITE_ID` (`website_id`),
27
+ KEY `IDX_EMAIL_CONTACT_IS_SUBSCRIBER` (`is_subscriber`),
28
+ KEY `IDX_EMAIL_CONTACT_SUBSCRIBER_STATUS` (`subscriber_status`),
29
+ KEY `IDX_EMAIL_CONTACT_SUBSCRIBER_IMPORTED` (`subscriber_imported`),
30
+ KEY `IDX_EMAIL_CONTACT_EMAIL_IMPORTED` (`email_imported`),
31
+ KEY `IDX_EMAIL_CONTACT_suppressed` (`suppressed`),
32
+ UNIQUE KEY `IDX_EMAIL_CONTACT_EMAIL` (`email`),
33
+ CONSTRAINT `FK_EMAIL_CONTACT_WEBSITE_ID_CORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE SET NULL ON UPDATE CASCADE
34
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Email Contacts';"
35
+ );
36
+
37
+
38
+ //Insert and populate email contact table
39
+ $installer->run(
40
+ "INSERT IGNORE INTO `{$this->getTable('email_contact')}` (`customer_id`, `email`, `website_id`)
41
+ SELECT `entity_id`, `email`, `website_id`
42
+ FROM `{$this->getTable('customer_entity')}`;"
43
+ );
44
+
45
+ //Subscribers that are not customers
46
+ $installer->run("
47
+ INSERT IGNORE INTO {$this->getTable('email_contact')} (`email`, `is_subscriber`, `subscriber_status`)
48
+ SELECT `subscriber_email`, '1' as col2, '1' as col3 FROM `{$this->getTable('newsletter/subscriber')}` WHERE `customer_id` = 0 AND `subscriber_status` = 1;
49
+ ");
50
+
51
+
52
+ $installer->endSetup();
app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.3-2.0.4.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+
6
+ $installer->startSetup();
7
+
8
+
9
+ $installer->run("
10
+ ALTER TABLE `{$this->getTable('email_contact')}`
11
+
12
+ DROP FOREIGN KEY `FK_EMAIL_CONTACT_WEBSITE_ID_CORE_WEBSITE_WEBSITE_ID`,
13
+ CHANGE COLUMN `website_id` `website_id` smallint(5) unsigned DEFAULT '0' AFTER `customer_id`;
14
+ ");
15
+
16
+ $installer->run("
17
+ UPDATE `{$this->getTable('email_contact')}` SET `website_id` = '0'
18
+ WHERE `website_id` IS NULL;
19
+ ");
20
+
21
+ $installer->run("
22
+ ALTER TABLE `{$this->getTable('email_contact')}`
23
+ ADD CONSTRAINT `FK_EMAIL_CONTACT_WEBSITE_ID_CORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `{$installer->getTable('core_website')}` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE;
24
+
25
+ ");
26
+
27
+
28
+ $installer->endSetup();
app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.4-2.0.5.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+
6
+ $installer->startSetup();
7
+
8
+
9
+ $installer->endSetup();
app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.5-2.0.6.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+ /**
8
+ * Campaign table.
9
+ */
10
+ $campaignTable = $installer->getTable('email_connector/campaign');
11
+
12
+ if ($installer->getConnection()->isTableExists($campaignTable)) {
13
+ $installer->getConnection()->dropTable($campaignTable);
14
+ }
15
+
16
+ $table = $installer->getConnection()->newTable($campaignTable);
17
+ $table->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
18
+ 'primary' => true,
19
+ 'identity' => true,
20
+ 'unsigned' => true,
21
+ 'nullable' => false
22
+ ), 'Primary Key')
23
+ ->addColumn('campaign_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
24
+ 'unsigned' => true,
25
+ 'nullable' => false,
26
+ ), 'Campaign ID')
27
+ ->addColumn('email', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
28
+ 'nullable' => false,
29
+ 'default' => ''
30
+ ), 'Contact Email')
31
+ ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
32
+ 'unsigned' => true,
33
+ 'nullable' => false,
34
+ ), 'Customer ID')
35
+ ->addColumn('is_sent', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
36
+ 'unsigned' => true,
37
+ 'nullable' => true,
38
+ ), 'Is Sent')
39
+ ->addColumn('sent_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
40
+ ), 'Send Date')
41
+ ->addColumn('order_increment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
42
+ 'unsigned' => true,
43
+ 'nullable' => false,
44
+ ), 'Order Increment ID')
45
+ ->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
46
+ 'unsigned' => true,
47
+ 'nullable' => false,
48
+ ), 'Sales Quote ID')
49
+ ->addColumn('message', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
50
+ 'nullable' => false,
51
+ 'default' => ''
52
+ ), 'Errror Message')
53
+ ->addColumn('checkout_method', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
54
+ 'nullable' => false,
55
+ 'default' => ''
56
+ ), 'Checkout Method Used')
57
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
58
+ 'unsigned' => true,
59
+ 'nullable' => false,
60
+ 'default' => '0'
61
+ ), 'Store ID')
62
+ ->addColumn('event_name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
63
+ 'nullable' => false,
64
+ 'default' => ''
65
+ ), 'Event Name')
66
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
67
+ ), 'Creation Time')
68
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
69
+ ), 'Update Time')
70
+
71
+ ->addIndex($this->getIdxName($campaignTable, array('store_id')),
72
+ array('store_id'))
73
+ ->addIndex($this->getIdxName($campaignTable, array('campaign_id')),
74
+ array('campaign_id'))
75
+ ->addIndex($this->getIdxName($campaignTable, array('email')),
76
+ array('email'))
77
+ ->addIndex($this->getIdxName($campaignTable, array('is_sent')),
78
+ array('is_sent'))
79
+ ->addForeignKey(
80
+ $installer->getFkName($campaignTable, 'store_id', 'core/store', 'store_id'),
81
+ 'store_id', $installer->getTable('core/store'), 'store_id',
82
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
83
+ ->setComment('Connector Campaigns');
84
+ $installer->getConnection()->createTable($table);
85
+
86
+ /**
87
+ * remove contact column
88
+ */
89
+ $installer->getConnection()->dropColumn($installer->getTable('email_connector/contact'), 'subscriber_imported');
90
+
91
+ /*
92
+ * Cleaning
93
+ */
94
+ $entityTypeId = $installer->getEntityTypeId('customer');
95
+ if($installer->attributeExists($entityTypeId, 'dotmailer_contact_id'))
96
+ $installer->removeAttribute($entityTypeId, 'dotmailer_contact_id');
97
+
98
+ $entityTypeId = $installer->getEntityTypeId('order');
99
+ if($installer->attributeExists($entityTypeId, 'dotmailer_order_imported'))
100
+ $installer->removeAttribute($entityTypeId, 'dotmailer_order_imported');
101
+
102
+
103
+ $installer->endSetup();
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Bestsellers.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Bestsellers extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
- {
7
- $baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
8
- $code = Mage::helper('connector')->getPasscode();
9
- $order = Mage::helper('connector')->getLastOrderNo();
10
- if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
11
- if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
12
- $text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/bestsellers';
13
- $element->setData('value', $text);
14
- $element->setData('disabled', 'disabled');
15
- return parent::_getElementHtml($element);
16
-
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Gridlist.php DELETED
@@ -1,104 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Gridlist extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
- {
7
- // Get the default HTML for this option
8
- $html = parent::_getElementHtml($element);
9
-
10
-
11
- $jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
12
-
13
- $jQuery .='
14
- <script type="text/javascript">
15
- jQuery.noConflict();
16
- jQuery(document).ready(function() {
17
- var gridOptions = {
18
- "4" : "4",
19
- "8" : "8",
20
- "12" : "12",
21
- "16" : "16",
22
- "20" : "20",
23
- "24" : "24",
24
- "28" : "28",
25
- "32" : "32"
26
-
27
- };
28
- var listOptions = {
29
- "2" : "2",
30
- "4" : "4",
31
- "6" : "6",
32
- "8" : "8"
33
- }
34
-
35
- jQuery("#dynamic_content_products_related_display_type").change(function(){
36
-
37
- var display_type = jQuery(this).closest("tr").next().find("select");
38
- var display_mode = jQuery(this).val();
39
- changeOptions(display_type, display_mode);
40
-
41
-
42
- });
43
-
44
- jQuery("#dynamic_content_products_upsell_display_type").change(function(){
45
- var display_type = jQuery(this).closest("tr").next().find("select");
46
- var display_mode = jQuery(this).val();
47
- changeOptions(display_type, display_mode);
48
-
49
- });
50
- jQuery("#dynamic_content_products_crosssell_display_type").change(function(){
51
- var display_type = jQuery(this).closest("tr").next().find("select");
52
- var display_mode = jQuery(this).val();
53
- changeOptions(display_type, display_mode);
54
- });
55
- jQuery("#dynamic_content_products_best_display_type").change(function(){
56
- var display_type = jQuery(this).closest("tr").next().find("select");
57
- var display_mode = jQuery(this).val();
58
- changeOptions(display_type, display_mode);
59
- });
60
- jQuery("#dynamic_content_products_most_viewed_display_type").change(function(){
61
- var display_type = jQuery(this).closest("tr").next().find("select");
62
- var display_mode = jQuery(this).val();
63
- changeOptions(display_type, display_mode);
64
- });
65
- jQuery("#dynamic_content_manual_product_search_display_type").change(function(){
66
- var display_type = jQuery(this).closest("tr").next().find("select");
67
- var display_mode = jQuery(this).val();
68
- changeOptions(display_type, display_mode);
69
- });
70
- jQuery("#dynamic_content_products_recently_viewed_display_type").change(function(){
71
- var display_type = jQuery(this).closest("tr").next().find("select");
72
- var display_mode = jQuery(this).val();
73
- changeOptions(display_type, display_mode);
74
- });
75
-
76
- function changeOptions(display_type, display_mode){
77
- if(display_mode == "list"){
78
- display_type.empty();
79
-
80
- jQuery.each(listOptions, function(key, value) {
81
- display_type.append(jQuery("<option></option>")
82
- .attr("value", value).text(key));
83
- });
84
-
85
- }
86
- if(display_mode == "grid"){
87
- display_type.empty();
88
- jQuery.each(gridOptions, function(key, value) {
89
- display_type.append(jQuery("<option></option>")
90
- .attr("value", value).text(key));
91
- });
92
- }
93
- }
94
-
95
- });
96
- </script>';
97
-
98
- $html .= $jQuery;
99
-
100
- return $html;
101
- }
102
-
103
-
104
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Insertvariable.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Insertvariable extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- public function _getElementHtml($element){
6
-
7
- $element->setData('onclick', 'templateControl.openVariableChooser();return false;');
8
-
9
-
10
- return parent::_getElementHtml($element);
11
- }
12
-
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Messagedefault.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Messagedefault extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- const DEFAULT_TEXT = 'Default SMS Text';
6
-
7
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
8
-
9
-
10
- $element->setData('placeholder', self::DEFAULT_TEXT);
11
-
12
- $element->setData('after_element_html', "
13
-
14
- <a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var order_number}}');return false;\">Insert Order Number</a>
15
- <a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
16
-
17
- <script type='text/javascript'>
18
-
19
- function addText(text){
20
- $('sms_section_sms_message_one_message').value += text;
21
- }
22
-
23
- function injectText(element,value){
24
- var element_dom=document.getElementById(element);
25
- if(document.selection){
26
- element_dom.focus();
27
- sel=document.selection.createRange();
28
- sel.text=value;
29
- return;
30
- }if(element_dom.selectionStart||element_dom.selectionStart=='0'){
31
- var t_start=element_dom.selectionStart;
32
- var t_end=element_dom.selectionEnd;
33
- var val_start=element_dom.value.substring(0,t_start);
34
- var val_end=element_dom.value.substring(t_end,element_dom.value.length);
35
- element_dom.value=val_start+value+val_end;
36
- }else{
37
- element_dom.value+=value;
38
- }
39
- }
40
- </script>
41
- ");
42
- return parent::_getElementHtml($element);
43
- }
44
-
45
-
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagefour.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessagefour extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- const DEFAULT_TEXT = 'Default SMS Text';
6
-
7
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
8
-
9
-
10
- $element->setData('placeholder', self::DEFAULT_TEXT);
11
-
12
- $element->setData('after_element_html', "
13
-
14
- <a href='#' onclick=\"injectText('sms_section_sms_message_four_message', '{{var order_number}}');return false;\">Insert Order Number</a>
15
- <a href='#' onclick=\"injectText('sms_section_sms_message_four_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
16
-
17
-
18
- ");
19
- return parent::_getElementHtml($element);
20
- }
21
-
22
-
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagethree.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessagethree extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- const DEFAULT_TEXT = 'Default SMS Text';
6
-
7
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
8
-
9
-
10
- $element->setData('placeholder', self::DEFAULT_TEXT);
11
-
12
- $element->setData('after_element_html', "
13
-
14
- <a href='#' onclick=\"injectText('sms_section_sms_message_three_message', '{{var order_number}}');return false;\">Insert Order Number</a>
15
- <a href='#' onclick=\"injectText('sms_section_sms_message_three_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
16
-
17
-
18
- ");
19
- return parent::_getElementHtml($element);
20
- }
21
-
22
-
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagetwo.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessagetwo extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- const DEFAULT_TEXT = 'Default SMS Text';
6
-
7
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
8
-
9
-
10
- $element->setData('placeholder', self::DEFAULT_TEXT);
11
-
12
- $element->setData('after_element_html', "
13
-
14
- <a href='#' onclick=\"injectText('sms_section_sms_message_two_message', '{{var order_number}}');return false;\">Insert Order Number</a>
15
- <a href='#' onclick=\"injectText('sms_section_sms_message_two_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
16
-
17
-
18
- ");
19
- return parent::_getElementHtml($element);
20
- }
21
-
22
-
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Couponinfo.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Couponinfo extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
- {
7
- $baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
8
- $code = Mage::helper('connector')->getPasscode();
9
- if(!strlen($code))
10
- $code = '[PLEASE SET UP A PASSCODE]';
11
- $text = $baseUr . 'connector/email/coupon/id/[INSERT ID HERE]/code/'. $code;
12
-
13
- $element->setData('value', $text);
14
- $element->setData('disabled', 'disabled');
15
- return parent::_getElementHtml($element);
16
- }
17
-
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Crosssell.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Crosssell extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
- {
7
- $baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
8
- $helper = Mage::helper('connector');
9
- $code = $helper->getPasscode();
10
- $order = $helper->getLastOrderNo();
11
-
12
- if(!strlen($code) && !strlen($order)) $code = '[PLEASE SET UP A PASSCODE]';
13
- if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
14
-
15
- $text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/crosssell';
16
- $element->setData('value', $text);
17
- $element->setData('disabled', 'disabled');
18
- return parent::_getElementHtml($element);
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Lostbasket.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Lostbasket extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
-
6
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
- {
8
- $baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
9
- $code = Mage::helper('connector')->getPasscode();
10
- if(!strlen($code))
11
- $code = '[PLEASE SET UP A PASSCODE]';
12
- $text = $baseUr . 'connector/email/basket/email/@EMAIL@/code/'. $code;
13
-
14
- $element->setData('value', $text);
15
- $element->setData('disabled', 'disabled');
16
- return parent::_getElementHtml($element);
17
- }
18
-
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Mostviewed.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Mostviewed extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
- {
7
- $baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
8
- $code = Mage::helper('connector')->getPasscode();
9
- $order = Mage::helper('connector')->getLastOrderNo();
10
- if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
11
- if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
12
- $text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/mostviewed';
13
- $element->setData('value', $text);
14
- $element->setData('disabled', 'disabled');
15
- return parent::_getElementHtml($element);
16
-
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Productpush.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Productpush extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
- {
7
- $baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
8
- $helper = Mage::helper('connector');
9
- $code = $helper->getPasscode();
10
- $order = $helper->getLastOrderNo();
11
- if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
12
- if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
13
- $text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/productpush';
14
- $element->setData('value', $text);
15
- $element->setData('disabled', 'disabled');
16
- return parent::_getElementHtml($element);
17
-
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Recentlyviewed.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Recentlyviewed extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
- {
6
- $baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
7
- $helper = Mage::helper('connector');
8
- $code = $helper->getPasscode();
9
-
10
- $customerId = $helper->getMappedCustomerId();
11
-
12
- if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
13
- if(!$customerId) $customerId = '[PLEASE MAP THE CUSTOMER ID]';
14
- $text = $baseUr . 'connector/email/products/customer/@' . $customerId . '@/code/' . $code . '/mode/recentlyviewed';
15
- $element->setData('value', $text);
16
- $element->setData('disabled', 'disabled');
17
- return parent::_getElementHtml($element);
18
-
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Related.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Related extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
- {
7
- $baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
8
- $helper = Mage::helper('connector');
9
- $code = $helper->getPasscode();
10
- $order = $helper->getLastOrderNo();
11
- if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
12
- if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
13
- $text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/related';
14
- $element->setData('value', $text);
15
-
16
- return parent::_getElementHtml($element);
17
-
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Upsell.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
- class Dotdigitalgroup_Email_Block_Adminhtml_System_Upsell extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
- {
6
- $baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
7
- $helper = Mage::helper('connector');
8
- $code = $helper->getPasscode();
9
- $order = $helper->getLastOrderNo();
10
-
11
- if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
12
- if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
13
-
14
- $text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/upsell';
15
- $element->setData('value', $text);
16
-
17
- return parent::_getElementHtml($element);
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcecustomersync.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Debug_Forcecustomersync extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
-
6
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
- $this->setElement($element);
8
- return $this->_getAddRowButtonHtml($this->__('Sync Customer Data Now'));
9
- }
10
-
11
- protected function _getAddRowButtonHtml($title) {
12
- $url = Mage::helper('adminhtml')->getUrl("connector/debug/forcecustomersync");
13
-
14
- return $this->getLayout()->createBlock('adminhtml/widget_button')
15
- ->setType('button')
16
- ->setLabel($this->__($title))
17
- ->setOnClick("window.location.href='" . $url . "'")
18
- ->toHtml();
19
- }
20
-
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcelostbasketsync.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Debug_Forcelostbasketsync extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
-
6
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
- $this->setElement($element);
8
- return $this->_getAddRowButtonHtml($this->__('Sync Lost Baskets Now'));
9
- }
10
-
11
- protected function _getAddRowButtonHtml($title) {
12
- $url = Mage::helper('adminhtml')->getUrl("connector/debug/forcelostbasketsync");
13
-
14
- return $this->getLayout()->createBlock('adminhtml/widget_button')
15
- ->setType('button')
16
- ->setLabel($this->__($title))
17
- ->setOnClick("window.location.href='" . $url . "'")
18
- ->toHtml();
19
- }
20
-
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcesuppressedsync.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Debug_Forcesuppressedsync extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
-
6
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
- $this->setElement($element);
8
- return $this->_getAddRowButtonHtml($this->__('Sync Suppressed Data Now'));
9
- }
10
-
11
- protected function _getAddRowButtonHtml($title) {
12
- $url = Mage::helper('adminhtml')->getUrl("connector/debug/forcesuppressed");
13
-
14
- return $this->getLayout()->createBlock('adminhtml/widget_button')
15
- ->setType('button')
16
- ->setLabel($this->__($title))
17
- ->setOnClick("window.location.href='" . $url . "'")
18
- ->toHtml();
19
- }
20
-
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Debug/Rescuenow.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Debug_Rescuenow extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
-
6
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
- $this->setElement($element);
8
- return $this->_getAddRowButtonHtml($this->__('Send Lost Basket Campaigns Now'));
9
- }
10
-
11
- protected function _getAddRowButtonHtml($title) {
12
- $url = Mage::helper('adminhtml')->getUrl("connector/debug/rescuenow");
13
-
14
- return $this->getLayout()->createBlock('adminhtml/widget_button')
15
- ->setType('button')
16
- ->setLabel($this->__($title))
17
- ->setOnClick("window.location.href='" . $url . "'")
18
- ->toHtml();
19
- }
20
-
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Block/Debug/Testcredentials.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Block_Debug_Testcredentials extends Mage_Adminhtml_Block_System_Config_Form_Field
4
- {
5
-
6
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
- $this->setElement($element);
8
- return $this->_getAddRowButtonHtml($this->__('Test Credentials'));
9
- }
10
-
11
- protected function _getAddRowButtonHtml($title) {
12
- $url = Mage::helper('adminhtml')->getUrl("connector/debug/testcredentials");
13
-
14
- return $this->getLayout()->createBlock('adminhtml/widget_button')
15
- ->setType('button')
16
- ->setLabel($this->__($title))
17
- ->setOnClick("window.location.href='" . $url . "'")
18
- ->toHtml();
19
- }
20
-
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Helper/Api/DotNetExample.php DELETED
@@ -1,182 +0,0 @@
1
- <?php
2
- /**
3
- * mag17.
4
- *
5
- * User: chrisroseuk
6
- * Date: 19/04/2013
7
- * Time: 17:10
8
- *
9
- */
10
-
11
- /*
12
- *
13
- * using System;
14
- using System.Collections.Generic;
15
- using System.IO;
16
- using System.Net;
17
- using System.Text;
18
- using System.Threading;
19
- using Newtonsoft.Json;
20
-
21
- namespace Email.ImportContacts
22
- {
23
- class Program
24
- {
25
- private const string UserName = "";
26
- private const string Password = "";
27
- private const int AddressBookId = 1188372; //Your address book here
28
-
29
- static void Main(string[] args)
30
- {
31
- AppDomain.CurrentDomain.UnhandledException += PrintUnhandledException;
32
-
33
- ApiContactImport contactImport = ImportContactsFromFile();
34
- ApiContactImport contactImportResult = WaitUntilImportFinishes(contactImport);
35
- PrintContactImport(contactImportResult);
36
-
37
- Dictionary<String, String> contactImportReport = GetContactImportReport(contactImportResult.Id);
38
- PrintContactImportReport(contactImportReport);
39
-
40
- String csvReport = GetContactImportFaults(contactImportResult.Id);
41
- PrintCsvReport(csvReport);
42
- }
43
-
44
- private static String GetContactImportFaults(Guid importId)
45
- {
46
- string url = String.Format("https://apiconnector.com/v2/contacts/import/{0}/report-faults", importId);
47
- HttpWebRequest request = CreateRequest(url);
48
- String result = ReadResultAsString(request);
49
- return result;
50
- }
51
-
52
- private static void PrintCsvReport(string csvReport)
53
- {
54
- Console.WriteLine();
55
- Console.WriteLine(csvReport);
56
- }
57
-
58
- private static Dictionary<string, string> GetContactImportReport(Guid importId)
59
- {
60
- string url = String.Format("https://apiconnector.com/v2/contacts/import/{0}/report", importId);
61
- HttpWebRequest request = CreateRequest(url);
62
- Dictionary<string, string> result = ReadResult<Dictionary<string, string>>(request);
63
- return result;
64
- }
65
-
66
- private static ApiContactImport WaitUntilImportFinishes(ApiContactImport importResult)
67
- {
68
- ApiContactImport result = importResult;
69
-
70
- while (result.Status == ApiContactImportStatuses.NotFinished)
71
- {
72
- Thread.Sleep(TimeSpan.FromSeconds(10));
73
-
74
- HttpWebRequest request = CreateRequest("https://apiconnector.com/v2/contacts/import/" + importResult.Id);
75
- result = ReadResult<ApiContactImport>(request);
76
- }
77
-
78
- return result;
79
- }
80
-
81
- private static ApiContactImport ImportContactsFromFile()
82
- {
83
- string url = String.Format("https://apiconnector.com/v2/address-books/{0}/contacts/import", AddressBookId);
84
- HttpWebRequest request = CreateRequest(url);
85
- request.Method = "POST";
86
-
87
- AddContactsToRequest(request);
88
-
89
- ApiContactImport result = ReadResult<ApiContactImport>(request);
90
- return result;
91
- }
92
-
93
- private static void AddContactsToRequest(HttpWebRequest request)
94
- {
95
- String boundary = Guid.NewGuid().ToString("N");
96
- request.ContentType = String.Format(@"multipart/form-data; boundary=""{0}""", boundary);
97
-
98
- using (BinaryWriter writer = new BinaryWriter(request.GetRequestStream()))
99
- {
100
- writer.Write(Encoding.UTF8.GetBytes("\r\n--" + boundary + "\r\n"));
101
-
102
- const string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n\r\n";
103
- string header = string.Format(headerTemplate, "Contacts", "Contacts.csv");
104
-
105
- byte[] headerbytes = Encoding.UTF8.GetBytes(header);
106
- writer.Write(headerbytes);
107
-
108
- byte[] contacts = File.ReadAllBytes("Contacts.csv");
109
- writer.Write(contacts);
110
-
111
- writer.Write(Encoding.UTF8.GetBytes("\r\n--" + boundary + "--\r\n"));
112
- }
113
- }
114
-
115
- private static HttpWebRequest CreateRequest(string url)
116
- {
117
- HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
118
- String base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(UserName + ":" + Password));
119
- request.Headers.Add("Authorization", "Basic " + base64);
120
-
121
- return request;
122
- }
123
-
124
- private static void PrintContactImport(ApiContactImport importResult)
125
- {
126
- Console.WriteLine("Import Id = {0}", importResult.Id);
127
- Console.WriteLine("Import Status = {0}", importResult.Status);
128
- }
129
-
130
- private static void PrintContactImportReport(Dictionary<String, String> contactImportReport)
131
- {
132
- Console.WriteLine();
133
- foreach (KeyValuePair<string, string> pair in contactImportReport)
134
- {
135
- Console.WriteLine("{0,-20} = {1}", pair.Key, pair.Value);
136
- }
137
- }
138
-
139
- private static String ReadResultAsString(WebRequest request)
140
- {
141
- String result;
142
-
143
- using (WebResponse response = request.GetResponse())
144
- {
145
- using (StreamReader reader = new StreamReader(response.GetResponseStream()))
146
- {
147
- result = reader.ReadToEnd();
148
- }
149
- }
150
-
151
- return result;
152
- }
153
-
154
- private static TResult ReadResult<TResult>(WebRequest request)
155
- {
156
- TResult result;
157
-
158
- using (WebResponse response = request.GetResponse())
159
- {
160
- using (StreamReader reader = new StreamReader(response.GetResponseStream()))
161
- {
162
- JsonSerializer serializer = new JsonSerializer();
163
- using (JsonTextReader jsonReader = new JsonTextReader(reader))
164
- {
165
- result = serializer.Deserialize<TResult>(jsonReader);
166
- }
167
- }
168
- }
169
-
170
- return result;
171
- }
172
-
173
- private static void PrintUnhandledException(object sender, UnhandledExceptionEventArgs e)
174
- {
175
- Console.WriteLine(e.ExceptionObject);
176
- }
177
- }
178
- }
179
- *
180
- *
181
- *
182
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Helper/Data.php DELETED
@@ -1,96 +0,0 @@
1
- <?php
2
- /*
3
- * empty helper to keep admin from breaking
4
- */
5
- class Dotdigitalgroup_Email_Helper_Data extends Mage_Core_Helper_Abstract
6
- {
7
- const XML_PATH_PASSCODE = 'connector_advanced_settings/external/passcode';
8
- const XML_PATH_LAST_ORDER_NO = 'connector_data_field_settings/customer_data/last_order_no';
9
- const XML_PATH_MAPPING_CUSTOMER_ID = 'connector_data_field_settings/customer_data/customer_id';
10
- const XML_PATH_ENABLED_LOGS = 'connector_advanced_settings/admin/debug';
11
-
12
-
13
- /**
14
- * return the time scheldule for the cronjob
15
- * @param $code
16
- * @return mixed
17
- */
18
- public function getSchelduledAtCronjob($code)
19
- {
20
- /* @var $collection Mage_Cron_Model_Resource_Schedule_Collection */
21
- $collection = Mage::getModel('cron/schedule')->getCollection();
22
- $collection->addFieldToFilter('job_code', $code)
23
- ->addFieldToFilter('status', Mage_Cron_Model_Schedule::STATUS_PENDING)
24
- ->addOrder('scheduled_at', Varien_Data_Collection_Db::SORT_ORDER_DESC)
25
- ->getSelect()->limit(1);
26
- $schedule = $collection->getFirstItem();
27
-
28
- $scheduleAt = $schedule->getData('scheduled_at');
29
-
30
- return $scheduleAt;
31
- }
32
-
33
- public function auth($authRequest)
34
- {
35
- if($authRequest == Mage::getStoreConfig(self::XML_PATH_PASSCODE)){
36
- return true;
37
- }
38
-
39
- if($this->isEnabledLogs())
40
- $this->log('authenication failed : ' . $authRequest , null, 'auth.log');
41
- exit();
42
- }
43
-
44
- public function getMappedCustomerId()
45
- {
46
- return Mage::getStoreConfig(self::XML_PATH_MAPPING_CUSTOMER_ID);
47
- }
48
-
49
- public function getPasscode()
50
- {
51
- return Mage::getStoreConfig(self::XML_PATH_PASSCODE);
52
- }
53
-
54
- public function getLastOrderNo()
55
- {
56
- return Mage::getStoreConfig(self::XML_PATH_LAST_ORDER_NO);
57
-
58
- }
59
-
60
- public function log($data, $level = Zend_Log::DEBUG, $filename = 'api.log')
61
- {
62
- if($this->isEnabledLogs()){
63
- $filename = 'connector_' . $filename;
64
-
65
- Mage::log($data, $level, $filename, $force = true);
66
- }
67
- }
68
-
69
- public function isEnabledLogs()
70
- {
71
- return (bool) Mage::getStoreConfig(self::XML_PATH_ENABLED_LOGS);
72
- }
73
-
74
- public function isOrderTransactionalEnabled()
75
- {
76
- return (bool) Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED);
77
- }
78
-
79
- public function isCustomerSyncEnabled()
80
- {
81
- return (bool) Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMER_SYNC_ENABLE);
82
- }
83
-
84
- public function getConnectorVersion()
85
- {
86
-
87
- $modules = (array) Mage::getConfig()->getNode('modules')->children();
88
-
89
- if(isset($modules['Dotdigitalgroup_Email'])){
90
-
91
- $moduleName = $modules['Dotdigitalgroup_Email'];
92
- return $moduleName->version;
93
- }
94
- return '';
95
- }
96
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Helper/Recommended.php DELETED
@@ -1,191 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Helper_Recommended extends Mage_Core_Helper_Abstract
4
- {
5
- const XML_PATH_RELATED_PRODUCTS_TYPE = 'dynamic_content/products/related_display_type';
6
- const XML_PATH_UPSELL_PRODUCTS_TYPE = 'dynamic_content/products/upsell_display_type';
7
- const XML_PATH_CROSSSELL_PRODUCTS_TYPE = 'dynamic_content/products/crosssell_display_type';
8
- const XML_PATH_BESTSELLER_PRODUCT_TYPE = 'dynamic_content/products/best_display_type';
9
- const XML_PATH_MOSTVIEWED_PRODUCT_TYPE = 'dynamic_content/products/most_viewed_display_type';
10
- const XML_PATH_RECENTLYVIEWED_PRODUCT_TYPE = 'dynamic_content/products/recently_viewed_display_type';
11
- const XML_PATH_PRODUCTPUSH_TYPE = 'dynamic_content/manual_product_search/display_type';
12
-
13
-
14
- const XML_PATH_RELATED_PRODUCTS_ITEMS = 'dynamic_content/products/related_items_to_display';
15
- const XML_PATH_UPSELL_PRODUCTS_ITEMS = 'dynamic_content/products/upsell_items_to_display';
16
- const XML_PATH_CROSSSELL_PRODUCTS_ITEMS = 'dynamic_content/products/crosssell_items_to_display';
17
- const XML_PATH_BESTSELLER_PRODUCT_ITEMS = 'dynamic_content/products/best_items_to_display';
18
- const XML_PATH_MOSTVIEWED_PRODUCT_ITEMS = 'dynamic_content/products/most_viewed_items_to_display';
19
- const XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS = 'dynamic_content/products/recently_viewed_items_to_display';
20
- const XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS = 'dynamic_content/manual_product_search/items_to_display';
21
-
22
-
23
- const XML_PATH_BESTSELLER_TIME_PERIOD = 'dynamic_content/products/best_time_period';
24
- const XML_PATH_MOSTVIEWED_TIME_PERIOD = 'dynamic_content/products/most_viewed_time_period';
25
-
26
- const XML_PATH_FALLBACK_PRODUCTS_ITEMS = 'dynamic_content/fallback_products/product_list';
27
-
28
- const XML_PATH_PRODUCTPUSH_ITEMS = 'dynamic_content/manual_product_search/products_push_list';
29
-
30
- public $periods = array('week', 'month', 'year');
31
-
32
-
33
- /**
34
- * product recommendation type
35
- * @var string
36
- */
37
-
38
-
39
- /**
40
- * Dispay mode
41
- * @return mixed|string grid:list
42
- */
43
- public function getMode()
44
- {
45
- $mode = Mage::app()->getRequest()->getParam('mode');
46
- $type = '';
47
- if($mode){
48
- switch($mode){
49
- case 'related':
50
- $type = $this->getRelatedProductsType();
51
- break;
52
- case 'upsell':
53
- $type = $this->getUpsellProductsType();
54
- break;
55
- case 'crosssell':
56
- $type = $this->getCrosssellProductsType();
57
- break;
58
- case 'bestsellers':
59
- $type = $this->getBestSellerProductsType();
60
- break;
61
- case 'mostviewed':
62
- $type = $this->getMostViewedProductsType();
63
- break;
64
- case 'recentlyviewed':
65
- $type = $this->getRecentlyviewedProductsType();
66
- break;
67
- case 'productpush':
68
- $type = $this->getProductpushProductsType();
69
- }
70
- }
71
-
72
- return $type;
73
- }
74
-
75
- public function getRelatedProductsType($storeId = 0)
76
- {
77
- return Mage::getStoreConfig(self::XML_PATH_RELATED_PRODUCTS_TYPE, $storeId);
78
- }
79
-
80
- public function getUpsellProductsType($storeId = 0)
81
- {
82
- return Mage::getStoreConfig(self::XML_PATH_UPSELL_PRODUCTS_TYPE, $storeId);
83
-
84
- }
85
-
86
- public function getCrosssellProductsType($storeId = 0)
87
- {
88
- return Mage::getStoreConfig(self::XML_PATH_CROSSSELL_PRODUCTS_TYPE, $storeId);
89
- }
90
-
91
- public function getBestSellerProductsType($storeId = 0)
92
- {
93
- return Mage::getStoreConfig(self::XML_PATH_BESTSELLER_PRODUCT_TYPE, $storeId);
94
- }
95
-
96
- public function getMostViewedProductsType($storeId = 0)
97
- {
98
- return Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_PRODUCT_TYPE, $storeId);
99
- }
100
-
101
- public function getRecentlyviewedProductsType($storeId = 0)
102
- {
103
- return Mage::getStoreConfig(self::XML_PATH_RECENTLYVIEWED_PRODUCT_TYPE, $storeId);
104
- }
105
-
106
- public function getProductpushProductsType($storeId = 0)
107
- {
108
- return Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_TYPE, $storeId);
109
- }
110
-
111
-
112
-
113
- /**
114
- * Limit of products displayed
115
- * @return int|mixed
116
- */
117
- public function getLimit()
118
- {
119
- $mode = Mage::registry('mode');
120
- $limit = 0;
121
- if($mode){
122
- switch($mode){
123
- case 'related':
124
- $limit = Mage::getStoreConfig(self::XML_PATH_RELATED_PRODUCTS_ITEMS);
125
- break;
126
- case 'upsell':
127
- $limit = Mage::getStoreConfig(self::XML_PATH_UPSELL_PRODUCTS_ITEMS);
128
- break;
129
- case 'crosssell':
130
- $limit = Mage::getStoreConfig(self::XML_PATH_CROSSSELL_PRODUCTS_ITEMS);
131
- break;
132
- case 'bestsellers':
133
- $limit = Mage::getStoreConfig(self::XML_PATH_BESTSELLER_PRODUCT_ITEMS);
134
- break;
135
- case 'mostviewed':
136
- $limit = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_PRODUCT_ITEMS);
137
- break;
138
- case 'recentlyviewed':
139
- $limit = Mage::getStoreConfig(self::XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS);
140
- break;
141
- case 'productpush':
142
- $limit = Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS);
143
- }
144
- }
145
-
146
- return $limit;
147
- }
148
-
149
- public function getFallbackIds(){
150
- $fallbackIds = Mage::getStoreConfig(self::XML_PATH_FALLBACK_PRODUCTS_ITEMS);
151
- if($fallbackIds)
152
- return explode(',', Mage::getStoreConfig(self::XML_PATH_FALLBACK_PRODUCTS_ITEMS));
153
- return array();
154
- }
155
-
156
- public function getTimeFromConfig($config)
157
- {
158
- $now = new Zend_Date();
159
- $period = '';
160
- if($config == 'mostviewed')
161
- $period = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_TIME_PERIOD);
162
- elseif($config == 'bestsellers')
163
- $period = Mage::getStoreConfig(self::XML_PATH_BESTSELLER_TIME_PERIOD);
164
- elseif($config == 'recentlyviewed')
165
- $period = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_TIME_PERIOD);
166
-
167
- if($period == 'week'){
168
- $sub = Zend_Date::WEEK;
169
- }elseif($period == 'month'){
170
- $sub = Zend_Date::MONTH;
171
- }elseif($period == 'year'){
172
- $sub = Zend_Date::YEAR;
173
- }
174
-
175
- if(isset($sub)){
176
- $period = $now->sub(1, $sub);
177
-
178
- return $period->tostring(Zend_Date::ISO_8601);
179
- }
180
- }
181
-
182
- public function getProductPushIds($storeId = 0)
183
- {
184
- $productIds = Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_ITEMS, $storeId);
185
-
186
- return explode(',', $productIds);
187
-
188
- }
189
-
190
-
191
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Account/Test.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Account_Test extends Dotdigitalgroup_Email_Model_Api_Rest
4
- {
5
- const TEST_API_USERNAME = 'apiuser-2c692ba1bbd2@apiconnector.com';
6
- const TEST_API_PASSWORD = 'Magento2013';
7
- const TEST_API_CAMPAIGN = '2643928';
8
- const TEST_CONTACT_ID = '13';
9
- const TEST_CONTACT_EMAIL = 'ben.staveley@dotmailer.co.uk';
10
-
11
- public function test($api_user = null, $api_password = null)
12
- {
13
- if($api_user && $api_password){
14
- $this->_api_user = $api_user;
15
- $this->_api_password = $api_password;
16
- }
17
- $response = array('errors' => 0, 'message' => '');
18
- $result = $this->testAccount();
19
- if(!$result){
20
- $response['errors'] = true;
21
- $response['message'] = 'Invalid API Credentials.';
22
- }
23
- $this->sendInstallConfirmation();
24
-
25
- return $response;
26
- }
27
-
28
- public function sendInstallConfirmation()
29
- {
30
- $this->_api_user = self::TEST_API_USERNAME;
31
- $this->_api_password = self::TEST_API_PASSWORD;
32
- $testEmail = self::TEST_CONTACT_EMAIL;
33
- $contactId = self::TEST_CONTACT_ID;
34
- $campaignId = self::TEST_API_CAMPAIGN;
35
-
36
- // send initial info
37
- $this->sendIntallInfo($testEmail, $contactId, $campaignId);
38
-
39
- }
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Api/Rest.php DELETED
@@ -1,729 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Api_Rest extends Mage_Core_Model_Abstract
4
- {
5
- const REST_WAIT_UPLOAD_TIME = 5;
6
- //rest api data
7
- const REST_ACCOUNT_INFO = 'https://apiconnector.com/v2/account-info';
8
- const REST_CONTACTS = 'https://apiconnector.com/v2/contacts/';
9
- const REST_CONTACTS_IMPORT = 'https://apiconnector.com/v2/contacts/import/';
10
- const REST_ADDRESS_BOOKS = 'https://apiconnector.com/v2/address-books';
11
- const REST_DATA_FILEDS = 'https://apiconnector.com/v2/data-fields';
12
- const REST_TRANSACTIONAL_DATA_IMPORT = 'https://apiconnector.com/v2/contacts/transactional-data/import/';
13
- const REST_SINGLE_TRANSACTIONAL_DATA_IMPORT = 'https://apiconnector.com/v2/contacts/transactional-data/';
14
- const REST_CAMPAIGN_SEND = 'https://apiconnector.com/v2/campaigns/send';
15
- const REST_CONTACTS_SUPPRESSED_SINCE = 'https://apiconnector.com/v2/contacts/suppressed-since/';
16
- const REST_DATA_FIELDS_CAMPAIGNS = 'https://apiconnector.com/v2/campaigns';
17
- const REST_SMS_MESSAGE_SEND_TO = 'https://apiconnector.com/v2/sms-messages/send-to/';
18
- //rest error responces
19
- const REST_CONTACT_NOT_FOUND = 'Error: ERROR_CONTACT_NOT_FOUND';
20
- const REST_STATUS_IMPORT_REPORT_NOT_FOUND = 'Import is not processed yet or completed with error. ERROR_IMPORT_REPORT_NOT_FOUND';
21
- const REST_STATUS_REPORT_NOTFINISHED = 'NotFinished';
22
- const REST_TRANSACTIONAL_DATA_NOT_EXISTS = 'Error: ERROR_TRANSACTIONAL_DATA_DOES_NOT_EXIST';
23
- const REST_API_USAGE_EXCEEDED = 'Your account has generated excess API activity and is being temporarily capped. Please contact support. ERROR_APIUSAGE_EXCEEDED';
24
-
25
- protected $_api_user;
26
- protected $_api_password;
27
- protected $_customers_file_slug = 'customer_sync';
28
- protected $_subscribers_file_slug = 'subscriber_sync';
29
- protected $_api_helper;
30
- protected $_subscribers_address_book_id;
31
- protected $_customers_address_book_id;
32
- protected $_filename;
33
- protected $_subscribers_filename;
34
- protected $_customers_filename;
35
- protected $_limit = 10;
36
- protected $_address_book_id;
37
- public $fileHelper; /** @var Dotdigitalgroup_Email_Helper_File */
38
- protected $_helper;
39
- public $result = array('error' => false, 'message' => '');
40
- protected $_log_filename = 'api.log';
41
-
42
- public function __construct()
43
- {
44
- // connect to default
45
- $this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
46
- $this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
47
- $this->_helper = Mage::helper('connector');
48
- }
49
-
50
- /**
51
- * Deletes all contacts from a given address book.
52
- * @param $addressBooks
53
- * @return mixed
54
- */
55
- protected function deleteAddressBookContacts($addressBooks) {
56
-
57
- foreach ($addressBooks as $addressBookId) {
58
-
59
- // skip if contact Id is null otherwise the API will delete ALL contacts from the address book!!!
60
- if ($addressBookId==null) continue;
61
- $ch = curl_init("https://apiconnector.com/v2/address-books/{$addressBookId}/contacts/");
62
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
63
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
64
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
65
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
66
-
67
- // delete the contact from the address book
68
- $result = curl_exec($ch);
69
- $result = json_decode($result);
70
- }
71
- }
72
-
73
-
74
- /**
75
- * Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel.
76
- * Must include one column called "Email". Any other columns will attempt to map to your custom data fields.
77
- * The ID of returned object can be used to query import progress.
78
- * @param $filename
79
- * @param $addressBookId
80
- * @return mixed
81
- */
82
- protected function postAddressBookContactsImport($filename, $addressBookId)
83
- {
84
- // ...the API request
85
- $uploadUrl = "https://apiconnector.com/v2/address-books/{$addressBookId}/contacts/import";
86
- $ch = curl_init($uploadUrl);
87
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
88
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
89
- curl_setopt($ch, CURLOPT_POSTFIELDS, array (
90
- 'file' => '@'.$this->fileHelper->getFilePath($filename)
91
- ));
92
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
93
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
94
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
95
- 'Content-Type: multipart/form-data')
96
- );
97
- // send contacts to address book
98
- $result = curl_exec($ch);
99
- $result = json_decode($result);
100
-
101
- return $result;
102
- }
103
-
104
- /**
105
- * Adds a contact to a given address book.
106
- * @param $addressBookId
107
- * @param $contactAPI
108
- * @return mixed
109
- */
110
- public function postAddressBookContacts($addressBookId, $contactAPI)
111
- {
112
- $data_string = json_encode($contactAPI);
113
- $url = self::REST_ADDRESS_BOOKS . '/' . $addressBookId . '/contacts';
114
- $ch = curl_init($url);
115
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
116
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
117
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
118
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
119
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
120
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
121
- 'Content-Type: application/json',
122
- 'Content-Length: ' . strlen($data_string))
123
- );
124
-
125
- // send campaign
126
- $result = curl_exec($ch);
127
- $result = json_decode($result);
128
-
129
- return $result;
130
- }
131
-
132
- /**
133
- * Deletes all contacts from a given address book.
134
- * @param $addressBookId
135
- * @param $contactId
136
- */
137
- public function deleteAddressBookContact($addressBookId, $contactId)
138
- {
139
- $url = self::REST_ADDRESS_BOOKS . '/' . $addressBookId . '/contacts/' . $contactId;
140
- $ch = curl_init($url);
141
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
142
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
143
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
144
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
145
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
146
- 'Content-Type: application/json'
147
- ));
148
- $result = curl_exec($ch);
149
- }
150
-
151
- /**
152
- * Gets a report with statistics about what was successfully imported, and what was unable to be imported.
153
- * @param $importId
154
- * @return mixed
155
- */
156
- public function getContactsImportReport($importId)
157
- {
158
- $reportUrl = self::REST_CONTACTS_IMPORT . "{$importId}/report";
159
- $ch = curl_init($reportUrl);
160
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
161
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
162
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
163
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
164
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
165
- 'Content-Type: application/json')
166
- );
167
- // get the report
168
- $result = curl_exec($ch);
169
- $result = json_decode($result);
170
- return $result;
171
- }
172
-
173
- public function getContacts($skip = 0, $limit = 1000)
174
- {
175
- $allContactsUrl = self::REST_CONTACTS . '?select=' . $limit . '&skip=' . $skip;
176
- $ch = curl_init($allContactsUrl);
177
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
178
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
179
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
180
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
181
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
182
- 'Content-Type: application/json'
183
- ));
184
- $data = curl_exec($ch);
185
- $result = json_decode($data);
186
-
187
- return $result;
188
- }
189
-
190
- public function getContactByEmail($email)
191
- {
192
- $contactInfoUrl = self::REST_CONTACTS . $email;
193
- $ch = curl_init($contactInfoUrl);
194
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
195
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
196
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
197
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
198
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
199
- 'Content-Type: application/json'
200
- ));
201
-
202
- $data = curl_exec($ch);
203
- $result = json_decode($data);
204
-
205
- return $result;
206
- }
207
- public function getContactById($contactId)
208
- {
209
- $contactInfoUrl = self::REST_CONTACTS . $contactId;
210
- $ch = curl_init($contactInfoUrl);
211
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
212
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
213
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
214
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
215
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
216
- 'Content-Type: application/json'
217
- ));
218
-
219
- $data = curl_exec($ch);
220
- $result = json_decode($data);
221
-
222
- return $result;
223
- }
224
-
225
- /**
226
- * Creates an address book.
227
- * @return mixed
228
- */
229
- public function postAddressBooks()
230
- {
231
- $contactInfoUrl = self::REST_ADDRESS_BOOKS;
232
- $ch = curl_init($contactInfoUrl);
233
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
234
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
235
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
236
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
237
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
238
- 'Content-Type: application/json'
239
- ));
240
- $data = curl_exec($ch);
241
- $result = json_decode($data);
242
- return $result;
243
- }
244
-
245
- /**
246
- * Creates a campaign.
247
- * @return mixed
248
- */
249
- protected function postCampaigns(){
250
- $contactInfoUrl = self::REST_DATA_FIELDS_CAMPAIGNS;
251
- $ch = curl_init($contactInfoUrl);
252
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
253
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
254
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
255
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
256
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
257
- 'Content-Type: application/json'
258
- ));
259
- $data = curl_exec($ch);
260
- $result = json_decode($data);
261
- return $result;
262
- }
263
-
264
- /**
265
- * Creates a data field within the account.
266
- * @return mixed
267
- */
268
- protected function postDataFields() {
269
- $contactInfoUrl = self::REST_DATA_FILEDS;
270
- $ch_contact = curl_init($contactInfoUrl);
271
- curl_setopt($ch_contact, CURLOPT_CUSTOMREQUEST, 'GET');
272
- curl_setopt($ch_contact, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
273
- curl_setopt($ch_contact, CURLOPT_RETURNTRANSFER, true);
274
- curl_setopt($ch_contact, CURLOPT_SSL_VERIFYPEER, false);
275
- curl_setopt($ch_contact, CURLOPT_HTTPHEADER, array(
276
- 'Content-Type: application/json'
277
- ));
278
- $data = curl_exec($ch_contact);
279
- $result = json_decode($data);
280
- return $result;
281
- }
282
-
283
- /**
284
- * Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel.
285
- * Must include one column called "Email". Any other columns will attempt to map to your custom data fields.
286
- * The ID of returned object can be used to query import progress.
287
- * @param bool $waitFinished
288
- * @return mixed
289
- */
290
- private function postContactsImport($waitFinished = false){
291
- $importUrl = self::REST_CONTACTS_IMPORT;
292
- $ch = curl_init($importUrl);
293
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
294
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
295
- curl_setopt($ch, CURLOPT_POSTFIELDS, array (
296
- 'file' => '@'.$this->getFilePath($this->_filename)
297
- ));
298
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
299
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
300
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
301
- 'Content-Type: multipart/form-data')
302
- );
303
- $result = curl_exec($ch);
304
- $result = json_decode($result);
305
-
306
- if($waitFinished)
307
- $this->waitFinishedImport($result->id);
308
- return $result;
309
- }
310
- public function updateContact($contactId, $data)
311
- {
312
- $data_string = json_encode($data);
313
- $contactInfoUrl = self::REST_CONTACTS . $contactId;
314
- $ch = curl_init($contactInfoUrl);
315
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
316
- curl_setopt($ch, CURLOPT_POST, true);
317
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
318
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
319
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
320
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
321
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
322
- 'Content-Type: application/json',
323
- 'Content-Length: ' . strlen($data_string))
324
- );
325
- $data = curl_exec($ch);
326
- $result = json_decode($data);
327
- return $result;
328
- }
329
-
330
- /**
331
- * Send connector campaings
332
- * @param $campaignId
333
- * @param $contacts
334
- * @return mixed
335
- */
336
- public function sendCampaign($campaignId, $contacts)
337
- {
338
- $data = array(
339
- 'username' => $this->_api_user,
340
- 'password' => $this->_api_password,
341
- "campaignId" => $campaignId,
342
- "ContactIds" => $contacts
343
- );
344
-
345
- $this->_helper->log($data, null, $this->_log_filename);
346
- $data_string = json_encode($data);
347
- $campaignUrl = self::REST_CAMPAIGN_SEND;
348
- $ch = curl_init($campaignUrl);
349
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
350
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
351
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
352
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
353
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
354
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
355
- 'Content-Type: application/json',
356
- 'Content-Length: ' . strlen($data_string))
357
- );
358
-
359
- // send campaign
360
- $result = curl_exec($ch);
361
- $result = json_decode($result);
362
- $this->_helper->log($result, null, $this->_log_filename);
363
-
364
- return $result;
365
- }
366
- private function waitFinishedImport($importId){
367
-
368
- do{
369
- // wait until do the report status call
370
- sleep(self::REST_WAIT_UPLOAD_TIME);
371
- // ...the API request
372
- // Create a GET request
373
-
374
- $reportUrl = self::REST_CONTACTS_IMPORT . "{$importId}/report";
375
- $ch = curl_init($reportUrl);
376
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
377
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
378
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
379
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
380
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
381
- 'Content-Type: application/json')
382
- );
383
-
384
- // get the report
385
- $result = curl_exec($ch);
386
- $result = json_decode($result);
387
-
388
- }while(isset($result->message) && $result->message == self::REST_STATUS_REPORT_NOTFINISHED);
389
-
390
- }
391
-
392
- /**
393
- * create new connector contact
394
- * @param $email
395
- * @return mixed
396
- */
397
- public function createNewContact($email)
398
- {
399
- $data = array(
400
- 'Email' => $email,
401
- 'EmailType' => 'Html'
402
- );
403
- $data_string = json_encode($data);
404
- $ch = curl_init(self::REST_CONTACTS);
405
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
406
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
407
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
408
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
409
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
410
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
411
- 'Content-Type: application/json',
412
- 'Content-Length: ' . strlen($data_string))
413
- );
414
- $result = curl_exec($ch);
415
- $result = json_decode($result);
416
-
417
- return $result;
418
- }
419
-
420
- public function sendIntallInfo($testEmail, $contactId, $campaignId)
421
- {
422
- $numProducts = Mage::getModel('catalog/product')->getCollection()->getSize();
423
- $numCustomers = Mage::getModel('customer/customer')->getCollection()->getSize();
424
-
425
- $data = array(
426
- 'Email' => $testEmail,
427
- 'EmailType' => 'Html',
428
- 'DataFields' => array(
429
- array(
430
- 'Key' => 'INSTALLCUSTOMERS',
431
- 'Value' => (string)$numCustomers),
432
- array(
433
- 'Key' => 'INSTALLPRODUCTS',
434
- 'Value' => (string)$numProducts),
435
- array(
436
- 'Key' => 'INSTALLURL',
437
- 'Value' => Mage::getBaseUrl()),
438
- array(
439
- 'Key' => 'INSTALLAPI',
440
- 'Value' => implode(',' , $this->getWebsiteAccounts())),
441
- array(
442
- 'Key' => 'PHPMEMORY',
443
- 'Value' => ini_get('memory_limit') . ', V=' . Mage::helper('connector')->getConnectorVersion()
444
- )
445
- )
446
- );
447
-
448
- $this->updateContact($contactId, $data);
449
- $this->sendCampaign($campaignId, array($contactId));
450
-
451
- return ;
452
- }
453
- private function getWebsiteAccounts()
454
- {
455
- $accounts = array();
456
- $websites = Mage::app()->getWebsites();
457
- foreach ($websites as $website) {
458
- $websiteId = $website->getWebsiteId();
459
- $websiteModel = Mage::app()->getWebsite($websiteId);
460
- $apiUsername = $websiteModel->getConfig('connector_api_settings/api_credentials/username');
461
- if(! in_array($apiUsername, $accounts))
462
- $accounts[] = $apiUsername;
463
- }
464
- return $accounts;
465
- }
466
-
467
- protected function getSuppressedSince($dateString)
468
- {
469
- $suppressedUrl = self::REST_CONTACTS_SUPPRESSED_SINCE . $dateString;
470
- $ch = curl_init($suppressedUrl);
471
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
472
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
473
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
474
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
475
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
476
- 'Content-Type: application/json'
477
- ));
478
-
479
- // get the list of suppressed contacts
480
- $data = curl_exec($ch);
481
- $data = json_decode($data);
482
-
483
- return $data;
484
-
485
- }
486
- public function sendMultiTransactionalData($ordersData, $collectionName = 'Order')
487
- {
488
- $orders = array();
489
- foreach ($ordersData as $order) {
490
- if(isset($order->connector_id)){
491
- $orders[] = array(
492
- 'Key' => $order->id,
493
- 'ContactIdentifier' => $order->connector_id,
494
- 'Json' => json_encode($order->expose())
495
- );
496
- }
497
- }
498
-
499
- $data_string = json_encode($orders);
500
- $transactionalUrl = self::REST_TRANSACTIONAL_DATA_IMPORT . $collectionName;
501
-
502
- $ch = curl_init($transactionalUrl);
503
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
504
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
505
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
506
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
507
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
508
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
509
- 'Content-Type: application/json',
510
- 'Content-Length: ' . strlen($data_string))
511
- );
512
-
513
- // send contacts to connector
514
- $result = curl_exec($ch);
515
- $result = json_decode($result);
516
-
517
- return $result;
518
- }
519
- protected function sendTransactionalData($quoteData, $collectionName = 'Basket')
520
- {
521
- // check if the transactional data is already set
522
- $transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $quoteData->id ;
523
- $ch = curl_init($transactionalUrl);
524
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
525
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
526
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
527
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
528
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
529
- 'Content-Type: application/json'
530
- ));
531
- $result = curl_exec($ch);
532
- $result = json_decode($result);
533
-
534
- if(isset($result->message) && $result->message == self::REST_TRANSACTIONAL_DATA_NOT_EXISTS)
535
- $transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName ;
536
- else
537
- $transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $result->key ;
538
-
539
-
540
- $data = array(
541
- 'Key' => $quoteData->id,
542
- 'ContactIdentifier' => $quoteData->connector_id,
543
- 'Json' => json_encode($quoteData->expose())
544
- );
545
-
546
-
547
- $data_string = json_encode($data);
548
-
549
- $ch = curl_init($transactionalUrl);
550
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
551
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
552
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
553
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
554
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
555
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
556
- 'Content-Type: application/json',
557
- 'Content-Length: ' . strlen($data_string))
558
- );
559
-
560
- // send contacts to connector
561
- $result = curl_exec($ch);
562
- $result = json_decode($result);
563
-
564
- return $result;
565
- }
566
-
567
- public function sendOrderTransactionalData($order, $collectionName = 'Order', $key = '')
568
- {
569
- $data = array(
570
- 'Key' => $order->id,
571
- 'ContactIdentifier' => $order->connector_id,
572
- 'Json' => json_encode($order->expose())
573
- );
574
-
575
-
576
- $data_string = json_encode($data);
577
-
578
- $transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $key;
579
-
580
- $ch = curl_init($transactionalUrl);
581
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
582
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
583
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
584
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
585
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
586
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
587
- 'Content-Type: application/json',
588
- 'Content-Length: ' . strlen($data_string))
589
- );
590
-
591
- // send contacts to connector
592
- $result = curl_exec($ch);
593
- $result = json_decode($result);
594
-
595
- if(! isset($result->message)){
596
- $this->removeTransactionalData($order->connector_id, 'Basket');
597
- }
598
-
599
- return $result;
600
- }
601
- public function deleteContactsTransactionalData($collectionName = 'Order', $key = '')
602
- {
603
-
604
- $transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $key;
605
-
606
- $ch = curl_init($transactionalUrl);
607
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
608
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
609
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
610
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
611
-
612
- // send contacts to connector
613
- $result = curl_exec($ch);
614
- $result = json_decode($result);
615
-
616
-
617
- return $result;
618
- }
619
-
620
- public function removeTransactionalData($contactId, $collectionName)
621
- {
622
- $transactionalUrl = 'https://apiconnector.com/v2/contacts/' . $contactId . '/transactional-data/' . $collectionName ;
623
- $ch = curl_init($transactionalUrl);
624
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
625
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
626
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
627
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
628
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
629
- 'Content-Type: application/json'
630
- ));
631
- $result = curl_exec($ch);
632
-
633
- }
634
-
635
- public function testAccount()
636
- {
637
- $url = self::REST_ACCOUNT_INFO;
638
- $ch = curl_init($url);
639
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
640
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
641
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
642
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
643
- $result = curl_exec($ch);
644
- $result = json_decode($result);
645
- if(isset($result->message)){
646
- return false;
647
- }
648
-
649
- return true;
650
- }
651
-
652
- public function getAddressBookContacts($bookId, $skip = 0)
653
- {
654
- /**
655
- * https://apiconnector.com/v2/address-books/{addressBookId}/contacts?withFullData={withFullData}&select={select}&skip={skip}
656
- */
657
- $url = self::REST_ADDRESS_BOOKS . '/' . $bookId . '/contacts' . '?skip=' . $skip;
658
-
659
- $ch = curl_init($url);
660
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
661
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
662
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
663
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
664
- $result = curl_exec($ch);
665
- $result = json_decode($result);
666
- return $result;
667
-
668
- }
669
-
670
- /**
671
- * Send a single SMS message.
672
- * @param $number
673
- * @param $message
674
- * @return mixed
675
- */
676
- public function postSmsMessagesSendTo($telephoneNumber, $message)
677
- {
678
- $data = array('Message' => $message);
679
- $data_string = json_encode($data);
680
- $ch = curl_init(self::REST_SMS_MESSAGE_SEND_TO . $telephoneNumber);
681
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
682
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
683
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
684
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
685
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
686
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
687
- 'Content-Type: application/json',
688
- 'Content-Length: ' . strlen($data_string))
689
- );
690
- $result = curl_exec($ch);
691
- $result = json_decode($result);
692
- return $result;
693
- }
694
-
695
- public function postContactsTransactionalDataImport($collectionName, $data = array())
696
- {
697
- $import = array();
698
-
699
- foreach ($data as $one) {
700
-
701
- $import[] = array(
702
- 'Key' => $one->getId(),
703
- 'ContactIdentifier' => $one->getCustomerId(),
704
- 'Json' => json_encode($one->expose())
705
- );
706
- }
707
-
708
- $data_string = json_encode($import);
709
-
710
- $transactionalUrl = self::REST_TRANSACTIONAL_DATA_IMPORT . $collectionName;
711
-
712
- $ch = curl_init($transactionalUrl);
713
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
714
- curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
715
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
716
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
717
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
718
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
719
- 'Content-Type: application/json',
720
- 'Content-Length: ' . strlen($data_string))
721
- );
722
-
723
- // send contacts to connector
724
- $result = curl_exec($ch);
725
- $result = json_decode($result);
726
-
727
- return $result;
728
- }
729
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Connector/Order.php DELETED
@@ -1,118 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Connector_Order
4
- {
5
- public $id;
6
- public $connector_id;
7
- public $customer_id;
8
- protected $store_name;
9
- protected $purchase_date;
10
- protected $delivery_address;
11
- protected $billing_address;
12
- protected $products = array();
13
- protected $order_subtotal;
14
- protected $discount_ammount;
15
- protected $order_total;
16
- public $quote_id;
17
-
18
- /**
19
- * set the order information
20
- * @param Mage_Sales_Model_Order $orderData
21
- */
22
- public function __construct(Mage_Sales_Model_Order $orderData)
23
- {
24
- $this->id = $orderData->getIncrementId();
25
- $this->store_name = $orderData->getStoreName();
26
-
27
- $created_at = new Zend_Date($orderData->getCreatedAt(), Zend_Date::ISO_8601);
28
- $this->purchase_date = $created_at->toString(Zend_Date::ISO_8601);
29
- $this->customer_id = $orderData->getCustomerId();
30
-
31
- $customerModel = Mage::getModel('customer/customer')->load($this->customer_id);
32
- if(!$customerModel->getDotmailerContactId()){
33
- Mage::helper('connector')->log('dotmailer id not found : ' . $customerModel->getDotmailerContactId() . ' ' . $this->customer_id . ' ' . $this->id);
34
- }
35
-
36
-
37
-
38
- $this->connector_id = $customerModel->getDotmailerContactId();
39
- $this->quote_id = $orderData->getQuoteId();
40
-
41
- /**
42
- * billing and shipping address
43
- */
44
- $deliveryData = $orderData->getShippingAddress()->getData();
45
- $this->delivery_address = array(
46
- 'delivery_address_1' => $this->getStreet($deliveryData['street'], 1),
47
- 'delivery_address_2' => $this->getStreet($deliveryData['street'], 2),
48
- 'delivery_city' => $deliveryData['city'],
49
- 'delivery_country' => $deliveryData['country_id'],
50
- 'delivery_postcode' => $deliveryData['postcode']
51
- );
52
- $billingData = $orderData->getBillingAddress()->getData();
53
- $this->billing_address = array(
54
- 'billing_address_1' => $this->getStreet($billingData['street'], 1),
55
- 'billing_address_2' => $this->getStreet($billingData['street'], 2),
56
- 'billing_city' => $billingData['city'],
57
- 'billing_country' => $billingData['country_id'],
58
- 'billing_postcode' => $billingData['postcode'],
59
- );
60
- //order products information
61
- $products = $orderData->getAllItems();
62
- $categories = array();
63
- foreach ($products as $productItem) {
64
- // product model
65
- $product = $productItem->getProduct();
66
- if($product){
67
- // category names
68
- $categoryCollection = $product->getCategoryCollection()
69
- ->addAttributeToSelect('name');
70
-
71
- foreach ($categoryCollection as $cat) {
72
- $categories[] = $cat->getName();
73
- }
74
- $categoryNames = implode(',', $categories);
75
- }
76
-
77
- $this->products[] = array(
78
- 'name' => $productItem->getName(),
79
- 'sku' => $productItem->getSku(),
80
- 'category' => $categoryNames,
81
- 'qty' => (int)number_format($productItem->getData('qty_ordered'), 2),
82
- 'price' => (float)number_format($productItem->getPrice(), 2),
83
- );
84
- }
85
- $this->order_subtotal = (float)number_format($orderData->getData('subtotal'), 2);
86
- $this->discount_ammount = (float)number_format($orderData->getData('discount_amount'), 2);
87
- $orderTotal = abs($orderData->getData('grand_total') - $orderData->getTotalRefunded());
88
- $this->order_total = (float)number_format($orderTotal, 2);
89
-
90
- }
91
- /**
92
- * get the street name by line number
93
- * @param $street
94
- * @param $line
95
- * @return string
96
- */
97
- private function getStreet($street, $line)
98
- {
99
- $street = explode("\n", $street);
100
- if($line == 1){
101
- return $street[0];
102
- }
103
- if(isset($street[$line -1])){
104
-
105
- return $street[$line - 1];
106
- }else{
107
-
108
- return '';
109
- }
110
- }
111
- // exposes the class as an array of objects
112
- public function expose() {
113
-
114
- return get_object_vars($this);
115
-
116
- }
117
-
118
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Connector/Quote.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Connector_Quote
4
- {
5
-
6
- public $id;
7
- public $connector_id;
8
- public $customer_id;
9
- protected $store_name;
10
- protected $create_date;
11
- protected $update_date;
12
- protected $delivery_address;
13
- protected $billing_address;
14
- protected $products = array();
15
- protected $order_subtotal;
16
- protected $order_total;
17
-
18
- /**
19
- * set the quote information
20
- * @param Mage_Sales_Model_Quote $quote
21
- */
22
- public function __construct(Mage_Sales_Model_Quote $quote)
23
- {
24
- $this->id = $quote->getId();
25
- $this->customer_id = $quote->getCustomerId();
26
- $customerModel = Mage::getModel('customer/customer')->load($this->customer_id);
27
- $this->connector_id = $customerModel->getData('dotmailer_contact_id');
28
-
29
- $this->store_name = $this->getStoreName($quote->getStoreId());
30
- $this->order_subtotal = (float)number_format($quote->getSubtotal(), 2);
31
- $this->order_total = (float)number_format($quote->getGrandTotal(), 2);
32
-
33
- $created_at = new Zend_Date($quote->getCreatedAt(), Zend_Date::ISO_8601);
34
- $updated_at = new Zend_Date($quote->getUpdatedAt(), Zend_Date::ISO_8601);
35
- $this->create_date = $created_at->toString(Zend_Date::ISO_8601);
36
- $this->update_date = $updated_at->toString(Zend_Date::ISO_8601);
37
-
38
- $items = $quote->getAllVisibleItems();
39
- foreach ($items as $product) {
40
- $this->products[] = array(
41
- 'name' => $product->getName(),
42
- 'sku' => $product->getSku(),
43
- 'category' => $this->getCategory($product),
44
- 'qty' => (float)number_format($product->getQty(), 2),
45
- 'price' => (float)number_format($product->getPrice(), 2)
46
- );
47
- }
48
- }
49
- private function getStoreName($storeId)
50
- {
51
- $storeModel = Mage::getModel('core/store')->load($storeId);
52
- return $storeModel->getName();
53
- }
54
- private function getCategory($product)
55
- {
56
- $product = Mage::getModel('catalog/product')->load($product->getProductId());
57
- $categories = $product->getCategoryCollection()
58
- ->addAttributeToSelect('name');
59
- $categoryNames = array();
60
- foreach ($categories as $cat) {
61
- $categoryNames[] = $cat->getName();
62
- }
63
-
64
- $categoryNames = implode(',', $categoryNames);
65
- return $categoryNames;
66
-
67
- }
68
- // exposes the class as an array of objects
69
- public function expose() {
70
-
71
- return get_object_vars($this);
72
-
73
- }
74
-
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Cron.php DELETED
@@ -1,58 +0,0 @@
1
- <?php
2
- class Dotdigitalgroup_Email_Model_Cron
3
- {
4
- /**
5
- * CRON FOR CUSTOMER SYNC
6
- */
7
- public function customersync()
8
- {
9
- if(Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMER_SYNC_ENABLE))
10
- Mage::getModel('connector/customer_customer')->sync();
11
- return;
12
- }
13
-
14
- /**
15
- * CRON FOR LOST BASKET
16
- */
17
- public function lostbasketssync()
18
- {
19
- //look for lost baskets
20
- Mage::getModel('connector/sales_quote')->proccessCampaigns();
21
- $helper = Mage::helper('connector');
22
- if($helper->isOrderTransactionalEnabled()){
23
- //send transactional data and mark as imported
24
- Mage::getModel('connector/sales_order')->sync();
25
- }
26
- if($helper->isCustomerSyncEnabled()){
27
- //check for customer that have no connector id
28
- $numUpdated = Mage::getModel('connector/customer_customer')->syncContacts();
29
- Mage::helper('connector')->log('SYNC CONTACTS : '. $numUpdated);
30
- }
31
- }
32
-
33
- /**
34
- * CRON FOR SUPRESSED CONTACTS
35
- */
36
- public function suppressedsync()
37
- {
38
- if(Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMER_SUPPRESSED_ENABLE)){
39
- //check suppressed contacts from connector
40
- Mage::getModel('connector/customer_suppressed')->unsubscribe();
41
- }
42
-
43
- }
44
-
45
- /**
46
- * CLEAN ARHIVED FOLDERS
47
- */
48
-
49
- public function cleaning()
50
- {
51
- $helper = Mage::helper('connector/file');
52
- $archivedFolder = $helper->getArchiveFolder();
53
- $result = $helper->deleteDir($archivedFolder);
54
- Mage::helper('connector')->log('Cleaning cronjob result : ' . $result, null, 'api.log');
55
- return $result;
56
- }
57
-
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Customer/Customer.php DELETED
@@ -1,480 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Customer_Customer extends Dotdigitalgroup_Email_Model_Api_Rest
4
- {
5
- // xml configuration
6
- const XML_PATH_CONNECTOR_API_USERNAME = 'connector_api_settings/api_credentials/username';
7
- const XML_PATH_CONNECTOR_API_PASSWORD = 'connector_api_settings/api_credentials/password';
8
- const XML_PATH_CUSTOMER_SYNC_ENABLE = 'connector_sync_settings/sync_customer_schedule/enabled';
9
- const XML_PATH_CUSTOMER_SYNC_LIMIT = 'connector_advanced_settings/sync_limits/contact';
10
- const XML_PATH_CUSTOMER_SUPPRESSED_ENABLE = 'connector_sync_settings/sync_suppressed_schedule/enabled';
11
- const XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID = 'connector_data_field_settings/address_book/customers';
12
- const XML_PATH_CUSTOMERS_SUPPRESSED_INTERVAL = 'connector_sync_settings/sync_suppressed_schedule/frequency';
13
- const XML_PATH_GUEST_ADDRESS_BOOK_ID = 'connector_data_field_settings/address_book/guest';
14
- const XML_PATH_CUSTOMER_WISHLIST_ENABLED = 'connector_sync_settings/transactional_data/wishlist_enabled';
15
-
16
- const FORCE_CUSTOMERS_YEARS = '10';
17
-
18
- protected $_customers_address_book_id;
19
- protected $_customers = array();
20
- protected $_mapping_hash;
21
- protected $_website; // website model
22
- private $countSubscribers = 0;
23
- private $countCustomers = 0;
24
-
25
- protected $accounts = array();// api accounts
26
- protected $wishlists = array();// wishlists
27
- protected $_proccessing;
28
- protected $_websiteId;
29
- public $apiLimit = 450;
30
-
31
- public function sync()
32
- {
33
- /** @var Dotdigitalgroup_Email_Helper_Data $helper */
34
- $helper = Mage::helper('connector');
35
- $helper->log('Start customer sync..', null, $this->_log_filename);
36
- $result = array('error' => false, 'message' => "Done.");
37
-
38
- // check for default settings to use memory limit
39
- if(Mage::getStoreConfig('connector_advanced_settings/admin/memory_limit'))
40
- $this->allowResourceFullExecution();
41
-
42
- // get all websites
43
- foreach(Mage::app()->getWebsites() as $website){
44
-
45
- // skip any actions if sync disabled
46
- if(! $website->getConfig(self::XML_PATH_CUSTOMER_SYNC_ENABLE))
47
- continue;
48
- //API credentials
49
- $this->_api_user = $website->getConfig(self::XML_PATH_CONNECTOR_API_USERNAME);
50
- $this->_api_password = $website->getConfig(self::XML_PATH_CONNECTOR_API_PASSWORD);
51
-
52
- if(strlen($this->_api_user) > 10 && strlen($this->_api_password)){
53
-
54
- $result = $this->exportCustomersForWebsite($website);
55
- if($website->getConfig(self::XML_PATH_CUSTOMER_WISHLIST_ENABLED)){
56
- $this->exportWishlistsForWebsite($website);
57
- }
58
- }else{
59
- $result['error'] = true;
60
- $message = 'The Credentials For Website :' . $website->getCode() . ' is not set!';
61
- $result['message'] = $message;
62
- $helper->log($message, null, $this->_log_filename);
63
- }
64
- }
65
- //set result check
66
- if($this->countCustomers != 0){
67
-
68
- $message = 'Total Exported : ' . $this->countCustomers . ' Customers, ' . $this->countSubscribers . ' Subscribers.';
69
-
70
- $result['message'] = $message;
71
- $helper->log($message, null, $this->_log_filename);
72
- }else{
73
- $result['error'] = true;
74
- $message = 'Check the logs for more information, the number of updated customers is : 0.';
75
- $result['message'] = $message;
76
- }
77
-
78
- $helper->log('Customer sync end!', null, $this->_log_filename);
79
- return $result;
80
- }
81
-
82
- /**
83
- * Get the customer for the website
84
- * @param bool $websiteId
85
- * @return mixed
86
- */
87
- public function getContactsCustomers($websiteId = false)
88
- {
89
- /** @var Mage_Customer_Model_Customer $customerCollection */
90
- $customerCollection = Mage::getModel('customer/customer')->getCollection()
91
- ->addAttributeToSelect('dotmailer_contact_id')
92
- ->addAttributeToFilter('dotmailer_contact_id', array('notnull' => true), 'left')
93
- ;
94
- if($websiteId !== false)
95
- $customerCollection->addAttributeToFilter('website_id', $websiteId);
96
-
97
- return $customerCollection;
98
- }
99
-
100
- private function countNumOfContacts($contacts)
101
- {
102
- $total = 0;
103
- // Get contacts number with contact id
104
- foreach ($contacts as $contact) {
105
- if($contact->getDotmailerContactId())
106
- $total++;
107
- }
108
- unset($contacts);
109
- return $total;
110
- }
111
-
112
- public function syncContacts()
113
- {
114
- $updated = 0;
115
- /**
116
- * Customers at website level
117
- */
118
- foreach (Mage::app()->getWebsites(true) as $website) {
119
- $websiteId = $website->getId();
120
- $missingContacts = $this->getMissingContacts($websiteId, $this->apiLimit);
121
- Mage::helper('connector')->log('API LIMIT : ' . $this->apiLimit, null, 'api.log');
122
- Mage::helper('connector')->log($missingContacts->count(), null, 'api.log');
123
- if(count($missingContacts) == 0)
124
- continue;
125
- //save customer and trigger the obsever
126
- foreach($missingContacts as $customer){
127
- try{
128
- $customer->save();
129
- $updated++;
130
- //limit the number of updated contacts
131
- if($this->apiLimit == $updated){
132
- return $updated;
133
- }
134
- }catch (Exception $e){
135
- Mage::logException($e);
136
- }
137
- }
138
- }
139
- return $updated;
140
- }
141
- public function getMissingContacts($websiteId = null, $limit = 200)
142
- {
143
- $customerCollection = Mage::getModel('customer/customer')->getCollection()
144
- ->addAttributeToSelect('dotmailer_contact_id')
145
- ->addAttributeToFilter('dotmailer_contact_id', array('null' => true), 'left')
146
- ->setPageSize($limit)
147
- ;
148
- if($websiteId !== null)
149
- $customerCollection->addAttributeToFilter('website_id', $websiteId);
150
-
151
- return $customerCollection;
152
- }
153
- public function getTotalNumberCustomers()
154
- {
155
- $customers = Mage::getModel('customer/customer')->getCollection();
156
- $totalCustomers = $customers->getSize();
157
-
158
- return $totalCustomers;
159
- }
160
-
161
- public function countSkipContacts($contacts = false, $websiteId)
162
- {
163
- if($contacts)
164
- $numContactIds = $this->countNumOfContacts($contacts);
165
- else
166
- $numContactIds = count($this->getContactsCustomers($websiteId));
167
-
168
-
169
- return $numContactIds;
170
- }
171
-
172
- /**
173
- * @param Mage_Core_Model_Website $website
174
- * @return $this
175
- */
176
- public function exportCustomersForWebsite(Mage_Core_Model_Website $website)
177
- {
178
- $websiteCode = $website->getCode();
179
- $websiteId = $website->getId();
180
- $customer_filename = $websiteCode . '_' . $this->_customers_file_slug . '_' . date('d-M-Y_hms') . '.csv';
181
- $subscriber_filename = $websiteCode . '_' . $this->_subscribers_file_slug . '_' . date('d-M-Y_hms') . '.csv';
182
- $helper = Mage::helper('connector');
183
-
184
- $helper->log('customer filename : ' . $customer_filename . ', subscriber filename : ' . $subscriber_filename, null, $this->_log_filename);
185
-
186
- $pageNum = 1;
187
- $pageSize = $website->getConfig('connector_advanced_settings/admin/batch_size');
188
- if($pageSize == '') $pageSize = 5000;
189
- $this->fileHelper = Mage::helper('connector/file');
190
-
191
- do{
192
- $time_start = microtime(true);
193
-
194
- $currentBatch = $this->getCustomersToExport($pageSize, $pageNum, $this->getMappingHash($website), $website->getId());
195
- $condition = count($currentBatch);
196
- //write the csv headers
197
- if($pageNum == 1 && count($currentBatch)){
198
- $this->fileHelper->outputCSV($this->fileHelper->getFilePath($customer_filename), $this->getCsvHeaderArray($website));
199
- $this->fileHelper->outputCSV($this->fileHelper->getFilePath($subscriber_filename), array('Email', 'emailType'));
200
- }
201
- foreach ($currentBatch as $customer) {
202
-
203
- /**
204
- * Send wishlist as transactional data
205
- */
206
- if($website->getConfig(self::XML_PATH_CUSTOMER_WISHLIST_ENABLED)){
207
- $this->setWishlists($customer, $website);
208
- }
209
- // check if customer is subscribed
210
- if($customer->isSubscribed()){
211
- // save data for subscribers
212
- $this->fileHelper->outputCSV($this->fileHelper->getFilePath($subscriber_filename), array($customer->getEmail(), 'Html'));
213
- $this->countSubscribers++;
214
- }
215
-
216
- // save data for csutomers
217
- $this->fileHelper->outputCSV($this->fileHelper->getFilePath($customer_filename), $customer->toCSVArray());
218
- $this->countCustomers++;
219
- }
220
- $time_end = microtime(true);
221
- $time_in_seconds = $time_end - $time_start;
222
-
223
- $helper->log('-----------------------------------------------execution time :' . gmdate("H:i:s", $time_in_seconds), null, $this->_log_filename);
224
- $pageNum++;
225
- unset($currentBatch);
226
-
227
- }while( $condition == $pageSize );
228
-
229
- $storeIds = Mage::getModel('core/website')->load($websiteId)
230
- ->getStoreIds();
231
- $subscriberModel = new Dotdigitalgroup_Email_Model_Newsletter_Subscriber();
232
- $subscribersNotCustomers = $subscriberModel->getSubscribersNotCustomers($storeIds);
233
-
234
- foreach ($subscribersNotCustomers as $one) {
235
- $this->fileHelper->outputCSV($this->fileHelper->getFilePath($subscriber_filename), array($one->getSubscriberEmail()));
236
- $this->countSubscribers++;
237
- }
238
-
239
- /**
240
- * Save customers and subscribers to address books
241
- */
242
- $this->postAddressBookContactsImport($customer_filename, $website->getConfig(self::XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID));
243
- $this->postAddressBookContactsImport($subscriber_filename, $website->getConfig(Dotdigitalgroup_Email_Model_Newsletter_Subscriber::XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID));
244
-
245
- //If successful, archive the CSV file and Log something in the Magento Log - success/failure
246
- if(file_exists($this->fileHelper->getFilePath($customer_filename)) && file_exists($this->fileHelper->getFilePath($subscriber_filename))){
247
- $this->fileHelper->archiveCSV($customer_filename);
248
- $this->fileHelper->archiveCSV($subscriber_filename);
249
- }
250
- return $this;
251
-
252
- }
253
-
254
- private function exportWishlistsForWebsite(Mage_Core_Model_Website $website){
255
-
256
- $this->_api_user = $website->getConfig(self::XML_PATH_CONNECTOR_API_USERNAME);
257
- $this->_api_password = $website->getConfig(self::XML_PATH_CONNECTOR_API_PASSWORD);
258
- //wishlists for the website key
259
- if(isset($this->wishlists[$website->getId()])){
260
-
261
- //send wishlists as transactional data
262
- $wishlists = $this->wishlists[$website->getId()];
263
-
264
- $this->postContactsTransactionalDataImport($collectionName = 'Wishlist', $wishlists);
265
- }
266
- }
267
-
268
- public function getCustomersToExport($pageSize = 0, $pageNum = 1, $mappingHash, $websiteId)
269
- {
270
- // the filtering and aggregation of all the customer data here
271
- $customers = array();
272
- $helper = Mage::helper('connector');
273
-
274
- $customerCollection = Mage::getModel('customer/customer')->getCollection()
275
- ->addAttributeToSelect('email')
276
- ->addAttributeToSelect('firstname')
277
- ->addAttributeToSelect('lastname')
278
- ->addAttributeToSelect('dob')
279
- ->addAttributeToSelect('gender')
280
- ->addAttributeToSelect('prefix')
281
- ->addAttributeToSelect('website_id')
282
- ->addAttributeToSelect('store_id')
283
- ->addAttributeToSelect('created_at')
284
- ->addAttributeToSelect('last_logged_in')
285
- ->addAttributeToSelect('group_id')
286
- ->addAttributeToSelect('dob')
287
- ->addAttributeToSelect('dotmailer_contact_id')
288
-
289
- ->addAttributeToFilter('website_id', $websiteId)
290
-
291
- ->joinAttribute('billing_street', 'customer_address/street', 'default_billing', null, 'left')
292
- ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
293
- ->joinAttribute('billing_country_code', 'customer_address/country_id', 'default_billing', null, 'left')
294
- ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
295
- ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
296
- ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
297
- ->joinAttribute('shipping_street', 'customer_address/street', 'default_shipping', null, 'left')
298
- ->joinAttribute('shipping_city', 'customer_address/city', 'default_shipping', null, 'left')
299
- ->joinAttribute('shipping_country_code', 'customer_address/country_id', 'default_shipping', null, 'left')
300
- ->joinAttribute('shipping_postcode', 'customer_address/postcode', 'default_shipping', null, 'left')
301
- ->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
302
- ->joinAttribute('shipping_region', 'customer_address/region', 'default_shipping', null, 'left')
303
- ->joinTable('newsletter/subscriber','subscriber_email=email',array('subscriber_status' => 'subscriber_status'), null, 'left')
304
-
305
- ;
306
- if( $pageSize ){
307
- $customerCollection->setPage($pageNum, $pageSize);
308
- }
309
-
310
- $customer_log = Mage::getSingleton('core/resource')->getTableName('log_customer');
311
- $sales_flat_order_grid = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_grid');
312
- $sales_flat_order = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
313
-
314
- // get the last login from the log_customer table
315
- $customerCollection->getSelect()->columns(array('last_logged_in' => new Zend_Db_Expr ("(SELECT login_at
316
- FROM $customer_log
317
- WHERE customer_id =e.entity_id
318
- ORDER BY log_id DESC
319
- LIMIT 1)")));
320
-
321
- // customer order information
322
- $alias = 'subselect';
323
- $subselect = Mage::getModel('Varien_Db_Select',
324
- Mage::getSingleton('core/resource')->getConnection('core_read')
325
- )->from($sales_flat_order_grid, array(
326
- 'customer_id as s_customer_id',
327
- 'sum(grand_total) as total_spend',
328
- 'count(*) as total_orders',
329
- 'avg(grand_total) as average_order_value',
330
- )
331
- )->group('customer_id')
332
- ;
333
- $customerCollection->getSelect()->columns(array(
334
- 'last_purchase' => new Zend_Db_Expr("(SELECT created_at
335
- FROM $sales_flat_order
336
- WHERE customer_id =e.entity_id
337
- ORDER BY created_at DESC
338
- LIMIT 1)"),
339
- 'last_order_no' => new Zend_Db_Expr("(SELECT entity_id
340
- FROM $sales_flat_order
341
- WHERE customer_id =e.entity_id
342
- ORDER BY created_at DESC
343
- LIMIT 1)")
344
- ));
345
-
346
- $customerCollection->getSelect()
347
- ->joinLeft(array($alias => $subselect),
348
- "{$alias}.s_customer_id = e.entity_id");
349
-
350
-
351
-
352
- $time = microtime(true);
353
- // create a customer object for each item in our collection
354
- foreach ($customerCollection as $item) {
355
-
356
- $customers[] = new Dotdigitalgroup_Email_Model_Connector_Customer($item, $mappingHash);
357
- }
358
-
359
- unset($customerCollection);
360
- $end_time = microtime(true);
361
- $end = $end_time - $time;
362
-
363
-
364
- $helper->log($pageSize . ': page' . $pageNum . ' for website: ' . $websiteId, null, $this->_log_filename);
365
- $helper->log('created dotmailer customers from collection: ' . gmdate("H:i:s", $end), null, $this->_log_filename);
366
-
367
- return $customers;
368
- }
369
-
370
- protected function allowResourceFullExecution() {
371
-
372
- /* it may be needed to set maximum execution time of the script to longer,
373
- * like 60 minutes than usual */
374
- set_time_limit ( 7200 );
375
-
376
- /* and memory to 512 megabytes */
377
- ini_set ( 'memory_limit', '512M' );
378
-
379
- return $this;
380
- }
381
- function convert($size)
382
- {
383
- $unit=array('b','kb','mb','gb','tb','pb');
384
- return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
385
- }
386
-
387
- /**
388
- * Create an array of columns we have chosen to map in our System->Config
389
- * @param Mage_Core_Model_Website $website
390
- * @return array
391
- */
392
- public function getCsvHeaderArray(Mage_Core_Model_Website $website) {
393
-
394
- $result = array();
395
-
396
- $result[] = 'Email';
397
-
398
- foreach ($this->getMappingHash($website) as $header) {
399
- if ($header != "0") $result[] = $header;
400
- }
401
- $result[] = 'emailType';
402
-
403
- return $result;
404
- }
405
-
406
- /**
407
- * Gets the datafield mapping hash from the system config
408
- * @param Mage_Core_Model_Website $website
409
- * @return array
410
- */
411
- protected function getMappingHash(Mage_Core_Model_Website $website){
412
-
413
-
414
- $customer_fields = array(
415
- 'customer_data/firstname',
416
- 'customer_data/lastname',
417
- 'customer_data/dob',
418
- 'customer_data/gender',
419
- 'customer_data/title',
420
- 'customer_data/website_created_on',
421
- 'customer_data/store_created_on',
422
- 'customer_data/account_created',
423
- 'customer_data/last_logged_in',
424
- 'customer_data/customer_group',
425
- 'customer_data/billing_address_1',
426
- 'customer_data/billing_address_2',
427
- 'customer_data/billing_city',
428
- 'customer_data/billing_country',
429
- 'customer_data/billing_postcode',
430
- 'customer_data/billing_telephone',
431
- 'customer_data/delivery_address_1',
432
- 'customer_data/delivery_address_2',
433
- 'customer_data/delivery_city',
434
- 'customer_data/delivery_country',
435
- 'customer_data/delivery_postcode',
436
- 'customer_data/delivery_telephone',
437
- 'customer_data/total_orders',
438
- 'customer_data/average_order_value',
439
- 'customer_data/total_spend',
440
- 'customer_data/last_order',
441
- 'customer_data/last_order_no',
442
- 'customer_data/customer_id'
443
- );
444
-
445
- $result = array();
446
-
447
- foreach ($customer_fields as $field) {
448
-
449
- $result[] = $website->getConfig('connector_data_field_settings/' . $field);
450
-
451
- }
452
- return $result;
453
- }
454
-
455
- public function setWishlists($customer, $website)
456
- {
457
- $customerId = $customer->id;
458
- $wishList = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId);
459
-
460
- /** @var $connectorWishlist */
461
- $connectorWishlist = new Dotdigitalgroup_Email_Model_Connector_Wishlist($customer);
462
- $connectorWishlist->setId($wishList->getId());
463
-
464
- $wishListItemCollection = $wishList->getItemCollection();
465
-
466
- if (count($wishListItemCollection)) {
467
- foreach ($wishListItemCollection as $item) {
468
- /* @var $product Mage_Catalog_Model_Product */
469
- $product = $item->getProduct();
470
- $connectorItem = new Dotdigitalgroup_Email_Model_Customer_Wishlist_Item($product);
471
- $connectorItem->setQty($item->getQty());
472
- $connectorItem->setPrice($product);
473
- $connectorWishlist->setItem($connectorItem);//store for wishlists
474
- }
475
- //set wishlists for later use
476
- $this->wishlists[$website->getId()][] = $connectorWishlist;
477
- }
478
- }
479
-
480
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Customer/Suppressed.php DELETED
@@ -1,85 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Customer_Suppressed extends Dotdigitalgroup_Email_Model_Api_Rest
4
- {
5
-
6
- private $suppressedContacts = array();
7
-
8
- public function unsubscribe($force = false)
9
- {
10
- // result of sync
11
- $result = array('errors' => false, 'message' => '', 'customers');
12
- $result['customers'] = 0;
13
- $date = new Zend_Date();
14
-
15
- /**
16
- * 1. calculate from frequency
17
- */
18
- if(! $force){
19
- $frequency = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMERS_SUPPRESSED_INTERVAL);
20
- // get the frequency of sinse date
21
- switch($frequency){
22
- case('H'):
23
- $date = $date->subHour(1);
24
- break;
25
- case('D'):
26
- $date = $date->subDay(1);
27
- break;
28
- case('W'):
29
- $date = $date->subWeek(1);
30
- break;
31
- case('M'):
32
- $date = $date->subMonth(1);
33
- break;
34
- }
35
- }else{
36
-
37
- // force sync all customers
38
- $date = $date->subYear(Dotdigitalgroup_Email_Model_Customer_Customer::FORCE_CUSTOMERS_YEARS);
39
- }
40
-
41
- // datetime format string
42
- $dateString = $date->toString(Zend_Date::W3C);
43
- /**
44
- * Sync all suppressed for each store
45
- */
46
- foreach (Mage::app()->getWebsites(true) as $website) {
47
- $this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
48
- $this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
49
- $contacts = $this->getSuppressedSince($dateString);
50
- if(! empty($contacts)){
51
- foreach ($contacts as $suppressed){
52
- $contactEmail = false;
53
- if(isset($suppressed->suppressedContact)){
54
-
55
- $contactEmail = $suppressed->suppressedContact->email;
56
- $contactId = $suppressed->suppressedContact->id;
57
- }
58
-
59
- if($contactEmail){
60
- try{
61
- /**
62
- * 3. Unsubscribe customer
63
- */
64
- $newsletterModel = Mage::getModel('newsletter/subscriber')->loadByEmail($contactEmail);
65
- if($newsletterModel->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED){
66
- $unsubscribe = $newsletterModel->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED);
67
- $unsubscribe->save();
68
- // remove from subscriber address-book
69
- $this->deleteAddressBookContact($website->getConfig(Dotdigitalgroup_Email_Model_Newsletter_Subscriber::XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID), $contactId);
70
- $this->suppressedContacts[$newsletterModel->getSubscriberEmail()] = $newsletterModel->getSubscriberEmail();
71
- }
72
- }catch (Exception $e){
73
- $result['errors'] = true;
74
- $result['message'] = 'Error Saving Customer!';
75
- }
76
- }
77
- }
78
- }
79
- }
80
- $result['customers'] = count($this->suppressedContacts);
81
-
82
- return $result;
83
- }
84
-
85
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Dynamic/Product/Mapper.php DELETED
@@ -1,90 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Dynamic_Product_Mapper extends Mage_Core_Model_Abstract
4
- {
5
- protected $_max_per_child;
6
-
7
- protected $_num_order_items;
8
-
9
- protected $_helper;
10
-
11
- public $_products = array();
12
-
13
- public $filename = 'mapper.log';
14
-
15
- public function __construct($num_order_items)
16
- {
17
- $this->_helper = Mage::helper('connector');
18
- $items_to_display = Mage::helper('connector/recommended')->getLimit();
19
- if($num_order_items < $items_to_display)
20
- $this->_max_per_child = number_format($items_to_display / $num_order_items);
21
- $this->_helper->log('max items per child : ' . $this->_max_per_child . ', items to display : ' . $items_to_display . ', number of order items : ' . $num_order_items, null, $this->filename);
22
-
23
- }
24
-
25
- /**
26
- * Set the products with parent limit
27
- * @param $products
28
- */
29
- public function setProducts($products)
30
- {
31
- $count = 0;
32
- foreach ($products as $product) {
33
- if($count < $this->_max_per_child)
34
- $this->setProduct($product);
35
- $count++;
36
- }
37
-
38
- }
39
- public function setProduct(Mage_Catalog_Model_Product $product)
40
- {
41
- $productId = $product->getEntityId();
42
-
43
- if(!isset($this->_products[$productId])){
44
- $this->_products[$productId] = $product;
45
- return true;
46
- }
47
- return false;
48
- }
49
-
50
- public function countProducts()
51
- {
52
- return count($this->_products);
53
- }
54
-
55
- public function getProducts()
56
- {
57
- return $this->_products;
58
- }
59
-
60
- public function getFallbackProducts($limit)
61
- {
62
- $count = 0;
63
- $fallbackIds = Mage::helper('connector/recommended')->getFallbackIds();
64
- $this->_helper->log('fallback products from helper : '. count($fallbackIds), null, $this->filename);
65
-
66
- if(!empty($fallbackIds)){
67
- foreach ($fallbackIds as $id) {
68
- /** @var Mage_Catalog_Model_Product $product */
69
- $product = Mage::getModel('catalog/product')->load($id);
70
-
71
- if($product->getEntityId()){
72
-
73
- $result = $this->setProduct($product);
74
- if($result)
75
- $count++;
76
-
77
- }
78
-
79
- $this->_helper->log('result for products ' . $this->countProducts() . ', count : ' . $count . ', limit : ' . $limit, null, $this->filename);
80
-
81
- if($count == $limit){
82
-
83
- break;
84
- }
85
- }
86
- }
87
-
88
- return;
89
- }
90
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Dynamic/Recommended.php DELETED
@@ -1,228 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Dynamic_Recommended extends Dotdigitalgroup_Email_Model_Dynamic_Product_Mapper
4
- {
5
- protected $_result_limit;
6
-
7
- protected $_storeId;//order store id
8
-
9
- protected $_order_items = 0;//order product items
10
-
11
- protected $_num_order_items;//number of items from order
12
-
13
- protected $_productMapper;
14
-
15
- protected $_is_log_enabled;
16
-
17
- protected $_helper;
18
-
19
- /**
20
- * @param $orderModel
21
- */
22
- public function __construct(Mage_Sales_Model_Order $orderModel = null)
23
- {
24
- if($orderModel){
25
- $this->_storeId = $orderModel->getStoreId();
26
- $this->_order_items = $orderModel->getAllItems();
27
- }
28
- $this->_num_order_items = count($this->_order_items);
29
- $this->_productMapper = new Dotdigitalgroup_Email_Model_Dynamic_Product_Mapper($this->_num_order_items);
30
- $this->_helper = Mage::helper('connector/recommended');
31
- $this->_result_limit = $this->_helper->getLimit();
32
- }
33
-
34
- /**
35
- * Get the recommended products
36
- * @return array
37
- */
38
- public function getProducts()
39
- {
40
- $mode = Mage::registry('mode');
41
- if($mode == 'related' || $mode == 'upsell' || $mode == 'crosssell'){
42
-
43
- //set the order items
44
- $this->setOrderItems();
45
- }else{
46
- //set products directly without looking for order items
47
- $this->setRecommendedProduct();
48
- }
49
-
50
- return $this->_productMapper->getProducts();
51
- }
52
-
53
- public function setOrderItems()
54
- {
55
- foreach ($this->_order_items as $item) {
56
- $productId = $item->getProductId();
57
- /** @var Mage_Catalog_Model_Product $product */
58
- $product = Mage::getModel('catalog/product')->load($productId);//make sure the product is loaded
59
-
60
- $this->setRecommendedProduct($product);
61
- }
62
-
63
- if($this->_productMapper->countProducts() < $this->_result_limit){
64
- $limit = $this->_result_limit - $this->_productMapper->countProducts();
65
- $this->_productMapper->getFallbackProducts($limit);
66
- }
67
-
68
- return $this->_productMapper->getProducts();
69
- }
70
-
71
- public function setRecommendedProduct(Mage_Catalog_Model_Product $productModel = null)
72
- {
73
- //array of products to display
74
- $products = array();
75
-
76
- $mode = Mage::registry('mode');
77
- switch($mode){
78
- case 'related':
79
- $products = $productModel->getRelatedProducts();
80
- break;
81
- case 'upsell':
82
- $products = $productModel->getUpSellProducts();
83
- break;
84
- case 'crosssell':
85
- $products = $productModel->getCrossSellProducts();
86
- break;
87
- case 'bestsellers':
88
- $products = $this->getBestSellersProducts();
89
- break;
90
- case 'mostviewed':
91
- $products = $this->getMostViewedProducts();
92
- break;
93
- case 'recentlyviewed':
94
- $products = $this->getRecentlyViewedProducts();
95
- break;
96
- case 'productpush':
97
- $products = $this->getPushProducts();
98
- break;
99
- }
100
- if($mode == 'related' || $mode == 'upsell' || $mode == 'crosssell'){
101
-
102
- $this->_productMapper->setProducts($products, $this->_result_limit);
103
- }
104
-
105
-
106
- Mage::helper('connector')->log('number of all recommended products : ' . $this->_productMapper->countProducts() . ', max : ' . $this->_result_limit, null, $this->filename);
107
-
108
- }
109
- public function getNumberOfOrderItems()
110
- {
111
- return $this->_order_items;
112
- }
113
-
114
- /**
115
- * Best Selling products
116
- * @return array
117
- */
118
- public function getBestSellersProducts()
119
- {
120
- $limit = $this->_helper->getLimit();
121
- $from = $this->_helper->getTimeFromConfig($config = 'bestsellers');
122
- $to = new Zend_Date();
123
- $to = $to->toString(Zend_Date::ISO_8601);
124
-
125
- $productCollection = Mage::getResourceModel('reports/product_collection')
126
- ->addOrderedQty($from, $to)
127
- ->addAttributeToSelect('*')
128
- ->addAttributeToSelect(array('name', 'price', 'small_image')) //edit to suit tastes
129
- ->setOrder('ordered_qty', 'desc') //best sellers on top
130
- ->setPageSize($limit);
131
-
132
- $productCollection->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
133
- $productCollection->addAttributeToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
134
-
135
- foreach ($productCollection as $_product) {
136
- $this->_productMapper->setProduct($_product);
137
- }
138
-
139
- return array();
140
- }
141
-
142
- /**
143
- * Most viwed products
144
- * @return array
145
- */
146
- public function getMostViewedProducts()
147
- {
148
- $limit = $this->_helper->getLimit();
149
- $from = $this->_helper->getTimeFromConfig($config = 'mostviewed');
150
-
151
- $to = new Zend_Date();
152
- $to = $to->toString(Zend_Date::ISO_8601);
153
- $productCollection = Mage::getResourceModel('reports/product_collection')
154
- ->addViewsCount()
155
- ->addViewsCount($from, $to)
156
- ->setPageSize($limit);
157
-
158
- $productCollection->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
159
- $productCollection->addAttributeToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
160
-
161
- foreach ($productCollection as $_product) {
162
- $this->_productMapper->setProduct($_product);
163
- }
164
-
165
-
166
- return $this->_productMapper->getProducts();
167
- }
168
-
169
- /**
170
- * Recently viewed products
171
- * @return $this
172
- */
173
- public function getRecentlyViewedProducts()
174
- {
175
- $customerId = Mage::registry('customer');
176
- $helper = Mage::helper('connector');
177
- $helper->log('recentlyviewed customer : ' . $customerId, null, $this->filename);
178
- if($customerId){
179
-
180
- $limit = $this->_helper->getLimit();
181
-
182
- //login customer to receive the recent products
183
- $session = Mage::getSingleton('customer/session');
184
- $session->loginById($customerId);
185
-
186
- /** @var Mage_Reports_Block_Product_Viewed $collection */
187
- $collection = Mage::getSingleton('Mage_Reports_Block_Product_Viewed');
188
- $items = $collection->getItemsCollection()
189
- ->setPageSize($limit)
190
- ;
191
-
192
-
193
- foreach ($items as $product) {
194
- $this->_productMapper->setProduct($product);
195
- }
196
-
197
-
198
- return $this->_productMapper->getProducts();
199
- }else{
200
-
201
- $helper->log('Get recently viewd products, customer id not found : ' . $customerId, null, $this->filename);
202
- }
203
-
204
- return null;
205
- }
206
-
207
- public function getPushProducts()
208
- {
209
- $productIds = $this->_helper->getProductPushIds();
210
-
211
- Mage::helper('connector')->log('proudcts push ids : ' . implode(',', $productIds), null, $this->filename);
212
-
213
-
214
- $productCollection = Mage::getModel('catalog/product')->getCollection()
215
- ->addAttributeToFilter('entity_id', array('in' => $productIds))
216
- ->setPageSize(Mage::helper('connector/recommended')->getLimit())
217
- ;
218
-
219
- foreach ($productCollection as $_product) {
220
- $this->_productMapper->setProduct($_product);
221
-
222
- }
223
-
224
- return $this->_productMapper->getProducts();
225
- }
226
-
227
-
228
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Newsletter_Subscriber extends Mage_Core_Helper_Abstract
4
- {
5
- const XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID = 'connector_data_field_settings/address_book/subscribers';
6
-
7
- // select subscribers that are not registred as customers
8
- public function getSubscribersNotCustomers($storeIds = array())
9
- {
10
- $newsletterCollection = Mage::getModel('newsletter/subscriber')->getCollection()
11
- ->addFieldToFilter('main_table.customer_id', array('eq' => 0))
12
- ->addFieldToFilter('subscriber_status', array('eq' => Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED))
13
- ->addStoreFilter($storeIds)
14
- ;
15
-
16
- return $newsletterCollection;
17
- }
18
-
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Observer.php DELETED
@@ -1,189 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Observer extends Dotdigitalgroup_Email_Model_Api_Rest
4
- {
5
- /**
6
- * Create new contact or update info also check for email change
7
- * event: customer_save_before
8
- * @param Varien_Event_Observer $observer
9
- * @return $this
10
- */
11
- public function handleCustomerSaveBefore(Varien_Event_Observer $observer)
12
- {
13
- // skip update customer for first time sync
14
- if(! Mage::registry('first_time_sync')){
15
-
16
- /* @var $customer Mage_Customer_Model_Customer */
17
- $customer = $observer->getEvent()->getCustomer();
18
- $email = $customer->getEmail();
19
- $websiteId = $customer->getWebsiteId();
20
- $subscribed = $customer->getIsSubscribed();
21
-
22
- $this->_api_user = Mage::app()->getWebsite($websiteId)->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
23
- $this->_api_password = Mage::app()->getWebsite($websiteId)->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
24
- $subscribersAddressBook = Mage::app()->getWebsite($websiteId)->getConfig(Dotdigitalgroup_Email_Model_Newsletter_Subscriber::XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID);
25
-
26
- if($customer->getData('dotmailer_contact_id')){
27
- $dotmailerId = $customer->getData('dotmailer_contact_id');
28
- //get contact infrmation by id
29
- $response = $this->getContactById($dotmailerId);
30
-
31
- //check for matching email
32
- if(isset($response->email)){
33
- if($email != $response->email){
34
- $data = array(
35
- 'Email' => $email,
36
- 'EmailType' => 'Html'
37
- );
38
- //update the contact with same id - different email
39
- $this->updateContact($dotmailerId, $data);
40
- }
41
-
42
- if(!$subscribed && $response->status == 'Subscribed'){
43
- $this->deleteAddressBookContact($subscribersAddressBook, $response->id);
44
- }
45
- }
46
- }else{
47
- //get contact info by email
48
- $response = $this->getContactByEmail($email);
49
- //create new contact and add to address books
50
- if(isset($response->message) && $response->message == Dotdigitalgroup_Email_Model_Api_Rest::REST_CONTACT_NOT_FOUND){
51
- $contactApi = $this->createNewContact($email);
52
- $this->postAddressBookContacts(Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID), $contactApi);
53
-
54
- if($subscribed){
55
- $this->postAddressBookContacts($subscribersAddressBook, $contactApi);
56
- }
57
- }
58
- }
59
-
60
- if(isset($response->id))
61
- $customer->setData('dotmailer_contact_id', $response->id);//set the id from contact info
62
- }
63
- return $this;
64
- }
65
- /**
66
- * event: sales_order_save_after
67
- * @param Varien_Event_Observer $observer
68
- * @return $this
69
- */
70
- public function handleSalesOrderSaveAfter(Varien_Event_Observer $observer)
71
- {
72
- $order = $observer->getEvent()->getOrder();
73
- $storeId = $order->getStoreId();
74
- $customerId = $order->getCustomerId();
75
-
76
- $customerModel = Mage::getModel('customer/customer')->load($customerId);
77
-
78
-
79
- if(!$customerModel->getData('dotmailer_contact_id'))
80
- $customerModel->save();
81
-
82
- $this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
83
- $this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
84
- $is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
85
-
86
- // store scope enabled
87
- if($is_enabled){
88
- $dotmailer = new Dotdigitalgroup_Email_Model_Connector_Order($order);
89
- $this->sendOrderTransactionalData($dotmailer, 'Order');
90
- }
91
-
92
-
93
- return $this;
94
- }
95
-
96
- /**
97
- * event: quote_save_after
98
- * @param Varien_Event_Observer $observer
99
- * @return $this
100
- */
101
- public function handleSalesQuoteSaveAfter(Varien_Event_Observer $observer)
102
- {
103
- $quote = $observer->getQuote();
104
- $customerIsNotGuest = $quote->getCustomerId();
105
- $storeId = $quote->getStoreId();
106
-
107
- $this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
108
- $this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
109
- $is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
110
-
111
- // save quotes that are active
112
- if($customerIsNotGuest && $is_enabled && $quote->getIsActive()){
113
- $dotmailer = new Dotdigitalgroup_Email_Model_Connector_Quote($quote);
114
- $this->sendTransactionalData($dotmailer, 'Basket');
115
- }
116
-
117
- return $this;
118
- }
119
-
120
- public function handleSalesOrderStatusChange(Varien_Event_Observer $observer)
121
- {
122
- $order = $observer->getEvent()->getOrder();
123
- $status = $order->getStatus();
124
-
125
- /**
126
- * SMS functinality
127
- */
128
- $smsStatusOne = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_ONE_STATUS);
129
- $smsStatusTwo = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_TWO_STATUS);
130
- $smsStatusThree = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_THREE_STATUS);
131
- $smsStatusFour = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_FOUR_STATUS);
132
- $smsModel = new Dotdigitalgroup_Email_Model_Sales_Sms();
133
-
134
- switch($status){
135
- case $smsStatusOne:
136
- $smsModel->sendMessage($order, 'ONE');
137
- break;
138
- case $smsStatusTwo:
139
- $smsModel->sendMessage($order, 'TWO');
140
- break;
141
- case $smsStatusThree:
142
- $smsModel->sendMessage($order, 'THREE');
143
- break;
144
- case $smsStatusFour:
145
- $smsModel->sendMessage($order, 'FOUR');
146
- break;
147
- }
148
-
149
- return $this;
150
- }
151
-
152
- public function handleSalesOrderRefund(Varien_Event_Observer $observer)
153
- {
154
- $creditmemo = $observer->getEvent()->getCreditmemo();
155
- $storeId = $creditmemo->getStoreId();
156
-
157
- $this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
158
- $this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
159
- $is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
160
- $order = $creditmemo->getOrder();
161
-
162
- // store scope enabled
163
- if($is_enabled){
164
- $connectorOrder = new Dotdigitalgroup_Email_Model_Connector_Order($order);
165
- $result = $this->sendOrderTransactionalData($connectorOrder, 'Order', $order->getIncrementId());
166
- $this->_helper->log($result, null, $this->_log_filename);
167
-
168
- }
169
-
170
- return $this;
171
- }
172
- public function hangleSalesOrderCancel(Varien_Event_Observer $observer)
173
- {
174
- $order = $observer->getEvent()->getOrder();
175
- $storeId = $order->getStoreId();
176
- $key = $order->getIncrementId();
177
-
178
- $this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
179
- $this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
180
- $is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
181
-
182
- if($is_enabled)
183
- $this->deleteContactsTransactionalData('Order', $key);
184
-
185
-
186
-
187
- return $this;
188
- }
189
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Order.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Order extends Mage_Sales_Model_Order
4
- {
5
- protected function _setState($state, $status = false, $comment = '', $isCustomerNotified = null, $shouldProtectState = false)
6
- {
7
- // dispatch an event before we attempt to do anything
8
- Mage::dispatchEvent('sales_order_status_before', array('order' => $this, 'state' => $state, 'status' => $status, 'comment' => $comment, 'isCustomerNotified' => $isCustomerNotified, 'shouldProtectState' => $shouldProtectState));
9
-
10
- // attempt to set the specified state
11
- if ($shouldProtectState) {
12
- if ($this->isStateProtected($state)) {
13
- Mage::throwException(Mage::helper('sales')->__('The Order State "%s" must not be set manually.', $state));
14
- }
15
- }
16
- $this->setData('state', $state);
17
-
18
- // add status history
19
- if ($status) {
20
- if ($status === true) {
21
- $status = $this->getConfig()->getStateDefaultStatus($state);
22
- }
23
- $this->setStatus($status);
24
- $history = $this->addStatusHistoryComment($comment, false); // no sense to set $status again
25
- $history->setIsCustomerNotified($isCustomerNotified); // for backwards compatibility
26
- }
27
-
28
- // dispatch an event after status has changed
29
- Mage::dispatchEvent('sales_order_status_after', array('order' => $this, 'state' => $state, 'status' => $status, 'comment' => $comment, 'isCustomerNotified' => $isCustomerNotified, 'shouldProtectState' => $shouldProtectState));
30
-
31
- return $this;
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Sales/Order.php DELETED
@@ -1,96 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Sales_Order extends Dotdigitalgroup_Email_Model_Api_Rest
4
- {
5
- const XML_PATH_TRANSACTIONAL_DATA_ENABLED = 'connector_sync_settings/transactional_data/order_enabled';
6
- const XML_PATH_TRANSACTIONAL_DATA_SYNC_LIMIT = 'connector_advanced_settings/sync_limits/orders';
7
-
8
- protected $accounts = array();
9
-
10
- /**
11
- * initial sync the transactional data
12
- * @return array
13
- */
14
- public function sync()
15
- {
16
- // Initialise a return hash containing results of our sync attempt
17
- $this->_searchAccounts();
18
-
19
- foreach ($this->accounts as $account){
20
- if(count($account->getOrders())){
21
- $this->sendMultiTransactionalData($account->getOrders(), 'Order');
22
-
23
- }
24
-
25
- unset($this->accounts[$account->getApiUsername()]);
26
- }
27
- return $this;
28
- }
29
-
30
- /**
31
- *Search the configuration data per website
32
- */
33
- private function _searchAccounts()
34
- {
35
- foreach (Mage::app()->getWebsites() as $website){
36
- $enabled = $website->getConfig(self::XML_PATH_TRANSACTIONAL_DATA_ENABLED);
37
-
38
- if(!$enabled)
39
- continue;
40
-
41
- $this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
42
- $limit = $website->getConfig(self::XML_PATH_TRANSACTIONAL_DATA_SYNC_LIMIT);
43
-
44
- if(!isset($this->accounts[$this->_api_user])){
45
- $account = new Dotdigitalgroup_Email_Model_Connector_Account();
46
- $account->setApiUsername($this->_api_user);
47
- $account->setApiPassword($this->_api_password);
48
- $this->accounts[$this->_api_user] = $account;
49
- }
50
- $this->accounts[$this->_api_user]->setOrders($this->getConnectorOrders($limit));
51
- }
52
- }
53
-
54
- /**
55
- * get all connector orders data
56
- * @param $limit
57
- * @return array
58
- */
59
- public function getConnectorOrders($limit = 100)
60
- {
61
- $orders = $customers = array();
62
- $orderCollection = Mage::getModel('sales/order')->getCollection()
63
- ->addAttributeToFilter('dotmailer_order_imported', array('null' => true), 'left')
64
- ->setPageSize($limit);
65
-
66
- $this->_helper->log('GET CONNECTOR ORDERS ' . $orderCollection->count() . ' limit ' . $limit, null, $this->_log_filename);
67
-
68
- //mark as imported for customers with contact id
69
- foreach ($orderCollection as $order) {
70
- try {
71
- $customerEmail = $order->getCustomerEmail();
72
- $storeId = $order->getStoreId();
73
- $this->setStoreId(Mage::app()->getStore(true)->getId());
74
- $websiteId = Mage::getModel('core/store')->load($storeId)->getWebsiteId();
75
-
76
- $customerModel = Mage::getModel('customer/customer')->setWebsiteId($websiteId)
77
- ->loadByEmail($customerEmail);
78
-
79
- if($customerModel){
80
- $contactId = $customerModel->getData('dotmailer_contact_id');
81
- if($contactId){
82
- $orders[] = new Dotdigitalgroup_Email_Model_Connector_Order($order);
83
- $order->setData('dotmailer_order_imported', 1);
84
- $order->save();
85
- }
86
- }
87
- }catch(Exception $e){
88
-
89
-
90
- $this->_helper->log($order->getIncrementId(), null, $this->_log_filename);
91
- $this->_helper->log($e->getMessage(), null, $this->_log_filename);
92
- }
93
- }
94
- return $orders;
95
- }
96
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Sales/Quote.php DELETED
@@ -1,289 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Model_Api_Rest
4
- {
5
- //xml path configuration
6
- const XML_PATH_LOSTBASKET_1_ENABLED = 'lostbaskets/customers/enabled_1';
7
- const XML_PATH_LOSTBASKET_2_ENABLED = 'lostbaskets/customers/enabled_2';
8
- const XML_PATH_LOSTBASKET_3_ENABLED = 'lostbaskets/customers/enabled_3';
9
-
10
- const XML_PATH_LOSTBASKET_1_INTERVAL = 'lost_basket_settings/customers/send_after_1';
11
- const XML_PATH_LOSTBASKET_2_INTERVAL = 'lost_basket_settings/customers/send_after_2';
12
- const XML_PATH_LOSTBASKET_3_INTERVAL = 'lost_basket_settings/customers/send_after_3';
13
-
14
- const XML_PATH_TRIGGER_1_CAMPAIGN = 'lost_basket_settings/customers/campaign_1';
15
- const XML_PATH_TRIGGER_2_CAMPAIGN = 'lost_basket_settings/customers/campaign_2';
16
- const XML_PATH_TRIGGER_3_CAMPAIGN = 'lost_basket_settings/customers/campaign_3';
17
-
18
- const XML_PATH_GUEST_LOSTBASKET_1_ENABLED = 'lostbaskets/guests/enabled_1';
19
- const XML_PATH_GUEST_LOSTBASKET_2_ENABLED = 'lostbaskets/guests/enabled_2';
20
- const XML_PATH_GUEST_LOSTBASKET_3_ENABLED = 'lostbaskets/guests/enabled_3';
21
-
22
- const XML_PATH_GUEST_LOSTBASKET_1_INTERVAL = 'lost_basket_settings/guests/send_after_1';
23
- const XML_PATH_GUEST_LOSTBASKET_2_INTERVAL = 'lost_basket_settings/guests/send_after_2';
24
- const XML_PATH_GUEST_LOSTBASKET_3_INTERVAL = 'lost_basket_settings/guests/send_after_3';
25
-
26
- const XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN = 'lost_basket_settings/guests/campaign_1';
27
- const XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN = 'lost_basket_settings/guests/campaign_2';
28
- const XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN = 'lost_basket_settings/guests/campaign_3';
29
-
30
- const XML_PATH_TEST_LOSTBASKET_EMAIL = 'lost_basket_settings/test/email';
31
-
32
-
33
- /**
34
- * send the lost baskets to campains
35
- * @return array
36
- */
37
- public function proccessCampaigns()
38
- {
39
- foreach (Mage::app()->getStores(true) as $store){
40
-
41
- //skip any action if all lost basket campaings are disabled
42
- if(!$store->getConfig(self::XML_PATH_LOSTBASKET_1_ENABLED) && !$store->getConfig(self::XML_PATH_LOSTBASKET_2_ENABLED) &&
43
- !$store->getConfig(self::XML_PATH_LOSTBASKET_3_ENABLED) && !$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_ENABLED) &&
44
- !$store->getconfig(self::XML_PATH_GUEST_LOSTBASKET_2_ENABLED) && !$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_ENABLED)
45
- )continue;
46
-
47
- // set credentials for every store
48
- $storeId = $store->getId();
49
- $this->_api_user = $store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
50
- $this->_api_password = $store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
51
-
52
- /**
53
- * Customers campaings
54
- */
55
-
56
- //first campign
57
- if($store->getConfig(self::XML_PATH_LOSTBASKET_1_ENABLED)){
58
-
59
- $contacts = array();
60
- $from = Zend_Date::now()->subMinute($store->getConfig(self::XML_PATH_LOSTBASKET_1_INTERVAL));
61
- $to = clone($from);
62
- $from->sub('5', Zend_Date::MINUTE);
63
- // lost baskets
64
- $quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
65
- if(count($quoteCollection)){
66
-
67
- // get collection contacts id
68
- foreach ($quoteCollection as $quote) {
69
- $customerId = $quote->getCustomerId();
70
- $dotmailerContactId = $this->_getContactIdByCustomerId($customerId);
71
-
72
- if($dotmailerContactId)
73
- $contacts[] = $dotmailerContactId;
74
- }
75
- //check for empty contacts to avoid mass emails
76
- if(!empty($contacts))
77
- $this->sendCampaign($store->getConfig(self::XML_PATH_TRIGGER_1_CAMPAIGN), $contacts);
78
- }
79
- }
80
-
81
- //second campaign
82
- if($store->getConfig(self::XML_PATH_LOSTBASKET_2_ENABLED)){
83
- $contacts = array();
84
- $from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_LOSTBASKET_2_INTERVAL));
85
- $to = clone($from);
86
- $from->sub('5', Zend_Date::MINUTE);
87
- // lost baskets
88
- $quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
89
- if(count($quoteCollection)){
90
- // get collection contacts id
91
- foreach ($quoteCollection as $quote) {
92
- $customerId = $quote->getCustomerId();
93
- $dotmailerContactId = $this->_getContactIdByCustomerId($customerId);
94
- if($dotmailerContactId)
95
- $contacts[] = $dotmailerContactId;
96
- }
97
- if(!empty($contacts))
98
- $this->sendCampaign($store->getConfig(self::XML_PATH_TRIGGER_2_CAMPAIGN), $contacts);
99
- }
100
- }
101
-
102
- //third campign
103
- if($store->getConfig(self::XML_PATH_LOSTBASKET_3_ENABLED)){
104
- $contacts = array();
105
- $from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_LOSTBASKET_3_INTERVAL));
106
- $to = clone($from);
107
- $from->sub('5', Zend_Date::MINUTE);
108
- // lost baskets
109
- $quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
110
- if(count($quoteCollection)){
111
- // get collection contacts id
112
- foreach ($quoteCollection as $quote) {
113
- $customerId = $quote->getCustomerId();
114
- $dotmailerContactId = $this->_getContactIdByCustomerId($customerId);
115
- if($dotmailerContactId)
116
- $contacts[] = $dotmailerContactId;
117
- }
118
- if(!empty($contacts))
119
- $this->sendCampaign($store->getConfig(self::XML_PATH_TRIGGER_3_CAMPAIGN), $contacts);
120
- }
121
- }
122
- /**
123
- * Guests campaings
124
- */
125
- //first guest campaign
126
- if($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_ENABLED))
127
- {
128
- $contacts = array();
129
- $from = Zend_Date::now()->subMinute($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_INTERVAL));
130
- $to = clone($from);
131
- $from->sub('5', Zend_Date::MINUTE);
132
- $quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
133
- if(count($quoteCollection)){
134
- // get collection contacts id
135
- foreach ($quoteCollection as $quote) {
136
- $email = $quote->getCustomerEmail();
137
- //check if the customer exists
138
- $response = $this->getContactByEmail($email);
139
-
140
- if(isset($response->message) && $response->message == self::REST_CONTACT_NOT_FOUND){
141
- //create new contact before sending campaign
142
- $contactAPI = $this->createNewContact($email);
143
- if(!isset($contactAPI->message))
144
- $response = $this->postAddressBookContacts($store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_GUEST_ADDRESS_BOOK_ID), $contactAPI);
145
- }
146
- $contacts[] = $response->id;
147
- }
148
- if(!empty($contacts))
149
- $this->sendCampaign($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN), $contacts);
150
- }
151
- }
152
- // second guest campaign
153
- if($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_ENABLED))
154
- {
155
- $contacts = array();
156
- $from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_INTERVAL));
157
- $to = clone($from);
158
- $from->sub('5', Zend_Date::MINUTE);
159
- // lost baskets
160
- $quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
161
- if(count($quoteCollection)){
162
- // get collection contacts id
163
- foreach ($quoteCollection as $quote) {
164
- $email = $quote->getCustomerEmail();
165
- //check if the customer exists
166
- $response = $this->getContactByEmail($email);
167
- if(isset($response->message) && $response->message == self::REST_CONTACT_NOT_FOUND){
168
- //create new contact before sending campaign
169
- $contactAPI = $this->createNewContact($email);
170
- if(!isset($contactAPI->message))
171
- $this->postAddressBookContacts($store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_GUEST_ADDRESS_BOOK_ID), $contactAPI);
172
- }
173
- $contacts[] = $response->id;
174
- }
175
- if(!empty($contacts))
176
- $this->sendCampaign($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN), $contacts);
177
- }
178
- }
179
- //third guest campaign
180
- if($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_ENABLED)){
181
- $contacts = array();
182
- $from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_INTERVAL));
183
- $to = clone($from);
184
- $from->sub('5', Zend_Date::MINUTE);
185
-
186
- // lost baskets
187
- $quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
188
- if(count($quoteCollection)){
189
- // get collection contacts id
190
- foreach ($quoteCollection as $quote) {
191
- $email = $quote->getCustomerEmail();
192
- //check if the customer exists
193
- $response = $this->getContactByEmail($email);
194
-
195
- if(isset($response->message) && $response->message == self::REST_CONTACT_NOT_FOUND){
196
- //create new contact before sending campaign
197
- $contactAPI = $this->createNewContact($email);
198
- if(!isset($contactAPI->message))
199
- $this->postAddressBookContacts($store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_GUEST_ADDRESS_BOOK_ID), $contactAPI);
200
- }
201
- $contacts[] = $response->id;
202
- }
203
- if(!empty($contacts))
204
- $this->sendCampaign($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN), $contacts);
205
- }
206
- }
207
- }
208
- return;
209
- }
210
-
211
- /**
212
- * @param $storeId
213
- * @param null $from
214
- * @param null $to
215
- * @param bool $guest
216
- * @return Varien_Data_Collection_Db
217
- */
218
- private function _getStoreQuotes($storeId, $from = null, $to = null, $guest = false){
219
-
220
- $salesCollection = Mage::getResourceModel('sales/quote_collection')
221
- ->addFieldToFilter('is_active',1)
222
- ->addFieldToFilter('items_count', array('gt' => 0))
223
- ->addFieldToFilter('customer_email', array('neq' => ''))
224
- ->addFieldToFilter('store_id', $storeId)
225
- ->addFieldToFilter('updated_at',array(
226
- 'from' => $from,
227
- 'to' => $to,
228
- 'date' => true)
229
- );
230
- if($guest)
231
- $salesCollection->addFieldToFilter('checkout_method' , Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);
232
-
233
- return $salesCollection->load();
234
- }
235
-
236
- private function _getContactIdByCustomerId($customerId)
237
- {
238
- $customerModel = Mage::getModel('customer/customer')->load($customerId);
239
-
240
- if($customerModel){
241
- return $customerModel->getData('dotmailer_contact_id');
242
- }
243
- return false;
244
-
245
- }
246
- public function forceProccess()
247
- {
248
- $result = array('errors' => false, 'message' => '');
249
- $contacts = array();
250
- $customerEmail = Mage::getStoreConfig(self::XML_PATH_TEST_LOSTBASKET_EMAIL);
251
-
252
-
253
- $salesCollection = Mage::getResourceModel('sales/quote_collection')
254
- ->addFieldToFilter('is_active',1)
255
- ->addFieldToFilter('items_count', array('gt' => 0))
256
- ->addFieldToFilter('customer_id', array('neq' => ''))
257
- ->addFieldToFilter('customer_email', $customerEmail)
258
-
259
- //->addFieldToFilter('store_id', $storeId)
260
- ;
261
- $salesCollection->getSelect()->order("updated_at desc");
262
-
263
-
264
- $quote = $salesCollection->getFirstItem();
265
-
266
- if($quote){
267
-
268
- $contactId = $this->_getContactIdByCustomerId($quote->getCustomerId());
269
-
270
- if($contactId)
271
- $contacts[] = $contactId;
272
-
273
- if(!empty($contacts)){
274
-
275
- $responce = $this->sendCampaign(Mage::getStoreConfig(self::XML_PATH_TRIGGER_1_CAMPAIGN), $contacts);
276
- if(isset($responce->message)){
277
- $result['errors'] = true;
278
- $result['message'] = $responce->message;
279
- }else{
280
-
281
- $result['message'] = 'First Test Campaign Sent ';
282
- }
283
- }
284
- }
285
- return $result;
286
-
287
- }
288
-
289
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/Sales/Sms.php DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_Sales_Sms extends Dotdigitalgroup_Email_Model_Api_Rest
4
- {
5
- const XML_PATH_SMS_MESSAGE_ONE_STATUS = 'sms_section/sms_message_one/order_status';
6
- const XML_PATH_SMS_MESSAGE_TWO_STATUS = 'sms_section/sms_message_two/order_status';
7
- const XML_PATH_SMS_MESSAGE_THREE_STATUS = 'sms_section/sms_message_three/order_status';
8
- const XML_PATH_SMS_MESSAGE_FOUR_STATUS = 'sms_section/sms_message_four/order_status';
9
-
10
- const XML_PATH_SMS_MESSAGE_ONE = 'sms_section/sms_message_one/message';
11
- const XML_PATH_SMS_MESSAGE_TWO = 'sms_section/sms_message_two/message';
12
- const XML_PATH_SMS_MESSAGE_THREE = 'sms_section/sms_message_three/message';
13
- const XML_PATH_SMS_MESSAGE_FOUR = 'sms_section/sms_message_four/message';
14
-
15
- public $_available = array('/customer_name/', '/order_number/', '/{{var /', '/}}/');
16
-
17
- public function sendMessage($order, $number)
18
- {
19
- $storeId = $order->getStoreId();
20
- $billing = $order->getBillingAddress();
21
- $customerTelephone = $billing->getTelephone();
22
-
23
- $message = Mage::getStoreConfig(constant('self::XML_PATH_SMS_MESSAGE_' . $number), $storeId);
24
-
25
- $message = $this->_processVariables($order, $message);
26
-
27
-
28
- $pattern = "/^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$/";
29
-
30
- $match = preg_match($pattern, $customerTelephone);
31
- $this->_helper->log('sms number to send : ' . $customerTelephone, null, $this->_log_filename);
32
-
33
- if ($match != false) {
34
- $telephoneNumber = preg_replace('/\A(0){1}+/', '+44', $customerTelephone);
35
- Mage::helper('connector')->log($telephoneNumber, null, 'api.log');
36
- $this->postSmsMessagesSendTo($telephoneNumber, $message);
37
- } else {
38
-
39
- $this->_helper->log('telephone number not valid ' . $customerTelephone, null, $this->_log_filename);
40
- }
41
- }
42
-
43
- /**
44
- * @param $order
45
- * @param $message
46
- * @return mixed
47
- */
48
- protected function _processVariables($order, $message)
49
- {
50
- $helper = Mage::helper('connector');
51
- if(preg_match('/{{var/', $message)){
52
-
53
- $firstname = $order->getCustomerFirstname();
54
-
55
- $replacemant = array();
56
- $replacemant[] = $firstname;
57
- $replacemant[] = $order->getIncrementId();
58
- $replacemant[] = '';
59
- $replacemant[] = '';
60
-
61
- $message = preg_replace($this->_available, $replacemant, $message);
62
-
63
- $helper->log($message, null, $this->_log_filename);
64
-
65
- }
66
-
67
- return $message;
68
- }
69
-
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Customer.php DELETED
@@ -1,50 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_System_Config_Backend_Syncschedule_Customer extends Mage_Core_Model_Config_Data
4
- {
5
- const CRON_STRING_PATH = 'connector_sync_settings/sync_customer_schedule/cronschedule';
6
-
7
- /**
8
- * Cron settings after save
9
- *
10
- *
11
- */
12
- protected function _afterSave()
13
- {
14
-
15
- $enabled = $this->getData('groups/sync_customer_schedule/fields/enabled/value');
16
- $time = $this->getData('groups/sync_customer_schedule/fields/time/value');
17
- $frequency = $this->getData('groups/sync_customer_schedule/fields/frequency/value');
18
-
19
- $frequencyHourly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_HOURLY;
20
- $frequencyDaily = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_DAILY;
21
- $frequencyWeekly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_WEEKLY;
22
- $frequencyMonthly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_MONTHLY;
23
-
24
- if ($enabled) {
25
- $cronDayOfWeek = date('N');
26
- $cronExprArray = array(
27
- ($frequency == $frequencyHourly) ? intval($time[1]) : '*', # Minute
28
- ($frequency == $frequencyDaily) ? intval($time[0]) : '*', # Hour
29
- ($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month
30
- '*', # Month of the Year
31
- ($frequency == $frequencyWeekly) ? $cronDayOfWeek : '*', # Day of the Week
32
- );
33
- $cronExprString = join(' ', $cronExprArray);
34
- }
35
- else {
36
- $cronExprString = '';
37
- }
38
-
39
- try {
40
- // store config $cronExprString
41
- Mage::getModel('core/config_data')
42
- ->load(self::CRON_STRING_PATH, 'path')
43
- ->setValue($cronExprString)
44
- ->setPath(self::CRON_STRING_PATH)
45
- ->save();
46
- }catch (Exception $e) {
47
- Mage::throwException('Unable to save the cron expression.');
48
- }
49
- }
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Suppressed.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_System_Config_Backend_Syncschedule_Suppressed extends Mage_Core_Model_Config_Data
4
- {
5
- const CRON_STRING_PATH = 'connector_sync_settings/sync_suppressed_schedule/cronschedulesupp';
6
-
7
- /**
8
- * Cron settings after save
9
- *
10
- *
11
- */
12
- protected function _afterSave()
13
- {
14
-
15
- $enabled = $this->getData('groups/sync_suppressed_schedule/fields/enabled/value');
16
- $time = $this->getData('groups/sync_suppressed_schedule/fields/time/value');
17
- $frequency = $this->getData('groups/sync_suppressed_schedule/fields/frequency/value');
18
-
19
- $frequencyHourly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_HOURLY;
20
- $frequencyDaily = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_DAILY;
21
- $frequencyWeekly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_WEEKLY;
22
- $frequencyMonthly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_MONTHLY;
23
-
24
- if ($enabled) {
25
- $cronDayOfWeek = date('N');
26
- $cronExprArray = array(
27
- ($frequency == $frequencyHourly) ? intval($time[1]) : '*', # Minute
28
- ($frequency == $frequencyDaily) ? intval($time[0]) : '*', # Hour
29
- ($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month
30
- '*', # Month of the Year
31
- ($frequency == $frequencyWeekly) ? $cronDayOfWeek : '*', # Day of the Week
32
- );
33
- $cronExprString = join(' ', $cronExprArray);
34
- }
35
- else {
36
- $cronExprString = '';
37
- }
38
-
39
- try {
40
- // store config $cronExprString
41
-
42
-
43
- Mage::getModel('core/config_data')
44
- ->load(self::CRON_STRING_PATH, 'path')
45
- ->setValue($cronExprString)
46
- ->setPath(self::CRON_STRING_PATH)
47
- ->save();
48
-
49
- }
50
- catch (Exception $e) {
51
- Mage::throwException('Unable to save the cron expression.');
52
- }
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Activebasket.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_Activebasket
4
- {
5
- function toOptionArray()
6
- {
7
- return array(
8
- array('value' => '0', 'label' => Mage::helper('connector')->__('Success Page')),
9
- array('value' => '1', 'label' => Mage::helper('connector')->__('Complete Order'))
10
- );
11
- }
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Addressbooks.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_Addressbooks extends Dotdigitalgroup_Email_Model_Api_Rest
4
- {
5
- // Returns the account's datafields
6
- public function toOptionArray()
7
- {
8
- $fields = array();
9
- //load the configuration for website select in admin
10
- $websiteName = Mage::app()->getRequest()->getParam('website');
11
- if(! empty($websiteName)){
12
- $websites = Mage::getModel('core/website')->getCollection()
13
- ->addFieldToFilter('code', $websiteName);
14
- $website = $websites->getFirstItem();
15
- $this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
16
- $this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
17
- }
18
- $addressBooks = $this->postAddressBooks();
19
-
20
- //set up fields with book id and label
21
- foreach ($addressBooks as $book){
22
-
23
- if(isset($book->id))
24
- $fields[] = array('value' => $book->id, 'label' => $book->name);
25
- }
26
-
27
- return $fields;
28
- }
29
-
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Campaigns.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /**
3
- * Date: 15/04/2013
4
- * Time: 13:46
5
- */
6
- class Dotdigitalgroup_Email_Model_System_Config_Source_Campaigns extends Dotdigitalgroup_Email_Model_Api_Rest
7
- {
8
-
9
- // Returns the account's datafields
10
- public function toOptionArray()
11
- {
12
- $fields = array();
13
- $websiteName = Mage::app()->getRequest()->getParam('website');
14
- if(! empty($websiteName)){
15
- $websites = Mage::getModel('core/website')->getCollection()
16
- ->addFieldToFilter('code', $websiteName);
17
- $website = $websites->getFirstItem();
18
- $this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
19
- $this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
20
- }
21
- $campaigns = $this->postCampaigns();
22
- foreach ($campaigns as $one){
23
- if(isset($one->id))
24
- $fields[] = array('value' => $one->id, 'label' => $one->name);
25
- }
26
-
27
- return $fields;
28
- }
29
-
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Datafields.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
- /**
3
- * Date: 15/04/2013
4
- * Time: 13:46
5
- */
6
- class Dotdigitalgroup_Email_Model_System_Config_Source_Datafields extends Dotdigitalgroup_Email_Model_Api_Rest
7
- {
8
-
9
- // Returns the account's datafields
10
- public function toOptionArray()
11
- {
12
- $fields = array();
13
- //load the configuration for website select in admin
14
- $websiteName = Mage::app()->getRequest()->getParam('website');
15
- if(! empty($websiteName)){
16
- $websites = Mage::getModel('core/website')->getCollection()
17
- ->addFieldToFilter('code', $websiteName);
18
- $website = $websites->getFirstItem();
19
- $this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
20
- $this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
21
- }
22
-
23
- // Add a "Do Not Map" Option
24
- $fields[] = array('value' => 0, 'label' => 'Do Not Map');
25
-
26
- $datafileds = $this->postDataFields();
27
- foreach ($datafileds as $datafield) {
28
- if(isset($datafield->name))
29
- $fields[] = array('value' => $datafield->name, 'label' => $datafield->name);
30
- }
31
-
32
- return $fields;
33
- }
34
-
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Displayifnot.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_Displayifnot
4
- {
5
- public function toOptionArray()
6
- {
7
- return array(
8
- array('value' => 'best-sellers', 'label' => Mage::helper('connector')->__('Best Sellers')),
9
- array('value' => 'most-viewed', 'label' => Mage::helper('connector')->__('Most Viewed'))
10
- );
11
- }
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Orderstatus.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_Orderstatus
4
- {
5
- public function toOptionArray(){
6
-
7
- $statusCollection = Mage::getModel('sales/order_status')->getCollection();
8
- $statuses = array();
9
-
10
- foreach ($statusCollection as $one) {
11
- $statuses[] = array('value' => $one->getStatus(), 'label' => Mage::helper('connector')->__($one->getLabel()));
12
- }
13
-
14
- return $statuses;
15
- }
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Sendcampain.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_SendCampain
4
- {
5
- /**
6
- * send to campain options hours
7
- * @return array
8
- */
9
- public function toOptionArray()
10
- {
11
- return array(
12
- array('value'=>1 , 'label'=>Mage::helper('adminhtml')->__('1 Hour')),
13
- array('value'=>2 , 'label'=>Mage::helper('adminhtml')->__('2 Hours')),
14
- array('value'=>3 , 'label'=>Mage::helper('adminhtml')->__('3 Hours')),
15
- array('value'=>4 , 'label'=>Mage::helper('adminhtml')->__('4 Hours')),
16
- array('value'=>5 , 'label'=>Mage::helper('adminhtml')->__('5 Hours')),
17
- array('value'=>6 , 'label'=>Mage::helper('adminhtml')->__('6 Hours')),
18
- array('value'=>12 , 'label'=>Mage::helper('adminhtml')->__('12 Hours')),
19
- array('value'=>36 , 'label'=>Mage::helper('adminhtml')->__('36 Hours')),
20
- array('value'=>48 , 'label'=>Mage::helper('adminhtml')->__('48 Hours')),
21
- array('value'=>60 , 'label'=>Mage::helper('adminhtml')->__('60 Hours')),
22
- array('value'=>72 , 'label'=>Mage::helper('adminhtml')->__('72 Hours')),
23
- array('value'=>84 , 'label'=>Mage::helper('adminhtml')->__('84 Hours')),
24
- array('value'=>96 , 'label'=>Mage::helper('adminhtml')->__('96 Hours')),
25
- array('value'=>108 , 'label'=>Mage::helper('adminhtml')->__('108 Hours')),
26
- array('value'=>120 , 'label'=>Mage::helper('adminhtml')->__('120 Hours')),
27
- );
28
-
29
- }
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Syncfrequency.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency
4
- {
5
-
6
- protected static $_options;
7
-
8
- const CRON_HOURLY = 'H';
9
- const CRON_DAILY = 'D';
10
- const CRON_WEEKLY = 'W';
11
- const CRON_MONTHLY = 'M';
12
-
13
- public function toOptionArray()
14
- {
15
- if (!self::$_options) {
16
- self::$_options = array(
17
- array(
18
- 'label' => Mage::helper('cron')->__('Hourly'),
19
- 'value' => self::CRON_HOURLY,
20
- ),
21
- array(
22
- 'label' => Mage::helper('cron')->__('Daily'),
23
- 'value' => self::CRON_DAILY,
24
- ),
25
- array(
26
- 'label' => Mage::helper('cron')->__('Weekly'),
27
- 'value' => self::CRON_WEEKLY,
28
- ),
29
- array(
30
- 'label' => Mage::helper('cron')->__('Monthly'),
31
- 'value' => self::CRON_MONTHLY,
32
- ),
33
- );
34
- }
35
- return self::$_options;
36
- }
37
-
38
-
39
-
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Timeperiod.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Model_System_Config_Source_Timeperiod
4
- {
5
- public function toOptionArray()
6
- {
7
- return array(
8
- array('value' => 'week', 'label' => Mage::helper('connector')->__('Week')),
9
- array('value' => 'month', 'label' => Mage::helper('connector')->__('Month')),
10
- array('value' => 'year', 'label' => Mage::helper('connector')->__('Year'))
11
- );
12
- }
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/Test/Model/Product.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- class Dotdigitalgroup_Email_Test_Model_Product extends EcomDev_PHPUnit_Test_Case
3
- {
4
-
5
- public function testIfTheAnswerToTheUniverseIs42()
6
- {
7
-
8
- $productModel = Mage::getModel('catalog/product')->load(39);
9
-
10
-
11
- $price = $productModel->getPrice();
12
-
13
- $this->assertEquals('20', $price);
14
-
15
-
16
-
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/controllers/Adminhtml/DebugController.php DELETED
@@ -1,125 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_Adminhtml_DebugController extends Mage_Adminhtml_Controller_Action
4
- {
5
-
6
- public function forcecustomersyncAction()
7
- {
8
- $result = Mage::getModel('connector/customer_customer')->sync();
9
-
10
- if ($result['error']) {
11
- Mage::getSingleton('adminhtml/session')->addError($result['message']);
12
- }else {
13
- Mage::getSingleton('adminhtml/session')->addSuccess($result['message']);
14
- }
15
- $this->_redirectReferer();
16
- }
17
-
18
- public function forcelostbasketsyncAction()
19
- {
20
-
21
- $result = Mage::getModel('connector/sales_quote')->forceProccess();
22
-
23
- if ($result['errors'])
24
- Mage::getSingleton('adminhtml/session')->addError($result['message']);
25
- else
26
- Mage::getSingleton('adminhtml/session')->addSuccess($result['message']);
27
-
28
- $this->_redirectReferer();
29
- }
30
-
31
- public function forcesuppressedAction()
32
- {
33
- // forse sync
34
- $result = Mage::getModel('connector/customer_suppressed')->unsubscribe(true);
35
-
36
- if($result['errors']){
37
- Mage::getSingleton('adminhtml/session')->addError($result['message']);
38
- }else{
39
-
40
- if($result['customers'] > 0)
41
- Mage::getSingleton('adminhtml/session')->addSuccess('Customers Unsubscribed : ' . $result['customers']);
42
- else
43
- Mage::getSingleton('adminhtml/session')->addSuccess('Done.');
44
- }
45
-
46
- $this->_redirectReferer();
47
- }
48
-
49
- public function testCredentialsAction()
50
- {
51
- /**
52
- * Test account API
53
- */
54
- $testResult = Mage::getModel('connector/account_test')->test();
55
-
56
- if($testResult['errors']){
57
- Mage::getSingleton('adminhtml/session')->addError($testResult['message']);
58
- }else{
59
- Mage::getSingleton('adminhtml/session')->addSuccess('API Credentials Valid.');
60
- }
61
- $this->_redirectReferer();
62
- }
63
- public function transactionalSyncAction()
64
- {
65
-
66
- Mage::register('force_transactional', true);
67
- $initialSync = Mage::getModel('connector/sales_order')->sync();
68
-
69
- if ($initialSync['errors'])
70
- Mage::getSingleton('adminhtml/session')->addError($initialSync['message']);
71
- else
72
- Mage::getSingleton('adminhtml/session')->addSuccess($initialSync['message']);
73
-
74
- $this->_redirectReferer();
75
- }
76
- public function deletecontactsidAction()
77
- {
78
- Mage::register('first_time_sync', true);
79
- $customerModel = new Dotdigitalgroup_Email_Model_Customer_Customer();
80
- $customers = $customerModel->getContactsCustomers();
81
- $numUpdated = 0;
82
- if($customers->getSize()){
83
- foreach ($customers as $one){
84
- try{
85
- $customer = Mage::getModel('customer/customer')->load($one->getId());
86
- $customer->setData('dotmailer_contact_id', null);
87
- $customer->save();
88
- }catch(Exception $e){
89
- Mage::helper('connector')->log($e->getMessage(), null, 'api.log');
90
- }
91
- $numUpdated++;
92
- }
93
- }
94
- Mage::unregister('first_time_sync');
95
- if($numUpdated);
96
- Mage::getModel('adminhtml/session')->addSuccess('Number Of Contacts Id Removed :'. $numUpdated);
97
- $this->_redirectReferer();
98
- }
99
-
100
- public function countcontactsAction()
101
- {
102
- $customer = new Dotdigitalgroup_Email_Model_Customer_Customer();
103
- $contacts = $customer->getContactsCustomers();
104
- $total = $customer->getTotalNumberCustomers();
105
- $numMissing = $contacts->getSize();
106
-
107
- Mage::getModel('adminhtml/session')->addSuccess('Customers No: ' . $total . ', With Contact Id No: ' . $numMissing);
108
- $this->_redirectReferer();
109
- }
110
-
111
- public function ajaxvalidationAction()
112
- {
113
- $result = 'Validation failed!';
114
- $api_user = $this->getRequest()->getParam('api_user');
115
- $api_password = $this->getRequest()->getParam('api_password');
116
- $testResult = Mage::getModel('connector/account_test')->test($api_user, $api_password);
117
- if($testResult['errors'] == false){
118
- $result = 'Valid';
119
- }
120
-
121
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
122
- }
123
-
124
-
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/controllers/EmailController.php DELETED
@@ -1,133 +0,0 @@
1
- <?php
2
-
3
- class Dotdigitalgroup_Email_EmailController extends Mage_Core_Controller_Front_Action
4
- {
5
- public function indexAction()
6
- {
7
- //Get current layout state
8
- $this->loadLayout();
9
-
10
- $this->renderLayout();
11
- }
12
-
13
-
14
- /**
15
- * Params
16
- * code - security check
17
- * order - order id
18
- * products type :
19
- * 1.related
20
- * 2.upsell
21
- * 3.cross sell
22
- * 4.best sellers
23
- * 5.most viewed
24
- * 6.recently viewed
25
- *
26
- */
27
- public function productsAction()
28
- {
29
- //get all params
30
- $params = $this->getRequest()->getParams();
31
-
32
- if(!isset($params['code']) || !isset($params['mode'])){
33
-
34
- exit();
35
- }
36
- //authenticate before proceed
37
- Mage::helper('connector')->auth($params['code']);
38
- Mage::register('mode', $params['mode']);
39
- if(isset($params['customer']))
40
- Mage::register('customer', $params['customer']);
41
- $this->loadLayout();
42
- $this->renderLayout();
43
-
44
- }
45
-
46
- public function couponAction()
47
- {
48
- $this->loadLayout();
49
- $this->renderLayout();
50
- }
51
- public function basketAction()
52
- {
53
- $this->loadLayout();
54
- $this->renderLayout();
55
- }
56
-
57
- public function logAction()
58
- {
59
- //@todo allow from these Ips
60
- $allowedIps = array(
61
-
62
- );
63
-
64
- //file name param
65
- $file = $this->getRequest()->getParam('file');
66
- $fileName = $file . '.log';
67
- $filePath = Mage::getBaseDir('log') . DIRECTORY_SEPARATOR . $fileName;
68
-
69
- $this->_prepareDownloadResponse($fileName, array(
70
- 'type' => 'filename',
71
- 'value' => $filePath
72
- ));
73
- exit();
74
-
75
- }
76
-
77
- public function resetimportedorderdataAction()
78
- {
79
- $orderCollection = Mage::getResourceModel('sales/order_collection');
80
- foreach ($orderCollection as $one) {
81
-
82
- try{
83
-
84
- $one->setData('dotmailer_order_imported', null);
85
- $one->save();
86
- }catch(Exception $e){
87
- Mage::logException($e);
88
- }
89
- }
90
-
91
- }
92
-
93
- public function saveMissingIdCustomerAction()
94
- {
95
- $customer = Mage::getModel('connector/customer_customer')->getMissingContacts();
96
- $helper = Mage::helper('connector');
97
- $helper->log('number of miss ids : ' . count($customer));
98
- foreach ($customer as $one) {
99
- try{
100
- $helper->log($one->getEmail());
101
- $one->save();
102
- }catch(Exception $e){
103
- $helper->log($e->getMessage());
104
-
105
- }
106
-
107
- }
108
-
109
- }
110
-
111
- public function importAllTransactionalDataAction()
112
- {
113
- $orderCollection = Mage::getModel('sales/order')->getCollection();
114
- $helper = Mage::helper('connector');
115
- $helper->log('import all transactional data : ' . $orderCollection->getSize());
116
- foreach($orderCollection as $one){
117
-
118
- $order = Mage::getModel('connector/connector_order', $one);
119
- if($order->connector_id)
120
- $orders[] = $order;
121
- }
122
- $helper->log('orders created : ' . count($orders));
123
- $rest = Mage::getModel('connector/api_rest');
124
-
125
- try{
126
- $result = $rest->sendMultiTransactionalData($orders, 'Order');
127
- $helper->log($result);
128
- }catch(Exception $e){
129
- $helper->log($e->getMessage());
130
- }
131
-
132
- }
133
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/etc/adminhtml.xml DELETED
@@ -1,43 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <acl>
4
- <resources>
5
- <admin>
6
- <children>
7
- <system>
8
- <children>
9
- <config>
10
- <children>
11
- <connector_api_settings translate="title">
12
- <title><![CDATA[API Credentials]]></title>
13
- </connector_api_settings>
14
- <connector_sync_settings translate="title">
15
- <title><![CDATA[Sync Settings]]></title>
16
- </connector_sync_settings>
17
- <connector_data_field_settings translate="title">
18
- <title><![CDATA[Data Field Mapping]]></title>
19
- </connector_data_field_settings>
20
- <connector_roi_page_tracking_settings translate="title">
21
- <title><![CDATA[ROI & Tracking]]></title>
22
- </connector_roi_page_tracking_settings>
23
- <lost_basket_settings translate="title">
24
- <title><![CDATA[Lost Baskets]]></title>
25
- </lost_basket_settings>
26
- <sms_section translate="title">
27
- <title><![CDATA[SMS Section]]></title>
28
- </sms_section>
29
- <dynamic_content translate="label">
30
- <title><![CDATA[Dynamic Content]]></title>
31
- </dynamic_content>
32
- <connector_advanced_settings translate="title">
33
- <title><![CDATA[Advanced Settings]]></title>
34
- </connector_advanced_settings>
35
- </children>
36
- </config>
37
- </children>
38
- </system>
39
- </children>
40
- </admin>
41
- </resources>
42
- </acl>
43
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Dotdigitalgroup/Email/etc/config.xml DELETED
@@ -1,289 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
-
4
- <modules>
5
- <Dotdigitalgroup_Email>
6
- <version>1.5.1</version>
7
- </Dotdigitalgroup_Email>
8
- </modules>
9
- <frontend>
10
- <routers>
11
- <connector>
12
- <use>standard</use>
13
- <args>
14
- <module>Dotdigitalgroup_Email</module>
15
- <frontName>connector</frontName>
16
- </args>
17
- </connector>
18
- </routers>
19
- <layout>
20
- <updates>
21
- <connector>
22
- <file>connector.xml</file>
23
- </connector>
24
- </updates>
25
- </layout>
26
- </frontend>
27
- <global>
28
- <models>
29
- <connector>
30
- <class>Dotdigitalgroup_Email_Model</class>
31
- </connector>
32
- <sales>
33
- <rewrite>
34
- <order>Dotdigitalgroup_Email_Model_Order</order>
35
- </rewrite>
36
- </sales>
37
- </models>
38
- <helpers>
39
- <connector>
40
- <class>Dotdigitalgroup_Email_Helper</class>
41
- </connector>
42
- </helpers>
43
- <blocks>
44
- <connector>
45
- <class>Dotdigitalgroup_Email_Block</class>
46
- </connector>
47
- </blocks>
48
-
49
- <resources>
50
- <connector_setup>
51
- <setup>
52
- <module>Dotdigitalgroup_Email</module>
53
- <class>Mage_Sales_Model_Mysql4_Setup</class>
54
- </setup>
55
- <connection>
56
- <use>core_setup</use>
57
- </connection>
58
- </connector_setup>
59
- <customer_write>
60
- <connection>
61
- <use>core_write</use>
62
- </connection>
63
- </customer_write>
64
- <customer_read>
65
- <connection>
66
- <use>core_read</use>
67
- </connection>
68
- </customer_read>
69
- </resources>
70
- <events>
71
- <customer_save_before>
72
- <observers>
73
- <contactid>
74
- <class>Dotdigitalgroup_Email_Model_Observer</class>
75
- <method>handleCustomerSaveBefore</method>
76
- </contactid>
77
- </observers>
78
- </customer_save_before>
79
- <sales_order_save_after>
80
- <observers>
81
- <connector_checkout_type_onepage_save_order_after>
82
- <class>Dotdigitalgroup_Email_Model_Observer</class>
83
- <method>handleSalesOrderSaveAfter</method>
84
- </connector_checkout_type_onepage_save_order_after>
85
- </observers>
86
- </sales_order_save_after>
87
- <sales_quote_save_after>
88
- <observers>
89
- <connector_quote_save_after>
90
- <type>singleton</type>
91
- <class>Dotdigitalgroup_Email_Model_Observer</class>
92
- <method>handleSalesQuoteSaveAfter</method>
93
- </connector_quote_save_after>
94
- </observers>
95
- </sales_quote_save_after>
96
- <sales_order_creditmemo_save_after>
97
- <observers>
98
- <connector_sales_order_payment_refund>
99
- <class>Dotdigitalgroup_Email_Model_Observer</class>
100
- <method>handleSalesOrderRefund</method>
101
- </connector_sales_order_payment_refund>
102
- </observers>
103
- </sales_order_creditmemo_save_after>
104
- <order_cancel_after>
105
- <observers>
106
- <connector_sales_order_cancel>
107
- <class>Dotdigitalgroup_Email_Model_Observer</class>
108
- <method>hangleSalesOrderCancel</method>
109
- </connector_sales_order_cancel>
110
- </observers>
111
- </order_cancel_after>
112
-
113
- <sales_order_status_after>
114
- <observers>
115
- <connector_sales_order_status_change>
116
- <class>Dotdigitalgroup_Email_Model_Observer</class>
117
- <method>handleSalesOrderStatusChange</method>
118
- </connector_sales_order_status_change>
119
- </observers>
120
- </sales_order_status_after>
121
- </events>
122
- </global>
123
-
124
- <adminhtml>
125
- <layout>
126
- <updates>
127
- <connector>
128
- <file>connector.xml</file>
129
- </connector>
130
- </updates>
131
- </layout>
132
- </adminhtml>
133
-
134
-
135
- <admin>
136
- <routers>
137
- <connector>
138
- <use>admin</use>
139
- <args>
140
- <modules>
141
- <connector before="Mage_Adminhtml">Dotdigitalgroup_Email_Adminhtml</connector>
142
- </modules>
143
- <module>Dotdigitalgroup_Email_Adminhtml</module>
144
- <frontName>connector</frontName>
145
- </args>
146
- </connector>
147
- </routers>
148
- </admin>
149
-
150
- <crontab>
151
- <jobs>
152
- <dotdigitalgroup_email_customer_sync>
153
- <run><model>connector/cron::customersync</model></run>
154
- <schedule>
155
- <config_path>connector_sync_settings/sync_customer_schedule/cronschedule</config_path>
156
- </schedule>
157
- </dotdigitalgroup_email_customer_sync>
158
- <dotdigitalgroup_email_lostbaskets_sync>
159
- <run><model>connector/cron::lostbasketssync</model></run>
160
- <schedule>
161
- <cron_expr>*/5 * * * *</cron_expr>
162
- </schedule>
163
- </dotdigitalgroup_email_lostbaskets_sync>
164
- <dotdigitalgroup_email_suppressed_sync>
165
- <run><model>connector/cron::suppressedsync</model></run>
166
- <schedule>
167
- <config_path>connector_sync_settings/sync_suppressed_schedule/cronschedulesupp</config_path>
168
- </schedule>
169
- </dotdigitalgroup_email_suppressed_sync>
170
- <dotdigitalgroup_email_cleaner>
171
- <run><model>connector/cron::cleaning</model></run>
172
- <schedule>
173
- <cron_expr>0 0 1 * * </cron_expr>
174
- </schedule>
175
- </dotdigitalgroup_email_cleaner>
176
- </jobs>
177
- </crontab>
178
- <default>
179
- <connector_api_settings>
180
- <api_credentials>
181
- <username></username>
182
- <password></password>
183
- </api_credentials>
184
- </connector_api_settings>
185
- <connector_sync_settings>
186
- <sync_customer_schedule>
187
- <enabled>0</enabled>
188
- <cronschedule></cronschedule>
189
- </sync_customer_schedule>
190
- <sync_suppressed_schedule>
191
- <enabled>0</enabled>
192
- <cronschedulesupp></cronschedulesupp>
193
- </sync_suppressed_schedule>
194
- <transactional_data>
195
- <enabled>0</enabled>
196
- </transactional_data>
197
- </connector_sync_settings>
198
- <connector_data_field_settings>
199
- <customer_data>
200
- <firstname></firstname>
201
- <lastname></lastname>
202
- <dob></dob>
203
- <gender></gender>
204
- <website_created_on></website_created_on>
205
- <store_created_on></store_created_on>
206
- <account_created></account_created>
207
- <last_logged_in></last_logged_in>
208
- <customer_group></customer_group>
209
- </customer_data>
210
- <customer_address>
211
- <billing_address_1></billing_address_1>
212
- <billing_address_2></billing_address_2>
213
- <billing_city></billing_city>
214
- <billing_country></billing_country>
215
- <billing_postcode></billing_postcode>
216
- <billing_telephone></billing_telephone>
217
- <delivery_address_1></delivery_address_1>
218
- <delivery_address_2></delivery_address_2>
219
- <delivery_city></delivery_city>
220
- <delivery_country></delivery_country>
221
- <delivery_postcode></delivery_postcode>
222
- <delivery_telephone></delivery_telephone>
223
- </customer_address>
224
- <customer_sales>
225
- <total_orders></total_orders>
226
- <average_order_value></average_order_value>
227
- <total_spend></total_spend>
228
- </customer_sales>
229
- </connector_data_field_settings>
230
-
231
- <connector_roi_page_tracking_settings>
232
- <page_tracking>
233
- <enabled></enabled>
234
- </page_tracking>
235
- <roi_tracking>
236
- <enabled></enabled>
237
- </roi_tracking>
238
- </connector_roi_page_tracking_settings>
239
- <connector_newsletter_subscription_settings>
240
- <customers_subscription_management>
241
- <default></default>
242
- </customers_subscription_management>
243
- <subscribers_subscription_management>
244
- <default></default>
245
- </subscribers_subscription_management>
246
- </connector_newsletter_subscription_settings>
247
- <lost_basket_settings>
248
- <customers>
249
- <enabled_1></enabled_1>
250
- <send_after_1></send_after_1>
251
- <campaign_1></campaign_1>
252
- <enabled_2></enabled_2>
253
- <send_after_2></send_after_2>
254
- <campaign_2></campaign_2>
255
- <enabled_3></enabled_3>
256
- <send_after_3></send_after_3>
257
- <campaign_3></campaign_3>
258
- </customers>
259
- <guests>
260
- <enabled_1></enabled_1>
261
- <send_after_1></send_after_1>
262
- <campaign_1></campaign_1>
263
- <enabled_2></enabled_2>
264
- <send_after_2></send_after_2>
265
- <campaign_2></campaign_2>
266
- <enabled_3></enabled_3>
267
- <send_after_3></send_after_3>
268
- <campaign_3></campaign_3>
269
- </guests>
270
- </lost_basket_settings>
271
- <connector_advanced_settings>
272
- <sync_limits>
273
- <contact>500</contact>
274
- <orders>500</orders>
275
- </sync_limits>
276
- <admin>
277
- <memory_limit></memory_limit>
278
- <batch_size>5000</batch_size>
279
- </admin>
280
- </connector_advanced_settings>
281
- </default>
282
- <phpunit>
283
- <suite>
284
- <modules>
285
- <Dotdigitalgroup_Email />
286
- </modules>
287
- </suite>
288
- </phpunit>
289
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Varien/Data/Collection.php DELETED
@@ -1,818 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Varien
22
- * @package Varien_Data
23
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Data collection
29
- *
30
- * @category Varien
31
- * @package Varien_Data
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Varien_Data_Collection implements IteratorAggregate, Countable
35
- {
36
- const SORT_ORDER_ASC = 'ASC';
37
- const SORT_ORDER_DESC = 'DESC';
38
-
39
- /**
40
- * Collection items
41
- *
42
- * @var array
43
- */
44
- protected $_items = array();
45
-
46
- /**
47
- * Item object class name
48
- *
49
- * @var string
50
- */
51
- protected $_itemObjectClass = 'Varien_Object';
52
-
53
- /**
54
- * Order configuration
55
- *
56
- * @var array
57
- */
58
- protected $_orders = array();
59
-
60
- /**
61
- * Filters configuration
62
- *
63
- * @var array
64
- */
65
- protected $_filters = array();
66
-
67
- /**
68
- * Filter rendered flag
69
- *
70
- * @var bool
71
- */
72
- protected $_isFiltersRendered = false;
73
-
74
- /**
75
- * Current page number for items pager
76
- *
77
- * @var int
78
- */
79
- protected $_curPage = 1;
80
-
81
- /**
82
- * Pager page size
83
- *
84
- * if page size is false, then we works with all items
85
- *
86
- * @var int | false
87
- */
88
- protected $_pageSize = false;
89
-
90
- /**
91
- * Total items number
92
- *
93
- * @var int
94
- */
95
- protected $_totalRecords;
96
-
97
- /**
98
- * Loading state flag
99
- *
100
- * @var bool
101
- */
102
- protected $_isCollectionLoaded;
103
-
104
- protected $_cacheKey;
105
-
106
- protected $_cacheTags = array();
107
-
108
- protected $_cacheLifetime = 86400;
109
-
110
- /**
111
- * Additional collection flags
112
- *
113
- * @var array
114
- */
115
- protected $_flags = array();
116
-
117
- public function __construct()
118
- {
119
-
120
- }
121
-
122
- /**
123
- * Add collection filter
124
- *
125
- * @param string $field
126
- * @param string $value
127
- * @param string $type and|or|string
128
- */
129
- public function addFilter($field, $value, $type = 'and')
130
- {
131
- $filter = new Varien_Object(); // implements ArrayAccess
132
- $filter['field'] = $field;
133
- $filter['value'] = $value;
134
- $filter['type'] = strtolower($type);
135
-
136
- $this->_filters[] = $filter;
137
- $this->_isFiltersRendered = false;
138
- return $this;
139
- }
140
-
141
- /**
142
- * Search for a filter by specified field
143
- *
144
- * Multiple filters can be matched if an array is specified:
145
- * - 'foo' -- get the first filter with field name 'foo'
146
- * - array('foo') -- get all filters with field name 'foo'
147
- * - array('foo', 'bar') -- get all filters with field name 'foo' or 'bar'
148
- * - array() -- get all filters
149
- *
150
- * @param string|array $field
151
- * @return Varien_Object|array|null
152
- */
153
- public function getFilter($field)
154
- {
155
- if (is_array($field)) {
156
- // empty array: get all filters
157
- if (empty($field)) {
158
- return $this->_filters;
159
- }
160
- // non-empty array: collect all filters that match specified field names
161
- $result = array();
162
- foreach ($this->_filters as $filter) {
163
- if (in_array($filter['field'], $field)) {
164
- $result[] = $filter;
165
- }
166
- }
167
- return $result;
168
- }
169
-
170
- // get a first filter by specified name
171
- foreach ($this->_filters as $filter) {
172
- if ($filter['field'] === $field) {
173
- return $filter;
174
- }
175
- }
176
- }
177
-
178
- /**
179
- * Retrieve collection loading status
180
- *
181
- * @return bool
182
- */
183
- public function isLoaded()
184
- {
185
- return $this->_isCollectionLoaded;
186
- }
187
-
188
- /**
189
- * Set collection loading status flag
190
- *
191
- * @param unknown_type $flag
192
- * @return unknown
193
- */
194
- protected function _setIsLoaded($flag = true)
195
- {
196
- $this->_isCollectionLoaded = $flag;
197
- return $this;
198
- }
199
-
200
- /**
201
- * Get current collection page
202
- *
203
- * @param int $displacement
204
- * @return int
205
- */
206
- public function getCurPage($displacement = 0)
207
- {
208
- if ($this->_curPage + $displacement < 1) {
209
- return 1;
210
- }
211
- elseif ($this->_curPage + $displacement > $this->getLastPageNumber()) {
212
- return $this->getLastPageNumber();
213
- } else {
214
- return $this->_curPage + $displacement;
215
- }
216
- }
217
-
218
- /**
219
- * Retrieve collection last page number
220
- *
221
- * @return int
222
- */
223
- public function getLastPageNumber()
224
- {
225
- $collectionSize = (int) $this->getSize();
226
- if (0 === $collectionSize) {
227
- return 1;
228
- }
229
- elseif($this->_pageSize) {
230
- return ceil($collectionSize/$this->_pageSize);
231
- }
232
- else{
233
- return 1;
234
- }
235
- }
236
-
237
- /**
238
- * Retrieve collection page size
239
- *
240
- * @return int
241
- */
242
- public function getPageSize()
243
- {
244
- return $this->_pageSize;
245
- }
246
-
247
- /**
248
- * Retrieve collection all items count
249
- *
250
- * @return int
251
- */
252
- public function getSize()
253
- {
254
- $this->load();
255
- if (is_null($this->_totalRecords)) {
256
- $this->_totalRecords = count($this->getItems());
257
- }
258
- return intval($this->_totalRecords);
259
- }
260
-
261
- /**
262
- * Retrieve collection first item
263
- *
264
- * @return Varien_Object
265
- */
266
- public function getFirstItem()
267
- {
268
- $this->load();
269
-
270
- if (count($this->_items)) {
271
- reset($this->_items);
272
- return current($this->_items);
273
- }
274
-
275
- return new $this->_itemObjectClass();
276
- }
277
-
278
- /**
279
- * Retrieve collection last item
280
- *
281
- * @return Varien_Object
282
- */
283
- public function getLastItem()
284
- {
285
- $this->load();
286
-
287
- if (count($this->_items)) {
288
- return end($this->_items);
289
- }
290
-
291
- return new $this->_itemObjectClass();
292
- }
293
-
294
- /**
295
- * Retrieve collection items
296
- *
297
- * @return array
298
- */
299
- public function getItems()
300
- {
301
- $this->load();
302
- return $this->_items;
303
- }
304
-
305
- /**
306
- * Retrieve field values from all items
307
- *
308
- * @param string $colName
309
- * @return array
310
- */
311
- public function getColumnValues($colName)
312
- {
313
- $this->load();
314
-
315
- $col = array();
316
- foreach ($this->getItems() as $item) {
317
- $col[] = $item->getData($colName);
318
- }
319
- return $col;
320
- }
321
-
322
- /**
323
- * Search all items by field value
324
- *
325
- * @param string $column
326
- * @param mixed $value
327
- * @return array
328
- */
329
- public function getItemsByColumnValue($column, $value)
330
- {
331
- $this->load();
332
-
333
- $res = array();
334
- foreach ($this as $item) {
335
- if ($item->getData($column)==$value) {
336
- $res[] = $item;
337
- }
338
- }
339
- return $res;
340
- }
341
-
342
- /**
343
- * Search first item by field value
344
- *
345
- * @param string $column
346
- * @param mixed $value
347
- * @return Varien_Object || null
348
- */
349
- public function getItemByColumnValue($column, $value)
350
- {
351
- $this->load();
352
-
353
- foreach ($this as $item) {
354
- if ($item->getData($column)==$value) {
355
- return $item;
356
- }
357
- }
358
- return null;
359
- }
360
-
361
- /**
362
- * Adding item to item array
363
- *
364
- * @param Varien_Object $item
365
- * @return Varien_Data_Collection
366
- */
367
- public function addItem(Varien_Object $item)
368
- {
369
- $itemId = $this->_getItemId($item);
370
-
371
- if (!is_null($itemId)) {
372
- if (isset($this->_items[$itemId])) {
373
- //throw new Exception('Item ('.get_class($item).') with the same id "'.$item->getId().'" already exist');
374
- }
375
- $this->_items[$itemId] = $item;
376
- } else {
377
- $this->_addItem($item);
378
- }
379
- return $this;
380
- }
381
-
382
- /**
383
- * Add item that has no id to collection
384
- *
385
- * @param Varien_Object $item
386
- * @return Varien_Data_Collection
387
- */
388
- protected function _addItem($item)
389
- {
390
- $this->_items[] = $item;
391
- return $this;
392
- }
393
-
394
- /**
395
- * Retrieve item id
396
- *
397
- * @param Varien_Object $item
398
- * @return mixed
399
- */
400
- protected function _getItemId(Varien_Object $item)
401
- {
402
- return $item->getId();
403
- }
404
-
405
- /**
406
- * Retrieve ids of all tems
407
- *
408
- * @return array
409
- */
410
- public function getAllIds()
411
- {
412
- $ids = array();
413
- foreach ($this->getItems() as $item) {
414
- $ids[] = $this->_getItemId($item);
415
- }
416
- return $ids;
417
- }
418
-
419
- /**
420
- * Remove item from collection by item key
421
- *
422
- * @param mixed $key
423
- * @return Varien_Data_Collection
424
- */
425
- public function removeItemByKey($key)
426
- {
427
- if (isset($this->_items[$key])) {
428
- unset($this->_items[$key]);
429
- }
430
- return $this;
431
- }
432
-
433
- /**
434
- * Clear collection
435
- *
436
- * @return Varien_Data_Collection
437
- */
438
- public function clear()
439
- {
440
- $this->_setIsLoaded(false);
441
- $this->_items = array();
442
- return $this;
443
- }
444
-
445
- /**
446
- * Walk through the collection and run model method or external callback
447
- * with optional arguments
448
- *
449
- * Returns array with results of callback for each item
450
- *
451
- * @param string $method
452
- * @param array $args
453
- * @return array
454
- */
455
- public function walk($callback, array $args=array())
456
- {
457
- $results = array();
458
- $useItemCallback = is_string($callback) && strpos($callback, '::')===false;
459
- foreach ($this->getItems() as $id=>$item) {
460
- if ($useItemCallback) {
461
- $cb = array($item, $callback);
462
- } else {
463
- $cb = $callback;
464
- array_unshift($args, $item);
465
- }
466
- $results[$id] = call_user_func_array($cb, $args);
467
- }
468
- return $results;
469
- }
470
-
471
- public function each($obj_method, $args=array())
472
- {
473
- foreach ($args->_items as $k => $item) {
474
- $args->_items[$k] = call_user_func($obj_method, $item);
475
- }
476
- }
477
-
478
- /**
479
- * Setting data for all collection items
480
- *
481
- * @param mixed $key
482
- * @param mixed $value
483
- * @return Varien_Data_Collection
484
- */
485
- public function setDataToAll($key, $value=null)
486
- {
487
- if (is_array($key)) {
488
- foreach ($key as $k=>$v) {
489
- $this->setDataToAll($k, $v);
490
- }
491
- return $this;
492
- }
493
- foreach ($this->getItems() as $item) {
494
- $item->setData($key, $value);
495
- }
496
- return $this;
497
- }
498
-
499
- /**
500
- * Set current page
501
- *
502
- * @param int $page
503
- * @return Varien_Data_Collection
504
- */
505
- public function setCurPage($page)
506
- {
507
- $this->_curPage = $page;
508
- return $this;
509
- }
510
-
511
- /**
512
- * Set collection page size
513
- *
514
- * @param int $size
515
- * @return Varien_Data_Collection
516
- */
517
- public function setPageSize($size)
518
- {
519
- $this->_pageSize = $size;
520
- return $this;
521
- }
522
-
523
- /**
524
- * Set select order
525
- *
526
- * @param string $field
527
- * @param string $direction
528
- * @return Varien_Data_Collection
529
- */
530
- public function setOrder($field, $direction = self::SORT_ORDER_DESC)
531
- {
532
- $this->_orders[$field] = $direction;
533
- return $this;
534
- }
535
-
536
- /**
537
- * Set collection item class name
538
- *
539
- * @param string $className
540
- * @return Varien_Data_Collection
541
- */
542
- function setItemObjectClass($className)
543
- {
544
- $className = Mage::getConfig()->getModelClassName($className);
545
- /**
546
- * is_subclass_of($className, 'Varien_Object') - Segmentation fault in php 5.2.3
547
- */
548
- /*if (!is_subclass_of($className, 'Varien_Object')) {
549
- throw new Exception($className.' does not extends from Varien_Object');
550
- }*/
551
- $this->_itemObjectClass = $className;
552
- return $this;
553
- }
554
-
555
- /**
556
- * Retrieve collection empty item
557
- *
558
- * @return Varien_Object
559
- */
560
- public function getNewEmptyItem()
561
- {
562
- return new $this->_itemObjectClass();
563
- }
564
-
565
- /**
566
- * Render sql select conditions
567
- *
568
- * @return Varien_Data_Collection
569
- */
570
- protected function _renderFilters()
571
- {
572
- return $this;
573
- }
574
-
575
- /**
576
- * Render sql select orders
577
- *
578
- * @return Varien_Data_Collection
579
- */
580
- protected function _renderOrders()
581
- {
582
- return $this;
583
- }
584
-
585
- /**
586
- * Render sql select limit
587
- *
588
- * @return Varien_Data_Collection
589
- */
590
- protected function _renderLimit()
591
- {
592
- return $this;
593
- }
594
-
595
- /**
596
- * Set select distinct
597
- *
598
- * @param bool $flag
599
- */
600
- public function distinct($flag)
601
- {
602
- return $this;
603
- }
604
-
605
- /**
606
- * Load data
607
- *
608
- * @return Varien_Data_Collection
609
- */
610
- public function loadData($printQuery = false, $logQuery = false)
611
- {
612
- return $this;
613
- }
614
-
615
- /**
616
- * Load data
617
- *
618
- * @return Varien_Data_Collection
619
- */
620
- public function load($printQuery = false, $logQuery = false)
621
- {
622
- return $this->loadData($printQuery, $logQuery);
623
- }
624
-
625
- /**
626
- * Convert collection to XML
627
- *
628
- * @return string
629
- */
630
- public function toXml()
631
- {
632
- $xml = '<?xml version="1.0" encoding="UTF-8"?>
633
- <collection>
634
- <totalRecords>'.$this->_totalRecords.'</totalRecords>
635
- <items>';
636
-
637
- foreach ($this as $item) {
638
- $xml.=$item->toXml();
639
- }
640
- $xml.= '</items>
641
- </collection>';
642
- return $xml;
643
- }
644
-
645
- /**
646
- * Convert collection to array
647
- *
648
- * @return array
649
- */
650
- public function toArray($arrRequiredFields = array())
651
- {
652
- $arrItems = array();
653
- $arrItems['totalRecords'] = $this->getSize();
654
-
655
- $arrItems['items'] = array();
656
- foreach ($this as $item) {
657
- $arrItems['items'][] = $item->toArray($arrRequiredFields);
658
- }
659
- return $arrItems;
660
- }
661
-
662
- /**
663
- * Convert items array to array for select options
664
- *
665
- * return items array
666
- * array(
667
- * $index => array(
668
- * 'value' => mixed
669
- * 'label' => mixed
670
- * )
671
- * )
672
- *
673
- * @param string $valueField
674
- * @param string $labelField
675
- * @return array
676
- */
677
- protected function _toOptionArray($valueField='id', $labelField='name', $additional=array())
678
- {
679
- $res = array();
680
- $additional['value'] = $valueField;
681
- $additional['label'] = $labelField;
682
-
683
- foreach ($this as $item) {
684
- foreach ($additional as $code => $field) {
685
- $data[$code] = $item->getData($field);
686
- }
687
- $res[] = $data;
688
- }
689
- return $res;
690
- }
691
-
692
- public function toOptionArray()
693
- {
694
- return $this->_toOptionArray();
695
- }
696
-
697
- public function toOptionHash()
698
- {
699
- return $this->_toOptionHash();
700
- }
701
-
702
- /**
703
- * Convert items array to hash for select options
704
- *
705
- * return items hash
706
- * array($value => $label)
707
- *
708
- * @param string $valueField
709
- * @param string $labelField
710
- * @return array
711
- */
712
- protected function _toOptionHash($valueField='id', $labelField='name')
713
- {
714
- $res = array();
715
- foreach ($this as $item) {
716
- $res[$item->getData($valueField)] = $item->getData($labelField);
717
- }
718
- return $res;
719
- }
720
-
721
- /**
722
- * Retrieve item by id
723
- *
724
- * @param mixed $idValue
725
- * @return Varien_Object
726
- */
727
- public function getItemById($idValue)
728
- {
729
- $this->load();
730
- if (isset($this->_items[$idValue])) {
731
- return $this->_items[$idValue];
732
- }
733
- return null;
734
- }
735
-
736
- /**
737
- * Implementation of IteratorAggregate::getIterator()
738
- */
739
- public function getIterator()
740
- {
741
- $this->load();
742
- return new ArrayIterator($this->_items);
743
- }
744
-
745
- /**
746
- * Retireve count of collection loaded items
747
- *
748
- * @return int
749
- */
750
- public function count()
751
- {
752
- $this->load();
753
-
754
- return count($this->_items);
755
- }
756
-
757
- public function setCacheKey($key)
758
- {
759
- $this->_cacheKey = $key;
760
- return $this;
761
- }
762
-
763
- public function getCacheKey()
764
- {
765
- return $this->_cacheKey;
766
- }
767
-
768
- public function setCacheTags($tags)
769
- {
770
- $this->_cacheTags = $tags;
771
- return $this;
772
- }
773
-
774
- public function getCacheTags()
775
- {
776
- return $this->_cacheTags;
777
- }
778
-
779
- public function getCacheLifetime()
780
- {
781
- return $this->_cacheLifetime;
782
- }
783
-
784
- /**
785
- * Retrieve Flag
786
- *
787
- * @param string $flag
788
- * @return mixed
789
- */
790
- public function getFlag($flag)
791
- {
792
- return isset($this->_flags[$flag]) ? $this->_flags[$flag] : null;
793
- }
794
-
795
- /**
796
- * Set Flag
797
- *
798
- * @param string $flag
799
- * @param mixed $value
800
- * @return Varien_Data_Collection
801
- */
802
- public function setFlag($flag, $value = null)
803
- {
804
- $this->_flags[$flag] = $value;
805
- return $this;
806
- }
807
-
808
- /**
809
- * Has Flag
810
- *
811
- * @param string $flag
812
- * @return bool
813
- */
814
- public function hasFlag($flag)
815
- {
816
- return array_key_exists($flag, $this->_flags);
817
- }
818
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/connector/email.xml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <adminhtml_email_dashboard_index>
4
+ <reference name="left">
5
+ <block type="adminhtml/system_config_switcher" name="store_switcher" as="store_switcher"
6
+ template="connector/dashboard/switcher.phtml">
7
+ <action method="setUseConfirm">
8
+ <params>0</params>
9
+ </action>
10
+ </block>
11
+ </reference>
12
+ <reference name="content">
13
+ <block type="email_connector/adminhtml_dashboard_content" template="connector/dashboard/content.phtml">
14
+
15
+ </block>
16
+ </reference>
17
+ </adminhtml_email_dashboard_index>
18
+ <adminhtml_email_contact_index>
19
+ <reference name="menu">
20
+ <action method="setActive">
21
+ <menupath>newsletter/email_contact/email_connector_contact</menupath>
22
+ </action>
23
+ </reference>
24
+ <reference name="content">
25
+ <block type="email_connector/adminhtml_contact" name="email_contact">
26
+ <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
27
+ <action method="setUseConfirm"><params>0</params></action>
28
+ </block>
29
+ </block>
30
+ </reference>
31
+ </adminhtml_email_contact_index>
32
+ <adminhtml_email_contact_grid>
33
+ <block type="core/text_list" name="root" output="toHtml">
34
+ <block type="email_connector/adminhtml_contact_grid" name="contact_grid"/>
35
+ </block>
36
+ </adminhtml_email_contact_grid>
37
+ <adminhtml_email_contact_edit>
38
+ <reference name="menu">
39
+ <action method="setActive">
40
+ <menupath>newsletter/email_contact/email_conector_contact</menupath>
41
+ </action>
42
+ </reference>
43
+ <reference name="content">
44
+ <block type="email_connector/adminhtml_contact_edit" name="email_contact_edit"></block>
45
+ </reference>
46
+ </adminhtml_email_contact_edit>
47
+ <adminhtml_email_campaign_index>
48
+ <reference name="menu">
49
+ <action method="setActive">
50
+ <menupath>newsletter/email_contact/email_connector_campaign</menupath>
51
+ </action>
52
+ </reference>
53
+ <reference name="content">
54
+ <block type="email_connector/adminhtml_campaign" name="email_campaign">
55
+ <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
56
+ <action method="setUseConfirm"><params>0</params></action>
57
+ </block>
58
+ </block>
59
+ </reference>
60
+ </adminhtml_email_campaign_index>
61
+ <adminhtml_email_campaign_grid>
62
+ <block type="core/text_list" name="root" output="toHtml">
63
+ <block type="email_connector/adminhtml_campaign_grid" name="campaign_grid"/>
64
+ </block>
65
+ </adminhtml_email_campaign_grid>
66
+ <adminhtml_email_campaign_edit>
67
+ <reference name="menu">
68
+ <action method="setActive">
69
+ <menupath>newsletter/email_contact/email_conector_campaign</menupath>
70
+ </action>
71
+ </reference>
72
+ <reference name="content">
73
+ <block type="email_connector/adminhtml_campaign_edit" name="email_campaign_edit"></block>
74
+ </reference>
75
+ </adminhtml_email_campaign_edit>
76
+
77
+ </config>
app/design/adminhtml/default/default/template/connector/dashboard/accountbar.phtml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php if( sizeof($this->getTotals()) > 0 ): ?>
2
+ <?php foreach( $this->getTotals() as $_total ): ?>
3
+ <div class="entry-edit" style="width: 400px">
4
+ <div class="entry-edit-head"><h4><?php echo $_total['label'] ?></h4></div>
5
+ <fieldset class="a-center bold">
6
+ <span class="nowrap" style="font-size:18px;color:#EA7601;"><?php echo $_total['value'] ?><span style="font-size:14px; color:#686868;"><?php echo $_total['decimals'] ?></span></span>
7
+ </fieldset>
8
+ </div>
9
+ <?php endforeach; ?>
10
+ <?php endif; ?>
app/design/adminhtml/default/default/template/connector/dashboard/content.phtml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="<?php echo $this->getHeaderWidth() ?>"><?php echo $this->getHeaderHtml() ?></td>
5
+ <td class="form-buttons"><?php echo $this->getButtonsHtml() ?></td>
6
+ </tr>
7
+ </table>
8
+ </div>
app/design/adminhtml/default/default/template/connector/dashboard/switcher.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="switcher">
2
+ <label for="store_switcher"><?php echo $this->__('Current Website') ?></label>
3
+ <?php echo $this->getHintHtml() ?>
4
+ <select id="store_switcher" class="system-config-store-switcher" onchange="location.href=this.options[this.selectedIndex].getAttribute('url')">
5
+ <?php foreach ($this->getStoreSelectOptions() as $_value => $_option): ?>
6
+ <?php if (isset($_option['is_group'])): ?>
7
+ <?php if ($_option['is_close']): ?>
8
+ </optgroup>
9
+ <?php else: ?>
10
+ <optgroup label="<?php echo $this->escapeHtml($_option['label']) ?>" style="<?php echo $_option['style'] ?>">
11
+ <?php endif; ?>
12
+ <?php continue ?>
13
+ <?php endif; ?>
14
+ <option value="<?php echo $this->escapeHtml($_value) ?>" url="<?php echo $_option['url'] ?>" <?php echo $_option['selected'] ? 'selected="selected"' : '' ?> style="<?php echo $_option['style'] ?>">
15
+ <?php echo $this->escapeHtml($_option['label']) ?>
16
+ </option>
17
+ <?php endforeach ?>
18
+ </select>
19
+ <?php if (Mage::getSingleton('admin/session')->isAllowed('system/store')): ?>
20
+ <p style="margin:10px 0 0;">
21
+ <a href="<?php echo $this->getUrl('*/system_store') ?>"><?php echo $this->__('Manage Stores') ?></a>
22
+ </p>
23
+ <?php endif; ?>
24
+ </div>
app/design/adminhtml/default/default/template/connector/grid.phtml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3 class="icon-head <?php echo $this->getHeadClass();?>"><?php echo $this->getHeaderText(); ?></h3></td>
5
+ <td class="a-right">
6
+ <?php echo $this->getButtonsHtml() ?>
7
+ </td>
8
+ </tr>
9
+ </table>
10
+ </div>
11
+ <?php if( !Mage::app()->isSingleStoreMode() ): ?>
12
+ <?php echo $this->getChildHtml('store_switcher');?>
13
+ <?php endif;?>
14
+ <div>
15
+ <?php echo $this->getGridHtml() ?>
16
+ </div>
app/design/adminhtml/default/default/template/connector/system/config/createdatafield.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <form action="<?php echo $this->getFormUrl(); ?>" id="connector_create_datafield" method="post">
3
+ <?php // echo $this->getBlockHtml('formkey')?>
4
+ <?php echo $this->getButtonHtml(); ?>
5
+ </form>
6
+
7
+
8
+ <form action="<?php echo $this->getPreviewUrl() ?>" method="post" id="emv_template_preview_form" target="_blank" >
9
+ <?php echo $this->getBlockHtml('formkey')?>
10
+ <div class="no-display">
11
+ <input type="hidden" id="preview_mage_template_id" name="mage_template_id" value="" />
12
+ <input type="hidden" id="preview_emv_send_mail_mode_id" name="emv_send_mail_mode_id" value="" />
13
+ <input type="hidden" id="preview_emv_template_id" name="emv_template_id" value="" />
14
+ <input type="hidden" id="preview_emv_account_id" name="emv_account_id" value="" />
15
+ <div id="preview-attribute-value"></div>
16
+ </div>
17
+ </form>
app/design/frontend/base/default/layout/connector.xml CHANGED
@@ -10,28 +10,21 @@
10
  <block type="checkout/onepage_success" name="checkout.roi" as="connector.roi" template="connector/roi_code.phtml"/>
11
  </reference>
12
  </checkout_onepage_success>
13
- <connector_email_products>
14
- <reference name="root">
15
- <action method="setTemplate"><template>page/blank.phtml</template></action>
16
- </reference>
17
- <reference name="content">
18
- <block type="connector/products" name="email.products" as="email.products" template="page/connector/products.phtml"/>
19
- </reference>
20
- </connector_email_products>
21
  <connector_email_coupon>
22
  <reference name="root">
23
  <action method="setTemplate"><template>page/blank.phtml</template></action>
24
  </reference>
25
  <reference name="content">
26
- <block type="connector/coupon" name="email.coupon" as="email.coupon" template="connector/coupon.phtml"/>
27
  </reference>
28
  </connector_email_coupon>
29
- <connector_email_basket>
30
  <reference name="root">
31
  <action method="setTemplate"><template>page/blank.phtml</template></action>
32
  </reference>
33
  <reference name="content">
34
- <block type="connector/basket" name="email.basket" as="email.basket" template="connector/basket.phtml"/>
35
  </reference>
36
- </connector_email_basket>
 
37
  </layout>
10
  <block type="checkout/onepage_success" name="checkout.roi" as="connector.roi" template="connector/roi_code.phtml"/>
11
  </reference>
12
  </checkout_onepage_success>
 
 
 
 
 
 
 
 
13
  <connector_email_coupon>
14
  <reference name="root">
15
  <action method="setTemplate"><template>page/blank.phtml</template></action>
16
  </reference>
17
  <reference name="content">
18
+ <block type="email_connector/coupon" name="email.coupon" as="email.coupon" template="connector/coupon.phtml"/>
19
  </reference>
20
  </connector_email_coupon>
21
+ <connector_order_update>
22
  <reference name="root">
23
  <action method="setTemplate"><template>page/blank.phtml</template></action>
24
  </reference>
25
  <reference name="content">
26
+ <block type="email_connector/order_update" name="connector.order.update" as="connector.order.update" template="connector/sales/order/update.phtml"/>
27
  </reference>
28
+ </connector_order_update>
29
+
30
  </layout>
app/design/frontend/base/default/template/connector/basket.phtml CHANGED
@@ -39,7 +39,7 @@ $helper = Mage::helper('core');
39
  ?>
40
  <tr>
41
  <td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">
42
- <img alt="" src="<?php echo $img;?>" width="85" align="absmiddle" border="0" height="85">
43
  </td>
44
  <td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">Product Name : <a href="<?php echo $productUrl;?>"><?php echo $name . '</a></br>'. $inStock;?></td>
45
  <td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;"><?php echo (int)$one->getQty();?></td>
39
  ?>
40
  <tr>
41
  <td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">
42
+ <img alt="" src="<?php echo $img;?>" width="85" align="middle" border="0" height="85">
43
  </td>
44
  <td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">Product Name : <a href="<?php echo $productUrl;?>"><?php echo $name . '</a></br>'. $inStock;?></td>
45
  <td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;"><?php echo (int)$one->getQty();?></td>
app/design/frontend/base/default/template/connector/creditmemo/items.phtml ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder();
2
+ $creditmemoItems = $this->getCreditmemoItems();
3
+ ?>
4
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
5
+ <thead>
6
+ <tr>
7
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Item</th>
8
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">SKU</th>
9
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Qty</th>
10
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Subtotal</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+
15
+
16
+ <?php $i=0; foreach ($creditmemoItems as $_item): $i++ ?>
17
+ <?php
18
+ if($_item->getParentItemId()) continue;?>
19
+ <tr <?php echo $i%2?'bgcolor="#eeeded"':'' ?>>
20
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;" width="70%"><?php echo $_item->getName() ?></td>
21
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"><?php echo $_item->getSku();?></td>
22
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"><?php echo sprintf('%s', $_item->getQtyOrdered()) ?></td>
23
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
24
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
25
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
26
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
27
+ <?php endif; ?>
28
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
29
+ <?php echo $_order->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
30
+ <?php else: ?>
31
+ <?php echo $_order->formatPrice($_item->getRowTotal()) ?>
32
+ <?php endif; ?>
33
+
34
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
35
+ <br />
36
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
37
+ <small>
38
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
39
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
40
+ <?php endforeach; ?>
41
+ </small>
42
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
43
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
44
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
45
+ <?php endforeach; ?>
46
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
47
+ <small>
48
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
49
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
50
+ <?php endforeach; ?>
51
+ </small>
52
+ <?php endif; ?>
53
+
54
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
55
+ <br />
56
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $_order->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
57
+ <?php endif; ?>
58
+ <?php endif; ?>
59
+ <?php endif; ?>
60
+
61
+
62
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
63
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
64
+ <br /><span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
65
+ <?php endif; ?>
66
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
67
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
68
+ <?php echo $_order->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
69
+ <?php else: ?>
70
+ <?php echo $_order->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
71
+ <?php endif; ?>
72
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
73
+ <br />
74
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
75
+ <small>
76
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
77
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
78
+ <?php endforeach; ?>
79
+ </small>
80
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
81
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
82
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
83
+ <?php endforeach; ?>
84
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
85
+ <small>
86
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
87
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
88
+ <?php endforeach; ?>
89
+ </small>
90
+ <?php endif; ?>
91
+
92
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
93
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $_order->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
94
+ <?php endif; ?>
95
+ <?php endif; ?>
96
+ <?php endif; ?>
97
+ </td>
98
+ </tr>
99
+ <?php endforeach ?>
100
+
101
+ </tbody>
102
+ <tfoot>
103
+
104
+ <tr>
105
+ <td></td>
106
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Subtotal') ?></td>
107
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getSubtotal()) ?></td>
108
+ </tr>
109
+ <?php
110
+
111
+ if ($_order->getDiscountAmount() > 0): ?>
112
+ <tr>
113
+ <td></td>
114
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Discount') ?></td>
115
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getDiscountAmount()) ?></td>
116
+ </tr>
117
+ <?php endif; ?>
118
+ <?php if ($_order->getShippingAmount() > 0): ?>
119
+ <tr>
120
+ <td></td>
121
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Shipping Amount') ?></td>
122
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getShippingAmount()) ?></td>
123
+ </tr>
124
+ <?php endif; ?>
125
+ <?php if ($_order->getTaxAmount() > 0): ?>
126
+ <tr>
127
+ <td></td>
128
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Tax Amount') ?></td>
129
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getTaxAmount()) ?></td>
130
+ </tr>
131
+ <?php endif; ?>
132
+ <tr>
133
+ <td></td>
134
+ <td colspan="2" align="right" style="padding:3px 9px"><strong><?php echo Mage::helper('sales')->__('Grand Total') ?></strong></td>
135
+ <td align="right" style="padding:6px 9px"><strong><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></strong></td>
136
+ </tr>
137
+ </tfoot>
138
+ </table>
139
+
140
+
app/design/frontend/base/default/template/connector/creditmemo/new.phtml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder();
2
+ $creditmemo = $order->getCreditmemosCollection()->getFirstItem();
3
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
4
+ ?>
5
+ <style>
6
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
7
+ </style>
8
+ <body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
9
+ <div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
10
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
11
+ <tr>
12
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
13
+ <!-- [ header starts here] -->
14
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
15
+ <!-- [ middle starts here] -->
16
+ <tr>
17
+ <td>
18
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Credit Memo #<?php echo $creditmemo->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <td>
23
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
24
+ <thead>
25
+ <tr>
26
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
27
+ <th width="10"></th>
28
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
29
+ </tr>
30
+ </thead>
31
+ <tbody>
32
+ <tr>
33
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
34
+ <?php echo $order->getBillingAddress()->format('html');?>
35
+ </td>
36
+ <td>&nbsp;</td>
37
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
38
+ <?php echo $paymentBlock->toHtml();?>
39
+ </td>
40
+ </tr>
41
+ </tbody>
42
+ </table>
43
+ <br/>
44
+ <?php if($order->getIsNotVirtual()):?>
45
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
46
+ <thead>
47
+ <tr>
48
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
49
+ <th width="10"></th>
50
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
51
+ </tr>
52
+ </thead>
53
+ <tbody>
54
+ <tr>
55
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
56
+ <?php echo $order->getShippingAddress()->format('html');?>
57
+ &nbsp;
58
+ </td>
59
+ <td>&nbsp;</td>
60
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
61
+ <?php echo $order->getShippingDescription();?>
62
+ &nbsp;
63
+ </td>
64
+ </tr>
65
+ </tbody>
66
+ </table>
67
+ <br/>
68
+ <?php endif;?>
69
+ <?php echo $this->getChildHtml('connector_creditmemo_items');?>
70
+ </td>
71
+ </tr>
72
+ </table>
73
+ </td>
74
+ </tr>
75
+ </table>
76
+ </div>
77
+ </body>
app/design/frontend/base/default/template/connector/creditmemo/newguest.phtml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder();
2
+ $creditmemo = $order->getCreditmemosCollection()->getFirstItem();
3
+ $billing = $order->getBillingAddress();
4
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
5
+ ?>
6
+ <style>
7
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
8
+ </style>
9
+ <body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
10
+ <div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
12
+ <tr>
13
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
14
+ <!-- [ header starts here] -->
15
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
16
+ <!-- [ middle starts here] -->
17
+ <tr>
18
+ <td>
19
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Credit Memo #<?php echo $creditmemo->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
20
+ </td>
21
+ </tr>
22
+ <tr>
23
+ <td>
24
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
25
+ <thead>
26
+ <tr>
27
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
28
+ <th width="10"></th>
29
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
30
+ </tr>
31
+ </thead>
32
+ <tbody>
33
+ <tr>
34
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
35
+ <?php echo $order->getBillingAddress()->format('html');?>
36
+ </td>
37
+ <td>&nbsp;</td>
38
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
39
+ <?php echo $paymentBlock->toHtml();?>
40
+ </td>
41
+ </tr>
42
+ </tbody>
43
+ </table>
44
+ <br/>
45
+ <?php if($order->getIsNotVirtual()):?>
46
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
47
+ <thead>
48
+ <tr>
49
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
50
+ <th width="10"></th>
51
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
52
+ </tr>
53
+ </thead>
54
+ <tbody>
55
+ <tr>
56
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
57
+ <?php echo $order->getShippingAddress()->format('html');?>
58
+ &nbsp;
59
+ </td>
60
+ <td>&nbsp;</td>
61
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
62
+ <?php echo $order->getShippingDescription();?>
63
+ &nbsp;
64
+ </td>
65
+ </tr>
66
+ </tbody>
67
+ </table>
68
+ <br/>
69
+ <?php endif;?>
70
+ <?php echo $this->getChildHtml('connector_creditmemo_items');?>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </td>
75
+ </tr>
76
+ </table>
77
+ </div>
78
+ </body>
app/design/frontend/base/default/template/connector/creditmemo/update.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder();
2
+ $creditmemo = $order->getCreditmemosCollection()->getFirstItem();
3
+ $comment = $creditmemo->getCommentsCollection()->getFirstItem()->getComment();
4
+ ?>
5
+ <style>
6
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
7
+ </style>
8
+ <body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
9
+ <div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
10
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
11
+ <tr>
12
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
13
+ <!-- [ header starts here] -->
14
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
15
+ <!-- [ middle starts here] -->
16
+ <tr>
17
+ <td valign="top">
18
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
19
+ Your order # <?php echo $order->getIncrementId();?> has been <br/>
20
+ <strong><?php echo $order->getStatusLabel();?></strong>.
21
+ </p>
22
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="<?php echo $this->getBaseUrl();?>customer/account/" style="color:#1E7EC8;">logging into your account</a>.</p>
23
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
24
+ </td>
25
+ </tr>
26
+ </table>
27
+ </td>
28
+ </tr>
29
+ </table>
30
+ </div>
31
+ </body>
app/design/frontend/base/default/template/connector/creditmemo/updateguest.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder();
2
+ $creditmemo = $order->getCreditmemosCollection()->getFirstItem();
3
+ $billing = $order->getBillingAddress();
4
+ $comment = $creditmemo->getCommentsCollection()->getFirstItem()->getComment();
5
+ ?>
6
+ <style>
7
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
8
+ </style>
9
+ <body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
10
+ <div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
12
+ <tr>
13
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
14
+ <!-- [ header starts here] -->
15
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
16
+ <!-- [ middle starts here] -->
17
+ <tr>
18
+ <td valign="top">
19
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
20
+ Your order # <?php echo $order->getIncrementId();?> has been <br/>
21
+ <strong><?php echo $order->getStatusLabel();?></strong>.
22
+ </p>
23
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
24
+ </td>
25
+ </tr>
26
+ </table>
27
+ </td>
28
+ </tr>
29
+ </table>
30
+ </div>
31
+ </body>
app/design/frontend/base/default/template/connector/customer.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $products = $this->getRecommendedProducts();
3
+ $displayType = $this->getDisplayType();
4
+ $i = 0;
5
+ foreach ($products as $key => $_product) :?>
6
+ <?php if($i == 0):?>
7
+ <table border="0" bordercolor="#FFCC00" width="147" cellpadding="0" cellspacing="0" style='font-family:arial; border-collapse: collapse; font-size:12;'><tr>
8
+ <?php endif;?>
9
+ <?php
10
+ //LIST MODE
11
+ if($displayType == 'list'){
12
+ echo '</tr><tr>';
13
+ }?>
14
+
15
+ <td style="vertical-align: text-top; padding-right: 2px;">
16
+
17
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="140" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" align="middle" /></a>
18
+
19
+ <div align="center"><b><?php echo substr($_product->getName(), 0, 40);?></b></div>
20
+
21
+ <div align="center"><?php echo $this->getPriceHtml($_product, true);?></div>
22
+ <div align="center"><a href="<?php echo $_product->getProductUrl();?>">View Now</a></div>
23
+ </td>
24
+
25
+ <?php if($i++ % 4 ==3 && $displayType == 'grid') echo '</tr><tr>'?>
26
+
27
+ <?php endforeach;?>
28
+ <?php if( $i > 0) echo '</table>';
29
+
30
+
app/design/frontend/base/default/template/connector/invoice/new.phtml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $order = $this->getOrder();
3
+ $invoice = $order->getInvoiceCollection()->getLastItem();
4
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
5
+ ?>
6
+ <style>
7
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
8
+ </style>
9
+ <body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
10
+ <div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
12
+ <tr>
13
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
14
+ <!-- [ header starts here] -->
15
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
16
+ <!-- [ middle starts here] -->
17
+ <tr>
18
+ <td valign="top">
19
+ <p style="font-size:12px; line-height:16px; margin:0;">
20
+ You can check the status of your order by <a href="<?php echo $this->getBaseUrl();?>customer/account/" style="color:#1E7EC8;">logging into your account</a>.
21
+ </p>
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <td>
26
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Invoice #<?php echo $invoice->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
27
+ </td>
28
+ </tr>
29
+ <tr>
30
+ <td>
31
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
32
+ <thead>
33
+ <tr>
34
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
35
+ <th width="10"></th>
36
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
37
+ </tr>
38
+ </thead>
39
+ <tbody>
40
+ <tr>
41
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
42
+ <?php echo $order->getBillingAddress()->format('html');?>
43
+ </td>
44
+ <td>&nbsp;</td>
45
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
46
+ <?php echo $paymentBlock->toHtml();?>
47
+ </td>
48
+ </tr>
49
+ </tbody>
50
+ </table>
51
+ <br/>
52
+ <?php if ($order->getIsNotVirtual()):?>
53
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
54
+ <thead>
55
+ <tr>
56
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
57
+ <th width="10"></th>
58
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
59
+ </tr>
60
+ </thead>
61
+ <tbody>
62
+ <tr>
63
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
64
+ <?php echo $order->getShippingAddress()->format('html');?>
65
+ &nbsp;
66
+ </td>
67
+ <td>&nbsp;</td>
68
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
69
+ <?php echo $order->getShippingDescription();?>&nbsp;
70
+ </td>
71
+ </tr>
72
+ </tbody>
73
+ </table>
74
+ <br/>
75
+ <?php endif;?>
76
+ <?php echo $this->getChildHtml('connector_order_items');?>
77
+ </td>
78
+ </tr>
79
+ <tr>
80
+ </tr>
81
+ </table>
82
+ </td>
83
+ </tr>
84
+ </table>
85
+ </div>
86
+ </body>
app/design/frontend/base/default/template/connector/invoice/newguest.phtml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $order = $this->getOrder();
3
+ $invoice = $order->getInvoiceCollection()->getLastItem();
4
+ $billing = $order->getBillingAddress();
5
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
6
+ ?>
7
+ <style>
8
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
9
+ </style>
10
+ <body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
12
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
13
+ <tr>
14
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
15
+ <!-- [ header starts here] -->
16
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
17
+ <!-- [ middle starts here] -->
18
+ <tr>
19
+ <td>
20
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Invoice #<?php echo $invoice->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
21
+ </td>
22
+ </tr>
23
+ <tr>
24
+ <td>
25
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
26
+ <thead>
27
+ <tr>
28
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
29
+ <th width="10"></th>
30
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
31
+ </tr>
32
+ </thead>
33
+ <tbody>
34
+ <tr>
35
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
36
+ <?php echo $billing->format('html');?>
37
+ </td>
38
+ <td>&nbsp;</td>
39
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
40
+ <?php echo $paymentBlock->toHtml();?>
41
+ </td>
42
+ </tr>
43
+ </tbody>
44
+ </table>
45
+ <br/>
46
+ <?php if($order->getIsNotVirtual()):?>
47
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
48
+ <thead>
49
+ <tr>
50
+ <th align="left" width="650" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
51
+ <th width="10"></th>
52
+ <th align="left" width="650" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
53
+ </tr>
54
+ </thead>
55
+ <tbody>
56
+ <tr>
57
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
58
+ <?php echo $order->getShippingAddress()->format('html');?>
59
+ &nbsp;
60
+ </td>
61
+ <td>&nbsp;</td>
62
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
63
+ <?php echo $order->getShippingDescription();?>
64
+ &nbsp;
65
+ </td>
66
+ </tr>
67
+ </tbody>
68
+ </table>
69
+ <br/>
70
+ <?php endif;?>
71
+ <?php echo $this->getChildHtml('connector_order_items');?>
72
+ </td>
73
+ </tr>
74
+ </table>
75
+ </td>
76
+ </tr>
77
+ </table>
78
+ </div>
79
+ </body>
app/design/frontend/base/default/template/connector/invoice/update.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder();
2
+ $invoice = $order->getInvoiceCollection()->getLastItem();
3
+ $comment = $invoice->getCommentsCollection()->getFirstItem()->getComment();
4
+ $billing = $order->getBillingAddress();
5
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
6
+ ?>
7
+ <style>
8
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
9
+ </style>
10
+ <body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
12
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
13
+ <tr>
14
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
15
+ <!-- [ header starts here] -->
16
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
17
+ <!-- [ middle starts here] -->
18
+ <tr>
19
+ <td valign="top">
20
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
21
+ Your order # <?php echo $order->getIncrementId();?> has been <br/>
22
+ <strong><?php echo $order->getStatusLabel();?></strong>.
23
+ </p>
24
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="<?php echo $this->getBaseUrl();?>customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>.</p>
25
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
26
+ </td>
27
+ </tr>
28
+ </table>
29
+ </td>
30
+ </tr>
31
+ </table>
32
+ </div>
33
+ </body>
app/design/frontend/base/default/template/connector/invoice/updateguest.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $order = $this->getOrder();
3
+ $invoice = $order->getInvoiceCollection()->getLastItem();
4
+ $comment = $invoice->getCommentsCollection()->getFirstItem()->getComment();
5
+ $billing = $order->getBillingAddress();
6
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
7
+ ?>
8
+ <style>
9
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
10
+ </style>
11
+ <body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
12
+ <div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
13
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
14
+ <tr>
15
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
16
+ <!-- [ header starts here] -->
17
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
18
+ <!-- [ middle starts here] -->
19
+ <tr>
20
+ <td valign="top">
21
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
22
+ Your order # <?php echo $order->getIncrementId();?> has been <br/>
23
+ <strong><?php echo $order->getStatusLabel();?></strong>.
24
+ </p>
25
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
26
+ </td>
27
+ </tr>
28
+ </table>
29
+ </td>
30
+ </tr>
31
+ </table>
32
+ </div>
33
+ </body>
app/design/frontend/base/default/template/connector/order/items.phtml ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder() ?>
2
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
3
+ <thead>
4
+ <tr>
5
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Item</th>
6
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">SKU</th>
7
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Qty</th>
8
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Subtotal</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+
13
+
14
+ <?php $i=0; foreach ($_order->getAllItems() as $_item): $i++ ?>
15
+ <?php
16
+ if($_item->getParentItemId()) continue;?>
17
+ <tr <?php echo $i%2?'bgcolor="#eeeded"':'' ?>>
18
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;" width="70%"><?php echo $_item->getName() ?></td>
19
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"><?php echo $_item->getSku();?></td>
20
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"><?php echo sprintf('%s', $_item->getQtyOrdered()) ?></td>
21
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
22
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
23
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
24
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
25
+ <?php endif; ?>
26
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
27
+ <?php echo $_order->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
28
+ <?php else: ?>
29
+ <?php echo $_order->formatPrice($_item->getRowTotal()) ?>
30
+ <?php endif; ?>
31
+
32
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
33
+ <br />
34
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
35
+ <small>
36
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
37
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
38
+ <?php endforeach; ?>
39
+ </small>
40
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
41
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
42
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
43
+ <?php endforeach; ?>
44
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
45
+ <small>
46
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
47
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
48
+ <?php endforeach; ?>
49
+ </small>
50
+ <?php endif; ?>
51
+
52
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
53
+ <br />
54
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $_order->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
55
+ <?php endif; ?>
56
+ <?php endif; ?>
57
+ <?php endif; ?>
58
+
59
+
60
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
61
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
62
+ <br /><span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
63
+ <?php endif; ?>
64
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
65
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
66
+ <?php echo $_order->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
67
+ <?php else: ?>
68
+ <?php echo $_order->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
69
+ <?php endif; ?>
70
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
71
+ <br />
72
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
73
+ <small>
74
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
75
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
76
+ <?php endforeach; ?>
77
+ </small>
78
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
79
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
80
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
81
+ <?php endforeach; ?>
82
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
83
+ <small>
84
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
85
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
86
+ <?php endforeach; ?>
87
+ </small>
88
+ <?php endif; ?>
89
+
90
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
91
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $_order->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
92
+ <?php endif; ?>
93
+ <?php endif; ?>
94
+ <?php endif; ?>
95
+ </td>
96
+ </tr>
97
+ <?php endforeach ?>
98
+
99
+ </tbody>
100
+ <tfoot>
101
+
102
+ <tr>
103
+ <td></td>
104
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Subtotal') ?></td>
105
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getSubtotal()) ?></td>
106
+ </tr>
107
+ <?php
108
+
109
+ if ($_order->getDiscountAmount() > 0): ?>
110
+ <tr>
111
+ <td></td>
112
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Discount') ?></td>
113
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getDiscountAmount()) ?></td>
114
+ </tr>
115
+ <?php endif; ?>
116
+ <?php if ($_order->getShippingAmount() > 0): ?>
117
+ <tr>
118
+ <td></td>
119
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Shipping Amount') ?></td>
120
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getShippingAmount()) ?></td>
121
+ </tr>
122
+ <?php endif; ?>
123
+ <?php if ($_order->getTaxAmount() > 0): ?>
124
+ <tr>
125
+ <td></td>
126
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Tax Amount') ?></td>
127
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getTaxAmount()) ?></td>
128
+ </tr>
129
+ <?php endif; ?>
130
+ <tr>
131
+ <td></td>
132
+ <td colspan="2" align="right" style="padding:3px 9px"><strong><?php echo Mage::helper('sales')->__('Grand Total') ?></strong></td>
133
+ <td align="right" style="padding:6px 9px"><strong><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></strong></td>
134
+ </tr>
135
+ </tfoot>
136
+ </table>
137
+
138
+
app/design/frontend/base/default/template/connector/order/new.phtml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $order = $this->getOrder();
3
+ $storeId = Mage::app()->getStore()->getId();
4
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
5
+ $paymentBlock->getMethod()->setStore($storeId);
6
+ ?>
7
+ <style>
8
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
9
+ </style>
10
+ <body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
12
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
13
+ <tr>
14
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
15
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
16
+ <tr>
17
+ <td>
18
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Order #<?php echo $order->getIncrementId();?> <small>(placed on <?php echo $order->getCreatedAtFormated('long');?>)</small></h2>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <td>
23
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
24
+ <thead>
25
+ <tr>
26
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
27
+ <th width="10"></th>
28
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
29
+ </tr>
30
+ </thead>
31
+ <tbody>
32
+ <tr>
33
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
34
+ <?php echo $order->getBillingAddress()->format('html');?>
35
+ </td>
36
+ <td>&nbsp;</td>
37
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
38
+ <?php echo $paymentBlock->toHtml();?>
39
+ </td>
40
+ </tr>
41
+ </tbody>
42
+ </table>
43
+ <br/>
44
+ <?php if($order->getIsNotVirtual()):?>
45
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
46
+ <thead>
47
+ <tr>
48
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
49
+ <th width="10"></th>
50
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
51
+ </tr>
52
+ </thead>
53
+ <tbody>
54
+ <tr>
55
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
56
+ <?php echo $order->getShippingAddress()->format('html');?>
57
+ &nbsp;
58
+ </td>
59
+ <td>&nbsp;</td>
60
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
61
+ <?php echo $order->getShippingDescription();?>
62
+ &nbsp;
63
+ </td>
64
+ </tr>
65
+ </tbody>
66
+ </table>
67
+ <br/>
68
+ <?php endif;?>
69
+ <?php echo $this->getChildHtml('connector_order_items');?>
70
+ <p style="font-size:12px; margin:0 0 10px 0"><?php echo $order->getEmailCustomerNote();?></p>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </td>
75
+ </tr>
76
+ </table>
77
+ </div>
78
+ </body>
app/design/frontend/base/default/template/connector/order/newguest.phtml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $order = $this->getOrder();
3
+ $storeId = Mage::app()->getStore()->getId();
4
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
5
+ $paymentBlock->getMethod()->setStore($storeId);
6
+ ?>
7
+ <style>
8
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
9
+ </style>
10
+ <body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
12
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
13
+ <tr>
14
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
15
+ <!-- [ header starts here] -->
16
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
17
+ <!-- [ middle starts here] -->
18
+ <tr>
19
+ <td>
20
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Order #<?php echo $order->getIncrementId();?> <small>(placed on <?php echo $order->getCreatedAtFormated('long');?>)</small></h2>
21
+ </td>
22
+ </tr>
23
+ <tr>
24
+ <td>
25
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
26
+ <thead>
27
+ <tr>
28
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
29
+ <th width="10"></th>
30
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
31
+ </tr>
32
+ </thead>
33
+ <tbody>
34
+ <tr>
35
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
36
+ <?php echo $order->getBillingAddress()->format('html');?>
37
+ </td>
38
+ <td>&nbsp;</td>
39
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
40
+ <?php echo $paymentBlock->toHtml();?>
41
+ </td>
42
+ </tr>
43
+ </tbody>
44
+ </table>
45
+ <br/>
46
+ <?php if($order->getIsNotVirtual()):?>
47
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
48
+ <thead>
49
+ <tr>
50
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
51
+ <th width="10"></th>
52
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
53
+ </tr>
54
+ </thead>
55
+ <tbody>
56
+ <tr>
57
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
58
+ <?php echo $order->getShippingAddress()->format('html');?>
59
+ &nbsp;
60
+ </td>
61
+ <td>&nbsp;</td>
62
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
63
+ <?php echo $order->getShippingDescription();?>
64
+ &nbsp;
65
+ </td>
66
+ </tr>
67
+ </tbody>
68
+ </table>
69
+ <br/>
70
+ <?php endif;?>
71
+ <?php echo $this->getChildHtml('connector_order_items');?>
72
+ <p style="font-size:12px; margin:0 10px 10px 0"><?php echo $order->getEmailCustomerNote();?></p>
73
+ </td>
74
+ </tr>
75
+ </table>
76
+ </td>
77
+ </tr>
78
+ </table>
79
+ </div>
80
+ </body>
app/design/frontend/base/default/template/connector/order/update.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $order = $this->getOrder();
3
+ $allstatues = $order->getAllStatusHistory();
4
+ $comment = (isset($allstatues[0]))? $allstatues[0]->getComment() : '';
5
+ ?>
6
+ <style>
7
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
8
+ </style>
9
+ <body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
10
+ <div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
12
+ <tr>
13
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
14
+ <!-- [ header starts here] -->
15
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
16
+ <!-- [ middle starts here] -->
17
+ <tr>
18
+ <td valign="top">
19
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
20
+ Your order # <?php echo $order->getIncrementId();?> has been <br/>
21
+ <strong><?php echo $order->getStatusLabel();?></strong>.
22
+ </p>
23
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="<?php echo $this->getBaseUrl();?>customer/account/" style="color:#1E7EC8;">logging into your account</a>.</p>
24
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
25
+ </td>
26
+ </tr>
27
+ </table>
28
+ </td>
29
+ </tr>
30
+ </table>
31
+ </div>
32
+ </body>
app/design/frontend/base/default/template/connector/order/updateguest.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $order = $this->getOrder();
3
+ $allstatues = $order->getAllStatusHistory();
4
+ $billing = $order->getBillingAddress();
5
+ $billingName = ($billing)? $billing->getName() : '';
6
+ $comment = (isset($allstatues[0]))? $allstatues[0]->getComment() : '';
7
+ ?>
8
+ <style>
9
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
10
+ </style>
11
+ <body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
12
+ <div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
13
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
14
+ <tr>
15
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
16
+ <!-- [ header starts here] -->
17
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
18
+ <!-- [ middle starts here] -->
19
+ <tr>
20
+ <td valign="top">
21
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
22
+ Your order # <?php echo $order->getIncrementId();?> has been <br/>
23
+ <strong><?php echo $order->getStatusLabel();?></strong>.
24
+ </p>
25
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
26
+ </td>
27
+ </tr>
28
+ </table>
29
+ </td>
30
+ </tr>
31
+ </table>
32
+ </div>
33
+ </body>
app/design/frontend/base/default/template/connector/product/list.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $products = $this->getLoadedProductCollection();
3
+ $mode = $this->getMode();
4
+ $i = 0;
5
+ foreach ($products as $key => $_product) :?>
6
+ <?php if($i == 0):?>
7
+ <style>
8
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_RECOMMENDED_STYLING);?>
9
+ </style>
10
+
11
+ <table border="0" width="147" cellpadding="0" cellspacing="0" style='font-family:arial; border-collapse: collapse; font-size:12;'><tr>
12
+ <?php endif;?>
13
+ <?php
14
+ //LIST MODE
15
+ if($mode == 'list'){
16
+ echo '</tr><tr>';
17
+ }?>
18
+
19
+ <td style="vertical-align: text-top; padding-right: 2px;">
20
+
21
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="140" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" align="middle" /></a>
22
+
23
+ <div class="product-name" align="center"><b><?php echo substr($_product->getName(), 0, 40);?></b></div>
24
+ <div class="product-price" align="center"><?php echo $this->getPriceHtml($_product, true) ?></div>
25
+ <div class="proudct-url" align="center"><a href="<?php echo $_product->getProductUrl();?>">View Now</a></div>
26
+ </td>
27
+
28
+ <?php if($i++ % 4 ==3 && $mode == 'grid') echo '</tr><tr>'?>
29
+
30
+ <?php endforeach;?>
31
+ <?php if( $i > 0) echo '</table>';
32
+
app/design/frontend/base/default/template/connector/{price.phtml → product/price.phtml} RENAMED
File without changes
app/design/frontend/base/default/template/connector/roi_code.phtml CHANGED
@@ -1,23 +1,17 @@
1
- <?php
2
-
3
- if(Mage::getStoreConfig('connector_roi_page_tracking_settings/roi_tracking/enabled')):?>
4
-
5
- <?php
6
  $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
7
  $orderId = $this->getOrderId();
8
  $items = $order->getAllItems();
9
  $total = number_format($order->getBaseGrandTotal(), 2);
 
 
 
10
 
11
- ?>
12
- <script type="text/javascript">
13
- <?php foreach ($items as $item):?>
14
-
15
- <?php if($item->getParentItemId() != null)
16
- continue;?>
17
- _dmTrack("product", <?php echo $item->getName()?>;
18
-
19
- <?php endforeach;?>
20
- _dmTrack("CheckOutAmount", <?php echo $total;?>);
21
- </script>
22
 
 
 
 
23
  <?php endif;?>
1
+ <?php if(Mage::helper('connector')->getRoiTrackingEnabled()):
 
 
 
 
2
  $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
3
  $orderId = $this->getOrderId();
4
  $items = $order->getAllItems();
5
  $total = number_format($order->getBaseGrandTotal(), 2);
6
+ ?>
7
+ <script type="text/javascript">
8
+ <?php foreach ($items as $item):?>
9
 
10
+ <?php if($item->getParentItemId() != null)
11
+ continue;?>
12
+ _dmTrack("product", "<?php echo $item->getName()?>");
 
 
 
 
 
 
 
 
13
 
14
+ <?php endforeach;?>
15
+ _dmTrack("CheckOutAmount", "<?php echo $total;?>");
16
+ </script>
17
  <?php endif;?>
app/design/frontend/base/default/template/connector/shipping/new.phtml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder();
2
+ $shipping = $order->getShipmentsCollection()->getFirstItem();
3
+ $comment = $shipping->getCommentsCollection()->getFirstItem()->getComment();
4
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
5
+ ?>
6
+ <style>
7
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
8
+ </style>
9
+ <body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
10
+ <div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
12
+ <tr>
13
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
14
+ <!-- [ header starts here] -->
15
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
16
+ <!-- [ middle starts here] -->
17
+ <tr>
18
+ <td>
19
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Shipment #<?php echo $shipping->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
20
+ </td>
21
+ </tr>
22
+ <tr>
23
+ <td>
24
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
25
+ <thead>
26
+ <tr>
27
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
28
+ <th width="10"></th>
29
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
30
+ </tr>
31
+ </thead>
32
+ <tbody>
33
+ <tr>
34
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
35
+ <?php echo $order->getBillingAddress()->format('html');?>
36
+ </td>
37
+ <td>&nbsp;</td>
38
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
39
+ <?php echo $paymentBlock->toHtml();?>
40
+ </td>
41
+ </tr>
42
+ </tbody>
43
+ </table>
44
+ <br/>
45
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
46
+ <thead>
47
+ <tr>
48
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
49
+ <th width="10"></th>
50
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
51
+ </tr>
52
+ </thead>
53
+ <tbody>
54
+ <tr>
55
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
56
+ <?php echo $order->getShippingAddress()->format('html');?>
57
+ &nbsp;
58
+ </td>
59
+ <td>&nbsp;</td>
60
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
61
+ <?php echo $order->getShippingDescription();?>
62
+ &nbsp;
63
+ </td>
64
+ </tr>
65
+ </tbody>
66
+ </table>
67
+ <br/>
68
+ <?php echo $this->getChildHtml('connector_shipping_items');?>
69
+ <?php echo $this->getChildHtml('connector_shipping_track');?>
70
+ <p style="font-size:12px; margin:0 10px 10px 0"><?php echo $comment;?></p>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </td>
75
+ </tr>
76
+ </table>
77
+ </div>
78
+ </body>
app/design/frontend/base/default/template/connector/shipping/newguest.phtml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder();
2
+ $billing = $order->getBillingAddress();
3
+ $shipping = $order->getShipmentsCollection()->getFirstItem();
4
+ $comment = $shipping->getCommentsCollection()->getFirstItem()->getComment();
5
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
6
+ ?>
7
+ <style>
8
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
9
+ </style>
10
+ <body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
12
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
13
+ <tr>
14
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
15
+ <!-- [ header starts here] -->
16
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
17
+ <!-- [ middle starts here] -->
18
+ <tr>
19
+ <td>
20
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Shipment #<?php echo $shipping->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
21
+ </td>
22
+ </tr>
23
+ <tr>
24
+ <td>
25
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
26
+ <thead>
27
+ <tr>
28
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
29
+ <th width="10"></th>
30
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
31
+ </tr>
32
+ </thead>
33
+ <tbody>
34
+ <tr>
35
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
36
+ <?php echo $order->getBillingAddress()->format('html');?>
37
+ </td>
38
+ <td>&nbsp;</td>
39
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
40
+ <?php echo $paymentBlock->toHtml();?>
41
+ </td>
42
+ </tr>
43
+ </tbody>
44
+ </table>
45
+ <br/>
46
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
47
+ <thead>
48
+ <tr>
49
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
50
+ <th width="10"></th>
51
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
52
+ </tr>
53
+ </thead>
54
+ <tbody>
55
+ <tr>
56
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
57
+ <?php echo $order->getShippingAddress()->format('html');?>
58
+ &nbsp;
59
+ </td>
60
+ <td>&nbsp;</td>
61
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
62
+ <?php echo $order->getShippingDescription();?>
63
+ &nbsp;
64
+ </td>
65
+ </tr>
66
+ </tbody>
67
+ </table>
68
+ <br/>
69
+ <?php echo $this->getChildHtml('connector_shipping_items');?>
70
+ <?php echo $this->getChildHtml('connector_shpping_track');?>
71
+ <p style="font-size:12px; margin:0 10px 10px 0"><?php echo $comment;?></p>
72
+ </td>
73
+ </tr>
74
+ </table>
75
+ </td>
76
+ </tr>
77
+ </table>
78
+ </div>
79
+ </body>
app/design/frontend/base/default/template/connector/shipping/update.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder();
2
+ $shipping = $order->getShipmentsCollection()->getFirstItem();
3
+ $comment = $shipping->getCommentsCollection()->getFirstItem()->getComment();
4
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
5
+ ?>
6
+ <style>
7
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
8
+ </style>
9
+ <body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
10
+ <div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
12
+ <tr>
13
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
14
+ <!-- [ header starts here] -->
15
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
16
+ <!-- [ middle starts here] -->
17
+ <tr>
18
+ <td valign="top">
19
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
20
+ Your order # <?php echo $order->getIncrementId();?> has been <br/>
21
+ <strong><?php echo $order->getStatusLabel();?></strong>.
22
+ </p>
23
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="<?php echo $this->getBaseUrl();?>customer/account/" style="color:#1E7EC8;">logging into your account</a>.</p>
24
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
25
+ </td>
26
+ </tr>
27
+ </table>
28
+ </td>
29
+ </tr>
30
+ </table>
31
+ </div>
32
+ </body>
app/design/frontend/base/default/template/connector/shipping/updateguest.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder();
2
+ $billing = $order->getBillingAddress();
3
+ $shipping = $order->getShipmentsCollection()->getFirstItem();
4
+ $comment = $shipping->getCommentsCollection()->getFirstItem()->getComment();
5
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
6
+ ?>
7
+ <style>
8
+ <?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
9
+ </style>
10
+ <body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
12
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
13
+ <tr>
14
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
15
+ <!-- [ header starts here] -->
16
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
17
+ <!-- [ middle starts here] -->
18
+ <tr>
19
+ <td valign="top">
20
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
21
+ Your order # <?php echo $order->getIncrementId();?> has been <br/>
22
+ <strong><?php echo $order->getStatusLabel();?></strong>.
23
+ </p>
24
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
25
+ </td>
26
+ </tr>
27
+ </table>
28
+ </td>
29
+ </tr>
30
+ </table>
31
+ </div>
32
+ </body>
app/design/frontend/base/default/template/connector/tracking_code.phtml CHANGED
@@ -1,4 +1,12 @@
1
  <?php
2
- if(Mage::getStoreConfig('connector_roi_page_tracking_settings/page_tracking/enabled')) :?>
3
- <script src="http://t.trackedlink.net/_dmpt.js" type="text/javascript"></script>
 
 
 
 
 
 
 
 
4
  <?php endif;?>
1
  <?php
2
+ if(Mage::helper('connector')->getPageTrackingEnabled()) :?>
3
+ <script type="text/javascript">
4
+ (function(){
5
+ var connector = document.createElement('script');
6
+ connector.type = 'text/javascript';
7
+ connector.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://') + 't.trackedlink.net/_dmpt.js';
8
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(connector, s);
9
+ })();
10
+ </script>
11
+
12
  <?php endif;?>
app/design/frontend/base/default/template/page/blank.phtml CHANGED
@@ -1 +1,14 @@
1
- <?php echo $this->getChildHtml('content');?>
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
3
+ <head>
4
+ </head>
5
+ <body>
6
+ <div class="main-container col1-layout">
7
+ <div class="main">
8
+ <div class="col-main">
9
+ <?php echo $this->getChildHtml('content') ?>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ </body>
14
+ </html>
app/design/frontend/base/default/template/page/connector/products.phtml DELETED
@@ -1,37 +0,0 @@
1
- <?php $productCollection = $this->getRecommendedProducts();?>
2
-
3
-
4
- <?php
5
- $listMode = $this->getMode();
6
-
7
- ?>
8
-
9
- <?php $i = 0;foreach ($productCollection as $key => $_product) :?>
10
- <?php $_product = Mage::getModel('catalog/product')->load($_product->getEntityId());?>
11
- <?php if($i == 0):?>
12
- <table border="0" bordercolor="#FFCC00" width="147" cellpadding="0" cellspacing="0" style='font-family:arial; border-collapse: collapse; font-size:12;'><tr>
13
- <?php endif;?>
14
- <?php
15
- //LIST MODE
16
- if($listMode == 'list'){
17
- echo '</tr><tr>';
18
- }?>
19
-
20
- <td style="vertical-align: text-top; padding-right: 2px;">
21
-
22
-
23
- <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="140" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" align="middle" /></a>
24
-
25
- <div align="center"><b><?php echo substr($_product->getName(), 0, 40);?></b></div>
26
-
27
- <div align="center"><?php echo $this->getPriceHtml($_product, true);?></div>
28
- <div align="center"><a href="<?php echo $_product->getProductUrl();?>">View Now</a></div>
29
- </td>
30
-
31
- <?php if($i++ % 4 ==3 && $listMode == 'grid') echo '</tr><tr>'?>
32
-
33
- <?php endforeach;?>
34
-
35
- </table>
36
-
37
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Dotdigitalgroup_Email.xml CHANGED
@@ -3,7 +3,7 @@
3
  <modules>
4
  <Dotdigitalgroup_Email>
5
  <active>true</active>
6
- <codePool>local</codePool>
7
  </Dotdigitalgroup_Email>
8
  </modules>
9
  </config>
3
  <modules>
4
  <Dotdigitalgroup_Email>
5
  <active>true</active>
6
+ <codePool>community</codePool>
7
  </Dotdigitalgroup_Email>
8
  </modules>
9
  </config>
app/locale/en_US/Dotdigitalgroup_Email.csv ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "EMAIL","EMAIL"
2
+ "API Credentials","API Credentials"
3
+ "API Settings","API Settings"
4
+ "API Username","API Username"
5
+ "API Password","API Password"
6
+ "Test API Credentials","Test API Credentials"
7
+ "*Please save your settings before clicking here! Use this button to test the account with customers campaign 1.","*Please save your settings before clicking here! Use this button to test the account with customers campaign 1."
8
+ "Sync Settings","Sync Settings"
9
+ "Customer Data and Subscribers Sync Schedule","Customer Data and Subscribers Sync Schedule"
10
+ "Enabled","Enabled"
11
+ "Start Time","Start Time"
12
+ "Frequency","Frequency"
13
+ "Suppressed Data Sync Schedule","Suppressed Data Sync Schedule"
14
+ "Use this button force the suppressed data synchronization to run now","Use this button force the suppressed data synchronization to run now"
15
+ "Transactional data settings","Transactional data settings"
16
+ "Order/Basket Information","Order/Basket Information"
17
+ "Wish List Information","Wish List Information"
18
+ "Data Mapping","Data Mapping"
19
+ "Data Field Mapping","Data Field Mapping"
20
+ "Customer Information","Customer Information"
21
+ "Title","Title"
22
+ "First Name","First Name"
23
+ "Last Name","Last Name"
24
+ "D.O.B.","D.O.B."
25
+ "Gender","Gender"
26
+ "Website Created On","Website Created On"
27
+ "Store Created On","Store Created On"
28
+ "Account Created Date","Account Created Date"
29
+ "Last Logged In Date","Last Logged In Date"
30
+ "Customer Group","Customer Group"
31
+ "Address Information","Address Information"
32
+ "Billing Address Line 1","Billing Address Line 1"
33
+ "Billing Address Line 2","Billing Address Line 2"
34
+ "Billing City","Billing City"
35
+ "Billing State/Region","Billing State/Region"
36
+ "Billing Country","Billing Country"
37
+ "Billing Zip/Postcode","Billing Zip/Postcode"
38
+ "Billing Telephone","Billing Telephone"
39
+ "Delivery Address Line 1","Delivery Address Line 1"
40
+ "Delivery Address Line 2","Delivery Address Line 2"
41
+ "Delivery City","Delivery City"
42
+ "Delivery State/Region","Delivery State/Region"
43
+ "Delivery Country","Delivery Country"
44
+ "Delivery Zip/Postcode","Delivery Zip/Postcode"
45
+ "Delivery Telephone","Delivery Telephone"
46
+ "Sales Information","Sales Information"
47
+ "Total Number of Orders","Total Number of Orders"
48
+ "Average Order Value","Average Order Value"
49
+ "Total Spend","Total Spend"
50
+ "Last Purchase Date","Last Purchase Date"
51
+ "Last Order No","Last Order No"
52
+ "Validation Block","Validation Block"
53
+ "Address Book Mapping","Address Book Mapping"
54
+ "Add Customers To","Add Customers To"
55
+ "Add Subscribers To","Add Subscribers To"
56
+ "Add Guests To","Add Guests To"
57
+ "ROI & Tracking","ROI & Tracking"
58
+ "Page Tracking","Page Tracking"
59
+ "ROI Tracking","ROI Tracking"
60
+ "Lost Baskets","Lost Baskets"
61
+ "Lost Baskets Settings","Lost Baskets Settings"
62
+ "Consider Order Complete For Lost Baskets","Consider Order Complete For Lost Baskets"
63
+ "Customers","Customers"
64
+ "Lost Basket 1","Lost Basket 1"
65
+ "Enabled/Disabled","Enabled/Disabled"
66
+ "Send After (min)","Send After (min)"
67
+ "Campaign To Send","Campaign To Send"
68
+ "Lost Basket 2","Lost Basket 2"
69
+ "Send After (hrs)","Send After (hrs)"
70
+ "Lost Basket 3","Lost Basket 3"
71
+ "Send After (hrs)","Send After (hrs)"
72
+ "Guests","Guests"
73
+ "Test","Test"
74
+ "Test Email","Test Email"
75
+ "Enter the email for customer to test lost basket, for customer Lost Basket 1","Enter the email for customer to test lost basket, for customer Lost Basket 1"
76
+ "Use this button force the data synchronization to run now.","Use this button force the data synchronization to run now."
77
+ "SMS","SMS"
78
+ "SMS Message 1","SMS Message 1"
79
+ "Order Status","Order Status"
80
+ "Message","Message"
81
+ "SMS Message 2","SMS Message 2"
82
+ "SMS Message 3","SMS Message 3"
83
+ "SMS Message 4","SMS Message 4"
84
+ "Dynamic Content","Dynamic Content"
85
+ "Related Products","Related Products"
86
+ "Display Type","Display Type"
87
+ "Items To Display","Items To Display"
88
+ "Up Sell Products","Up Sell Products"
89
+ "Cross Sell Products","Cross Sell Products"
90
+ "Best Sellers","Best Sellers"
91
+ "Time Period","Time Period"
92
+ "Most Viewed","Most Viewed"
93
+ "Recently Viewed","Recently Viewed"
94
+ "Manual Product Push","Manual Product Push"
95
+ "Settings","Settings"
96
+ "Products","Products"
97
+ "Comma Separated Product Id's","Comma Separated Product Id's"
98
+ "Fallback Products","Fallback Products"
99
+ "Transactional Emails","Transactional Emails"
100
+ "Test & Setup","Test & Setup"
101
+ "Email Mapping","Email Mapping"
102
+ "Order Emails","Order Emails"
103
+ "New Credit Memo","New Credit Memo"
104
+ "New Credit Memo Guest","New Credit Memo Guest"
105
+ "Credit Memo Update","Credit Memo Update"
106
+ "New Invoice","New Invoice"
107
+ "Invoice Update","Invoice Update"
108
+ "New Order","New Order"
109
+ "Order Update","Order Update"
110
+ "New Shipment","New Shipment"
111
+ "Shipment Update","Shipment Update"
112
+ "Customer Emails","Customer Emails"
113
+ "Password Remind","Password Remind"
114
+ "Forgot Password","Forgot Password"
115
+ "New Account","New Account"
116
+ "Advanced Settings","Advanced Settings"
117
+ "Transactional Sync Limit","Transactional Sync Limit"
118
+ "Historical Import Limit","Historical Import Limit"
119
+ "External Dynamic Content","External Dynamic Content"
120
+ "Passcode","Passcode"
121
+ "Recommended: Set a passcode so that basket contents and coupon codes can only be viewed if the following passcode is sent with the request.","Recommended: Set a passcode so that basket contents and coupon codes can only be viewed if the following passcode is sent with the request."
122
+ "Baskets Content URL","Baskets Content URL"
123
+ "Coupon Codes","Coupon Codes"
124
+ "Coupon Codes URL","Coupon Codes URL"
125
+ "Related Products URL","Related Products URL"
126
+ "Up Sell Products URL","Up Sell Products URL"
127
+ "Cross Sell Products URL","Cross Sell Products URL"
128
+ "Best Sellers URL","Best Sellers URL"
129
+ "Most Viewed URL","Most Viewed URL"
130
+ "Product Push URL","Product Push URL"
131
+ "New Customer Registration Email","New Customer Registration Email"
132
+ "New Order Email Confirmation","New Order Email Confirmation"
133
+ "New Creditmemo","New Creditmemo"
134
+ "Admin","Admin"
135
+ "Contacts ID's","Contacts ID's"
136
+ "Count Customers With ID","Count Customers With ID"
137
+ "Delete All Contact ID's","Delete All Contact ID's"
138
+ "Memory Limit","Memory Limit"
139
+ "Set to NO to use system default memory.","Set to NO to use system default memory."
140
+ "Customer Sync Batch Size","Customer Sync Batch Size"
141
+ "Set the limit size for customers loaded in memory.","Set the limit size for customers loaded in memory."
142
+ "Debug Mode","Debug Mode"
143
+ "Set to YES to allow creating log files in var/log directory","Set to YES to allow creating log files in var/log directory"
144
+ "Count Customers Now","Count Customers Now"
145
+
146
+
package.xml CHANGED
@@ -1,18 +1,32 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>dotmailermagento</name>
4
- <version>1.5.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Integrate your ecommerce with dotMailer's powerful triggered email marketing and convert more visits to sales.</summary>
10
  <description>Connector Integration for Magento, allows to manage and synchronise customer data and lost baskets.</description>
11
- <notes>Product recommendation and dynamic content for connector.</notes>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  <authors><author><name>Calin Diacon</name><user>cdiacon</user><email>cdiacon@gmail.com</email></author></authors>
13
- <date>2013-10-23</date>
14
- <time>10:14:57</time>
15
- <contents><target name="magelocal"><dir name="Dotdigitalgroup"><dir name="Email"><dir name="Block"><dir name="Adminhtml"><dir name="System"><file name="Bestsellers.php" hash="3712d5b267bcb960ab61ea4c2f7780fd"/><dir name="Config"><file name="Gridlist.php" hash="4022c4af28efa8b521eae76da8781417"/><file name="Insertvariable.php" hash="16efa5b30d69f1a87ba73a39c30d526b"/><file name="Messagedefault.php" hash="316850603c3aba812e34955f4e6ea1ad"/><file name="Password.php" hash="3065946d4e092e6fe0d31cbb4b52edee"/><file name="Smsmessagefour.php" hash="6764248cd2dd0a1df8f8546ef581cefd"/><file name="Smsmessageone.php" hash="f99c4598125f337f5d02003e381466b0"/><file name="Smsmessagethree.php" hash="5deb67df50db7c640c7d8438cad05df6"/><file name="Smsmessagetwo.php" hash="ef33d2f8c780dba2fa71e3723192ed74"/><file name="Validator.php" hash="03288ddcb5cbf3234231d8af8f7723ff"/><file name="Waitingfield.php" hash="fb25e0d81a2067a2d8f6cabff4277f84"/><file name="Wrapper.php" hash="cf5319d175c585354c2d9ebfe30d41e6"/></dir><file name="Couponinfo.php" hash="ede44a34e922becad72a5b3c1c0fc633"/><file name="Crosssell.php" hash="e2f2f5436d3ea902cd40a03795d5e456"/><file name="Lostbasket.php" hash="923a64cb4759f3c1a6bac37437612a7c"/><file name="Mostviewed.php" hash="e6ecfc239e55d4f3781ae8d6e7da15ce"/><file name="Productpush.php" hash="9c243d149366577f47383935892f58d5"/><file name="Recentlyviewed.php" hash="2351cd33be3f670809a72774989b149a"/><file name="Related.php" hash="69a352f8d5c2b397f19cf2a3f1eac9d7"/><file name="Upsell.php" hash="20e8adb20d3bb7e31dfce13e616cd195"/></dir></dir><file name="Basket.php" hash="850034be56ab609ca8345781520148ae"/><file name="Coupon.php" hash="6aaec59401eb7a4602dcb29db9d8c03d"/><dir name="Debug"><file name="Countcontacts.php" hash="59d8d74a82aac88d3cb0f4ed9ffecfef"/><file name="Deletecontacts.php" hash="f2b3f787467ff337331e554117e48408"/><file name="Forcecustomersync.php" hash="d5738efb228c7ba430bf2156941b93a7"/><file name="Forcelostbasketsync.php" hash="f12e28f29b7e1c56edf6464b5af7ead4"/><file name="Forcesuppressedsync.php" hash="cfda0355fae3284853259f3f292dd742"/><file name="Initialsync.php" hash="118b2c178a22fa3cd2301d4d9bbec5f2"/><file name="Rescuenow.php" hash="f20a18a3fe2803c7d71924ec04bc4f50"/><file name="Testcredentials.php" hash="660ca7d025c51974bec5307518649506"/><file name="Transactionalsync.php" hash="7cce60182af6603fa0a082bf02752be8"/></dir><file name="Products.php" hash="091bd0a56391c7fc1b94e96e11ea636c"/></dir><dir name="Helper"><dir name="Api"><file name="DotNetExample.php" hash="cdefe297bf38b6c49ec0acdf9f43264a"/><file name="Restrequest.php" hash="dbd90bdcc12a90bcc875e6c88842e8be"/></dir><file name="Data.php" hash="042d65513fc63e89ff8093e5cb932ec1"/><file name="File.php" hash="7b13d5ce553d5c0442694a9ad2d46016"/><file name="Recommended.php" hash="e14f6657e3243816e8f7d4aae214499e"/></dir><dir name="Model"><dir name="Account"><file name="Test.php" hash="71095642bfae08183962007d59ef028c"/></dir><dir name="Api"><file name="Rest.php" hash="c91400b9e9d21cef977b95479752ad90"/></dir><dir name="Connector"><file name="Account.php" hash="b232ee04f222c3e61a6e6494d13a11b4"/><file name="Customer.php" hash="1f201b107ced31b9bad9b9884f8c4a28"/><file name="Order.php" hash="4baaed26cb6efb7de3dfdf8550acc6fe"/><file name="Quote.php" hash="74cb4c28351223c213889d00552712a7"/><file name="Wishlist.php" hash="7f02a04debb6d6a8971d5e696142b1c7"/></dir><file name="Cron.php" hash="23942f32f5cfeae44479fec3e4ca0294"/><dir name="Customer"><file name="Customer.php" hash="4b853783ed303a61dd5808f0fc368c3a"/><file name="Suppressed.php" hash="639382b91fe82328548429c5d7d48a7e"/><dir name="Wishlist"><file name="Item.php" hash="7087ac6edf465a88a5dd96af483459d9"/></dir></dir><dir name="Dynamic"><dir name="Product"><file name="Mapper.php" hash="63451cbd3d11523ba6d60f71a88d10f6"/></dir><file name="Recommended.php" hash="6588de609b5bc87ed1a51b25f7243858"/></dir><dir name="Newsletter"><file name="Subscriber.php" hash="aa06389101532308e6aa14da6cef2c99"/></dir><file name="Observer.php" hash="b3106c169860a62263e3aa92230f9f16"/><file name="Order.php" hash="df951471328bb27f35babb337e527851"/><dir name="Sales"><file name="Order.php" hash="2cb28b4a209825331ea01d6b45576d08"/><file name="Quote.php" hash="c97137d259868f7a44aaaa95e2130674"/><file name="Sms.php" hash="ea05d7b33f140fd308a60215fa5f7baa"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Syncschedule"><file name="Customer.php" hash="d421b5ac07c5bb71051edfda1cc4dcdb"/><file name="Suppressed.php" hash="6eb9b26bbac6c6ce86a7981a20f604ad"/></dir></dir><dir name="Source"><file name="Activebasket.php" hash="1ec34cf0f073f40c36f1918d4f38cbb0"/><file name="Addressbooks.php" hash="e482c8e6d64520eed38110005b6f44ea"/><file name="Campaigns.php" hash="221e817a4796d3754b6230f8e71a91e5"/><file name="Datafields.php" hash="e8d219b3170bf5e416bdf479874f0304"/><file name="Displayifnot.php" hash="175ec822880b9c21bdde7697e90da2d8"/><file name="Displaytype.php" hash="6025a5b7b08908819ec20263b0715b8b"/><file name="Gridview.php" hash="6c9a24e47167cabaa9c749670372e4ed"/><file name="Lostbasket.php" hash="02c5254bd7aeab58253f38e6ee401ee7"/><file name="Orderlimit.php" hash="db8cc03eb2259ce07900b5d2a45eedbc"/><file name="Orderstatus.php" hash="62446aebcb422acce53641412c0fd98f"/><file name="Sendcampain.php" hash="207c467eb35319e26437be126716fc72"/><file name="Syncfrequency.php" hash="19181d66a5688d6da78da9b8b0c639b0"/><file name="Timeperiod.php" hash="6f3d5907f6e6bdff3a6e0fae196fa78c"/></dir></dir></dir></dir><dir name="Test"><dir name="Model"><file name="Product.php" hash="590f024e6ae4a33044897004e81d5a33"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DebugController.php" hash="0b58c42b842da871181f19ca97d69a13"/></dir><file name="EmailController.php" hash="af67b1470e5f33767d2fbf80c8d2725f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5f8fdbfa276d01622117b1a5a7ac4bf4"/><file name="config.xml" hash="10fd0f57b91292c12737b83b9244240c"/><file name="system.xml" hash="2ff93941b9d0336a602bbe410a377282"/></dir><dir name="sql"><dir name="connector_setup"><file name="mysql4-install-0.1.0.php" hash="c33e49225f3974f784f8b7b12f609102"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="7fae25a8ae47fe0ba692076ac04237a4"/></dir></dir></dir></dir><dir name="Varien"><dir name="Data"><file name="Collection.php" hash="a925107e95454d0e6609138b00f972aa"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="connector.xml" hash="d86fe05590ffbcbd4fe671da9cdb2979"/></dir><dir name="template"><dir name="connector"><file name="basket.phtml" hash="2dadd9e056a5a0267fb5a84e8d711fce"/><file name="coupon.phtml" hash="0e39fce43a6b3c4b45130996f1de90ff"/><file name="price.phtml" hash="3600de0d5573415628823b3d1f397cca"/><file name="roi_code.phtml" hash="72b38638e7105a4375cf22d662d67fab"/><file name="tracking_code.phtml" hash="4dcec68640a76074eced63d054a701eb"/></dir><dir name="page"><dir name="connector"><file name="products.phtml" hash="3c8bf292c14da73cd513498978323724"/></dir><file name="blank.phtml" hash="7bf34446254428a5c42740731127b435"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dotdigitalgroup_Email.xml" hash="9b9b2dbb1f62fe025fe35da89171b658"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>1.5.2</min><max>6.0.0</max></php><extension><name>curl</name><min>7.15.1</min><max>7.30.0</max></extension></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>dotmailermagento</name>
4
+ <version>3.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Integrate your ecommerce with dotMailer's powerful triggered email marketing and convert more visits to sales.</summary>
10
  <description>Connector Integration for Magento, allows to manage and synchronise customer data and lost baskets.</description>
11
+ <notes>Transactional Emails, Custom Customer Attributes, Reports &amp; More&#xD;
12
+ &#xD;
13
+ This release includes some great new functionality as well as including a number of fixes. &#xD;
14
+ &#xD;
15
+ ##IMPORTANT## Dynamic content URL's have been changed so will need updating within your dotMailer account to ensure they continue working correctly. ##IMPORTANT##&#xD;
16
+ &#xD;
17
+ Release Highlights:&#xD;
18
+ &#xD;
19
+ + Transactional Emails: Replace the standard emails Magento currently sends to your customers and guests with beautifully created campaigns from dotMailer. Emails include new account, new order, dispatch, cancel and refund emails. **A dotMailer child account is required to enable this functionality**&#xD;
20
+ &#xD;
21
+ + Custom Customer Attributes: Sync your custom created customer attributes to dotMailer &#xD;
22
+ &#xD;
23
+ + Dynamic Content Styling: Apply custom CSS to all dynamic content pages e.g. font size, colour and type.&#xD;
24
+ &#xD;
25
+ + Reporting: Now within the Newsletter section in Magento you can view the import status of contacts and orders, as well as the sending status of transactional and lost basket emails.</notes>
26
  <authors><author><name>Calin Diacon</name><user>cdiacon</user><email>cdiacon@gmail.com</email></author></authors>
27
+ <date>2014-04-08</date>
28
+ <time>12:14:09</time>
29
+ <contents><target name="magecommunity"><dir name="Dotdigitalgroup"><dir name="Email"><dir name="Block"><dir name="Adminhtml"><dir name="Campaign"><dir name="Edit"><file name="Form.php" hash="03c8d95031a56485c6c2b34385736b3d"/></dir><file name="Edit.php" hash="b5ce88fee87e9cf6f8c74a43b86778aa"/><file name="Grid.php" hash="b1354b229cff5cb7ea5da5c3e693122e"/></dir><file name="Campaign.php" hash="de2e7284fa9da11b9145bb121ba051ba"/><dir name="Column"><dir name="Renderer"><file name="Imported.php" hash="c37b40f9c7802c752ec511ca18f6ab51"/><file name="Status.php" hash="a9fdb5a1b8c35f9d82e68825747753df"/></dir></dir><dir name="Config"><file name="Customdatafields.php" hash="51242d2c4a45d92eee83e52addbcd38e"/><file name="Select.php" hash="b92091e08d7e24032be9b8aea033b81d"/></dir><dir name="Contact"><dir name="Edit"><file name="Form.php" hash="ea62df55f43b350463d1fe3177b43b3a"/></dir><file name="Edit.php" hash="2d8a87b0fda5c6840c3a288455d842fd"/><file name="Grid.php" hash="47bb5ede075bd47760f139cb52412ce5"/></dir><file name="Contact.php" hash="67b472aca6f517744c64112d2b8203a6"/><dir name="Dashboard"><file name="Content.php" hash="4c0fab042df22c79f9a0a0a82e4e374a"/></dir><file name="Dashboard.php" hash="909e48f6a0eedfbc79752371fd079ba3"/><dir name="Order"><file name="Grid.php" hash="c987ae5b25ce424557dd153ea60f1dd6"/></dir><file name="Order.php" hash="9ac8972700cf62c43c3ab1e8a9868ac7"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="View.php" hash="fe35138d07d7edf823eb0ad7e6805b5d"/></dir></dir></dir><dir name="System"><dir name="Advanced"><file name="Deletecontactids.php" hash="208d008fa096c22c6caf81f20cee1240"/><file name="Reimportorders.php" hash="4c17bcc297b5720e7d1a1d9572f1d681"/><file name="Reimportsubscribers.php" hash="09e62674a8a0b500b2627658a848da0b"/><file name="Setupdatafields.php" hash="b74d1a00ec8917b4a24749290f447725"/><file name="Suppressedcontacts.php" hash="dc49e4ab126a9008671c37a9f3e42df6"/></dir><file name="Ajaxvalidate.php" hash="2647705ecfcd6c1cd39489febd38b490"/><dir name="Config"><file name="Addressbook.php" hash="68c471b6ab147dcc7f7929bf1588b606"/><file name="Datafield.php" hash="159843e4dd95c95a9b64183794617264"/><file name="Validator.php" hash="bc40dfb587f768fc034f3376578348cb"/><file name="Waitingfield.php" hash="e207f36809f0406d39ba5488ae07cfc1"/><file name="Wrapper.php" hash="482971d9dc6cc93d0a67b161baf30760"/></dir><dir name="Dynamic"><file name="Addressbookbutton.php" hash="7e42551d70b5023ecd0b05a19706300c"/><file name="Bestsellers.php" hash="d8cfae00e51f14e06c291015d459cebd"/><file name="Couponinfo.php" hash="9e65bc483990d64eeb5a590be77cb0c4"/><file name="Creditmemonew.php" hash="cc2fa4736137680924919170869c4d52"/><file name="Crosssell.php" hash="017042b0d149288c8bc1a2314afec4c7"/><file name="Datafieldbutton.php" hash="26c1e98c5db3326c34cf494455c4a89d"/><file name="Gridlist.php" hash="43d35c8c6af3064fb4f803abd1feeb61"/><file name="Lostbasket.php" hash="30c899587a80eb74bb242312c15e2b77"/><file name="Mostviewed.php" hash="244e438db8ad0c6d79be522f2a77a641"/><file name="Productpush.php" hash="9ae40b463bd38d1d8d182082c8a4aa09"/><file name="Recentlyviewed.php" hash="9080a469428ff27339ddf310751dee79"/><file name="Related.php" hash="b2d214ea18d127bf2d743c215214f607"/><file name="Upsell.php" hash="0d3450795159d127cc3336754f4cd525"/></dir><file name="Emailapivalidate.php" hash="6a7926b4e5360d3d14f644083627d725"/><dir name="Sms"><file name="Smsmessagefour.php" hash="478fe1128b25f725e5a71b413a9c2e66"/><file name="Smsmessageone.php" hash="84c538ffdc9e7a6727ae63fcec829702"/><file name="Smsmessagethree.php" hash="23ade0bf1f888ec94aa4ce570698588e"/><file name="Smsmessagetwo.php" hash="0c4f7ddf529cf0e51b3393e4700a0588"/></dir><dir name="Url"><file name="Creditmemoupdate.php" hash="8f8f46682700dfedf9fb26c2fe092c96"/><file name="Creditmemoupdateguest.php" hash="fc75a15217442dcfe044e62fea628b27"/><file name="Customerconfirmation.php" hash="bf7c4f7484a837053895021da3729058"/><file name="Customerconfirmed.php" hash="9c81a83c351debf45bfbacf0a94afe9a"/><file name="Customernew.php" hash="ae49907eaa3c23e89f15deea539f614c"/><file name="Invoiceupdate.php" hash="ea0bbeb34a2ef2bee55d5ead23165024"/><file name="Invoiceupdateguest.php" hash="92c119c51edf73d72250601607aeedac"/><file name="Newcreditmemo.php" hash="071c98cae55f2c0fde05d2b51135f631"/><file name="Newcreditmemoguest.php" hash="10d894593ec46ee82188d0e342502965"/><file name="Newinvoice.php" hash="592887a1a328a912009989e1d126d242"/><file name="Newinvoiceguest.php" hash="5f6ef6dd9e9858eb88f4805781c5a00b"/><file name="Neworder.php" hash="737b519422a3ee8b07758c30812e6d75"/><file name="Neworderguest.php" hash="8a9fe7abbcffabaef9d257efc3fea1ce"/><file name="Newshipment.php" hash="004a3092323114bf046d139ac8b4b4c1"/><file name="Newshipmentguest.php" hash="445806639a8814887f41ad09712ab692"/><file name="Orderupdate.php" hash="b3cde00902583273ebd86f6130531024"/><file name="Orderupdateguest.php" hash="ddcb35360b292cced133f535b2a7d88c"/><file name="Shipmentupdate.php" hash="be5aa56bf70958b24e1b6cbee35c097c"/><file name="Shipmentupdateguest.php" hash="c7d3ead0596c51dfec9082187387168b"/></dir></dir></dir><file name="Basket.php" hash="205a0231de07b733eb32a27819b4f558"/><file name="Coupon.php" hash="6aaec59401eb7a4602dcb29db9d8c03d"/><file name="Customer.php" hash="48d91075d316fbd761f8d5c390e2b0b3"/><dir name="Order"><file name="Creditmemo.php" hash="3d3b7bf754809aa74e14b6e5556b77af"/><file name="Invoice.php" hash="f084d450635275f324cef44f6ca49ad1"/><file name="Shipping.php" hash="175e74945f64b3afbba4fddcafb8ad40"/></dir><file name="Order.php" hash="279e6a6ea8f2ad1fb8b29d27fa9acf0b"/><file name="Products.php" hash="43fbfdcf8d0f1b564cd7add67a0773dc"/><dir name="Recommended"><file name="Bestsellers.php" hash="75e469e09e0124a3cbd0e4304e219b1d"/><file name="Mostviewed.php" hash="15d74f7fc6f45c6138da010f522c0914"/><file name="Products.php" hash="d7aa606914a32c76b27ec152e9c4ccd5"/><file name="Push.php" hash="9fd33949fc75ad897a3f8f2ea1849357"/><file name="Recentlyviewed.php" hash="34d1d921b3355f3c5dd24dcbfd2972a2"/></dir></dir><dir name="Helper"><file name="Config.php" hash="8575f835f251bd07b1edfeca41e8aa6d"/><file name="Data.php" hash="012c2313f93b68018549bcdaef0837d9"/><file name="File.php" hash="ffc5a7b2ea38df1dd506dd535690841d"/><file name="Recommended.php" hash="7f6b0a6e7ca1cfcae80f448b19742c2b"/><file name="Transactional.php" hash="15223641a354f68e465cb9b41b3f2a0a"/></dir><dir name="Model"><dir name="Abstract"><file name="Rest.php" hash="1d24616062ad0e8ede63009ef11effa0"/></dir><dir name="Adminhtml"><file name="Observer.php" hash="33a3046421b3c8aa3538603c141699ba"/><dir name="Source"><file name="Addressbooks.php" hash="a34179091ff4e04439ba8dfa863edcf3"/><dir name="Advanced"><file name="Transdata.php" hash="5c670a26d641c4b7e73bbaff48af3dd6"/></dir><file name="Campaigns.php" hash="44a79100c152f3ca059f4426b931a603"/><dir name="Customer"><dir name="Attributes"><file name="Select.php" hash="74d8a794296adbde81b7f6bd10c2a51d"/></dir></dir><file name="Datafields.php" hash="0aad2711ade16a739ff2f832040fcb5d"/><dir name="Datamapping"><file name="Datafieldtype.php" hash="642abde2d39cd2b289e4b6d67aa1a5c2"/></dir><dir name="Dynamic"><file name="Displaytype.php" hash="ce33272a6fbce0878e36dcb39ff9639e"/><file name="Gridview.php" hash="119f092674f9d49d92d3b1550a519b94"/></dir><dir name="Lostbaskets"><file name="Interval.php" hash="a8f7e2b6c61ebc0fbdde777499519276"/><file name="Intervalminute.php" hash="ad895a4ab04e792de13901a85cb75abb"/></dir><dir name="Transactional"><file name="Campaigns.php" hash="6975df0e04428807cb5609b53329925e"/></dir></dir></dir><dir name="Apiconnector"><file name="Client.php" hash="48c42eec9921aceb819100ac9cda5484"/><file name="Contact.php" hash="b3a1d6892b6f2d7965b3376a4750bc5f"/><file name="Test.php" hash="315eb73fc49d9cfc7779da45f2cfe759"/></dir><file name="Campaign.php" hash="42cd3d6fa040a60f69dadf13ca42afc9"/><dir name="Connector"><file name="Account.php" hash="97907f0a714c79f5d554e211c341e1ef"/><file name="Campaign.php" hash="46b917765113b6b7181e19d7b2018111"/><file name="Customer.php" hash="447c93eaf7c744cdb607b8554c6d6db7"/><file name="Datafield.php" hash="615257a7badd9e680efca0fd3c31bdbf"/><file name="Order.php" hash="4754e509e9414a1863c7dc237bef1bf6"/></dir><file name="Contact.php" hash="37ac5702649617b0650a331cbc12664f"/><file name="Cron.php" hash="17fdbec9127d0a60598acec8f3f39ac8"/><dir name="Customer"><file name="Guest.php" hash="3410ba76646eb77c134979a34b1f8ae2"/><file name="Observer.php" hash="8541c0a01abe4a0be294c667210cc536"/><dir name="Wishlist"><file name="Item.php" hash="8613bd11d7ff1ed8c5555a04087a952f"/></dir><file name="Wishlist.php" hash="f5cada121166dba6f6256c2f9ff00122"/></dir><dir name="Email"><dir name="Template"><file name="Mailer.php" hash="0ac80932cbe99808d4fdcbb000fe6421"/></dir><file name="Template.php" hash="51eeb527869674d045bc9bddfb148030"/></dir><dir name="Newsletter"><file name="Observer.php" hash="5d3e9b5b63fd6619596f493473573437"/><file name="Subscriber.php" hash="d6bd9a9f00463e7466d3c2c9035bc9b6"/></dir><file name="Order.php" hash="a1229635f592954c9ab501fd565edd90"/><dir name="Resource"><dir name="Campaign"><file name="Collection.php" hash="09ef0fec9b684933c74fb7967dac13db"/></dir><file name="Campaign.php" hash="4d880a3e0f6398c28a1202b092626cee"/><dir name="Contact"><file name="Collection.php" hash="18e3e91e9e9f048541b02206d64347db"/></dir><file name="Contact.php" hash="2417143f9245d9ee2a6b0cb8d12eda1f"/><dir name="Order"><file name="Collection.php" hash="9c12a26fbe26bdcd186f36f305f27e76"/></dir><file name="Order.php" hash="79991b817f73d9837eeae43bbad6ffd2"/><file name="Setup.php" hash="442dda9eabbd1fb6e88e7d2baaa2a28c"/></dir><dir name="Sales"><file name="Observer.php" hash="adf6f4dbc82898f9083f5da08c33ccba"/><file name="Order.php" hash="b8fbfc6cc82fd397797ae10d6550da77"/><file name="Quote.php" hash="78c8c3ac564d915689fff7706c817e12"/></dir><dir name="Sms"><file name="Campaign.php" hash="07ad7e4230da2f134af93103e3dfe719"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConnectorController.php" hash="baa36d0f843639bb3e6788f40e02937d"/><dir name="Email"><file name="CampaignController.php" hash="59ea2fb6684d059861aa0c9aaa3b4b66"/><file name="ContactController.php" hash="fdf82cedc9973ad3de5e367d18b96282"/><file name="DashboardController.php" hash="cc6a85225839e4a1701497566cf0b822"/><file name="OrderController.php" hash="8489fe3ab664a52d8312f766b7b3851f"/></dir></dir><file name="CreditmemoController.php" hash="bb5e804c2cc8e594e51adec3b754ba64"/><file name="CustomerController.php" hash="2c598f0f23264946a398ba50a83525f9"/><file name="EmailController.php" hash="d0b74eaac798a087a481cda2a626febf"/><file name="InvoiceController.php" hash="2bd188f49f4263e3230274177d06e11c"/><file name="OrderController.php" hash="ee5c7d81c82f66a2c2f034eab92941a2"/><file name="ProductsController.php" hash="d0f8dcf536431b1ec4daf58b73b1f383"/><file name="ReportController.php" hash="b44f170e995eade343b8aa3ffed23172"/><file name="ShippingController.php" hash="3d543b26d1e2fdaa8b8a3a76e826ddfb"/></dir><dir name="etc"><file name="adminhtml.xml" hash="eddd1e44aba4e13fd2156dd4ac067c4d"/><file name="config.xml" hash="0641c59757191bbe34aa9f328edd3a02"/><file name="system.xml" hash="87dab87bc6b5ba5974d77cafedfdb522"/></dir><dir name="sql"><dir name="email_connector_setup"><file name="mysql4-install-0.1.0.php" hash="bb1b5e52152e2f111d852c1649b7d1d9"/><file name="mysql4-install-3.0.0.php" hash="385a2d7427baf260360dbb3a53c92eb8"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="7fae25a8ae47fe0ba692076ac04237a4"/><file name="mysql4-upgrade-1.1.2-1.5.0.php" hash="34ac896f6e681c56d8d2dd6bf411215e"/><file name="mysql4-upgrade-1.5.0-2.0.0.php" hash="75020a02255ea63e9bc4599d85ab4e2f"/><file name="mysql4-upgrade-2.0.0-2.0.1.php" hash="2f71a10d19eddd97c9eba9af840e4f09"/><file name="mysql4-upgrade-2.0.1-2.0.2.php" hash="6b7af944ebc76328d16223cdb245c568"/><file name="mysql4-upgrade-2.0.3-2.0.4.php" hash="d71788287371f0f5416f81e03245d281"/><file name="mysql4-upgrade-2.0.4-2.0.5.php" hash="f2080852fd1e0512da9bf1074767a9b3"/><file name="mysql4-upgrade-2.0.5-2.0.6.php" hash="7d32ac02fcfe6ba56108e2490ff7baaf"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="connector"><file name="basket.phtml" hash="f09ad8c5084114f7756c6f325674bd02"/><file name="coupon.phtml" hash="0e39fce43a6b3c4b45130996f1de90ff"/><dir><dir name="creditmemo"><file name="items.phtml" hash="e911de4e7f2717698e4041c7046ed5a5"/><file name="new.phtml" hash="5589a265ebc3b0ffab4285215808138c"/><file name="newguest.phtml" hash="b3099cea7baf66070d2063dbb27d2053"/><file name="update.phtml" hash="440f6fc8e4bfbbe8e0a8319d93c7bdbb"/><file name="updateguest.phtml" hash="48645cffd4bc7529621b8b2506185e3a"/></dir><dir name="invoice"><file name="new.phtml" hash="1192c608d82df66d646d99d310313a62"/><file name="newguest.phtml" hash="df98e57abe15e091e9270e403ccf727d"/><file name="update.phtml" hash="687e00b25885f032b8e3e4ab1e5a781b"/><file name="updateguest.phtml" hash="3d8328e8a9acbf8cf524a5bcdfa24947"/></dir><dir name="order"><file name="items.phtml" hash="9d149cbb8fe1e4c2736c6d77323abfc0"/><file name="new.phtml" hash="af976c073e42e371fb8ff0a99fa93b16"/><file name="newguest.phtml" hash="e5d85683a8c471dd00da1c8b72baa1fb"/><file name="update.phtml" hash="41111f0d68a5e8a231201c0475b442e8"/><file name="updateguest.phtml" hash="ee4cef5f27e8018ef6cf553ccffe8ff7"/></dir><dir name="product"><file name="list.phtml" hash="2009ad2820e112121a38396d898a2368"/><file name="price.phtml" hash="3600de0d5573415628823b3d1f397cca"/></dir><dir name="shipping"><file name="new.phtml" hash="20d0ff879f62695b9f7dca28fa0b581e"/><file name="newguest.phtml" hash="30dcf6965428f51e62cff18df22b4078"/><file name="update.phtml" hash="0935d641ab711f58c93f3b889ed72a75"/><file name="updateguest.phtml" hash="a087f227d6ece5acbed9a86ca438eef8"/></dir></dir><file name="customer.phtml" hash="c3b19b1e5b573260d07950ceb8cbd7a5"/><file name="roi_code.phtml" hash="2535b61d7901205fd4f063da1e8c16b3"/><file name="tracking_code.phtml" hash="f82527b0485a58fb852a2d8028f4393d"/></dir><dir name="page"><file name="blank.phtml" hash="7a10ef1534ebe3b449cf051799e5a066"/></dir></dir><dir name="layout"><file name="connector.xml" hash="29764d08db6049755ab6bb2ab74940a2"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="connector"><dir><dir name="dashboard"><file name="accountbar.phtml" hash="fc130aeddfcb28c7edb6d53fd586cf5f"/><file name="content.phtml" hash="25120cbe22253e3580ed483f75163092"/><file name="switcher.phtml" hash="533b49243f54ceff40e280f8035e1cf8"/></dir><dir name="system"><dir name="config"><file name="createdatafield.phtml" hash="a1a571fa0957d7fadf346d1b89c5a0b0"/></dir></dir></dir><file name="grid.phtml" hash="d6811097b84ca9d31a24f5a421ab9088"/></dir></dir><dir name="layout"><dir name="connector"><file name="email.xml" hash="d3c6c926f556c60e8e7f469b0220f816"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dotdigitalgroup_Email.xml" hash="8745c0b2eae08783b6203a613acdbcb8"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Dotdigitalgroup_Email.csv" hash="20a38887a1fff108817a3d36bdf1beb2"/></dir></target></contents>
30
  <compatible/>
31
  <dependencies><required><php><min>1.5.2</min><max>6.0.0</max></php><extension><name>curl</name><min>7.15.1</min><max>7.30.0</max></extension></required></dependencies>
32
  </package>