dotmailermagento - Version 2.0.4

Version Notes

Dropping number of subscribers.

Download this release

Release Info

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


Code changes from version 1.5.1 to 2.0.4

Files changed (151) hide show
  1. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Advanced/Admin/Contactsimported.php +20 -0
  2. app/code/{local/Dotdigitalgroup/Email/Block/Debug/Deletecontacts.php → community/Dotdigitalgroup/Email/Block/Adminhtml/Advanced/Admin/Deletecontactids.php} +2 -3
  3. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Sales/Order/Creditmemo/View.php +198 -0
  4. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Password.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Ajaxvalidate.php} +1 -1
  5. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Bestsellers.php +20 -0
  6. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Couponinfo.php +4 -3
  7. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Creditmemonew.php +21 -0
  8. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Crosssell.php +3 -4
  9. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Customernew.php +21 -0
  10. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Invoicenew.php +20 -0
  11. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Lostbasket.php +4 -4
  12. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Mostviewed.php +5 -5
  13. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Ordernew.php +20 -0
  14. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Orderupdate.php +20 -0
  15. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Productpush.php +5 -5
  16. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Related.php +4 -3
  17. app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Upsell.php +1 -1
  18. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Gridlist.php +0 -0
  19. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagefour.php +0 -0
  20. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessageone.php +0 -0
  21. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagethree.php +0 -0
  22. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagetwo.php +4 -7
  23. app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Synccustomerdata.php +31 -0
  24. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Validator.php +0 -0
  25. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Waitingfield.php +14 -1
  26. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Wrapper.php +5 -3
  27. app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Recentlyviewed.php +3 -3
  28. app/code/{local/Dotdigitalgroup/Email/Block/Debug/Countcontacts.php → community/Dotdigitalgroup/Email/Block/Adminhtml/Widget/Button/Reimportorders.php} +3 -4
  29. app/code/{local/Dotdigitalgroup/Email/Block/Debug/Initialsync.php → community/Dotdigitalgroup/Email/Block/Adminhtml/Widget/Button/Setupdatafields.php} +5 -4
  30. app/code/{local/Dotdigitalgroup/Email/Block/Debug/Transactionalsync.php → community/Dotdigitalgroup/Email/Block/Adminhtml/Widget/Button/Suppressedcontacts.php} +4 -3
  31. app/code/{local → community}/Dotdigitalgroup/Email/Block/Basket.php +1 -1
  32. app/code/{local → community}/Dotdigitalgroup/Email/Block/Coupon.php +0 -0
  33. app/code/community/Dotdigitalgroup/Email/Block/Customer.php +24 -0
  34. app/code/community/Dotdigitalgroup/Email/Block/Order.php +27 -0
  35. app/code/community/Dotdigitalgroup/Email/Block/Order/Creditmemo.php +85 -0
  36. app/code/community/Dotdigitalgroup/Email/Block/Order/Creditmemo/Items.php +58 -0
  37. app/code/community/Dotdigitalgroup/Email/Block/Order/Info.php +95 -0
  38. app/code/community/Dotdigitalgroup/Email/Block/Order/Invoice.php +84 -0
  39. app/code/community/Dotdigitalgroup/Email/Block/Order/Invoice/Items.php +58 -0
  40. app/code/{local → community}/Dotdigitalgroup/Email/Block/Products.php +0 -0
  41. app/code/community/Dotdigitalgroup/Email/Helper/Data.php +492 -0
  42. app/code/{local → community}/Dotdigitalgroup/Email/Helper/File.php +23 -3
  43. app/code/{local → community}/Dotdigitalgroup/Email/Helper/Recommended.php +1 -1
  44. app/code/{local/Dotdigitalgroup/Email/Helper/Api/Restrequest.php → community/Dotdigitalgroup/Email/Model/Abstract/Rest.php} +46 -42
  45. app/code/{local → community}/Dotdigitalgroup/Email/Model/Connector/Account.php +10 -7
  46. app/code/community/Dotdigitalgroup/Email/Model/Connector/Api/Client.php +592 -0
  47. app/code/community/Dotdigitalgroup/Email/Model/Connector/Campaign.php +84 -0
  48. app/code/{local → community}/Dotdigitalgroup/Email/Model/Connector/Customer.php +59 -112
  49. app/code/{local → community}/Dotdigitalgroup/Email/Model/Connector/Order.php +26 -27
  50. app/code/community/Dotdigitalgroup/Email/Model/Connector/Test.php +65 -0
  51. app/code/community/Dotdigitalgroup/Email/Model/Cron.php +84 -0
  52. app/code/community/Dotdigitalgroup/Email/Model/Customer/Contact.php +204 -0
  53. app/code/community/Dotdigitalgroup/Email/Model/Customer/Guest.php +74 -0
  54. app/code/{local/Dotdigitalgroup/Email/Model/Connector → community/Dotdigitalgroup/Email/Model/Customer}/Wishlist.php +10 -10
  55. app/code/{local → community}/Dotdigitalgroup/Email/Model/Customer/Wishlist/Item.php +13 -8
  56. app/code/{local → community}/Dotdigitalgroup/Email/Model/Dynamic/Product/Mapper.php +0 -0
  57. app/code/{local → community}/Dotdigitalgroup/Email/Model/Dynamic/Recommended.php +0 -1
  58. app/code/community/Dotdigitalgroup/Email/Model/Email/Contact.php +130 -0
  59. app/code/community/Dotdigitalgroup/Email/Model/Email/Order.php +62 -0
  60. app/code/community/Dotdigitalgroup/Email/Model/Email/Send.php +488 -0
  61. app/code/community/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php +139 -0
  62. app/code/community/Dotdigitalgroup/Email/Model/Observer.php +248 -0
  63. app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Contact.php +12 -0
  64. app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Contact/Collection.php +19 -0
  65. app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Order.php +9 -0
  66. app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Order/Collection.php +15 -0
  67. app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Send.php +10 -0
  68. app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Send/Collection.php +10 -0
  69. app/code/community/Dotdigitalgroup/Email/Model/Resource/Setup.php +6 -0
  70. app/code/community/Dotdigitalgroup/Email/Model/Sales/Order.php +137 -0
  71. app/code/{local/Dotdigitalgroup/Email/Model/Order.php → community/Dotdigitalgroup/Email/Model/Sales/Order/State.php} +1 -1
  72. app/code/{local → community}/Dotdigitalgroup/Email/Model/Sales/Quote.php +54 -91
  73. app/code/{local → community}/Dotdigitalgroup/Email/Model/Sales/Sms.php +7 -12
  74. app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Customer.php +10 -11
  75. app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Activebasket.php +0 -0
  76. app/code/community/Dotdigitalgroup/Email/Model/System/Config/Source/Addressbooks.php +37 -0
  77. app/code/community/Dotdigitalgroup/Email/Model/System/Config/Source/Campaigns.php +34 -0
  78. app/code/community/Dotdigitalgroup/Email/Model/System/Config/Source/Datafields.php +37 -0
  79. app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Displaytype.php +0 -0
  80. app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Gridview.php +0 -0
  81. app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Lostbasket.php +0 -0
  82. app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Orderlimit.php +0 -0
  83. app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Orderstatus.php +0 -0
  84. app/code/community/Dotdigitalgroup/Email/Model/System/Config/Source/Sendcampaignafter.php +32 -0
  85. app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Timeperiod.php +0 -0
  86. app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/ConnectorController.php +135 -0
  87. app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/DebugController.php +48 -0
  88. app/code/community/Dotdigitalgroup/Email/controllers/CustomerController.php +11 -0
  89. app/code/community/Dotdigitalgroup/Email/controllers/EmailController.php +70 -0
  90. app/code/community/Dotdigitalgroup/Email/controllers/OrderController.php +65 -0
  91. app/code/{local → community}/Dotdigitalgroup/Email/etc/adminhtml.xml +9 -6
  92. app/code/community/Dotdigitalgroup/Email/etc/config.xml +464 -0
  93. app/code/{local → community}/Dotdigitalgroup/Email/etc/system.xml +688 -434
  94. app/code/community/Dotdigitalgroup/Email/sql/.DS_Store +0 -0
  95. app/code/{local → community}/Dotdigitalgroup/Email/sql/connector_setup/mysql4-install-0.1.0.php +4 -11
  96. app/code/{local → community}/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-1.1.1-1.1.2.php +0 -0
  97. app/code/community/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-1.1.2-1.5.0.php +8 -0
  98. app/code/community/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-1.5.0-2.0.0.php +75 -0
  99. app/code/community/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-2.0.0-2.0.1.php +9 -0
  100. app/code/community/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-2.0.1-2.0.2.php +52 -0
  101. app/code/community/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-2.0.3-2.0.4.php +34 -0
  102. app/code/community/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-2.0.4-2.1.0.php +33 -0
  103. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Bestsellers.php +0 -18
  104. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Insertvariable.php +0 -13
  105. app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Messagedefault.php +0 -46
  106. app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcecustomersync.php +0 -21
  107. app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcelostbasketsync.php +0 -21
  108. app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcesuppressedsync.php +0 -21
  109. app/code/local/Dotdigitalgroup/Email/Block/Debug/Rescuenow.php +0 -21
  110. app/code/local/Dotdigitalgroup/Email/Block/Debug/Testcredentials.php +0 -21
  111. app/code/local/Dotdigitalgroup/Email/Helper/Api/DotNetExample.php +0 -182
  112. app/code/local/Dotdigitalgroup/Email/Helper/Data.php +0 -96
  113. app/code/local/Dotdigitalgroup/Email/Model/Account/Test.php +0 -40
  114. app/code/local/Dotdigitalgroup/Email/Model/Api/Rest.php +0 -729
  115. app/code/local/Dotdigitalgroup/Email/Model/Connector/Quote.php +0 -75
  116. app/code/local/Dotdigitalgroup/Email/Model/Cron.php +0 -58
  117. app/code/local/Dotdigitalgroup/Email/Model/Customer/Customer.php +0 -480
  118. app/code/local/Dotdigitalgroup/Email/Model/Customer/Suppressed.php +0 -85
  119. app/code/local/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php +0 -19
  120. app/code/local/Dotdigitalgroup/Email/Model/Observer.php +0 -189
  121. app/code/local/Dotdigitalgroup/Email/Model/Sales/Order.php +0 -96
  122. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Suppressed.php +0 -54
  123. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Addressbooks.php +0 -30
  124. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Campaigns.php +0 -30
  125. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Datafields.php +0 -35
  126. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Displayifnot.php +0 -12
  127. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Sendcampain.php +0 -30
  128. app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Syncfrequency.php +0 -40
  129. app/code/local/Dotdigitalgroup/Email/Test/Model/Product.php +0 -18
  130. app/code/local/Dotdigitalgroup/Email/controllers/Adminhtml/DebugController.php +0 -125
  131. app/code/local/Dotdigitalgroup/Email/controllers/EmailController.php +0 -133
  132. app/code/local/Dotdigitalgroup/Email/etc/config.xml +0 -289
  133. app/code/local/Varien/Data/Collection.php +0 -818
  134. app/design/frontend/base/default/layout/connector.xml +68 -1
  135. app/design/frontend/base/default/template/connector/customer/new.phtml +47 -0
  136. app/design/frontend/base/default/template/connector/customer/system/config/synccustomerdata.phtml +34 -0
  137. app/design/frontend/base/default/template/{page/connector → connector}/products.phtml +4 -7
  138. app/design/frontend/base/default/template/connector/roi_code.phtml +10 -16
  139. app/design/frontend/base/default/template/connector/sales/order/creditmemo.phtml +1 -0
  140. app/design/frontend/base/default/template/connector/sales/order/creditmemo/items.phtml +64 -0
  141. app/design/frontend/base/default/template/connector/sales/order/info.phtml +58 -0
  142. app/design/frontend/base/default/template/connector/sales/order/invoice.phtml +1 -0
  143. app/design/frontend/base/default/template/connector/sales/order/invoice/items.phtml +61 -0
  144. app/design/frontend/base/default/template/connector/sales/order/invoice/renderer/default.phtml +273 -0
  145. app/design/frontend/base/default/template/connector/sales/order/new.phtml +211 -0
  146. app/design/frontend/base/default/template/connector/sales/order/totals.phtml +22 -0
  147. app/design/frontend/base/default/template/connector/tracking_code.phtml +10 -2
  148. app/design/frontend/base/default/template/page/blank.phtml +1 -1
  149. app/etc/modules/Dotdigitalgroup_Email.xml +1 -1
  150. app/locale/en_US/Dotdigitalgroup_Email.csv +146 -0
  151. package.xml +5 -5
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Advanced/Admin/Contactsimported.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Advanced_Admin_Contactsimported extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
7
+ return $this->_getAddRowButtonHtml($this->__('Count Imported Contacts Now'));
8
+ }
9
+
10
+ protected function _getAddRowButtonHtml($title) {
11
+ $url = $this->getUrl("*/debug/countcontacts");
12
+
13
+ return $this->getLayout()->createBlock('adminhtml/widget_button')
14
+ ->setType('button')
15
+ ->setLabel($this->__($title))
16
+ ->setOnClick("window.location.href='" . $url . "'")
17
+ ->toHtml();
18
+ }
19
+
20
+ }
app/code/{local/Dotdigitalgroup/Email/Block/Debug/Deletecontacts.php → community/Dotdigitalgroup/Email/Block/Adminhtml/Advanced/Admin/Deletecontactids.php} RENAMED
@@ -1,6 +1,6 @@
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) {
@@ -9,7 +9,7 @@ class Dotdigitalgroup_Email_Block_Debug_Deletecontacts extends Mage_Adminhtml_Bl
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')
@@ -17,5 +17,4 @@ class Dotdigitalgroup_Email_Block_Debug_Deletecontacts extends Mage_Adminhtml_Bl
17
  ->setOnClick("window.location.href='" . $url . "'")
18
  ->toHtml();
19
  }
20
-
21
  }
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Advanced_Admin_Deletecontactids extends Mage_Adminhtml_Block_System_Config_Form_Field
4
  {
5
 
6
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
9
  }
10
 
11
  protected function _getAddRowButtonHtml($title) {
12
+ $url = Mage::helper('adminhtml')->getUrl("*/debug/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/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/Adminhtml/System/Config/Password.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/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_Config_Form_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/Form/Bestsellers.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_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
+ $helper = Mage::helper('connector');
10
+ $code = $helper->getPasscode();
11
+ $order = $helper->getLastOrderNo();
12
+ if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
13
+ if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
14
+ $text = $baseUrl . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/bestsellers';
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 → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Couponinfo.php RENAMED
@@ -1,14 +1,15 @@
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');
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_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
  $code = Mage::helper('connector')->getPasscode();
10
  if(!strlen($code))
11
  $code = '[PLEASE SET UP A PASSCODE]';
12
+ $text = $baseUrl . 'connector/email/coupon/id/[INSERT ID HERE]/code/'. $code;
13
 
14
  $element->setData('value', $text);
15
  $element->setData('disabled', 'disabled');
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Creditmemonew.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_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
+ $helper = Mage::helper('connector');
9
+ $code = $helper->getPasscode();
10
+ $orderId = $helper->getMappedOrderId();
11
+
12
+ if(!strlen($code))
13
+ $code = '[PLEASE SET UP A PASSCODE]';
14
+ $text = $baseUrl . 'connector/order/creditmemo/id/@' . $orderId . '@/code/'. $code;
15
+
16
+ $element->setData('value', $text);
17
+
18
+ return parent::_getElementHtml($element);
19
+ }
20
+
21
+ }
app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Crosssell.php RENAMED
@@ -1,10 +1,10 @@
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();
@@ -12,9 +12,8 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Crosssell extends Mage_Adminh
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
  }
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_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
  $helper = Mage::helper('connector');
9
  $code = $helper->getPasscode();
10
  $order = $helper->getLastOrderNo();
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 = $baseUrl . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/crosssell';
16
  $element->setData('value', $text);
 
17
  return parent::_getElementHtml($element);
18
  }
19
  }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Customernew.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_Customernew extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ /** label */
6
+ public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $helper = Mage::helper('connector');
10
+ $code = $helper->getPasscode();
11
+
12
+ $customerId = $helper->getMappedCustomerId();
13
+ if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
14
+
15
+ $text = $baseUrl . 'connector/customer/new/id/@' . $customerId . '@' . '/code/' . $code;
16
+ $element->setData('value', $text);
17
+
18
+ return parent::_getElementHtml($element);
19
+ }
20
+
21
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Invoicenew.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_Invoicenew 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
+ $helper = Mage::helper('connector');
10
+ $code = $helper->getPasscode();
11
+ $orderId = $helper->getMappedOrderId();
12
+
13
+ if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
14
+
15
+ $text = $baseUrl . 'connector/order/invoice/id/@' . $orderId . '@/code/' . $code;
16
+ $element->setData('value', $text);
17
+
18
+ return parent::_getElementHtml($element);
19
+ }
20
+ }
app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Lostbasket.php RENAMED
@@ -1,18 +1,18 @@
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
 
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_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
  $code = Mage::helper('connector')->getPasscode();
11
  if(!strlen($code))
12
  $code = '[PLEASE SET UP A PASSCODE]';
13
+ $text = $baseUrl . 'connector/email/basket/email/@EMAIL@/code/'. $code;
14
 
15
  $element->setData('value', $text);
 
16
  return parent::_getElementHtml($element);
17
  }
18
 
app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Mostviewed.php RENAMED
@@ -1,18 +1,18 @@
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
  }
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_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
  $code = Mage::helper('connector')->getPasscode();
10
  $order = Mage::helper('connector')->getLastOrderNo();
11
  if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
12
  if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
13
+ $text = $baseUrl . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/mostviewed';
14
  $element->setData('value', $text);
 
 
15
 
16
+ return parent::_getElementHtml($element);
17
  }
18
  }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Ordernew.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_Ordernew extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $helper = Mage::helper('connector');
10
+ $code = $helper->getPasscode();
11
+ $orderId = $helper->getMappedOrderId();
12
+
13
+ if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
14
+
15
+ $text = $baseUrl . 'connector/order/new/id/@' . $orderId . '@/code/' . $code;
16
+ $element->setData('value', $text);
17
+
18
+ return parent::_getElementHtml($element);
19
+ }
20
+ }
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form/Orderupdate.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_Orderupdate extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /** label */
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+
8
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
9
+ $helper = Mage::helper('connector');
10
+ $code = $helper->getPasscode();
11
+ $orderId = $helper->getMappedOrderId();
12
+
13
+ if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
14
+
15
+ $text = $baseUrl . 'connector/order/udpate/id/@' . $orderId . '@/code/' . $code;
16
+ $element->setData('value', $text);
17
+
18
+ return parent::_getElementHtml($element);
19
+ }
20
+ }
app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Productpush.php RENAMED
@@ -1,19 +1,19 @@
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
  }
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_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
  $helper = Mage::helper('connector');
10
  $code = $helper->getPasscode();
11
  $order = $helper->getLastOrderNo();
12
  if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
13
  if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
14
+ $text = $baseUrl . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/productpush';
15
  $element->setData('value', $text);
 
 
16
 
17
+ return parent::_getElementHtml($element);
18
  }
19
  }
app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Related.php RENAMED
@@ -1,16 +1,17 @@
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);
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_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
  $helper = Mage::helper('connector');
9
  $code = $helper->getPasscode();
10
+
11
  $order = $helper->getLastOrderNo();
12
  if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
13
  if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
14
+ $text = $baseUrl . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/related';
15
  $element->setData('value', $text);
16
 
17
  return parent::_getElementHtml($element);
app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Form}/Upsell.php RENAMED
@@ -1,5 +1,5 @@
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
  {
1
  <?php
2
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Form_Upsell extends Mage_Adminhtml_Block_System_Config_Form_Field
3
  {
4
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
  {
app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Gridlist.php RENAMED
File without changes
app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagefour.php RENAMED
File without changes
app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessageone.php RENAMED
File without changes
app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagethree.php RENAMED
File without changes
app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagetwo.php RENAMED
@@ -9,13 +9,10 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessagetwo 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_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
 
9
 
10
  $element->setData('placeholder', self::DEFAULT_TEXT);
11
 
12
+ $element->setData('after_element_html',
13
+ "<a href='#' onclick=\"injectText('sms_section_sms_message_two_message', '{{var order_number}}');return false;\">Insert Order Number</a>
14
+ <a href='#' onclick=\"injectText('sms_section_sms_message_two_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>"
15
+ );
 
 
 
16
  return parent::_getElementHtml($element);
17
  }
18
 
app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Synccustomerdata.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Synccustomerdata 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 _getAddRowButtonHtml($label) {
14
+ $params = Mage::app()->getRequest()->getParams();
15
+
16
+ $url = Mage::helper('adminhtml')->getUrl("*/connector/forcecustomersync", $params);
17
+
18
+ return $this->getLayout()->createBlock('adminhtml/widget_button')
19
+ ->setType('button')
20
+ ->setLabel($label)
21
+ ->setOnClick("window.location.href='" . $url . "'")
22
+ ->toHtml();
23
+ }
24
+
25
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
26
+ {
27
+ $originalData = $element->getOriginalData();
28
+ return $this->_getAddRowButtonHtml($originalData['button_label']);
29
+ }
30
+
31
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Validator.php RENAMED
File without changes
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...'))
@@ -20,7 +28,10 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Waitingfield extends M
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\%"})
@@ -28,6 +39,8 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Waitingfield extends M
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"});
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...'))
28
  jQuery.noConflict();
29
  jQuery(document).ready(function() {
30
  //hide the load image field
31
+ jQuery("#row_connector_api_settings_api_credentials_validator").hide();
32
+ jQuery("#row_connector_sync_settings_sync_customer_schedule_validator").hide();
33
+
34
+
35
  var loadingmask = jQuery("#loadingmask");
36
  loadingmask.hide();
37
  loadingmask.css({top : "50\%", left: "50\%"})
39
  jQuery("button").click(function(){
40
 
41
  jQuery("body").css({"background-color": "black", "opacity": "0.4"});
42
+ jQuery("#row_connector_api_settings_api_credentials_validator").show();
43
+ jQuery("#row_connector_sync_settings_sync_customer_schedule_validator").show();
44
 
45
  loadingmask.show();
46
  loadingmask.css({"display": "block", "opacity" : "1"});
app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Wrapper.php RENAMED
@@ -7,6 +7,8 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Wrapper extends Mage_A
7
  {
8
  $element->setData('onchange', "apiValidation(this.form, this);");
9
 
 
 
10
  $element->setData('after_element_html', "
11
  <script>
12
  document.observe('dom:loaded', function(){
@@ -17,14 +19,14 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Wrapper extends Mage_A
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' ,
7
  {
8
  $element->setData('onchange', "apiValidation(this.form, this);");
9
 
10
+ $url = Mage::helper('adminhtml')->getUrl('*/debug/ajaxvalidation');
11
+
12
  $element->setData('after_element_html', "
13
  <script>
14
  document.observe('dom:loaded', function(){
19
  var api_user = $('connector_api_settings_api_credentials_username');
20
  var api_password = $('connector_api_settings_api_credentials_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/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Recentlyviewed.php RENAMED
@@ -3,15 +3,15 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Recentlyviewed extends Mage_A
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);
3
  {
4
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
  {
6
+ $baseUrl = $this->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
7
+
8
  $helper = Mage::helper('connector');
9
  $code = $helper->getPasscode();
 
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 = $baseUrl . 'connector/email/products/customer/@' . $customerId . '@/code/' . $code . '/mode/recentlyviewed';
15
  $element->setData('value', $text);
16
  $element->setData('disabled', 'disabled');
17
  return parent::_getElementHtml($element);
app/code/{local/Dotdigitalgroup/Email/Block/Debug/Countcontacts.php → community/Dotdigitalgroup/Email/Block/Adminhtml/Widget/Button/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_Widget_Button_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->__('Reset Orders'));
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/Initialsync.php → community/Dotdigitalgroup/Email/Block/Adminhtml/Widget/Button/Setupdatafields.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')
@@ -17,4 +18,4 @@ class Dotdigitalgroup_Email_Block_Debug_Initialsync extends Mage_Adminhtml_Block
17
  ->toHtml();
18
  }
19
 
20
- }
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Widget_Button_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->__('Setup And Map Datafields'));
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/{local/Dotdigitalgroup/Email/Block/Debug/Transactionalsync.php → community/Dotdigitalgroup/Email/Block/Adminhtml/Widget/Button/Suppressedcontacts.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')
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Block_Adminhtml_Widget_Button_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->__('Update 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')
app/code/{local → community}/Dotdigitalgroup/Email/Block/Basket.php RENAMED
@@ -19,7 +19,7 @@ class Dotdigitalgroup_Email_Block_Basket extends Mage_Core_Block_Template
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')
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')
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,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Customer extends Mage_Core_Block_Template
4
+ {
5
+
6
+ public function getNewCustomer()
7
+ {
8
+ $params = Mage::app()->getRequest()->getParams();
9
+ if(isset($params['id'])){
10
+
11
+ $customerModel = Mage::getModel('customer/customer')->load($params['id']);
12
+
13
+ if(! $customerModel->getEntityId()){
14
+ Mage::helper('connector')->log('Transactional email, no customer found :' . $params['id'], null, 'email');
15
+ exit;
16
+ }
17
+ return $customerModel;
18
+
19
+ }else{
20
+ exit;
21
+ }
22
+ }
23
+
24
+ }
app/code/community/Dotdigitalgroup/Email/Block/Order.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Block_Order extends Mage_Core_Block_Template
4
+ {
5
+ public function getNewOrder()
6
+ {
7
+ $params = Mage::app()->getRequest()->getParams();
8
+
9
+ if(isset($params['id'])){
10
+
11
+ $orderModel = Mage::getModel('sales/order')->load($params['id']);
12
+
13
+ if(! $orderModel->getEntityId()){
14
+ Mage::helper('connector')->log('Transactional email, no customer found :' . $params['id'], null, 'email');
15
+ exit;
16
+ }
17
+ Mage::register('order_id', $params['id']);
18
+ Mage::register('current_order', $orderModel);
19
+ return $orderModel;
20
+
21
+ }else{
22
+ exit;
23
+ }
24
+
25
+
26
+ }
27
+ }
app/code/community/Dotdigitalgroup/Email/Block/Order/Creditmemo.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Order_Creditmemo extends Mage_Sales_Block_Order_Creditmemo_Items
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('connector/sales/order/creditmemo.phtml');
8
+ }
9
+
10
+ protected function _prepareLayout()
11
+ {
12
+
13
+ if ($headBlock = $this->getLayout()->getBlock('head')) {
14
+ $headBlock->setTitle($this->__('Order # %s', $this->getOrder()->getRealOrderId()));
15
+ }
16
+ $this->setChild(
17
+ 'payment_info',
18
+ $this->helper('payment')->getInfoBlock($this->getOrder()->getPayment())
19
+ );
20
+ }
21
+
22
+ public function getPaymentInfoHtml()
23
+ {
24
+ return $this->getChildHtml('payment_info');
25
+ }
26
+
27
+ /**
28
+ * Retrieve current order model instance
29
+ *
30
+ * @return Mage_Sales_Model_Order
31
+ */
32
+ public function getOrder()
33
+ {
34
+ return Mage::registry('current_order');
35
+ }
36
+
37
+ /**
38
+ * Return back url for logged in and guest users
39
+ *
40
+ * @return string
41
+ */
42
+ public function getBackUrl()
43
+ {
44
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
45
+ return Mage::getUrl('*/*/history');
46
+ }
47
+ return Mage::getUrl('*/*/form');
48
+ }
49
+
50
+ /**
51
+ * Return back title for logged in and guest users
52
+ *
53
+ * @return string
54
+ */
55
+ public function getBackTitle()
56
+ {
57
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
58
+ return Mage::helper('sales')->__('Back to My Orders');
59
+ }
60
+ return Mage::helper('sales')->__('View Another Order');
61
+ }
62
+
63
+ public function getInvoiceUrl($order)
64
+ {
65
+ return Mage::getUrl('*/*/invoice', array('order_id' => $order->getId()));
66
+ }
67
+
68
+ public function getShipmentUrl($order)
69
+ {
70
+ return Mage::getUrl('*/*/shipment', array('order_id' => $order->getId()));
71
+ }
72
+
73
+ public function getViewUrl($order)
74
+ {
75
+ return Mage::getUrl('*/*/view', array('order_id' => $order->getId()));
76
+ }
77
+
78
+ public function getPrintCreditmemoUrl($creditmemo){
79
+ return Mage::getUrl('*/*/printCreditmemo', array('creditmemo_id' => $creditmemo->getId()));
80
+ }
81
+
82
+ public function getPrintAllCreditmemosUrl($order){
83
+ return Mage::getUrl('*/*/printCreditmemo', array('order_id' => $order->getId()));
84
+ }
85
+ }
app/code/community/Dotdigitalgroup/Email/Block/Order/Creditmemo/Items.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Order_Creditmemo_Items extends Mage_Sales_Block_Items_Abstract
3
+ {
4
+ /**
5
+ * Retrieve current order model instance
6
+ *
7
+ * @return Mage_Sales_Model_Order
8
+ */
9
+ public function getOrder()
10
+ {
11
+ return Mage::registry('current_order');
12
+ }
13
+
14
+ public function getPrintCreditmemoUrl($creditmemo)
15
+ {
16
+ return Mage::getUrl('*/*/printCreditmemo', array('creditmemo_id' => $creditmemo->getId()));
17
+ }
18
+
19
+ public function getPrintAllCreditmemosUrl($order)
20
+ {
21
+ return Mage::getUrl('*/*/printCreditmemo', array('order_id' => $order->getId()));
22
+ }
23
+
24
+ /**
25
+ * Get creditmemo totals block html
26
+ *
27
+ * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
28
+ * @return string
29
+ */
30
+ public function getTotalsHtml($creditmemo)
31
+ {
32
+ $totals = $this->getChild('creditmemo_totals');
33
+ $html = '';
34
+ if ($totals) {
35
+ $totals->setCreditmemo($creditmemo);
36
+ $html = $totals->toHtml();
37
+ }
38
+ return $html;
39
+ }
40
+
41
+ /**
42
+ * Get html of creditmemo comments block
43
+ *
44
+ * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
45
+ * @return string
46
+ */
47
+ public function getCommentsHtml($creditmemo)
48
+ {
49
+ $html = '';
50
+ $comments = $this->getChild('creditmemo_comments');
51
+ if ($comments) {
52
+ $comments->setEntity($creditmemo)
53
+ ->setTitle(Mage::helper('sales')->__('About Your Refund'));
54
+ $html = $comments->toHtml();
55
+ }
56
+ return $html;
57
+ }
58
+ }
app/code/community/Dotdigitalgroup/Email/Block/Order/Info.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Order_Info extends Mage_Core_Block_Template
3
+ {
4
+ protected $_links = array();
5
+
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->setTemplate('connector/sales/order/info.phtml');
10
+ }
11
+
12
+ protected function _prepareLayout()
13
+ {
14
+ $this->setChild(
15
+ 'payment_info',
16
+ $this->helper('payment')->getInfoBlock($this->getOrder()->getPayment())
17
+ );
18
+ }
19
+
20
+ public function getPaymentInfoHtml()
21
+ {
22
+ return $this->getChildHtml('payment_info');
23
+ }
24
+
25
+ /**
26
+ * Retrieve current order model instance
27
+ *
28
+ * @return Mage_Sales_Model_Order
29
+ */
30
+ public function getOrder()
31
+ {
32
+ return Mage::registry('current_order');
33
+ }
34
+
35
+ public function addLink($name, $path, $label)
36
+ {
37
+ $this->_links[$name] = new Varien_Object(array(
38
+ 'name' => $name,
39
+ 'label' => $label,
40
+ 'url' => empty($path) ? '' : Mage::getUrl($path, array('order_id' => $this->getOrder()->getId()))
41
+ ));
42
+ return $this;
43
+ }
44
+
45
+ public function getLinks()
46
+ {
47
+ $this->checkLinks();
48
+ return $this->_links;
49
+ }
50
+
51
+ private function checkLinks()
52
+ {
53
+ $order = $this->getOrder();
54
+ if (!$order->hasInvoices()) {
55
+ unset($this->_links['invoice']);
56
+ }
57
+ if (!$order->hasShipments()) {
58
+ unset($this->_links['shipment']);
59
+ }
60
+ if (!$order->hasCreditmemos()) {
61
+ unset($this->_links['creditmemo']);
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Get url for reorder action
67
+ *
68
+ * @deprecated after 1.6.0.0, logic moved to new block
69
+ * @param Mage_Sales_Order $order
70
+ * @return string
71
+ */
72
+ public function getReorderUrl($order)
73
+ {
74
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
75
+ return $this->getUrl('sales/guest/reorder', array('order_id' => $order->getId()));
76
+ }
77
+ return $this->getUrl('sales/order/reorder', array('order_id' => $order->getId()));
78
+ }
79
+
80
+ /**
81
+ * Get url for printing order
82
+ *
83
+ * @deprecated after 1.6.0.0, logic moved to new block
84
+ * @param Mage_Sales_Order $order
85
+ * @return string
86
+ */
87
+ public function getPrintUrl($order)
88
+ {
89
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
90
+ return $this->getUrl('sales/guest/print', array('order_id' => $order->getId()));
91
+ }
92
+ return $this->getUrl('sales/order/print', array('order_id' => $order->getId()));
93
+ }
94
+
95
+ }
app/code/community/Dotdigitalgroup/Email/Block/Order/Invoice.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Order_Invoice extends Mage_Sales_Block_Order_Invoice_Items
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('connector/sales/order/invoice.phtml');
8
+ }
9
+
10
+ protected function _prepareLayout()
11
+ {
12
+ if ($headBlock = $this->getLayout()->getBlock('head')) {
13
+ $headBlock->setTitle($this->__('Order # %s', $this->getOrder()->getRealOrderId()));
14
+ }
15
+ $this->setChild(
16
+ 'payment_info',
17
+ $this->helper('payment')->getInfoBlock($this->getOrder()->getPayment())
18
+ );
19
+ }
20
+
21
+ public function getPaymentInfoHtml()
22
+ {
23
+ return $this->getChildHtml('payment_info');
24
+ }
25
+
26
+ /**
27
+ * Retrieve current order model instance
28
+ *
29
+ * @return Mage_Sales_Model_Order
30
+ */
31
+ public function getOrder()
32
+ {
33
+ return Mage::registry('current_order');
34
+ }
35
+
36
+ /**
37
+ * Return back url for logged in and guest users
38
+ *
39
+ * @return string
40
+ */
41
+ public function getBackUrl()
42
+ {
43
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
44
+ return Mage::getUrl('*/*/history');
45
+ }
46
+ return Mage::getUrl('*/*/form');
47
+ }
48
+
49
+ /**
50
+ * Return back title for logged in and guest users
51
+ *
52
+ * @return string
53
+ */
54
+ public function getBackTitle()
55
+ {
56
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
57
+ return Mage::helper('sales')->__('Back to My Orders');
58
+ }
59
+ return Mage::helper('sales')->__('View Another Order');
60
+ }
61
+
62
+ public function getViewUrl($order)
63
+ {
64
+ return Mage::getUrl('*/*/view', array('order_id' => $order->getId()));
65
+ }
66
+
67
+ public function getShipmentUrl($order)
68
+ {
69
+ return Mage::getUrl('*/*/shipment', array('order_id' => $order->getId()));
70
+ }
71
+
72
+ public function getCreditmemoUrl($order)
73
+ {
74
+ return Mage::getUrl('*/*/creditmemo', array('order_id' => $order->getId()));
75
+ }
76
+
77
+ public function getPrintInvoiceUrl($invoice){
78
+ return Mage::getUrl('*/*/printInvoice', array('invoice_id' => $invoice->getId()));
79
+ }
80
+
81
+ public function getPrintAllInvoicesUrl($order){
82
+ return Mage::getUrl('*/*/printInvoice', array('order_id' => $order->getId()));
83
+ }
84
+ }
app/code/community/Dotdigitalgroup/Email/Block/Order/Invoice/Items.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Block_Order_Invoice_Items extends Mage_Sales_Block_Items_Abstract
3
+ {
4
+ /**
5
+ * Retrieve current order model instance
6
+ *
7
+ * @return Mage_Sales_Model_Order
8
+ */
9
+ public function getOrder()
10
+ {
11
+ return Mage::registry('current_order');
12
+ }
13
+
14
+ public function getPrintInvoiceUrl($invoice)
15
+ {
16
+ return Mage::getUrl('*/*/printInvoice', array('invoice_id' => $invoice->getId()));
17
+ }
18
+
19
+ public function getPrintAllInvoicesUrl($order)
20
+ {
21
+ return Mage::getUrl('*/*/printInvoice', array('order_id' => $order->getId()));
22
+ }
23
+
24
+ /**
25
+ * Get html of invoice totals block
26
+ *
27
+ * @param Mage_Sales_Model_Order_Invoice $invoice
28
+ * @return string
29
+ */
30
+ public function getInvoiceTotalsHtml($invoice)
31
+ {
32
+ $html = '';
33
+ $totals = $this->getChild('invoice_totals');
34
+ if ($totals) {
35
+ $totals->setInvoice($invoice);
36
+ $html = $totals->toHtml();
37
+ }
38
+ return $html;
39
+ }
40
+
41
+ /**
42
+ * Get html of invoice comments block
43
+ *
44
+ * @param Mage_Sales_Model_Order_Invoice $invoice
45
+ * @return string
46
+ */
47
+ public function getInvoiceCommentsHtml($invoice)
48
+ {
49
+ $html = '';
50
+ $comments = $this->getChild('invoice_comments');
51
+ if ($comments) {
52
+ $comments->setEntity($invoice)
53
+ ->setTitle(Mage::helper('sales')->__('About Your Invoice'));
54
+ $html = $comments->toHtml();
55
+ }
56
+ return $html;
57
+ }
58
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Block/Products.php RENAMED
File without changes
app/code/community/Dotdigitalgroup/Email/Helper/Data.php ADDED
@@ -0,0 +1,492 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ const XML_PATH_ENABLED = 'connector_api_settings/api_credentials/enabled';
6
+ const XML_PATH_PASSCODE = 'connector_advanced_settings/external/passcode';
7
+ const XML_PATH_LAST_ORDER_ID = 'connector_data_field_settings/customer_data/last_order_id';
8
+ const XML_PATH_MAPPING_CUSTOMER_ID = 'connector_data_field_settings/customer_data/customer_id';
9
+ const XML_PATH_MAPPING_ORDER_ID = 'connector_data_field_settings/customer_data/last_order_no';
10
+ const XML_PATH_API_USERNAME = 'connector_api_settings/api_credentials/username';
11
+ const XML_PATH_API_PASSWORD = 'connector_api_settings/api_credentials/password';
12
+ const XML_PATH_PAGE_TRACKING_ENABLED = 'connector_roi_page_tracking_settings/page_tracking/enabled';
13
+ const XML_PATH_ROI_TRACKING_ENABLED = 'connector_roi_page_tracking_settings/roi_tracking/enabled';
14
+
15
+ /**
16
+ * Sync settings page
17
+ */
18
+ const XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID = 'connector_sync_settings/address_book/customers';
19
+ const XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID = 'connector_sync_settings/address_book/subscribers';
20
+ const XML_PATH_GUEST_ADDRESS_BOOK_ID = 'connector_sync_settings/address_book/guests';
21
+
22
+ const XML_PATH_SYNC_CONTACT_ENABLED = 'connector_sync_settings/sync/contact_enabled';
23
+ const XML_PATH_SYNC_SUBSCRIBER_ENABLED = 'connector_sync_settings/sync/subscriber_enabled';
24
+ const XML_PATH_SYNC_ORDER_ENABLED = 'connector_sync_settings/sync/order_enabled';
25
+ const XML_PATH_SYNC_WISHLIST_ENABLED = 'connector_sync_settings/sync/wishlist_enabled';
26
+
27
+
28
+ /**
29
+ * Advanced settings
30
+ */
31
+ const XML_PATH_ADVANCED_DEBUG_ENABLED = 'connector_advanced_settings/admin/debug_enabled';
32
+
33
+ const XML_PATH_SYNC_LIMIT = 'connector_advanced_settings/admin/batch_size';
34
+
35
+ const XML_PATH_TRANSACTIONAL_DATA_SYNC_LIMIT = 'connector_advanced_settings/sync_limits/orders';
36
+
37
+ const XML_PATH_RESOURCE_ALLOCATION = 'connector_advanced_settings/admin/memory_limit';
38
+
39
+
40
+
41
+ public function isEnabled()
42
+ {
43
+ return (bool)Mage::getStoreConfig(self::XML_PATH_ENABLED);
44
+ }
45
+
46
+ /**
47
+ * @param int/object $website
48
+ * @return mixed
49
+ */
50
+ public function getApiUsername($website = 0)
51
+ {
52
+ $website = Mage::app()->getWebsite($website);
53
+
54
+ return $website->getConfig(self::XML_PATH_API_USERNAME);
55
+ }
56
+
57
+ public function getApiPassword($website = 0)
58
+ {
59
+ $website = Mage::app()->getWebsite($website);
60
+
61
+ return $website->getConfig(self::XML_PATH_API_PASSWORD);
62
+ }
63
+
64
+ public function auth($authRequest)
65
+ {
66
+ if($authRequest == Mage::getStoreConfig(self::XML_PATH_PASSCODE)){
67
+ return true;
68
+ }
69
+
70
+ // if($this->isEnabledLogs())
71
+ $this->log('Authenication failed : ' . $authRequest);
72
+ exit();
73
+ }
74
+
75
+ public function getSubscriberSyncEnabled()
76
+ {
77
+ return Mage::getStoreConfig(self::XML_PATH_SYNC_SUBSCRIBER_ENABLED);
78
+ }
79
+
80
+ public function getMappedCustomerId()
81
+ {
82
+ return Mage::getStoreConfig(self::XML_PATH_MAPPING_CUSTOMER_ID);
83
+ }
84
+
85
+ public function getMappedOrderId()
86
+ {
87
+ return Mage::getStoreConfig(self::XML_PATH_MAPPING_ORDER_ID);
88
+ }
89
+
90
+ public function getPasscode()
91
+ {
92
+ return Mage::getStoreConfig(self::XML_PATH_PASSCODE);
93
+ }
94
+
95
+ public function getLastOrderNo()
96
+ {
97
+ return Mage::getStoreConfig(self::XML_PATH_LAST_ORDER_ID);
98
+
99
+ }
100
+
101
+ public function log($data, $level = Zend_Log::DEBUG, $filename = 'api.log')
102
+ {
103
+ if($this->getDebugEnabled()){
104
+ $filename = 'connector_' . $filename;
105
+
106
+ Mage::log($data, $level, $filename, $force = true);
107
+ }
108
+ }
109
+
110
+ public function getDebugEnabled()
111
+ {
112
+ return (bool) Mage::getStoreConfig(self::XML_PATH_ADVANCED_DEBUG_ENABLED);
113
+ }
114
+
115
+ public function getContactSyncEnabled()
116
+ {
117
+ return (bool) Mage::getStoreConfig(self::XML_PATH_SYNC_CONTACT_ENABLED);
118
+ }
119
+
120
+ public function getConnectorVersion()
121
+ {
122
+
123
+ $modules = (array) Mage::getConfig()->getNode('modules')->children();
124
+
125
+ if(isset($modules['Dotdigitalgroup_Email'])){
126
+
127
+ $moduleName = $modules['Dotdigitalgroup_Email'];
128
+ return $moduleName->version;
129
+ }
130
+ return '';
131
+ }
132
+
133
+
134
+ public function getPageTrackingEnabled()
135
+ {
136
+ return (bool)Mage::getStoreConfig(self::XML_PATH_PAGE_TRACKING_ENABLED);
137
+ }
138
+
139
+ public function getRoiTrackingEnabled()
140
+ {
141
+ return (bool)Mage::getStoreConfig(self::XML_PATH_ROI_TRACKING_ENABLED);
142
+
143
+ }
144
+
145
+ public function getOrderSyncEnabled()
146
+ {
147
+ return Mage::getStoreConfig(self::XML_PATH_SYNC_ORDER_ENABLED);
148
+ }
149
+
150
+ public function getTransactionalSyncLimit()
151
+ {
152
+ return Mage::getStoreConfig(self::XML_PATH_TRANSACTIONAL_DATA_SYNC_LIMIT);
153
+ }
154
+
155
+ public function getResourceAllocationEnabled()
156
+ {
157
+ return (bool)Mage::getStoreConfig(self::XML_PATH_RESOURCE_ALLOCATION);
158
+ }
159
+
160
+ public function getMappedStoreName($website)
161
+ {
162
+ return $website->getConfig('connector_data_field_settings/customer_data/store_name');
163
+ }
164
+
165
+
166
+ public function getContactId($email, $websiteId)
167
+ {
168
+ $client = Mage::getModel('connector/connector_api_client');
169
+ $client->setApiUsername($this->getApiUsername($websiteId))
170
+ ->setApiPassword($this->getApiPassword($websiteId));
171
+ $contactModel = Mage::getModel('connector/email_contact');
172
+
173
+ $contact = $contactModel->loadByCustomerEmail($email, $websiteId);
174
+
175
+ if($contactId = $contact->getContactId()){
176
+ return $contactId;
177
+ }else{
178
+
179
+ $response = $client->postContacts($email);
180
+ if(isset($response->id)){
181
+ $contactId = $response->id;
182
+ $contactModel->setContactId($contactId)->save();
183
+ }
184
+ return $contactId;
185
+ }
186
+
187
+ }
188
+ public function getDatafields()
189
+ {
190
+ $dataFields = array(
191
+ 'customer_id' => array(
192
+ 'name' => 'Customer_ID',
193
+ 'type' => 'numeric',
194
+ 'visibility' => 'private',
195
+ ),
196
+ 'dob' => array(
197
+ 'name' => 'DOB',
198
+ 'type' => 'string',
199
+ 'visibility' => 'private',
200
+ 'defaultValue' => ''
201
+ ),
202
+ 'title' => array(
203
+ 'name' => 'Title',
204
+ 'type' => 'string',
205
+ 'visibility' => 'private',
206
+ 'defaultValue' => ''
207
+ ),
208
+ 'website_name' => array(
209
+ 'name' => 'Website_Name',
210
+ 'type' => 'string',
211
+ 'visibility' => 'private',
212
+ 'defaultValue' => ''
213
+ ),
214
+ 'store_name' => array(
215
+ 'name' => 'Store_Name',
216
+ 'type' => 'string',
217
+ 'visibility' => 'private',
218
+ 'defaultValue' => ''
219
+ ),
220
+ 'created_at' => array(
221
+ 'name' => 'Account_Created_Date',
222
+ 'type' => 'date',
223
+ 'visibility' => 'private'
224
+ ),
225
+ 'last_logged_date' => array(
226
+ 'name' => 'Last_Loggedin_Date',
227
+ 'type' => 'date',
228
+ 'visibility' => 'private'
229
+ ),
230
+ 'customer_group' => array(
231
+ 'name' => 'Customer_Group',
232
+ 'type' => 'string',
233
+ 'visibility' => 'private',
234
+ 'defaultValue' => ''
235
+ ),
236
+ 'billing_address_1' => array(
237
+ 'name' => 'Billing_Address_1',
238
+ 'type' => 'string',
239
+ 'visibility' => 'private',
240
+ 'defaultValue' => ''
241
+ ),
242
+ 'billing_address_2' => array(
243
+ 'name' => 'Billing_Address_2',
244
+ 'type' => 'string',
245
+ 'visibility' => 'private',
246
+ 'defaultValue' => ''
247
+ ),
248
+ 'billing_state' => array(
249
+ 'name' => 'Billing_State',
250
+ 'type' => 'string',
251
+ 'visibility' => 'private'
252
+ ),
253
+ 'billing_city' => array(
254
+ 'name' => 'Billing_City',
255
+ 'type' => 'string',
256
+ 'visibility' => 'private',
257
+ 'defaultValue' => ''
258
+ ),
259
+ 'billing_country' => array(
260
+ 'name' => 'Billing_Country',
261
+ 'type' => 'string',
262
+ 'visibility' => 'private',
263
+ 'defaultValue' => ''
264
+ ),
265
+ 'billing_postcode' => array(
266
+ 'name' => 'Billing_Postcode',
267
+ 'type' => 'string',
268
+ 'visibility' => 'private',
269
+ 'defaultValue' => ''
270
+ ),
271
+ 'billing_telephone' => array(
272
+ 'name' => 'Billing_Telephone',
273
+ 'type' => 'string',
274
+ 'visibility' => 'private',
275
+ 'defaultValue' => ''
276
+ ),
277
+ 'delivery_address_1' => array(
278
+ 'name' => 'Delivery_Address_1',
279
+ 'type' => 'string',
280
+ 'visibility' => 'private',
281
+ 'defaultValue' => ''
282
+ ),
283
+ 'delivery_address_2' => array(
284
+ 'name' => 'Delivery_Address_2',
285
+ 'type' => 'string',
286
+ 'visibility' => 'private',
287
+ 'defaultValue' => ''
288
+ ),
289
+ 'delivery_state' => array(
290
+ 'name' => 'Delivery_State',
291
+ 'type' => 'string',
292
+ 'visibility' => 'private'
293
+ ),
294
+ 'delivery_city' => array(
295
+ 'name' => 'Delivery_City',
296
+ 'type' => 'string',
297
+ 'visibility' => 'private',
298
+ 'defaultValue' => ''
299
+ ),
300
+ 'delivery_country' => array(
301
+ 'name' => 'Delivery_Country',
302
+ 'type' => 'string',
303
+ 'visibility' => 'private',
304
+ 'defaultValue' => ''
305
+ ),
306
+ 'delivery_postcode' => array(
307
+ 'name' => 'Delivery_Postcode',
308
+ 'type' => 'string',
309
+ 'visibility' => 'private',
310
+ 'defaultValue' => ''
311
+ ),
312
+ 'delivery_telephone' => array(
313
+ 'name' => 'Delivery_Telephone',
314
+ 'type' => 'string',
315
+ 'visibility' => 'private',
316
+ 'defaultValue' => ''
317
+ ),
318
+ 'number_of_orders' => array(
319
+ 'name' => 'Number_Of_Orders',
320
+ 'type' => 'numeric',
321
+ 'visibility' => 'private',
322
+ ),
323
+ 'total_spend' => array(
324
+ 'name' => 'Total_Spend',
325
+ 'type' => 'numeric',
326
+ 'visibility' => 'private',
327
+ ),
328
+ 'average_order_value' => array(
329
+ 'name' => 'Average_Order_Value',
330
+ 'type' => 'numeric',
331
+ 'visibility' => 'private',
332
+ ),
333
+ 'last_order_date' => array(
334
+ 'name' => 'Last_Order_Date',
335
+ 'type' => 'date',
336
+ 'visibility' => 'private',
337
+ ),
338
+ 'last_order_id' => array(
339
+ 'name' => 'Last_Order_ID',
340
+ 'type' => 'numeric',
341
+ 'visibility' => 'private',
342
+ )
343
+ );
344
+ return $dataFields;
345
+ }
346
+
347
+ /**
348
+ * Default datafields
349
+ * @return array
350
+ */
351
+ public function getDefaultDataFields()
352
+ {
353
+ $dataFields = array(
354
+ array(
355
+ 'name' => 'Customer_ID',
356
+ 'type' => 'string',
357
+ 'visibility' => 'public',
358
+ ),array(
359
+ 'name' => 'Order_ID',
360
+ 'type' => 'numeric',
361
+ 'visibility' => 'public',
362
+ ),array(
363
+ 'name' => 'Order_Increment_ID',
364
+ 'type' => 'numeric',
365
+ 'visibility' => 'public',
366
+ )
367
+ );
368
+
369
+ return $dataFields;
370
+ }
371
+
372
+
373
+ public function getCustomerAddressBook($website)
374
+ {
375
+ $website = Mage::app()->getWebsite($website);
376
+ return $website->getConfig(self::XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID);
377
+ }
378
+
379
+ public function getSubscriberAddressBook($website)
380
+ {
381
+ $website = Mage::app()->getWebsite($website);
382
+ return $website->getConfig(self::XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID);
383
+ }
384
+
385
+ public function getGuestAddressBook($website)
386
+ {
387
+ $website = Mage::app()->getWebsite($website);
388
+ return $website->getConfig(self::XML_PATH_GUEST_ADDRESS_BOOK_ID);
389
+ }
390
+
391
+
392
+ /**
393
+ * Sync limit for contacts
394
+ * @return mixed
395
+ */
396
+ public function getSyncLimit()
397
+ {
398
+ return Mage::getStoreConfig(self::XML_PATH_SYNC_LIMIT);
399
+ }
400
+
401
+
402
+ /**
403
+ * Gets the datafield mapping hash from the system config.
404
+ * @param $website
405
+ * @return array
406
+ */
407
+ public function getMappingHash($website){
408
+
409
+
410
+ $website = Mage::app()->getWebsite($website);
411
+ $result = array();
412
+
413
+ $customerFields = $this->_getCustomerDataFields();
414
+
415
+
416
+ foreach ($customerFields as $field) {
417
+
418
+ $configPath = 'connector_data_field_settings/customer_data/' . $field;
419
+
420
+ $result[] = $website->getConfig($configPath);
421
+ }
422
+
423
+ return $result;
424
+ }
425
+
426
+ private function _getCustomerDataFields(){
427
+
428
+ return array(
429
+ 'title',
430
+ 'firstname',
431
+ 'lastname',
432
+ 'dob',
433
+ 'gender',
434
+ 'website_name',
435
+ 'store_name',
436
+ 'created_at',
437
+ 'last_logged_date',
438
+ 'customer_group',
439
+ 'billing_address_1',
440
+ 'billing_address_2',
441
+ 'billing_city',
442
+ 'billing_country',
443
+ 'billing_postcode',
444
+ 'billing_telephone',
445
+ 'delivery_address_1',
446
+ 'delivery_address_2',
447
+ 'delivery_city',
448
+ 'delivery_country',
449
+ 'delivery_postcode',
450
+ 'delivery_telephone',
451
+ 'number_of_orders',
452
+ 'average_order_value',
453
+ 'total_spend',
454
+ 'last_order_date',
455
+ 'last_order_id',
456
+ 'customer_id',
457
+ );
458
+ }
459
+
460
+ public function getWishlistEnabled()
461
+ {
462
+ return (bool)Mage::getStoreConfig(self::XML_PATH_SYNC_WISHLIST_ENABLED);
463
+ }
464
+
465
+ public function allowResourceFullExecution() {
466
+
467
+ if($this->getResourceAllocationEnabled()){
468
+
469
+ /* it may be needed to set maximum execution time of the script to longer,
470
+ * like 60 minutes than usual */
471
+ set_time_limit(7200);
472
+
473
+ /* and memory to 512 megabytes */
474
+ ini_set('memory_limit', '512M');
475
+ }
476
+ return $this;
477
+ }
478
+ public function convert($size)
479
+ {
480
+ $unit=array('b','kb','mb','gb','tb','pb');
481
+ return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
482
+ }
483
+
484
+ public function countCustomersWithContactId()
485
+ {
486
+ $contactsCollection = Mage::getModel('connector/email_contact')->getCollection()
487
+ ->addFieldToFilter('customer_id', array('notnull' => true))
488
+ ->addFieldToFilter('contact_id', array('notnull' => true));
489
+
490
+ return $contactsCollection->getSize();
491
+ }
492
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Helper/File.php RENAMED
@@ -47,9 +47,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 +155,25 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
155
  array_map($class_func, glob($path.'/*')) == @rmdir($path);
156
  }
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
 
159
  }
47
 
48
  /**
49
  * Moves the output file from one folder to the next
50
+ * @param $source_folder
51
+ * @param $dest_folder
52
+ * @param $filename
53
  */
54
  public function moveFile($source_folder, $dest_folder, $filename ){
55
 
155
  array_map($class_func, glob($path.'/*')) == @rmdir($path);
156
  }
157
 
158
+ /**
159
+ * Create an array of columns we have chosen to map in our System->Config
160
+ * @param $website
161
+ * @return array
162
+ */
163
+ public function getCsvHeaderArray($website) {
164
+
165
+
166
+ $website = Mage::app()->getWebsite($website);
167
+ $result = array();
168
+ $result[] = 'Email';
169
+
170
+ foreach (Mage::helper('connector')->getMappingHash($website) as $header) {
171
+ if($header != "0") $result[] = $header;
172
+ }
173
+ $result[] = 'emailType';
174
+
175
+ return $result;
176
+ }
177
+
178
 
179
  }
app/code/{local → community}/Dotdigitalgroup/Email/Helper/Recommended.php RENAMED
@@ -17,7 +17,7 @@ class Dotdigitalgroup_Email_Helper_Recommended extends Mage_Core_Helper_Abstract
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';
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';
app/code/{local/Dotdigitalgroup/Email/Helper/Api/Restrequest.php → community/Dotdigitalgroup/Email/Model/Abstract/Rest.php} RENAMED
@@ -1,13 +1,13 @@
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;
@@ -15,11 +15,11 @@ class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email
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;
@@ -114,11 +112,10 @@ class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email
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 +147,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 +170,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,23 +203,23 @@ 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);
@@ -227,63 +227,66 @@ class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email
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 +297,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 $api_username;
10
+ protected $api_password;
11
  protected $acceptType;
12
  protected $responseBody;
13
  protected $responseInfo;
15
  public function __construct() // ($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->api_username = (string)Mage::helper('connector')->getApiUsername(Mage::app()->getWebsite()->getId());
22
+ $this->api_password = (string)Mage::helper('connector')->getApiPassword(Mage::app()->getWebsite()->getId());
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;
112
  $this->responseInfo = null;
113
  }
114
 
115
+ public function execute()
116
  {
117
  $ch = curl_init();
118
  $this->setAuth($ch);
 
119
  try
120
  {
121
  switch (strtoupper($this->verb))
147
  throw $e;
148
  }
149
 
150
+ return $this->responseBody;
151
  }
152
 
153
  public function buildPostBody($data = null)
154
  {
 
 
 
 
 
155
 
156
+ $this->requestBody = json_encode($data);
157
+ return $this;
158
  }
159
 
160
+ protected function executeGet($ch)
161
  {
162
  $this->doExecute($ch);
163
  }
164
 
165
+ protected function executePost($ch)
166
  {
167
  if (!is_string($this->requestBody))
168
  {
170
  }
171
 
172
  curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
173
+ curl_setopt($ch, CURLOPT_POST, true);
174
 
175
  $this->doExecute($ch);
176
  }
177
+ protected function buildPostBodyFromFile($filename){
178
+
179
+ $this->requestBody = array (
180
+ 'file' => '@'.$filename
181
+ );
182
+
183
+ }
184
 
185
  protected function executePut($ch)
186
  {
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 = json_decode(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);
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->api_username !== null && $this->api_password !== null)
233
  {
234
  curl_setopt($curlHandle, CURLAUTH_BASIC, CURLAUTH_DIGEST);
235
+ curl_setopt($curlHandle, CURLOPT_USERPWD, $this->api_username . ':' . $this->api_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 getApiPassword()
250
  {
251
+ return $this->api_password;
252
  }
253
 
254
+ public function setApiPassword($apiPassword)
255
  {
256
+ $this->api_password = $apiPassword;
257
+ return $this;
258
  }
259
 
260
+ public function getResponseBody()
261
  {
262
  return $this->responseBody;
263
  }
264
 
265
+ public function getResponseInfo()
266
  {
267
  return $this->responseInfo;
268
  }
269
 
270
+ public function getUrl()
271
  {
272
  return $this->url;
273
  }
274
 
275
+ public function setUrl($url)
276
  {
277
  $this->url = $url;
278
+ return $this;
279
  }
280
 
281
+ public function getApiUsername()
282
  {
283
+ return $this->api_username;
284
  }
285
 
286
+ public function setApiUsername($apiUsername)
287
  {
288
+ $this->api_username = $apiUsername;
289
+ return $this;
290
  }
291
 
292
  public function getVerb ()
297
  public function setVerb ($verb)
298
  {
299
  $this->verb = $verb;
300
+ return $this;
301
  }
302
  }
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/Api/Client.php ADDED
@@ -0,0 +1,592 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Connector_Api_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
+
29
+ protected $_customers_file_slug = 'customer_sync';
30
+ protected $_subscribers_file_slug = 'subscriber_sync';
31
+ protected $_api_helper;
32
+ protected $_subscribers_address_book_id;
33
+ protected $_customers_address_book_id;
34
+ protected $_filename;
35
+ protected $_subscribers_filename;
36
+ protected $_customers_filename;
37
+ protected $_limit = 10;
38
+ protected $_address_book_id;
39
+ public $fileHelper; /** @var Dotdigitalgroup_Email_Helper_File */
40
+ public $result = array('error' => false, 'message' => '');
41
+
42
+
43
+ /**
44
+ * Gets a contact by ID. Unsubscribed or suppressed contacts will not be retrieved.
45
+ * @param $id
46
+ * @return null
47
+ */
48
+ public function getContactById($id)
49
+ {
50
+ $url = self::REST_CONTACTS . $id;
51
+
52
+ $this->setUrl($url)
53
+ ->setVerb('GET');
54
+ $response = $this->execute();
55
+ if(isset($response->message))
56
+ Mage::helper('connector')->log('GET CONTACT INFO ID ' . $response->message);
57
+
58
+ return $response;
59
+ }
60
+
61
+ /**
62
+ * * Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel.
63
+ * Must include one column called "Email". Any other columns will attempt to map to your custom data fields.
64
+ * The ID of returned object can be used to query import progress.
65
+ * @param $filename
66
+ * @param $addressBookId
67
+ * @return mixed
68
+ */
69
+ public function postAddressBookContactsImport($filename, $addressBookId)
70
+ {
71
+ // ...the API request
72
+ $url = "https://apiconnector.com/v2/address-books/{$addressBookId}/contacts/import";
73
+ $helper = Mage::helper('connector');
74
+
75
+ $ch = curl_init($url);
76
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
77
+ curl_setopt($ch, CURLOPT_USERPWD, $this->getApiUsername() . ':' . $this->getApiPassword());
78
+ curl_setopt($ch, CURLOPT_POSTFIELDS, array (
79
+ 'file' => '@'.Mage::helper('connector/file')->getFilePath($filename)
80
+ ));
81
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
82
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
83
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
84
+ 'Content-Type: multipart/form-data')
85
+ );
86
+
87
+
88
+ // send contacts to address book
89
+ $result = curl_exec($ch);
90
+ $result = json_decode($result);
91
+
92
+ if(isset($result->message)){
93
+ $helper->log('POST ADDRESS BOOK CONTACT IMPORT ; ' . $result->message);
94
+ }
95
+
96
+ return $result;
97
+ }
98
+
99
+ /**
100
+ * Adds a contact to a given address book.
101
+ * @param $addressBookId
102
+ * @param $apiContact
103
+ * @return mixed|null
104
+ */
105
+ public function postAddressBookContacts($addressBookId, $apiContact)
106
+ {
107
+ $url = self::REST_ADDRESS_BOOKS . '/' . $addressBookId . '/contacts';
108
+ $this->setUrl($url)
109
+ ->setVerb("POST")
110
+ ->buildPostBody($apiContact);
111
+
112
+ $response = $this->execute();
113
+ if(isset($response->message))
114
+ Mage::helper('connector')->log('POST ADDRESS BOOK CONTACTS ' . $response->message);
115
+
116
+ return $response;
117
+ }
118
+
119
+ /**
120
+ * Deletes all contacts from a given address book.
121
+ * @param $addressBookId
122
+ * @param $contactId
123
+ * @return null
124
+ */
125
+ public function deleteAddressBookContact($addressBookId, $contactId)
126
+ {
127
+ $url = self::REST_ADDRESS_BOOKS . '/' . $addressBookId . '/contacts/' . $contactId;
128
+ $this->setUrl($url)
129
+ ->setVerb('DELETE');
130
+
131
+ $response = $this->execute();
132
+ if(isset($response->message))
133
+ Mage::helper('connector')->log('DELETE ADDRESS BOOK CONTACT ' . $response->message);
134
+
135
+ return $response;
136
+ }
137
+
138
+ /**
139
+ * Gets a report with statistics about what was successfully imported, and what was unable to be imported.
140
+ * @param $importId
141
+ * @return mixed
142
+ */
143
+ public function getContactsImportReport($importId)
144
+ {
145
+ $url = self::REST_CONTACTS_IMPORT . $importId . "/report";
146
+
147
+ $this->setUrl($url)
148
+ ->setVerb('GET');
149
+
150
+ $response = $this->execute();
151
+ if(isset($response->message))
152
+ Mage::helper('connector')->log('GET CONTACTS IMPORT REPORT . ' . $url . ' message : ' . $response->message);
153
+ return $response;
154
+ }
155
+
156
+ /**
157
+ * Gets a contact by email address.
158
+ * @param $email
159
+ * @return mixed
160
+ */
161
+ public function getContactByEmail($email)
162
+ {
163
+ $url = self::REST_CONTACTS . $email;
164
+ $this->setUrl($url)
165
+ ->setVerb('GET');
166
+
167
+ $response = $this->execute();
168
+ if(isset($response->message))
169
+ Mage::helper('connector')->log('GET CONTACT BY EMAIL : ' . $email . ' ' . $response->message);
170
+
171
+ return $response;
172
+ }
173
+
174
+ /**
175
+ * Get all address books
176
+ * @return null
177
+ */
178
+ public function getAddressBooks()
179
+ {
180
+ $url = self::REST_ADDRESS_BOOKS;
181
+ $this->setUrl($url)
182
+ ->setVerb("GET");
183
+
184
+ $response = $this->execute();
185
+ if(isset($response->message))
186
+ Mage::helper('connector')->log('GET ALL ADDRESS BOOKS..' . $response->message);
187
+ return $response;
188
+ }
189
+
190
+ /**
191
+ * Get list of all campaigns
192
+ * @return mixed
193
+ */
194
+ public function getCampaigns()
195
+ {
196
+ $url = self::REST_DATA_FIELDS_CAMPAIGNS;
197
+ $this->setUrl($url)
198
+ ->setVerb('GET');
199
+
200
+ $response = $this->execute();
201
+ if(isset($response->message))
202
+ Mage::helper('connector')->log('GET CAMPAINGS ' . $response->message);
203
+
204
+ return $response;
205
+ }
206
+
207
+ /**
208
+ * Creates a data field within the account.
209
+ * @param $data string/array
210
+ * @param string $type string, numeric, date, boolean
211
+ * @param string $visibility public, private
212
+ * @param bool $defaultValue
213
+ * @return mixed
214
+ */
215
+ public function postDataFields($data, $type = 'string', $visibility = 'public', $defaultValue = false)
216
+ {
217
+ $url = self::REST_DATA_FILEDS;
218
+ $helper = Mage::helper('connector');
219
+ if($type == 'numeric' && !$defaultValue)
220
+ $defaultValue = 0;
221
+
222
+ if(is_string($data)){
223
+ $data = array(
224
+ 'name' => $data,
225
+ 'type' => $type,
226
+ 'visibility' => $visibility,
227
+ 'defaultValue' => $defaultValue
228
+ );
229
+ }
230
+ $this->flush();
231
+ $this->setUrl($url)
232
+ ->buildPostBody($data)
233
+ ->setVerb('POST');
234
+
235
+ $response = $this->execute();
236
+ if(isset($response->message)){
237
+ $helper->log('POST CREATE DATAFIELDS ' . $response->message);
238
+ $helper->log($response);
239
+ }
240
+
241
+ return $response;
242
+ }
243
+
244
+ public function deleteDataField($name)
245
+ {
246
+ $url = self::REST_DATA_FILEDS . '/' . $name;
247
+ $request = Mage::helper('connector/api_restrequest');
248
+ $request->setUrl($url)
249
+ ->setVerb('DELETE');
250
+
251
+ $response = $request->execute();
252
+ if(isset($response->message))
253
+ Mage::helper('connector')->log('DELETE DATA FIELD :' . $name . ' ' . $response->message);
254
+ return $request->execute();
255
+ }
256
+
257
+ /**
258
+ * Lists the data fields within the account.
259
+ * @return mixed
260
+ */
261
+ public function getDataFields()
262
+ {
263
+ $url = self::REST_DATA_FILEDS;
264
+ $this->setUrl($url)
265
+ ->setVerb('GET');
266
+
267
+ $response = $this->execute();
268
+ if(isset($response->message))
269
+ Mage::helper('connector')->log('GET ALL DATAFIELDS ' . $response->message);
270
+
271
+ return $response;
272
+ }
273
+
274
+ /**
275
+ * Updates a contact.
276
+ * @param $contactId
277
+ * @param $data
278
+ * @return object
279
+ */
280
+ public function updateContact($contactId, $data)
281
+ {
282
+ $url = self::REST_CONTACTS . $contactId;
283
+ $this->flush();
284
+ $this->setUrl($url)
285
+ ->setVerb('PUT')
286
+ ->buildPostBody($data);
287
+
288
+ $response = $this->execute();
289
+ if(isset($response->message)){
290
+ Mage::helper('connector')->log('UPDATE CONTACT ' . $contactId);
291
+ Mage::helper('connector')->log($data);
292
+ }
293
+
294
+ return $response;
295
+ }
296
+
297
+ /**
298
+ * Sends a specified campaign to one or more address books, segments or contacts at a specified time.
299
+ * Leave the address book array empty to send to All Contacts.
300
+ * @param $campaignId
301
+ * @param $contacts
302
+ * @return mixed
303
+ */
304
+ public function postCampaignsSend($campaignId, $contacts)
305
+ {
306
+ $helper = Mage::helper('connector');
307
+ $data = array(
308
+ 'username' => $this->api_username,
309
+ 'password' => $this->api_password,
310
+ "campaignId" => $campaignId,
311
+ "ContactIds" => $contacts
312
+ );
313
+ $this->setUrl(self::REST_CAMPAIGN_SEND)
314
+ ->setVerb('POST')
315
+ ->buildPostBody($data);
316
+
317
+ $response = $this->execute();
318
+ if(isset($response->message))
319
+ $helper->log(' SENDING CAMPAIGN ' . $response->message);
320
+
321
+ return $response;
322
+ }
323
+
324
+ /**
325
+ * Creates a contact.
326
+ * @param $email
327
+ * @return mixed
328
+ */
329
+ public function postContacts($email)
330
+ {
331
+ $url = self::REST_CONTACTS;
332
+ $data = array(
333
+ 'Email' => $email,
334
+ 'EmailType' => 'Html',
335
+
336
+ );
337
+ $this->setUrl($url)
338
+ ->setVerb('POST')
339
+ ->buildPostBody($data);
340
+
341
+ $response = $this->execute();
342
+ if(isset($response->message))
343
+ Mage::helper('connector')->log('CREATE A NEW CONTACT : ' . $email . ' ' . $response->message);
344
+
345
+ return $response;
346
+ }
347
+
348
+ /**
349
+ * @param $testEmail
350
+ * @param $contactId
351
+ * @param $campaignId
352
+ */
353
+ public function sendIntallInfo($testEmail, $contactId, $campaignId)
354
+ {
355
+ $helper = Mage::helper('connector');
356
+ $productSize= Mage::getModel('catalog/product')->getCollection()->getSize();
357
+ $customerSize = Mage::getModel('customer/customer')->getCollection()->getSize();
358
+
359
+ $data = array(
360
+ 'Email' => $testEmail,
361
+ 'EmailType' => 'Html',
362
+ 'DataFields' => array(
363
+ array(
364
+ 'Key' => 'INSTALLCUSTOMERS',
365
+ 'Value' => (string)$customerSize),
366
+ array(
367
+ 'Key' => 'INSTALLPRODUCTS',
368
+ 'Value' => (string)$productSize),
369
+ array(
370
+ 'Key' => 'INSTALLURL',
371
+ 'Value' => Mage::getBaseUrl()),
372
+ array(
373
+ 'Key' => 'INSTALLAPI',
374
+ 'Value' => implode(',' , $this->getWebsiteAccounts())),
375
+ array(
376
+ 'Key' => 'PHPMEMORY',
377
+ 'Value' => ini_get('memory_limit') . ', Version = ' . $helper->getConnectorVersion()
378
+ )
379
+ )
380
+ );
381
+ $helper->log('SEND INSTALL INFO DATA...', Zend_Log::INFO, 'api.log');
382
+ /**
383
+ * Update data fields for a contact
384
+ */
385
+ $this->updateContact($contactId, $data);
386
+ /**
387
+ * Send Install info campaign
388
+ */
389
+ $this->postCampaignsSend($campaignId, array($contactId));
390
+
391
+ return;
392
+ }
393
+ private function getWebsiteAccounts()
394
+ {
395
+ $accounts = array();
396
+ $websites = Mage::app()->getWebsites();
397
+ foreach ($websites as $website) {
398
+ $websiteId = $website->getWebsiteId();
399
+ $websiteModel = Mage::app()->getWebsite($websiteId);
400
+ $apiUsername = $websiteModel->getConfig('connector_api_settings/api_credentials/username');
401
+ if(! in_array($apiUsername, $accounts))
402
+ $accounts[] = $apiUsername;
403
+ }
404
+ return $accounts;
405
+ }
406
+
407
+ /**
408
+ * Gets a list of suppressed contacts after a given date along with the reason for suppression.
409
+ * @param $dateString
410
+ * @return mixed
411
+ */
412
+ public function getContactsSuppressedSinceDate($dateString)
413
+ {
414
+ $url = self::REST_CONTACTS_SUPPRESSED_SINCE . $dateString;
415
+ $this->setUrl($url)
416
+ ->setVerb("GET");
417
+
418
+ $response = $this->execute();
419
+ if(isset($response->message))
420
+ Mage::helper('connector')->log('GET CONTACTS SUPPRESSED SINSE : ' . $dateString . ' ' . $response->message);
421
+
422
+ return $response;
423
+ }
424
+
425
+ /**
426
+ * Adds multiple pieces of transactional data to contacts asynchronously, returning an identifier that can be used to check for import progress.
427
+ * @param $collectionName
428
+ * @param $transactionalData
429
+ * @return object
430
+ */
431
+ public function postContactsTransactionalDataImport($transactionalData, $collectionName = 'Orders')
432
+ {
433
+ $orders = array();
434
+
435
+ foreach($transactionalData as $one){
436
+ if(isset($one->connector_id)){
437
+ $orders[] = array(
438
+ 'Key' => $one->id,
439
+ 'ContactIdentifier' => $one->connector_id,
440
+ 'Json' => json_encode($one->expose())
441
+ );
442
+ }
443
+ }
444
+ $url = self::REST_TRANSACTIONAL_DATA_IMPORT . $collectionName;
445
+ $this->setURl($url)
446
+ ->setVerb('POST')
447
+ ->buildPostBody($orders);
448
+
449
+ $result = $this->execute();
450
+ if(isset($result->message)){
451
+ Mage::helper('connector')->log(' SEND MULTI TRANSACTIONAL DATA ' . $result->message);
452
+ Mage::helper('connector')->log($orders);
453
+ }
454
+
455
+ return $result;
456
+ }
457
+
458
+ /**
459
+ * Adds a single piece of transactional data to a contact.
460
+ * @param $data
461
+ * @param string $name
462
+ * @return null
463
+ */
464
+ public function postContactsTransactionalData($data, $name = 'Orders')
465
+ {
466
+
467
+ $getData = $this->getContactsTransactionalDataByKey($name, $data->id);
468
+ if(isset($getData->message) && $getData->message == self::REST_TRANSACTIONAL_DATA_NOT_EXISTS){
469
+ $url = self::REST_TRANSACTIONAL_DATA . $name;
470
+ }else{
471
+ $url = self::REST_TRANSACTIONAL_DATA . $name . '/' . $getData->key ;
472
+ }
473
+ $apiData = array(
474
+ 'Key' => $data->id,
475
+ 'ContactIdentifier' => $data->connector_id,
476
+ 'Json' => json_encode($data->expose())
477
+ );
478
+
479
+ $this->setUrl($url)
480
+ ->setVerb('POST')
481
+ ->buildPostBody($apiData);
482
+ $response = $this->execute();
483
+ if(isset($response->message)){
484
+ Mage::helper('connector')->log('POST CONTACTS TRANSACTIONAL DATA ' . $response->message);
485
+ Mage::helper('connector')->log($apiData);
486
+ }
487
+
488
+ return $response;
489
+ }
490
+
491
+ /**
492
+ * Gets a piece of transactional data by key.
493
+ * @param $name
494
+ * @param $key
495
+ * @return null
496
+ */
497
+ public function getContactsTransactionalDataByKey($name, $key)
498
+ {
499
+ $url = self::REST_TRANSACTIONAL_DATA . $name . '/' . $key;
500
+ $this->setUrl($url)
501
+ ->setVerb('GET');
502
+
503
+ $response = $this->execute();
504
+ if(isset($response->message))
505
+ Mage::helper('connector')->log('GET CONTACTS TRANSACTIONAL DATA name: ' . $name . ' key: ' . $key . ' ' . $response->message);
506
+
507
+ return $response;
508
+ }
509
+
510
+ /**
511
+ * Deletes all transactional data for a contact.
512
+ * @param $email
513
+ * @param string $collectionName
514
+ * @return object
515
+ */
516
+ public function deleteContactTransactionalData($email, $collectionName = 'Orders')
517
+ {
518
+ $url = 'https://apiconnector.com/v2/contacts/' . $email . '/transactional-data/' . $collectionName ;
519
+ $this->setUrl($url)
520
+ ->setVerb('DELETE');
521
+
522
+ $response = $this->execute();
523
+ if(isset($response->message))
524
+ Mage::helper('connector')->log('DELETE CONTACT TRANSACTIONAL DATA : ' . $email . ' ' . $response->message);
525
+
526
+ return $response;
527
+ }
528
+
529
+ /**
530
+ * Gets a summary of information about the current status of the account.
531
+ * @return mixed
532
+ */
533
+ public function getAccountInfo()
534
+ {
535
+ $url = self::REST_ACCOUNT_INFO;
536
+ $helper = Mage::helper('connector');
537
+ $this->setUrl($url)
538
+ ->setVerb('GET');
539
+ $response = $this->execute();
540
+
541
+ $message = isset($response->message)? $response->message : '';
542
+ $helper->log('GET ACCOUNT INFO for api user : ' . $this->getApiUsername() . ' ' . $message);
543
+
544
+ return $response;
545
+ }
546
+
547
+ /**
548
+ * Send a single SMS message.
549
+ * @param $telephoneNumber
550
+ * @param $message
551
+ * @return object
552
+ */
553
+ public function postSmsMessagesSendTo($telephoneNumber, $message)
554
+ {
555
+ $data = array('Message' => $message);
556
+ $url = self::REST_SMS_MESSAGE_SEND_TO . $telephoneNumber;
557
+ $this->setUrl($url)
558
+ ->setVerb('POST')
559
+ ->buildPostBody($data);
560
+
561
+ $response = $this->execute();
562
+ if(isset($response->message))
563
+ Mage::helper('connector')->log('POST SMS MESSAGE SEND to ' . $telephoneNumber . ' message: ' . $message . ' error: ' . $response->message);
564
+
565
+ return $response;
566
+ }
567
+
568
+
569
+ /**
570
+ * Deletes multiple contacts from an address book
571
+ * @param $addressBookId
572
+ * @param $contactIds
573
+ * @return object
574
+ */
575
+ public function deleteAddressBookContactsInbulk($addressBookId, $contactIds)
576
+ {
577
+ $url = 'https://apiconnector.com/v2/address-books/' . $addressBookId . '/contacts/inbulk';
578
+
579
+ $data = array('ContactIds' => array($contactIds[0]));
580
+
581
+ $this->setUrl($url)
582
+ ->setVerb('DELETE')
583
+ ->buildPostBody($data);
584
+
585
+ $result = $this->execute();
586
+ if(isset($result->message)){
587
+ Mage::helper('connector')->log('DELETE BULK ADDRESS BOOK CONTACTS ' . $result->message . ' address book ' . $addressBookId);
588
+
589
+ }
590
+ return $result;
591
+ }
592
+ }
app/code/community/Dotdigitalgroup/Email/Model/Connector/Campaign.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 $email_send_id = array();
10
+
11
+ /**
12
+ * @param $email_send_id
13
+ * @return $this
14
+ */
15
+ public function setEmailSendId($email_send_id)
16
+ {
17
+ $this->email_send_id[] = $email_send_id;
18
+ return $this;
19
+ }
20
+
21
+ /**
22
+ * @return array
23
+ */
24
+ public function getEmailSendId()
25
+ {
26
+ return $this->email_send_id;
27
+ }
28
+
29
+ /**
30
+ * @param $contacts
31
+ * @return $this
32
+ */
33
+ public function setContacts($contacts)
34
+ {
35
+ $this->contacts[] = $contacts;
36
+ return $this;
37
+ }
38
+
39
+ /**
40
+ * @return array
41
+ */
42
+ public function getContacts()
43
+ {
44
+ return $this->contacts;
45
+ }
46
+
47
+ /**
48
+ * @param $emails
49
+ * @return $this
50
+ */
51
+ public function setEmails($emails)
52
+ {
53
+ $this->emails = $emails;
54
+ return $this;
55
+ }
56
+
57
+ /**
58
+ * @return array
59
+ */
60
+ public function getEmails()
61
+ {
62
+ return $this->emails;
63
+ }
64
+
65
+ /**
66
+ * @param mixed $id
67
+ */
68
+ public function setId($id)
69
+ {
70
+ $this->id = $id;
71
+ }
72
+
73
+ /**
74
+ * @return mixed
75
+ */
76
+ public function getId()
77
+ {
78
+ return $this->id;
79
+ }
80
+
81
+
82
+
83
+
84
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Model/Connector/Customer.php RENAMED
@@ -11,11 +11,11 @@ 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;
21
  private $_billing_address_2;
@@ -30,118 +30,65 @@ 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
  {
76
  return $this->_email;
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() {
@@ -153,16 +100,16 @@ class Dotdigitalgroup_Email_Model_Connector_Customer{
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,11 +126,11 @@ 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';
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
+
19
  // Customer Address Data
20
  private $_billing_address_1;
21
  private $_billing_address_2;
30
  private $_delivery_postcode;
31
  private $_delivery_telephone;
32
  // Customer Sales Data
33
+ private $_number_of_orders;
34
  private $_average_order_value;
35
  private $_total_spend;
36
+ private $_last_order_date;
37
+ private $_last_order_id;
38
+
 
 
39
  private $_customer_id;
40
 
41
+ private $_last_logged_date;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  public function getEmail()
44
  {
45
  return $this->_email;
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  private $_mapping_hash;
49
 
50
 
51
  // class constructor - takes
52
+ public function __construct( $customer){
 
 
53
 
54
+ $this->_mapping_hash = Mage::helper('connector')->getMappingHash($customer->getWebsiteId());
55
  // map each attribute from the $customer parameter (collection item) to the corresponding scoped variable in this class
56
+ $this->_email = $customer->getEmail();
57
+ $this->_firstname = $customer->getFirstname();
58
+ $this->_lastname = $customer->getLastname();
59
+ $this->_dob = $customer->getDob();
60
+ $this->_gender = $this->getCustomerGender($customer->getGender());
61
+ $this->_title = $customer->getPrefix();
62
+
63
+ $this->_website_name = $this->getWebsiteName($customer->getWebsiteId());
64
+ $this->_store_name = $this->getStoreName($customer->getStoreId());
65
+ $this->_created_at = $customer->getCreatedAt();
66
+ $this->_last_logged_date = $customer->getLastLoggedDate();
67
+ $this->_customer_group = $this->getCustomerGroup($customer->getGroupId());
68
+ $this->_billing_address_1 = $this->getStreet($customer->getBillingStreet(), 1);
69
+ $this->_billing_address_2 = $this->getStreet($customer->getBillingStreet(), 2);
70
+
71
+ $this->_billing_city = $customer->getBillingCity();
72
+ $this->_billing_country = $customer->getBillingCountryCode();
73
+ $this->_billing_postcode = $customer->getBillingPostcode();
74
+ $this->_billing_telephone = $customer->getBillingTelephone();
75
+
76
+ $this->_delivery_address_1 = $this->getStreet($customer->getShippingStreet(), 1);
77
+ $this->_delivery_address_2 = $this->getStreet($customer->getShippingStreet(), 2);
78
+
79
+ $this->_delivery_city = $customer->getShippingCity();
80
+ $this->_delivery_country = $customer->getShippingCountryCode();
81
+ $this->_delivery_postcode = $customer->getShippingPostcode();
82
+ $this->_delivery_telephone = $customer->getShippingTelephone();
83
+
84
+ $this->_number_of_orders = $customer->getNumberOfOrders();
85
+ $this->_average_order_value = $customer->getAverageOrderValue();
86
+ $this->_total_spend = $customer->getTotalSpend();
87
+
88
+ $this->_last_order_date = $customer->getLastOrderDate();
89
+ $this->_last_order_id = $customer->getLastOrderId();
90
+
91
+ $this->_customer_id = $customer->getId();
 
 
 
 
 
92
  }
93
 
94
  public function toCSVArray() {
100
  // Email is the only required field in the CSV upload
101
  $result[] = $this->_email;
102
 
103
+ if ($this->_mapping_hash[0]!="0") $result[] = $this->_title;
104
+ if ($this->_mapping_hash[1]!="0") $result[] = $this->_firstname;
105
+ if ($this->_mapping_hash[2]!="0") $result[] = $this->_lastname;
106
+ if ($this->_mapping_hash[3]!="0") $result[] = $this->_dob;
107
+ if ($this->_mapping_hash[4]!="0") $result[] = $this->_gender;
108
 
109
+ if ($this->_mapping_hash[5]!="0") $result[] = $this->_website_name;
110
+ if ($this->_mapping_hash[6]!="0") $result[] = $this->_store_name;
111
+ if ($this->_mapping_hash[7]!="0") $result[] = $this->_created_at;
112
+ if ($this->_mapping_hash[8]!="0") $result[] = $this->_last_logged_date;
113
  if ($this->_mapping_hash[9]!="0") $result[] = $this->_customer_group;
114
 
115
  if ($this->_mapping_hash[10]!="0") $result[] = $this->_billing_address_1;
126
  if ($this->_mapping_hash[20]!="0") $result[] = $this->_delivery_postcode;
127
  if ($this->_mapping_hash[21]!="0") $result[] = $this->_delivery_telephone;
128
 
129
+ if ($this->_mapping_hash[22]!="0") $result[] = $this->_number_of_orders;
130
  if ($this->_mapping_hash[23]!="0") $result[] = $this->_average_order_value;
131
  if ($this->_mapping_hash[24]!="0") $result[] = $this->_total_spend;
132
+ if ($this->_mapping_hash[25]!="0") $result[] = $this->_last_order_date;
133
+ if ($this->_mapping_hash[26]!="0") $result[] = $this->_last_order_id;
134
  if ($this->_mapping_hash[27]!="0") $result[] = $this->_customer_id;
135
 
136
  $result[] = 'Html';
app/code/{local → community}/Dotdigitalgroup/Email/Model/Connector/Order.php RENAMED
@@ -2,9 +2,9 @@
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;
@@ -13,7 +13,8 @@ class Dotdigitalgroup_Email_Model_Connector_Order
13
  protected $order_subtotal;
14
  protected $discount_ammount;
15
  protected $order_total;
16
- public $quote_id;
 
17
 
18
  /**
19
  * set the order information
@@ -26,42 +27,39 @@ class Dotdigitalgroup_Email_Model_Connector_Order
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
@@ -69,19 +67,20 @@ class Dotdigitalgroup_Email_Model_Connector_Order
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());
2
 
3
  class Dotdigitalgroup_Email_Model_Connector_Order
4
  {
5
+ public $id;
6
  public $connector_id;
7
+ public $quote_id;
8
  protected $store_name;
9
  protected $purchase_date;
10
  protected $delivery_address;
13
  protected $order_subtotal;
14
  protected $discount_ammount;
15
  protected $order_total;
16
+ protected $categories;
17
+
18
 
19
  /**
20
  * set the order information
27
 
28
  $created_at = new Zend_Date($orderData->getCreatedAt(), Zend_Date::ISO_8601);
29
  $this->purchase_date = $created_at->toString(Zend_Date::ISO_8601);
 
 
 
 
 
 
30
 
31
+ $customerModel = Mage::getModel('customer/customer');
32
+ $customerModel->load($orderData->getCustomerId());
 
33
  $this->quote_id = $orderData->getQuoteId();
34
 
35
  /**
36
  * billing and shipping address
37
  */
38
+ //check if order has shipping data virtual/downloadable
39
+ if($orderData->getShippingAddress()){
40
+ $deliveryData = $orderData->getShippingAddress()->getData();
41
+ $this->delivery_address = array(
42
+ 'delivery_address_1' => $this->getStreet($deliveryData['street'], 1),
43
+ 'delivery_address_2' => $this->getStreet($deliveryData['street'], 2),
44
+ 'delivery_city' => $deliveryData['city'],
45
+ 'delivery_region' => $deliveryData['region'],
46
+ 'delivery_country' => $deliveryData['country_id'],
47
+ 'delivery_postcode' => $deliveryData['postcode']
48
+ );
49
+ }
50
+
51
  $billingData = $orderData->getBillingAddress()->getData();
52
  $this->billing_address = array(
53
  'billing_address_1' => $this->getStreet($billingData['street'], 1),
54
  'billing_address_2' => $this->getStreet($billingData['street'], 2),
55
  'billing_city' => $billingData['city'],
56
+ 'billing_region' => $billingData['region'],
57
  'billing_country' => $billingData['country_id'],
58
  'billing_postcode' => $billingData['postcode'],
59
  );
60
+
61
+ //Order items
62
+ foreach ($orderData->getAllItems() as $productItem) {
 
 
63
  $product = $productItem->getProduct();
64
  if($product){
65
  // category names
67
  ->addAttributeToSelect('name');
68
 
69
  foreach ($categoryCollection as $cat) {
70
+ $categories = array();
71
  $categories[] = $cat->getName();
72
+ $this->categories[]['Name'] = substr(implode(', ', $categories), 0, 244);
73
  }
 
74
  }
75
 
76
  $this->products[] = array(
77
  'name' => $productItem->getName(),
78
  'sku' => $productItem->getSku(),
 
79
  'qty' => (int)number_format($productItem->getData('qty_ordered'), 2),
80
  'price' => (float)number_format($productItem->getPrice(), 2),
81
  );
82
  }
83
+
84
  $this->order_subtotal = (float)number_format($orderData->getData('subtotal'), 2);
85
  $this->discount_ammount = (float)number_format($orderData->getData('discount_amount'), 2);
86
  $orderTotal = abs($orderData->getData('grand_total') - $orderData->getTotalRefunded());
app/code/community/Dotdigitalgroup/Email/Model/Connector/Test.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Connector_Test extends Dotdigitalgroup_Email_Model_Connector_Api_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
+ public function validate($apiUsername, $apiPassword)
12
+ {
13
+ $this->setApiUsername($apiUsername);
14
+ $this->setApiPassword($apiPassword);
15
+ /**
16
+ * Get Account Information
17
+ */
18
+ $accountInfo = $this->getAccountInfo();
19
+ $this->_sendInstallConfirmation();
20
+
21
+ return $accountInfo;
22
+ }
23
+
24
+ public function ajaxvalidate($apiUsername, $apiPassword)
25
+ {
26
+ $message = 'Credentials Valid.';
27
+ $this->setApiUsername($apiUsername);
28
+ $this->setApiPassword($apiPassword);
29
+ $response = $this->getAccountInfo();
30
+
31
+ if(isset($response->message)){
32
+ $message = 'API Username And API Password Do Not Match!';
33
+ }
34
+ return $message;
35
+ }
36
+
37
+ private function _sendInstallConfirmation()
38
+ {
39
+ // set test credentials
40
+ $this->setApiUsername(self::TEST_API_USERNAME);
41
+ $this->setApiPassword(self::TEST_API_PASSWORD);
42
+
43
+ $testEmail = self::TEST_CONTACT_EMAIL;
44
+ $contactId = self::TEST_CONTACT_ID;
45
+ $campaignId = self::TEST_API_CAMPAIGN;
46
+
47
+ /**
48
+ * send initial info
49
+ */
50
+ $this->sendIntallInfo($testEmail, $contactId, $campaignId);
51
+ }
52
+
53
+ public function createDefaultDataFields(){
54
+
55
+
56
+ $helper = Mage::helper('connector');
57
+
58
+ foreach ($helper->getDefaultDataFields() as $datafield){
59
+
60
+ $this->postDataFields($datafield);
61
+ }
62
+ return ;
63
+
64
+ }
65
+ }
app/code/community/Dotdigitalgroup/Email/Model/Cron.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Dotdigitalgroup_Email_Model_Cron
3
+ {
4
+ /**
5
+ * CRON FOR CONTACTS SYNC
6
+ */
7
+ public function contactSync()
8
+ {
9
+ if(Mage::helper('connector')->getContactSyncEnabled()){
10
+
11
+ // send customers
12
+ Mage::getModel('connector/customer_contact')->sync();
13
+ }
14
+ return;
15
+ }
16
+
17
+
18
+ /**
19
+ * CRON FOR LOST BASKET
20
+ */
21
+ public function lostBaskets()
22
+ {
23
+ // send lost basket
24
+ //Mage::getModel('connector/email_send')->sendLostBasketsEmail();
25
+
26
+ Mage::getModel('connector/sales_quote')->proccessCampaigns();
27
+
28
+
29
+ }
30
+
31
+ /**
32
+ * CRON FOR ORDER TRANSACTIONAL DATA
33
+ */
34
+ public function orderSync()
35
+ {
36
+ if(Mage::helper('connector')->getOrderSyncEnabled()){
37
+
38
+ // send order
39
+ Mage::getModel('connector/sales_order')->sync();
40
+ }
41
+ }
42
+
43
+ /**
44
+ * CRON FOR SUBSCRIBERS AND SUPRESSED CONTACTS
45
+ */
46
+ public function subscribersAndSuppressedSync()
47
+ {
48
+ $helper = Mage::helper('connector');
49
+ if($helper->getSubscriberSyncEnabled()){
50
+ $helper->log('start subscribers and suppresssed sync..');
51
+ //sync subscribers
52
+ Mage::getModel('connector/newsletter_subscriber')
53
+ ->sync()
54
+ ->unsubscribe();
55
+ //sync guests
56
+ Mage::getModel('connector/customer_guest')->sync();
57
+ $helper->log('end subscribers and suppresssed sync.');
58
+ }
59
+ }
60
+
61
+ public function sendMail()
62
+ {
63
+ $helper = Mage::helper('connector');
64
+ $helper->log('Sending mail cron..');
65
+ $emailModel = Mage::getModel('connector/email_send')->send();
66
+
67
+
68
+ $helper->log('email send end');
69
+ }
70
+
71
+ /**
72
+ * CLEAN ARHIVED FOLDERS
73
+ */
74
+
75
+ public function cleaning()
76
+ {
77
+ $helper = Mage::helper('connector/file');
78
+ $archivedFolder = $helper->getArchiveFolder();
79
+ $result = $helper->deleteDir($archivedFolder);
80
+ $helper->log('Cleaning cronjob result : ' . $result);
81
+ return $result;
82
+ }
83
+
84
+ }
app/code/community/Dotdigitalgroup/Email/Model/Customer/Contact.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Customer_Contact
4
+ {
5
+ private $_start;
6
+ private $_countCustomers;
7
+ protected $wishlists;
8
+
9
+ public function sync()
10
+ {
11
+ /** @var Dotdigitalgroup_Email_Helper_Data $helper */
12
+ $helper = Mage::helper('connector');
13
+ $helper->log('Start customer sync..');
14
+ $this->_start = microtime(true);
15
+
16
+ //resourse allocation
17
+ $helper->allowResourceFullExecution();
18
+
19
+ $result = array('error' => false, 'message' => "Done.");
20
+
21
+ foreach(Mage::app()->getWebsites(true) as $website){
22
+
23
+ $this->_exportCustomersForWebsite($website);
24
+ }
25
+
26
+ $helper->log('Total time for sync : ' . gmdate("H:i:s", microtime(true) - $this->_start));
27
+ return $result;
28
+ }
29
+
30
+
31
+
32
+ private function _exportCustomersForWebsite(Mage_Core_Model_Website $website){
33
+
34
+ $helper = Mage::helper('connector');
35
+ $updated = 0;
36
+ $customers = array();
37
+ //skip if the mapping field is missing
38
+ if(!$helper->getCustomerAddressBook($website))
39
+ return;
40
+ //reset wishlists
41
+ $this->wishlists = array();
42
+ $fileHelper = Mage::helper('connector/file');
43
+ $contactModel = Mage::getModel('connector/email_contact');
44
+ $client = Mage::getModel('connector/connector_api_client');
45
+ $client->setApiUsername($helper->getApiUsername($website));
46
+ $client->setApiPassword($helper->getApiPassword($website));
47
+
48
+ // Contacts to import for website
49
+ $pageSize = $helper->getSyncLimit();
50
+ $contacts = $contactModel->getContactsToImportForWebsite($website->getId(), $pageSize);
51
+
52
+ // no contacts for this webiste
53
+ if(!count($contacts))
54
+ return;
55
+
56
+ //create customer filename
57
+ $customersFile = strtolower($website->getCode() . '_customers_' . date('d_m_Y_Hi') . '.csv');
58
+ $helper->log('Customers file : ' . $customersFile);
59
+
60
+ //get customer ids
61
+ $customerIds = array();
62
+ foreach($contacts as $contact){
63
+ $customerIds[] = $contact->getCustomerId();
64
+ }
65
+
66
+ //customer collection
67
+ $customerCollection = Mage::getResourceModel('customer/customer_collection')
68
+ ->addNameToSelect()
69
+ ->addAttributeToSelect('email')
70
+ ->addAttributeToSelect('dob')
71
+ ->addAttributeToSelect('gender')
72
+ ->addAttributeToSelect('created_at')
73
+ ->addAttributeToSelect('last_logged_in')
74
+ ->addAttributeToSelect('group_id')
75
+ ->addAttributeToSelect('dob')
76
+ ->joinAttribute('billing_street', 'customer_address/street', 'default_billing', null, 'left')
77
+ ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
78
+ ->joinAttribute('billing_country_code', 'customer_address/country_id', 'default_billing', null, 'left')
79
+ ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
80
+ ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
81
+ ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
82
+ ->joinAttribute('shipping_street', 'customer_address/street', 'default_shipping', null, 'left')
83
+ ->joinAttribute('shipping_city', 'customer_address/city', 'default_shipping', null, 'left')
84
+ ->joinAttribute('shipping_country_code','customer_address/country_id', 'default_shipping', null, 'left')
85
+ ->joinAttribute('shipping_postcode', 'customer_address/postcode', 'default_shipping', null, 'left')
86
+ ->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
87
+ ->joinAttribute('shipping_region', 'customer_address/region', 'default_shipping', null, 'left')
88
+ ->addAttributeToFilter('entity_id', array('in' => $customerIds))
89
+ ;
90
+
91
+ $customer_log = Mage::getSingleton('core/resource')->getTableName('log_customer');
92
+ $sales_flat_order_grid = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_grid');
93
+
94
+ // get the last login date from the log_customer table
95
+ $customerCollection->getSelect()->columns(
96
+ array('last_logged_date' => new Zend_Db_Expr ("(SELECT login_at
97
+ FROM $customer_log WHERE customer_id =e.entity_id ORDER BY log_id DESC LIMIT 1)")));
98
+
99
+ // customer order information
100
+ $alias = 'subselect';
101
+ $subselect = Mage::getModel('Varien_Db_Select', Mage::getSingleton('core/resource')->getConnection('core_read'))
102
+ ->from($sales_flat_order_grid, array(
103
+ 'customer_id as s_customer_id',
104
+ 'sum(grand_total) as total_spend',
105
+ 'count(*) as number_of_orders',
106
+ 'avg(grand_total) as average_order_value',
107
+ )
108
+ )->group('customer_id')
109
+ ;
110
+ $customerCollection->getSelect()->columns(array(
111
+ 'last_order_date' => new Zend_Db_Expr("(SELECT created_at
112
+ FROM $sales_flat_order_grid
113
+ WHERE customer_id =e.entity_id
114
+ ORDER BY created_at DESC
115
+ LIMIT 1)"),
116
+ 'last_order_id' => new Zend_Db_Expr("(SELECT entity_id
117
+ FROM $sales_flat_order_grid
118
+ WHERE customer_id =e.entity_id
119
+ ORDER BY created_at DESC
120
+ LIMIT 1)")
121
+ )
122
+ );
123
+ $customerCollection->getSelect()
124
+ ->joinLeft(array($alias => $subselect),
125
+ "{$alias}.s_customer_id = e.entity_id");
126
+
127
+ //write the csv headers
128
+ $fileHelper->outputCSV($fileHelper->getFilePath($customersFile), $fileHelper->getCsvHeaderArray($website));
129
+
130
+ foreach($customerCollection as $customer){
131
+ $connectorCustomer = Mage::getModel('connector/connector_customer', $customer);
132
+ $contactModel = Mage::getModel('connector/email_contact')->loadByCustomerId($customer->getId());
133
+
134
+ //skip contacts without customer id
135
+ if(!$contactModel->getId())
136
+ continue;
137
+ $customers[] = $connectorCustomer;
138
+
139
+ //mark the contact as imported
140
+ $contactModel->setEmailImported(Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_IMPORTED)->save();
141
+
142
+ //Send wishlist as transactional data
143
+ if($helper->getWishlistEnabled() && $contactId = $contactModel->getContactId()){
144
+ $this->setCustomerWishList($customer, $contactId, $website);
145
+ }
146
+
147
+ // save csv file data for customers
148
+ $fileHelper->outputCSV($fileHelper->getFilePath($customersFile), $connectorCustomer->toCSVArray());
149
+ $updated++;
150
+ }
151
+ //send wishlist as transactional data
152
+ if(isset($this->wishlists[$website->getId()])){
153
+ //send wishlists as transactional data
154
+ $wishlists = $this->wishlists[$website->getId()];
155
+ $client->deleteContactTransactionalData($contactId, 'Wishlist');
156
+ $client->postContactsTransactionalDataImport($wishlists, $collectionName = 'Wishlist');
157
+ }
158
+
159
+ $helper->log('Website : ' . $website->getName() . ', customers = ' . count($customers));
160
+ $helper->log('-----------------------------------------------execution time :' . gmdate("H:i:s", microtime(true) - $this->_start));
161
+
162
+ if(file_exists($fileHelper->getFilePath($customersFile))){
163
+ //import contacts
164
+ if($updated > 0)
165
+ $client->postAddressBookContactsImport($customersFile, $helper->getCustomerAddressBook($website));
166
+ //archive file on success
167
+ $fileHelper->archiveCSV($customersFile);
168
+ }
169
+ $this->_countCustomers = $updated;
170
+ return;
171
+ }
172
+
173
+ /**
174
+ * @param $customer
175
+ * @param $contactId
176
+ * @param $website
177
+ */
178
+ public function setCustomerWishList($customer, $contactId, $website)
179
+ {
180
+ $website = Mage::app()->getWebsite($website);
181
+ $customerId = $customer->getId();
182
+ $wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId);
183
+
184
+ /** @var $connectorWishlist */
185
+ $connectorWishlist = Mage::getModel('connector/customer_wishlist', $customer);
186
+ $connectorWishlist->setId($wishlist->getId())
187
+ ->setConnectorId($contactId);
188
+ $wishListItemCollection = $wishlist->getItemCollection();
189
+
190
+ if (count($wishListItemCollection)) {
191
+ foreach ($wishListItemCollection as $item) {
192
+ /* @var $product Mage_Catalog_Model_Product */
193
+ $product = $item->getProduct();
194
+ $wishlistItem = Mage::getModel('connector/customer_wishlist_item', $product)
195
+ ->setQty($item->getQty());
196
+ $wishlistItem->setPrice($product);
197
+
198
+ $connectorWishlist->setItem($wishlistItem);//store for wishlists
199
+ }
200
+ //set wishlists for later use
201
+ $this->wishlists[$website->getId()][] = $connectorWishlist;
202
+ }
203
+ }
204
+ }
app/code/community/Dotdigitalgroup/Email/Model/Customer/Guest.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Customer_Guest
4
+ {
5
+ protected $_countGuests = 0;
6
+ public function sync()
7
+ {
8
+ /** @var Dotdigitalgroup_Email_Helper_Data $helper */
9
+ $helper = Mage::helper('connector');
10
+ $helper->log('Start guest sync..');
11
+ $this->_start = microtime(true);
12
+
13
+ foreach(Mage::app()->getWebsites() as $website){
14
+
15
+ $this->_exportGuestPerWebsite($website);
16
+ }
17
+ $helper->log('Total time for guest sync : ' . gmdate("H:i:s", microtime(true) - $this->_start));
18
+
19
+ return;
20
+ }
21
+
22
+ public function _exportGuestPerWebsite($website)
23
+ {
24
+ $helper = Mage::helper('connector');
25
+ $fileHelper = Mage::helper('connector/file');
26
+ $client = Mage::getModel('connector/connector_api_client')
27
+ ->setApiUsername($helper->getApiUsername($website))
28
+ ->setApiPassword($helper->getApiPassword($website));
29
+
30
+ $guestFilename = strtolower($website->getCode() . '_guest_' . date('d_m_Y_Hi') . '.csv');
31
+ $helper->log('Guest file: ' . $guestFilename);
32
+
33
+ //get store name mapped
34
+ $storeName = $helper->getMappedStoreName($website);
35
+ //guest file headers
36
+ $fileHelper->outputCSV($fileHelper->getFilePath($guestFilename), array('Email', 'emailType', $storeName));
37
+
38
+ $guests = Mage::getModel('connector/email_contact')->getCollection()
39
+ ->addFieldToFilter('is_guest', array('notnull' => true))
40
+ ->addFieldToFilter('is_subscriber', array('null' => true))
41
+ ->addFieldToFilter('website_id', $website->getId())
42
+ ->addFieldToFilter('email_imported', Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_NOT_IMPORTED)
43
+ ;
44
+
45
+ foreach ($guests as $guest) {
46
+
47
+
48
+ $email = $guest->getEmail();
49
+
50
+ $helper->log('guest email : '. $email . ' website ' . $website->getId());
51
+ try{
52
+
53
+ $guest->setEmailImported(Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_IMPORTED)
54
+ ->save();
55
+
56
+ }catch (Exception $e){
57
+ $helper->log($e->getMessage());
58
+ }
59
+
60
+ $storeName = $website->getName();
61
+ // save data for guests
62
+ $fileHelper->outputCSV($fileHelper->getFilePath($guestFilename), array($email, 'Html', $storeName));
63
+ $this->_countGuests++;
64
+ }
65
+ if($this->_countGuests){
66
+ //Add to guest address book
67
+ $client->postAddressBookContactsImport($guestFilename, $helper->getGuestAddressBook($website));
68
+ }
69
+
70
+ //arhive guest file
71
+ $fileHelper->archiveCSV($guestFilename);
72
+ }
73
+
74
+ }
app/code/{local/Dotdigitalgroup/Email/Model/Connector → community/Dotdigitalgroup/Email/Model/Customer}/Wishlist.php RENAMED
@@ -1,21 +1,18 @@
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
  /**
@@ -53,11 +50,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 +69,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();
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Model_Customer_Wishlist
4
  {
5
+ public $id;
6
+ public $customer_id;
7
+ public $connector_id;
 
 
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
  }
17
 
18
  /**
50
  }
51
 
52
  /**
53
+ * @param $id
54
+ * @return $this
55
  */
56
  public function setId($id)
57
  {
58
  $this->id = $id;
59
+ return $this;
60
  }
61
 
62
  /**
69
 
70
  public function setItem($item)
71
  {
72
+
73
  $this->items[] = $item->expose();
74
 
75
  $this->total_wishlist_value += $item->getTotalValueOfProduct();
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,7 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
55
  }
56
 
57
  /**
58
- * @param mixed $price
59
  */
60
  public function setPrice($product)
61
  {
@@ -74,13 +79,17 @@ 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
  /**
85
  * @return mixed
86
  */
@@ -93,8 +102,4 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
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
  */
65
  public function setPrice($product)
66
  {
79
  }
80
 
81
  /**
82
+ * @param $sku
83
+ * @return $this
84
  */
85
  public function setSku($sku)
86
  {
87
  $this->sku = $sku;
88
+ return $this;
89
  }
90
 
91
+
92
+
93
  /**
94
  * @return mixed
95
  */
102
  return get_object_vars($this);
103
 
104
  }
 
 
 
 
105
  }
app/code/{local → community}/Dotdigitalgroup/Email/Model/Dynamic/Product/Mapper.php RENAMED
File without changes
app/code/{local → community}/Dotdigitalgroup/Email/Model/Dynamic/Recommended.php RENAMED
@@ -210,7 +210,6 @@ class Dotdigitalgroup_Email_Model_Dynamic_Recommended extends Dotdigitalgroup_Em
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())
210
 
211
  Mage::helper('connector')->log('proudcts push ids : ' . implode(',', $productIds), null, $this->filename);
212
 
 
213
  $productCollection = Mage::getModel('catalog/product')->getCollection()
214
  ->addAttributeToFilter('entity_id', array('in' => $productIds))
215
  ->setPageSize(Mage::helper('connector/recommended')->getLimit())
app/code/community/Dotdigitalgroup/Email/Model/Email/Contact.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+ * Contact model.
6
+ */
7
+ class Dotdigitalgroup_Email_Model_Email_Contact extends Mage_Core_Model_Abstract
8
+ {
9
+
10
+ const EMAIL_CONTACT_IMPORTED = 1;
11
+ const EMAIL_CONTACT_NOT_IMPORTED = null;
12
+
13
+ /**
14
+ * constructor
15
+ */
16
+ public function _construct(){
17
+ parent::_construct();
18
+ $this->_init('connector/email_contact');
19
+ }
20
+
21
+
22
+ /**
23
+ * Reset the imported data
24
+ * @return int
25
+ */
26
+ public function resetCustomerContacts()
27
+ {
28
+ $collection = $this->getCollection()
29
+ ->addFieldToFilter('is_guest', array('null' => true))
30
+ ->addFieldToFilter('customer_id', array('notnull' => true))
31
+ ->addFieldToFilter('email_imported', array('notnull' => true))
32
+ ;
33
+
34
+ $reset = 0;
35
+ foreach($collection as $_contact){
36
+
37
+ try{
38
+
39
+ if($_contact->getEmailImported()){
40
+ $_contact->setEmailImported(Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_NOT_IMPORTED)->save();
41
+ $reset++;
42
+ }
43
+ }catch(Exception $e){
44
+ Mage::helper('connector')->log($e->getMessage());
45
+
46
+ }
47
+
48
+ }
49
+ return $reset;
50
+ }
51
+
52
+ /**
53
+ * Load contact by customer id
54
+ * @param $customerId
55
+ * @return mixed
56
+ */
57
+ public function loadByCustomerId($customerId)
58
+ {
59
+ $collection = $this->getCollection()
60
+ ->addFieldToFilter('customer_id', $customerId);
61
+ if($collection->count())
62
+ return $collection->getFirstItem();
63
+ return $this;
64
+
65
+ }
66
+
67
+ public function getContactsToImportForWebsite($websiteId, $pageSize = 100)
68
+ {
69
+ $collection = $this->getCollection()
70
+ ->addFieldToFilter('website_id', $websiteId)
71
+ ->addFieldToFilter('email_imported', array('null' => true))
72
+ ->addFieldToFilter('customer_id', array('notnull' => true))
73
+ ;
74
+
75
+ $collection->getSelect()->limit($pageSize);
76
+
77
+ return $collection;
78
+ }
79
+
80
+ /**
81
+ * Get missing contacts.
82
+ * @param $websiteId
83
+ * @param int $pageSize
84
+ * @return mixed
85
+ */
86
+ public function getMissingContacts($websiteId, $pageSize = 100)
87
+ {
88
+ $collection = $this->getCollection()
89
+ ->addFieldToFilter('contact_id', array('null' => true))
90
+ ->addFieldToFilter('suppressed', null)
91
+ ->addFieldToFilter('website_id', $websiteId);
92
+
93
+ $collection->getSelect()->limit($pageSize);
94
+
95
+ return $collection->load();
96
+ }
97
+
98
+ /**
99
+ * Load Contact by Email.
100
+ * @param $email
101
+ * @param $websiteId
102
+ * @return $this
103
+ */
104
+ public function loadByCustomerEmail($email, $websiteId)
105
+ {
106
+ $collection = $this->getCollection()
107
+ ->addFieldToFilter('email', $email)
108
+ ->addFieldToFilter('website_id', $websiteId)
109
+ ;
110
+ if($collection->count()){
111
+ return $collection->getFirstItem();
112
+ }else{
113
+ $this->setEmail($email)
114
+ ->setWebsiteId($websiteId);
115
+ }
116
+ return $this;
117
+ }
118
+
119
+ public function getSubscribersToImport($limit)
120
+ {
121
+ $collection = $this->getCollection()
122
+ ->addFieldToFilter('is_subscriber', array('notnull' => true))
123
+ ->addFieldToFilter('subscriber_imported', array('null' => true));
124
+
125
+ $collection->getSelect()->limit($limit);
126
+
127
+ return $collection;
128
+ }
129
+
130
+ }
app/code/community/Dotdigitalgroup/Email/Model/Email/Order.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Email_Order extends Mage_Core_Model_Abstract
4
+ {
5
+ /**
6
+ * constructor
7
+ */
8
+ public function _construct(){
9
+ parent::_construct();
10
+ $this->_init('connector/email_order');
11
+ }
12
+
13
+
14
+ public function loadByOrderId($orderId, $quoteId, $storeId)
15
+ {
16
+ $collection = $this->getCollection()
17
+ ->addFieldToFilter('order_id', $orderId)
18
+ ->addFieldToFilter('quote_id', $quoteId)
19
+ ->addFieldToFilter('store_id', $storeId);
20
+ if($collection->count()){
21
+ return $collection->getFirstItem();
22
+ }else{
23
+ $this->setOrderId($orderId)
24
+ ->setQuoteId($quoteId)
25
+ ->setStoreId($storeId);
26
+ }
27
+ return $this;
28
+ }
29
+
30
+
31
+ public function getEmailOrderRow($orderId, $quoteId, $storeId)
32
+ {
33
+
34
+ $collection = $this->getCollection()
35
+ ->addFieldToFilter('order_id', $orderId)
36
+ ->addFieldToFilter('quote_id', $quoteId)
37
+ ->addFieldToFilter('store_id', $storeId);
38
+
39
+ if($collection->count()){
40
+ return $collection->getFirstItem();
41
+ }else{
42
+ $now = Mage::getSingleton('core/date')->gmtDate();
43
+
44
+ $this->setOrderId($orderId)
45
+ ->setQuoteId($quoteId)
46
+ ->setStoreId($storeId)
47
+ ->setCreatedAt($now)
48
+ ;
49
+ }
50
+ return $this;
51
+
52
+ }
53
+ public function getOrdersToImport($limit)
54
+ {
55
+ $collection = $this->getCollection()
56
+ ->addFieldToFilter('email_imported', array('null' => true));
57
+
58
+ $collection->getSelect()->limit($limit);
59
+ return $collection->load();
60
+ }
61
+
62
+ }
app/code/community/Dotdigitalgroup/Email/Model/Email/Send.php ADDED
@@ -0,0 +1,488 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Email_Send extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ //xml path configuration
8
+ const XML_PATH_LOSTBASKET_1_ENABLED = 'lostbaskets/customers/enabled_1';
9
+ const XML_PATH_LOSTBASKET_2_ENABLED = 'lostbaskets/customers/enabled_2';
10
+ const XML_PATH_LOSTBASKET_3_ENABLED = 'lostbaskets/customers/enabled_3';
11
+
12
+ const XML_PATH_LOSTBASKET_1_INTERVAL = 'lost_basket_settings/customers/send_after_1';
13
+ const XML_PATH_LOSTBASKET_2_INTERVAL = 'lost_basket_settings/customers/send_after_2';
14
+ const XML_PATH_LOSTBASKET_3_INTERVAL = 'lost_basket_settings/customers/send_after_3';
15
+
16
+ const XML_PATH_TRIGGER_1_CAMPAIGN = 'lost_basket_settings/customers/campaign_1';
17
+ const XML_PATH_TRIGGER_2_CAMPAIGN = 'lost_basket_settings/customers/campaign_2';
18
+ const XML_PATH_TRIGGER_3_CAMPAIGN = 'lost_basket_settings/customers/campaign_3';
19
+
20
+ const XML_PATH_GUEST_LOSTBASKET_1_ENABLED = 'lostbaskets/guests/enabled_1';
21
+ const XML_PATH_GUEST_LOSTBASKET_2_ENABLED = 'lostbaskets/guests/enabled_2';
22
+ const XML_PATH_GUEST_LOSTBASKET_3_ENABLED = 'lostbaskets/guests/enabled_3';
23
+
24
+ const XML_PATH_GUEST_LOSTBASKET_1_INTERVAL = 'lost_basket_settings/guests/send_after_1';
25
+ const XML_PATH_GUEST_LOSTBASKET_2_INTERVAL = 'lost_basket_settings/guests/send_after_2';
26
+ const XML_PATH_GUEST_LOSTBASKET_3_INTERVAL = 'lost_basket_settings/guests/send_after_3';
27
+
28
+ const XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN = 'lost_basket_settings/guests/campaign_1';
29
+ const XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN = 'lost_basket_settings/guests/campaign_2';
30
+ const XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN = 'lost_basket_settings/guests/campaign_3';
31
+
32
+ const XML_PATH_TEST_LOSTBASKET_EMAIL = 'lost_basket_settings/test/email';
33
+
34
+
35
+
36
+ /**
37
+ * constructor
38
+ */
39
+ public function _construct(){
40
+ parent::_construct();
41
+ $this->_init('connector/email_send');
42
+ }
43
+
44
+
45
+ /**
46
+ * @param $quoteId
47
+ * @param $storeId
48
+ * @return mixed
49
+ */
50
+ public function loadByQuoteId($quoteId, $storeId)
51
+ {
52
+ $collection = $this->getCollection()
53
+ ->addFieldToFilter('quote_id', $quoteId)
54
+ ->addFieldToFilter('store_id', $storeId);
55
+
56
+ if($collection->count())
57
+ return $collection->getFirstItem();
58
+ else
59
+ $this->setQuoteId($quoteId)
60
+ ->setStoreId($storeId);
61
+
62
+ return $this;
63
+ }
64
+
65
+
66
+
67
+
68
+ /**
69
+ * send the lost baskets to campains
70
+ * @return array
71
+ */
72
+ public function sendLostBasketsEmail()
73
+ {
74
+ $helper = Mage::helper('connector');
75
+ $client = Mage::getModel('connector/connector_api_client');
76
+ $salesQuote = Mage::getModel('connector/sales_quote');
77
+
78
+ foreach (Mage::app()->getStores() as $store){
79
+
80
+ //skip any action if all lost basket campaings are disabled
81
+ if(!$store->getConfig(self::XML_PATH_LOSTBASKET_1_ENABLED) && !$store->getConfig(self::XML_PATH_LOSTBASKET_2_ENABLED) &&
82
+ !$store->getConfig(self::XML_PATH_LOSTBASKET_3_ENABLED) && !$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_ENABLED) &&
83
+ !$store->getconfig(self::XML_PATH_GUEST_LOSTBASKET_2_ENABLED) && !$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_ENABLED)
84
+ )continue;
85
+ // set credentials for every store
86
+ $storeId = $store->getId();
87
+ $websiteId = $store->getWebsite()->getId();
88
+ $client->setApiUsername($helper->getApiUsername($websiteId));
89
+ $client->setApiPassword($helper->getApiPassword($websiteId));
90
+
91
+ /**
92
+ * Customers campaings
93
+ */
94
+
95
+ //first campign
96
+ if(!$store->getConfig(self::XML_PATH_LOSTBASKET_1_ENABLED)){
97
+
98
+ $contacts = array();
99
+ $from = Zend_Date::now()->subMinute($store->getConfig(self::XML_PATH_LOSTBASKET_1_INTERVAL));
100
+ $to = clone($from);
101
+ $from->sub('5', Zend_Date::MINUTE);
102
+
103
+ // sales quotes for guests
104
+ $quoteCollection = $salesQuote->getGuestStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
105
+
106
+ foreach($quoteCollection as $one) {
107
+
108
+ $email = $one->getEmail();
109
+ if(isset($email)){
110
+ $campaignId = $store->getConfig(self::XML_PATH_TRIGGER_1_CAMPAIGN);
111
+ $contactModel = Mage::getModel('connector/email_contact')->loadByCustomerEmail($email, $websiteId);
112
+
113
+ if($contactId = $contactModel->getContactId()){
114
+ $contacts[] = $contactId;
115
+ }else{
116
+
117
+ $result = $client->getContactByEmail($email);
118
+ if(isset($result->id)){
119
+ $contactModel->setContactId($result->id)->save();
120
+ $contacts[] = $result->id;
121
+ }
122
+ }
123
+ }
124
+ }
125
+ // if(count($contacts)){
126
+ // $result = $client->postCampaignsSend($campaignId, $contacts);
127
+ // if(isset($result->message)){
128
+ //
129
+ // foreach ($emailsToSent as $one){
130
+ // $one->setCapmaignId($campaignId)
131
+ // ->setMessage($result->message)->save();
132
+ // }
133
+ // }else{
134
+ // foreach ($emailsToSent as $one) {
135
+ //
136
+ // $one->setCampaignId($campaignId)
137
+ // ->setIsSent(1)
138
+ // ->setSentAt(Varien_Date::now())
139
+ // ->save();
140
+ // }
141
+ // }
142
+ // }
143
+ }
144
+
145
+ //second campaign
146
+ if(!$store->getConfig(self::XML_PATH_LOSTBASKET_2_ENABLED)){
147
+ $contacts = array();
148
+ $from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_LOSTBASKET_2_INTERVAL));
149
+ $to = clone($from);
150
+ $from->sub('5', Zend_Date::MINUTE);
151
+ // lost baskets
152
+ $emailsToSent = $this->_getEmailToSent($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
153
+
154
+ foreach($emailsToSent as $one) {
155
+
156
+ $email = $one->getEmail();
157
+ if(isset($email)){
158
+ $campaignId = $store->getConfig(self::XML_PATH_TRIGGER_2_CAMPAIGN);
159
+
160
+ $contactModel = Mage::getModel('connector/email_contact')->loadByCustomerEmail($email, $websiteId);
161
+
162
+ if($contactId = $contactModel->getContactId()){
163
+ $contacts[] = $contactId;
164
+ }else{
165
+
166
+ $result = $client->getContactByEmail($email);
167
+ if(isset($result->id)){
168
+ $contactModel->setContactId($result->id)->save();
169
+ $contacts[] = $result->id;
170
+ }
171
+ }
172
+ }
173
+ }
174
+ if(count($contacts)){
175
+ $result = $client->postCampaignsSend($campaignId, $contacts);
176
+ if(isset($result->message)){
177
+
178
+ foreach ($emailsToSent as $one){
179
+ $one->setCapmaignId($campaignId)
180
+ ->setMessage($result->message)->save();
181
+ }
182
+ }else{
183
+ foreach ($emailsToSent as $one) {
184
+
185
+ $one->setCampaignId($campaignId)
186
+ ->setIsSent(1)
187
+ ->setSentAt(Varien_Date::now())
188
+ ->save();
189
+ }
190
+
191
+ }
192
+ }
193
+ }
194
+
195
+ //third campign
196
+ if(!$store->getConfig(self::XML_PATH_LOSTBASKET_3_ENABLED)){
197
+ $contacts = array();
198
+ $from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_LOSTBASKET_3_INTERVAL));
199
+ $to = clone($from);
200
+ $from->sub('5', Zend_Date::MINUTE);
201
+ // lost baskets
202
+ $emailsToSent = $this->_getEmailToSent($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
203
+
204
+ foreach($emailsToSent as $one) {
205
+
206
+ $email = $one->getEmail();
207
+ if(isset($email)){
208
+ $campaignId = $store->getConfig(self::XML_PATH_TRIGGER_3_CAMPAIGN);
209
+ $contactModel = Mage::getModel('connector/email_contact')->loadByCustomerEmail($email, $websiteId);
210
+ if($contactId = $contactModel->getContactId()){
211
+ $contacts[] = $contactId;
212
+ }else{
213
+
214
+ $result = $client->getContactByEmail($email);
215
+ if(isset($result->id)){
216
+ $contactModel->setContactId($result->id)->save();
217
+ $contacts[] = $result->id;
218
+ }
219
+ }
220
+ }
221
+ }
222
+ if(count($contacts)){
223
+ $result = $client->postCampaignsSend($campaignId, $contacts);
224
+ if(isset($result->message)){
225
+
226
+ foreach ($emailsToSent as $one){
227
+ $one->setCapmaignId($campaignId)
228
+ ->setMessage($result->message)->save();
229
+ }
230
+ }else{
231
+ foreach ($emailsToSent as $one) {
232
+ $one->setCampaignId($campaignId)
233
+ ->setIsSent(1)
234
+ ->setSentAt(Varien_Date::now())
235
+ ->save();
236
+ }
237
+ }
238
+ }
239
+ }
240
+ /**
241
+ * Guests campaings
242
+ */
243
+ //first guest campaign
244
+ if(!$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_ENABLED))
245
+ {
246
+ $contacts = array();
247
+ $from = Zend_Date::now()->subMinute($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_INTERVAL));
248
+ $to = clone($from);
249
+ $from->sub('5', Zend_Date::MINUTE);
250
+
251
+ // sales quotes for guests
252
+ $quoteCollection = $salesQuote->getGuestStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
253
+
254
+ foreach($quoteCollection as $quote) {
255
+ $email = $quote->getCustomerEmail();
256
+ $campaignId = $store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN);
257
+
258
+ $result = $client->postContacts($email);
259
+ if(isset($result->id)){
260
+ $contacts[] = $result->id;
261
+ }
262
+
263
+ }
264
+ if(count($contacts)){
265
+ /**
266
+ * Send Lost Basket Campaign For Guests
267
+ */
268
+ $result = $client->postCampaignsSend($campaignId, $contacts);
269
+
270
+ if(isset($result->message)){
271
+ //save report message for this contact
272
+ foreach ($quoteCollection as $quote){
273
+
274
+ $quoteId = $quote->getId();
275
+ $emailModel = $this->loadByQuoteId($quoteId, $storeId);
276
+ $emailModel->setEmail($email)
277
+ ->setQuoteId($quote->getId())
278
+ ->setCreatedAt($quote->getCreatedAt())
279
+ ->setUpdatedAt($quote->getUpdatedAt())
280
+ ;
281
+
282
+ $emailModel->setCampaignId($campaignId)
283
+ ->setMessage($result->message)->save();
284
+ }
285
+ }else{
286
+ //mark contacts as sent
287
+ foreach ($quoteCollection as $quote) {
288
+ $email = $quote->getCustomerEmail();
289
+ $storeId = $quote->getStoreId();
290
+
291
+ $collection = $this->getCollection()
292
+ ->addFieldToFilter('email', $email);
293
+ if($collection->count()){
294
+ $send = $collection->getFirstItem();
295
+ }else{
296
+ $send = $this;
297
+ $send->setEmail($email);
298
+ }
299
+ $send->setSentAt(Varien_Date::now())
300
+ ->setIsSent(1)
301
+ ->setCampaignId($campaignId)->save();
302
+ }
303
+
304
+ }
305
+ }
306
+ }
307
+ // second guest campaign
308
+ if(!$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_ENABLED))
309
+ {
310
+ $contacts = array();
311
+ $from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_INTERVAL));
312
+ $to = clone($from);
313
+ $from->sub('5', Zend_Date::MINUTE);
314
+ $quoteCollection = $salesQuote->getGuestStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
315
+ foreach($quoteCollection as $quote) {
316
+ $email = $quote->getCustomerEmail();
317
+ $campaignId = $store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN);
318
+
319
+ $result = $client->postContacts($email);
320
+ if(isset($result->id)){
321
+ $contacts[] = $result->id;
322
+ }
323
+
324
+ }
325
+ if(count($contacts)){
326
+ /**
327
+ * Send Lost Basket Campaign For Guests
328
+ */
329
+ $result = $client->postCampaignsSend($campaignId, $contacts);
330
+
331
+ if(isset($result->message)){
332
+ //save report message for this contact
333
+ foreach ($quoteCollection as $quote){
334
+
335
+ $quoteId = $quote->getId();
336
+ $emailModel = $this->loadByQuoteId($quoteId, $storeId);
337
+ $emailModel->setEmail($email)
338
+ ->setQuoteId($quote->getId())
339
+ ->setCreatedAt($quote->getCreatedAt())
340
+ ->setUpdatedAt($quote->getUpdatedAt())
341
+ ;
342
+ $emailModel->setCampaignId($campaignId)
343
+ ->setMessage($result->message)->save();
344
+ }
345
+ }else{
346
+ //mark contacts as sent
347
+ foreach ($quoteCollection as $quote) {
348
+ $email = $quote->getCustomerEmail();
349
+ $storeId = $quote->getStoreId();
350
+ $collection = $this->getCollection()
351
+ ->addFieldToFilter('email', $email);
352
+ if($collection->count()){
353
+ $send = $collection->getFirstItem();
354
+ }else{
355
+ $send = $this;
356
+ $send->setEmail($email);
357
+ }
358
+ $send->setSentAt(Varien_Date::now())
359
+ ->setIsSent(1)
360
+ ->setCampaignId($campaignId)->save();
361
+ }
362
+ }
363
+ }
364
+ }
365
+ //third guest campaign
366
+ if(!$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_ENABLED)){
367
+ $contacts = array();
368
+ $from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_INTERVAL));
369
+ $to = clone($from);
370
+ $from->sub('5', Zend_Date::MINUTE);
371
+ $quoteCollection = $salesQuote->getGuestStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
372
+ foreach($quoteCollection as $quote) {
373
+ $email = $quote->getCustomerEmail();
374
+ $campaignId = $store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN);
375
+
376
+ $result = $client->postContacts($email);
377
+ if(isset($result->id)){
378
+ $contacts[] = $result->id;
379
+ }
380
+
381
+ }
382
+ if(count($contacts)){
383
+ /**
384
+ * Send Lost Basket Campaign For Guests
385
+ */
386
+ $result = $client->postCampaignsSend($campaignId, $contacts);
387
+
388
+ if(isset($result->message)){
389
+ //save report message for this contact
390
+ foreach ($quoteCollection as $quote){
391
+
392
+ $quoteId = $quote->getId();
393
+ $emailModel = $this->loadByQuoteId($quoteId, $storeId);
394
+ $emailModel->setEmail($email)
395
+ ->setQuoteId($quote->getId())
396
+ ->setCreatedAt($quote->getCreatedAt())
397
+ ->setUpdatedAt($quote->getUpdatedAt())
398
+ ;
399
+ $emailModel->setCampaignId($campaignId)
400
+ ->setMessage($result->message)->save();
401
+ }
402
+ }else{
403
+ //mark contacts as sent
404
+ foreach ($quoteCollection as $quote) {
405
+ $email = $quote->getCustomerEmail();
406
+ $quoteId = $quote->getId();
407
+ $storeId = $quote->getStoreId();
408
+ $collection = $this->getCollection()
409
+ ->addFieldToFilter('email', $email);
410
+ if($collection->count()){
411
+ $send = $collection->getFirstItem();
412
+ }else{
413
+ $send = $this;
414
+ $send->setEmail($email);
415
+ }
416
+ $send->setSentAt(Varien_Date::now())
417
+ ->setIsSent(1)
418
+ ->setCampaignId($campaignId)->save();
419
+ }
420
+ }
421
+ }
422
+ }
423
+ }
424
+ return;
425
+ }
426
+
427
+ public function send()
428
+ {
429
+ $helper = Mage::helper('connector');
430
+ $contactModel = Mage::getModel('connector/email_contact');
431
+ $campaigns = array();
432
+ $emailsSend = $this->_getEmailToSent();
433
+
434
+ foreach ($emailsSend as $emailSend) {
435
+ $storeId = $emailSend->getStoreId();
436
+ $campaignId = $emailSend->getCampaignId();
437
+ $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
438
+ $contactId = $helper->getContactId($emailSend->getEmail(), $websiteId);
439
+
440
+ $campaignModel = Mage::getModel('connector/connector_campaign');
441
+ $campaignModel->setId($campaignId)
442
+ ->setContact($contactId)
443
+ ->setEmailSendId($emailSend->getEmailSendId());
444
+
445
+ if($contactId)
446
+ $campaigns[$emailSend->getCampaignId()][] = $contactId;
447
+
448
+ }
449
+
450
+ foreach ($campaigns as $campaignId => $contacts) {
451
+
452
+ $client = Mage::getModel('connector/connector_api_client');
453
+ $client->setApiUsername($helper->getApiUsername($websiteId))
454
+ ->setApiPassword($helper->getApiPassword($websiteId));
455
+
456
+ $result = $client->postCampaignsSend($campaignId, $contacts);
457
+
458
+ if(isset($result->message)){
459
+ $errorEmails = $this->getCollection()
460
+ ->addFieldToFilter('emails_send_ids', $campaign);
461
+
462
+ foreach ($contacts as $contact) {
463
+
464
+
465
+ }
466
+ }
467
+ }
468
+ }
469
+
470
+ /**
471
+ * @return mixed
472
+ */
473
+ private function _getEmailToSent(){
474
+
475
+ $collection = $this->getCollection();
476
+ $collection->addFieldToFilter('is_sent', array('null' => true));
477
+
478
+ $collection->getSelect()->order('campaign_id');
479
+
480
+ return $collection->load();
481
+ }
482
+
483
+ public function sendEmails($websiteId)
484
+ {
485
+
486
+ }
487
+
488
+ }
app/code/community/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Newsletter_Subscriber
4
+ {
5
+
6
+ const STATUS_SUBSCRIBED = 1;
7
+ const STATUS_NOT_ACTIVE = 2;
8
+ const STATUS_UNSUBSCRIBED = 3;
9
+ const STATUS_UNCONFIRMED = 4;
10
+
11
+ private $suppressedContacts = array();
12
+
13
+ protected $_countSubscribers = 0;
14
+
15
+
16
+ protected $_start;
17
+
18
+
19
+
20
+ public function sync()
21
+ {
22
+ /** @var Dotdigitalgroup_Email_Helper_Data $helper */
23
+ $helper = Mage::helper('connector');
24
+ $helper->log('Start subscriber sync..');
25
+ $this->_start = microtime(true);
26
+
27
+ foreach(Mage::app()->getWebsites() as $website){
28
+ $this->_exportSubscribersPerWebsite($website);
29
+ }
30
+ $helper->log('Total time for sync : ' . gmdate("H:i:s", microtime(true) - $this->_start));
31
+
32
+ return $this;
33
+ }
34
+
35
+ public function _exportSubscribersPerWebsite($website)
36
+ {
37
+ $helper = Mage::helper('connector');
38
+ $updated = 0;
39
+ $fileHelper = Mage::helper('connector/file');
40
+ $client = Mage::getModel('connector/connector_api_client')
41
+ ->setApiUsername($helper->getApiUsername($website))
42
+ ->setApiPassword($helper->getApiPassword($website));
43
+
44
+ $subscribersFilename = strtolower($website->getCode() . '_subscribers_' . date('d_m_Y_Hi') . '.csv');
45
+ $helper->log('Subscribers file: ' . $subscribersFilename);
46
+
47
+ //get mapped storename
48
+ $subscriberStorename = $helper->getMappedStoreName($website);
49
+ //subscriber file headers
50
+ $fileHelper->outputCSV($fileHelper->getFilePath($subscribersFilename), array('Email', 'emailType', $subscriberStorename));
51
+
52
+ $subscribers = Mage::getModel('connector/email_contact')->getSubscribersToImport($helper->getSyncLimit());
53
+
54
+ foreach ($subscribers as $contact) {
55
+
56
+ try{
57
+ $email = $contact->getEmail();
58
+ $contact->setSubscriberImported(Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_IMPORTED)->save();
59
+ }catch (Exception $e){
60
+ $helper->log($e->getMessage());
61
+ }
62
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
63
+ $storeId = $subscriber->getStoreId();
64
+ $storeName = Mage::app()->getStore($storeId)->getName();
65
+ // save data for subscribers
66
+ $fileHelper->outputCSV($fileHelper->getFilePath($subscribersFilename), array($email, 'Html', $storeName));
67
+ $updated++;
68
+
69
+ }
70
+ if($updated){
71
+ //Add to subscriber address book
72
+ $client->postAddressBookContactsImport($subscribersFilename, $helper->getSubscriberAddressBook($website));
73
+ }
74
+ $this->_countSubscribers += $updated;
75
+ $fileHelper->archiveCSV($subscribersFilename);
76
+ }
77
+
78
+ public function unsubscribe($force = false)
79
+ {
80
+ $result['customers'] = 0;
81
+ $date = new Zend_Date();
82
+ $date = $date->subHour(1);
83
+ $client = Mage::getModel('connector/connector_api_client');
84
+ $helper = Mage::helper('connector');
85
+
86
+ // force sync all customers
87
+ if($force)
88
+ $date = $date->subYear(10);
89
+
90
+
91
+ // datetime format string
92
+ $dateString = $date->toString(Zend_Date::W3C);
93
+ /**
94
+ * 1. Sync all suppressed for each store
95
+ */
96
+ foreach (Mage::app()->getWebsites(true) as $website) {
97
+
98
+ $client->setApiUsername($helper->getApiUsername($website));
99
+ $client->setApiPassword($helper->getApiPassword($website));
100
+ $subscriberBookId = $helper->getSubscriberAddressBook($website);
101
+ $contacts = $client->getContactsSuppressedSinceDate($dateString);
102
+
103
+ if(! empty($contacts)){
104
+ foreach ($contacts as $suppressed){
105
+ if(isset($suppressed->suppressedContact)){
106
+
107
+ $email = $suppressed->suppressedContact->email;
108
+ $contactId = $suppressed->suppressedContact->id;
109
+
110
+ try{
111
+ /**
112
+ * 2. Unsubscribe customer
113
+ */
114
+ $newsletterModel = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
115
+ if($newsletterModel->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED){
116
+ $unsubscribe = $newsletterModel->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED);
117
+ $unsubscribe->save();
118
+ // remove from subscriber address-book
119
+ $client->deleteAddressBookContact($website->getConfig(), $contactId);
120
+ $this->suppressedContacts[$newsletterModel->getSubscriberEmail($subscriberBookId)] = $newsletterModel->getSubscriberEmail();
121
+ }
122
+ //mark contact as suppressed and unsubscribe
123
+ $contactCollection = Mage::getModel('connector/email_contact')->getCollection()
124
+ ->addFieldToFilter('email', $email);
125
+
126
+ foreach ($contactCollection as $contact) {
127
+ $contact->setIsSubscriber(null)
128
+ ->setSuppressed(1)->save();
129
+ }
130
+ }catch (Exception $e){
131
+ Mage::helper('connector')->log($e->getMessage());
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+ return $result;
138
+ }
139
+ }
app/code/community/Dotdigitalgroup/Email/Model/Observer.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Observer
4
+ {
5
+
6
+ /**
7
+ * Admin Sync Settings Section
8
+ * @param Varien_Event_Observer $observer
9
+ * @return $this
10
+ */
11
+ public function actionConfigResetContacts(Varien_Event_Observer $observer)
12
+ {
13
+ $helper = Mage::helper('connector');
14
+ $contactModel = Mage::getModel('connector/email_contact');
15
+ $updated = $contactModel->resetCustomerContacts();
16
+ $helper->log('Reset customer contacts for reimport : ' . $updated);
17
+
18
+ return $this;
19
+ }
20
+
21
+ /**
22
+ * Admin API Credentials Section
23
+ * @param Varien_Event_Observer $observer
24
+ * @return $this
25
+ */
26
+ public function actionConfigSaveAfter(Varien_Event_Observer $observer)
27
+ {
28
+ $helper = Mage::helper('connector');
29
+ $groups = Mage::app()->getRequest()->getPost('groups');
30
+
31
+ //skip if the inherit option is selected
32
+ if(isset($groups['api_credentials']['fields']['username']['value'])
33
+ && isset($groups['api_credentials']['fields']['password']['value'])){
34
+ /** @var Dotdigitalgroup_Email_Model_Connector_Test $testModel */
35
+ $testModel = Mage::getModel('connector/connector_test');
36
+
37
+ /**
38
+ * Validate
39
+ */
40
+ $helper->log('VALIDATE ACCOUNT');
41
+ $apiUsername = $groups['api_credentials']['fields']['username']['value'];
42
+ $apiPassword = $groups['api_credentials']['fields']['password']['value'];
43
+ $response = $testModel->validate($apiUsername, $apiPassword );
44
+
45
+ if(isset($response->message)){
46
+ Mage::getSingleton('adminhtml/session')->addError($response->message);
47
+ }else{
48
+ /**
49
+ * Create default data fields
50
+ */
51
+ $testModel->createDefaultDataFields();
52
+ Mage::getSingleton('adminhtml/session')->addSuccess($helper->__('API Credentials Valid.'));
53
+ }
54
+
55
+ }
56
+ return $this;
57
+ }
58
+ /**
59
+ * Create new contact or update info, also check for email change
60
+ * event: customer_save_before
61
+ * @param Varien_Event_Observer $observer
62
+ * @return $this
63
+ */
64
+ public function handleCustomerSaveBefore(Varien_Event_Observer $observer)
65
+ {
66
+ $customer = $observer->getEvent()->getCustomer();
67
+ $email = $customer->getEmail();
68
+ $websiteId = $customer->getWebsiteId();
69
+ $customerId = $customer->getEntityId();
70
+ try{
71
+
72
+ $contactModel = Mage::getModel('connector/email_contact')->loadByCustomerEmail($email, $websiteId);
73
+ $contactModel->setEmailImported(Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_NOT_IMPORTED)
74
+ ->setCustomerId($customerId)
75
+ ->save();
76
+
77
+ }catch(Exception $e){
78
+ Mage::logException($e);
79
+ }
80
+
81
+ return $this;
82
+ }
83
+ /**
84
+ * event: sales_order_save_after
85
+ * @param Varien_Event_Observer $observer
86
+ * @return $this
87
+ */
88
+ public function handleSalesOrderSaveAfter(Varien_Event_Observer $observer)
89
+ {
90
+ $order = $observer->getEvent()->getOrder();
91
+ $orderId = $order->getEntityId();
92
+ $quoteId = $order->getQuoteId();
93
+ $storeId = $order->getStoreId();
94
+
95
+ try{
96
+ $emailOrder = Mage::getModel('connector/email_order')->loadByOrderId($orderId, $quoteId, $storeId);
97
+ //register the order
98
+ $emailOrder->setUpdatedAt($order->getUpdatedAt())
99
+ ->setEmailImported(Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_NOT_IMPORTED)
100
+ ->save();
101
+
102
+ }catch(Exception $e){
103
+ Mage::logException($e);
104
+ }
105
+ return $this;
106
+ }
107
+
108
+ public function newsletterSubscriberSave(Varien_Event_Observer $observer)
109
+ {
110
+ $subscriber = $observer->getEvent()->getSubscriber();
111
+ $email = $subscriber->getEmail();
112
+ $storeId = $subscriber->getStoreId();
113
+ $subscriberStatus = $subscriber->getSubscriberStatus();
114
+
115
+ $helper = Mage::helper('connector');
116
+ $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
117
+ $contactEmail = Mage::getModel('connector/email_contact')->loadByCustomerEmail($email, $websiteId);
118
+
119
+ try{
120
+ /**
121
+ * Subscribe a contact
122
+ */
123
+ if($subscriberStatus == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED){
124
+ $contactEmail->setSubscriberStatus($subscriberStatus)
125
+ ->setIsSubscriber(1);
126
+
127
+ }else{
128
+ /**
129
+ * Unsubscribe contact
130
+ */
131
+ $client = Mage::getModel('connector/connector_api_client')
132
+ ->setApiUsername($helper->getApiUsername($websiteId))
133
+ ->setApiPassword($helper->getApiPassword($websiteId));
134
+
135
+ if(!$contactEmail->getContactId()){
136
+ //if contact id is not set get the di
137
+ $result = $client->postContacts($email);
138
+ $contactId = $result->id;
139
+ }else{
140
+ $contactId = $contactEmail->getContactId();
141
+ }
142
+ if($contactId){
143
+ $client->deleteAddressBookContact($helper->getSubscriberAddressBook($websiteId), $contactId);
144
+ }else{
145
+ Mage::helper('connector')->log('CONTACT ID EMPTY : ' . $contactId . ' email : ' . $email);
146
+ }
147
+ $contactEmail->setIsSubscriber(null);
148
+ }
149
+ $contactEmail->save();
150
+
151
+ }catch(Exception $e){
152
+ Mage::helper('connector')->log($e->getMessage());
153
+ }
154
+ return $this;
155
+ }
156
+
157
+
158
+ public function handleSalesOrderStatusChange(Varien_Event_Observer $observer)
159
+ {
160
+ $order = $observer->getEvent()->getOrder();
161
+ $status = $order->getStatus();
162
+
163
+ /**
164
+ * SMS functinality
165
+ */
166
+ $smsStatusOne = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_ONE_STATUS);
167
+ $smsStatusTwo = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_TWO_STATUS);
168
+ $smsStatusThree = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_THREE_STATUS);
169
+ $smsStatusFour = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_FOUR_STATUS);
170
+ $smsModel = Mage::getModel('connector/sales_sms');
171
+
172
+ switch($status){
173
+ case $smsStatusOne:
174
+ $smsModel->sendMessage($order, 'ONE');
175
+ break;
176
+ case $smsStatusTwo:
177
+ $smsModel->sendMessage($order, 'TWO');
178
+ break;
179
+ case $smsStatusThree:
180
+ $smsModel->sendMessage($order, 'THREE');
181
+ break;
182
+ case $smsStatusFour:
183
+ $smsModel->sendMessage($order, 'FOUR');
184
+ break;
185
+ }
186
+
187
+ return $this;
188
+ }
189
+
190
+ public function handleSalesOrderRefund(Varien_Event_Observer $observer)
191
+ {
192
+ $creditmemo = $observer->getEvent()->getCreditmemo();
193
+ $storeId = $creditmemo->getStoreId();
194
+ $order = $creditmemo->getOrder();
195
+ $orderId = $order->getEntityId();
196
+ $quoteId = $order->getQuoteId();
197
+ $helper = Mage::helper('connector');
198
+ $emailOrder = Mage::getModel('connector/email_order')->loadByOrderId($orderId, $quoteId, $storeId);
199
+
200
+ try{
201
+ $emailOrder->setEmailImported(Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_NOT_IMPORTED)->save();
202
+ }catch (Exception $e){
203
+ $helper->log($e->getMessage());
204
+ }
205
+
206
+ return $this;
207
+ }
208
+ public function hangleSalesOrderCancel(Varien_Event_Observer $observer)
209
+ {
210
+ $order = $observer->getEvent()->getOrder();
211
+ $storeId = $order->getStoreId();
212
+ $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
213
+ $customerEmail = $order->getCustomerEmail();
214
+ $helper = Mage::helper('connector');
215
+ if($helper->isEnabled($storeId)){
216
+
217
+ $client = Mage::getModel('connector/connector_api_client');
218
+ $client->setApiUsername($helper->getApiUsername($websiteId));
219
+ $client->setApiPassword($helper->getApiPassword($websiteId));
220
+
221
+ // delete the order transactional data
222
+ $client->deleteContactTransactionalData($customerEmail, 'Orders');
223
+ }
224
+
225
+ return $this;
226
+ }
227
+
228
+ // public function handleSalesQuoteSaveAfter(Varien_Event_Observer $observer)
229
+ // {
230
+ // $quote = $observer->getEvent()->getQuote();
231
+ // $quoteId = $quote->getId();
232
+ // try{
233
+ //
234
+ // $sendModel = Mage::getModel('connector/email_send')->loadByQuoteId($quoteId, $quote->getStoreId());
235
+ //
236
+ //
237
+ // $sendModel->setEmail($quote->getCustomerEmail())
238
+ // ->setCreatedAt($quote->getCreatedAt())
239
+ // ->setUpdatedAt($quote->getUpdatedAt())->save();
240
+ //
241
+ // }catch(Exception $e){
242
+ // Mage::logException($e);
243
+ // }
244
+ //
245
+ //
246
+ // return $this;
247
+ // }
248
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Contact.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Email_Contact extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('connector/email_contact', 'email_contact_id');
8
+
9
+ }
10
+
11
+
12
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Contact/Collection.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Email_Contact_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ protected function _construct(){
6
+ parent::_construct();
7
+ $this->_init('connector/email_contact');
8
+ }
9
+
10
+
11
+ public function addWebsiteFilter($website)
12
+ {
13
+ $this->addFilter('website_id', $website);
14
+ return $this;
15
+ }
16
+
17
+
18
+
19
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Order.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Email_Order extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('connector/email_order', 'email_order_id');
8
+ }
9
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Order/Collection.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Email_Order_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->_init('connector/email_order');
10
+ }
11
+
12
+
13
+
14
+
15
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Send.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Email_Send extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('connector/email_send', 'email_send_id');
8
+
9
+ }
10
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Email/Send/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Email_Send_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('connector/email_send');
9
+ }
10
+ }
app/code/community/Dotdigitalgroup/Email/Model/Resource/Setup.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
4
+ {
5
+
6
+ }
app/code/community/Dotdigitalgroup/Email/Model/Sales/Order.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_Sales_Order
4
+ {
5
+ const XML_PATH_TRANSACTIONAL_DATA_SYNC_LIMIT = 'connector_advanced_settings/sync_limits/orders';
6
+
7
+ protected $accounts = array();
8
+ private $_api_username;
9
+ private $_api_password;
10
+
11
+ /**
12
+ * initial sync the transactional data
13
+ * @return array
14
+ */
15
+ public function sync()
16
+ {
17
+ Mage::helper('connector')->log('start order sync..');
18
+ $client = Mage::getModel('connector/connector_api_client');
19
+ // Initialise a return hash containing results of our sync attempt
20
+ $this->_searchAccounts();
21
+
22
+ foreach($this->accounts as $account){
23
+ if(count($account->getOrders())){
24
+ $client->postContactsTransactionalDataImport($account->getOrders(), 'Orders');
25
+ }
26
+
27
+ unset($this->accounts[$account->getApiUsername()]);
28
+ }
29
+ Mage::helper('connector')->log('end order sync.');
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() as $website){
40
+
41
+ $this->_api_username = $helper->getApiUsername($website);
42
+ $this->_api_password = $helper->getApiPassword($website);
43
+
44
+ // limit for orders included to sync
45
+ $limit = Mage::helper('connector')->getTransactionalSyncLimit();
46
+
47
+ if(!isset($this->accounts[$this->_api_username])){
48
+ $account = Mage::getModel('connector/connector_account')
49
+ ->setApiUsername($this->_api_username)
50
+ ->setApiPassword($this->_api_password);
51
+
52
+ $this->accounts[$this->_api_username] = $account;
53
+ }
54
+ $this->accounts[$this->_api_username]->setOrders($this->getConnectorOrders($limit));
55
+
56
+ }
57
+ }
58
+
59
+ /**
60
+ * get all order to import
61
+ * @param $limit
62
+ * @return array
63
+ */
64
+ public function getConnectorOrders($limit = 100)
65
+ {
66
+ $orders = $customers = array();
67
+ $orderModel = Mage::getModel('connector/email_order');
68
+ $orderCollection = $orderModel->getOrdersToImport($limit);
69
+
70
+
71
+ foreach ($orderCollection as $order) {
72
+ try {
73
+ $salesOrder = Mage::getModel('sales/order')->load($order->getOrderId());
74
+
75
+ $websiteId = Mage::getModel('core/store')->load($order->getStoreId())->getWebsiteId();
76
+
77
+ /**
78
+ * Get guest and add to contacts
79
+ */
80
+ if($salesOrder->getCustomerIsGuest()){
81
+
82
+ $this->_createGuestContact($salesOrder->getCustomerEmail(), $websiteId);
83
+ }
84
+
85
+ //@todo report the deleted orders in log table
86
+ if($salesOrder->getId()){
87
+ $connectorOrder = Mage::getModel('connector/connector_order', $salesOrder);
88
+ $connectorOrder->connector_id = $salesOrder->getCustomerEmail();
89
+ $orders[] = $connectorOrder;
90
+ }
91
+ //mark order as imported
92
+ $order->setEmailImported(Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_IMPORTED)->save();
93
+
94
+
95
+ }catch(Exception $e){
96
+ Mage::helper('connector')->log($e->getMessage());
97
+ }
98
+ }
99
+ return $orders;
100
+ }
101
+ private function _createGuestContact($email, $websiteId){
102
+ try{
103
+ $client = Mage::getModel('connector/connector_api_client');
104
+ $client->setApiUsername(Mage::helper('connector')->getApiUsername($websiteId))
105
+ ->setApiPassword(Mage::helper('connector')->getApiPassword($websiteId));
106
+
107
+ $contactApi = $client->getContactByEmail($email);
108
+ if(isset($contactApi->message) && $contactApi->message == Dotdigitalgroup_Email_Model_Connector_Api_Client::REST_CONTACT_NOT_FOUND){
109
+ $contactApi = $client->postContacts($email);
110
+
111
+
112
+ }elseif(isset($contactApi->message)){
113
+ return false;
114
+ }
115
+ // Add guest to address book
116
+ $client->postAddressBookContacts(Mage::helper('connector')->getGuestAddressBook($websiteId), $contactApi);
117
+
118
+ /**
119
+ * Create new contact
120
+ */
121
+ $contactModel = Mage::getModel('connector/email_contact')->loadByCustomerEmail($email, $websiteId);
122
+
123
+ $contactModel->setIsGuest(1)
124
+ ->setContactId($contactApi->id)
125
+ ->setEmailImported(Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_NOT_IMPORTED)
126
+ ->save();
127
+
128
+
129
+ Mage::helper('connector')->log('found guest : ' . $email . ' website ' . $websiteId);
130
+ }catch(Exception $e){
131
+ Mage::helper('connector')->log($e->getMessage());
132
+ }
133
+
134
+ return true;
135
+
136
+ }
137
+ }
app/code/{local/Dotdigitalgroup/Email/Model/Order.php → community/Dotdigitalgroup/Email/Model/Sales/Order/State.php} RENAMED
@@ -1,6 +1,6 @@
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
  {
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Model_Sales_Order_State extends Mage_Sales_Model_Order
4
  {
5
  protected function _setState($state, $status = false, $comment = '', $isCustomerNotified = null, $shouldProtectState = false)
6
  {
app/code/{local → community}/Dotdigitalgroup/Email/Model/Sales/Quote.php RENAMED
@@ -1,6 +1,6 @@
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';
@@ -36,18 +36,23 @@ class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Mode
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
@@ -62,19 +67,20 @@ class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Mode
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
 
@@ -86,16 +92,20 @@ class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Mode
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
 
@@ -110,14 +120,18 @@ class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Mode
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
@@ -130,23 +144,24 @@ class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Mode
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
@@ -163,17 +178,18 @@ class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Mode
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
@@ -182,7 +198,6 @@ class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Mode
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)){
@@ -190,18 +205,18 @@ class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Mode
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
  }
@@ -227,63 +242,11 @@ class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Mode
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
  }
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Model_Sales_Quote
4
  {
5
  //xml path configuration
6
  const XML_PATH_LOSTBASKET_1_ENABLED = 'lostbaskets/customers/enabled_1';
36
  */
37
  public function proccessCampaigns()
38
  {
39
+ $helper = Mage::helper('connector');
40
+
41
+ $client = Mage::getModel('connector/connector_api_client');
42
+
43
+ foreach (Mage::app()->getStores() as $store){
44
 
45
  //skip any action if all lost basket campaings are disabled
46
  if(!$store->getConfig(self::XML_PATH_LOSTBASKET_1_ENABLED) && !$store->getConfig(self::XML_PATH_LOSTBASKET_2_ENABLED) &&
47
  !$store->getConfig(self::XML_PATH_LOSTBASKET_3_ENABLED) && !$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_ENABLED) &&
48
  !$store->getconfig(self::XML_PATH_GUEST_LOSTBASKET_2_ENABLED) && !$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_ENABLED)
49
  )continue;
 
50
  // set credentials for every store
51
  $storeId = $store->getId();
52
+ $websiteId = $store->getWebsite()->getId();
53
+
54
+ $client->setApiUsername($helper->getApiUsername($websiteId));
55
+ $client->setApiPassword($helper->getApiPassword($websiteId));
56
 
57
  /**
58
  * Customers campaings
67
  $from->sub('5', Zend_Date::MINUTE);
68
  // lost baskets
69
  $quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
 
70
 
71
+ if(count($quoteCollection)){
72
  // get collection contacts id
73
  foreach ($quoteCollection as $quote) {
 
 
74
 
75
+ $email = $quote->getCustomerEmail();
76
+ $contactId = $helper->getContactId($email, $websiteId);
77
+
78
+ if($contactId)
79
+ $contacts[] = $contactId;
80
  }
81
+
82
  if(!empty($contacts))
83
+ $client->postCampaignsSend($store->getConfig(self::XML_PATH_TRIGGER_1_CAMPAIGN), $contacts);
84
  }
85
  }
86
 
92
  $from->sub('5', Zend_Date::MINUTE);
93
  // lost baskets
94
  $quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
95
+
96
  if(count($quoteCollection)){
97
  // get collection contacts id
98
  foreach ($quoteCollection as $quote) {
99
+
100
+ $email = $quote->getCustomerEmail();
101
+ $contactId = $helper->getContactId($email, $websiteId);
102
+
103
+ if($contactId)
104
+ $contacts[] = $contactId;
105
  }
106
+
107
  if(!empty($contacts))
108
+ $client->postCampaignsSend($store->getConfig(self::XML_PATH_TRIGGER_2_CAMPAIGN), $contacts);
109
  }
110
  }
111
 
120
  if(count($quoteCollection)){
121
  // get collection contacts id
122
  foreach ($quoteCollection as $quote) {
123
+
124
+ $email = $quote->getCustomerEmail();
125
+ $contactId = $helper->getContactId($email, $websiteId);
126
+
127
+ if($contactId)
128
+ $contacts[] = $contactId;
129
  }
130
+
131
  if(!empty($contacts))
132
+ $client->postCampaignsSend($store->getConfig(self::XML_PATH_TRIGGER_3_CAMPAIGN), $contacts);
133
  }
134
+
135
  }
136
  /**
137
  * Guests campaings
144
  $to = clone($from);
145
  $from->sub('5', Zend_Date::MINUTE);
146
  $quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
147
+
148
  if(count($quoteCollection)){
149
  // get collection contacts id
150
  foreach ($quoteCollection as $quote) {
151
  $email = $quote->getCustomerEmail();
152
  //check if the customer exists
153
+ $response = $client->getContactByEmail($email);
154
 
155
+ if(isset($response->message) && $response->message == Dotdigitalgroup_Email_Model_Connector_Api_Client::REST_CONTACT_NOT_FOUND){
156
  //create new contact before sending campaign
157
+ $contactAPI = $client->postContacts($email);
158
  if(!isset($contactAPI->message))
159
+ $response = $client->postAddressBookContacts($helper->getGuestAddressBook($websiteId), $contactAPI);
160
  }
161
  $contacts[] = $response->id;
162
  }
163
  if(!empty($contacts))
164
+ $client->postCampaignsSend($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN), $contacts);
165
  }
166
  }
167
  // second guest campaign
178
  foreach ($quoteCollection as $quote) {
179
  $email = $quote->getCustomerEmail();
180
  //check if the customer exists
181
+ $response = $client->getContactByEmail($email);
182
+
183
+ if(isset($response->message) && $response->message == Dotdigitalgroup_Email_Model_Connector_Api_Client::REST_CONTACT_NOT_FOUND){
184
  //create new contact before sending campaign
185
+ $contactAPI = $client->postContacts($email);
186
  if(!isset($contactAPI->message))
187
+ $response = $client->postAddressBookContacts($helper->getGuestAddressBook($websiteId), $contactAPI);
188
  }
189
  $contacts[] = $response->id;
190
  }
191
  if(!empty($contacts))
192
+ $client->postCampaignsSend($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN), $contacts);
193
  }
194
  }
195
  //third guest campaign
198
  $from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_INTERVAL));
199
  $to = clone($from);
200
  $from->sub('5', Zend_Date::MINUTE);
 
201
  // lost baskets
202
  $quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
203
  if(count($quoteCollection)){
205
  foreach ($quoteCollection as $quote) {
206
  $email = $quote->getCustomerEmail();
207
  //check if the customer exists
208
+ $response = $client->getContactByEmail($email);
209
 
210
+ if(isset($response->message) && $response->message == Dotdigitalgroup_Email_Model_Connector_Api_Client::REST_CONTACT_NOT_FOUND){
211
  //create new contact before sending campaign
212
+ $contactAPI = $client->postContacts($email);
213
  if(!isset($contactAPI->message))
214
+ $response = $client->postAddressBookContacts($helper->getGuestAddressBook($websiteId), $contactAPI);
215
  }
216
  $contacts[] = $response->id;
217
  }
218
  if(!empty($contacts))
219
+ $client->postCampaignsSend($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN), $contacts);
220
  }
221
  }
222
  }
242
  'to' => $to,
243
  'date' => true)
244
  );
245
+
246
  if($guest)
247
  $salesCollection->addFieldToFilter('checkout_method' , Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);
248
 
249
  return $salesCollection->load();
250
  }
251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  }
app/code/{local → community}/Dotdigitalgroup/Email/Model/Sales/Sms.php RENAMED
@@ -1,6 +1,6 @@
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';
@@ -19,24 +19,21 @@ class Dotdigitalgroup_Email_Model_Sales_Sms extends Dotdigitalgroup_Email_Model_
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
 
@@ -59,9 +56,7 @@ class Dotdigitalgroup_Email_Model_Sales_Sms extends Dotdigitalgroup_Email_Model_
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;
1
  <?php
2
 
3
+ class Dotdigitalgroup_Email_Model_Sales_Sms
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';
19
  $storeId = $order->getStoreId();
20
  $billing = $order->getBillingAddress();
21
  $customerTelephone = $billing->getTelephone();
22
+ $client = Mage::getModel('connector/connector_api_client');
23
+ $helper = Mage::helper('connector');
24
 
25
  $message = Mage::getStoreConfig(constant('self::XML_PATH_SMS_MESSAGE_' . $number), $storeId);
26
 
27
  $message = $this->_processVariables($order, $message);
 
 
28
  $pattern = "/^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$/";
29
 
30
  $match = preg_match($pattern, $customerTelephone);
 
31
 
32
  if ($match != false) {
33
  $telephoneNumber = preg_replace('/\A(0){1}+/', '+44', $customerTelephone);
34
+ $client->setApiUsername($helper->getApiUsername($storeId));
35
+ $client->setApiPassword($helper->getApiPassword($storeId));
36
+ $client->postSmsMessagesSendTo($telephoneNumber, $message);
 
 
37
  }
38
  }
39
 
56
  $replacemant[] = '';
57
 
58
  $message = preg_replace($this->_available, $replacemant, $message);
59
+ $helper->log($message);
 
 
60
  }
61
 
62
  return $message;
app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Customer.php RENAMED
@@ -2,19 +2,17 @@
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;
@@ -24,12 +22,13 @@ class Dotdigitalgroup_Email_Model_System_Config_Backend_Syncschedule_Customer ex
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 {
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/contact_frequency';
6
 
7
  /**
8
  * Cron settings after save
 
 
9
  */
10
  protected function _afterSave()
11
  {
12
 
13
+ $enabled = $this->getData('groups/sync/fields/contact_enabled/value');
14
+ $time = $this->getData('groups/sync/fields/contact_time/value');
15
+ $frequency = $this->getData('groups/sync/fields/contact_frequency/value');
16
 
17
  $frequencyHourly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_HOURLY;
18
  $frequencyDaily = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_DAILY;
22
  if ($enabled) {
23
  $cronDayOfWeek = date('N');
24
  $cronExprArray = array(
25
+ ($frequency == $frequencyHourly)? $time[1] : '*', # Minute
26
+ ($frequency == $frequencyDaily)? intval($time[0]) : '*', # Hour
27
+ ($frequency == $frequencyMonthly)? '1' : '*', # Day of the Month
28
+ '*', # Month of the Year
29
+ ($frequency == $frequencyWeekly) ? $cronDayOfWeek : '*', # Day of the Week
30
  );
31
+
32
  $cronExprString = join(' ', $cronExprArray);
33
  }
34
  else {
app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Activebasket.php RENAMED
File without changes
app/code/community/Dotdigitalgroup/Email/Model/System/Config/Source/Addressbooks.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_System_Config_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
+ $helper = Mage::helper('connector');
12
+ $client = Mage::getModel('connector/connector_api_client');
13
+
14
+
15
+ $client->setApiUsername($helper->getApiUsername($website));
16
+ $client->setApiPassword($helper->getApiPassword($website));
17
+
18
+ // Add a "Do Not Map" Option
19
+ $fields[] = array('value' => 0, 'label' => 'Do Not Map');
20
+
21
+ // api all address books
22
+ $addressBooks = $client->getAddressBooks();
23
+
24
+ if(isset($addressBooks->message)){
25
+ $fields[] = array('value' => 0, 'label' => $addressBooks->message);
26
+ }
27
+
28
+ //set up fields with book id and label
29
+ foreach ($addressBooks as $book){
30
+ if(isset($book->id))
31
+ $fields[] = array('value' => $book->id, 'label' => $book->name);
32
+ }
33
+
34
+ return $fields;
35
+ }
36
+
37
+ }
app/code/community/Dotdigitalgroup/Email/Model/System/Config/Source/Campaigns.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Date: 15/04/2013
4
+ * Time: 13:46
5
+ */
6
+ class Dotdigitalgroup_Email_Model_System_Config_Source_Campaigns
7
+ {
8
+
9
+ // Returns the account's datafields
10
+ public function toOptionArray()
11
+ {
12
+ $fields = array();
13
+ /** @var Dotdigitalgroup_Email_Model_Connector_Api_Client $client */
14
+ $client = Mage::getModel('connector/connector_api_client');
15
+
16
+ $websiteName = Mage::app()->getRequest()->getParam('website');
17
+ if(! empty($websiteName)){
18
+ $website = Mage::getModel('core/website')->getCollection()
19
+ ->addFieldToFilter('code', $websiteName)->getFirstItem();
20
+
21
+ $client->setApiUsername(Mage::helper('connector')->getApiUsername($website));
22
+ $client->setApiPassword(Mage::helper('connector')->getApiPassword($website));
23
+ }
24
+ $campaigns = $client->getCampaigns();
25
+
26
+ foreach ($campaigns as $one){
27
+ if(isset($one->id))
28
+ $fields[] = array('value' => $one->id, 'label' => $one->name);
29
+ }
30
+
31
+ return $fields;
32
+ }
33
+
34
+ }
app/code/community/Dotdigitalgroup/Email/Model/System/Config/Source/Datafields.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_System_Config_Source_Datafields
4
+ {
5
+ // Returns the account's datafields
6
+ public function toOptionArray()
7
+ {
8
+ $helper = Mage::helper('connector');
9
+ $fields = array();
10
+
11
+ $website = Mage::app()->getRequest()->getParam('website');
12
+ $client = Mage::getModel('connector/connector_api_client');
13
+
14
+ $client->setApiUsername($helper->getApiUsername($website));
15
+ $client->setApiPassword($helper->getApiPassword($website));
16
+
17
+
18
+ /**
19
+ * api get all datafields
20
+ */
21
+ $datafields = $client->getDataFields();
22
+ // Add a "Do Not Map" Option
23
+ $fields[] = array('value' => 0, 'label' => 'Do Not Map');
24
+
25
+ if(isset($datafields->message)){
26
+ $fields[] = array('value' => 0, 'label' => $datafields->message);
27
+ }
28
+
29
+
30
+ foreach ($datafields as $datafield) {
31
+ if(isset($datafield->name))
32
+ $fields[] = array('value' => $datafield->name, 'label' => $datafield->name);
33
+ }
34
+
35
+ return $fields;
36
+ }
37
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Displaytype.php RENAMED
File without changes
app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Gridview.php RENAMED
File without changes
app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Lostbasket.php RENAMED
File without changes
app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Orderlimit.php RENAMED
File without changes
app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Orderstatus.php RENAMED
File without changes
app/code/community/Dotdigitalgroup/Email/Model/System/Config/Source/Sendcampaignafter.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Model_System_Config_Source_Sendcampaignafter
4
+ {
5
+
6
+ protected $times = array(1,2,3,4,5,6,12,36,48,60,72,84,96,108,120);
7
+ /**
8
+ * send to campain options hours
9
+ * @return array
10
+ */
11
+ public function toOptionArray()
12
+ {
13
+ $result = $row = array();
14
+ $i = 0;
15
+ foreach($this->times as $one){
16
+
17
+ if($i == 0)
18
+ $row = array(
19
+ 'value' => $one,
20
+ 'label' => Mage::helper('connector')->__($one . ' Hour')
21
+ );
22
+ else
23
+ $row = array(
24
+ 'value' => $one,
25
+ 'label' => Mage::helper('connector')->__($one . ' Hours')
26
+ );
27
+ $result[] = $row;
28
+ }
29
+
30
+ return $result;
31
+ }
32
+ }
app/code/{local → community}/Dotdigitalgroup/Email/Model/System/Config/Source/Timeperiod.php RENAMED
File without changes
app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/ConnectorController.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Adminhtml_ConnectorController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ /**
6
+ * Create and map datafields
7
+ */
8
+ public function setupdatafieldsAction()
9
+ {
10
+ $result = array('errors' => false, 'message' => '');
11
+ $apiModel = Mage::getModel('connector/connector_api_client');
12
+ $redirectUrl = Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit', array('section' => 'connector_data_field_settings'));
13
+
14
+ // get all possible datatifileds
15
+ $datafields = Mage::helper('connector')->getDatafields();
16
+ foreach ($datafields as $key => $datafield){
17
+ $responce = $apiModel->postDataFields($datafield);
18
+
19
+ if(isset($responce->message)){
20
+ $result['errors'] = true;
21
+ $result['message'] .= 'Datafield ' . $datafield['name'] . ' - '. $responce->message . '</br>';
22
+ }else{
23
+ //map the succesful created datafield
24
+ $config = new Mage_Core_Model_Config();
25
+ //@todo check scope
26
+ $config->saveConfig('connector_data_field_settings/customer_data/' . $key, strtoupper($datafield['name']));
27
+
28
+ // clean config cache
29
+ Mage::getConfig()->cleanCache();
30
+
31
+ Mage::helper('connector')->log('successfully connected : ' . $datafield['name']);
32
+ }
33
+ }
34
+ if($result['errors'])
35
+ Mage::getSingleton('adminhtml/session')->addNotice($result['message']);
36
+ else{
37
+ Mage::getSingleton('adminhtml/session')->addSuccess('All Datafields Created And Mapped.');
38
+ }
39
+
40
+ $this->_redirectUrl($redirectUrl);
41
+ }
42
+
43
+ public function connectAction()
44
+ {
45
+ $params = $this->getRequest()->getParams();
46
+ $apiModel = Mage::getModel('connector/api');
47
+ $helper = Mage::helper('connector');
48
+ $testModel = Mage::getModel('connector/connector_test');
49
+
50
+ if(isset($params['store'])){
51
+
52
+ //store level
53
+ $store = $params['store'];
54
+ $apiUsername = $helper->getApiUsername($store);
55
+ $apiPassword = $helper->getApiPassword($store);
56
+ $store = Mage::getModel('core/store')->load($store);
57
+
58
+
59
+ $apiModel->setStoreId($store->getId());
60
+ }elseif(isset($params['website'])){
61
+ //website level
62
+ $website = $params['website'];
63
+ $apiUsername = $helper->getApiUsername($website, 'website');
64
+ $apiPassword = $helper->getApiPassword($website, 'website');
65
+ $website = Mage::getModel('core/website')->load($website);
66
+ $apiModel->setWebsiteId($website->getId());
67
+ $helper->log('connect website account');
68
+ }else{
69
+ //admin level
70
+ $apiUsername = $helper->getApiUsername();
71
+ $apiPassword = $helper->getApiPassword();
72
+ $helper->log('connect default account');
73
+ }
74
+
75
+ $testResult = $testModel->validate($apiUsername, $apiPassword);
76
+ if(isset($testResult->message)){
77
+ $helper->log("VALIDATE " . $testResult->message);
78
+ }else{
79
+
80
+ // save api data
81
+ $apiModel->setApiUsername($apiUsername)
82
+ ->setModifiedAt(Varien_Date::now())
83
+ ->setData('api_password', $apiPassword);
84
+
85
+ $apiModel->save();
86
+ }
87
+
88
+ $this->_redirectReferer();
89
+ }
90
+
91
+
92
+ public function forcecustomersyncAction()
93
+ {
94
+ $website = $this->getRequest()->getParam('website');
95
+ $store = $this->getRequest()->getParam('store');
96
+
97
+ $result = Mage::getModel('connector/customer_customer')->forceSync($store, $website);
98
+
99
+
100
+ Mage::getSingleton('adminhtml/session')->addSuccess('Number of Customers : ' . $result['customers'] . ', Subscribers : ' . $result['subscribers']);
101
+
102
+ $this->_redirectReferer();
103
+ }
104
+
105
+ public function resetordersAction()
106
+ {
107
+ $emailOrders = Mage::getModel('connector/email_order')->getCollection()
108
+ ->addFieldToFilter('email_imported', array('notnull' => true));
109
+
110
+ try{
111
+ foreach ($emailOrders as $order) {
112
+ $order->setEmailImported(null)->save();
113
+ }
114
+
115
+ }catch(Exception $e){
116
+ Mage::helper('connector')->log($e->getMessage());
117
+ }
118
+ Mage::getSingleton('adminhtml/session')->addSuccess('Done.');
119
+
120
+ $this->_redirectReferer();
121
+ }
122
+
123
+ public function suppresscontactsAction()
124
+ {
125
+ Mage::helper('connector')->log('start force suppress');
126
+ //forcesync subscribers
127
+ Mage::getModel('connector/newsletter_subscriber')
128
+ ->unsubscribe(true);
129
+ Mage::helper('connector')->log('end force suppresssed sync.');
130
+ Mage::getSingleton('adminhtml/session')->addSuccess('Done.');
131
+ $this->_redirectReferer();
132
+
133
+ }
134
+
135
+ }
app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/DebugController.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_Adminhtml_DebugController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function deletecontactidsAction()
6
+ {
7
+ $contactCollection = Mage::getModel('connector/email_contact')->getCollection()
8
+ ->addFieldToFilter('contact_id', array('neq' => null))
9
+ ;
10
+ $numUpdated = 0;
11
+
12
+ foreach($contactCollection as $contact){
13
+
14
+ try{
15
+
16
+ $contact->setContactId(Dotdigitalgroup_Email_Model_Email_Contact::EMAIL_CONTACT_NOT_IMPORTED)->save();
17
+ }catch (Exception $e){
18
+ Mage::helper('connector')->log($e->getMessage());
19
+ }
20
+ $numUpdated++;
21
+ }
22
+
23
+ if($numUpdated)
24
+ Mage::getModel('adminhtml/session')->addSuccess('Number Of Contacts Id Removed: '. $numUpdated);
25
+ $this->_redirectReferer();
26
+ }
27
+
28
+ public function countcontactsAction()
29
+ {
30
+ $total = Mage::getModel('customer/customer')->getCollection()->getSize();
31
+
32
+ $contactsSize = Mage::helper('connector')->countCustomersWithContactId();
33
+
34
+ Mage::getModel('adminhtml/session')->addSuccess('Customers Total No: ' . $total . '</br> Customers With Contact Id No: ' . $contactsSize);
35
+ $this->_redirectReferer();
36
+ }
37
+
38
+ public function ajaxvalidationAction()
39
+ {
40
+ $params = $this->getRequest()->getParams();
41
+
42
+ $apiUsername = $params['api_username'];
43
+ $apiPassword = $params['api_password'];
44
+ $message = Mage::getModel('connector/connector_test')->ajaxvalidate($apiUsername, $apiPassword);
45
+
46
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($message));
47
+ }
48
+ }
app/code/community/Dotdigitalgroup/Email/controllers/CustomerController.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_CustomerController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function newAction()
6
+ {
7
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
8
+ $this->loadLayout();
9
+ $this->renderLayout();
10
+ }
11
+ }
app/code/community/Dotdigitalgroup/Email/controllers/EmailController.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
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
+ //file name param
60
+ $file = $this->getRequest()->getParam('file');
61
+ $fileName = $file . '.log';
62
+ $filePath = Mage::getBaseDir('log') . DIRECTORY_SEPARATOR . $fileName;
63
+
64
+ $this->_prepareDownloadResponse($fileName, array(
65
+ 'type' => 'filename',
66
+ 'value' => $filePath
67
+ ));
68
+ exit();
69
+ }
70
+ }
app/code/community/Dotdigitalgroup/Email/controllers/OrderController.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Dotdigitalgroup_Email_OrderController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function newAction()
6
+ {
7
+
8
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
9
+ $this->loadLayout();
10
+ $this->renderLayout();
11
+
12
+ }
13
+
14
+ public function customerRegAction()
15
+ {
16
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
17
+ $this->loadLayout();
18
+ $this->renderLayout();
19
+ }
20
+
21
+ public function registrationAction()
22
+ {
23
+ $this->loadLayout();
24
+ $this->renderLayout();
25
+ }
26
+
27
+ public function creditmemoAction()
28
+ {
29
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
30
+ $orderId = $this->getRequest()->getParam('id');
31
+ $order = Mage::getModel('sales/order')->load($orderId);
32
+
33
+ //look for refund order
34
+ if(! $order->hasCreditmemos())
35
+ exit();
36
+
37
+ Mage::register('current_order', $order);
38
+
39
+ $this->loadLayout();
40
+ $this->renderLayout();
41
+ }
42
+
43
+ public function invoiceAction()
44
+ {
45
+ //Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
46
+ $orderId = $this->getRequest()->getParam('id');
47
+ $orderModel = Mage::getModel('sales/order')->load($orderId);
48
+
49
+ if(! $orderModel->hasInvoices())
50
+ exit();
51
+ Mage::register('current_order', $orderModel);
52
+
53
+ $this->loadLayout();
54
+ $this->renderLayout();
55
+ }
56
+
57
+ public function updateAction()
58
+ {
59
+ Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
60
+ $this->loadLayout();
61
+ $this->renderLayout();
62
+
63
+ }
64
+
65
+ }
app/code/{local → community}/Dotdigitalgroup/Email/etc/adminhtml.xml RENAMED
@@ -7,10 +7,10 @@
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>
@@ -26,13 +26,16 @@
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>
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>
26
  <sms_section translate="title">
27
  <title><![CDATA[SMS Section]]></title>
28
  </sms_section>
29
+ <dynamic_content translate="title">
30
  <title><![CDATA[Dynamic Content]]></title>
31
  </dynamic_content>
32
+ <transactional_emails translate="title">
33
+ <title><![CDATA[Transactional Email]]></title>
34
+ </transactional_emails>
35
  <connector_advanced_settings translate="title">
36
  <title><![CDATA[Advanced Settings]]></title>
37
  </connector_advanced_settings>
38
+ </children>
39
  </config>
40
  </children>
41
  </system>
app/code/community/Dotdigitalgroup/Email/etc/config.xml ADDED
@@ -0,0 +1,464 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Dotdigitalgroup_Email>
5
+ <version>2.0.4</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
+ <models>
28
+ <connector>
29
+ <class>Dotdigitalgroup_Email_Model</class>
30
+ <resourceModel>connector_resource</resourceModel>
31
+ </connector>
32
+ <connector_resource>
33
+ <class>Dotdigitalgroup_Email_Model_Resource</class>
34
+ <entities>
35
+ <email_order>
36
+ <table>email_order</table>
37
+ </email_order>
38
+ <email_contact>
39
+ <table>email_contact</table>
40
+ </email_contact>
41
+ <email_send>
42
+ <table>email_send</table>
43
+ </email_send>
44
+ </entities>
45
+ </connector_resource>
46
+ <resources>
47
+ <connector_setup>
48
+ <setup>
49
+ <module>Dotdigitalgroup_Email</module>
50
+ <class>Dotdigitalgroup_Email_Model_Resource_Setup</class>
51
+ </setup>
52
+ <connection>
53
+ <use>core_setup</use>
54
+ </connection>
55
+ </connector_setup>
56
+ <connector_api_write>
57
+ <connection>
58
+ <use>core_write</use>
59
+ </connection>
60
+ </connector_api_write>
61
+ <connector_api_read>
62
+ <connection>
63
+ <use>core_read</use>
64
+ </connection>
65
+ </connector_api_read>
66
+ </resources>
67
+ <sales>
68
+ <rewrite>
69
+ <order>Dotdigitalgroup_Email_Model_Sales_Order_State</order>
70
+ </rewrite>
71
+ </sales>
72
+ </models>
73
+ <helpers>
74
+ <connector>
75
+ <class>Dotdigitalgroup_Email_Helper</class>
76
+ </connector>
77
+ </helpers>
78
+ <blocks>
79
+ <connector>
80
+ <class>Dotdigitalgroup_Email_Block</class>
81
+ </connector>
82
+ </blocks>
83
+ <resources>
84
+ <connector_setup>
85
+ <setup>
86
+ <module>Dotdigitalgroup_Email</module>
87
+ <class>Mage_Sales_Model_Mysql4_Setup</class>
88
+ </setup>
89
+ <connection>
90
+ <use>core_setup</use>
91
+ </connection>
92
+ </connector_setup>
93
+ <customer_write>
94
+ <connection>
95
+ <use>core_write</use>
96
+ </connection>
97
+ </customer_write>
98
+ <customer_read>
99
+ <connection>
100
+ <use>core_read</use>
101
+ </connection>
102
+ </customer_read>
103
+ </resources>
104
+ <events>
105
+ <admin_system_config_changed_section_connector_api_settings>
106
+ <observers>
107
+ <check_timezone_config>
108
+ <class>Dotdigitalgroup_Email_Model_Observer</class>
109
+ <method>actionConfigSaveAfter</method>
110
+ </check_timezone_config>
111
+ </observers>
112
+ </admin_system_config_changed_section_connector_api_settings>
113
+ <admin_system_config_changed_section_connector_sync_settings>
114
+ <observers>
115
+ <reset_contacts>
116
+ <class>Dotdigitalgroup_Email_Model_Observer</class>
117
+ <method>actionConfigResetContacts</method>
118
+ </reset_contacts>
119
+ </observers>
120
+ </admin_system_config_changed_section_connector_sync_settings>
121
+ <admin_system_config_changed_section_connector_data_field_settings>
122
+ <observers>
123
+ <reset_contacts_on_datamapping>
124
+ <class>Dotdigitalgroup_Email_Model_Observer</class>
125
+ <method>actionConfigResetContacts</method>
126
+ </reset_contacts_on_datamapping>
127
+ </observers>
128
+ </admin_system_config_changed_section_connector_data_field_settings>
129
+ <customer_save_after>
130
+ <observers>
131
+ <contactid>
132
+ <class>Dotdigitalgroup_Email_Model_Observer</class>
133
+ <method>handleCustomerSaveBefore</method>
134
+ </contactid>
135
+ </observers>
136
+ </customer_save_after>
137
+ <newsletter_subscriber_save_before>
138
+ <observers>
139
+ <connector_newsletter_subscriber_save_after>
140
+ <class>Dotdigitalgroup_Email_Model_Observer</class>
141
+ <method>newsletterSubscriberSave</method>
142
+ </connector_newsletter_subscriber_save_after>
143
+ </observers>
144
+ </newsletter_subscriber_save_before>
145
+ <sales_order_save_after>
146
+ <observers>
147
+ <connector_checkout_type_onepage_save_order_after>
148
+ <class>Dotdigitalgroup_Email_Model_Observer</class>
149
+ <method>handleSalesOrderSaveAfter</method>
150
+ </connector_checkout_type_onepage_save_order_after>
151
+ </observers>
152
+ </sales_order_save_after>
153
+ <!--<sales_quote_save_after>-->
154
+ <!--<observers>-->
155
+ <!--<connector_sales_quote_save_after>-->
156
+ <!--<class>Dotdigitalgroup_Email_Model_Observer</class>-->
157
+ <!--<method>handleSalesQuoteSaveAfter</method>-->
158
+ <!--</connector_sales_quote_save_after>-->
159
+ <!--</observers>-->
160
+ <!--</sales_quote_save_after>-->
161
+ <sales_order_creditmemo_save_after>
162
+ <observers>
163
+ <connector_sales_order_payment_refund>
164
+ <class>Dotdigitalgroup_Email_Model_Observer</class>
165
+ <method>handleSalesOrderRefund</method>
166
+ </connector_sales_order_payment_refund>
167
+ </observers>
168
+ </sales_order_creditmemo_save_after>
169
+ <order_cancel_after>
170
+ <observers>
171
+ <connector_sales_order_cancel>
172
+ <class>Dotdigitalgroup_Email_Model_Observer</class>
173
+ <method>hangleSalesOrderCancel</method>
174
+ </connector_sales_order_cancel>
175
+ </observers>
176
+ </order_cancel_after>
177
+ <sales_order_status_after>
178
+ <observers>
179
+ <connector_sales_order_status_change>
180
+ <class>Dotdigitalgroup_Email_Model_Observer</class>
181
+ <method>handleSalesOrderStatusChange</method>
182
+ </connector_sales_order_status_change>
183
+ </observers>
184
+ </sales_order_status_after>
185
+ </events>
186
+ </global>
187
+ <adminhtml>
188
+ <translate>
189
+ <modules>
190
+ <Dotdigitalgroup_Email>
191
+ <files>
192
+ <default>Dotdigitalgroup_Email.csv</default>
193
+ </files>
194
+ </Dotdigitalgroup_Email>
195
+ </modules>
196
+ </translate>
197
+ </adminhtml>
198
+ <admin>
199
+ <routers>
200
+ <adminhtml>
201
+ <args>
202
+ <modules>
203
+ <Dotdigitalgroup_Email before="Mage_Adminhtml">Dotdigitalgroup_Email_Adminhtml</Dotdigitalgroup_Email>
204
+ </modules>
205
+ </args>
206
+ </adminhtml>
207
+ </routers>
208
+ </admin>
209
+ <crontab>
210
+ <jobs>
211
+ <connector_email_customer_sync>
212
+ <run><model>connector/cron::contactSync</model></run>
213
+ <schedule>
214
+ <cron_expr>*/15 * * * *</cron_expr>
215
+ </schedule>
216
+ </connector_email_customer_sync>
217
+ <connector_email_subscriber_and_suppressed_sync>
218
+ <run><model>connector/cron::subscribersAndSuppressedSync</model></run>
219
+ <schedule>
220
+ <cron_expr>*/15 * * * *</cron_expr>
221
+ </schedule>
222
+ </connector_email_subscriber_and_suppressed_sync>
223
+ <connector_email_lostbaskets>
224
+ <run><model>connector/cron::lostBaskets</model></run>
225
+ <schedule>
226
+ <cron_expr>*/5 * * * *</cron_expr>
227
+ </schedule>
228
+ </connector_email_lostbaskets>
229
+ <!--<connector_email_sender>-->
230
+ <!--<run>-->
231
+ <!--<model>connector/cron::sendMail</model>-->
232
+ <!--</run>-->
233
+ <!--<schedule>-->
234
+ <!--<cron_expr>02,07,12,17,22,27,32,37,42,47,52,57 * * * *</cron_expr>-->
235
+ <!--</schedule>-->
236
+ <!--</connector_email_sender>-->
237
+ <connector_email_order_sync>
238
+ <run><model>connector/cron::orderSync</model></run>
239
+ <schedule>
240
+ <cron_expr>*/15 * * * *</cron_expr>
241
+ </schedule>
242
+ </connector_email_order_sync>
243
+ <connector_email_cleaner>
244
+ <run><model>connector/cron::cleaning</model></run>
245
+ <schedule>
246
+ <cron_expr>* * 1 * * </cron_expr>
247
+ </schedule>
248
+ </connector_email_cleaner>
249
+ </jobs>
250
+ </crontab>
251
+ <default>
252
+ <connector_api_settings>
253
+ <api_credentials>
254
+ <username></username>
255
+ <password></password>
256
+ </api_credentials>
257
+ </connector_api_settings>
258
+ <connector_sync_settings>
259
+ <sync_customer_schedule>
260
+ <enabled>0</enabled>
261
+ <time></time>
262
+ <frequency></frequency>
263
+ <cronschedule></cronschedule>
264
+ </sync_customer_schedule>
265
+ <sync_suppressed_schedule>
266
+ <enabled>0</enabled>
267
+ <time></time>
268
+ <frequency></frequency>
269
+ <cronschedulesupp></cronschedulesupp>
270
+ </sync_suppressed_schedule>
271
+ <transactional_data>
272
+ <order_enabled>0</order_enabled>
273
+ <wishlist_enabled>0</wishlist_enabled>
274
+ </transactional_data>
275
+ </connector_sync_settings>
276
+ <connector_data_field_settings>
277
+ <customer_data>
278
+ <customer_id></customer_id>
279
+ <title></title>
280
+ <firstname></firstname>
281
+ <lastname></lastname>
282
+ <dob></dob>
283
+ <gender></gender>
284
+ <website_name></website_name>
285
+ <store_name></store_name>
286
+ <customer_created_date></customer_created_date>
287
+ <last_logged_in></last_logged_in>
288
+ <customer_group></customer_group>
289
+ <address_title></address_title>
290
+ <billing_address_1></billing_address_1>
291
+ <billing_address_2></billing_address_2>
292
+ <billing_city></billing_city>
293
+ <billing_state></billing_state>
294
+ <billing_country></billing_country>
295
+ <billing_postcode></billing_postcode>
296
+ <billing_telephone></billing_telephone>
297
+ <delivery_address_1></delivery_address_1>
298
+ <delivery_address_2></delivery_address_2>
299
+ <delivery_city></delivery_city>
300
+ <delivery_state></delivery_state>
301
+ <delivery_country></delivery_country>
302
+ <delivery_postcode></delivery_postcode>
303
+ <delivery_telephone></delivery_telephone>
304
+ <total_orders></total_orders>
305
+ <average_order_value></average_order_value>
306
+ <total_spend></total_spend>
307
+ <last_order></last_order>
308
+ <last_order_no></last_order_no>
309
+ </customer_data>
310
+ <address_book>
311
+ <customers></customers>
312
+ <subscribers></subscribers>
313
+ <guest></guest>
314
+ </address_book>
315
+ </connector_data_field_settings>
316
+ <connector_roi_page_tracking_settings>
317
+ <page_tracking>
318
+ <enabled>0</enabled>
319
+ </page_tracking>
320
+ <roi_tracking>
321
+ <enabled>0</enabled>
322
+ </roi_tracking>
323
+ </connector_roi_page_tracking_settings>
324
+ <connector_newsletter_subscription_settings>
325
+ <customers_subscription_management>
326
+ <default></default>
327
+ </customers_subscription_management>
328
+ <subscribers_subscription_management>
329
+ <default></default>
330
+ </subscribers_subscription_management>
331
+ </connector_newsletter_subscription_settings>
332
+ <lost_basket_settings>
333
+ <active><active></active></active>
334
+ <customers>
335
+ <enabled_1>0</enabled_1>
336
+ <send_after_1></send_after_1>
337
+ <campaign_1></campaign_1>
338
+ <enabled_2>0</enabled_2>
339
+ <send_after_2></send_after_2>
340
+ <campaign_2></campaign_2>
341
+ <enabled_3>0</enabled_3>
342
+ <send_after_3></send_after_3>
343
+ <campaign_3></campaign_3>
344
+ </customers>
345
+ <guests>
346
+ <enabled_1>0</enabled_1>
347
+ <send_after_1></send_after_1>
348
+ <campaign_1></campaign_1>
349
+ <enabled_2>0</enabled_2>
350
+ <send_after_2></send_after_2>
351
+ <campaign_2></campaign_2>
352
+ <enabled_3>0</enabled_3>
353
+ <send_after_3></send_after_3>
354
+ <campaign_3></campaign_3>
355
+ </guests>
356
+ <test>
357
+ <email></email>
358
+ </test>
359
+ </lost_basket_settings>
360
+ <sms_section>
361
+ <sms_message_one>
362
+ <enabled>0</enabled>
363
+ <order_status></order_status>
364
+ <message></message>
365
+ </sms_message_one>
366
+ <sms_message_two>
367
+ <enabled>0</enabled>
368
+ <order_status></order_status>
369
+ <message></message>
370
+ </sms_message_two>
371
+ <sms_message_three>
372
+ <enabled>0</enabled>
373
+ <order_status></order_status>
374
+ <message></message>
375
+ </sms_message_three>
376
+ <sms_message_four>
377
+ <enabled>0</enabled>
378
+ <order_status></order_status>
379
+ <message></message>
380
+ </sms_message_four>
381
+ </sms_section>
382
+ <dynamic_content>
383
+ <products>
384
+ <related_display_type>list</related_display_type>
385
+ <related_items_to_display>2</related_items_to_display>
386
+ <upsell_display_type>list</upsell_display_type>
387
+ <upsell_items_to_display>2</upsell_items_to_display>
388
+ <crosssell_display_type>list</crosssell_display_type>
389
+ <crosssell_items_to_display>2</crosssell_items_to_display>
390
+ <best_display_type>list</best_display_type>
391
+ <best_items_to_display>2</best_items_to_display>
392
+ <most_viewed_display_type>list</most_viewed_display_type>
393
+ <most_viewed_items_to_display>2</most_viewed_items_to_display>
394
+ <recently_viewed_display_type>list</recently_viewed_display_type>
395
+ <recently_viewed_items_to_display>2</recently_viewed_items_to_display>
396
+ </products>
397
+ <manual_product_search>
398
+ <display_type>list</display_type>
399
+ <items_to_display>2</items_to_display>
400
+ <products_push_items></products_push_items>
401
+ </manual_product_search>
402
+ <fallback_products>
403
+ <product_list></product_list>
404
+ </fallback_products>
405
+ </dynamic_content>
406
+ <transactional_emails>
407
+ <transactional_email>
408
+ <api_username></api_username>
409
+ <api_password></api_password>
410
+ </transactional_email>
411
+ <email_mapping>
412
+ <new_creditmemo></new_creditmemo>
413
+ <new_creditmemo_guest></new_creditmemo_guest>
414
+ <creditmemo></creditmemo>
415
+ <new_invoice></new_invoice>
416
+ <invoice_update></invoice_update>
417
+ <new_order></new_order>
418
+ <order_update></order_update>
419
+ <new_shipment></new_shipment>
420
+ <shipment_update></shipment_update>
421
+ <customer_emails_heading></customer_emails_heading>
422
+ <password_remind></password_remind>
423
+ <forgot_password></forgot_password>
424
+ <new_account></new_account>
425
+ </email_mapping>
426
+ </transactional_emails>
427
+ <connector_advanced_settings>
428
+ <sync_limits>
429
+ <orders>500</orders>
430
+ </sync_limits>
431
+ <external>
432
+ <passcode>secret</passcode>
433
+ <lost_basket_url></lost_basket_url>
434
+ <coupon_code_title></coupon_code_title>
435
+ <coupon_code_url></coupon_code_url>
436
+ <dynamic_content_url></dynamic_content_url>
437
+ <related_products_url></related_products_url>
438
+ <upsell_products_url></upsell_products_url>
439
+ <crosssell_products_url></crosssell_products_url>
440
+ <best_sellers_url></best_sellers_url>
441
+ <most_viewed_url></most_viewed_url>
442
+ <product_push_url></product_push_url>
443
+ <recently_viewed_url></recently_viewed_url>
444
+ <transactional_customer_new></transactional_customer_new>
445
+ <transactional_order_new></transactional_order_new>
446
+ <transactional_order_creditmemo_new></transactional_order_creditmemo_new>
447
+ <transactional_order_update></transactional_order_update>
448
+ <transactional_invoice_new></transactional_invoice_new>
449
+ </external>
450
+ <admin>
451
+ <memory_limit>0</memory_limit>
452
+ <batch_size>10000</batch_size>
453
+ <debug>0</debug>
454
+ </admin>
455
+ </connector_advanced_settings>
456
+ </default>
457
+ <phpunit>
458
+ <suite>
459
+ <modules>
460
+ <Dotdigitalgroup_Email />
461
+ </modules>
462
+ </suite>
463
+ </phpunit>
464
+ </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,7 +16,7 @@
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>
@@ -25,36 +25,37 @@
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>
@@ -67,10 +68,8 @@
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 +77,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 +123,88 @@
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,8 +213,8 @@
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>
@@ -254,7 +222,7 @@
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,28 +230,25 @@
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>
@@ -292,7 +257,7 @@
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>
@@ -301,7 +266,7 @@
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>
@@ -310,7 +275,7 @@
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>
@@ -319,7 +284,7 @@
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>
@@ -327,8 +292,8 @@
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>
@@ -336,8 +301,8 @@
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>
@@ -345,8 +310,8 @@
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>
@@ -354,8 +319,8 @@
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>
@@ -364,7 +329,7 @@
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>
@@ -372,7 +337,7 @@
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>
@@ -381,7 +346,7 @@
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>
@@ -390,7 +355,7 @@
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>
@@ -399,7 +364,16 @@
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>
@@ -408,7 +382,7 @@
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>
@@ -417,7 +391,7 @@
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>
@@ -426,7 +400,7 @@
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>
@@ -435,7 +409,7 @@
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>
@@ -444,7 +418,7 @@
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>
@@ -453,7 +427,16 @@
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>
@@ -462,7 +445,7 @@
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>
@@ -471,7 +454,7 @@
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>
@@ -480,7 +463,7 @@
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>
@@ -488,7 +471,7 @@
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>
@@ -496,8 +479,8 @@
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>
@@ -506,7 +489,7 @@
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>
@@ -515,7 +498,7 @@
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>
@@ -523,17 +506,17 @@
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>
@@ -547,46 +530,9 @@
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 +541,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 +550,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 +561,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 +570,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>
@@ -637,16 +583,16 @@
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>
@@ -654,8 +600,8 @@
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>
@@ -665,7 +611,7 @@
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,15 +620,15 @@
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>
@@ -692,8 +638,8 @@
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>
@@ -701,7 +647,7 @@
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>
@@ -710,15 +656,15 @@
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>
@@ -728,17 +674,17 @@
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>
@@ -746,15 +692,15 @@
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>
@@ -764,17 +710,17 @@
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>
@@ -784,23 +730,23 @@
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>
@@ -808,36 +754,35 @@
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>
@@ -845,36 +790,35 @@
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>
@@ -882,225 +826,194 @@
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>
941
  <sort_order>7000</sort_order>
942
  <show_in_default>1</show_in_default>
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>
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
  <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>
958
  <sort_order>10</sort_order>
959
  <show_in_default>1</show_in_default>
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>
989
  <show_in_default>1</show_in_default>
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>
997
  <sort_order>10</sort_order>
998
  <show_in_default>1</show_in_default>
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>
1028
  <show_in_default>1</show_in_default>
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>
1036
  <sort_order>10</sort_order>
1037
  <show_in_default>1</show_in_default>
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>
1066
  <show_in_default>1</show_in_default>
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>
1074
  <sort_order>10</sort_order>
1075
  <show_in_default>1</show_in_default>
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,7 +1022,7 @@
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>
@@ -1118,7 +1031,7 @@
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,7 +1039,7 @@
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>
@@ -1135,7 +1048,7 @@
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>
@@ -1144,8 +1057,7 @@
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,7 +1065,7 @@
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>
@@ -1162,7 +1074,7 @@
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>
@@ -1171,8 +1083,7 @@
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,7 +1091,7 @@
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>
@@ -1189,7 +1100,7 @@
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>
@@ -1198,16 +1109,15 @@
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>
@@ -1215,8 +1125,8 @@
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>
@@ -1224,8 +1134,8 @@
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>
@@ -1233,9 +1143,8 @@
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,7 +1152,7 @@
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>
@@ -1252,7 +1161,7 @@
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>
@@ -1261,7 +1170,7 @@
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>
@@ -1270,8 +1179,7 @@
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,7 +1187,7 @@
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>
@@ -1288,7 +1196,7 @@
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>
@@ -1297,9 +1205,7 @@
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>
@@ -1309,9 +1215,8 @@
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>
@@ -1320,7 +1225,7 @@
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>
@@ -1328,7 +1233,7 @@
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>
@@ -1337,7 +1242,7 @@
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>
@@ -1346,7 +1251,7 @@
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>
@@ -1354,7 +1259,7 @@
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>
@@ -1365,7 +1270,7 @@
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>
@@ -1373,7 +1278,7 @@
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>
@@ -1386,16 +1291,280 @@
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>
@@ -1403,8 +1572,8 @@
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>
@@ -1414,7 +1583,7 @@
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>
@@ -1422,7 +1591,7 @@
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>
@@ -1431,7 +1600,7 @@
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>
@@ -1439,17 +1608,16 @@
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>
@@ -1457,17 +1625,16 @@
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>
@@ -1475,62 +1642,61 @@
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>
@@ -1539,9 +1705,62 @@
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>
@@ -1549,59 +1768,94 @@
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_settings 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_credentials translate="label" module="connector">
20
  <label>API Settings</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>10</sort_order>
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>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
  <validate>validate-length minimum-length-36</validate>
47
  </username>
48
+ <password translate="label" module="connector">
49
  <label>API Password</label>
50
  <frontend_type>password</frontend_type>
51
+ <frontend_model>connector/adminhtml_system_config_form_ajaxvalidate</frontend_model>
 
 
 
 
 
 
 
 
52
  <sort_order>30</sort_order>
53
  <show_in_default>1</show_in_default>
54
  <show_in_website>1</show_in_website>
55
  <show_in_store>0</show_in_store>
56
+ <depends><enabled>1</enabled></depends>
57
+ </password>
58
  <validator>
 
59
  <frontend_type>hidden</frontend_type>
60
  <frontend_model>connector/adminhtml_system_config_waitingfield</frontend_model>
61
  <sort_order>50</sort_order>
68
  </api_credentials>
69
  </groups>
70
  </connector_api_settings>
71
+ <connector_sync_settings translate="label" module="connector">
 
72
  <label><![CDATA[Sync Settings]]></label>
 
73
  <tab>connector</tab>
74
  <frontend_type>text</frontend_type>
75
  <sort_order>3000</sort_order>
77
  <show_in_website>1</show_in_website>
78
  <show_in_store>0</show_in_store>
79
  <groups>
80
+ <address_book translate="label" module="connector">
81
+ <label>Address Book Mapping</label>
 
82
  <sort_order>10</sort_order>
83
  <show_in_default>1</show_in_default>
84
  <show_in_website>1</show_in_website>
85
  <show_in_store>0</show_in_store>
86
  <expanded>1</expanded>
87
  <fields>
88
+ <customers translate="label" module="connector">
89
+ <label>Add Customers To</label>
90
  <frontend_type>select</frontend_type>
91
+ <source_model>connector/system_config_source_addressbooks</source_model>
92
  <sort_order>10</sort_order>
93
  <show_in_default>1</show_in_default>
94
  <show_in_website>1</show_in_website>
95
  <show_in_store>0</show_in_store>
96
+ </customers>
97
+ <subscribers translate="label" module="connector">
98
+ <label>Add Subscribers To</label>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>connector/system_config_source_addressbooks</source_model>
101
  <sort_order>20</sort_order>
102
  <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
  <show_in_store>0</show_in_store>
105
+ </subscribers>
106
+ <guests translate="label" module="connector">
107
+ <label>Add Guests To</label>
 
108
  <frontend_type>select</frontend_type>
109
+ <source_model>connector/system_config_source_addressbooks</source_model>
 
110
  <sort_order>30</sort_order>
111
  <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  <show_in_store>0</show_in_store>
114
+ </guests>
 
115
  </fields>
116
+ </address_book>
117
+ <sync translate="label" module="connector">
118
+ <label>Sync</label>
119
  <frontend_type>text</frontend_type>
120
  <sort_order>20</sort_order>
121
  <show_in_default>1</show_in_default>
123
  <show_in_store>0</show_in_store>
124
  <expanded>1</expanded>
125
  <fields>
126
+ <contact_title translate="label" module="connector">
127
+ <label>Contact Sync</label>
128
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
129
+ <sort_order>10</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>0</show_in_store>
133
+ </contact_title>
134
+ <contact_enabled translate="label" module="connector">
135
  <label>Enabled</label>
136
  <frontend_type>select</frontend_type>
137
  <source_model>adminhtml/system_config_source_yesno</source_model>
138
+ <sort_order>20</sort_order>
139
  <show_in_default>1</show_in_default>
140
  <show_in_website>1</show_in_website>
141
  <show_in_store>0</show_in_store>
142
+ </contact_enabled>
143
+ <subscriber_title translate="label" module="connector">
144
+ <label>Subscriber Sync</label>
145
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
146
+ <sort_order>50</sort_order>
 
147
  <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
  <show_in_store>0</show_in_store>
150
+ </subscriber_title>
151
+ <subscriber_enabled translate="label" module="connector">
152
+ <label>Enabled</label>
 
153
  <frontend_type>select</frontend_type>
154
+ <source_model>adminhtml/system_config_source_yesno</source_model>
155
+ <sort_order>60</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
+ </subscriber_enabled>
160
+ <order_title translate="label" module="connector">
161
+ <label>Order Sync</label>
 
 
 
 
 
 
 
 
 
 
 
162
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
163
+ <sort_order>70</sort_order>
164
  <show_in_default>1</show_in_default>
165
  <show_in_website>1</show_in_website>
166
  <show_in_store>0</show_in_store>
167
+ </order_title>
168
+ <order_enabled translate="label" module="connector">
169
  <label>Enabled</label>
170
  <frontend_type>select</frontend_type>
171
  <source_model>adminhtml/system_config_source_yesno</source_model>
172
+ <sort_order>80</sort_order>
173
  <show_in_default>1</show_in_default>
174
  <show_in_website>1</show_in_website>
175
  <show_in_store>0</show_in_store>
176
  </order_enabled>
177
+ <wishlist_title translate="label" module="connector">
178
+ <label>Wishlist Sync</label>
179
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
180
+ <sort_order>90</sort_order>
181
  <show_in_default>1</show_in_default>
182
  <show_in_website>1</show_in_website>
183
  <show_in_store>0</show_in_store>
184
+ </wishlist_title>
185
+ <wishlist_enabled translate="label" module="connector">
186
  <label>Enabled</label>
187
  <frontend_type>select</frontend_type>
188
  <source_model>adminhtml/system_config_source_yesno</source_model>
189
+ <sort_order>100</sort_order>
190
  <show_in_default>1</show_in_default>
191
  <show_in_website>1</show_in_website>
192
  <show_in_store>0</show_in_store>
193
  </wishlist_enabled>
194
+ <validator>
195
+ <frontend_type>hidden</frontend_type>
196
+ <frontend_model>connector/adminhtml_system_config_waitingfield</frontend_model>
197
+ <sort_order>110</sort_order>
198
+ <show_in_default>1</show_in_default>
199
+ <show_in_website>1</show_in_website>
200
+ <show_in_store>0</show_in_store>
201
+ <can_be_empty>1</can_be_empty>
202
+ </validator>
203
  </fields>
204
+ </sync>
205
  </groups>
206
  </connector_sync_settings>
207
+ <connector_data_field_settings translate="label" module="connector">
208
  <label><![CDATA[Data Mapping]]></label>
209
  <tab>connector</tab>
210
  <frontend_type>text</frontend_type>
213
  <show_in_website>1</show_in_website>
214
  <show_in_store>0</show_in_store>
215
  <groups>
216
+ <customer_data translate="label" module="connector">
217
+ <label>Data Fields Mapping</label>
218
  <frontend_type>text</frontend_type>
219
  <sort_order>20</sort_order>
220
  <show_in_default>1</show_in_default>
222
  <show_in_store>0</show_in_store>
223
  <expanded>1</expanded>
224
  <fields>
225
+ <customer_title translate="label" module="connector">
226
  <label>Customer Information</label>
227
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
228
  <sort_order>10</sort_order>
230
  <show_in_website>1</show_in_website>
231
  <show_in_store>0</show_in_store>
232
  </customer_title>
233
+ <title translate="label" module="connector">
234
+ <label>Title</label>
 
235
  <frontend_type>select</frontend_type>
236
  <source_model>connector/system_config_source_datafields</source_model>
237
  <sort_order>20</sort_order>
238
  <show_in_default>1</show_in_default>
239
  <show_in_website>1</show_in_website>
240
  <show_in_store>0</show_in_store>
241
+ </title>
242
+ <customer_id translate="label" module="connector">
243
+ <label>Customer ID</label>
 
244
  <frontend_type>select</frontend_type>
245
  <source_model>connector/system_config_source_datafields</source_model>
246
  <sort_order>30</sort_order>
247
+ <show_in_default>0</show_in_default>
248
+ <show_in_website>0</show_in_website>
249
  <show_in_store>0</show_in_store>
250
+ </customer_id>
251
+ <firstname translate="label" module="connector">
 
252
  <label>First Name</label>
253
  <frontend_type>select</frontend_type>
254
  <source_model>connector/system_config_source_datafields</source_model>
257
  <show_in_website>1</show_in_website>
258
  <show_in_store>0</show_in_store>
259
  </firstname>
260
+ <lastname translate="label" module="connector">
261
  <label>Last Name</label>
262
  <frontend_type>select</frontend_type>
263
  <source_model>connector/system_config_source_datafields</source_model>
266
  <show_in_website>1</show_in_website>
267
  <show_in_store>0</show_in_store>
268
  </lastname>
269
+ <dob translate="label" module="connector">
270
  <label>D.O.B.</label>
271
  <frontend_type>select</frontend_type>
272
  <source_model>connector/system_config_source_datafields</source_model>
275
  <show_in_website>1</show_in_website>
276
  <show_in_store>0</show_in_store>
277
  </dob>
278
+ <gender translate="label" module="connector">
279
  <label>Gender</label>
280
  <frontend_type>select</frontend_type>
281
  <source_model>connector/system_config_source_datafields</source_model>
284
  <show_in_website>1</show_in_website>
285
  <show_in_store>0</show_in_store>
286
  </gender>
287
+ <website_name translate="label" module="connector">
288
  <label>Website Created On</label>
289
  <frontend_type>select</frontend_type>
290
  <source_model>connector/system_config_source_datafields</source_model>
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
+ </website_name>
296
+ <store_name translate="label" module="connector">
297
  <label>Store Created On</label>
298
  <frontend_type>select</frontend_type>
299
  <source_model>connector/system_config_source_datafields</source_model>
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
+ </store_name>
305
+ <created_at translate="label" module="connector">
306
  <label>Account Created Date</label>
307
  <frontend_type>select</frontend_type>
308
  <source_model>connector/system_config_source_datafields</source_model>
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
+ </created_at>
314
+ <last_logged_date translate="label" module="connector">
315
  <label>Last Logged In Date</label>
316
  <frontend_type>select</frontend_type>
317
  <source_model>connector/system_config_source_datafields</source_model>
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
+ </last_logged_date>
323
+ <customer_group translate="label" module="connector">
324
  <label>Customer Group</label>
325
  <frontend_type>select</frontend_type>
326
  <source_model>connector/system_config_source_datafields</source_model>
329
  <show_in_website>1</show_in_website>
330
  <show_in_store>0</show_in_store>
331
  </customer_group>
332
+ <address_title translate="label" module="connector">
333
  <label>Address Information</label>
334
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
335
  <sort_order>130</sort_order>
337
  <show_in_website>1</show_in_website>
338
  <show_in_store>0</show_in_store>
339
  </address_title>
340
+ <billing_address_1 translate="label" module="connector">
341
  <label>Billing Address Line 1</label>
342
  <frontend_type>select</frontend_type>
343
  <source_model>connector/system_config_source_datafields</source_model>
346
  <show_in_website>1</show_in_website>
347
  <show_in_store>0</show_in_store>
348
  </billing_address_1>
349
+ <billing_address_2 translate="label" module="connector">
350
  <label>Billing Address Line 2</label>
351
  <frontend_type>select</frontend_type>
352
  <source_model>connector/system_config_source_datafields</source_model>
355
  <show_in_website>1</show_in_website>
356
  <show_in_store>0</show_in_store>
357
  </billing_address_2>
358
+ <billing_city translate="label" module="connector">
359
  <label>Billing City</label>
360
  <frontend_type>select</frontend_type>
361
  <source_model>connector/system_config_source_datafields</source_model>
364
  <show_in_website>1</show_in_website>
365
  <show_in_store>0</show_in_store>
366
  </billing_city>
367
+ <billing_state translate="label" module="connector">
368
+ <label>Billing State/Region</label>
369
+ <frontend_type>select</frontend_type>
370
+ <source_model>connector/system_config_source_datafields</source_model>
371
+ <sort_order>155</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_state>
376
+ <billing_country translate="label" module="connector">
377
  <label>Billing Country</label>
378
  <frontend_type>select</frontend_type>
379
  <source_model>connector/system_config_source_datafields</source_model>
382
  <show_in_website>1</show_in_website>
383
  <show_in_store>0</show_in_store>
384
  </billing_country>
385
+ <billing_postcode translate="label" module="connector">
386
  <label>Billing Zip/Postcode</label>
387
  <frontend_type>select</frontend_type>
388
  <source_model>connector/system_config_source_datafields</source_model>
391
  <show_in_website>1</show_in_website>
392
  <show_in_store>0</show_in_store>
393
  </billing_postcode>
394
+ <billing_telephone translate="label" module="connector">
395
  <label>Billing Telephone</label>
396
  <frontend_type>select</frontend_type>
397
  <source_model>connector/system_config_source_datafields</source_model>
400
  <show_in_website>1</show_in_website>
401
  <show_in_store>0</show_in_store>
402
  </billing_telephone>
403
+ <delivery_address_1 translate="label" module="connector">
404
  <label>Delivery Address Line 1</label>
405
  <frontend_type>select</frontend_type>
406
  <source_model>connector/system_config_source_datafields</source_model>
409
  <show_in_website>1</show_in_website>
410
  <show_in_store>0</show_in_store>
411
  </delivery_address_1>
412
+ <delivery_address_2 translate="label" module="connector">
413
  <label>Delivery Address Line 2</label>
414
  <frontend_type>select</frontend_type>
415
  <source_model>connector/system_config_source_datafields</source_model>
418
  <show_in_website>1</show_in_website>
419
  <show_in_store>0</show_in_store>
420
  </delivery_address_2>
421
+ <delivery_city translate="label" module="connector">
422
  <label>Delivery City</label>
423
  <frontend_type>select</frontend_type>
424
  <source_model>connector/system_config_source_datafields</source_model>
427
  <show_in_website>1</show_in_website>
428
  <show_in_store>0</show_in_store>
429
  </delivery_city>
430
+ <delivery_state translate="label" module="connector">
431
+ <label>Delivery State/Region</label>
432
+ <frontend_type>select</frontend_type>
433
+ <source_model>connector/system_config_source_datafields</source_model>
434
+ <sort_order>215</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_state>
439
+ <delivery_country translate="label" module="connector">
440
  <label>Delivery Country</label>
441
  <frontend_type>select</frontend_type>
442
  <source_model>connector/system_config_source_datafields</source_model>
445
  <show_in_website>1</show_in_website>
446
  <show_in_store>0</show_in_store>
447
  </delivery_country>
448
+ <delivery_postcode translate="label" module="connector">
449
  <label>Delivery Zip/Postcode</label>
450
  <frontend_type>select</frontend_type>
451
  <source_model>connector/system_config_source_datafields</source_model>
454
  <show_in_website>1</show_in_website>
455
  <show_in_store>0</show_in_store>
456
  </delivery_postcode>
457
+ <delivery_telephone translate="label" module="connector">
458
  <label>Delivery Telephone</label>
459
  <frontend_type>select</frontend_type>
460
  <source_model>connector/system_config_source_datafields</source_model>
463
  <show_in_website>1</show_in_website>
464
  <show_in_store>0</show_in_store>
465
  </delivery_telephone>
466
+ <sales_title translate="label" module="connector">
467
  <label>Sales Information</label>
468
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
469
  <sort_order>260</sort_order>
471
  <show_in_website>1</show_in_website>
472
  <show_in_store>0</show_in_store>
473
  </sales_title>
474
+ <number_of_orders translate="label" module="connector">
475
  <label>Total Number of Orders</label>
476
  <frontend_type>select</frontend_type>
477
  <source_model>connector/system_config_source_datafields</source_model>
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
+ </number_of_orders>
483
+ <average_order_value translate="label" module="connector">
484
  <label>Average Order Value</label>
485
  <frontend_type>select</frontend_type>
486
  <source_model>connector/system_config_source_datafields</source_model>
489
  <show_in_website>1</show_in_website>
490
  <show_in_store>0</show_in_store>
491
  </average_order_value>
492
+ <total_spend translate="label" module="connector">
493
  <label>Total Spend</label>
494
  <frontend_type>select</frontend_type>
495
  <source_model>connector/system_config_source_datafields</source_model>
498
  <show_in_website>1</show_in_website>
499
  <show_in_store>0</show_in_store>
500
  </total_spend>
501
+ <last_order_date translate="label" module="connector">
502
  <label>Last Purchase Date</label>
503
  <frontend_type>select</frontend_type>
504
  <source_model>connector/system_config_source_datafields</source_model>
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
+ </last_order_date>
510
+ <last_order_id translate="label" module="connector">
511
+ <label>Last Order ID</label>
512
  <frontend_type>select</frontend_type>
513
  <source_model>connector/system_config_source_datafields</source_model>
514
  <sort_order>310</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
+ </last_order_id>
519
+ <validator translate="label" module="connector">
520
  <label>Validation Block</label>
521
  <frontend_type>select</frontend_type>
522
  <source_model>connector/system_config_source_datafields</source_model>
530
  </validator>
531
  </fields>
532
  </customer_data>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  </groups>
534
  </connector_data_field_settings>
535
+ <connector_roi_page_tracking_settings translate="label" module="connector">
536
  <label><![CDATA[ROI & Tracking]]></label>
537
  <tab>connector</tab>
538
  <frontend_type>text</frontend_type>
541
  <show_in_website>1</show_in_website>
542
  <show_in_store>0</show_in_store>
543
  <groups>
544
+ <page_tracking translate="label" module="connector">
545
  <label>Page Tracking</label>
546
  <frontend_type>text</frontend_type>
547
  <sort_order>10</sort_order>
550
  <show_in_store>0</show_in_store>
551
  <expanded>1</expanded>
552
  <fields>
553
+ <enabled translate="label" module="connector">
554
  <label>Enabled</label>
555
  <frontend_type>select</frontend_type>
556
  <source_model>adminhtml/system_config_source_yesno</source_model>
561
  </enabled>
562
  </fields>
563
  </page_tracking>
564
+ <roi_tracking translate="label" module="connector">
565
  <label>ROI Tracking</label>
566
  <frontend_type>text</frontend_type>
567
  <sort_order>20</sort_order>
570
  <show_in_store>0</show_in_store>
571
  <expanded>1</expanded>
572
  <fields>
573
+ <enabled translate="label" module="connector">
574
  <label>Enabled</label>
575
  <frontend_type>select</frontend_type>
576
  <source_model>adminhtml/system_config_source_yesno</source_model>
583
  </roi_tracking>
584
  </groups>
585
  </connector_roi_page_tracking_settings>
586
+ <lost_basket_settings translate="label" module="connector">
587
  <label><![CDATA[Lost Baskets]]></label>
588
  <tab>connector</tab>
589
  <frontend_type>text</frontend_type>
590
  <sort_order>6000</sort_order>
591
  <show_in_default>1</show_in_default>
592
  <show_in_website>1</show_in_website>
593
+ <show_in_store>0</show_in_store>
594
  <groups>
595
+ <active translate="label" module="connector">
596
  <label>Lost Baskets Settings</label>
597
  <frontend_type>text</frontend_type>
598
  <sort_order>100</sort_order>
600
  <show_in_website>0</show_in_website>
601
  <show_in_store>0</show_in_store>
602
  <fields>
603
+ <active translate="label" module="connector">
604
+ <label>Consider Order Complete For Lost Baskets</label>
605
  <frontend_type>select</frontend_type>
606
  <source_model>connector/system_config_source_activebasket</source_model>
607
  <sort_order>10</sort_order>
611
  </active>
612
  </fields>
613
  </active>
614
+ <customers translate="label" module="connector">
615
  <label>Customers</label>
616
  <frontend_type>text</frontend_type>
617
  <sort_order>10</sort_order>
620
  <show_in_store>1</show_in_store>
621
  <expanded>1</expanded>
622
  <fields>
623
+ <heading_1 translate="label" module="connector">
624
+ <label>Lost Basket 1</label>
625
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
626
  <sort_order>10</sort_order>
627
  <show_in_default>1</show_in_default>
628
  <show_in_website>1</show_in_website>
629
  <show_in_store>1</show_in_store>
630
  </heading_1>
631
+ <enabled_1 translate="label" module="connector">
632
  <label>Enabled/Disabled</label>
633
  <frontend_type>select</frontend_type>
634
  <config_path>lostbaskets/customers/enabled_1</config_path>
638
  <show_in_website>1</show_in_website>
639
  <show_in_store>1</show_in_store>
640
  </enabled_1>
641
+ <send_after_1 translate="label" module="connector">
642
+ <label>Send After (min)</label>
643
  <frontend_type>select</frontend_type>
644
  <source_model>connector/system_config_source_lostbasket</source_model>
645
  <sort_order>30</sort_order>
647
  <show_in_website>1</show_in_website>
648
  <show_in_store>1</show_in_store>
649
  </send_after_1>
650
+ <campaign_1 translate="label" module="connector">
651
  <label>Campaign To Send</label>
652
  <frontend_type>select</frontend_type>
653
  <source_model>connector/system_config_source_campaigns</source_model>
656
  <show_in_website>1</show_in_website>
657
  <show_in_store>1</show_in_store>
658
  </campaign_1>
659
+ <heading_2 translate="label" module="connector">
660
+ <label>Lost Basket 2</label>
661
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
662
  <sort_order>50</sort_order>
663
  <show_in_default>1</show_in_default>
664
  <show_in_website>1</show_in_website>
665
  <show_in_store>1</show_in_store>
666
  </heading_2>
667
+ <enabled_2 translate="label" module="connector">
668
  <label>Enabled/Disabled</label>
669
  <frontend_type>select</frontend_type>
670
  <config_path>lostbaskets/customers/enabled_2</config_path>
674
  <show_in_website>1</show_in_website>
675
  <show_in_store>1</show_in_store>
676
  </enabled_2>
677
+ <send_after_2 translate="label" module="connector">
678
+ <label>Send After (hrs)</label>
679
  <frontend_type>select</frontend_type>
680
+ <source_model>connector/system_config_source_sendcampaignafter</source_model>
681
  <sort_order>70</sort_order>
682
  <show_in_default>1</show_in_default>
683
  <show_in_website>1</show_in_website>
684
  <show_in_store>1</show_in_store>
685
  </send_after_2>
686
+ <campaign_2 translate="label" module="connector">
687
+ <label>Campaign To Send</label>
688
  <frontend_type>select</frontend_type>
689
  <source_model>connector/system_config_source_campaigns</source_model>
690
  <sort_order>80</sort_order>
692
  <show_in_website>1</show_in_website>
693
  <show_in_store>1</show_in_store>
694
  </campaign_2>
695
+ <heading_3 translate="label" module="connector">
696
+ <label>Lost Basket 3</label>
697
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
698
  <sort_order>90</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
  </heading_3>
703
+ <enabled_3 translate="label" module="connector">
704
  <label>Enabled/Disabled</label>
705
  <frontend_type>select</frontend_type>
706
  <config_path>lostbaskets/customers/enabled_3</config_path>
710
  <show_in_website>1</show_in_website>
711
  <show_in_store>1</show_in_store>
712
  </enabled_3>
713
+ <send_after_3 translate="label" module="connector">
714
+ <label>Send After (hrs)</label>
715
  <frontend_type>select</frontend_type>
716
+ <source_model>connector/system_config_source_sendcampaignafter</source_model>
717
  <sort_order>110</sort_order>
718
  <show_in_default>1</show_in_default>
719
  <show_in_website>1</show_in_website>
720
  <show_in_store>1</show_in_store>
721
  </send_after_3>
722
+ <campaign_3 translate="label" module="connector">
723
+ <label>Campaign To Send</label>
724
  <frontend_type>select</frontend_type>
725
  <source_model>connector/system_config_source_campaigns</source_model>
726
  <sort_order>120</sort_order>
730
  </campaign_3>
731
  </fields>
732
  </customers>
733
+ <guests translate="label" module="connector">
734
  <label>Guests</label>
735
  <frontend_type>text</frontend_type>
736
  <sort_order>20</sort_order>
737
  <show_in_default>1</show_in_default>
738
  <show_in_website>1</show_in_website>
739
+ <show_in_store>0</show_in_store>
740
  <fields>
741
+ <heading_1 translate="label" module="connector">
742
+ <label>Lost Basket 1</label>
743
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
744
  <sort_order>10</sort_order>
745
  <show_in_default>1</show_in_default>
746
  <show_in_website>1</show_in_website>
747
+ <show_in_store>0</show_in_store>
748
  </heading_1>
749
+ <enabled_1 translate="label" module="connector">
750
  <label>Enabled/Disabled</label>
751
  <frontend_type>select</frontend_type>
752
  <config_path>lostbaskets/guests/enabled_1</config_path>
754
  <sort_order>20</sort_order>
755
  <show_in_default>1</show_in_default>
756
  <show_in_website>1</show_in_website>
757
+ <show_in_store>0</show_in_store>
758
  </enabled_1>
759
+ <send_after_1 translate="label" module="connector">
760
+ <label>Send After (min)</label>
761
  <frontend_type>select</frontend_type>
762
  <source_model>connector/system_config_source_lostbasket</source_model>
763
  <sort_order>30</sort_order>
764
  <show_in_default>1</show_in_default>
765
  <show_in_website>1</show_in_website>
766
+ <show_in_store>0</show_in_store>
767
  </send_after_1>
768
+ <campaign_1 translate="label" module="connector">
769
  <label>Campaign To Send</label>
770
  <frontend_type>select</frontend_type>
771
  <source_model>connector/system_config_source_campaigns</source_model>
772
  <sort_order>40</sort_order>
773
  <show_in_default>1</show_in_default>
774
  <show_in_website>1</show_in_website>
775
+ <show_in_store>0</show_in_store>
776
  </campaign_1>
777
+ <heading_2 translate="label" module="connector">
778
+ <label>Lost Basket 2</label>
 
779
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
780
  <sort_order>50</sort_order>
781
  <show_in_default>1</show_in_default>
782
  <show_in_website>1</show_in_website>
783
+ <show_in_store>0</show_in_store>
784
  </heading_2>
785
+ <enabled_2 translate="label" module="connector">
786
  <label>Enabled/Disabled</label>
787
  <frontend_type>select</frontend_type>
788
  <config_path>lostbaskets/guests/enabled_2</config_path>
790
  <sort_order>60</sort_order>
791
  <show_in_default>1</show_in_default>
792
  <show_in_website>1</show_in_website>
793
+ <show_in_store>0</show_in_store>
794
  </enabled_2>
795
+ <send_after_2 translate="label" module="connector">
796
+ <label>Send After (hrs)</label>
797
  <frontend_type>select</frontend_type>
798
+ <source_model>connector/system_config_source_sendcampaignafter</source_model>
799
  <sort_order>70</sort_order>
800
  <show_in_default>1</show_in_default>
801
  <show_in_website>1</show_in_website>
802
+ <show_in_store>0</show_in_store>
803
  </send_after_2>
804
+ <campaign_2 translate="label" module="connector">
805
+ <label>Campaign To Send</label>
806
  <frontend_type>select</frontend_type>
807
  <source_model>connector/system_config_source_campaigns</source_model>
808
  <sort_order>80</sort_order>
809
  <show_in_default>1</show_in_default>
810
  <show_in_website>1</show_in_website>
811
+ <show_in_store>0</show_in_store>
812
  </campaign_2>
813
+ <heading_3 translate="label" module="connector">
814
+ <label>Lost Basket 3</label>
 
815
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
816
  <sort_order>90</sort_order>
817
  <show_in_default>1</show_in_default>
818
  <show_in_website>1</show_in_website>
819
+ <show_in_store>0</show_in_store>
820
  </heading_3>
821
+ <enabled_3 translate="label" module="connector">
822
  <label>Enabled/Disabled</label>
823
  <frontend_type>select</frontend_type>
824
  <config_path>lostbaskets/guests/enabled_3</config_path>
826
  <sort_order>100</sort_order>
827
  <show_in_default>1</show_in_default>
828
  <show_in_website>1</show_in_website>
829
+ <show_in_store>0</show_in_store>
830
  </enabled_3>
831
+ <send_after_3 translate="label" module="connector">
832
+ <label>Send After (hrs)</label>
833
  <frontend_type>select</frontend_type>
834
+ <source_model>connector/system_config_source_sendcampaignafter</source_model>
835
  <sort_order>110</sort_order>
836
  <show_in_default>1</show_in_default>
837
  <show_in_website>1</show_in_website>
838
+ <show_in_store>0</show_in_store>
839
  </send_after_3>
840
+ <campaign_3 translate="label" module="connector">
841
+ <label>Campaign To Send</label>
842
  <frontend_type>select</frontend_type>
843
  <source_model>connector/system_config_source_campaigns</source_model>
844
  <sort_order>120</sort_order>
845
  <show_in_default>1</show_in_default>
846
  <show_in_website>1</show_in_website>
847
+ <show_in_store>0</show_in_store>
848
  </campaign_3>
849
  </fields>
850
  </guests>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
851
  </groups>
852
  </lost_basket_settings>
853
+ <sms_section translate="label" module="connector">
854
  <label><![CDATA[SMS]]></label>
855
  <tab>connector</tab>
856
  <frontend_type>text</frontend_type>
857
  <sort_order>7000</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
  <groups>
862
+ <sms_message_one translate="label" module="connector">
863
  <label>SMS Message 1</label>
864
  <frontend_type>text</frontend_type>
865
  <sort_order>10</sort_order>
866
  <show_in_default>1</show_in_default>
867
  <show_in_website>1</show_in_website>
868
+ <show_in_store>0</show_in_store>
869
  <fields>
870
+ <enabled translate="label" module="connector">
871
  <label>Enabled</label>
872
  <frontend_type>select</frontend_type>
873
  <source_model>adminhtml/system_config_source_yesno</source_model>
874
  <sort_order>10</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
  </enabled>
879
+ <order_status translate="label" module="connector">
880
  <label>Order Status</label>
881
  <sort_order>20</sort_order>
882
  <frontend_type>select</frontend_type>
883
  <source_model>connector/system_config_source_orderstatus</source_model>
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
  </order_status>
888
+ <message translate="label" module="connector">
889
  <label>Message</label>
890
  <frontend_type>textarea</frontend_type>
891
  <frontend_model>connector/adminhtml_system_config_smsmessageone</frontend_model>
892
  <sort_order>30</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
  <validate>validate-length maximum-length-110</validate>
897
  </message>
898
  </fields>
 
899
  </sms_message_one>
900
+ <sms_message_two translate="label" module="connector">
901
  <label>SMS Message 2</label>
902
  <frontend_type>text</frontend_type>
903
  <sort_order>20</sort_order>
904
  <show_in_default>1</show_in_default>
905
  <show_in_website>1</show_in_website>
906
+ <show_in_store>0</show_in_store>
907
  <fields>
908
+ <enabled translate="label" module="connector">
909
  <label>Enabled</label>
910
  <frontend_type>select</frontend_type>
911
  <source_model>adminhtml/system_config_source_yesno</source_model>
912
  <sort_order>10</sort_order>
913
  <show_in_default>1</show_in_default>
914
  <show_in_website>1</show_in_website>
915
+ <show_in_store>0</show_in_store>
916
  </enabled>
917
+ <order_status translate="label" module="connector">
918
  <label>Order Status</label>
919
  <sort_order>20</sort_order>
920
  <frontend_type>select</frontend_type>
921
  <source_model>connector/system_config_source_orderstatus</source_model>
922
  <show_in_default>1</show_in_default>
923
  <show_in_website>1</show_in_website>
924
+ <show_in_store>0</show_in_store>
925
  </order_status>
926
+ <message translate="label" module="connector">
927
  <label>Message</label>
928
  <frontend_type>textarea</frontend_type>
929
  <frontend_model>connector/adminhtml_system_config_smsmessagetwo</frontend_model>
930
  <sort_order>30</sort_order>
931
  <show_in_default>1</show_in_default>
932
  <show_in_website>1</show_in_website>
933
+ <show_in_store>0</show_in_store>
934
  <validate>validate-length maximum-length-110</validate>
935
  </message>
936
  </fields>
 
937
  </sms_message_two>
938
+ <sms_message_three translate="label" module="connector">
939
  <label>SMS Message 3</label>
940
  <frontend_type>text</frontend_type>
941
  <sort_order>30</sort_order>
942
  <show_in_default>1</show_in_default>
943
  <show_in_website>1</show_in_website>
944
+ <show_in_store>0</show_in_store>
945
  <fields>
946
+ <enabled translate="label" module="connector">
947
  <label>Enabled</label>
948
  <frontend_type>select</frontend_type>
949
  <source_model>adminhtml/system_config_source_yesno</source_model>
950
  <sort_order>10</sort_order>
951
  <show_in_default>1</show_in_default>
952
  <show_in_website>1</show_in_website>
953
+ <show_in_store>0</show_in_store>
954
  </enabled>
955
+ <order_status translate="label" module="connector">
956
  <label>Order Status</label>
957
  <sort_order>20</sort_order>
958
  <frontend_type>select</frontend_type>
959
  <source_model>connector/system_config_source_orderstatus</source_model>
960
  <show_in_default>1</show_in_default>
961
  <show_in_website>1</show_in_website>
962
+ <show_in_store>0</show_in_store>
963
  </order_status>
964
+ <message translate="label" module="connector">
965
  <label>Message</label>
966
  <frontend_type>textarea</frontend_type>
967
  <frontend_model>connector/adminhtml_system_config_smsmessagethree</frontend_model>
968
  <sort_order>30</sort_order>
969
  <show_in_default>1</show_in_default>
970
  <show_in_website>1</show_in_website>
971
+ <show_in_store>0</show_in_store>
972
  <validate>validate-length maximum-length-110</validate>
973
  </message>
974
  </fields>
975
  </sms_message_three>
976
+ <sms_message_four translate="label" module="connector">
977
  <label>SMS Message 4</label>
978
  <frontend_type>text</frontend_type>
979
  <sort_order>40</sort_order>
980
  <show_in_default>1</show_in_default>
981
  <show_in_website>1</show_in_website>
982
+ <show_in_store>0</show_in_store>
983
  <fields>
984
+ <enabled translate="label" module="connector">
985
  <label>Enabled</label>
986
  <frontend_type>select</frontend_type>
987
  <source_model>adminhtml/system_config_source_yesno</source_model>
988
  <sort_order>10</sort_order>
989
  <show_in_default>1</show_in_default>
990
  <show_in_website>1</show_in_website>
991
+ <show_in_store>0</show_in_store>
992
  </enabled>
993
+ <order_status translate="label" module="connector">
994
  <label>Order Status</label>
995
  <sort_order>20</sort_order>
996
  <frontend_type>select</frontend_type>
997
  <source_model>connector/system_config_source_orderstatus</source_model>
998
  <show_in_default>1</show_in_default>
999
  <show_in_website>1</show_in_website>
1000
+ <show_in_store>0</show_in_store>
1001
  </order_status>
1002
+ <message translate="label" module="connector">
1003
  <label>Message</label>
1004
  <frontend_type>textarea</frontend_type>
1005
+ <frontend_model>connector/adminhtml_system_config_Smsmessagefour</frontend_model>
1006
  <sort_order>30</sort_order>
1007
  <show_in_default>1</show_in_default>
1008
  <show_in_website>1</show_in_website>
1009
+ <show_in_store>0</show_in_store>
1010
  <validate>validate-length maximum-length-110</validate>
1011
  </message>
1012
  </fields>
 
1013
  </sms_message_four>
1014
  </groups>
1015
  </sms_section>
1016
+ <dynamic_content translate="label" module="connector">
1017
  <label><![CDATA[Dynamic Content]]></label>
1018
  <tab>connector</tab>
1019
  <frontend_type>text</frontend_type>
1022
  <show_in_website>1</show_in_website>
1023
  <show_in_store>0</show_in_store>
1024
  <groups>
1025
+ <products translate="label" module="connector">
1026
  <label>Dynamic Products</label>
1027
  <frontend_type>text</frontend_type>
1028
  <sort_order>10</sort_order>
1031
  <show_in_store>0</show_in_store>
1032
  <expanded>1</expanded>
1033
  <fields>
1034
+ <related translate="label" module="connector">
1035
  <label>Related Products</label>
1036
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1037
  <sort_order>10</sort_order>
1039
  <show_in_website>1</show_in_website>
1040
  <show_in_store>0</show_in_store>
1041
  </related>
1042
+ <related_display_type translate="label" module="connector">
1043
  <label>Display Type</label>
1044
  <frontend_type>select</frontend_type>
1045
  <source_model>connector/system_config_source_displaytype</source_model>
1048
  <show_in_website>1</show_in_website>
1049
  <show_in_store>0</show_in_store>
1050
  </related_display_type>
1051
+ <related_items_to_display translate="label" module="connector">
1052
  <label>Items To Display</label>
1053
  <frontend_type>select</frontend_type>
1054
  <source_model>connector/system_config_source_gridview</source_model>
1057
  <show_in_default>1</show_in_default>
1058
  <show_in_store>0</show_in_store>
1059
  </related_items_to_display>
1060
+ <upsell translate="label" module="connector">
 
1061
  <label>Up Sell Products</label>
1062
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1063
  <sort_order>40</sort_order>
1065
  <show_in_website>1</show_in_website>
1066
  <show_in_store>0</show_in_store>
1067
  </upsell>
1068
+ <upsell_display_type translate="label" module="connector">
1069
  <label>Display Type</label>
1070
  <frontend_type>select</frontend_type>
1071
  <source_model>connector/system_config_source_displaytype</source_model>
1074
  <show_in_website>1</show_in_website>
1075
  <show_in_store>0</show_in_store>
1076
  </upsell_display_type>
1077
+ <upsell_items_to_display translate="label" module="connector">
1078
  <label>Items To Display</label>
1079
  <frontend_type>select</frontend_type>
1080
  <source_model>connector/system_config_source_gridview</source_model>
1083
  <show_in_default>1</show_in_default>
1084
  <show_in_store>0</show_in_store>
1085
  </upsell_items_to_display>
1086
+ <crosssell translate="label" module="connector">
 
1087
  <label>Cross Sell Products</label>
1088
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1089
  <sort_order>70</sort_order>
1091
  <show_in_website>1</show_in_website>
1092
  <show_in_store>0</show_in_store>
1093
  </crosssell>
1094
+ <crosssell_display_type translate="label" module="connector">
1095
  <label>Display Type</label>
1096
  <frontend_type>select</frontend_type>
1097
  <source_model>connector/system_config_source_displaytype</source_model>
1100
  <show_in_website>1</show_in_website>
1101
  <show_in_store>0</show_in_store>
1102
  </crosssell_display_type>
1103
+ <crosssell_items_to_display translate="label" module="connector">
1104
  <label>Items To Display</label>
1105
  <frontend_type>select</frontend_type>
1106
  <source_model>connector/system_config_source_gridview</source_model>
1109
  <show_in_default>1</show_in_default>
1110
  <show_in_store>0</show_in_store>
1111
  </crosssell_items_to_display>
1112
+ <bestsellers translate="label" module="connector">
 
1113
  <label>Best Sellers</label>
1114
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1115
  <sort_order>100</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
+ </bestsellers>
1120
+ <bestsellers_display_type translate="label" module="connector">
1121
  <label>Display Type</label>
1122
  <frontend_type>select</frontend_type>
1123
  <source_model>connector/system_config_source_displaytype</source_model>
1125
  <show_in_default>1</show_in_default>
1126
  <show_in_website>1</show_in_website>
1127
  <show_in_store>0</show_in_store>
1128
+ </bestsellers_display_type>
1129
+ <bestsellers_items_to_display translate="label" module="connector">
1130
  <label>Items To Display</label>
1131
  <frontend_type>select</frontend_type>
1132
  <source_model>connector/system_config_source_gridview</source_model>
1134
  <show_in_website>1</show_in_website>
1135
  <show_in_default>1</show_in_default>
1136
  <show_in_store>0</show_in_store>
1137
+ </bestsellers_items_to_display>
1138
+ <bestsellers_time_period translate="label" module="connector">
1139
  <label>Time Period</label>
1140
  <frontend_type>select</frontend_type>
1141
  <source_model>connector/system_config_source_timeperiod</source_model>
1143
  <show_in_default>1</show_in_default>
1144
  <show_in_website>1</show_in_website>
1145
  <show_in_store>0</show_in_store>
1146
+ </bestsellers_time_period>
1147
+ <most_viewed translate="label" module="connector">
 
1148
  <label>Most Viewed</label>
1149
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1150
  <sort_order>140</sort_order>
1152
  <show_in_website>1</show_in_website>
1153
  <show_in_store>0</show_in_store>
1154
  </most_viewed>
1155
+ <most_viewed_display_type translate="label" module="connector">
1156
  <label>Display Type</label>
1157
  <frontend_type>select</frontend_type>
1158
  <source_model>connector/system_config_source_displaytype</source_model>
1161
  <show_in_website>1</show_in_website>
1162
  <show_in_store>0</show_in_store>
1163
  </most_viewed_display_type>
1164
+ <most_viewed_items_to_display translate="label" module="connector">
1165
  <label>Items To Display</label>
1166
  <frontend_type>select</frontend_type>
1167
  <source_model>connector/system_config_source_gridview</source_model>
1170
  <show_in_default>1</show_in_default>
1171
  <show_in_store>0</show_in_store>
1172
  </most_viewed_items_to_display>
1173
+ <most_viewed_time_period translate="label" module="connector">
1174
  <label>Time Period</label>
1175
  <frontend_type>select</frontend_type>
1176
  <source_model>connector/system_config_source_timeperiod</source_model>
1179
  <show_in_website>1</show_in_website>
1180
  <show_in_store>0</show_in_store>
1181
  </most_viewed_time_period>
1182
+ <recently_viewed translate="label" module="connector">
 
1183
  <label>Recently Viewed</label>
1184
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1185
  <sort_order>180</sort_order>
1187
  <show_in_website>1</show_in_website>
1188
  <show_in_store>0</show_in_store>
1189
  </recently_viewed>
1190
+ <recently_viewed_display_type translate="label" module="connector">
1191
  <label>Display Type</label>
1192
  <frontend_type>select</frontend_type>
1193
  <source_model>connector/system_config_source_displaytype</source_model>
1196
  <show_in_website>1</show_in_website>
1197
  <show_in_store>0</show_in_store>
1198
  </recently_viewed_display_type>
1199
+ <recently_viewed_items_to_display translate="label" module="connector">
1200
  <label>items To Display</label>
1201
  <frontend_type>select</frontend_type>
1202
  <source_model>connector/system_config_source_gridview</source_model>
1205
  <show_in_website>1</show_in_website>
1206
  <show_in_store>0</show_in_store>
1207
  </recently_viewed_items_to_display>
 
1208
  <validator>
 
1209
  <frontend_type>hidden</frontend_type>
1210
  <frontend_model>connector/adminhtml_system_config_gridlist</frontend_model>
1211
  <sort_order>210</sort_order>
1215
  <can_be_empty>1</can_be_empty>
1216
  </validator>
1217
  </fields>
 
1218
  </products>
1219
+ <manual_product_search translate="label" module="connector">
1220
  <label>Manual Product Push</label>
1221
  <frontend_type>text</frontend_type>
1222
  <sort_order>20</sort_order>
1225
  <show_in_store>0</show_in_store>
1226
  <expanded>1</expanded>
1227
  <fields>
1228
+ <settings tranlate="label" module="connector">
1229
  <label>Settings</label>
1230
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1231
  <sort_order>10</sort_order>
1233
  <show_in_website>1</show_in_website>
1234
  <show_in_store>0</show_in_store>
1235
  </settings>
1236
+ <display_type translate="label" module="connector">
1237
  <label>Display Type</label>
1238
  <frontend_type>select</frontend_type>
1239
  <source_model>connector/system_config_source_displaytype</source_model>
1242
  <show_in_website>1</show_in_website>
1243
  <show_in_store>0</show_in_store>
1244
  </display_type>
1245
+ <items_to_display translate="label" module="connector">
1246
  <label>Items To Display</label>
1247
  <frontend_type>select</frontend_type>
1248
  <source_model>connector/system_config_source_gridview</source_model>
1251
  <show_in_default>1</show_in_default>
1252
  <show_in_store>0</show_in_store>
1253
  </items_to_display>
1254
+ <products_push translate="label" module="connector">
1255
  <label>Products</label>
1256
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1257
  <sort_order>80</sort_order>
1259
  <show_in_website>1</show_in_website>
1260
  <show_in_store>0</show_in_store>
1261
  </products_push>
1262
+ <products_push_items translate="label comment" module="connector">
1263
  <label>Products</label>
1264
  <frontend_type>text</frontend_type>
1265
  <sort_order>90</sort_order>
1270
  </products_push_items>
1271
  </fields>
1272
  </manual_product_search>
1273
+ <fallback_products translate="label" module="connector">
1274
  <label>Fallback Products</label>
1275
  <frontend_type>text</frontend_type>
1276
  <sort_order>30</sort_order>
1278
  <show_in_website>1</show_in_website>
1279
  <show_in_store>0</show_in_store>
1280
  <fields>
1281
+ <product_list translate="label comment" module="connector">
1282
  <label>Products</label>
1283
  <frontend_type>text</frontend_type>
1284
  <sort_order>10</sort_order>
1291
  </fallback_products>
1292
  </groups>
1293
  </dynamic_content>
1294
+ <transactional_emails translate="label" module="connector">
1295
+ <label>Transactional Emails</label>
1296
  <tab>connector</tab>
1297
  <frontend_type>text</frontend_type>
1298
+ <show_in_default>0</show_in_default>
1299
+ <show_in_website>0</show_in_website>
1300
+ <show_in_store>0</show_in_store>
1301
  <sort_order>9000</sort_order>
1302
+ <groups>
1303
+ <transactional_email translate="label" module="connector">
1304
+ <label>Transactional Emails</label>
1305
+ <frontend_type>text</frontend_type>
1306
+ <sort_order>100</sort_order>
1307
+ <show_in_default>1</show_in_default>
1308
+ <show_in_website>1</show_in_website>
1309
+ <show_in_store>0</show_in_store>
1310
+ <expanded>1</expanded>
1311
+ <fields>
1312
+ <api_username translate="label" module="connector">
1313
+ <label>API Username</label>
1314
+ <frontend_type>text</frontend_type>
1315
+ <sort_order>10</sort_order>
1316
+ <show_in_default>1</show_in_default>
1317
+ <show_in_website>1</show_in_website>
1318
+ <show_in_store>0</show_in_store>
1319
+ </api_username>
1320
+ <api_password translate="label" module="connector">
1321
+ <label>API Password</label>
1322
+ <frontend_type>password</frontend_type>
1323
+ <!--<frontend_model>connector/adminhtml_system_config_testbutton</frontend_model>-->
1324
+ <sort_order>20</sort_order>
1325
+ <show_in_default>1</show_in_default>
1326
+ <show_in_website>1</show_in_website>
1327
+ <show_in_store>0</show_in_store>
1328
+ </api_password>
1329
+ <validator>
1330
+ <frontend_type>hidden</frontend_type>
1331
+ <frontend_model>connector/adminhtml_system_config_waitingfield</frontend_model>
1332
+ <sort_order>40</sort_order>
1333
+ <show_in_default>1</show_in_default>
1334
+ <show_in_website>1</show_in_website>
1335
+ <show_in_store>0</show_in_store>
1336
+ <can_be_empty>1</can_be_empty>
1337
+ </validator>
1338
+ </fields>
1339
+ </transactional_email>
1340
+ <email_mapping translate="label" module="connector">
1341
+ <label>Email Mapping</label>
1342
+ <frontend_type>text</frontend_type>
1343
+ <sort_order>200</sort_order>
1344
+ <show_in_default>1</show_in_default>
1345
+ <show_in_website>1</show_in_website>
1346
+ <show_in_store>0</show_in_store>
1347
+ <expanded>1</expanded>
1348
+ <fields>
1349
+ <order_title translate="label" module="connector">
1350
+ <label>Order Emails</label>
1351
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1352
+ <sort_order>10</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
+ </order_title>
1357
+ <new_creditmemo translate="label" module="connector">
1358
+ <label>New Credit Memo</label>
1359
+ <frontend_type>select</frontend_type>
1360
+ <source_model>connector/system_config_source_campaigns</source_model>
1361
+ <sort_order>20</sort_order>
1362
+ <show_in_default>1</show_in_default>
1363
+ <show_in_website>1</show_in_website>
1364
+ <show_in_store>0</show_in_store>
1365
+ </new_creditmemo>
1366
+ <new_creditmemo_guest translate="label" module="connector">
1367
+ <label>New Credit Memo Guest</label>
1368
+ <frontend_type>select</frontend_type>
1369
+ <source_model>connector/system_config_source_campaigns</source_model>
1370
+ <sort_order>30</sort_order>
1371
+ <show_in_default>1</show_in_default>
1372
+ <show_in_website>1</show_in_website>
1373
+ <show_in_store>0</show_in_store>
1374
+ </new_creditmemo_guest>
1375
+ <creditmemo translate="label" module="connector">
1376
+ <label>Credit Memo Update</label>
1377
+ <frontend_type>select</frontend_type>
1378
+ <source_model>connector/system_config_source_campaigns</source_model>
1379
+ <sort_order>40</sort_order>
1380
+ <show_in_default>1</show_in_default>
1381
+ <show_in_website>1</show_in_website>
1382
+ <show_in_store>0</show_in_store>
1383
+ </creditmemo>
1384
+ <new_invoice translate="label" module="connector">
1385
+ <label>New Invoice</label>
1386
+ <frontend_type>select</frontend_type>
1387
+ <source_model>connector/system_config_source_campaigns</source_model>
1388
+ <sort_order>50</sort_order>
1389
+ <show_in_default>1</show_in_default>
1390
+ <show_in_website>1</show_in_website>
1391
+ <show_in_store>0</show_in_store>
1392
+ </new_invoice>
1393
+ <invoice_update translate="label" module="connector">
1394
+ <label>Invoice Update</label>
1395
+ <frontend_type>select</frontend_type>
1396
+ <source_model>connector/system_config_source_campaigns</source_model>
1397
+ <sort_order>60</sort_order>
1398
+ <show_in_default>1</show_in_default>
1399
+ <show_in_website>1</show_in_website>
1400
+ <show_in_store>0</show_in_store>
1401
+ </invoice_update>
1402
+ <new_order translate="label" module="connector">
1403
+ <label>New Order</label>
1404
+ <sort_order>70</sort_order>
1405
+ <frontend_type>select</frontend_type>
1406
+ <source_model>connector/system_config_source_campaigns</source_model>
1407
+ <show_in_default>1</show_in_default>
1408
+ <show_in_website>1</show_in_website>
1409
+ <show_in_store>0</show_in_store>
1410
+ </new_order>
1411
+ <order_update translate="label" module="connector">
1412
+ <label>Order Update</label>
1413
+ <sort_order>80</sort_order>
1414
+ <frontend_type>select</frontend_type>
1415
+ <source_model>connector/system_config_source_campaigns</source_model>
1416
+ <show_in_default>1</show_in_default>
1417
+ <show_in_website>1</show_in_website>
1418
+ <show_in_store>0</show_in_store>
1419
+ </order_update>
1420
+ <new_shipment translate="label" module="connector">
1421
+ <label>New Shipment</label>
1422
+ <sort_order>90</sort_order>
1423
+ <frontend_type>select</frontend_type>
1424
+ <source_model>connector/system_config_source_campaigns</source_model>
1425
+ <show_in_default>1</show_in_default>
1426
+ <show_in_website>1</show_in_website>
1427
+ <show_in_store>0</show_in_store>
1428
+ </new_shipment>
1429
+ <shipment_update translate="label" module="connector">
1430
+ <label>Shipment Update</label>
1431
+ <sort_order>100</sort_order>
1432
+ <frontend_type>select</frontend_type>
1433
+ <source_model>connector/system_config_source_campaigns</source_model>
1434
+ <show_in_default>1</show_in_default>
1435
+ <show_in_website>1</show_in_website>
1436
+ <show_in_store>0</show_in_store>
1437
+ </shipment_update>
1438
+ <customer_emails_heading translate="label" module="connector">
1439
+ <label>Customer Emails</label>
1440
+ <sort_order>110</sort_order>
1441
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1442
+ <show_in_default>1</show_in_default>
1443
+ <show_in_website>1</show_in_website>
1444
+ <show_in_store>0</show_in_store>
1445
+ </customer_emails_heading>
1446
+ <password_remind translate="label" module="connector">
1447
+ <label>Password Remind</label>
1448
+ <sort_order>120</sort_order>
1449
+ <frontend_type>select</frontend_type>
1450
+ <source_model>connector/system_config_source_campaigns</source_model>
1451
+ <show_in_default>1</show_in_default>
1452
+ <show_in_website>1</show_in_website>
1453
+ <show_in_store>0</show_in_store>
1454
+ </password_remind>
1455
+ <forgot_password translate="label" module="connector">
1456
+ <label>Forgot Password</label>
1457
+ <sort_order>130</sort_order>
1458
+ <frontend_type>select</frontend_type>
1459
+ <source_model>connector/system_config_source_campaigns</source_model>
1460
+ <show_in_default>1</show_in_default>
1461
+ <show_in_website>1</show_in_website>
1462
+ <show_in_store>0</show_in_store>
1463
+ </forgot_password>
1464
+ <new_account translate="label" module="connector">
1465
+ <label>New Account</label>
1466
+ <sort_order>140</sort_order>
1467
+ <frontend_type>select</frontend_type>
1468
+ <source_model>connector/system_config_source_campaigns</source_model>
1469
+ <show_in_default>1</show_in_default>
1470
+ <show_in_website>1</show_in_website>
1471
+ <show_in_store>0</show_in_store>
1472
+ </new_account>
1473
+ <!--<new_account_key translate="label">-->
1474
+ <!--<label>New Account Key</label>-->
1475
+ <!--<sort_order>150</sort_order>-->
1476
+ <!--<frontend_type>select</frontend_type>-->
1477
+ <!--<source_model>connector/system_config_source_campaigns</source_model>-->
1478
+ <!--<show_in_default>1</show_in_default>-->
1479
+ <!--<show_in_website>1</show_in_website>-->
1480
+ <!--<show_in_store>0</show_in_store>-->
1481
+ <!--</new_account_key>-->
1482
+ <!--<new_account_confirm translate="label">-->
1483
+ <!--<label>New Account Confirmed</label>-->
1484
+ <!--<sort_order>160</sort_order>-->
1485
+ <!--<frontend_type>select</frontend_type>-->
1486
+ <!--<source_model>connector/system_config_source_campaigns</source_model>-->
1487
+ <!--<show_in_default>1</show_in_default>-->
1488
+ <!--<show_in_website>1</show_in_website>-->
1489
+ <!--<show_in_store>0</show_in_store>-->
1490
+ <!--</new_account_confirm>-->
1491
+ <!--<newsletter_subscribtion_confirmation tranlate="label">-->
1492
+ <!--<label>Newsletter Subscription Confirmation</label>-->
1493
+ <!--<sort_order>170</sort_order>-->
1494
+ <!--<frontend_type>select</frontend_type>-->
1495
+ <!--<source_model>connector/system_config_source_campaigns</source_model>-->
1496
+ <!--<show_in_default>1</show_in_default>-->
1497
+ <!--<show_in_website>1</show_in_website>-->
1498
+ <!--<show_in_store>0</show_in_store>-->
1499
+ <!--</newsletter_subscribtion_confirmation>-->
1500
+ <!--<newsletter_subscription_success translate="label">-->
1501
+ <!--<label>Newsletter Subscription Success</label>-->
1502
+ <!--<sort_order>180</sort_order>-->
1503
+ <!--<frontend_type>select</frontend_type>-->
1504
+ <!--<source_model>connector/system_config_source_campaigns</source_model>-->
1505
+ <!--<show_in_default>1</show_in_default>-->
1506
+ <!--<show_in_website>1</show_in_website>-->
1507
+ <!--<show_in_store>0</show_in_store>-->
1508
+ <!--</newsletter_subscription_success>-->
1509
+
1510
+ <!--<website_email_header translate="label">-->
1511
+ <!--<label>Website Email</label>-->
1512
+ <!--<sort_order>190</sort_order>-->
1513
+ <!--<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>-->
1514
+ <!--<show_in_default>1</show_in_default>-->
1515
+ <!--<show_in_website>1</show_in_website>-->
1516
+ <!--<show_in_store>0</show_in_store>-->
1517
+ <!--</website_email_header>-->
1518
+ <!--<product_price_alert translate="label">-->
1519
+ <!--<label>Product Price Alert</label>-->
1520
+ <!--<sort_order>200</sort_order>-->
1521
+ <!--<frontend_type>select</frontend_type>-->
1522
+ <!--<source_model>connector/system_config_source_campaigns</source_model>-->
1523
+ <!--<show_in_default>1</show_in_default>-->
1524
+ <!--<show_in_website>1</show_in_website>-->
1525
+ <!--<show_in_store>0</show_in_store>-->
1526
+ <!--</product_price_alert>-->
1527
+ <!--<product_stock_alert translate="label">-->
1528
+ <!--<label>Product Stock Alert</label>-->
1529
+ <!--<sort_order>210</sort_order>-->
1530
+ <!--<frontend_type>select</frontend_type>-->
1531
+ <!--<source_model>connector/system_config_source_campaigns</source_model>-->
1532
+ <!--<show_in_default>1</show_in_default>-->
1533
+ <!--<show_in_website>1</show_in_website>-->
1534
+ <!--<show_in_store>0</show_in_store>-->
1535
+ <!--</product_stock_alert>-->
1536
+ <!--<send_to_frend translate="label">-->
1537
+ <!--<label>Send To A Friend</label>-->
1538
+ <!--<sort_order>220</sort_order>-->
1539
+ <!--<frontend_type>select</frontend_type>-->
1540
+ <!--<source_model>connector/system_config_source_campaigns</source_model>-->
1541
+ <!--<show_in_default>1</show_in_default>-->
1542
+ <!--<show_in_website>1</show_in_website>-->
1543
+ <!--<show_in_store>0</show_in_store>-->
1544
+ <!--</send_to_frend>-->
1545
+ <!--<share_wishlist translate="label">-->
1546
+ <!--<label>Share Wishlist</label>-->
1547
+ <!--<sort_order>230</sort_order>-->
1548
+ <!--<frontend_type>select</frontend_type>-->
1549
+ <!--<source_model>connector/system_config_source_campaigns</source_model>-->
1550
+ <!--<show_in_default>1</show_in_default>-->
1551
+ <!--<show_in_website>1</show_in_website>-->
1552
+ <!--<show_in_store>0</show_in_store>-->
1553
+ <!--</share_wishlist>-->
1554
+ </fields>
1555
+ </email_mapping>
1556
+ </groups>
1557
+ </transactional_emails>
1558
+ <connector_advanced_settings translate="label" module="connector">
1559
+ <label><![CDATA[Advanced Settings]]></label>
1560
+ <tab>connector</tab>
1561
+ <frontend_type>text</frontend_type>
1562
+ <sort_order>10000</sort_order>
1563
  <show_in_default>1</show_in_default>
1564
  <show_in_website>1</show_in_website>
1565
+ <show_in_store>0</show_in_store>
1566
  <groups>
1567
+ <sync_limits translate="label" module="connector">
1568
  <label>Transactional Sync Limit</label>
1569
  <frontend_type>text</frontend_type>
1570
  <sort_order>10</sort_order>
1572
  <show_in_website>1</show_in_website>
1573
  <show_in_store>0</show_in_store>
1574
  <fields>
1575
+ <orders translate="label" module="connector">
1576
+ <label>Historical Import Limit</label>
1577
  <frontend_type>select</frontend_type>
1578
  <source_model>connector/system_config_source_orderlimit</source_model>
1579
  <sort_order>40</sort_order>
1583
  </orders>
1584
  </fields>
1585
  </sync_limits>
1586
+ <external translate="label" module="connector">
1587
  <label><![CDATA[External Dynamic Content]]></label>
1588
  <frontend_type>text</frontend_type>
1589
  <sort_order>20</sort_order>
1591
  <show_in_website>1</show_in_website>
1592
  <show_in_store>0</show_in_store>
1593
  <fields>
1594
+ <passcode translate="label comment" module="connector">
1595
  <label>Passcode</label>
1596
  <frontend_type>text</frontend_type>
1597
  <sort_order>10</sort_order>
1600
  <show_in_store>0</show_in_store>
1601
  <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>
1602
  </passcode>
1603
+ <lost_basket_title translate="label" module="connector">
1604
  <label>Lost Baskets</label>
1605
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1606
  <sort_order>20</sort_order>
1608
  <show_in_website>1</show_in_website>
1609
  <show_in_store>0</show_in_store>
1610
  </lost_basket_title>
1611
+ <lost_basket_url translate="label" module="connector">
 
1612
  <label>Baskets Content URL</label>
1613
  <frontend_type>label</frontend_type>
1614
+ <frontend_model>connector/adminhtml_system_config_form_lostbasket</frontend_model>
1615
  <sort_order>30</sort_order>
1616
  <show_in_default>1</show_in_default>
1617
  <show_in_website>1</show_in_website>
1618
  <show_in_store>0</show_in_store>
1619
  </lost_basket_url>
1620
+ <coupon_code_title title="label" module="connector">
1621
  <label>Coupon Codes</label>
1622
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1623
  <sort_order>40</sort_order>
1625
  <show_in_default>1</show_in_default>
1626
  <show_in_store>0</show_in_store>
1627
  </coupon_code_title>
1628
+ <coupon_code_url translate="label" module="connector">
1629
  <label>Coupon Codes URL</label>
1630
  <frontend_type>label</frontend_type>
1631
+ <frontend_model>connector/adminhtml_system_config_form_couponinfo</frontend_model>
1632
  <sort_order>50</sort_order>
1633
  <show_in_default>1</show_in_default>
1634
  <show_in_website>1</show_in_website>
1635
  <show_in_store>0</show_in_store>
1636
  </coupon_code_url>
1637
+ <dynamic_content_url translate="label" module="connector">
 
1638
  <label>Dynamic Content</label>
1639
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1640
  <sort_order>60</sort_order>
1642
  <show_in_website>1</show_in_website>
1643
  <show_in_store>0</show_in_store>
1644
  </dynamic_content_url>
1645
+ <related_products_url translate="label" module="connector">
1646
  <label>Related Products URL</label>
1647
  <frontend_type>label</frontend_type>
1648
+ <frontend_model>connector/adminhtml_system_config_form_related</frontend_model>
1649
  <sort_order>70</sort_order>
1650
  <show_in_default>1</show_in_default>
1651
  <show_in_website>1</show_in_website>
1652
  <show_in_store>0</show_in_store>
1653
  </related_products_url>
1654
+ <upsell_products_url translate="label" module="connector">
1655
  <label>Up Sell Products URL</label>
1656
  <frontend_type>label</frontend_type>
1657
+ <frontend_model>connector/adminhtml_system_config_form_upsell</frontend_model>
1658
  <sort_order>80</sort_order>
1659
  <show_in_default>1</show_in_default>
1660
  <show_in_website>1</show_in_website>
1661
  <show_in_store>0</show_in_store>
1662
  </upsell_products_url>
1663
+ <crosssell_products_url translate="label" module="connector">
1664
  <label>Cross Sell Products URL</label>
1665
  <frontend_type>label</frontend_type>
1666
+ <frontend_model>connector/adminhtml_system_config_form_crosssell</frontend_model>
1667
  <sort_order>90</sort_order>
1668
  <show_in_default>1</show_in_default>
1669
  <show_in_website>1</show_in_website>
1670
  <show_in_store>0</show_in_store>
1671
  </crosssell_products_url>
1672
+ <best_sellers_url translate="label" module="connector">
 
1673
  <label>Best Sellers URL</label>
1674
  <frontend_type>label</frontend_type>
1675
+ <frontend_model>connector/adminhtml_system_config_form_bestsellers</frontend_model>
1676
  <sort_order>100</sort_order>
1677
  <show_in_default>1</show_in_default>
1678
  <show_in_website>1</show_in_website>
1679
  <show_in_store>0</show_in_store>
1680
  </best_sellers_url>
1681
+ <most_viewed_url translate="label" module="connector">
1682
  <label>Most Viewed URL</label>
1683
  <frontend_type>label</frontend_type>
1684
+ <frontend_model>connector/adminhtml_system_config_form_mostviewed</frontend_model>
1685
  <sort_order>110</sort_order>
1686
  <show_in_default>1</show_in_default>
1687
  <show_in_website>1</show_in_website>
1688
  <show_in_store>0</show_in_store>
1689
  </most_viewed_url>
1690
+ <product_push_url translate="label" module="connector">
1691
  <label>Product Push URL</label>
1692
  <frontend_type>label</frontend_type>
1693
+ <frontend_model>connector/adminhtml_system_config_form_productpush</frontend_model>
1694
  <sort_order>120</sort_order>
1695
  <show_in_default>1</show_in_default>
1696
  <show_in_website>1</show_in_website>
1697
  <show_in_store>0</show_in_store>
1698
  </product_push_url>
1699
+ <recently_viewed_url translate="label" module="connector">
1700
  <label>Recently Viewed</label>
1701
  <frontend_type>label</frontend_type>
1702
  <frontend_model>connector/adminhtml_system_recentlyviewed</frontend_model>
1705
  <show_in_website>1</show_in_website>
1706
  <show_in_store>0</show_in_store>
1707
  </recently_viewed_url>
1708
+ <transactional_heading translate="label" module="connector">
1709
+ <label>Transactional Emails</label>
1710
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1711
+ <sort_order>140</sort_order>
1712
+ <show_in_default>0</show_in_default>
1713
+ <show_in_website>0</show_in_website>
1714
+ <show_in_store>0</show_in_store>
1715
+ </transactional_heading>
1716
+ <transactional_customer_new translate="label" module="connector">
1717
+ <label>New Customer Registration Email</label>
1718
+ <frontend_type>label</frontend_type>
1719
+ <frontend_model>connector/adminhtml_system_config_form_customernew</frontend_model>
1720
+ <sort_order>150</sort_order>
1721
+ <show_in_default>0</show_in_default>
1722
+ <show_in_website>0</show_in_website>
1723
+ <show_in_store>0</show_in_store>
1724
+ </transactional_customer_new>
1725
+ <transactional_order_new translate="label" module="connector">
1726
+ <label>New Order Email Confirmation</label>
1727
+ <frontend_type>label</frontend_type>
1728
+ <frontend_model>connector/adminhtml_system_config_form_ordernew</frontend_model>
1729
+ <sort_order>160</sort_order>
1730
+ <show_in_default>0</show_in_default>
1731
+ <show_in_website>0</show_in_website>
1732
+ <show_in_store>0</show_in_store>
1733
+ </transactional_order_new>
1734
+ <transactional_order_creditmemo_new translate="label" module="connector">
1735
+ <label>New Creditmemo</label>
1736
+ <frontend_type>label</frontend_type>
1737
+ <frontend_model>connector/adminhtml_system_config_form_creditmemonew</frontend_model>
1738
+ <sort_order>170</sort_order>
1739
+ <show_in_default>0</show_in_default>
1740
+ <show_in_website>0</show_in_website>
1741
+ <show_in_store>0</show_in_store>
1742
+ </transactional_order_creditmemo_new>
1743
+ <transactional_order_update translate="label" module="connector">
1744
+ <label>Order Update</label>
1745
+ <frontend_type>label</frontend_type>
1746
+ <frontend_model>connector/adminhtml_system_config_form_orderupdate</frontend_model>
1747
+ <sort_order>180</sort_order>
1748
+ <show_in_default>0</show_in_default>
1749
+ <show_in_website>0</show_in_website>
1750
+ <show_in_store>0</show_in_store>
1751
+ </transactional_order_update>
1752
+ <transactional_invoice_new translate="label" module="connector">
1753
+ <label>New Invoice</label>
1754
+ <frontend_type>label</frontend_type>
1755
+ <frontend_model>connector/adminhtml_system_config_form_invoicenew</frontend_model>
1756
+ <sort_order>180</sort_order>
1757
+ <show_in_default>0</show_in_default>
1758
+ <show_in_website>0</show_in_website>
1759
+ <show_in_store>0</show_in_store>
1760
+ </transactional_invoice_new>
1761
  </fields>
1762
  </external>
1763
+ <admin translate="label" module="connector">
1764
  <label>Admin</label>
1765
  <frontend_type>text</frontend_type>
1766
  <sort_order>30</sort_order>
1768
  <show_in_default>1</show_in_default>
1769
  <show_in_store>0</show_in_store>
1770
  <fields>
1771
+ <admin_title translate="label" module="connector">
1772
+ <label><![CDATA[Contacts ID's]]></label>
1773
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1774
  <sort_order>10</sort_order>
1775
  <show_in_default>1</show_in_default>
1776
  <show_in_website>1</show_in_website>
1777
  <show_in_store>0</show_in_store>
1778
  </admin_title>
1779
+ <count_customers translate="label" module="connector">
1780
+ <label>Count Customers With ID</label>
1781
+ <frontend_model>connector/adminhtml_advanced_admin_contactsimported</frontend_model>
1782
  <sort_order>20</sort_order>
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
  </count_customers>
1787
+ <delete_contact translate="label" module="connector">
1788
+ <label><![CDATA[Delete All Contact ID's]]></label>
1789
+ <frontend_model>connector/adminhtml_advanced_admin_deletecontactids</frontend_model>
1790
  <sort_order>30</sort_order>
1791
  <show_in_default>1</show_in_default>
1792
  <show_in_website>1</show_in_website>
1793
  <show_in_store>0</show_in_store>
1794
  </delete_contact>
1795
+ <advanced_title translate="label" module="connector">
1796
+ <label>Advanced</label>
1797
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1798
+ <sort_order>40</sort_order>
1799
+ <show_in_default>1</show_in_default>
1800
+ <show_in_website>1</show_in_website>
1801
+ <show_in_store>0</show_in_store>
1802
+ </advanced_title>
1803
+ <setup_data_fields translate="label comment" module="connector">
1804
+ <label>Setup Data Fields</label>
1805
+ <frontend_model>connector/adminhtml_widget_button_setupdatafields</frontend_model>
1806
+ <sort_order>50</sort_order>
1807
+ <show_in_default>1</show_in_default>
1808
+ <show_in_website>1</show_in_website>
1809
+ <show_in_store>0</show_in_store>
1810
+ <comment>This will create data-fields and map them automatically.</comment>
1811
+ </setup_data_fields>
1812
+ <reimport_orders module="connector" translate="label">
1813
+ <label>Reimport Order Data</label>
1814
+ <frontend_model>connector/adminhtml_widget_button_reimportorders</frontend_model>
1815
+ <sort_order>60</sort_order>
1816
+ <show_in_default>1</show_in_default>
1817
+ <show_in_website>1</show_in_website>
1818
+ <show_in_store>0</show_in_store>
1819
+ <comment>Remport Order Transactional Data</comment>
1820
+ </reimport_orders>
1821
+ <suppressed_contacts module="connector" translate="label">
1822
+ <label>Update Supressed Contacts</label>
1823
+ <frontend_model>connector/adminhtml_widget_button_suppressedcontacts</frontend_model>
1824
+ <sort_order>70</sort_order>
1825
+ <show_in_default>1</show_in_default>
1826
+ <show_in_website>1</show_in_website>
1827
+ <show_in_store>0</show_in_store>
1828
+ <comment>Update All Contacts Who Historically Unsubscribed.</comment>
1829
+ </suppressed_contacts>
1830
+ <memory_limit translate="label comment" module="connector">
1831
  <label>Memory Limit</label>
1832
  <frontend_type>select</frontend_type>
1833
  <source_model>adminhtml/system_config_source_yesno</source_model>
1834
  <show_in_default>1</show_in_default>
1835
  <show_in_website>0</show_in_website>
1836
  <show_in_store>0</show_in_store>
1837
+ <sort_order>80</sort_order>
1838
  <comment>Set to NO to use system default memory.</comment>
1839
  </memory_limit>
1840
+ <batch_size translate="label comment" module="connector">
1841
  <label>Customer Sync Batch Size</label>
1842
  <frontend_type>text</frontend_type>
1843
  <show_in_default>1</show_in_default>
1844
  <show_in_website>1</show_in_website>
1845
  <show_in_store>0</show_in_store>
1846
+ <sort_order>90</sort_order>
1847
  <comment>Set the limit size for customers loaded in memory.</comment>
1848
  </batch_size>
1849
+ <debug_enabled translate="label comment" module="connector">
1850
  <label>Debug Mode</label>
1851
  <frontend_type>select</frontend_type>
1852
  <source_model>adminhtml/system_config_source_yesno</source_model>
1853
+ <sort_order>100</sort_order>
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
+ <comment>Set to YES to allow debug infomation to be saved in var/log directory.</comment>
1858
+ </debug_enabled>
1859
  </fields>
1860
  </admin>
1861
  </groups>
app/code/community/Dotdigitalgroup/Email/sql/.DS_Store ADDED
Binary file
app/code/{local → community}/Dotdigitalgroup/Email/sql/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/{local → community}/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-1.1.1-1.1.2.php RENAMED
File without changes
app/code/community/Dotdigitalgroup/Email/sql/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/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/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/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/connector_setup/mysql4-upgrade-2.0.3-2.0.4.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+
6
+ $installer->startSetup();
7
+
8
+
9
+ $installer->run("
10
+ ALTER TABLE `{$this->getTable('email_contact')}`
11
+ DROP INDEX `IDX_EMAIL_CONTACT_EMAIL`,
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
+ $installer->run("
28
+ ALTER TABLE `{$this->getTable('sales_flat_order')}`
29
+ DROP COLUMN `dotmailer_order_imported`;
30
+ ");
31
+
32
+
33
+
34
+ $installer->endSetup();
app/code/community/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-2.0.4-2.1.0.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+
6
+ $installer->startSetup();
7
+
8
+ $installer->run(
9
+ "DROP TABLE IF EXISTS {$this->getTable('email_send')};
10
+ CREATE TABLE `{$this->getTable('email_send')}` (
11
+ `email_send_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
12
+ `campaign_id` int(10) unsigned DEFAULT NULL,
13
+ `quote_id` int(10) unsigned DEFAULT NULL,
14
+ `email` varchar(255) DEFAULT NULL,
15
+ `message` varchar(255) DEFAULT NULL,
16
+ `customer_id` int(10) unsigned DEFAULT NULL,
17
+ `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
18
+ `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
19
+ `sent_at` datetime DEFAULT NULL,
20
+ `is_sent` smallint(5) unsigned DEFAULT NULL,
21
+ `store_id` smallint(5) unsigned DEFAULT NULL COMMENT 'Store Id',
22
+ PRIMARY KEY (`email_send_id`),
23
+ KEY `IDX_EMAIL_SEND_STORE_ID` (`store_id`),
24
+ KEY `IDX_EMAIL_SEND_CAMPAIGN_ID` (`campaign_id`),
25
+ KEY `IDX_EMAIL_SEND_EMAIL` (`email`),
26
+ KEY `IDX_EMAIL_SEND_IS_SENT` (`is_sent`),
27
+ CONSTRAINT `FK_EMAIL_SEND_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE
28
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Email Transactional Send';"
29
+ );
30
+
31
+
32
+
33
+ $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/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/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/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/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/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/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/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/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/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/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/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/frontend/base/default/layout/connector.xml CHANGED
@@ -15,7 +15,7 @@
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>
@@ -34,4 +34,71 @@
34
  <block type="connector/basket" name="email.basket" as="email.basket" template="connector/basket.phtml"/>
35
  </reference>
36
  </connector_email_basket>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  </layout>
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="connector/products.phtml"/>
19
  </reference>
20
  </connector_email_products>
21
  <connector_email_coupon>
34
  <block type="connector/basket" name="email.basket" as="email.basket" template="connector/basket.phtml"/>
35
  </reference>
36
  </connector_email_basket>
37
+ <connector_order_new>
38
+ <reference name="root">
39
+ <action method="setTemplate"><template>page/blank.phtml</template></action>
40
+ </reference>
41
+ <reference name="content">
42
+ <block type="connector/order" name="connector.order.new" as="connector.order.new" template="connector/sales/order/new.phtml"/>
43
+ </reference>
44
+ </connector_order_new>
45
+ <connector_order_update>
46
+ <reference name="root">
47
+ <action method="setTemplate"><template>page/blank.phtml</template></action>
48
+ </reference>
49
+ <reference name="content">
50
+ <block type="connector/order_update" name="connector.order.update" as="connector.order.update" template="connector/sales/order/update.phtml"/>
51
+ </reference>
52
+ </connector_order_update>
53
+ <connector_customer_new>
54
+ <reference name="root">
55
+ <action method="setTemplate"><template>page/blank.phtml</template></action>
56
+ </reference>
57
+ <reference name="content">
58
+ <block type="connector/customer" name="connector.customer.new" template="connector/customer/new.phtml" as="connector.customer.new"/>
59
+ </reference>
60
+ </connector_customer_new>
61
+ <connector_order_creditmemo>
62
+ <reference name="root">
63
+ <action method="setTemplate"><template>page/blank.phtml</template></action>
64
+ </reference>
65
+ <reference name="content">
66
+ <block type="connector/order_info" as="info" name="sales.order.info">
67
+ <block type="connector/order_creditmemo" name="sales.order.creditmemo">
68
+ <block type="connector/order_creditmemo_items" name="creditmemo_items" template="connector/sales/order/creditmemo/items.phtml">
69
+ <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>sales/order/creditmemo/items/renderer/default.phtml</template></action>
70
+ <action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>sales/order/creditmemo/items/renderer/default.phtml</template></action>
71
+ <block type="sales/order_creditmemo_totals" name="creditmemo_totals" template="sales/order/totals.phtml">
72
+ <action method="setLabelProperties"><value>colspan="6" class="a-right"</value></action>
73
+ <action method="setValueProperties"><value>class="a-right"</value></action>
74
+ <block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml"/>
75
+ </block>
76
+
77
+ </block>
78
+ </block>
79
+ </block>
80
+ </reference>
81
+ </connector_order_creditmemo>
82
+ <connector_order_invoice>
83
+ <reference name="root">
84
+ <action method="setTemplate"><template>page/blank.phtml</template></action>
85
+ </reference>
86
+ <reference name="content">
87
+ <block type="connector/order_invoice" name="sales.order.invoice">
88
+ <block type="connector/order_invoice_items" name="invoice_items" template="connector/sales/order/invoice/items.phtml">
89
+ <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>sales/order/invoice/items/renderer/default.phtml</template></action>
90
+ <action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>sales/order/invoice/items/renderer/default.phtml</template></action>
91
+ <block type="sales/order_invoice_totals" name="invoice_totals" template="connector/sales/order/totals.phtml">
92
+ <action method="setLabelProperties"><value>colspan="4" class="a-right"</value></action>
93
+ <action method="setValueProperties"><value>class="last a-right"</value></action>
94
+ <block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml" />
95
+ </block>
96
+ <block type="sales/order_comments" name="invoice_comments" template="sales/order/comments.phtml" />
97
+ </block>
98
+ </block>
99
+ </reference>
100
+
101
+ <block type="core/text_list" name="additional.product.info" />
102
+ </connector_order_invoice>
103
+
104
  </layout>
app/design/frontend/base/default/template/connector/customer/new.phtml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $customer = $this->getNewCustomer();
3
+ ?>
4
+
5
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
6
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
7
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
8
+ <tr>
9
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
10
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
11
+
12
+ <tr>
13
+ <td>
14
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
15
+
16
+ <tbody>
17
+ <tr>
18
+ <td>
19
+ Use the following values when prompted to log in:
20
+ </td>
21
+ </tr>
22
+ <tr>
23
+
24
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; ">
25
+ Username : <?php echo $customer->getEmail();?>
26
+ </td>
27
+
28
+
29
+ </tr>
30
+ </tbody>
31
+ </table>
32
+ </td>
33
+
34
+ </tr>
35
+
36
+ </table>
37
+
38
+ </td>
39
+ </tr>
40
+
41
+ </table>
42
+ </div>
43
+ </body>
44
+
45
+
46
+
47
+
app/design/frontend/base/default/template/connector/customer/system/config/synccustomerdata.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ function validateVat() {
4
+ var elem = $('<?php echo $this->getHtmlId() ?>');
5
+
6
+ params = {
7
+ country: $('general_store_information_merchant_country').value,
8
+ vat: $('general_store_information_merchant_vat_number').value
9
+ };
10
+
11
+ new Ajax.Request('<?php echo $this->getAjaxUrl() ?>', {
12
+ parameters: params,
13
+ onSuccess: function(response) {
14
+ result = '<?php echo $this->__('VAT Number is Invalid') ?>';
15
+ try {
16
+ response = response.responseText;
17
+ if (response == 1) {
18
+ result = '<?php echo $this->__('VAT Number is Valid') ?>';
19
+ elem.removeClassName('fail').addClassName('success')
20
+ } else {
21
+ elem.removeClassName('success').addClassName('fail')
22
+ }
23
+ } catch (e) {
24
+ elem.removeClassName('success').addClassName('fail')
25
+ }
26
+ $('validation_result').update(result);
27
+ }
28
+ });
29
+ }
30
+ //]]>
31
+ </script>
32
+ <button onclick="javascript:validateVat(); return false;" class="scalable" type="button" id="<?php echo $this->getHtmlId() ?>">
33
+ <span id="validation_result"><?php echo $this->escapeHtml($this->getButtonLabel()) ?></span>
34
+ </button>
app/design/frontend/base/default/template/{page/connector → connector}/products.phtml RENAMED
@@ -1,12 +1,9 @@
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>
 
 
 
1
  <?php
 
2
 
3
+ $productCollection = $this->getRecommendedProducts();
4
+ $listMode = $this->getMode();
5
+ $i = 0;
6
+ foreach ($productCollection as $key => $_product) :?>
7
  <?php $_product = Mage::getModel('catalog/product')->load($_product->getEntityId());?>
8
  <?php if($i == 0):?>
9
  <table border="0" bordercolor="#FFCC00" width="147" cellpadding="0" cellspacing="0" style='font-family:arial; border-collapse: collapse; font-size:12;'><tr>
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/sales/order/creditmemo.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->getChildHtml('creditmemo_items');
app/design/frontend/base/default/template/connector/sales/order/creditmemo/items.phtml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder() ?>
2
+ <?php foreach ($_order->getCreditmemosCollection() as $_creditmemo): ?>
3
+ <h3 class="table-caption"><?php echo $this->__('Items Refunded') ?></h3>
4
+
5
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
6
+ <thead>
7
+ <tr>
8
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Item</th>
9
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">SKU</th>
10
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Qty</th>
11
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Subtotal</th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
15
+ <?php $_items = $_creditmemo->getAllItems(); ?>
16
+ <?php foreach ($_items as $_item): ?>
17
+ <?php if ($_item->getOrderItem()->getParentItem()) continue;?>
18
+ <tr class="border">
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;" width="70%"><?php echo $_item->getName() ?></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 $_item->getSku();?></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 number_format($_item->getQty(), 0);?></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 $_order->formatPrice($_item->getRowTotal());?>
23
+ </tr>
24
+ <?php endforeach; ?>
25
+
26
+ </tbody>
27
+ <tfoot>
28
+ <tr>
29
+ <td></td>
30
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Subtotal') ?></td>
31
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getSubtotal()) ?></td>
32
+ </tr>
33
+ <?php
34
+
35
+ if ($_order->getDiscountAmount() > 0): ?>
36
+ <tr>
37
+ <td></td>
38
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Discount') ?></td>
39
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getDiscountAmount()) ?></td>
40
+ </tr>
41
+ <?php endif; ?>
42
+ <?php if ($_order->getShippingAmount() > 0): ?>
43
+ <tr>
44
+ <td></td>
45
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Shipping Amount') ?></td>
46
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getShippingAmount()) ?></td>
47
+ </tr>
48
+ <?php endif; ?>
49
+ <?php if ($_order->getTaxAmount() > 0): ?>
50
+ <tr>
51
+ <td></td>
52
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Tax Amount') ?></td>
53
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getTaxAmount()) ?></td>
54
+ </tr>
55
+ <?php endif; ?>
56
+ <tr bgcolor="#DEE5E8">
57
+ <td></td>
58
+ <td colspan="2" align="right" style="padding:3px 9px"><strong><big><?php echo Mage::helper('sales')->__('Grand Total') ?></big></strong></td>
59
+ <td align="right" style="padding:6px 9px"><strong><big><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></big></strong></td>
60
+ </tr>
61
+ </tfoot>
62
+ </table>
63
+ <?php echo $this->getCommentsHtml($_creditmemo)?>
64
+ <?php endforeach; ?>
app/design/frontend/base/default/template/connector/sales/order/info.phtml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder() ?>
2
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
3
+
4
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
+ <html lang="en">
6
+ <head>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+ <title>Email Preview</title>
9
+ </head>
10
+ <body>
11
+ <style type="text/css">
12
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
13
+ </style>
14
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
15
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
16
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
17
+ <tr>
18
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
19
+ <!-- [ header starts here] -->
20
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
21
+
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
+
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
+
41
+ <?php echo $this->getPaymentInfoHtml() ?>
42
+
43
+ </td>
44
+ </tr>
45
+ </tbody>
46
+ </table>
47
+ </br>
48
+ <?php echo $this->getChildHtml('sales.order.creditmemo');?>
49
+ </td>
50
+ </tr>
51
+ </table>
52
+ </td>
53
+ </tr>
54
+ </table>
55
+ </div>
56
+ </body>
57
+ </html>
58
+
app/design/frontend/base/default/template/connector/sales/order/invoice.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->getChildHtml('invoice_items');
app/design/frontend/base/default/template/connector/sales/order/invoice/items.phtml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder() ?>
2
+
3
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>Email Preview</title>
8
+ </head>
9
+ <body>
10
+ <style type="text/css">
11
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
12
+ </style>
13
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
14
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
15
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
16
+ <tr>
17
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
18
+ <!-- [ header starts here] -->
19
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
20
+
21
+ <tr>
22
+ <td>
23
+ <?php foreach ($_order->getInvoiceCollection() as $_invoice): ?>
24
+ <h2 class="sub-title"><?php echo $this->__('Invoice #') ?><?php echo $_invoice->getIncrementId(); ?></h2>
25
+ <h3 class="table-caption"><?php echo $this->__('Items Invoiced') ?></h3>
26
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
27
+ <thead>
28
+ <tr>
29
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;"><?php echo $this->__('Product Name');?></th>
30
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;"><?php echo $this->__('SKU');?></th>
31
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;"><?php echo $this->__('Price');?></th>
32
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;"><?php echo $this->__('Qty Invoiced');?></th>
33
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;"><?php echo $this->__('Subtotal');?></th>
34
+ </tr>
35
+ </thead>
36
+
37
+ <?php $_items = $_invoice->getAllItems(); ?>
38
+ <?php $_count = count($_items) ?>
39
+ <?php foreach ($_items as $_item): ?>
40
+ <?php if ($_item->getOrderItem()->getParentItem()) continue; ?>
41
+ <tbody>
42
+ <?php echo $this->getItemHtml($_item) ?>
43
+ </tbody>
44
+ <?php endforeach; ?>
45
+ <tfoot>
46
+ <?php //echo $this->getInvoiceTotalsHtml($_invoice)?>
47
+ </tfoot>
48
+ </table>
49
+ <?php echo $this->getInvoiceCommentsHtml($_invoice)?>
50
+ <?php endforeach; ?>
51
+
52
+ </tr>
53
+ </table>
54
+ </td>
55
+ </tr>
56
+ </table>
57
+ </div>
58
+ </body>
59
+ </html>
60
+
61
+
app/design/frontend/base/default/template/connector/sales/order/invoice/renderer/default.phtml ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_item = $this->getItem() ?>
2
+ <?php $_order = $this->getItem()->getOrderItem()->getOrder() ?>
3
+ <tr class="border" id="order-item-row-<?php echo $_item->getId() ?>">
4
+ <td><h4 class="product-name"><?php echo $this->htmlEscape($_item->getName()) ?></h4>
5
+ <?php if($_options = $this->getItemOptions()): ?>
6
+ <dl class="item-options">
7
+ <?php foreach ($_options as $_option) : ?>
8
+ <dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
9
+ <?php if (!$this->getPrintStatus()): ?>
10
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
11
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>>
12
+ <?php echo $_formatedOptionValue['value'] ?>
13
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
14
+ <div class="truncated_full_value">
15
+ <dl class="item-options">
16
+ <dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
17
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
18
+ </dl>
19
+ </div>
20
+ <?php endif; ?>
21
+ </dd>
22
+ <?php else: ?>
23
+ <dd><?php echo $this->htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?></dd>
24
+ <?php endif; ?>
25
+ <?php endforeach; ?>
26
+ </dl>
27
+ <?php endif; ?>
28
+ <?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
29
+ <?php if ($addInfoBlock) :?>
30
+ <?php echo $addInfoBlock->setItem($_item->getOrderItem())->toHtml(); ?>
31
+ <?php endif; ?>
32
+ <?php echo $this->htmlEscape($_item->getDescription()) ?>
33
+ <?php if($this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item->getOrderItem()) && $_item->getGiftMessageId()): ?>
34
+ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" onclick="return giftMessageToogle('<?php echo $_item->getId() ?>')"><?php echo $this->__('Gift Message') ?></a>
35
+ <?php endif; ?>
36
+ </td>
37
+ <td><?php echo $this->htmlEscape(Mage::helper('core/string')->splitInjection($this->getSku())) ?></td>
38
+ <td class="a-right">
39
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
40
+ <span class="price-excl-tax">
41
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
42
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
43
+ <span class="cart-price">
44
+ <?php endif; ?>
45
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
46
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
47
+ </span>
48
+ <?php endif; ?>
49
+ <?php endif; ?>
50
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
51
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
52
+ <?php else: ?>
53
+ <span class="cart-price">
54
+ <?php endif; ?>
55
+
56
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
57
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
58
+ <?php else: ?>
59
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()) ?>
60
+ <?php endif; ?>
61
+
62
+ </span>
63
+
64
+
65
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
66
+
67
+ <span class="cart-tax-info" id="eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
68
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
69
+ <small>
70
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
71
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
72
+ <?php endforeach; ?>
73
+ </small>
74
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
75
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
76
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></small></span>
77
+ <?php endforeach; ?>
78
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
79
+ <small>
80
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
81
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
82
+ <?php endforeach; ?>
83
+ </small>
84
+ <?php endif; ?>
85
+ </span>
86
+
87
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
88
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
89
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?></span>
90
+ </span>
91
+ <?php endif; ?>
92
+ <?php endif; ?>
93
+ </span>
94
+ <br />
95
+ <?php endif; ?>
96
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
97
+ <span class="price-incl-tax">
98
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
99
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
100
+ <span class="cart-price">
101
+ <?php endif; ?>
102
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
103
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
104
+ </span>
105
+ <?php endif; ?>
106
+ <?php endif; ?>
107
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($this->getItem()); ?>
108
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
109
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
110
+ <?php else: ?>
111
+ <span class="cart-price">
112
+ <?php endif; ?>
113
+
114
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
115
+ <?php echo $this->getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
116
+ <?php else: ?>
117
+ <?php echo $this->getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
118
+ <?php endif; ?>
119
+
120
+ </span>
121
+
122
+
123
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
124
+
125
+ <span class="cart-tax-info" id="unit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
126
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
127
+ <small>
128
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
129
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
130
+ <?php endforeach; ?>
131
+ </small>
132
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
133
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
134
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></small></span>
135
+ <?php endforeach; ?>
136
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
137
+ <small>
138
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
139
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
140
+ <?php endforeach; ?>
141
+ </small>
142
+ <?php endif; ?>
143
+ </span>
144
+
145
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
146
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
147
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?></span>
148
+ </span>
149
+ <?php endif; ?>
150
+ <?php endif; ?>
151
+ </span>
152
+ <?php endif; ?>
153
+ </td>
154
+ <td class="a-center"><?php echo $_item->getQty()*1 ?> </td>
155
+ <td class="a-right">
156
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
157
+ <span class="price-excl-tax">
158
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
159
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
160
+ <span class="cart-price">
161
+ <?php endif; ?>
162
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
163
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
164
+ </span>
165
+ <?php endif; ?>
166
+ <?php endif; ?>
167
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
168
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
169
+ <?php else: ?>
170
+ <span class="cart-price">
171
+ <?php endif; ?>
172
+
173
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
174
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
175
+ <?php else: ?>
176
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
177
+ <?php endif; ?>
178
+
179
+ </span>
180
+
181
+
182
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
183
+
184
+ <span class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
185
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
186
+ <small>
187
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
188
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
189
+ <?php endforeach; ?>
190
+ </small>
191
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
192
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
193
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></small></span>
194
+ <?php endforeach; ?>
195
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
196
+ <small>
197
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
198
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
199
+ <?php endforeach; ?>
200
+ </small>
201
+ <?php endif; ?>
202
+ </span>
203
+
204
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
205
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
206
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?></span>
207
+ </span>
208
+ <?php endif; ?>
209
+ <?php endif; ?>
210
+ </span>
211
+ <br />
212
+ <?php endif; ?>
213
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
214
+ <span class="price-incl-tax">
215
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
216
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
217
+ <span class="cart-price">
218
+ <?php endif; ?>
219
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
220
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
221
+ </span>
222
+ <?php endif; ?>
223
+ <?php endif; ?>
224
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
225
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
226
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
227
+ <?php else: ?>
228
+ <span class="cart-price">
229
+ <?php endif; ?>
230
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
231
+ <?php echo $this->getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
232
+ <?php else: ?>
233
+ <?php echo $this->getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxRowDisposition()) ?>
234
+ <?php endif; ?>
235
+
236
+ </span>
237
+
238
+
239
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
240
+
241
+ <span class="cart-tax-info" id="subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
242
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
243
+ <small>
244
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
245
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
246
+ <?php endforeach; ?>
247
+ </small>
248
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
249
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
250
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></small></span>
251
+ <?php endforeach; ?>
252
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
253
+ <small>
254
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
255
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
256
+ <?php endforeach; ?>
257
+ </small>
258
+ <?php endif; ?>
259
+ </span>
260
+
261
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
262
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
263
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?></span>
264
+ </span>
265
+ <?php endif; ?>
266
+ <?php endif; ?>
267
+
268
+
269
+
270
+ </span>
271
+ <?php endif; ?>
272
+ </td>
273
+ </tr>
app/design/frontend/base/default/template/connector/sales/order/new.phtml ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_order = $this->getNewOrder();
3
+ $storeId = Mage::app()->getStore()->getId();
4
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($_order->getPayment())
5
+ ->setIsSecureMode(true);
6
+ $paymentBlock->getMethod()->setStore($storeId);
7
+ $paymentBlockHtml = $paymentBlock->toHtml();
8
+ ?>
9
+ <!--body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }-->
10
+
11
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
12
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
13
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
14
+ <tr>
15
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
16
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
17
+
18
+ <tr>
19
+ <td>
20
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
21
+ <thead>
22
+ <tr>
23
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
24
+ <th width="10"></th>
25
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
26
+ </tr>
27
+ </thead>
28
+ <tbody>
29
+ <tr>
30
+ <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;">
31
+ <?php echo $_order->getBillingAddress()->format('html');?>
32
+ </td>
33
+ <td>&nbsp;</td>
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 $paymentBlockHtml;?>
36
+ </td>
37
+ </tr>
38
+ </tbody>
39
+ </table>
40
+ <br/>
41
+ <?php
42
+
43
+ if($_order->getIsNotVirtual()):?>
44
+
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
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
70
+ <thead>
71
+ <tr>
72
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Item</th>
73
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">SKU</th>
74
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Qty</th>
75
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Subtotal</th>
76
+ </tr>
77
+ </thead>
78
+ <tbody>
79
+
80
+
81
+ <?php $i=0; foreach ($_order->getAllItems() as $_item): $i++ ?>
82
+ <?php
83
+ if($_item->getParentItemId()) continue;?>
84
+ <tr <?php echo $i%2?'bgcolor="#eeeded"':'' ?>>
85
+ <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>
86
+ <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>
87
+ <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>
88
+ <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;">
89
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
90
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
91
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
92
+ <?php endif; ?>
93
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
94
+ <?php echo $_order->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
95
+ <?php else: ?>
96
+ <?php echo $_order->formatPrice($_item->getRowTotal()) ?>
97
+ <?php endif; ?>
98
+
99
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
100
+ <br />
101
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
102
+ <small>
103
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
104
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
105
+ <?php endforeach; ?>
106
+ </small>
107
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
108
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
109
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
110
+ <?php endforeach; ?>
111
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
112
+ <small>
113
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
114
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
115
+ <?php endforeach; ?>
116
+ </small>
117
+ <?php endif; ?>
118
+
119
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
120
+ <br />
121
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $_order->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
122
+ <?php endif; ?>
123
+ <?php endif; ?>
124
+ <?php endif; ?>
125
+
126
+
127
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
128
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
129
+ <br /><span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
130
+ <?php endif; ?>
131
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
132
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
133
+ <?php echo $_order->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
134
+ <?php else: ?>
135
+ <?php echo $_order->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
136
+ <?php endif; ?>
137
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
138
+ <br />
139
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
140
+ <small>
141
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
142
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
143
+ <?php endforeach; ?>
144
+ </small>
145
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
146
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
147
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
148
+ <?php endforeach; ?>
149
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
150
+ <small>
151
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
152
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
153
+ <?php endforeach; ?>
154
+ </small>
155
+ <?php endif; ?>
156
+
157
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
158
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $_order->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
159
+ <?php endif; ?>
160
+ <?php endif; ?>
161
+ <?php endif; ?>
162
+ </td>
163
+ </tr>
164
+ <?php endforeach ?>
165
+
166
+ </tbody>
167
+ <tfoot>
168
+
169
+ <tr>
170
+ <td></td>
171
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Subtotal') ?></td>
172
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getSubtotal()) ?></td>
173
+ </tr>
174
+ <?php
175
+
176
+ if ($_order->getDiscountAmount() > 0): ?>
177
+ <tr>
178
+ <td></td>
179
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Discount') ?></td>
180
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getDiscountAmount()) ?></td>
181
+ </tr>
182
+ <?php endif; ?>
183
+ <?php if ($_order->getShippingAmount() > 0): ?>
184
+ <tr>
185
+ <td></td>
186
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Shipping Amount') ?></td>
187
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getShippingAmount()) ?></td>
188
+ </tr>
189
+ <?php endif; ?>
190
+ <?php if ($_order->getTaxAmount() > 0): ?>
191
+ <tr>
192
+ <td></td>
193
+ <td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Tax Amount') ?></td>
194
+ <td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getTaxAmount()) ?></td>
195
+ </tr>
196
+ <?php endif; ?>
197
+ <tr bgcolor="#DEE5E8">
198
+ <td></td>
199
+ <td colspan="2" align="right" style="padding:3px 9px"><strong><big><?php echo Mage::helper('sales')->__('Grand Total') ?></big></strong></td>
200
+ <td align="right" style="padding:6px 9px"><strong><big><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></big></strong></td>
201
+ </tr>
202
+ </tfoot>
203
+ </table>
204
+ </td>
205
+ </tr>
206
+ </table>
207
+ </td>
208
+ </tr>
209
+ </table>
210
+ </div>
211
+ </body>
app/design/frontend/base/default/template/connector/sales/order/totals.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php foreach ($this->getTotals() as $_code => $_total): ?>
2
+ <?php if ($_total->getBlockName()): ?>
3
+ <?php echo $this->getChildHtml($_total->getBlockName(), false); ?>
4
+ <?php else:?>
5
+ <tr class="<?php echo $_code?>">
6
+ <td colspan="2" align="right" style="padding:3px 9px">
7
+ <?php if ($_total->getStrong()):?>
8
+ <strong><?php echo $this->escapeHtml($_total->getLabel());?></strong>
9
+ <?php else:?>
10
+ <?php echo $this->escapeHtml($_total->getLabel());?>
11
+ <?php endif?>
12
+ </td>
13
+ <td align="right" style="padding:3px 9px">
14
+ <?php if ($_total->getStrong()):?>
15
+ <strong><?php echo $this->formatValue($_total) ?></strong>
16
+ <?php else:?>
17
+ <?php echo $this->formatValue($_total) ?>
18
+ <?php endif?>
19
+ </td>
20
+ </tr>
21
+ <?php endif?>
22
+ <?php endforeach?>
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 @@
1
- <?php echo $this->getChildHtml('content');?>
1
+ <?php echo $this->getChildHtml('content');
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,18 @@
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>2.0.4</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>Dropping number of subscribers.</notes>
12
  <authors><author><name>Calin Diacon</name><user>cdiacon</user><email>cdiacon@gmail.com</email></author></authors>
13
+ <date>2014-01-14</date>
14
+ <time>13:27:39</time>
15
+ <contents><target name="magecommunity"><dir name="Dotdigitalgroup"><dir name="Email"><dir name="Block"><dir name="Adminhtml"><dir name="Advanced"><dir name="Admin"><file name="Contactsimported.php" hash="f1474a536719a27f9c97d77fdc071ac0"/><file name="Deletecontactids.php" hash="729e0227d63c8bdd1b3ea7128312d978"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="View.php" hash="fe35138d07d7edf823eb0ad7e6805b5d"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Ajaxvalidate.php" hash="8e755edd861892a9e68fd43a5450942b"/><file name="Bestsellers.php" hash="b2fa4ed00d2e30d9ea383f8374ba73be"/><file name="Couponinfo.php" hash="87eeef872835410ed7481019169a8d45"/><file name="Creditmemonew.php" hash="526045f9a469aad0212a04c0c0f84544"/><file name="Crosssell.php" hash="acc9de2192a54ce1a5baddd4d6e7c28b"/><file name="Customernew.php" hash="840431388af96ed7f7222f9db4fd020a"/><file name="Invoicenew.php" hash="421e986daf8513448d399e5699f7870d"/><file name="Lostbasket.php" hash="1d7ad7247b5b986100a052eceb19d7dc"/><file name="Mostviewed.php" hash="c5b304b1196cf4e724b9a42ce2bfb250"/><file name="Ordernew.php" hash="1b523afd79ef5e01ad12ca43fd56e6b8"/><file name="Orderupdate.php" hash="37ade5436b287bf8fc080b061c93ed4f"/><file name="Productpush.php" hash="bacafa6e33f0724253bf0deb40c0c90f"/><file name="Related.php" hash="dd1977a631753dbe35d42480aa900c6d"/><file name="Upsell.php" hash="fd126b8a610e8fc9a9e331431abb03f5"/></dir><file name="Gridlist.php" hash="4022c4af28efa8b521eae76da8781417"/><file name="Smsmessagefour.php" hash="6764248cd2dd0a1df8f8546ef581cefd"/><file name="Smsmessageone.php" hash="f99c4598125f337f5d02003e381466b0"/><file name="Smsmessagethree.php" hash="5deb67df50db7c640c7d8438cad05df6"/><file name="Smsmessagetwo.php" hash="4f886042f98e891a759c0b97a6e7eb05"/><file name="Synccustomerdata.php" hash="eebac512d913007da75631d2a1a08697"/><file name="Validator.php" hash="03288ddcb5cbf3234231d8af8f7723ff"/><file name="Waitingfield.php" hash="ad068a39d2ccb07affd67c8cd8584735"/><file name="Wrapper.php" hash="0a61b6dfb4983f0e9d15eca97e11f9d3"/></dir><file name="Recentlyviewed.php" hash="0295d3ffad0196ecc42124aad707b585"/></dir><dir name="Widget"><dir name="Button"><file name="Reimportorders.php" hash="25efce64ce01707e6f623a9ee165e77b"/><file name="Setupdatafields.php" hash="c4f5670c164ea03991263e9c4d945e91"/><file name="Suppressedcontacts.php" hash="74b66bd83ed53312ea7f74ce5795e590"/></dir></dir></dir><file name="Basket.php" hash="902338ab1cb1c8f4df59861394be3967"/><file name="Coupon.php" hash="6aaec59401eb7a4602dcb29db9d8c03d"/><file name="Customer.php" hash="b257f4375f47948d55f9dd7e8fd4393c"/><dir name="Order"><dir name="Creditmemo"><file name="Items.php" hash="27d9167dad29c7790ad58645f69e3646"/></dir><file name="Creditmemo.php" hash="fdfcdf3e9e1c3c70ff918a7d6e22ed2c"/><file name="Info.php" hash="8443321bdd35b4121fe63a8087cadf40"/><dir name="Invoice"><file name="Items.php" hash="af1d38a3cd72c75fc4f2e3ad46e6195e"/></dir><file name="Invoice.php" hash="750a5f937b784c0a2f884d7d220024a3"/></dir><file name="Order.php" hash="ae164f65893724dcc76092d0c682e764"/><file name="Products.php" hash="091bd0a56391c7fc1b94e96e11ea636c"/></dir><dir name="Helper"><file name="Data.php" hash="7716ae6f39a586e27e2a812344b0ddbf"/><file name="File.php" hash="2f12ca241e0c2243b59d8b3710e9ec90"/><file name="Recommended.php" hash="69bd19c4d22bd550f4db6e5c7b0d323c"/></dir><dir name="Model"><dir name="Abstract"><file name="Rest.php" hash="310fa6fc9e2d7f7eb762a73a062247a6"/></dir><dir name="Connector"><file name="Account.php" hash="97907f0a714c79f5d554e211c341e1ef"/><dir name="Api"><file name="Client.php" hash="394411f9097f7224b285d8ca7e23bb57"/></dir><file name="Campaign.php" hash="6812cec1cf639302f652e77534452fa4"/><file name="Customer.php" hash="b30e0d14aded8fba7c00aecfe83921cf"/><file name="Order.php" hash="ff01e7f16b2630a42b5fa11f335681ff"/><file name="Test.php" hash="7934213870c7a7ab1587b0d6c76d7edf"/></dir><file name="Cron.php" hash="2e43114240fc7a243eccc64653206eee"/><dir name="Customer"><file name="Contact.php" hash="4d676b3e64c793a0462abdc2d53c4434"/><file name="Guest.php" hash="93c474ea9249dde97580714577eeb23d"/><dir name="Wishlist"><file name="Item.php" hash="97ee7711a4dd1a361146c9679b6ebea2"/></dir><file name="Wishlist.php" hash="81c29f37f853f98103ab33a49a489b39"/></dir><dir name="Dynamic"><dir name="Product"><file name="Mapper.php" hash="63451cbd3d11523ba6d60f71a88d10f6"/></dir><file name="Recommended.php" hash="f7372d4f33b3586b021939b6993e3261"/></dir><dir name="Email"><file name="Contact.php" hash="569f8c1b4e89808ce8ed617340a51b38"/><file name="Order.php" hash="db88d06cece235778224ab663d5c106d"/><file name="Send.php" hash="068136ebeee6cf06014b666871fd1262"/></dir><dir name="Newsletter"><file name="Subscriber.php" hash="615f0eb815310705afb0344d4f67c7d0"/></dir><file name="Observer.php" hash="6383ff48e076ccb2862ef8b1c3e30f88"/><dir name="Resource"><dir name="Email"><dir name="Contact"><file name="Collection.php" hash="0721f74549e97323d9c6e472226e1cb9"/></dir><file name="Contact.php" hash="3c193df4c957e212cf7ad48ad86ef2a6"/><dir name="Order"><file name="Collection.php" hash="d91df4625cc1db125c1d40f9ca70c615"/></dir><file name="Order.php" hash="9a0f35812962ffc7c2a9afac62619bf5"/><dir name="Send"><file name="Collection.php" hash="ffec8f9fb2ca17442dc07b71d2c277d8"/></dir><file name="Send.php" hash="2777eec5d7a30ed5fad57746fa81c288"/></dir><file name="Setup.php" hash="e275a98c8e7b7c7c96487d249e74893d"/></dir><dir name="Sales"><dir name="Order"><file name="State.php" hash="37920779c169acf0cda019b8c1abedfa"/></dir><file name="Order.php" hash="0722db07b232fc1ae71e7345f9cde8c0"/><file name="Quote.php" hash="ec0138f2d084c78db5bb3fcec9a5a886"/><file name="Sms.php" hash="14dae975a1ded4f76507632f84e5dea3"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Syncschedule"><file name="Customer.php" hash="d0c9486102e133016d6f14a0282e3c1d"/></dir></dir><dir name="Source"><file name="Activebasket.php" hash="1ec34cf0f073f40c36f1918d4f38cbb0"/><file name="Addressbooks.php" hash="80af0afe345b73546bbab981aedddf78"/><file name="Campaigns.php" hash="8d3c24110eb1e0b8f4c5b2874887d375"/><file name="Datafields.php" hash="070b93c86ee1c942b3358e895054a404"/><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="Sendcampaignafter.php" hash="c3865e3a664ab7420b4d288f8e5b7672"/><file name="Timeperiod.php" hash="6f3d5907f6e6bdff3a6e0fae196fa78c"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConnectorController.php" hash="c0aed61d21a53d87659baa895e553970"/><file name="DebugController.php" hash="7f8444fb981e8a1673f8f580d224f290"/></dir><file name="CustomerController.php" hash="1f541d8609472ddd32dac0ce2b4391fe"/><file name="EmailController.php" hash="ce8622027af3a279dc16545acce5cd65"/><file name="OrderController.php" hash="a7911f87094f3f0255fcc917d021d85f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8e9d447d2cb3d2c5f10d6b0b608ebaba"/><file name="config.xml" hash="da33301175054baef9273e3ef1960ac0"/><file name="system.xml" hash="c0218c3ddb7c2c144f91fbad9de0a6f6"/></dir><dir name="sql"><dir name="connector_setup"><file name="mysql4-install-0.1.0.php" hash="bb1b5e52152e2f111d852c1649b7d1d9"/><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="dbab1d9af7a80d43b9ade3395420b3a9"/><file name="mysql4-upgrade-2.0.4-2.1.0.php" hash="959e134f7ff3d833499b93509a6ad6ed"/></dir><file name=".DS_Store" hash="d7fd6a1f2efc75ea6c79d6e208718a01"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="connector.xml" hash="aa8bc52a5fd2f3cffe3b0b9d8f976d90"/></dir><dir name="template"><dir name="connector"><file name="basket.phtml" hash="2dadd9e056a5a0267fb5a84e8d711fce"/><file name="coupon.phtml" hash="0e39fce43a6b3c4b45130996f1de90ff"/><dir name="customer"><file name="new.phtml" hash="9cc2d8fb4d8007df5a6f20fa3dc0dc1c"/><dir name="system"><dir name="config"><file name="synccustomerdata.phtml" hash="0f127f59f09194dd0b24bde9043e22de"/></dir></dir></dir><file name="price.phtml" hash="3600de0d5573415628823b3d1f397cca"/><file name="products.phtml" hash="a2139e8f875ecb7906aeaeae396b0a7c"/><file name="roi_code.phtml" hash="ee4150b30c808c2f6c803f87fa7355da"/><dir name="sales"><dir name="order"><dir name="creditmemo"><file name="items.phtml" hash="3c7560bf346a08d3b435f7823eb4233d"/></dir><file name="creditmemo.phtml" hash="37c56ea7911713219261e63d5ba47845"/><file name="info.phtml" hash="8cb155174b428bb902102f18867dccd6"/><dir name="invoice"><file name="items.phtml" hash="83975b71738f7e95bb2cb3c7ab6b1268"/><dir name="renderer"><file name="default.phtml" hash="6b169aad785564139fae81f63c8f5b55"/></dir></dir><file name="invoice.phtml" hash="f751287920624e0b5bf222acdffa5973"/><file name="new.phtml" hash="8b18e8e82f9d3957a38934fbcb1a8e25"/><file name="totals.phtml" hash="915578e433291d3639d5a091cbc98cc6"/></dir></dir><file name="tracking_code.phtml" hash="f82527b0485a58fb852a2d8028f4393d"/></dir><dir name="page"><file name="blank.phtml" hash="2ffd97981bddedac0e16dd27f42bff25"/></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>
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>