Version Notes
Release Notes:
- Currency Symbol added to Cost Fields
- Troubleshooting system implemented
- Customer Account Dashboard Improvements
- Subscribe/Unsubscribe to Newsletter and Interests (Lists)
- Bug Fixes
- Bad API Key fix
- Multi-store Support Improved
- Separate API keys per Store
- Abandoned Cart process runs per Store
- Improved support for Disabling of Module
- Disabling module stops calls to API and turns off custom blocks on front end
- Disable module per store
- Tested on Enterprise 1.13
Download this release
Release Info
Developer | Magento Core Team |
Extension | EmailDirect_Integration |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.3.1 to 1.5.0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Abandoned.php +31 -5
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Abandoned/Grid.php +101 -86
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Customer/Edit/Tab/Memberactivity.php +0 -73
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Memberactivity/Grid.php +0 -101
- app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Account.php +11 -10
- app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Fieldset/Hint.php +0 -4
- app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Addressmapfields.php +8 -9
- app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Button.php +7 -98
- app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Common.php +70 -72
- app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Mapfields.php +17 -18
- app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Shippingmapfields.php +18 -18
- app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Troubleshooting.php +92 -0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Convert/Profile/Export.php +1 -31
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting.php +96 -0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/Tabs.php +12 -0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View.php +79 -0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View/Form.php +10 -0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Download.php +43 -0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Info.php +42 -0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Log.php +38 -0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Submit.php +32 -0
- app/code/local/EmailDirect/Integration/Block/Checkout/Subscribe.php +13 -22
- app/code/local/EmailDirect/Integration/Block/Customer/Account/Dashboard/Info.php +27 -5
- app/code/local/EmailDirect/Integration/Block/Customer/Account/Lists.php +38 -144
- app/code/local/EmailDirect/Integration/Block/Customer/Newsletter.php +0 -17
- app/code/local/EmailDirect/Integration/Block/Email/Order/Items.php +0 -6
- app/code/local/EmailDirect/Integration/Block/Email/Order/Items/Order/Default.php +0 -59
- app/code/local/EmailDirect/Integration/Block/Email/Order/Items/Order/Grouped.php +0 -25
- app/code/local/EmailDirect/Integration/Helper/Data.php +489 -59
- app/code/local/EmailDirect/Integration/Helper/Fields.php +10 -15
- app/code/local/EmailDirect/Integration/Model/Custom/Collection.php +0 -37
- app/code/local/EmailDirect/Integration/Model/Observer.php +499 -322
- app/code/local/EmailDirect/Integration/Model/System/Config/Source/Abandoned.php +27 -27
- app/code/local/EmailDirect/Integration/Model/System/Config/Source/Abandonedlist.php +2 -0
- app/code/local/EmailDirect/Integration/Model/System/Config/Source/Additionallist.php +2 -8
- app/code/local/EmailDirect/Integration/Model/System/Config/Source/Checkoutsubscribe.php +6 -10
- app/code/local/EmailDirect/Integration/Model/System/Config/Source/Export/Batch.php +1 -6
- app/code/local/EmailDirect/Integration/Model/System/Config/Source/List.php +3 -8
- app/code/local/EmailDirect/Integration/Model/System/Config/Source/Maxtimes.php +4 -9
- app/code/local/EmailDirect/Integration/Model/System/Config/Source/Publication.php +3 -6
- app/code/local/EmailDirect/Integration/Model/System/Config/Source/Source.php +3 -6
- app/code/local/EmailDirect/Integration/Model/System/Config/Source/Time.php +2 -6
- app/code/local/EmailDirect/Integration/Model/Wrapper/Abandoned.php +9 -23
- app/code/local/EmailDirect/Integration/Model/Wrapper/Abstract.php +53 -0
- app/code/local/EmailDirect/Integration/Model/Wrapper/Database.php +3 -3
- app/code/local/EmailDirect/Integration/Model/Wrapper/Execute.php +69 -46
- app/code/local/EmailDirect/Integration/Model/Wrapper/Ftp.php +1 -1
- app/code/local/EmailDirect/Integration/Model/Wrapper/Lists.php +14 -24
- app/code/local/EmailDirect/Integration/Model/Wrapper/Orders.php +12 -71
- app/code/local/EmailDirect/Integration/Model/Wrapper/Publications.php +5 -9
- app/code/local/EmailDirect/Integration/Model/Wrapper/Relays.php +0 -66
- app/code/local/EmailDirect/Integration/Model/Wrapper/Sources.php +7 -8
- app/code/local/EmailDirect/Integration/Model/Wrapper/Subscribers.php +92 -0
- app/code/local/EmailDirect/Integration/Model/Wrapper/Suscribers.php +0 -165
- app/code/local/EmailDirect/Integration/controllers/AbandonedController.php +1 -1
- app/code/local/EmailDirect/Integration/controllers/Admin/AbandonedController.php +1 -1
- app/code/local/EmailDirect/Integration/controllers/Admin/TroubleshootingController.php +131 -0
- app/code/local/EmailDirect/Integration/controllers/Customer/AccountController.php +96 -29
- app/code/local/EmailDirect/Integration/controllers/ExportController.php +0 -11
- app/code/local/EmailDirect/Integration/etc/config.xml +28 -36
- app/code/local/EmailDirect/Integration/etc/system.xml +248 -243
- app/design/adminhtml/default/default/layout/emaildirect.xml +27 -24
- app/design/adminhtml/default/default/template/emaildirect/system/config/form/field/trouble.phtml +81 -0
- app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view.phtml +23 -0
- app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view/form.phtml +1 -0
- app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view/tab/download.phtml +13 -0
- app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view/tab/info.phtml +65 -0
- app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view/tab/log.phtml +11 -0
- app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view/tab/submit.phtml +57 -0
- app/design/frontend/base/default/layout/emaildirect.xml +11 -25
- app/design/frontend/base/default/template/emaildirect/boxes/additionalNewsletter.phtml +0 -17
- app/design/frontend/base/default/template/emaildirect/boxes/additionalNewsletterBox.phtml +0 -36
- app/design/frontend/base/default/template/emaildirect/boxes/generalNewsletter.phtml +0 -24
- app/design/frontend/base/default/template/emaildirect/boxes/generalNewsletterBox.phtml +0 -34
- app/design/frontend/base/default/template/emaildirect/boxes/generalNewsletterMediumBox.phtml +0 -22
- app/design/frontend/base/default/template/emaildirect/checkout/subscribe.phtml +2 -1
- app/design/frontend/base/default/template/emaildirect/customer/account/dashboard/info.phtml +25 -7
- app/design/frontend/base/default/template/emaildirect/customer/account/lists.phtml +37 -39
- package.xml +18 -5
- skin/adminhtml/default/default/emaildirect/emaildirect.css +22 -1
app/code/local/EmailDirect/Integration/Block/Adminhtml/Abandoned.php
CHANGED
@@ -6,19 +6,45 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned extends Mage_Adminhtml_B
|
|
6 |
public function __construct()
|
7 |
{
|
8 |
$this->_controller = 'adminhtml_abandoned';
|
9 |
-
|
10 |
|
11 |
if (Mage::helper('emaildirect')->getAbandonedEnabled())
|
12 |
{
|
13 |
$this->_headerText = "Abandoned Carts - Last Run: " . Mage::helper('emaildirect')->getAbandonedLastRunHtml();
|
14 |
|
15 |
$this->_addButton('run_now', array(
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
));
|
20 |
}
|
21 |
else
|
22 |
$this->_headerText = "Abandoned Carts - <span class='ab_ng'>Disabled</span>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
}
|
6 |
public function __construct()
|
7 |
{
|
8 |
$this->_controller = 'adminhtml_abandoned';
|
9 |
+
$this->_blockGroup = 'emaildirect';
|
10 |
|
11 |
if (Mage::helper('emaildirect')->getAbandonedEnabled())
|
12 |
{
|
13 |
$this->_headerText = "Abandoned Carts - Last Run: " . Mage::helper('emaildirect')->getAbandonedLastRunHtml();
|
14 |
|
15 |
$this->_addButton('run_now', array(
|
16 |
+
'label' => Mage::helper('emaildirect')->__('Run Now'),
|
17 |
+
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/run') .'\')',
|
18 |
+
));
|
|
|
19 |
}
|
20 |
else
|
21 |
$this->_headerText = "Abandoned Carts - <span class='ab_ng'>Disabled</span>";
|
22 |
+
|
23 |
+
parent::__construct();
|
24 |
+
$this->_removeButton('add');
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getStoreSwitcherHtml()
|
28 |
+
{
|
29 |
+
if (Mage::app()->isSingleStoreMode())
|
30 |
+
return '';
|
31 |
+
return $this->getChildHtml('store_switcher');
|
32 |
+
}
|
33 |
+
|
34 |
+
protected function _prepareLayout()
|
35 |
+
{
|
36 |
+
$this->setChild('store_switcher',
|
37 |
+
$this->getLayout()->createBlock('adminhtml/store_switcher')
|
38 |
+
->setUseConfirm(false)
|
39 |
+
->setSwitchUrl($this->getUrl('*/*/*', array('store'=>null)))
|
40 |
+
->setTemplate('report/store/switcher.phtml')
|
41 |
+
);
|
42 |
+
|
43 |
+
return parent::_prepareLayout();
|
44 |
+
}
|
45 |
+
|
46 |
+
public function getGridHtml()
|
47 |
+
{
|
48 |
+
return $this->getStoreSwitcherHtml() . parent::getGridHtml();
|
49 |
}
|
50 |
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Abandoned/Grid.php
CHANGED
@@ -3,7 +3,12 @@
|
|
3 |
class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
{
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
7 |
{
|
8 |
parent::__construct();
|
9 |
$this->setId('abandonedGrid');
|
@@ -15,59 +20,71 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
|
|
15 |
$this->setRowClickCallback('openGridRow');
|
16 |
}
|
17 |
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
$collection = $this->getCollection();
|
21 |
|
22 |
-
|
23 |
->addFieldToFilter('main_table.is_active', '1')
|
24 |
->addSubtotal($storeIds, $filter)
|
25 |
->addFieldToFilter('customer_email',array('notnull'=>1))
|
26 |
->setOrder('updated_at');
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
|
35 |
protected function _prepareCollection()
|
36 |
{
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
return parent::_prepareCollection();
|
55 |
}
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
}
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
|
70 |
-
|
71 |
{
|
72 |
$options = array();
|
73 |
|
@@ -88,22 +105,22 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
|
|
88 |
|
89 |
protected function _prepareColumns()
|
90 |
{
|
91 |
-
|
92 |
'header' =>Mage::helper('reports')->__('Customer First Name'),
|
93 |
'index' =>'customer_firstname'
|
94 |
-
|
95 |
|
96 |
-
|
97 |
'header' =>Mage::helper('reports')->__('Last Name'),
|
98 |
'index' =>'customer_lastname'
|
99 |
));
|
100 |
|
101 |
-
|
102 |
'header' =>Mage::helper('reports')->__('Email'),
|
103 |
'index' =>'customer_email'
|
104 |
));
|
105 |
|
106 |
-
|
107 |
'header' => Mage::helper('sales')->__('Customer Group'),
|
108 |
'index' => 'customer_group_id',
|
109 |
//'filter_index' => 'IFNULL(cust.group_id,0)',
|
@@ -112,7 +129,7 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
|
|
112 |
'options' => $this->getCustomerGroups()
|
113 |
));
|
114 |
|
115 |
-
|
116 |
'header' =>Mage::helper('reports')->__('Number of Items'),
|
117 |
'width' =>'80px',
|
118 |
'align' =>'right',
|
@@ -120,7 +137,7 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
|
|
120 |
'type' =>'number'
|
121 |
));
|
122 |
|
123 |
-
|
124 |
'header' =>Mage::helper('reports')->__('Quantity of Items'),
|
125 |
'width' =>'80px',
|
126 |
'align' =>'right',
|
@@ -128,19 +145,19 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
|
|
128 |
'type' =>'number'
|
129 |
));
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
'header' => Mage::helper('reports')->__('Subtotal'),
|
145 |
'width' => '80px',
|
146 |
'type' => 'currency',
|
@@ -150,7 +167,7 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
|
|
150 |
'rate' => $this->getRate($currencyCode),
|
151 |
));
|
152 |
|
153 |
-
|
154 |
'header' =>Mage::helper('reports')->__('Abandoned Date'),
|
155 |
'width' =>'170px',
|
156 |
'type' =>'datetime',
|
@@ -158,7 +175,7 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
|
|
158 |
'filter_index'=>'main_table.updated_at'
|
159 |
));
|
160 |
|
161 |
-
|
162 |
'header' =>Mage::helper('reports')->__('Minutes'),
|
163 |
'width' =>'100px',
|
164 |
'renderer' => 'EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_AbandonedMinutes',
|
@@ -169,13 +186,13 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
|
|
169 |
|
170 |
));
|
171 |
|
172 |
-
|
173 |
'header' =>Mage::helper('reports')->__('IP Address'),
|
174 |
'width' =>'80px',
|
175 |
'index' =>'remote_ip'
|
176 |
));
|
177 |
|
178 |
-
|
179 |
'header' =>Mage::helper('reports')->__('Date Sent to EmailDirect'),
|
180 |
//'width' =>'80px',
|
181 |
'index' =>'emaildirect_abandoned_date',
|
@@ -183,10 +200,10 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
|
|
183 |
|
184 |
));
|
185 |
|
186 |
-
|
187 |
-
|
188 |
|
189 |
-
|
190 |
array(
|
191 |
'header' => Mage::helper('emaildirect')->__('Action'),
|
192 |
'width' => '100',
|
@@ -211,40 +228,38 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
|
|
211 |
'renderer' => 'EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_Action',
|
212 |
'index' => 'stores',
|
213 |
'is_system' => true,
|
214 |
-
|
215 |
-
|
216 |
|
217 |
-
|
218 |
-
|
219 |
|
220 |
-
|
221 |
-
|
222 |
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
return $this;
|
227 |
|
228 |
-
|
229 |
-
|
230 |
|
231 |
-
|
232 |
'label' => Mage::helper('emaildirect')->__('Send or Resend'),
|
233 |
'url' => $this->getUrl('*/*/massSend')
|
234 |
));
|
235 |
|
236 |
-
|
237 |
-
return $this;
|
238 |
}
|
239 |
|
240 |
-
|
241 |
{
|
242 |
return $this->getUrl('*/*/grid', array('_current'=> true));
|
243 |
}
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
}
|
3 |
class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
{
|
5 |
|
6 |
+
/**
|
7 |
+
* ids of current stores
|
8 |
+
*/
|
9 |
+
protected $_storeIds = array();
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
{
|
13 |
parent::__construct();
|
14 |
$this->setId('abandonedGrid');
|
20 |
$this->setRowClickCallback('openGridRow');
|
21 |
}
|
22 |
|
23 |
+
/**
|
24 |
+
* storeIds setter
|
25 |
+
*
|
26 |
+
* @param array $storeIds
|
27 |
+
* @return Mage_Adminhtml_Block_Report_Grid_Shopcart_Abstract
|
28 |
+
*/
|
29 |
+
public function setStoreIds($storeIds)
|
30 |
+
{
|
31 |
+
$this->_storeIds = $storeIds;
|
32 |
+
return $this;
|
33 |
+
}
|
34 |
+
|
35 |
+
private function prepareForAbandonedReport($storeIds, $filter = null)
|
36 |
+
{
|
37 |
$collection = $this->getCollection();
|
38 |
|
39 |
+
$collection->addFieldToFilter('items_count', array('neq' => '0'))
|
40 |
->addFieldToFilter('main_table.is_active', '1')
|
41 |
->addSubtotal($storeIds, $filter)
|
42 |
->addFieldToFilter('customer_email',array('notnull'=>1))
|
43 |
->setOrder('updated_at');
|
44 |
+
if (is_array($storeIds) && !empty($storeIds))
|
45 |
+
{
|
46 |
+
$collection->addFieldToFilter('store_id', array('in' => $storeIds));
|
47 |
+
}
|
48 |
+
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
|
52 |
protected function _prepareCollection()
|
53 |
{
|
54 |
+
/** @var $collection Mage_Reports_Model_Resource_Quote_Collection */
|
55 |
+
$collection = Mage::getResourceModel('reports/quote_collection');
|
56 |
+
|
57 |
+
$filter = $this->getParam($this->getVarNameFilter(), array());
|
58 |
+
|
59 |
+
if ($filter)
|
60 |
+
{
|
61 |
+
$filter = base64_decode($filter);
|
62 |
+
parse_str(urldecode($filter), $data);
|
63 |
+
}
|
64 |
+
|
65 |
+
$this->setCollection($collection);
|
66 |
|
67 |
+
if (!empty($data))
|
68 |
+
$this->prepareForAbandonedReport($this->_storeIds, $data);
|
69 |
+
else
|
70 |
+
$this->prepareForAbandonedReport($this->_storeIds);
|
71 |
+
|
72 |
+
return parent::_prepareCollection();
|
|
|
73 |
}
|
74 |
|
75 |
+
protected function _addColumnFilterToCollection($column)
|
76 |
+
{
|
77 |
+
$field = ( $column->getFilterIndex() ) ? $column->getFilterIndex() : $column->getIndex();
|
78 |
+
$skip = array('subtotal', 'customer_name'/*, 'email', 'created_at', 'updated_at'*/);
|
79 |
|
80 |
+
if (in_array($field, $skip))
|
81 |
+
return $this;
|
|
|
82 |
|
83 |
+
parent::_addColumnFilterToCollection($column);
|
84 |
+
return $this;
|
85 |
+
}
|
86 |
|
87 |
+
private function getCustomerGroups($blank = false)
|
88 |
{
|
89 |
$options = array();
|
90 |
|
105 |
|
106 |
protected function _prepareColumns()
|
107 |
{
|
108 |
+
$this->addColumn('customer_firstname', array(
|
109 |
'header' =>Mage::helper('reports')->__('Customer First Name'),
|
110 |
'index' =>'customer_firstname'
|
111 |
+
));
|
112 |
|
113 |
+
$this->addColumn('customer_lastname', array(
|
114 |
'header' =>Mage::helper('reports')->__('Last Name'),
|
115 |
'index' =>'customer_lastname'
|
116 |
));
|
117 |
|
118 |
+
$this->addColumn('email', array(
|
119 |
'header' =>Mage::helper('reports')->__('Email'),
|
120 |
'index' =>'customer_email'
|
121 |
));
|
122 |
|
123 |
+
$this->addColumn('customer_group_id', array(
|
124 |
'header' => Mage::helper('sales')->__('Customer Group'),
|
125 |
'index' => 'customer_group_id',
|
126 |
//'filter_index' => 'IFNULL(cust.group_id,0)',
|
129 |
'options' => $this->getCustomerGroups()
|
130 |
));
|
131 |
|
132 |
+
$this->addColumn('items_count', array(
|
133 |
'header' =>Mage::helper('reports')->__('Number of Items'),
|
134 |
'width' =>'80px',
|
135 |
'align' =>'right',
|
137 |
'type' =>'number'
|
138 |
));
|
139 |
|
140 |
+
$this->addColumn('items_qty', array(
|
141 |
'header' =>Mage::helper('reports')->__('Quantity of Items'),
|
142 |
'width' =>'80px',
|
143 |
'align' =>'right',
|
145 |
'type' =>'number'
|
146 |
));
|
147 |
|
148 |
+
if ($this->getRequest()->getParam('website'))
|
149 |
+
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
150 |
+
else if ($this->getRequest()->getParam('group'))
|
151 |
+
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
152 |
+
else if ($this->getRequest()->getParam('store'))
|
153 |
+
$storeIds = array((int)$this->getRequest()->getParam('store'));
|
154 |
+
else
|
155 |
+
$storeIds = array();
|
156 |
+
|
157 |
+
$this->setStoreIds($storeIds);
|
158 |
+
$currencyCode = $this->getCurrentCurrencyCode();
|
159 |
+
|
160 |
+
$this->addColumn('subtotal', array(
|
161 |
'header' => Mage::helper('reports')->__('Subtotal'),
|
162 |
'width' => '80px',
|
163 |
'type' => 'currency',
|
167 |
'rate' => $this->getRate($currencyCode),
|
168 |
));
|
169 |
|
170 |
+
$this->addColumn('updated_at', array(
|
171 |
'header' =>Mage::helper('reports')->__('Abandoned Date'),
|
172 |
'width' =>'170px',
|
173 |
'type' =>'datetime',
|
175 |
'filter_index'=>'main_table.updated_at'
|
176 |
));
|
177 |
|
178 |
+
$this->addColumn('abandoned_minutes', array(
|
179 |
'header' =>Mage::helper('reports')->__('Minutes'),
|
180 |
'width' =>'100px',
|
181 |
'renderer' => 'EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_AbandonedMinutes',
|
186 |
|
187 |
));
|
188 |
|
189 |
+
$this->addColumn('remote_ip', array(
|
190 |
'header' =>Mage::helper('reports')->__('IP Address'),
|
191 |
'width' =>'80px',
|
192 |
'index' =>'remote_ip'
|
193 |
));
|
194 |
|
195 |
+
$this->addColumn('emaildirect_abandoned_date', array(
|
196 |
'header' =>Mage::helper('reports')->__('Date Sent to EmailDirect'),
|
197 |
//'width' =>'80px',
|
198 |
'index' =>'emaildirect_abandoned_date',
|
200 |
|
201 |
));
|
202 |
|
203 |
+
if (Mage::helper('emaildirect')->getAbandonedEnabled())
|
204 |
+
{
|
205 |
|
206 |
+
$this->addColumn('action',
|
207 |
array(
|
208 |
'header' => Mage::helper('emaildirect')->__('Action'),
|
209 |
'width' => '100',
|
228 |
'renderer' => 'EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_Action',
|
229 |
'index' => 'stores',
|
230 |
'is_system' => true,
|
231 |
+
));
|
232 |
+
}
|
233 |
|
234 |
+
//$this->addExportType('*/*/exportAbandonedCsv', Mage::helper('reports')->__('CSV'));
|
235 |
+
//$this->addExportType('*/*/exportAbandonedExcel', Mage::helper('reports')->__('Excel XML'));
|
236 |
|
237 |
+
return parent::_prepareColumns();
|
238 |
+
}
|
239 |
|
240 |
+
protected function _prepareMassaction()
|
241 |
+
{
|
242 |
+
if (!Mage::helper('emaildirect')->getAbandonedEnabled())
|
243 |
return $this;
|
244 |
|
245 |
+
$this->setMassactionIdField('post_id');
|
246 |
+
$this->getMassactionBlock()->setFormFieldName('id');
|
247 |
|
248 |
+
$this->getMassactionBlock()->addItem('send', array(
|
249 |
'label' => Mage::helper('emaildirect')->__('Send or Resend'),
|
250 |
'url' => $this->getUrl('*/*/massSend')
|
251 |
));
|
252 |
|
253 |
+
return $this;
|
|
|
254 |
}
|
255 |
|
256 |
+
public function getGridUrl()
|
257 |
{
|
258 |
return $this->getUrl('*/*/grid', array('_current'=> true));
|
259 |
}
|
260 |
|
261 |
+
public function getRowUrl($row)
|
262 |
+
{
|
263 |
+
return $this->getUrl('adminhtml/customer/edit', array('id'=>$row->getCustomerId(), 'active_tab'=>'cart'));
|
264 |
+
}
|
|
|
265 |
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Customer/Edit/Tab/Memberactivity.php
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class EmailDirect_Integration_Block_Adminhtml_Customer_Edit_Tab_Memberactivity
|
4 |
-
extends EmailDirect_Integration_Block_Adminhtml_Memberactivity_Grid
|
5 |
-
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
-
{
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Columns, that should be removed from grid
|
10 |
-
*
|
11 |
-
* @var array
|
12 |
-
*/
|
13 |
-
protected $_columnsToRemove = array('visitor_session_id', 'protocol', 'customer_id');
|
14 |
-
|
15 |
-
public function __construct()
|
16 |
-
{
|
17 |
-
parent::__construct();
|
18 |
-
$this->setFilterVisibility(FALSE);
|
19 |
-
$this->setSaveParametersInSession(FALSE);
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Defines after which tab, this tab should be rendered
|
24 |
-
*
|
25 |
-
* @return string
|
26 |
-
*/
|
27 |
-
public function getAfter()
|
28 |
-
{
|
29 |
-
return 'orders';
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Return Tab label
|
34 |
-
*
|
35 |
-
* @return string
|
36 |
-
*/
|
37 |
-
public function getTabLabel()
|
38 |
-
{
|
39 |
-
return $this->__('EmailDirect List Member Activity');
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Return Tab title
|
44 |
-
*
|
45 |
-
* @return string
|
46 |
-
*/
|
47 |
-
public function getTabTitle()
|
48 |
-
{
|
49 |
-
return $this->__('EmailDirect List Member Activity');
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Can show tab in tabs
|
54 |
-
*
|
55 |
-
* @return boolean
|
56 |
-
*/
|
57 |
-
public function canShowTab()
|
58 |
-
{
|
59 |
-
$customer = Mage::registry('current_customer');
|
60 |
-
return (bool)$customer->getId();
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Tab is hidden
|
65 |
-
*
|
66 |
-
* @return boolean
|
67 |
-
*/
|
68 |
-
public function isHidden()
|
69 |
-
{
|
70 |
-
//TODO: Hide if MageMonkey is disabled
|
71 |
-
return false;
|
72 |
-
}
|
73 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Memberactivity/Grid.php
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class EmailDirect_Integration_Block_Adminhtml_Memberactivity_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
-
{
|
5 |
-
|
6 |
-
public function __construct()
|
7 |
-
{
|
8 |
-
parent::__construct();
|
9 |
-
$this->setId('token_grid');
|
10 |
-
$this->setDefaultSort('id');
|
11 |
-
$this->setDefaultDir('DESC');
|
12 |
-
}
|
13 |
-
|
14 |
-
protected function _prepareCollection()
|
15 |
-
{
|
16 |
-
$customer = Mage::registry('current_customer');
|
17 |
-
$email = $customer->getEmail();
|
18 |
-
|
19 |
-
$api = Mage::getSingleton('emaildirect/wrapper_suscribers', array('apikey' => Mage::helper('emaildirect')->getApiKey($customer->getStore())));
|
20 |
-
$activity = array();
|
21 |
-
// $lists = $api->listsForEmail($email);
|
22 |
-
|
23 |
-
$activityData = array();
|
24 |
-
$history = $api->suscriberHistory($email);
|
25 |
-
foreach($history->Actions->HistoryAction as $activity){
|
26 |
-
$act['action'] = $activity->Action;
|
27 |
-
$act['details'] = $activity->Details;
|
28 |
-
$act['timestamp'] = $activity->Date;
|
29 |
-
if(isset($activity->Links->Link)) {
|
30 |
-
$act['url'] = $activity->Links->Link;
|
31 |
-
}
|
32 |
-
$activityData[] = $act;
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
// if(is_array($lists)){
|
38 |
-
// foreach($lists as $list){
|
39 |
-
// $activity []= $api->listMemberActivity($list, $email);
|
40 |
-
// }
|
41 |
-
//
|
42 |
-
// if(!empty($activity)){
|
43 |
-
// foreach($activity as $act){
|
44 |
-
//
|
45 |
-
// if(empty($act['data'][0])){
|
46 |
-
// continue;
|
47 |
-
// }
|
48 |
-
//
|
49 |
-
// $activityData []= $act['data'];
|
50 |
-
// }
|
51 |
-
// }
|
52 |
-
// }
|
53 |
-
|
54 |
-
$collection = Mage::getModel('emaildirect/custom_collection', array($activityData));
|
55 |
-
$this->setCollection($collection);
|
56 |
-
return parent::_prepareCollection();
|
57 |
-
}
|
58 |
-
|
59 |
-
protected function _prepareColumns()
|
60 |
-
{
|
61 |
-
|
62 |
-
$this->addColumn('action', array(
|
63 |
-
'header'=> Mage::helper('emaildirect')->__('Action'),
|
64 |
-
'index' => 'action',
|
65 |
-
'sortable' => false
|
66 |
-
));
|
67 |
-
$this->addColumn('details', array(
|
68 |
-
'header'=> Mage::helper('emaildirect')->__('Details'),
|
69 |
-
'index' => 'details',
|
70 |
-
'sortable' => false
|
71 |
-
));
|
72 |
-
$this->addColumn('url', array(
|
73 |
-
'header'=> Mage::helper('emaildirect')->__('Url'),
|
74 |
-
'index' => 'url',
|
75 |
-
'sortable' => false
|
76 |
-
));
|
77 |
-
// $this->addColumn('bounce_type', array(
|
78 |
-
// 'header'=> Mage::helper('emaildirect')->__('Bounce Type'),
|
79 |
-
// 'index' => 'bounce_type',
|
80 |
-
// 'sortable' => false
|
81 |
-
// ));
|
82 |
-
// $this->addColumn('campaign_id', array(
|
83 |
-
// 'header'=> Mage::helper('emaildirect')->__('Campaign ID'),
|
84 |
-
// 'index' => 'campaign_id',
|
85 |
-
// 'sortable' => false
|
86 |
-
// ));
|
87 |
-
$this->addColumn('timestamp', array(
|
88 |
-
'header'=> Mage::helper('emaildirect')->__('Timestamp'),
|
89 |
-
'index' => 'timestamp',
|
90 |
-
'sortable' => false
|
91 |
-
));
|
92 |
-
|
93 |
-
return parent::_prepareColumns();
|
94 |
-
}
|
95 |
-
|
96 |
-
public function getRowUrl($row)
|
97 |
-
{
|
98 |
-
return false;
|
99 |
-
}
|
100 |
-
|
101 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Account.php
CHANGED
@@ -1,20 +1,21 @@
|
|
1 |
<?php
|
2 |
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Account
|
4 |
-
|
5 |
{
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
15 |
|
16 |
$html .= '</ul>';
|
17 |
|
18 |
-
|
19 |
-
|
20 |
}
|
1 |
<?php
|
2 |
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Account
|
4 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
5 |
{
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
$values = $element->getValues();
|
9 |
|
10 |
+
$html = '<ul class="checkboxes">';
|
11 |
|
12 |
+
foreach($values as $dat)
|
13 |
+
{
|
14 |
+
$html .= "<li>{$dat['label']}</li>";
|
15 |
+
}
|
16 |
|
17 |
$html .= '</ul>';
|
18 |
|
19 |
+
return $html;
|
20 |
+
}
|
21 |
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Fieldset/Hint.php
CHANGED
@@ -1,9 +1,5 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
/**
|
4 |
-
* Renderer for SagePay banner in System Configuration
|
5 |
-
* @author Ebizmart Team <info@ebizmarts.com>
|
6 |
-
*/
|
7 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Fieldset_Hint
|
8 |
extends Mage_Adminhtml_Block_Abstract
|
9 |
implements Varien_Data_Form_Element_Renderer_Interface
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Fieldset_Hint
|
4 |
extends Mage_Adminhtml_Block_Abstract
|
5 |
implements Varien_Data_Form_Element_Renderer_Interface
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Addressmapfields.php
CHANGED
@@ -2,21 +2,20 @@
|
|
2 |
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Addressmapfields extends EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common
|
4 |
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
$this->addColumn('magento', array(
|
9 |
'label' => Mage::helper('emaildirect')->__('Billing Address'),
|
10 |
'style' => 'width:120px',
|
11 |
));
|
12 |
-
|
13 |
'label' => Mage::helper('emaildirect')->__('Emaildirect'),
|
14 |
'type' => 'options',
|
15 |
'options' => Mage::helper('emaildirect')->getEmailDirectColumnOptions(),
|
16 |
'style' => 'width:120px',
|
17 |
));
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
}
|
2 |
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Addressmapfields extends EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common
|
4 |
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->addColumn('magento', array(
|
|
|
8 |
'label' => Mage::helper('emaildirect')->__('Billing Address'),
|
9 |
'style' => 'width:120px',
|
10 |
));
|
11 |
+
$this->addColumn('emaildirect', array(
|
12 |
'label' => Mage::helper('emaildirect')->__('Emaildirect'),
|
13 |
'type' => 'options',
|
14 |
'options' => Mage::helper('emaildirect')->getEmailDirectColumnOptions(),
|
15 |
'style' => 'width:120px',
|
16 |
));
|
17 |
+
$this->_addAfter = false;
|
18 |
+
$this->_addButtonLabel = Mage::helper('emaildirect')->__('Add field');
|
19 |
+
parent::__construct();
|
20 |
+
}
|
21 |
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Button.php
CHANGED
@@ -8,7 +8,6 @@ class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Button ex
|
|
8 |
*/
|
9 |
public function __construct()
|
10 |
{
|
11 |
-
//echo "TTTTTTTTTTT";
|
12 |
parent::__construct();
|
13 |
$this->setTemplate('emaildirect/system/config/form/field/button.phtml');
|
14 |
}
|
@@ -19,101 +18,11 @@ class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Button ex
|
|
19 |
* @param Varien_Data_Form_Element_Abstract $element
|
20 |
* @return string
|
21 |
*/
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Enter description here...
|
32 |
-
*
|
33 |
-
* @param Varien_Data_Form_Element_Abstract $element
|
34 |
-
* @return string
|
35 |
-
*/
|
36 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
37 |
-
{
|
38 |
-
$id = $element->getHtmlId();
|
39 |
-
|
40 |
-
$useContainerId = $element->getData('use_container_id');
|
41 |
-
$html = '<tr id="row_' . $id . '">'
|
42 |
-
. '<td class="label"><label for="'.$id.'">'.$element->getLabel().'</label></td>';
|
43 |
-
|
44 |
-
//$isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
|
45 |
-
$isMultiple = $element->getExtType()==='multiple';
|
46 |
-
|
47 |
-
// replace [value] with [inherit]
|
48 |
-
$namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName());
|
49 |
-
|
50 |
-
$options = $element->getValues();
|
51 |
-
|
52 |
-
$addInheritCheckbox = false;
|
53 |
-
if ($element->getCanUseWebsiteValue()) {
|
54 |
-
$addInheritCheckbox = true;
|
55 |
-
$checkboxLabel = Mage::helper('adminhtml')->__('Use Website');
|
56 |
-
}
|
57 |
-
elseif ($element->getCanUseDefaultValue()) {
|
58 |
-
$addInheritCheckbox = true;
|
59 |
-
$checkboxLabel = Mage::helper('adminhtml')->__('Use Default');
|
60 |
-
}
|
61 |
-
|
62 |
-
if ($addInheritCheckbox) {
|
63 |
-
$inherit = $element->getInherit()==1 ? 'checked="checked"' : '';
|
64 |
-
if ($inherit) {
|
65 |
-
$element->setDisabled(true);
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
$html.= '<td class="value">';
|
70 |
-
$html.= $this->_getElementHtml($element);
|
71 |
-
if ($element->getComment()) {
|
72 |
-
$html.= '<p class="note"><span>'.$element->getComment().'</span></p>';
|
73 |
-
}
|
74 |
-
$html.= '</td>';
|
75 |
-
|
76 |
-
if ($addInheritCheckbox) {
|
77 |
-
|
78 |
-
$defText = $element->getDefaultValue();
|
79 |
-
if ($options) {
|
80 |
-
$defTextArr = array();
|
81 |
-
foreach ($options as $k=>$v) {
|
82 |
-
if ($isMultiple) {
|
83 |
-
if (is_array($v['value']) && in_array($k, $v['value'])) {
|
84 |
-
$defTextArr[] = $v['label'];
|
85 |
-
}
|
86 |
-
} elseif ($v['value']==$defText) {
|
87 |
-
$defTextArr[] = $v['label'];
|
88 |
-
break;
|
89 |
-
}
|
90 |
-
}
|
91 |
-
$defText = join(', ', $defTextArr);
|
92 |
-
}
|
93 |
-
|
94 |
-
// default value
|
95 |
-
$html.= '<td class="use-default">';
|
96 |
-
//$html.= '<input id="'.$id.'_inherit" name="'.$namePrefix.'[inherit]" type="checkbox" value="1" class="input-checkbox config-inherit" '.$inherit.' onclick="$(\''.$id.'\').disabled = this.checked">';
|
97 |
-
$html.= '<input id="'.$id.'_inherit" name="'.$namePrefix.'[inherit]" type="checkbox" value="1" class="checkbox config-inherit" '.$inherit.' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> ';
|
98 |
-
$html.= '<label for="'.$id.'_inherit" class="inherit" title="'.htmlspecialchars($defText).'">'.$checkboxLabel.'</label>';
|
99 |
-
$html.= '</td>';
|
100 |
-
}
|
101 |
-
|
102 |
-
$html.= '<td class="scope-label">';
|
103 |
-
if ($element->getScope()) {
|
104 |
-
$html .= $element->getScopeLabel();
|
105 |
-
}
|
106 |
-
$html.= '</td>';
|
107 |
-
|
108 |
-
$html.= '<td class="">';
|
109 |
-
if ($element->getHint()) {
|
110 |
-
$html.= '<div class="hint" >';
|
111 |
-
$html.= '<div style="display: none;">' . $element->getHint() . '</div>';
|
112 |
-
$html.= '</div>';
|
113 |
-
}
|
114 |
-
$html.= '</td>';
|
115 |
-
|
116 |
-
$html.= '</tr>';
|
117 |
-
return $html;
|
118 |
-
}
|
119 |
}
|
8 |
*/
|
9 |
public function __construct()
|
10 |
{
|
|
|
11 |
parent::__construct();
|
12 |
$this->setTemplate('emaildirect/system/config/form/field/button.phtml');
|
13 |
}
|
18 |
* @param Varien_Data_Form_Element_Abstract $element
|
19 |
* @return string
|
20 |
*/
|
21 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
22 |
+
{
|
23 |
+
$this->setElement($element);
|
24 |
+
$html = $this->_toHtml();
|
25 |
+
//$this->_arrayRowsCache = null; // doh, the object is used as singleton!
|
26 |
+
return $html;
|
27 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Common.php
CHANGED
@@ -3,77 +3,75 @@
|
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
4 |
{
|
5 |
/**
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$column = $this->_columns[$columnName];
|
50 |
-
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
}
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
4 |
{
|
5 |
/**
|
6 |
+
* Check if columns are defined, set template
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
parent::__construct();
|
12 |
+
$this->setTemplate('emaildirect/system/config/form/field/array.phtml');
|
13 |
+
}
|
14 |
+
/**
|
15 |
+
* Add a column to array-grid
|
16 |
+
*
|
17 |
+
* @param string $name
|
18 |
+
* @param array $params
|
19 |
+
*/
|
20 |
+
public function addColumn($name, $params)
|
21 |
+
{
|
22 |
+
$this->_columns[$name] = array(
|
23 |
+
'label' => empty($params['label']) ? 'Column' : $params['label'],
|
24 |
+
'size' => empty($params['size']) ? false : $params['size'],
|
25 |
+
'style' => empty($params['style']) ? null : $params['style'],
|
26 |
+
'class' => empty($params['class']) ? null : $params['class'],
|
27 |
+
'type' => empty($params['type']) ? null : $params['type'],
|
28 |
+
'options' => empty($params['options']) ? null : $params['options'],
|
29 |
+
'renderer' => false,
|
30 |
+
);
|
31 |
+
if ((!empty($params['renderer'])) && ($params['renderer'] instanceof Mage_Core_Block_Abstract)) {
|
32 |
+
$this->_columns[$name]['renderer'] = $params['renderer'];
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Render array cell for prototypeJS template
|
38 |
+
*
|
39 |
+
* @param string $columnName
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
protected function _renderCellTemplate($columnName)
|
43 |
+
{
|
44 |
+
if (empty($this->_columns[$columnName])) {
|
45 |
+
throw new Exception('Wrong column name specified.');
|
46 |
+
}
|
47 |
+
$column = $this->_columns[$columnName];
|
48 |
+
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
|
|
|
|
49 |
|
50 |
+
if ($column['renderer']) {
|
51 |
+
return $column['renderer']->setInputName($inputName)->setColumnName($columnName)->setColumn($column)
|
52 |
+
->toHtml();
|
53 |
+
}
|
54 |
+
|
55 |
+
if ($column['type'] == 'options')
|
56 |
+
{
|
57 |
+
//$name = $this->getColumn()->getName() ? $this->getColumn()->getName() : $this->getColumn()->getId();
|
58 |
+
$html = '<select name="' . $inputName . '"class="' .
|
59 |
+
(isset($column['class']) ? $column['class'] : 'input-text') . '"'.
|
60 |
+
(isset($column['style']) ? ' style="'.$column['style'] . '"' : '') . '>';
|
61 |
+
//$value = $row->getData($this->getColumn()->getIndex());
|
62 |
+
foreach ($column['options'] as $val => $label){
|
63 |
+
//$selected = ( ($val == $value && (!is_null($value))) ? ' selected="selected"' : '' );
|
64 |
+
$html .= '<option #{_selected_' . $this->escapeHtml($val) . '} value="' . $this->escapeHtml($val) . '">';
|
65 |
+
$html .= $this->escapeHtml($label) . '</option>';
|
66 |
+
}
|
67 |
+
$html.='</select>';
|
68 |
+
|
69 |
+
return $html;
|
70 |
+
}
|
71 |
+
|
72 |
+
return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}" ' .
|
73 |
+
($column['size'] ? 'size="' . $column['size'] . '"' : '') . ' class="' .
|
74 |
+
(isset($column['class']) ? $column['class'] : 'input-text') . '"'.
|
75 |
+
(isset($column['style']) ? ' style="'.$column['style'] . '"' : '') . '/>';
|
76 |
+
}
|
77 |
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Mapfields.php
CHANGED
@@ -2,21 +2,20 @@
|
|
2 |
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Mapfields extends EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common
|
4 |
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
}
|
2 |
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Mapfields extends EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common
|
4 |
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->addColumn('magento', array(
|
8 |
+
'label' => Mage::helper('emaildirect')->__('Customer'),
|
9 |
+
'style' => 'width:120px',
|
10 |
+
));
|
11 |
+
$this->addColumn('emaildirect', array(
|
12 |
+
'label' => Mage::helper('emaildirect')->__('Emaildirect'),
|
13 |
+
'style' => 'width:120px',
|
14 |
+
'type' => 'options',
|
15 |
+
'options' => Mage::helper('emaildirect')->getEmailDirectColumnOptions(),
|
16 |
+
));
|
17 |
+
$this->_addAfter = false;
|
18 |
+
$this->_addButtonLabel = Mage::helper('emaildirect')->__('Add field');
|
19 |
+
parent::__construct();
|
20 |
+
}
|
21 |
+
}
|
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Shippingmapfields.php
CHANGED
@@ -3,22 +3,22 @@
|
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Shippingmapfields extends EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common
|
4 |
{
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
}
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Shippingmapfields extends EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common
|
4 |
{
|
5 |
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
$this->addColumn('magento', array(
|
9 |
+
'label' => Mage::helper('emaildirect')->__('Shipping Field'),
|
10 |
+
'type' => 'options',
|
11 |
+
'options' => Mage::helper('emaildirect')->getShippingColumnOptions(),
|
12 |
+
'style' => 'width:120px',
|
13 |
+
));
|
14 |
+
$this->addColumn('emaildirect', array(
|
15 |
+
'label' => Mage::helper('emaildirect')->__('Emaildirect'),
|
16 |
+
'type' => 'options',
|
17 |
+
'options' => Mage::helper('emaildirect')->getEmailDirectColumnOptions(),
|
18 |
+
'style' => 'width:120px',
|
19 |
+
));
|
20 |
+
$this->_addAfter = false;
|
21 |
+
$this->_addButtonLabel = Mage::helper('emaildirect')->__('Add field');
|
22 |
+
parent::__construct();
|
23 |
+
}
|
24 |
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Troubleshooting.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Troubleshooting extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setTemplate('emaildirect/system/config/form/field/trouble.phtml');
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$this->setElement($element);
|
15 |
+
$html = $this->_toHtml();
|
16 |
+
return $html;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getStartDate()
|
20 |
+
{
|
21 |
+
$date = Mage::helper('emaildirect')->troubleConfig('start_date');
|
22 |
+
|
23 |
+
$minutes = round(abs(time() - strtotime($date)) / 60,0);
|
24 |
+
|
25 |
+
$date = Mage::helper('core')->formatTime($date, 'long', true);
|
26 |
+
|
27 |
+
$minutes = "<br />(" . Mage::helper('emaildirect')->timeElapsed2string(strtotime($date)) . " ago)";
|
28 |
+
|
29 |
+
return "{$date} {$minutes}";
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getEDirectInfo()
|
33 |
+
{
|
34 |
+
$active = Mage::helper('emaildirect')->config('active');
|
35 |
+
$setup = Mage::helper('emaildirect')->config('setup');
|
36 |
+
|
37 |
+
$class= 'ab_ok';
|
38 |
+
$msg = "Enabled";
|
39 |
+
|
40 |
+
if (!$setup)
|
41 |
+
{
|
42 |
+
$class = 'ab_ng';
|
43 |
+
$msg = "Invalid API Key";
|
44 |
+
}
|
45 |
+
else if (!$active)
|
46 |
+
{
|
47 |
+
$class = 'ab_ng';
|
48 |
+
$msg = "Disabled";
|
49 |
+
}
|
50 |
+
|
51 |
+
return "<span class='{$class}'>{$msg}</span>";
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getAbandonedInfo()
|
55 |
+
{
|
56 |
+
$active = Mage::helper('emaildirect')->config('active');
|
57 |
+
$setup = Mage::helper('emaildirect')->config('setup');
|
58 |
+
$sendit = Mage::helper('emaildirect')->config('sendabandoned');
|
59 |
+
$abandoned_setup = Mage::helper('emaildirect')->config('abandonedsetup');
|
60 |
+
|
61 |
+
$class= 'ab_ok';
|
62 |
+
$msg = "Enabled";
|
63 |
+
|
64 |
+
if (!$setup || !$active || !$sendit || !$abandoned_setup)
|
65 |
+
{
|
66 |
+
$class = 'ab_ng';
|
67 |
+
$msg = "Disabled";
|
68 |
+
}
|
69 |
+
|
70 |
+
return "<span class='{$class}'>{$msg}</span>";
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getLogInfo()
|
74 |
+
{
|
75 |
+
$helper = Mage::helper('emaildirect');
|
76 |
+
$file_size = $helper->getLogFileSize();
|
77 |
+
$formatted_size = $helper->formatSize($file_size);
|
78 |
+
|
79 |
+
$max_size = $helper->getMaxLogFileSize();
|
80 |
+
|
81 |
+
if ($file_size > $max_size || $file_size == 0)
|
82 |
+
$formatted_size = "<span class='log_size_warning'>{$formatted_size}</span>";
|
83 |
+
|
84 |
+
$file_date = $helper->getLogFilelastUpdate();
|
85 |
+
|
86 |
+
$last_update = $date = Mage::helper('core')->formatTime(date("Y-m-d H:i:s",$file_date), 'long', true);
|
87 |
+
|
88 |
+
$ago = $helper->timeElapsed2string($file_date);
|
89 |
+
|
90 |
+
return "emaildirect.log ({$formatted_size})<br />{$last_update}<br />({$ago} ago.)";
|
91 |
+
}
|
92 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Convert/Profile/Export.php
CHANGED
@@ -1,36 +1,5 @@
|
|
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 Mage
|
22 |
-
* @package Mage_Adminhtml
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
|
27 |
-
/**
|
28 |
-
* Convert profiles run block
|
29 |
-
*
|
30 |
-
* @category Mage
|
31 |
-
* @package Mage_Adminhtml
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
class Emaildirect_Integration_Block_Adminhtml_System_Convert_Profile_Export extends Mage_Adminhtml_Block_Abstract
|
35 |
{
|
36 |
public function __construct()
|
@@ -38,6 +7,7 @@ class Emaildirect_Integration_Block_Adminhtml_System_Convert_Profile_Export exte
|
|
38 |
parent::__construct();
|
39 |
$this->_init();
|
40 |
}
|
|
|
41 |
protected function _init()
|
42 |
{
|
43 |
$products = Mage::getModel('catalog/product')->getCollection();
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
class Emaildirect_Integration_Block_Adminhtml_System_Convert_Profile_Export extends Mage_Adminhtml_Block_Abstract
|
4 |
{
|
5 |
public function __construct()
|
7 |
parent::__construct();
|
8 |
$this->_init();
|
9 |
}
|
10 |
+
|
11 |
protected function _init()
|
12 |
{
|
13 |
$products = Mage::getModel('catalog/product')->getCollection();
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Emaildirect_Integration_Block_Adminhtml_Troubleshooting extends Mage_Adminhtml_Block_Template
|
4 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* ######################## TAB settings #################################
|
8 |
+
*/
|
9 |
+
public function getTabLabel()
|
10 |
+
{
|
11 |
+
return Mage::helper('sales')->__('Test1');
|
12 |
+
}
|
13 |
+
|
14 |
+
public function getTabTitle()
|
15 |
+
{
|
16 |
+
return Mage::helper('sales')->__('Test2');
|
17 |
+
}
|
18 |
+
|
19 |
+
public function canShowTab()
|
20 |
+
{
|
21 |
+
return true;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function isHidden()
|
25 |
+
{
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
|
29 |
+
public function __construct()
|
30 |
+
{
|
31 |
+
parent::__construct();
|
32 |
+
$this->setTemplate('emaildirect/troubleshooting/details.phtml');
|
33 |
+
}
|
34 |
+
|
35 |
+
private function getArrayData($data)
|
36 |
+
{
|
37 |
+
$output = "<table width='100%'><tr><th>Magento</th><th>EmailDirect</th></tr>";
|
38 |
+
foreach ($data as $row)
|
39 |
+
{
|
40 |
+
$output .= "<tr><td>{$row['magento']}</td><td>{$row['emaildirect']}</td></tr>";
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
$output .= "</table>";
|
45 |
+
|
46 |
+
return $output;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getEnvironmentInfo()
|
50 |
+
{
|
51 |
+
$data = array(
|
52 |
+
'Magento Version' => Mage::getVersion(),
|
53 |
+
'Magento Edition' => Mage::getEdition(),
|
54 |
+
'EmailDirect Version' => (string) Mage::getConfig()->getNode('modules/EmailDirect_Integration/version'),
|
55 |
+
'Website URL' => Mage::getBaseUrl(),
|
56 |
+
'PHP Version' => phpversion(),
|
57 |
+
'Server Software' => $_SERVER['SERVER_SOFTWARE']
|
58 |
+
|
59 |
+
);
|
60 |
+
return $data;
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getConfigurationInfo()
|
64 |
+
{
|
65 |
+
$data = array();
|
66 |
+
|
67 |
+
$store = Mage::app()->getStore();
|
68 |
+
|
69 |
+
$e_config = Mage::getStoreConfig("emaildirect/general", $store);
|
70 |
+
|
71 |
+
foreach ($e_config as $key => $value)
|
72 |
+
{
|
73 |
+
if (is_array($value))
|
74 |
+
{
|
75 |
+
// Ignore for now
|
76 |
+
}
|
77 |
+
else
|
78 |
+
{
|
79 |
+
$test_data = @unserialize($value);
|
80 |
+
if ($test_data !== false)
|
81 |
+
$data[$key] = $this->getArrayData($test_data);
|
82 |
+
else
|
83 |
+
$data[$key] = $value;;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
return $data;
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getLogFile()
|
91 |
+
{
|
92 |
+
$log_file = Mage::getBaseDir('log') . DS. "emaildirect.log";
|
93 |
+
|
94 |
+
return file_get_contents($log_file);
|
95 |
+
}
|
96 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/Tabs.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Block_Adminhtml_Troubleshooting_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('troubleshooting_view_tabs');
|
9 |
+
$this->setDestElementId('troubleshooting_view');
|
10 |
+
$this->setTitle(Mage::helper('emaildirect')->__('Troubleshooting'));
|
11 |
+
}
|
12 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Block_Adminhtml_Troubleshooting_View extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
$this->_blockGroup = "emaildirect";
|
9 |
+
$this->_controller = 'adminhtml_troubleshooting';
|
10 |
+
$this->_mode = 'view';
|
11 |
+
|
12 |
+
parent::__construct();
|
13 |
+
|
14 |
+
$this->_removeButton('delete');
|
15 |
+
$this->_removeButton('reset');
|
16 |
+
$this->_removeButton('save');
|
17 |
+
$this->setId('troubleshooting_view');
|
18 |
+
|
19 |
+
$this->_addButton('info_send', array(
|
20 |
+
'label' => Mage::helper('sales')->__('Send to EmailDirect'),
|
21 |
+
'onclick' => 'ed_form.submit();',
|
22 |
+
));
|
23 |
+
|
24 |
+
$onClick = "setLocation('{$this->getDownloadUrl()}')";
|
25 |
+
$this->_addButton('info_download', array(
|
26 |
+
'label' => Mage::helper('sales')->__('Download Report'),
|
27 |
+
'onclick' => $onClick,
|
28 |
+
));
|
29 |
+
$this->setTemplate('emaildirect/troubleshooting/view.phtml');
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getHeaderText()
|
33 |
+
{
|
34 |
+
return Mage::helper('emaildirect')->__('Information to send to EmailDirect');
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getUrl($params='', $params2=array())
|
38 |
+
{
|
39 |
+
//$params2['order_id'] = $this->getOrderId();
|
40 |
+
return parent::getUrl($params, $params2);
|
41 |
+
}
|
42 |
+
|
43 |
+
public function getDownloadUrl()
|
44 |
+
{
|
45 |
+
return $this->getUrl('emaildirect/admin_troubleshooting/download/');
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getBackUrl()
|
49 |
+
{
|
50 |
+
return $this->getUrl('adminhtml/system_config/edit/',array('section' => 'emaildirect'));
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getLogFileName()
|
54 |
+
{
|
55 |
+
return Mage::helper('emaildirect')->getLogFileName();
|
56 |
+
}
|
57 |
+
|
58 |
+
public function getTroubleEmail()
|
59 |
+
{
|
60 |
+
return Mage::helper('emaildirect')->troubleConfig('email');
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getLogFileSize()
|
64 |
+
{
|
65 |
+
return Mage::helper('emaildirect')->getLogFileSize();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getMaxLogFileSize()
|
69 |
+
{
|
70 |
+
return Mage::helper('emaildirect')->formatSize(Mage::helper('emaildirect')->getMaxLogFileSize());
|
71 |
+
}
|
72 |
+
|
73 |
+
public function isLogFileTooLarge()
|
74 |
+
{
|
75 |
+
if ($this->getLogFileSize() > Mage::helper('emaildirect')->getMaxLogFileSize())
|
76 |
+
return true;
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View/Form.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Block_Adminhtml_Troubleshooting_View_Form extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->setTemplate('emaildirect/troubleshooting/view/form.phtml');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Download.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Block_Adminhtml_Troubleshooting_View_Tab_Download
|
4 |
+
extends Mage_Adminhtml_Block_Template
|
5 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
+
{
|
7 |
+
|
8 |
+
public function getTabLabel()
|
9 |
+
{
|
10 |
+
return Mage::helper('sales')->__('Download Report');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getTabTitle()
|
14 |
+
{
|
15 |
+
return Mage::helper('sales')->__('Download Report');
|
16 |
+
}
|
17 |
+
|
18 |
+
public function canShowTab()
|
19 |
+
{
|
20 |
+
return true;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function isHidden()
|
24 |
+
{
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function __construct()
|
29 |
+
{
|
30 |
+
parent::__construct();
|
31 |
+
$this->setTemplate('emaildirect/troubleshooting/view/tab/download.phtml');
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getTroubleEmail()
|
35 |
+
{
|
36 |
+
return Mage::helper('emaildirect')->troubleConfig('email');
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getTroubleSubject()
|
40 |
+
{
|
41 |
+
return Mage::helper('emaildirect')->troubleConfig('subject');
|
42 |
+
}
|
43 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Info.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Block_Adminhtml_Troubleshooting_View_Tab_Info
|
4 |
+
extends Mage_Adminhtml_Block_Template
|
5 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
+
{
|
7 |
+
public function getTabLabel()
|
8 |
+
{
|
9 |
+
return Mage::helper('sales')->__('Configuration Info');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getTabTitle()
|
13 |
+
{
|
14 |
+
return Mage::helper('sales')->__('Configuration Information');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function canShowTab()
|
18 |
+
{
|
19 |
+
return true;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function isHidden()
|
23 |
+
{
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
+
parent::__construct();
|
30 |
+
$this->setTemplate('emaildirect/troubleshooting/view/tab/info.phtml');
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getEnvironmentInfo()
|
34 |
+
{
|
35 |
+
return Mage::helper('emaildirect')->getEnvironmentInfo();
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getConfigurationInfo()
|
39 |
+
{
|
40 |
+
return Mage::helper('emaildirect')->getConfigurationInfo();
|
41 |
+
}
|
42 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Log.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Block_Adminhtml_Troubleshooting_View_Tab_Log
|
4 |
+
extends Mage_Adminhtml_Block_Template
|
5 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
+
{
|
7 |
+
|
8 |
+
public function getTabLabel()
|
9 |
+
{
|
10 |
+
return Mage::helper('sales')->__('Log File');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getTabTitle()
|
14 |
+
{
|
15 |
+
return Mage::helper('sales')->__('Log file');
|
16 |
+
}
|
17 |
+
|
18 |
+
public function canShowTab()
|
19 |
+
{
|
20 |
+
return true;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function isHidden()
|
24 |
+
{
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function __construct()
|
29 |
+
{
|
30 |
+
parent::__construct();
|
31 |
+
$this->setTemplate('emaildirect/troubleshooting/view/tab/log.phtml');
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getLogFile()
|
35 |
+
{
|
36 |
+
return Mage::helper('emaildirect')->getLogFileContents();
|
37 |
+
}
|
38 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Submit.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Block_Adminhtml_Troubleshooting_View_Tab_Submit
|
4 |
+
extends Mage_Adminhtml_Block_Template
|
5 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
+
{
|
7 |
+
public function getTabLabel()
|
8 |
+
{
|
9 |
+
return Mage::helper('sales')->__('Send to EmailDirect');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getTabTitle()
|
13 |
+
{
|
14 |
+
return Mage::helper('sales')->__('Send Information to EmailDirect');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function canShowTab()
|
18 |
+
{
|
19 |
+
return true;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function isHidden()
|
23 |
+
{
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
+
parent::__construct();
|
30 |
+
$this->setTemplate('emaildirect/troubleshooting/view/tab/submit.phtml');
|
31 |
+
}
|
32 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Checkout/Subscribe.php
CHANGED
@@ -2,35 +2,26 @@
|
|
2 |
|
3 |
class EmailDirect_Integration_Block_Checkout_Subscribe extends Mage_Core_Block_Template
|
4 |
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
*
|
9 |
-
* @return string
|
10 |
-
*/
|
11 |
-
protected function _toHtml()
|
12 |
-
{
|
13 |
-
$alreadySubscribed = Mage::getModel('newsletter/subscriber')
|
14 |
->loadByEmail($this->getQuote()->getCustomerEmail())
|
15 |
->isSubscribed();
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
return parent::_toHtml();
|
23 |
-
}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
public function checkStatus()
|
32 |
{
|
33 |
return (int)$this->helper('emaildirect')->config('checkout_subscribe');
|
34 |
}
|
35 |
-
|
36 |
}
|
2 |
|
3 |
class EmailDirect_Integration_Block_Checkout_Subscribe extends Mage_Core_Block_Template
|
4 |
{
|
5 |
+
protected function _toHtml()
|
6 |
+
{
|
7 |
+
$alreadySubscribed = Mage::getModel('newsletter/subscriber')
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
->loadByEmail($this->getQuote()->getCustomerEmail())
|
9 |
->isSubscribed();
|
10 |
|
11 |
+
if (!$this->helper('emaildirect')->canCheckoutSubscribe() || $alreadySubscribed)
|
12 |
+
return '';
|
13 |
+
|
14 |
+
return parent::_toHtml();
|
15 |
+
}
|
|
|
|
|
16 |
|
17 |
+
public function getQuote()
|
18 |
+
{
|
19 |
+
return Mage::getSingleton('checkout/session')
|
20 |
+
->getQuote();
|
21 |
+
}
|
22 |
|
23 |
public function checkStatus()
|
24 |
{
|
25 |
return (int)$this->helper('emaildirect')->config('checkout_subscribe');
|
26 |
}
|
|
|
27 |
}
|
app/code/local/EmailDirect/Integration/Block/Customer/Account/Dashboard/Info.php
CHANGED
@@ -4,24 +4,46 @@ class EmailDirect_Integration_Block_Customer_Account_Dashboard_Info extends Mage
|
|
4 |
{
|
5 |
public function IsSubscribed($email)
|
6 |
{
|
7 |
-
$rc = Mage::getSingleton('emaildirect/
|
8 |
$lists = array();
|
9 |
|
10 |
$abandonedID = Mage::helper('emaildirect')->config('abandonedpublication');
|
11 |
|
12 |
-
if($rc->Publications->Publication && $rc->Publications->Publication->PublicationID != $abandonedID)
|
|
|
13 |
$lists[]=(string)$rc->Publications->Publication->Name;
|
14 |
}
|
15 |
$abandonedID = Mage::helper('emaildirect')->config('abandonedlist');
|
16 |
|
17 |
-
foreach($rc->Lists->List as $i)
|
|
|
18 |
if($i->ListID != $abandonedID) {
|
19 |
$lists[]=(string)$i->Name;
|
20 |
}
|
21 |
}
|
22 |
return $lists;
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
}
|
26 |
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
{
|
5 |
public function IsSubscribed($email)
|
6 |
{
|
7 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_subscribers')->getProperties($email);
|
8 |
$lists = array();
|
9 |
|
10 |
$abandonedID = Mage::helper('emaildirect')->config('abandonedpublication');
|
11 |
|
12 |
+
if ($rc->Publications->Publication && $rc->Publications->Publication->PublicationID != $abandonedID)
|
13 |
+
{
|
14 |
$lists[]=(string)$rc->Publications->Publication->Name;
|
15 |
}
|
16 |
$abandonedID = Mage::helper('emaildirect')->config('abandonedlist');
|
17 |
|
18 |
+
foreach($rc->Lists->List as $i)
|
19 |
+
{
|
20 |
if($i->ListID != $abandonedID) {
|
21 |
$lists[]=(string)$i->Name;
|
22 |
}
|
23 |
}
|
24 |
return $lists;
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function _toHtml()
|
28 |
+
{
|
29 |
+
if (!Mage::helper('emaildirect')->canEDirect())
|
30 |
+
return parent::_toHtml();
|
31 |
|
32 |
+
return parent::_toHtml();
|
33 |
}
|
34 |
|
35 |
+
public function getSubscriptions()
|
36 |
+
{
|
37 |
+
return Mage::helper('emaildirect')->getSubscriptions($this->_getEmail());
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Retrieve email from Customer object in session
|
42 |
+
*
|
43 |
+
* @return string Email address
|
44 |
+
*/
|
45 |
+
protected function _getEmail()
|
46 |
+
{
|
47 |
+
return $this->helper('customer')->getCustomer()->getEmail();
|
48 |
+
}
|
49 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Customer/Account/Lists.php
CHANGED
@@ -2,92 +2,45 @@
|
|
2 |
|
3 |
class Emaildirect_Integration_Block_Customer_Account_Lists extends Mage_Core_Block_Template
|
4 |
{
|
5 |
-
|
6 |
-
protected $_lists = array();
|
7 |
-
protected $_info = array();
|
8 |
-
protected $_myLists = array();
|
9 |
-
protected $_generalList = array();
|
10 |
protected $_form;
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
public function getAllLists()
|
15 |
-
{
|
16 |
-
$listData = Mage::getSingleton('emaildirect/wrapper_lists')->getLists();
|
17 |
-
$options = array();
|
18 |
-
foreach($listData as $list)
|
19 |
-
{
|
20 |
-
if($list['active'])
|
21 |
-
$options[] = array(
|
22 |
-
'id' => $list['id'],
|
23 |
-
'name' => $list['name']);
|
24 |
-
}
|
25 |
-
$this->_allLists = $options;
|
26 |
-
return $options;
|
27 |
-
}
|
28 |
-
|
29 |
-
public function getGeneralList()
|
30 |
{
|
31 |
-
|
32 |
-
// foreach($this->_allLists as $list) {
|
33 |
-
// if($list['id']==$general) {
|
34 |
-
// $rc = array('id' => $list['id'], 'name' => $list['name']);
|
35 |
-
// break;
|
36 |
-
// }
|
37 |
-
// }
|
38 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_publications')->getPublication($general);
|
39 |
-
return array('id' =>(int) $rc->PublicationID,'name'=> (string)$rc->Name);
|
40 |
}
|
41 |
-
|
42 |
-
|
43 |
/**
|
44 |
-
*
|
45 |
*
|
46 |
-
* @
|
|
|
47 |
*/
|
48 |
-
public function
|
49 |
{
|
50 |
-
$
|
51 |
-
$
|
52 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
-
if($
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
if(in_array($list['id'],$activelists))
|
60 |
-
$this->_lists [] = array(
|
61 |
-
'id' => $list['id'],
|
62 |
-
'name' => $list['name']);
|
63 |
-
}
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
}
|
68 |
|
69 |
-
|
70 |
-
* Getter for class property
|
71 |
-
*
|
72 |
-
* @return array
|
73 |
-
*/
|
74 |
-
public function getSubscribedLists()
|
75 |
-
{
|
76 |
-
$properties = Mage::getSingleton('emaildirect/wrapper_suscribers')->getProperties($this->_getEmail());
|
77 |
-
$rc = array();
|
78 |
-
$publications = array();
|
79 |
-
foreach($properties->Lists->List as $list)
|
80 |
-
{
|
81 |
-
$rc [] = (int)$list->ListID;
|
82 |
-
}
|
83 |
-
$this->_myLists = $rc;
|
84 |
-
foreach($properties->Publications->Publication as $publication)
|
85 |
-
{
|
86 |
-
$this->_publications[] = (int) $publication->PublicationID;
|
87 |
-
}
|
88 |
-
return $this->_myLists;
|
89 |
}
|
90 |
-
|
91 |
/**
|
92 |
* Utility to generate HTML name for element
|
93 |
* @param string $list
|
@@ -99,13 +52,11 @@ class Emaildirect_Integration_Block_Customer_Account_Lists extends Mage_Core_Blo
|
|
99 |
{
|
100 |
$htmlName = "list[{$list['id']}]";
|
101 |
|
102 |
-
if(!is_null($group))
|
103 |
$htmlName .= "[{$group['id']}]";
|
104 |
-
}
|
105 |
|
106 |
-
if(TRUE === $multiple)
|
107 |
$htmlName .= '[]';
|
108 |
-
}
|
109 |
|
110 |
return $htmlName;
|
111 |
}
|
@@ -115,15 +66,14 @@ class Emaildirect_Integration_Block_Customer_Account_Lists extends Mage_Core_Blo
|
|
115 |
*
|
116 |
* @return Varien_Data_Form
|
117 |
*/
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
|
128 |
/**
|
129 |
* Retrieve email from Customer object in session
|
@@ -134,60 +84,4 @@ class Emaildirect_Integration_Block_Customer_Account_Lists extends Mage_Core_Blo
|
|
134 |
{
|
135 |
return $this->helper('customer')->getCustomer()->getEmail();
|
136 |
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Return HTML code for list <label> with checkbox, checked if subscribed, otherwise not
|
140 |
-
*
|
141 |
-
* @param array $list List data from
|
142 |
-
* @return string HTML code
|
143 |
-
*/
|
144 |
-
public function listLabel($generalList,$list)
|
145 |
-
{
|
146 |
-
$myLists = $this->_myLists;
|
147 |
-
|
148 |
-
$checkbox = new Varien_Data_Form_Element_Checkbox;
|
149 |
-
$checkbox->setForm($this->getForm());
|
150 |
-
$checkbox->setHtmlId('list-' . $list['id']);
|
151 |
-
if(!in_array($generalList['id'],$this->_publications)) {
|
152 |
-
$checkbox->setChecked(false);
|
153 |
-
$checkbox->setData('disabled',true);
|
154 |
-
}
|
155 |
-
else {
|
156 |
-
$checkbox->setChecked((bool)(is_array($myLists) && in_array($list['id'], $myLists)));
|
157 |
-
}
|
158 |
-
$checkbox->setTitle( ($checkbox->getChecked() ? $this->__('Click to unsubscribe from this list.') : $this->__('Click to subscribe to this list.')) );
|
159 |
-
$checkbox->setLabel($list['name']);
|
160 |
-
|
161 |
-
$hname = $this->_htmlGroupName($list);
|
162 |
-
$checkbox->setName($hname . '[subscribed]');
|
163 |
-
|
164 |
-
$checkbox->setValue($list['id']);
|
165 |
-
$checkbox->setClass('emaildirect-list-subscriber');
|
166 |
-
|
167 |
-
|
168 |
-
return $checkbox->getLabelHtml() . $checkbox->getElementHtml();
|
169 |
-
}
|
170 |
-
public function publicationLabel($list)
|
171 |
-
{
|
172 |
-
$myLists = $this->_myLists;
|
173 |
-
|
174 |
-
$checkbox = new Varien_Data_Form_Element_Checkbox;
|
175 |
-
$checkbox->setForm($this->getForm());
|
176 |
-
$checkbox->setHtmlId('publication-' . $list['id']);
|
177 |
-
$checkbox->setChecked(in_array($list['id'],$this->_publications));
|
178 |
-
// $checkbox->setChecked((bool)(is_array($myLists) && in_array($list['id'], $myLists)));
|
179 |
-
$checkbox->setTitle( ($checkbox->getChecked() ? $this->__('Click to unsubscribe from this list.') : $this->__('Click to subscribe to this list.')) );
|
180 |
-
$checkbox->setLabel($list['name']);
|
181 |
-
|
182 |
-
// $hname = $this->_htmlGroupName($list);
|
183 |
-
$hname = 'publication';
|
184 |
-
$checkbox->setName($hname . '[subscribed]');
|
185 |
-
|
186 |
-
$checkbox->setValue($list['id']);
|
187 |
-
$checkbox->setClass('emaildirect-publication-subscriber');
|
188 |
-
|
189 |
-
|
190 |
-
return $checkbox->getLabelHtml() . $checkbox->getElementHtml();
|
191 |
-
}
|
192 |
-
|
193 |
}
|
2 |
|
3 |
class Emaildirect_Integration_Block_Customer_Account_Lists extends Mage_Core_Block_Template
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
5 |
protected $_form;
|
6 |
+
|
7 |
+
public function getSubscriptions()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
{
|
9 |
+
return Mage::helper('emaildirect')->getSubscriptions($this->_getEmail());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
+
|
|
|
12 |
/**
|
13 |
+
* Return HTML code for list <label> with checkbox, checked if subscribed, otherwise not
|
14 |
*
|
15 |
+
* @param array $list List data from
|
16 |
+
* @return string HTML code
|
17 |
*/
|
18 |
+
public function showCheckbox($newsletter, $type = 'list')
|
19 |
{
|
20 |
+
$checkbox = new Varien_Data_Form_Element_Checkbox;
|
21 |
+
$checkbox->setForm($this->getForm());
|
22 |
+
$checkbox->setHtmlId($type . '-' . $newsletter['id']);
|
23 |
+
|
24 |
+
if ($newsletter['disabled'])
|
25 |
+
$checkbox->setData('disabled',true);
|
26 |
+
|
27 |
+
$checkbox->setChecked($newsletter['subscribed']);
|
28 |
+
|
29 |
+
$checkbox->setTitle( ($checkbox->getChecked() ? $this->__('Click to unsubscribe from this list.') : $this->__('Click to subscribe to this list.')) );
|
30 |
+
$checkbox->setLabel($newsletter['name']);
|
31 |
|
32 |
+
if ($type == 'list')
|
33 |
+
$hname = $this->_htmlGroupName($newsletter);
|
34 |
+
else
|
35 |
+
$hname = $type;
|
36 |
+
$checkbox->setName($hname . '[subscribed]');
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
$checkbox->setValue($newsletter['id']);
|
39 |
+
$checkbox->setClass("emaildirect-{$type}-subscriber");
|
|
|
40 |
|
41 |
+
return $checkbox->getLabelHtml() . $checkbox->getElementHtml();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
+
|
44 |
/**
|
45 |
* Utility to generate HTML name for element
|
46 |
* @param string $list
|
52 |
{
|
53 |
$htmlName = "list[{$list['id']}]";
|
54 |
|
55 |
+
if(!is_null($group))
|
56 |
$htmlName .= "[{$group['id']}]";
|
|
|
57 |
|
58 |
+
if (TRUE === $multiple)
|
59 |
$htmlName .= '[]';
|
|
|
60 |
|
61 |
return $htmlName;
|
62 |
}
|
66 |
*
|
67 |
* @return Varien_Data_Form
|
68 |
*/
|
69 |
+
public function getForm()
|
70 |
+
{
|
71 |
+
if ($this->_form instanceof Varien_Data_Form)
|
72 |
+
return $this->_form;
|
73 |
+
|
74 |
+
$this->_form = new Varien_Data_Form();
|
75 |
+
return $this->_form;
|
76 |
+
}
|
|
|
77 |
|
78 |
/**
|
79 |
* Retrieve email from Customer object in session
|
84 |
{
|
85 |
return $this->helper('customer')->getCustomer()->getEmail();
|
86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
app/code/local/EmailDirect/Integration/Block/Customer/Newsletter.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Created on Dec 15, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
-
class EmailDirect_Integration_Block_Customer_Newsletter extends Mage_Customer_Block_Newsletter {
|
9 |
-
|
10 |
-
public function isEmailDirectEnabled($store) {
|
11 |
-
// Mage::log(__METHOD__);
|
12 |
-
return true;
|
13 |
-
}
|
14 |
-
public function getSubscribedAdditionalLists() {
|
15 |
-
// Mage::log(__METHOD__);
|
16 |
-
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmailDirect/Integration/Block/Email/Order/Items.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class EmailDirect_Integration_Block_Email_Order_Items extends Mage_Sales_Block_Items_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmailDirect/Integration/Block/Email/Order/Items/Order/Default.php
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class EmailDirect_Integration_Block_Email_Order_Items_Order_Default extends Mage_Core_Block_Template
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* Retrieve current order model instance
|
7 |
-
*
|
8 |
-
* @return Mage_Sales_Model_Order
|
9 |
-
*/
|
10 |
-
public function getOrder()
|
11 |
-
{
|
12 |
-
return $this->getItem()->getOrder();
|
13 |
-
}
|
14 |
-
|
15 |
-
public function getItemOptions()
|
16 |
-
{
|
17 |
-
$result = array();
|
18 |
-
if ($options = $this->getItem()->getProductOptions()) {
|
19 |
-
if (isset($options['options'])) {
|
20 |
-
$result = array_merge($result, $options['options']);
|
21 |
-
}
|
22 |
-
if (isset($options['additional_options'])) {
|
23 |
-
$result = array_merge($result, $options['additional_options']);
|
24 |
-
}
|
25 |
-
if (isset($options['attributes_info'])) {
|
26 |
-
$result = array_merge($result, $options['attributes_info']);
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
-
return $result;
|
31 |
-
}
|
32 |
-
|
33 |
-
public function getValueHtml($value)
|
34 |
-
{
|
35 |
-
if (is_array($value)) {
|
36 |
-
return sprintf('%d', $value['qty']) . ' x ' . $this->htmlEscape($value['title']) . " " . $this->getItem()->getOrder()->formatPrice($value['price']);
|
37 |
-
} else {
|
38 |
-
return $this->htmlEscape($value);
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
public function getSku($item)
|
43 |
-
{
|
44 |
-
if ($item->getProductOptionByCode('simple_sku'))
|
45 |
-
return $item->getProductOptionByCode('simple_sku');
|
46 |
-
else
|
47 |
-
return $item->getSku();
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Return product additional information block
|
52 |
-
*
|
53 |
-
* @return Mage_Core_Block_Abstract
|
54 |
-
*/
|
55 |
-
public function getProductAdditionalInformationBlock()
|
56 |
-
{
|
57 |
-
return $this->getLayout()->getBlock('additional.product.info');
|
58 |
-
}
|
59 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmailDirect/Integration/Block/Email/Order/Items/Order/Grouped.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class EmailDirect_Integration_Block_Email_Email_Items_Order_Grouped extends Mage_Sales_Block_Order_Email_Items_Order_Default
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* Prepare item html
|
7 |
-
*
|
8 |
-
* This method uses renderer for real product type
|
9 |
-
*
|
10 |
-
* @return string
|
11 |
-
*/
|
12 |
-
protected function _toHtml()
|
13 |
-
{ if ($this->getItem()->getOrderItem()) {
|
14 |
-
$item = $this->getItem()->getOrderItem();
|
15 |
-
} else {
|
16 |
-
$item = $this->getItem();
|
17 |
-
}
|
18 |
-
if ($productType = $item->getRealProductType()) {
|
19 |
-
$renderer = $this->getRenderedBlock()->getItemRenderer($productType);
|
20 |
-
$renderer->setItem($this->getItem());
|
21 |
-
return $renderer->toHtml();
|
22 |
-
}
|
23 |
-
return parent::_toHtml();
|
24 |
-
}
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmailDirect/Integration/Helper/Data.php
CHANGED
@@ -1,19 +1,45 @@
|
|
1 |
<?php
|
2 |
-
/*
|
3 |
-
* Created on Oct 26, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
-
class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
9 |
-
{
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
{
|
13 |
-
if ($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
{
|
15 |
-
|
|
|
|
|
16 |
}
|
|
|
|
|
17 |
}
|
18 |
|
19 |
public function getExportFileName($name,$full = true)
|
@@ -27,17 +53,15 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
27 |
}
|
28 |
|
29 |
public function getApiKey($store = null)
|
|
|
|
|
|
|
|
|
|
|
30 |
{
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
$curstore = Mage::app()->getStore();
|
35 |
-
Mage::app()->setCurrentStore($store);
|
36 |
-
$key = $this->config('apikey', $store);
|
37 |
-
Mage::app()->setCurrentStore($curstore);
|
38 |
-
}
|
39 |
-
|
40 |
-
return $key;
|
41 |
}
|
42 |
|
43 |
private function _config($value,$section, $store = null)
|
@@ -50,6 +74,7 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
50 |
|
51 |
if ($configscope)
|
52 |
$store = $configscope;
|
|
|
53 |
}
|
54 |
|
55 |
$realvalue = Mage::getStoreConfig("emaildirect/{$section}/{$value}", $store);
|
@@ -66,6 +91,11 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
66 |
{
|
67 |
return $this->_config($value,'export',$store);
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
public function getEmailDirectColumnOptions()
|
71 |
{
|
@@ -78,7 +108,7 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
78 |
if ($column->IsCustom == 'true')
|
79 |
{
|
80 |
$key = (string)$column->ColumnName;
|
81 |
-
|
82 |
$options[$key] = $key;
|
83 |
}
|
84 |
}
|
@@ -88,7 +118,12 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
88 |
|
89 |
public function getShippingColumnOptions()
|
90 |
{
|
91 |
-
$options = array(
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
return $options;
|
94 |
}
|
@@ -176,17 +211,17 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
176 |
|
177 |
public function getOrderMergeVars(&$merge_vars, $order)
|
178 |
{
|
179 |
-
$this->
|
180 |
$maps = unserialize( $this->config('shipping_fields', $order->getStoreId()) );
|
181 |
|
182 |
-
if($maps)
|
183 |
{
|
184 |
-
|
185 |
-
$this->
|
186 |
$shipping_data = $this->getShippingData($order);
|
187 |
|
188 |
-
|
189 |
-
$this->
|
190 |
|
191 |
$this->processMap($merge_vars, $maps, $shipping_data);
|
192 |
}
|
@@ -196,18 +231,20 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
196 |
|
197 |
public function getTrackingMergeVars($track, $order)
|
198 |
{
|
|
|
|
|
199 |
$merge_vars = array();
|
200 |
-
$this->debugLog('getTrackMergeVars');
|
201 |
$maps = unserialize( $this->config('shipping_fields', $order->getStoreId()) );
|
202 |
-
|
203 |
-
if(
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
211 |
return $merge_vars;
|
212 |
}
|
213 |
|
@@ -234,8 +271,9 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
234 |
continue;
|
235 |
|
236 |
$state_code = $region->getCode();
|
237 |
-
|
238 |
-
|
|
|
239 |
}
|
240 |
break;
|
241 |
case 'date_of_purchase':
|
@@ -269,11 +307,19 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
269 |
public function canCheckoutSubscribe()
|
270 |
{
|
271 |
return (bool)($this->config('checkout_subscribe') != 0);
|
272 |
-
// return Mage::getStoreConfigFlag('emaildirect/general/checkout_subscribe');
|
273 |
}
|
274 |
public function canEdirect()
|
275 |
{
|
276 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
}
|
278 |
|
279 |
public function registerGuestCustomer($order)
|
@@ -297,39 +343,423 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
297 |
|
298 |
public function getAbandonedLastRunHtml()
|
299 |
{
|
300 |
-
$last_run =
|
301 |
-
|
302 |
-
$minutes = round(abs(time() - strtotime($last_run)) / 60,0);
|
303 |
-
|
304 |
-
$last_run = Mage::helper('core')->formatTime($last_run, 'long', true);
|
305 |
|
306 |
$class = 'ab_ng';
|
307 |
|
308 |
if ($last_run != null)
|
|
|
|
|
|
|
|
|
|
|
309 |
$class = 'ab_ok';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
else
|
|
|
311 |
$last_run = "NEVER";
|
|
|
|
|
312 |
|
313 |
-
|
314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
320 |
|
321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
}
|
323 |
|
324 |
public function getAbandonedEnabled()
|
325 |
{
|
326 |
-
$active =
|
327 |
-
$
|
328 |
-
|
|
|
329 |
|
330 |
-
if (!$sendit || !$setup || !$active)
|
331 |
return false;
|
332 |
|
333 |
return true;
|
334 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
const LOG_FILE_NAME = 'emaildirect';
|
6 |
+
const LOG_FILE_EXT = '.log';
|
7 |
+
|
8 |
+
const ABANDONED_CART = "AB";
|
9 |
+
const ORDERS = "OR";
|
10 |
+
const NEWSLETTER = "NL";
|
11 |
+
const CUSTOMER = "CU";
|
12 |
+
const IGNORE = "IG";
|
13 |
+
|
14 |
+
const DISABLED_REASON_PREFIX = "Skipping";
|
15 |
+
|
16 |
+
private $_log_area = "";
|
17 |
+
|
18 |
+
public function formatSize($size)
|
19 |
+
{
|
20 |
+
$unit=array('b','kb','mb','gb','tb','pb');
|
21 |
+
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
|
22 |
+
}
|
23 |
+
|
24 |
+
function timeElapsed2string($time)
|
25 |
{
|
26 |
+
if ($time == "")
|
27 |
+
return "";
|
28 |
+
|
29 |
+
$timeline = time() - $time;
|
30 |
+
|
31 |
+
$periods = array('day' => 86400, 'hour' => 3600, 'minute' => 60);
|
32 |
+
|
33 |
+
$ret = "";
|
34 |
+
|
35 |
+
foreach($periods AS $name => $seconds)
|
36 |
{
|
37 |
+
$num = floor($timeline / $seconds);
|
38 |
+
$timeline -= ($num * $seconds);
|
39 |
+
$ret .= $num.' '.$name.(($num > 1 || $num == 0) ? 's' : '').' ';
|
40 |
}
|
41 |
+
|
42 |
+
return trim($ret);
|
43 |
}
|
44 |
|
45 |
public function getExportFileName($name,$full = true)
|
53 |
}
|
54 |
|
55 |
public function getApiKey($store = null)
|
56 |
+
{
|
57 |
+
return $this->config('apikey',$store);
|
58 |
+
}
|
59 |
+
|
60 |
+
public function updateConfig($path,$value,$store, $base_path = 'general')
|
61 |
{
|
62 |
+
$config = new Mage_Core_Model_Config();
|
63 |
+
$config->saveConfig("emaildirect/{$base_path}/{$path}",$value,"default",$store);
|
64 |
+
Mage::getConfig()->cleanCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
|
67 |
private function _config($value,$section, $store = null)
|
74 |
|
75 |
if ($configscope)
|
76 |
$store = $configscope;
|
77 |
+
|
78 |
}
|
79 |
|
80 |
$realvalue = Mage::getStoreConfig("emaildirect/{$section}/{$value}", $store);
|
91 |
{
|
92 |
return $this->_config($value,'export',$store);
|
93 |
}
|
94 |
+
|
95 |
+
public function troubleConfig($value, $store = null)
|
96 |
+
{
|
97 |
+
return $this->_config($value,'troubleshooting',$store);
|
98 |
+
}
|
99 |
|
100 |
public function getEmailDirectColumnOptions()
|
101 |
{
|
108 |
if ($column->IsCustom == 'true')
|
109 |
{
|
110 |
$key = (string)$column->ColumnName;
|
111 |
+
|
112 |
$options[$key] = $key;
|
113 |
}
|
114 |
}
|
118 |
|
119 |
public function getShippingColumnOptions()
|
120 |
{
|
121 |
+
$options = array(
|
122 |
+
'shipping_code' => 'Shipping Code',
|
123 |
+
'shipping_description' => 'Shipping Description',
|
124 |
+
'carrier_code' => 'Tracking Carrier Code',
|
125 |
+
'title' => 'Tracking Title',
|
126 |
+
'number' => 'Tracking Number');
|
127 |
|
128 |
return $options;
|
129 |
}
|
211 |
|
212 |
public function getOrderMergeVars(&$merge_vars, $order)
|
213 |
{
|
214 |
+
$this->log('getOrderMergeVars');
|
215 |
$maps = unserialize( $this->config('shipping_fields', $order->getStoreId()) );
|
216 |
|
217 |
+
if ($maps)
|
218 |
{
|
219 |
+
|
220 |
+
$this->log($maps, "Maps");
|
221 |
$shipping_data = $this->getShippingData($order);
|
222 |
|
223 |
+
|
224 |
+
$this->log($shipping_data,'Shipping Data');
|
225 |
|
226 |
$this->processMap($merge_vars, $maps, $shipping_data);
|
227 |
}
|
231 |
|
232 |
public function getTrackingMergeVars($track, $order)
|
233 |
{
|
234 |
+
$this->log('getTrackingMergeVars Start');
|
235 |
+
|
236 |
$merge_vars = array();
|
|
|
237 |
$maps = unserialize( $this->config('shipping_fields', $order->getStoreId()) );
|
238 |
+
|
239 |
+
if (!$maps)
|
240 |
+
return null;
|
241 |
+
|
242 |
+
$this->log($maps, "Maps");
|
243 |
+
|
244 |
+
$this->log($track->getData(), "Tracking Data");
|
245 |
+
|
246 |
+
$this->processMap($merge_vars, $maps, $track);
|
247 |
+
|
248 |
return $merge_vars;
|
249 |
}
|
250 |
|
271 |
continue;
|
272 |
|
273 |
$state_code = $region->getCode();
|
274 |
+
|
275 |
+
if ($state_code != "")
|
276 |
+
$merge_vars[$key] = $state_code;
|
277 |
}
|
278 |
break;
|
279 |
case 'date_of_purchase':
|
307 |
public function canCheckoutSubscribe()
|
308 |
{
|
309 |
return (bool)($this->config('checkout_subscribe') != 0);
|
|
|
310 |
}
|
311 |
public function canEdirect()
|
312 |
{
|
313 |
+
// TEST THIS!
|
314 |
+
//Mage::helper('core')->isModuleOutputEnabled($moduleName)
|
315 |
+
|
316 |
+
$active = $this->config('active');
|
317 |
+
$setup = $this->config('setup');
|
318 |
+
|
319 |
+
if (!$active || !$setup)
|
320 |
+
return false;
|
321 |
+
|
322 |
+
return true;
|
323 |
}
|
324 |
|
325 |
public function registerGuestCustomer($order)
|
343 |
|
344 |
public function getAbandonedLastRunHtml()
|
345 |
{
|
346 |
+
$last_run = $this->config('abandoned_last_run');
|
|
|
|
|
|
|
|
|
347 |
|
348 |
$class = 'ab_ng';
|
349 |
|
350 |
if ($last_run != null)
|
351 |
+
{
|
352 |
+
$minutes = round(abs(time() - strtotime($last_run)) / 60,0);
|
353 |
+
|
354 |
+
$last_run = Mage::helper('core')->formatTime($last_run, 'long', true);
|
355 |
+
|
356 |
$class = 'ab_ok';
|
357 |
+
|
358 |
+
if ($minutes > 60)
|
359 |
+
$class = 'ab_ng';
|
360 |
+
|
361 |
+
if ($minutes == 1)
|
362 |
+
$minutes = " ({$minutes} minute ago)";
|
363 |
+
else
|
364 |
+
$minutes = " ({$minutes} minutes ago)";
|
365 |
+
}
|
366 |
else
|
367 |
+
{
|
368 |
$last_run = "NEVER";
|
369 |
+
$minutes = "";
|
370 |
+
}
|
371 |
|
372 |
+
return "<span class='{$class}'>{$last_run}{$minutes}</span>";
|
373 |
+
}
|
374 |
+
|
375 |
+
public function getOrdersEnabled()
|
376 |
+
{
|
377 |
+
$active = $this->config('active');
|
378 |
+
$setup = $this->config('setup');
|
379 |
+
$sendit = $this->config('sendorder');
|
380 |
+
|
381 |
+
if (!$sendit || !$setup || !$active)
|
382 |
+
return false;
|
383 |
|
384 |
+
return true;
|
385 |
+
}
|
386 |
+
|
387 |
+
public function getDisabledReason()
|
388 |
+
{
|
389 |
+
if (!$this->config('active'))
|
390 |
+
return "EmailDirect Module is Disabled.";
|
391 |
|
392 |
+
if (!$this->config('setup'))
|
393 |
+
return "EmailDirect Module is not configured with a valid API Key.";
|
394 |
+
|
395 |
+
return "";
|
396 |
+
}
|
397 |
+
|
398 |
+
public function getOrdersDisabledReason()
|
399 |
+
{
|
400 |
+
$base = $this->getDisabledReason();
|
401 |
+
|
402 |
+
if ($base != "")
|
403 |
+
return $base;
|
404 |
+
|
405 |
+
//$sendit = $this->config('sendorder');
|
406 |
+
|
407 |
+
return "Sending Orders is disabled.";
|
408 |
}
|
409 |
|
410 |
public function getAbandonedEnabled()
|
411 |
{
|
412 |
+
$active = $this->config('active');
|
413 |
+
$setup = $this->config('setup');
|
414 |
+
$sendit = $this->config('sendabandoned');
|
415 |
+
$abandoned_setup = $this->config('abandonedsetup');
|
416 |
|
417 |
+
if (!$sendit || !$setup || !$active || !$abandoned_setup)
|
418 |
return false;
|
419 |
|
420 |
return true;
|
421 |
}
|
422 |
+
|
423 |
+
public function getAbandonedDisabledReason()
|
424 |
+
{
|
425 |
+
$base = $this->getDisabledReason();
|
426 |
+
|
427 |
+
if ($base != "")
|
428 |
+
return $base;
|
429 |
+
|
430 |
+
if (!$this->config('abandonedsetup'))
|
431 |
+
return "Abandoned Cart Processing Not Setup.";
|
432 |
+
|
433 |
+
return "Sending Abandoned Carts is Disabled";
|
434 |
+
}
|
435 |
+
|
436 |
+
// TROUBLESHOOTING
|
437 |
+
|
438 |
+
private function getReportTable($heading, $table, $headings = true)
|
439 |
+
{
|
440 |
+
$output = "<h1>{$heading}</h1>";
|
441 |
+
$output .= "<table cellspacing='0' border='1'>";
|
442 |
+
|
443 |
+
if ($headings)
|
444 |
+
$output .= "<thead>
|
445 |
+
<tr class='headings'>
|
446 |
+
<th>Setting</th>
|
447 |
+
<th>Value</th>
|
448 |
+
</tr>
|
449 |
+
</thead>";
|
450 |
+
|
451 |
+
foreach ($table as $key => $value)
|
452 |
+
{
|
453 |
+
$output .= "<tr class='border'>
|
454 |
+
<td>{$key}</td>
|
455 |
+
<td>{$value}</td>
|
456 |
+
</tr>";
|
457 |
+
}
|
458 |
+
$output .= "</table>";
|
459 |
+
|
460 |
+
return $output;
|
461 |
+
}
|
462 |
+
|
463 |
+
public function getReport($customer = null)
|
464 |
+
{
|
465 |
+
$environment = $this->getEnvironmentInfo();
|
466 |
+
$store_configuration = $this->getConfigurationInfo();
|
467 |
+
|
468 |
+
$output = "<html><head></head><body>";
|
469 |
+
|
470 |
+
if ($customer != null)
|
471 |
+
$output .= $this->getReportTable("Customer Information", $customer, false);
|
472 |
+
|
473 |
+
$output .= $this->getReportTable("General Configuration", $environment);
|
474 |
+
|
475 |
+
foreach ($store_configuration as $code => $configuration)
|
476 |
+
{
|
477 |
+
$output .= $this->getReportTable("Module Configuration for store: {$code}", $configuration);
|
478 |
+
}
|
479 |
+
|
480 |
+
$output .= "<h1>Log File</h1>";
|
481 |
+
$output .= "<pre>" . $this->getLogFileContents() . "</pre>";
|
482 |
+
|
483 |
+
$output .= "</body></html>";
|
484 |
+
|
485 |
+
return $output;
|
486 |
+
}
|
487 |
+
|
488 |
+
private function getArrayData($data)
|
489 |
+
{
|
490 |
+
$output = "<table cellspacing='0' class='data ed-config-subtable'>
|
491 |
+
<thead>
|
492 |
+
<tr class='headings'>
|
493 |
+
<th>Magento</th>
|
494 |
+
<th>EmailDirect</th>
|
495 |
+
</tr>
|
496 |
+
</thead>";
|
497 |
+
|
498 |
+
foreach ($data as $row)
|
499 |
+
{
|
500 |
+
$output .= "<tbody><tr class='border'><td>{$row['magento']}</td><td>{$row['emaildirect']}</td></tr></tbody>";
|
501 |
+
}
|
502 |
+
|
503 |
+
$output .= "</table>";
|
504 |
+
|
505 |
+
return $output;
|
506 |
+
}
|
507 |
+
|
508 |
+
public function getEnvironmentInfo()
|
509 |
+
{
|
510 |
+
$data = array(
|
511 |
+
'Magento Version' => Mage::getVersion(),
|
512 |
+
'Magento Edition' => Mage::getEdition(),
|
513 |
+
'EmailDirect Version' => (string) Mage::getConfig()->getNode('modules/EmailDirect_Integration/version'),
|
514 |
+
'Website URL' => Mage::getBaseUrl(),
|
515 |
+
'PHP Version' => phpversion(),
|
516 |
+
'Server Software' => $_SERVER['SERVER_SOFTWARE']
|
517 |
+
);
|
518 |
+
return $data;
|
519 |
+
}
|
520 |
+
|
521 |
+
public function getConfigurationInfo()
|
522 |
+
{
|
523 |
+
$store_data = array();
|
524 |
+
|
525 |
+
$stores = Mage::app()->getStores();
|
526 |
+
|
527 |
+
foreach ($stores as $store)
|
528 |
+
{
|
529 |
+
$e_config = Mage::getStoreConfig("emaildirect/general", $store);
|
530 |
+
|
531 |
+
$data = array( );
|
532 |
+
|
533 |
+
foreach ($e_config as $key => $value)
|
534 |
+
{
|
535 |
+
if (is_array($value))
|
536 |
+
{
|
537 |
+
// Skip
|
538 |
+
}
|
539 |
+
else
|
540 |
+
{
|
541 |
+
// Check if the data is serialized
|
542 |
+
$test_data = @unserialize($value);
|
543 |
+
if ($test_data !== false)
|
544 |
+
$data[$key] = $this->getArrayData($test_data);
|
545 |
+
else
|
546 |
+
$data[$key] = $value;;
|
547 |
+
}
|
548 |
+
}
|
549 |
+
|
550 |
+
$store_data[$store->getName()] = $data;
|
551 |
+
}
|
552 |
+
|
553 |
+
return $store_data;
|
554 |
+
}
|
555 |
+
|
556 |
+
public function getLogFileContents()
|
557 |
+
{
|
558 |
+
$log_file = $this->getLogFilePath();
|
559 |
+
|
560 |
+
$max_size = $this->getMaxLogFileSize();
|
561 |
+
$log_file_size = filesize($log_file);
|
562 |
+
$offset = 0;
|
563 |
+
|
564 |
+
if ($log_file_size > $max_size)
|
565 |
+
$offset = $log_file_size - $max_size;
|
566 |
+
|
567 |
+
|
568 |
+
return htmlentities(file_get_contents($log_file,false,null,$offset));
|
569 |
+
}
|
570 |
+
|
571 |
+
public function getLogFilePath()
|
572 |
+
{
|
573 |
+
return Mage::getBaseDir('log') . DS. self::LOG_FILE_NAME . self::LOG_FILE_EXT;
|
574 |
+
}
|
575 |
+
|
576 |
+
public function getLogFileName()
|
577 |
+
{
|
578 |
+
return self::LOG_FILE_NAME . self::LOG_FILE_EXT;
|
579 |
+
}
|
580 |
+
|
581 |
+
public function getLogFileSize()
|
582 |
+
{
|
583 |
+
$log_file = $this->getLogFilePath();
|
584 |
+
|
585 |
+
return filesize($log_file);
|
586 |
+
}
|
587 |
+
|
588 |
+
public function getLogFilelastUpdate()
|
589 |
+
{
|
590 |
+
$log_file = $this->getLogFilePath();
|
591 |
+
|
592 |
+
if (file_exists($log_file))
|
593 |
+
return filemtime($log_file);
|
594 |
+
|
595 |
+
return "";
|
596 |
+
}
|
597 |
+
|
598 |
+
public function getMaxLogFileSize()
|
599 |
+
{
|
600 |
+
return $this->troubleConfig('max_file_size');
|
601 |
+
}
|
602 |
+
|
603 |
+
public function turnOnTroubleshooting($store = null)
|
604 |
+
{
|
605 |
+
// Enabled
|
606 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
607 |
+
$date = date("Y-m-d H:i:s", $date);
|
608 |
+
|
609 |
+
$this->updateConfig("debug",1,$store);
|
610 |
+
$this->updateConfig("start_date",$date,$store,"troubleshooting");
|
611 |
+
}
|
612 |
+
|
613 |
+
public function turnOffTroubleshooting($store)
|
614 |
+
{
|
615 |
+
$this->updateConfig("debug",0,$store);
|
616 |
+
$this->updateConfig("start_date","",$store,"troubleshooting");
|
617 |
+
|
618 |
+
// RENAME LOG FILE
|
619 |
+
$log_file = $this->getLogFileName();
|
620 |
+
|
621 |
+
if (!file_exists($log_file))
|
622 |
+
return; // Ignore
|
623 |
+
|
624 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
625 |
+
$date = date(" Y_m_d_H_i_s", $date);
|
626 |
+
|
627 |
+
$new_log_file = str_replace(self::LOG_FILE_EXT, $date . self::LOG_FILE_EXT, $log_file);
|
628 |
+
|
629 |
+
sleep(1); // Sleep or it won't rename the file.
|
630 |
+
if (!rename($log_file,$new_log_file))
|
631 |
+
Mage::throwException("Failed to Rename Log File");
|
632 |
+
}
|
633 |
+
|
634 |
+
// Newsletter
|
635 |
+
|
636 |
+
private function getSubscriberData($data, $email)
|
637 |
+
{
|
638 |
+
|
639 |
+
$properties = Mage::getSingleton('emaildirect/wrapper_subscribers')->getProperties($email);
|
640 |
+
$pub_count = 0;
|
641 |
+
$list_count = 0;
|
642 |
+
$publication_subscribed = false;
|
643 |
+
|
644 |
+
foreach($properties->Publications->Publication as $publication)
|
645 |
+
{
|
646 |
+
if ((int) $publication->PublicationID == $data['publication']['id'])
|
647 |
+
{
|
648 |
+
$data['publication']['subscribed'] = true;
|
649 |
+
$publication_subscribed = true;
|
650 |
+
$pub_count++;
|
651 |
+
}
|
652 |
+
}
|
653 |
+
|
654 |
+
// Skip the lists if the publication is not subscribed
|
655 |
+
if (!$publication_subscribed)
|
656 |
+
{
|
657 |
+
foreach ($data['lists'] as $list_id => $list)
|
658 |
+
{
|
659 |
+
$data['lists'][$list_id]['disabled'] = true;
|
660 |
+
}
|
661 |
+
$data['count'] = $pub_count;
|
662 |
+
$data['list_count'] = 0;
|
663 |
+
return $data;
|
664 |
+
}
|
665 |
+
|
666 |
+
foreach($properties->Lists->List as $list)
|
667 |
+
{
|
668 |
+
$list_id = (int)$list->ListID;
|
669 |
+
|
670 |
+
if (isset($data['lists'][$list_id]))
|
671 |
+
{
|
672 |
+
$data['lists'][$list_id]['subscribed'] = true;
|
673 |
+
$list_count++;
|
674 |
+
}
|
675 |
+
}
|
676 |
+
|
677 |
+
$data['count'] = $pub_count + $list_count;
|
678 |
+
$data['list_count'] = $list_count;
|
679 |
+
|
680 |
+
return $data;
|
681 |
+
}
|
682 |
+
|
683 |
+
private function getPublication()
|
684 |
+
{
|
685 |
+
$general = $this->config('publication');
|
686 |
+
|
687 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_publications')->getPublication($general);
|
688 |
+
return array('id' =>(int) $rc->PublicationID,'name'=> (string)$rc->Name, 'subscribed' => false, 'disabled' => false);
|
689 |
+
}
|
690 |
+
|
691 |
+
private function getLists()
|
692 |
+
{
|
693 |
+
//return array();
|
694 |
+
$additional_lists = $this->config('additional_lists');
|
695 |
+
|
696 |
+
if ($additional_lists == "")
|
697 |
+
return null;
|
698 |
+
|
699 |
+
$active_lists = explode(",",$additional_lists);
|
700 |
+
|
701 |
+
$all_lists = Mage::getSingleton('emaildirect/wrapper_lists')->getLists();
|
702 |
+
|
703 |
+
$list_data = array();
|
704 |
+
foreach($all_lists as $list)
|
705 |
+
{
|
706 |
+
if (in_array($list['id'],$active_lists))
|
707 |
+
$list_data[$list['id']] = array(
|
708 |
+
'id' => $list['id'],
|
709 |
+
'name' => $list['name'],
|
710 |
+
'subscribed' => false,
|
711 |
+
'disabled' => false);
|
712 |
+
}
|
713 |
+
|
714 |
+
//Zend_debug::dump($list_data);
|
715 |
+
|
716 |
+
return $list_data;
|
717 |
+
}
|
718 |
+
|
719 |
+
|
720 |
+
public function getSubscriptions($email)
|
721 |
+
{
|
722 |
+
$data = array(
|
723 |
+
'publication' => $this->getPublication(),
|
724 |
+
'lists' => $this->getLists()
|
725 |
+
);
|
726 |
+
|
727 |
+
$data = $this->getSubscriberData($data, $email);
|
728 |
+
|
729 |
+
return $data;
|
730 |
+
}
|
731 |
+
|
732 |
+
// LOGGING
|
733 |
+
public function log($data, $prefix = "", $area = "")
|
734 |
+
{
|
735 |
+
if ($this->config('debug'))
|
736 |
+
{
|
737 |
+
if ($area == "")
|
738 |
+
$area = $this->_log_area;
|
739 |
+
|
740 |
+
if ($area == self::IGNORE)
|
741 |
+
return;
|
742 |
+
|
743 |
+
if (is_array($data) || is_object($data))
|
744 |
+
$data = print_r($data, true);
|
745 |
+
|
746 |
+
if ($prefix != "")
|
747 |
+
$prefix .= ": ";
|
748 |
+
|
749 |
+
if ($area != "")
|
750 |
+
$data = "[{$area}] {$prefix}{$data}";
|
751 |
+
|
752 |
+
Mage::log($data,null,self::LOG_FILE_NAME . self::LOG_FILE_EXT);
|
753 |
+
}
|
754 |
+
}
|
755 |
+
|
756 |
+
public function logReason($data, $area = "")
|
757 |
+
{
|
758 |
+
$this->log($data,self::DISABLED_REASON_PREFIX, $area);
|
759 |
+
}
|
760 |
+
|
761 |
+
public function setLogArea($area)
|
762 |
+
{
|
763 |
+
$this->_log_area = $area;
|
764 |
+
}
|
765 |
}
|
app/code/local/EmailDirect/Integration/Helper/Fields.php
CHANGED
@@ -22,9 +22,8 @@ class EmailDirect_Integration_Helper_Fields extends Mage_Core_Helper_Abstract
|
|
22 |
|
23 |
if(isset($rc->ErrorCode) && $rc->ErrorCode != 233)
|
24 |
{
|
25 |
-
Mage::helper('emaildirect')->
|
26 |
-
Mage::
|
27 |
-
Mage::throwException("Error adding {$name} field");
|
28 |
}
|
29 |
}
|
30 |
|
@@ -59,7 +58,6 @@ class EmailDirect_Integration_Helper_Fields extends Mage_Core_Helper_Abstract
|
|
59 |
array('name' => "{$prefix}Cost{$i}",
|
60 |
'type' => 'Text',
|
61 |
'size' => '20');
|
62 |
-
|
63 |
}
|
64 |
|
65 |
return $fields;
|
@@ -134,20 +132,17 @@ class EmailDirect_Integration_Helper_Fields extends Mage_Core_Helper_Abstract
|
|
134 |
{
|
135 |
$this->addDatabaseField($data);
|
136 |
}
|
137 |
-
|
138 |
-
|
139 |
-
$missing_check = $this->getMissingColumns($fields);
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
}
|
148 |
|
149 |
-
//Zend_debug::dump($missing);
|
150 |
-
|
151 |
// Save version so we know if we are up to date or not
|
152 |
Mage::getConfig()->saveConfig(self::ABANDONED_SETUP_PATH, 1,"default","default");
|
153 |
Mage::getConfig()->saveConfig(self::SETUP_VERSION_PATH, $this->getVersion(),"default","default");
|
22 |
|
23 |
if(isset($rc->ErrorCode) && $rc->ErrorCode != 233)
|
24 |
{
|
25 |
+
Mage::helper('emaildirect')->log("Error adding {$name} field");
|
26 |
+
Mage::throwException("Error adding {$name} field");
|
|
|
27 |
}
|
28 |
}
|
29 |
|
58 |
array('name' => "{$prefix}Cost{$i}",
|
59 |
'type' => 'Text',
|
60 |
'size' => '20');
|
|
|
61 |
}
|
62 |
|
63 |
return $fields;
|
132 |
{
|
133 |
$this->addDatabaseField($data);
|
134 |
}
|
135 |
+
|
136 |
+
$missing_check = $this->getMissingColumns($fields);
|
|
|
137 |
|
138 |
+
if (count($missing_check) != 0)
|
139 |
+
{
|
140 |
+
Mage::helper('emaildirect')->log("Error creating fields");
|
141 |
+
Mage::helper('emaildirect')->log($missing_check, "Missing Check");
|
142 |
+
Mage::throwException("Error creating fields");
|
143 |
+
}
|
144 |
}
|
145 |
|
|
|
|
|
146 |
// Save version so we know if we are up to date or not
|
147 |
Mage::getConfig()->saveConfig(self::ABANDONED_SETUP_PATH, 1,"default","default");
|
148 |
Mage::getConfig()->saveConfig(self::SETUP_VERSION_PATH, $this->getVersion(),"default","default");
|
app/code/local/EmailDirect/Integration/Model/Custom/Collection.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class EmailDirect_Integration_Model_Custom_Collection
|
4 |
-
extends Varien_Data_Collection
|
5 |
-
{
|
6 |
-
|
7 |
-
protected $_toload = NULL;
|
8 |
-
|
9 |
-
public function __construct(array $data)
|
10 |
-
{
|
11 |
-
$data = current($data);
|
12 |
-
|
13 |
-
if( empty($data) ){
|
14 |
-
return parent::__construct();
|
15 |
-
}
|
16 |
-
|
17 |
-
$this->_toload = $data;
|
18 |
-
|
19 |
-
return parent::__construct();
|
20 |
-
}
|
21 |
-
public function load($printQuery = false, $logQuery = false)
|
22 |
-
{
|
23 |
-
if($this->isLoaded() || is_null($this->_toload)){
|
24 |
-
return $this;
|
25 |
-
}
|
26 |
-
|
27 |
-
foreach ($this->_toload as $row) {
|
28 |
-
$item = new Varien_Object;
|
29 |
-
$item->addData($row);
|
30 |
-
$this->addItem($item);
|
31 |
-
}
|
32 |
-
|
33 |
-
$this->_setIsLoaded();
|
34 |
-
|
35 |
-
return $this;
|
36 |
-
}
|
37 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmailDirect/Integration/Model/Observer.php
CHANGED
@@ -1,70 +1,129 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Nov 28, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_Observer
|
9 |
{
|
10 |
const ABANDONED_LAST_RUN = 'emaildirect/general/abandoned_last_run';
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
/**
|
13 |
* Handle Subscriber object saving process
|
14 |
*/
|
15 |
public function handleSubscriber(Varien_Event_Observer $observer)
|
16 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
$subscriber = $observer->getEvent()->getSubscriber();
|
18 |
$subscriber->setImportMode(false);
|
19 |
|
20 |
$email = $subscriber->getSubscriberEmail();
|
21 |
-
$listId =
|
22 |
$isConfirmNeed = (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $subscriber->getStoreId()) == 1) ? TRUE : FALSE;
|
23 |
|
24 |
//New subscriber, just add
|
25 |
-
if( $subscriber->isObjectNew() )
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
28 |
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
29 |
-
if( !Mage::helper('customer')->isLoggedIn() && Mage::registry('ed_guest_customer'))
|
|
|
|
|
30 |
$guestCustomer = Mage::registry('ed_guest_customer');
|
31 |
$subscriber->setFirstname($guestCustomer->getFirstname());
|
32 |
$subscriber->setLastname($guestCustomer->getLastname());
|
33 |
Mage::unregister('ed_guest_customer');
|
34 |
$subscriber->save();
|
35 |
}
|
|
|
|
|
36 |
}
|
37 |
-
else
|
|
|
|
|
38 |
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
39 |
-
$
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
42 |
}
|
43 |
-
}
|
44 |
-
|
|
|
|
|
|
|
45 |
|
46 |
$oldSubscriber = Mage::getModel('newsletter/subscriber')
|
47 |
->load($subscriber->getId());
|
48 |
$oldstatus = (int)$oldSubscriber->getOrigData('subscriber_status');
|
49 |
-
if($oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED && $status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
|
|
|
|
50 |
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
51 |
-
$
|
52 |
-
|
53 |
-
|
|
|
|
|
54 |
}
|
55 |
-
elseif( $status !== $oldstatus )
|
|
|
|
|
|
|
|
|
56 |
//Unsubscribe customer
|
57 |
-
if($status == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
|
58 |
-
|
|
|
|
|
59 |
->unsubscribe($listId, $email);
|
60 |
-
}
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
63 |
->subscribe($listId, $email);
|
64 |
}
|
|
|
|
|
65 |
}
|
66 |
}
|
67 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -73,103 +132,155 @@ class EmailDirect_Integration_Model_Observer
|
|
73 |
*/
|
74 |
public function handleSubscriberDeletion(Varien_Event_Observer $observer)
|
75 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
$subscriber = $observer->getEvent()->getSubscriber();
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
-
|
83 |
{
|
84 |
-
|
85 |
-
|
86 |
-
$apiKey = isset($post['groups']['general']['fields']['apikey']['value']) ? $post['groups']['general']['fields']['apikey']['value'] : Mage::helper('emaildirect')->config('apikey');
|
87 |
-
if(!$apiKey){
|
88 |
-
return $observer;
|
89 |
-
}
|
90 |
-
|
91 |
-
$source = isset($post['groups']['general']['fields']['source']['value']) ? $post['groups']['general']['fields']['source']['value'] : Mage::helper('emaildirect')->config('source');
|
92 |
-
|
93 |
-
if($source == '') {
|
94 |
$source = "Magento";
|
95 |
-
$
|
96 |
-
$config->saveConfig('emaildirect/general/source',$source,"default",$store);
|
97 |
-
Mage::getConfig()->cleanCache();
|
98 |
}
|
99 |
-
|
100 |
-
|
101 |
-
$
|
102 |
foreach($sources as $item)
|
103 |
{
|
104 |
-
if($item['name']==$source)
|
105 |
-
|
106 |
-
$
|
107 |
-
// Mage::log($item);
|
108 |
break;
|
109 |
}
|
110 |
}
|
111 |
|
112 |
-
if(
|
|
|
113 |
$rc = Mage::getSingleton('emaildirect/wrapper_sources')->addSource($source);
|
114 |
-
if(!isset($rc->SourceID))
|
|
|
115 |
Mage::throwException("Error adding source");
|
116 |
}
|
117 |
-
else
|
118 |
-
|
119 |
-
|
120 |
-
Mage::getConfig()->cleanCache();
|
121 |
}
|
122 |
}
|
123 |
-
else
|
124 |
-
|
125 |
-
$
|
126 |
-
Mage::getConfig()->cleanCache();
|
127 |
}
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
-
$
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
{
|
132 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
}
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
// Verify all custom fields are present
|
136 |
Mage::helper('emaildirect/fields')->verifyFields($force_product);
|
|
|
|
|
137 |
}
|
138 |
|
139 |
public function _mergeVars($object = NULL, $includeEmail = FALSE)
|
140 |
{
|
141 |
//Initialize as GUEST customer
|
142 |
$customer = new Varien_Object;
|
|
|
|
|
143 |
|
144 |
$regCustomer = Mage::registry('current_customer');
|
145 |
$guestCustomer = Mage::registry('ed_guest_customer');
|
146 |
|
147 |
-
if(
|
|
|
|
|
148 |
$customer = Mage::helper('customer')->getCustomer();
|
149 |
-
}
|
|
|
|
|
|
|
150 |
$customer = $regCustomer;
|
151 |
-
}
|
|
|
|
|
|
|
152 |
$customer = $guestCustomer;
|
153 |
-
}
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
}else{
|
158 |
-
$customer = $object;
|
159 |
-
}*/
|
160 |
$customer = $object;
|
161 |
}
|
162 |
-
|
163 |
$address = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
|
164 |
if ($address)
|
165 |
$customer->setBillingAddress($address);
|
166 |
|
167 |
-
$
|
168 |
|
169 |
-
return $
|
170 |
}
|
171 |
|
172 |
-
private function addMergeItem($item, $pos, $
|
173 |
{
|
174 |
$name = "";
|
175 |
$sku = "";
|
@@ -187,7 +298,7 @@ class EmailDirect_Integration_Model_Observer
|
|
187 |
else
|
188 |
{
|
189 |
if ($item->getProduct() == null)
|
190 |
-
return $
|
191 |
$product_id = $item->getProduct()->getId();
|
192 |
}
|
193 |
|
@@ -207,27 +318,27 @@ class EmailDirect_Integration_Model_Observer
|
|
207 |
else
|
208 |
$cost = $item->getPrice();
|
209 |
|
210 |
-
$cost = number_format($cost, 2, '.', '');
|
211 |
$description = $product->getShortDescription();
|
212 |
}
|
213 |
}
|
214 |
|
215 |
-
$
|
216 |
-
$
|
217 |
-
$
|
218 |
-
$
|
219 |
|
220 |
-
$
|
221 |
-
$
|
222 |
|
223 |
-
return $
|
224 |
}
|
225 |
|
226 |
-
private function getRelatedOrderItems($quote, $
|
227 |
{
|
228 |
$prefix = "Related";
|
229 |
|
230 |
-
$max_count =
|
231 |
|
232 |
$id_list = array();
|
233 |
|
@@ -254,21 +365,21 @@ class EmailDirect_Integration_Model_Observer
|
|
254 |
if ($count > $max_count)
|
255 |
break;
|
256 |
|
257 |
-
$
|
258 |
}
|
259 |
|
260 |
while ($count < $max_count)
|
261 |
{
|
262 |
$count++;
|
263 |
-
$
|
264 |
}
|
265 |
|
266 |
-
return $
|
267 |
}
|
268 |
|
269 |
-
private function getMergeOrderItems($quote, $
|
270 |
{
|
271 |
-
$max_count =
|
272 |
|
273 |
$count = 0;
|
274 |
|
@@ -279,51 +390,79 @@ class EmailDirect_Integration_Model_Observer
|
|
279 |
if ($count > $max_count)
|
280 |
break;
|
281 |
|
282 |
-
$
|
283 |
}
|
284 |
|
285 |
while ($count < $max_count)
|
286 |
{
|
287 |
$count++;
|
288 |
-
$
|
289 |
}
|
290 |
|
291 |
-
return $
|
292 |
}
|
293 |
|
294 |
public function updateCustomer(Varien_Event_Observer $observer)
|
295 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
$store = Mage::app()->getStore()->getId();
|
297 |
$customer = $observer->getEvent()->getCustomer();
|
298 |
|
299 |
-
$
|
|
|
|
|
300 |
|
301 |
-
$api = Mage::getSingleton('emaildirect/
|
302 |
|
303 |
$oldEmail = $customer->getOrigData('email');
|
304 |
$email = $customer->getEmail();
|
305 |
-
|
306 |
-
|
|
|
|
|
|
|
307 |
}
|
308 |
-
elseif($oldEmail != $email)
|
309 |
{
|
310 |
-
|
311 |
-
|
|
|
|
|
|
|
312 |
}
|
|
|
|
|
|
|
|
|
313 |
|
314 |
return $observer;
|
315 |
}
|
316 |
|
317 |
public function registerCheckoutSubscribe(Varien_Event_Observer $observer)
|
318 |
{
|
319 |
-
|
|
|
|
|
|
|
|
|
320 |
return;
|
321 |
}
|
322 |
$subscribe = Mage::app()->getRequest()->getPost('emaildirect_subscribe');
|
323 |
|
324 |
-
if(!is_null($subscribe))
|
|
|
325 |
Mage::getSingleton('core/session')->setEmaildirectCheckout($subscribe);
|
326 |
}
|
|
|
|
|
327 |
}
|
328 |
|
329 |
/**
|
@@ -331,105 +470,164 @@ class EmailDirect_Integration_Model_Observer
|
|
331 |
*/
|
332 |
public function registerCheckoutSuccess(Varien_Event_Observer $observer)
|
333 |
{
|
334 |
-
|
|
|
|
|
|
|
|
|
335 |
return;
|
336 |
}
|
|
|
337 |
$sessionFlag = Mage::getSingleton('core/session')->getEmaildirectCheckout(TRUE);
|
338 |
-
if(
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
//Guest Checkout
|
346 |
-
if( (int)$order->getCustomerGroupId() === Mage_Customer_Model_Group::NOT_LOGGED_IN_ID ){
|
347 |
-
Mage::helper('emaildirect')->registerGuestCustomer($order);
|
348 |
-
}
|
349 |
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
}
|
|
|
|
|
|
|
|
|
|
|
355 |
}
|
356 |
|
357 |
public function salesOrderShipmentTrackSaveAfter(Varien_Event_Observer $observer)
|
358 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
$track = $observer->getEvent()->getTrack();
|
360 |
|
361 |
$order = $track->getShipment()->getOrder();
|
362 |
$shippingMethod = $order->getShippingMethod(); // String in format of 'carrier_method'
|
363 |
if (!$shippingMethod)
|
364 |
-
|
365 |
-
|
|
|
|
|
|
|
366 |
$email = $order->getCustomerEmail();
|
367 |
|
368 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
|
370 |
-
$
|
371 |
|
372 |
-
|
373 |
}
|
374 |
|
375 |
public function orderSaveAfter(Varien_Event_Observer $observer)
|
376 |
{
|
377 |
-
|
|
|
378 |
|
379 |
-
|
380 |
{
|
381 |
-
$
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
$customer->setBillingAddress($order->getBillingAddress());
|
396 |
-
}
|
397 |
-
else
|
398 |
-
{
|
399 |
-
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
400 |
-
$address = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
|
401 |
-
$customer->setBillingAddress($address);
|
402 |
-
}
|
403 |
-
|
404 |
-
$mergeVars = Mage::helper('emaildirect')->getMergeVars($customer, true);
|
405 |
-
$mergeVars = Mage::helper('emaildirect')->getOrderMergeVars($mergeVars,$order);
|
406 |
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
|
|
|
|
|
|
|
|
|
|
425 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
return $observer;
|
427 |
}
|
428 |
|
429 |
// START ABANDONED CRON
|
430 |
private function getAbandonedTime()
|
431 |
{
|
432 |
-
$time =
|
433 |
$time *= 60; // Adjust to seconds.
|
434 |
|
435 |
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
@@ -441,10 +639,10 @@ class EmailDirect_Integration_Model_Observer
|
|
441 |
|
442 |
private function getLastOrder($quote)
|
443 |
{
|
444 |
-
|
445 |
$customer_id = $quote->getData('customer_id');
|
446 |
|
447 |
-
|
448 |
|
449 |
$orders = Mage::getResourceModel('sales/order_collection')
|
450 |
->addFieldToSelect('*')
|
@@ -452,11 +650,11 @@ class EmailDirect_Integration_Model_Observer
|
|
452 |
->addAttributeToSort('created_at', 'DESC')
|
453 |
->setPageSize(1);
|
454 |
|
455 |
-
|
456 |
if ($orders->getSize() <= 0)
|
457 |
return null;
|
458 |
|
459 |
-
|
460 |
$order = $orders->getFirstItem();
|
461 |
|
462 |
return $order;
|
@@ -480,126 +678,64 @@ class EmailDirect_Integration_Model_Observer
|
|
480 |
}
|
481 |
}
|
482 |
|
483 |
-
private function setAbandonedUrl($quote,$url)
|
484 |
-
{
|
485 |
-
$table_name = Mage::getSingleton('core/resource')->getTableName("sales_flat_quote");
|
486 |
-
|
487 |
-
$sql = "UPDATE {$table_name} SET emaildirect_abandoned_url = '{$url}' WHERE entity_id = {$quote->getId()}";
|
488 |
-
|
489 |
-
try
|
490 |
-
{
|
491 |
-
Mage::getSingleton('core/resource')
|
492 |
-
->getConnection('core_write')
|
493 |
-
->query($sql);
|
494 |
-
}
|
495 |
-
catch (Exception $e)
|
496 |
-
{
|
497 |
-
Mage::logException($e);
|
498 |
-
}
|
499 |
-
}
|
500 |
-
|
501 |
private function processAbandoned($quote, $date)
|
502 |
{
|
503 |
-
|
504 |
$email = $quote->getCustomerEmail();
|
505 |
|
506 |
$abandonedDate = $quote->getUpdatedAt();
|
507 |
|
508 |
-
|
509 |
-
$mergeVars = array();
|
510 |
|
511 |
-
$
|
512 |
-
$
|
513 |
|
514 |
-
$
|
515 |
-
$
|
516 |
|
517 |
-
$
|
518 |
|
519 |
$order = $this->getLastOrder($quote);
|
520 |
|
521 |
if ($order != null)
|
522 |
{
|
523 |
-
$
|
524 |
-
|
525 |
|
526 |
-
|
527 |
-
|
528 |
-
{
|
529 |
-
Mage::helper('emaildirect')->debugLog("Get Order");
|
530 |
-
|
531 |
-
if ($order != null)
|
532 |
{
|
533 |
-
|
534 |
-
$
|
535 |
-
$
|
536 |
-
$
|
537 |
|
538 |
-
$
|
539 |
-
$
|
|
|
540 |
}
|
541 |
-
|
542 |
-
|
543 |
}
|
544 |
|
545 |
-
$xml = Mage::getSingleton('emaildirect/wrapper_abandoned')->getOneSubscriber($email,$
|
546 |
|
547 |
$this->setSentToEmailDirectDate($quote, $date);
|
548 |
|
|
|
|
|
549 |
return $xml;
|
550 |
}
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
Mage::helper('emaildirect')->debugLog("Abandoned Carts Processor Start");
|
555 |
-
|
556 |
-
$active = Mage::helper('emaildirect')->config('active');
|
557 |
-
$sendit = Mage::helper('emaildirect')->config('sendabandoned');
|
558 |
-
$setup = Mage::helper('emaildirect')->config('abandonedsetup');
|
559 |
-
|
560 |
-
if (!$active)
|
561 |
-
{
|
562 |
-
Mage::helper('emaildirect')->debugLog("Skipping... EmailDirect Module is Disabled");
|
563 |
-
return;
|
564 |
-
}
|
565 |
-
|
566 |
-
if (!$sendit)
|
567 |
-
{
|
568 |
-
Mage::helper('emaildirect')->debugLog("Skipping... SendIt = False");
|
569 |
-
return;
|
570 |
-
}
|
571 |
-
|
572 |
-
if (!$setup)
|
573 |
-
{
|
574 |
-
Mage::helper('emaildirect')->debugLog("Skipping... Not Setup");
|
575 |
-
return;
|
576 |
-
}
|
577 |
-
|
578 |
// Store the time we last run
|
579 |
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
580 |
$date = date("Y-m-d H:i:s", $date);
|
581 |
|
582 |
-
|
583 |
-
|
584 |
-
Mage::helper('emaildirect/fields')->checkFields();
|
585 |
-
|
586 |
-
$check_date = $this->getAbandonedTime();
|
587 |
-
|
588 |
-
Mage::helper('emaildirect')->debugLog("Check Date: {$check_date}");
|
589 |
-
|
590 |
-
// Get abandoned collection
|
591 |
-
$collection = Mage::getResourceModel('reports/quote_collection');
|
592 |
-
|
593 |
-
$collection->addFieldToFilter('items_count', array('neq' => '0'))
|
594 |
-
->addFieldToFilter('main_table.is_active', '1')
|
595 |
-
->setOrder('updated_at');
|
596 |
-
|
597 |
-
$collection->addFieldToFilter('main_table.updated_at', array('lt' => $check_date));
|
598 |
-
$collection->addFieldToFilter('main_table.emaildirect_abandoned_date', array('null' => true));
|
599 |
-
$collection->addFieldToFilter('main_table.emaildirect_abandoned_url', array('notnull' => true));
|
600 |
-
$collection->addFieldToFilter('main_table.customer_email', array('notnull' => true));
|
601 |
|
602 |
-
Mage::
|
603 |
|
604 |
$subscribers = false;
|
605 |
|
@@ -616,77 +752,118 @@ class EmailDirect_Integration_Model_Observer
|
|
616 |
|
617 |
if (!$subscribers)
|
618 |
{
|
619 |
-
|
620 |
-
return; // No abandoned carts found
|
621 |
}
|
622 |
-
|
623 |
-
|
624 |
-
Mage::helper('emaildirect')->debugLog($xml);
|
625 |
-
|
626 |
-
Mage::helper('emaildirect')->debugLog("Sending Abandoned Carts");
|
627 |
// Send them all at once
|
628 |
$rc = Mage::getSingleton('emaildirect/wrapper_abandoned')->sendSubscribers($xml);
|
|
|
|
|
|
|
|
|
|
|
629 |
|
630 |
-
|
631 |
-
Mage::helper('emaildirect')->debugLog($rc);
|
632 |
|
633 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
634 |
}
|
635 |
|
636 |
public function SendAbandonedCarts($id_list)
|
637 |
{
|
638 |
-
|
|
|
639 |
|
640 |
Mage::helper('emaildirect/fields')->checkFields();
|
641 |
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
646 |
-
$date = date("Y-m-d H:i:s", $date);
|
647 |
-
|
648 |
// Get abandoned collection
|
649 |
$collection = Mage::getResourceModel('reports/quote_collection');
|
650 |
|
651 |
$collection->addFieldToFilter('entity_id', array('in' => $id_list))
|
652 |
->setOrder('updated_at');
|
653 |
|
654 |
-
|
655 |
-
|
656 |
-
$subscribers = false;
|
657 |
-
|
658 |
-
$xml = "<Subscribers>";
|
659 |
-
|
660 |
-
// Get the data for each abandoned cart
|
661 |
-
foreach ($collection as $quote)
|
662 |
-
{
|
663 |
-
$xml .= $this->processAbandoned($quote,$date);
|
664 |
-
$subscribers = true;
|
665 |
-
}
|
666 |
-
|
667 |
-
$xml .= "</Subscribers>";
|
668 |
-
|
669 |
-
if (!$subscribers)
|
670 |
-
{
|
671 |
-
Mage::helper('emaildirect')->debugLog("Exiting... No Carts Found");
|
672 |
-
return; // No abandoned carts found
|
673 |
-
}
|
674 |
-
|
675 |
-
Mage::helper('emaildirect')->debugLog("Subscriber Xml:");
|
676 |
-
Mage::helper('emaildirect')->debugLog($xml);
|
677 |
|
678 |
-
|
679 |
-
// Send them all at once
|
680 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_abandoned')->sendSubscribers($xml);
|
681 |
-
|
682 |
-
Mage::helper('emaildirect')->debugLog("Results:");
|
683 |
-
Mage::helper('emaildirect')->debugLog($rc);
|
684 |
|
685 |
-
|
686 |
}
|
687 |
// END ABANDONED CRON
|
688 |
|
689 |
// START QUOTE SAVE AFTER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
690 |
private function getAbandonedUrl($quote)
|
691 |
{
|
692 |
// We are using comma separated lists for the ID's and Quantities so that it takes up less
|
@@ -711,8 +888,7 @@ class EmailDirect_Integration_Model_Observer
|
|
711 |
|
712 |
$url_data = array("quote" => $quote->getId(), "id" => $ids, "qty" => $qtys);
|
713 |
|
714 |
-
|
715 |
-
Mage::helper('emaildirect')->debugLog($url_data);
|
716 |
|
717 |
$url = base64_encode(serialize($url_data));
|
718 |
|
@@ -723,29 +899,30 @@ class EmailDirect_Integration_Model_Observer
|
|
723 |
|
724 |
public function quoteSaveAfter(Varien_Event_Observer $observer)
|
725 |
{
|
726 |
-
|
|
|
727 |
$quote = $observer->getEvent()->getQuote();
|
728 |
|
729 |
if (trim($quote->getEmaildirectAbandonedDate()))
|
730 |
{
|
731 |
-
|
732 |
return;
|
733 |
}
|
734 |
|
735 |
$url = $this->getAbandonedUrl($quote);
|
736 |
|
737 |
-
|
738 |
|
739 |
if ($quote->getEmaildirectAbandonedUrl() == $url)
|
740 |
{
|
741 |
-
|
742 |
return;
|
743 |
}
|
744 |
|
745 |
-
|
746 |
// Re-save quote with new URL
|
747 |
$this->setAbandonedUrl($quote, $url);
|
748 |
-
|
749 |
}
|
750 |
// END QUOTE SAVE AFTER
|
751 |
}
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_Observer
|
4 |
{
|
5 |
const ABANDONED_LAST_RUN = 'emaildirect/general/abandoned_last_run';
|
6 |
+
|
7 |
+
private $_helper = null;
|
8 |
+
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
$this->_helper = Mage::helper('emaildirect');
|
12 |
+
}
|
13 |
+
|
14 |
/**
|
15 |
* Handle Subscriber object saving process
|
16 |
*/
|
17 |
public function handleSubscriber(Varien_Event_Observer $observer)
|
18 |
{
|
19 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
|
20 |
+
$this->_helper->log('handleSubscriber Start');
|
21 |
+
|
22 |
+
if (!$this->_helper->canEdirect())
|
23 |
+
{
|
24 |
+
$this->_helper->logReason($this->_helper->getDisabledReason());
|
25 |
+
return $observer;
|
26 |
+
}
|
27 |
+
|
28 |
$subscriber = $observer->getEvent()->getSubscriber();
|
29 |
$subscriber->setImportMode(false);
|
30 |
|
31 |
$email = $subscriber->getSubscriberEmail();
|
32 |
+
$listId = $this->_helper->getDefaultPublication($subscriber->getStoreId());
|
33 |
$isConfirmNeed = (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $subscriber->getStoreId()) == 1) ? TRUE : FALSE;
|
34 |
|
35 |
//New subscriber, just add
|
36 |
+
if( $subscriber->isObjectNew() )
|
37 |
+
{
|
38 |
+
$this->_helper->log("New Subscriber");
|
39 |
+
if( TRUE === $isConfirmNeed )
|
40 |
+
{
|
41 |
+
$this->_helper->log("Confirmation Needed");
|
42 |
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
43 |
+
if( !Mage::helper('customer')->isLoggedIn() && Mage::registry('ed_guest_customer'))
|
44 |
+
{
|
45 |
+
$this->_helper->log("Guest Customer");
|
46 |
$guestCustomer = Mage::registry('ed_guest_customer');
|
47 |
$subscriber->setFirstname($guestCustomer->getFirstname());
|
48 |
$subscriber->setLastname($guestCustomer->getLastname());
|
49 |
Mage::unregister('ed_guest_customer');
|
50 |
$subscriber->save();
|
51 |
}
|
52 |
+
else
|
53 |
+
$this->_helper->log("Not a Guest Customer (Doing Nothing?)");
|
54 |
}
|
55 |
+
else
|
56 |
+
{
|
57 |
+
$this->_helper->log("Confirmation Not Required");
|
58 |
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
59 |
+
$merge_vars = $this->_mergeVars($subscriber);
|
60 |
+
|
61 |
+
$this->_helper->log($merge_vars,"Merge Vars");
|
62 |
+
|
63 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
|
64 |
+
->subscriberAdd($email,$merge_vars);
|
65 |
}
|
66 |
+
}
|
67 |
+
else
|
68 |
+
{
|
69 |
+
$this->_helper->log("Existing Subscriber");
|
70 |
+
$status = (int)$subscriber->getData('subscriber_status');
|
71 |
|
72 |
$oldSubscriber = Mage::getModel('newsletter/subscriber')
|
73 |
->load($subscriber->getId());
|
74 |
$oldstatus = (int)$oldSubscriber->getOrigData('subscriber_status');
|
75 |
+
if ($oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED && $status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
76 |
+
{
|
77 |
+
$this->_helper->log("Unconfirmed to Subscribed");
|
78 |
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
79 |
+
$merge_vars = $this->_mergeVars($subscriber);
|
80 |
+
|
81 |
+
$this->_helper->log($merge_vars,"Merge Vars");
|
82 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
|
83 |
+
->subscriberAdd($email,$merge_vars);
|
84 |
}
|
85 |
+
elseif( $status !== $oldstatus )
|
86 |
+
{
|
87 |
+
//Status change
|
88 |
+
$this->_helper->log("Status Change");
|
89 |
+
|
90 |
//Unsubscribe customer
|
91 |
+
if($status == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
|
92 |
+
{
|
93 |
+
$this->_helper->log("Unsubscribed");
|
94 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_publications')
|
95 |
->unsubscribe($listId, $email);
|
96 |
+
}
|
97 |
+
else if($status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
98 |
+
{
|
99 |
+
$this->_helper->log("Subscribed");
|
100 |
+
if( $oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE || $oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED )
|
101 |
+
{
|
102 |
+
$this->_helper->log("Changing Status");
|
103 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_publications')
|
104 |
->subscribe($listId, $email);
|
105 |
}
|
106 |
+
else
|
107 |
+
$this->_helper->log("Status Not Changed");
|
108 |
}
|
109 |
}
|
110 |
}
|
111 |
+
$this->_helper->log('handleSubscriber End');
|
112 |
+
}
|
113 |
+
|
114 |
+
// Remove Unsubscribe option from Newsletter grid
|
115 |
+
public function updateNewsletterMassAction($observer)
|
116 |
+
{
|
117 |
+
if (!$this->_helper->canEdirect())
|
118 |
+
return $observer;
|
119 |
+
|
120 |
+
$block = $observer->getEvent()->getBlock();
|
121 |
+
|
122 |
+
if (get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
|
123 |
+
&& $block->getRequest()->getControllerName() == 'newsletter_subscriber')
|
124 |
+
{
|
125 |
+
$block->removeItem('unsubscribe');
|
126 |
+
}
|
127 |
}
|
128 |
|
129 |
/**
|
132 |
*/
|
133 |
public function handleSubscriberDeletion(Varien_Event_Observer $observer)
|
134 |
{
|
135 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
|
136 |
+
$this->_helper->log("Handle Subscriber Deletion Start");
|
137 |
+
|
138 |
+
if (!$this->_helper->canEdirect())
|
139 |
+
{
|
140 |
+
$this->_helper->logReason($this->_helper->getDisabledReason());
|
141 |
+
return $observer;
|
142 |
+
}
|
143 |
+
|
144 |
$subscriber = $observer->getEvent()->getSubscriber();
|
145 |
+
|
146 |
+
$email = $subscriber->getSubscriberEmail();
|
147 |
+
|
148 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
|
149 |
+
->subscriberDelete($email);
|
150 |
+
|
151 |
+
$this->_helper->log("Handle Subscriber Deletion End");
|
152 |
}
|
153 |
|
154 |
+
private function validateSource($source, $sources, $store)
|
155 |
{
|
156 |
+
if ($source == '')
|
157 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
$source = "Magento";
|
159 |
+
$this->_helper->updateConfig('source', $source, $store);
|
|
|
|
|
160 |
}
|
161 |
+
|
162 |
+
//check if the source exist
|
163 |
+
$source_id = '';
|
164 |
foreach($sources as $item)
|
165 |
{
|
166 |
+
if($item['name']==$source)
|
167 |
+
{
|
168 |
+
$source_id = $item['id'];
|
|
|
169 |
break;
|
170 |
}
|
171 |
}
|
172 |
|
173 |
+
if ($source_id == '')
|
174 |
+
{
|
175 |
$rc = Mage::getSingleton('emaildirect/wrapper_sources')->addSource($source);
|
176 |
+
if(!isset($rc->SourceID))
|
177 |
+
{
|
178 |
Mage::throwException("Error adding source");
|
179 |
}
|
180 |
+
else
|
181 |
+
{
|
182 |
+
$this->_helper->updateConfig('sourceid', $rc->SourceID, $store);
|
|
|
183 |
}
|
184 |
}
|
185 |
+
else
|
186 |
+
{
|
187 |
+
$this->_helper->updateConfig('sourceid', $source_id, $store);
|
|
|
188 |
}
|
189 |
+
}
|
190 |
+
|
191 |
+
private function saveTroubleshooting($store)
|
192 |
+
{
|
193 |
+
$post = Mage::app()->getRequest()->getPost();
|
194 |
|
195 |
+
$status = $post['groups']['troubleshooting']['fields']['enabled']['value'];
|
196 |
+
|
197 |
+
if ($status)
|
198 |
+
$this->_helper->turnOnTroubleshooting($store);
|
199 |
+
else
|
200 |
+
$this->_helper->turnOffTroubleshooting($store);
|
201 |
+
}
|
202 |
+
|
203 |
+
public function saveConfig(Varien_Event_Observer $observer)
|
204 |
+
{
|
205 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::IGNORE);
|
206 |
+
$store = is_null($observer->getEvent()->getStore()) ? 'default': $observer->getEvent()->getStore();
|
207 |
+
$post = Mage::app()->getRequest()->getPost();
|
208 |
+
|
209 |
+
$fields = $post['groups']['general']['fields'];
|
210 |
+
|
211 |
+
$apiKey = isset($fields['apikey']['value']) ? $fields['apikey']['value'] : '';
|
212 |
+
|
213 |
+
if ($apiKey == '')
|
214 |
{
|
215 |
+
$this->_helper->updateConfig('setup', false, $store);
|
216 |
+
return $observer;
|
217 |
+
}
|
218 |
+
|
219 |
+
$sources = Mage::getSingleton('emaildirect/wrapper_sources')->getSources();
|
220 |
+
|
221 |
+
if (is_string($sources))
|
222 |
+
{
|
223 |
+
$this->_helper->updateConfig('setup', false, $store);
|
224 |
+
Mage::throwException($sources);
|
225 |
}
|
226 |
|
227 |
+
$this->_helper->updateConfig('setup', true, $store);
|
228 |
+
|
229 |
+
$source = isset($fields['source']['value']) ? $fields['source']['value'] : '';
|
230 |
+
|
231 |
+
$this->validateSource($source, $sources, $store);
|
232 |
+
|
233 |
+
$force_product = false;
|
234 |
+
if (isset($fields['save_latest_order']['value']) && $fields['save_latest_order']['value'] == true)
|
235 |
+
$force_product = true;
|
236 |
+
|
237 |
// Verify all custom fields are present
|
238 |
Mage::helper('emaildirect/fields')->verifyFields($force_product);
|
239 |
+
|
240 |
+
$this->saveTroubleshooting($store);
|
241 |
}
|
242 |
|
243 |
public function _mergeVars($object = NULL, $includeEmail = FALSE)
|
244 |
{
|
245 |
//Initialize as GUEST customer
|
246 |
$customer = new Varien_Object;
|
247 |
+
|
248 |
+
$this->_helper->log("Observer Merge Vars");
|
249 |
|
250 |
$regCustomer = Mage::registry('current_customer');
|
251 |
$guestCustomer = Mage::registry('ed_guest_customer');
|
252 |
|
253 |
+
if (Mage::helper('customer')->isLoggedIn())
|
254 |
+
{
|
255 |
+
$this->_helper->log("Logged in Customer");
|
256 |
$customer = Mage::helper('customer')->getCustomer();
|
257 |
+
}
|
258 |
+
else if ($regCustomer)
|
259 |
+
{
|
260 |
+
$this->_helper->log("Current Customer");
|
261 |
$customer = $regCustomer;
|
262 |
+
}
|
263 |
+
else if ($guestCustomer)
|
264 |
+
{
|
265 |
+
$this->_helper->log("Guest Customer");
|
266 |
$customer = $guestCustomer;
|
267 |
+
}
|
268 |
+
else
|
269 |
+
{
|
270 |
+
$this->_helper->log("Parameter Customer");
|
|
|
|
|
|
|
271 |
$customer = $object;
|
272 |
}
|
273 |
+
|
274 |
$address = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
|
275 |
if ($address)
|
276 |
$customer->setBillingAddress($address);
|
277 |
|
278 |
+
$merge_vars = $this->_helper->getMergeVars($customer, $includeEmail);
|
279 |
|
280 |
+
return $merge_vars;
|
281 |
}
|
282 |
|
283 |
+
private function addMergeItem($item, $pos, $merge_vars, $prefix = "")
|
284 |
{
|
285 |
$name = "";
|
286 |
$sku = "";
|
298 |
else
|
299 |
{
|
300 |
if ($item->getProduct() == null)
|
301 |
+
return $merge_vars; // Can't get product so abort
|
302 |
$product_id = $item->getProduct()->getId();
|
303 |
}
|
304 |
|
318 |
else
|
319 |
$cost = $item->getPrice();
|
320 |
|
321 |
+
$cost = Mage::helper('core')->currency($cost,true,false);//number_format($cost, 2, '.', '');
|
322 |
$description = $product->getShortDescription();
|
323 |
}
|
324 |
}
|
325 |
|
326 |
+
$merge_vars["{$prefix}ProductName{$pos}"] = $name;
|
327 |
+
$merge_vars["{$prefix}SKU{$pos}"] = $sku;
|
328 |
+
$merge_vars["{$prefix}URL{$pos}"] = $url;
|
329 |
+
$merge_vars["{$prefix}Image{$pos}"] = $image;
|
330 |
|
331 |
+
$merge_vars["{$prefix}Cost{$pos}"] = $cost;
|
332 |
+
$merge_vars["{$prefix}Description{$pos}"] = $description;
|
333 |
|
334 |
+
return $merge_vars;
|
335 |
}
|
336 |
|
337 |
+
private function getRelatedOrderItems($quote, $merge_vars)
|
338 |
{
|
339 |
$prefix = "Related";
|
340 |
|
341 |
+
$max_count = $this->_helper->config('related_fields');
|
342 |
|
343 |
$id_list = array();
|
344 |
|
365 |
if ($count > $max_count)
|
366 |
break;
|
367 |
|
368 |
+
$merge_vars = $this->addMergeItem($rp['linked_product_id'], $count, $merge_vars, $prefix);
|
369 |
}
|
370 |
|
371 |
while ($count < $max_count)
|
372 |
{
|
373 |
$count++;
|
374 |
+
$merge_vars = $this->addMergeItem(null, $count, $merge_vars, $prefix);
|
375 |
}
|
376 |
|
377 |
+
return $merge_vars;
|
378 |
}
|
379 |
|
380 |
+
private function getMergeOrderItems($quote, $merge_vars, $prefix = "")
|
381 |
{
|
382 |
+
$max_count = $this->_helper->config('product_fields');
|
383 |
|
384 |
$count = 0;
|
385 |
|
390 |
if ($count > $max_count)
|
391 |
break;
|
392 |
|
393 |
+
$merge_vars = $this->addMergeItem($item, $count, $merge_vars, $prefix);
|
394 |
}
|
395 |
|
396 |
while ($count < $max_count)
|
397 |
{
|
398 |
$count++;
|
399 |
+
$merge_vars = $this->addMergeItem(null, $count, $merge_vars, $prefix);
|
400 |
}
|
401 |
|
402 |
+
return $merge_vars;
|
403 |
}
|
404 |
|
405 |
public function updateCustomer(Varien_Event_Observer $observer)
|
406 |
{
|
407 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::CUSTOMER);
|
408 |
+
$this->_helper->log("Update Customer Start");
|
409 |
+
|
410 |
+
if (!$this->_helper->canEdirect())
|
411 |
+
{
|
412 |
+
$this->_helper->logReason($this->_helper->getDisabledReason());
|
413 |
+
return $observer;
|
414 |
+
}
|
415 |
+
|
416 |
$store = Mage::app()->getStore()->getId();
|
417 |
$customer = $observer->getEvent()->getCustomer();
|
418 |
|
419 |
+
$merge_vars = $this->_mergeVars($customer, TRUE);
|
420 |
+
|
421 |
+
$this->_helper->log($merge_vars,"Merge Vars");
|
422 |
|
423 |
+
$api = Mage::getSingleton('emaildirect/wrapper_subscribers');
|
424 |
|
425 |
$oldEmail = $customer->getOrigData('email');
|
426 |
$email = $customer->getEmail();
|
427 |
+
|
428 |
+
if ($oldEmail == '')
|
429 |
+
{
|
430 |
+
$this->_helper->log("Original Email was blank. Adding Subscriber");
|
431 |
+
$rc = $api->subscriberAdd($email,$merge_vars);
|
432 |
}
|
433 |
+
elseif ($oldEmail != $email)
|
434 |
{
|
435 |
+
$this->_helper->log("Modifying Email");
|
436 |
+
$rc = $api->mailModify($oldEmail,$email);
|
437 |
+
|
438 |
+
$this->_helper->log("Adding Subscriber");
|
439 |
+
$rc = $api->subscriberAdd($email,$merge_vars);
|
440 |
}
|
441 |
+
else
|
442 |
+
$this->_helper->logReason("Email has not been changed");
|
443 |
+
|
444 |
+
$this->_helper->log("Update Customer End");
|
445 |
|
446 |
return $observer;
|
447 |
}
|
448 |
|
449 |
public function registerCheckoutSubscribe(Varien_Event_Observer $observer)
|
450 |
{
|
451 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
|
452 |
+
$this->_helper->log("Register Checkout Subscribe Start");
|
453 |
+
if(!$this->_helper->canEdirect())
|
454 |
+
{
|
455 |
+
$this->_helper->logReason($this->_helper->getDisabledReason());
|
456 |
return;
|
457 |
}
|
458 |
$subscribe = Mage::app()->getRequest()->getPost('emaildirect_subscribe');
|
459 |
|
460 |
+
if(!is_null($subscribe))
|
461 |
+
{
|
462 |
Mage::getSingleton('core/session')->setEmaildirectCheckout($subscribe);
|
463 |
}
|
464 |
+
|
465 |
+
$this->_helper->log("Register Checkout Subscribe End");
|
466 |
}
|
467 |
|
468 |
/**
|
470 |
*/
|
471 |
public function registerCheckoutSuccess(Varien_Event_Observer $observer)
|
472 |
{
|
473 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
|
474 |
+
$this->_helper->log("Register Checkout Success Start");
|
475 |
+
if(!$this->_helper->canEdirect())
|
476 |
+
{
|
477 |
+
$this->_helper->logReason($this->_helper->getDisabledReason());
|
478 |
return;
|
479 |
}
|
480 |
+
|
481 |
$sessionFlag = Mage::getSingleton('core/session')->getEmaildirectCheckout(TRUE);
|
482 |
+
if (!$sessionFlag)
|
483 |
+
{
|
484 |
+
$this->_helper->logReason("Session flag not found.");
|
485 |
+
return;
|
486 |
+
}
|
487 |
+
|
488 |
+
$orderId = (int)current($observer->getEvent()->getOrderIds());
|
|
|
|
|
|
|
|
|
489 |
|
490 |
+
if (!$orderId)
|
491 |
+
{
|
492 |
+
$this->_helper->logReason("Order ID not found.");
|
493 |
+
return;
|
494 |
+
}
|
495 |
+
|
496 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
497 |
+
if (!$order->getId())
|
498 |
+
{
|
499 |
+
$this->_helper->logReason("Failed to Load Order ({$orderId}).");
|
500 |
+
return;
|
501 |
+
}
|
502 |
+
|
503 |
+
$this->_helper->log("Processing Order # " . $order->getIncrementId());
|
504 |
+
|
505 |
+
//Guest Checkout
|
506 |
+
if( (int)$order->getCustomerGroupId() === Mage_Customer_Model_Group::NOT_LOGGED_IN_ID )
|
507 |
+
{
|
508 |
+
$this->_helper->log("Guest Checkout");
|
509 |
+
$this->_helper->registerGuestCustomer($order);
|
510 |
}
|
511 |
+
|
512 |
+
$rc = $subscriber = Mage::getModel('newsletter/subscriber')
|
513 |
+
->subscribe($order->getCustomerEmail());
|
514 |
+
|
515 |
+
$this->_helper->log("Register Checkout Success End");
|
516 |
}
|
517 |
|
518 |
public function salesOrderShipmentTrackSaveAfter(Varien_Event_Observer $observer)
|
519 |
{
|
520 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ORDERS);
|
521 |
+
$this->_helper->log("Sales Order Shipment Track Save After Start");
|
522 |
+
if(!$this->_helper->canEdirect())
|
523 |
+
{
|
524 |
+
$this->_helper->logReason($this->_helper->getDisabledReason());
|
525 |
+
return;
|
526 |
+
}
|
527 |
$track = $observer->getEvent()->getTrack();
|
528 |
|
529 |
$order = $track->getShipment()->getOrder();
|
530 |
$shippingMethod = $order->getShippingMethod(); // String in format of 'carrier_method'
|
531 |
if (!$shippingMethod)
|
532 |
+
{
|
533 |
+
$this->_helper->logReason("Shipping Method not found");
|
534 |
+
return $observer;
|
535 |
+
}
|
536 |
+
|
537 |
$email = $order->getCustomerEmail();
|
538 |
|
539 |
+
$merge_vars = array();
|
540 |
+
|
541 |
+
$merge_vars = $this->_helper->getTrackingMergeVars($track, $order);
|
542 |
+
|
543 |
+
if ($merge_vars == null)
|
544 |
+
{
|
545 |
+
$this->_helper->logReason("No shipping fields setup");
|
546 |
+
return $observer;
|
547 |
+
}
|
548 |
+
|
549 |
+
$this->_helper->log($merge_vars,"Merge Vars");
|
550 |
+
|
551 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_orders')->addSubscriberTracking($email, $merge_vars);
|
552 |
|
553 |
+
$this->_helper->log("Sales Order Shipment Track Save After Start");
|
554 |
|
555 |
+
return $observer;
|
556 |
}
|
557 |
|
558 |
public function orderSaveAfter(Varien_Event_Observer $observer)
|
559 |
{
|
560 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
|
561 |
+
$this->_helper->log("Order Save After Start");
|
562 |
|
563 |
+
if (!$this->_helper->getOrdersEnabled())
|
564 |
{
|
565 |
+
$this->_helper->logReason($this->_helper->getOrdersDisabledReason());
|
566 |
+
return $observer;
|
567 |
+
}
|
568 |
+
|
569 |
+
$order = $observer->getEvent()->getOrder();
|
570 |
+
|
571 |
+
$this->_helper->log("Order Save After: " . $order->getIncrementId());
|
572 |
+
if($order->getState() !== Mage_Sales_Model_Order::STATE_COMPLETE)
|
573 |
+
{
|
574 |
+
$this->_helper->logReason("Order is not complete.");
|
575 |
+
return $observer;
|
576 |
+
}
|
577 |
+
|
578 |
+
//$this->_helper->log("Order is complete. Processing...");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
579 |
|
580 |
+
$email = $order->getCustomerEmail();
|
581 |
+
|
582 |
+
if ($order->getData('customer_is_guest'))
|
583 |
+
{
|
584 |
+
$this->_helper->log("Guest Customer");
|
585 |
+
|
586 |
+
$customer = new Varien_Object;
|
587 |
+
|
588 |
+
$customer->setData('email',$email);
|
589 |
+
$customer->setData('firstname',$order->getData('customer_firstname'));
|
590 |
+
$customer->setData('lastname',$order->getData('customer_lastname'));
|
591 |
+
$customer->setData('store_id',$order->getStoreId());
|
592 |
+
|
593 |
+
$customer->setBillingAddress($order->getBillingAddress());
|
594 |
+
}
|
595 |
+
else
|
596 |
+
{
|
597 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
598 |
+
$address = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
|
599 |
+
$customer->setBillingAddress($address);
|
600 |
+
}
|
601 |
|
602 |
+
$merge_vars = $this->_helper->getMergeVars($customer, true);
|
603 |
+
$merge_vars = $this->_helper->getOrderMergeVars($merge_vars,$order);
|
604 |
+
|
605 |
+
if ($this->_helper->config('save_latest_order'))
|
606 |
+
{
|
607 |
+
$this->_helper->log("Getting Latest Order Info");
|
608 |
+
$merge_vars['LastOrderNumber'] = $order->getIncrementId();
|
609 |
+
$merge_vars['LastPurchaseDate'] = $order->getData('created_at');
|
610 |
+
$merge_vars['LastPurchaseTotal'] = Mage::helper('core')->currency($order->getData('total_paid'), true, false);
|
611 |
+
|
612 |
+
$merge_vars = $this->getMergeOrderItems($order, $merge_vars);
|
613 |
+
$merge_vars = $this->getRelatedOrderItems($order, $merge_vars);
|
614 |
}
|
615 |
+
|
616 |
+
$this->_helper->log($merge_vars, "Merge Vars");
|
617 |
+
|
618 |
+
Mage::helper('emaildirect/fields')->checkFields();
|
619 |
+
|
620 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_orders')->addSubscriberOrder($email,$order, $merge_vars);
|
621 |
+
|
622 |
+
$this->_helper->log("Order Save After End");
|
623 |
+
|
624 |
return $observer;
|
625 |
}
|
626 |
|
627 |
// START ABANDONED CRON
|
628 |
private function getAbandonedTime()
|
629 |
{
|
630 |
+
$time = $this->_helper->config('abandonedtime');
|
631 |
$time *= 60; // Adjust to seconds.
|
632 |
|
633 |
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
639 |
|
640 |
private function getLastOrder($quote)
|
641 |
{
|
642 |
+
$this->_helper->log("Get Last Order");
|
643 |
$customer_id = $quote->getData('customer_id');
|
644 |
|
645 |
+
$this->_helper->log("Customer ID: {$customer_id}");
|
646 |
|
647 |
$orders = Mage::getResourceModel('sales/order_collection')
|
648 |
->addFieldToSelect('*')
|
650 |
->addAttributeToSort('created_at', 'DESC')
|
651 |
->setPageSize(1);
|
652 |
|
653 |
+
$this->_helper->log("Order Count: " . $orders->getSize());
|
654 |
if ($orders->getSize() <= 0)
|
655 |
return null;
|
656 |
|
657 |
+
$this->_helper->log("Order Found");
|
658 |
$order = $orders->getFirstItem();
|
659 |
|
660 |
return $order;
|
678 |
}
|
679 |
}
|
680 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
681 |
private function processAbandoned($quote, $date)
|
682 |
{
|
683 |
+
$this->_helper->log("ProcessAbandoned Start");
|
684 |
$email = $quote->getCustomerEmail();
|
685 |
|
686 |
$abandonedDate = $quote->getUpdatedAt();
|
687 |
|
688 |
+
$merge_vars = array();
|
|
|
689 |
|
690 |
+
$merge_vars['FirstName'] = $quote->getData('customer_firstname');
|
691 |
+
$merge_vars['LastName'] = $quote->getData('customer_lastname');
|
692 |
|
693 |
+
$merge_vars['AbandonedDate'] = $abandonedDate;
|
694 |
+
$merge_vars['AbandonedUrl'] = $quote->getEmaildirectAbandonedUrl();
|
695 |
|
696 |
+
$merge_vars = $this->getMergeOrderItems($quote, $merge_vars, "AB");
|
697 |
|
698 |
$order = $this->getLastOrder($quote);
|
699 |
|
700 |
if ($order != null)
|
701 |
{
|
702 |
+
$this->_helper->log("Processing Last Order");
|
703 |
+
$merge_vars = $this->_helper->getOrderMergeVars($merge_vars,$order);
|
704 |
|
705 |
+
$this->_helper->log("Check Save Lastest");
|
706 |
+
if ($this->_helper->config('save_latest_order'))
|
|
|
|
|
|
|
|
|
707 |
{
|
708 |
+
$this->_helper->log("Adding Latest Order Information");
|
709 |
+
$merge_vars['LastOrderNumber'] = $order->getIncrementId();
|
710 |
+
$merge_vars['LastPurchaseDate'] = $order->getData('created_at');
|
711 |
+
$merge_vars['LastPurchaseTotal'] = Mage::helper('core')->currency($order->getData('total_paid'), true, false);
|
712 |
|
713 |
+
$merge_vars = $this->getMergeOrderItems($order, $merge_vars);
|
714 |
+
$merge_vars = $this->getRelatedOrderItems($order, $merge_vars);
|
715 |
+
$this->_helper->log("Finish Save Latest");
|
716 |
}
|
717 |
+
else
|
718 |
+
$this->_helper->log("Don't save latest order information");
|
719 |
}
|
720 |
|
721 |
+
$xml = Mage::getSingleton('emaildirect/wrapper_abandoned')->getOneSubscriber($email,$merge_vars);
|
722 |
|
723 |
$this->setSentToEmailDirectDate($quote, $date);
|
724 |
|
725 |
+
$this->_helper->log("ProcessAbandoned End");
|
726 |
+
|
727 |
return $xml;
|
728 |
}
|
729 |
+
|
730 |
+
private function _abandonedCartsProcessor($collection, $mark_time = true)
|
731 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
732 |
// Store the time we last run
|
733 |
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
734 |
$date = date("Y-m-d H:i:s", $date);
|
735 |
|
736 |
+
$this->_helper->log("Saving Last Run Date: {$date}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
|
738 |
+
Mage::getConfig()->saveConfig(self::ABANDONED_LAST_RUN, $date,"default","default");
|
739 |
|
740 |
$subscribers = false;
|
741 |
|
752 |
|
753 |
if (!$subscribers)
|
754 |
{
|
755 |
+
$this->_helper->logReason("No Carts Found");
|
756 |
+
return $observer; // No abandoned carts found
|
757 |
}
|
758 |
+
|
759 |
+
$this->_helper->log("Sending Abandoned Carts");
|
|
|
|
|
|
|
760 |
// Send them all at once
|
761 |
$rc = Mage::getSingleton('emaildirect/wrapper_abandoned')->sendSubscribers($xml);
|
762 |
+
}
|
763 |
+
|
764 |
+
public function abandonedStoreProcessor($store, $check_date)
|
765 |
+
{
|
766 |
+
$store_code = $store->getCode();
|
767 |
|
768 |
+
$this->_helper->log("Processing Store: {$store_code}");
|
|
|
769 |
|
770 |
+
if (!$this->_helper->getAbandonedEnabled())
|
771 |
+
{
|
772 |
+
$this->_helper->logReason($this->_helper->getAbandonedDisabledReason());
|
773 |
+
return;
|
774 |
+
}
|
775 |
+
|
776 |
+
Mage::helper('emaildirect/fields')->checkFields();
|
777 |
+
|
778 |
+
// Get abandoned collection
|
779 |
+
$collection = Mage::getResourceModel('reports/quote_collection');
|
780 |
+
|
781 |
+
$collection->addFieldToFilter('items_count', array('neq' => '0'))
|
782 |
+
->addFieldToFilter('main_table.is_active', '1')
|
783 |
+
->setOrder('updated_at');
|
784 |
+
|
785 |
+
$collection->addFieldToFilter('main_table.updated_at', array('lt' => $check_date));
|
786 |
+
$collection->addFieldToFilter('main_table.emaildirect_abandoned_date', array('null' => true));
|
787 |
+
$collection->addFieldToFilter('main_table.emaildirect_abandoned_url', array('notnull' => true));
|
788 |
+
$collection->addFieldToFilter('main_table.customer_email', array('notnull' => true));
|
789 |
+
|
790 |
+
$collection->addFieldToFilter('store_id', array('eq' => $store->getId()));
|
791 |
+
|
792 |
+
$this->_helper->log("SQL: " . $collection->getSelect()->__toString());
|
793 |
+
|
794 |
+
$this->_abandonedCartsProcessor($collection);
|
795 |
+
|
796 |
+
$this->_helper->log("Finished Processing Store: {$store_code}");
|
797 |
+
}
|
798 |
+
|
799 |
+
public function abandonedCartsProcessor()
|
800 |
+
{
|
801 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
|
802 |
+
$this->_helper->log("Abandoned Carts Processor Start");
|
803 |
+
|
804 |
+
$check_date = $this->getAbandonedTime();
|
805 |
+
|
806 |
+
$this->_helper->log("Check Date: {$check_date}");
|
807 |
+
|
808 |
+
$stores = Mage::app()->getStores();
|
809 |
+
|
810 |
+
$starting_store = Mage::app()->getStore()->getCode();
|
811 |
+
|
812 |
+
foreach ($stores as $store)
|
813 |
+
{
|
814 |
+
Mage::app()->setCurrentStore($store->getCode());
|
815 |
+
|
816 |
+
$this->abandonedStoreProcessor($store, $check_date);
|
817 |
+
}
|
818 |
+
|
819 |
+
Mage::app()->setCurrentStore($starting_store);
|
820 |
+
|
821 |
+
$this->_helper->log("Abandoned Carts Processor End");
|
822 |
}
|
823 |
|
824 |
public function SendAbandonedCarts($id_list)
|
825 |
{
|
826 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
|
827 |
+
$this->_helper->log("Sending Specific Abandoned Carts Start");
|
828 |
|
829 |
Mage::helper('emaildirect/fields')->checkFields();
|
830 |
|
831 |
+
$this->_helper->log($id_list, "ID LIST");
|
832 |
+
|
|
|
|
|
|
|
|
|
833 |
// Get abandoned collection
|
834 |
$collection = Mage::getResourceModel('reports/quote_collection');
|
835 |
|
836 |
$collection->addFieldToFilter('entity_id', array('in' => $id_list))
|
837 |
->setOrder('updated_at');
|
838 |
|
839 |
+
$this->_helper->log("SQL: " . $collection->getSelect()->__toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
840 |
|
841 |
+
$this->_abandonedCartsProcessor($collection, false);
|
|
|
|
|
|
|
|
|
|
|
842 |
|
843 |
+
$this->_helper->log("Sending Specific Abandoned Carts End");
|
844 |
}
|
845 |
// END ABANDONED CRON
|
846 |
|
847 |
// START QUOTE SAVE AFTER
|
848 |
+
private function setAbandonedUrl($quote,$url)
|
849 |
+
{
|
850 |
+
$table_name = Mage::getSingleton('core/resource')->getTableName("sales_flat_quote");
|
851 |
+
|
852 |
+
$sql = "UPDATE {$table_name} SET emaildirect_abandoned_url = '{$url}' WHERE entity_id = {$quote->getId()}";
|
853 |
+
|
854 |
+
try
|
855 |
+
{
|
856 |
+
Mage::getSingleton('core/resource')
|
857 |
+
->getConnection('core_write')
|
858 |
+
->query($sql);
|
859 |
+
}
|
860 |
+
catch (Exception $e)
|
861 |
+
{
|
862 |
+
$this->_helper->log($e);
|
863 |
+
Mage::logException($e);
|
864 |
+
}
|
865 |
+
}
|
866 |
+
|
867 |
private function getAbandonedUrl($quote)
|
868 |
{
|
869 |
// We are using comma separated lists for the ID's and Quantities so that it takes up less
|
888 |
|
889 |
$url_data = array("quote" => $quote->getId(), "id" => $ids, "qty" => $qtys);
|
890 |
|
891 |
+
$this->_helper->log($url_data, "Abandoned Url Data");
|
|
|
892 |
|
893 |
$url = base64_encode(serialize($url_data));
|
894 |
|
899 |
|
900 |
public function quoteSaveAfter(Varien_Event_Observer $observer)
|
901 |
{
|
902 |
+
$this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
|
903 |
+
$this->_helper->log("Quote Save After Start");
|
904 |
$quote = $observer->getEvent()->getQuote();
|
905 |
|
906 |
if (trim($quote->getEmaildirectAbandonedDate()))
|
907 |
{
|
908 |
+
$this->_helper->logReason("Already sent.");
|
909 |
return;
|
910 |
}
|
911 |
|
912 |
$url = $this->getAbandonedUrl($quote);
|
913 |
|
914 |
+
$this->_helper->log("Abandoned Url: {$url}");
|
915 |
|
916 |
if ($quote->getEmaildirectAbandonedUrl() == $url)
|
917 |
{
|
918 |
+
$this->_helper->logReason("Abandoned Url is up to date.");
|
919 |
return;
|
920 |
}
|
921 |
|
922 |
+
$this->_helper->log("Saving Quote.");
|
923 |
// Re-save quote with new URL
|
924 |
$this->setAbandonedUrl($quote, $url);
|
925 |
+
$this->_helper->log("Quote Save After End");
|
926 |
}
|
927 |
// END QUOTE SAVE AFTER
|
928 |
}
|
app/code/local/EmailDirect/Integration/Model/System/Config/Source/Abandoned.php
CHANGED
@@ -2,30 +2,30 @@
|
|
2 |
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Abandoned
|
4 |
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
}
|
2 |
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Abandoned
|
4 |
{
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
array('value' => 0, 'label' => Mage::helper('emaildirect')->__('Do not send through Magento')),
|
14 |
+
array('value' => 1, 'label' => Mage::helper('emaildirect')->__('1 Day')),
|
15 |
+
array('value' => 2, 'label' => Mage::helper('emaildirect')->__('2 Days')),
|
16 |
+
array('value' => 3, 'label' => Mage::helper('emaildirect')->__('3 Days')),
|
17 |
+
array('value' => 4, 'label' => Mage::helper('emaildirect')->__('4 Days')),
|
18 |
+
array('value' => 5, 'label' => Mage::helper('emaildirect')->__('5 Days')),
|
19 |
+
array('value' => 6, 'label' => Mage::helper('emaildirect')->__('6 Days')),
|
20 |
+
array('value' => 7, 'label' => Mage::helper('emaildirect')->__('7 Days')),
|
21 |
+
array('value' => 8, 'label' => Mage::helper('emaildirect')->__('8 Days')),
|
22 |
+
array('value' => 9, 'label' => Mage::helper('emaildirect')->__('9 Days')),
|
23 |
+
array('value' => 10, 'label' => Mage::helper('emaildirect')->__('10 Days')),
|
24 |
+
array('value' => 11, 'label' => Mage::helper('emaildirect')->__('11 Days')),
|
25 |
+
array('value' => 12, 'label' => Mage::helper('emaildirect')->__('12 Days')),
|
26 |
+
array('value' => 13, 'label' => Mage::helper('emaildirect')->__('13 Days')),
|
27 |
+
array('value' => 14, 'label' => Mage::helper('emaildirect')->__('14 Days')),
|
28 |
+
array('value' => 15, 'label' => Mage::helper('emaildirect')->__('15 Days')),
|
29 |
+
);
|
30 |
+
}
|
31 |
+
}
|
app/code/local/EmailDirect/Integration/Model/System/Config/Source/Abandonedlist.php
CHANGED
@@ -4,6 +4,8 @@ class EmailDirect_Integration_Model_System_Config_Source_Abandonedlist
|
|
4 |
{
|
5 |
public function toOptionArray()
|
6 |
{
|
|
|
|
|
7 |
$options = array();
|
8 |
|
9 |
$options[] = array(
|
4 |
{
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
+
Mage::helper('emaildirect')->setLogArea(EmailDirect_Integration_Helper_Data::IGNORE);
|
8 |
+
|
9 |
$options = array();
|
10 |
|
11 |
$options[] = array(
|
app/code/local/EmailDirect/Integration/Model/System/Config/Source/Additionallist.php
CHANGED
@@ -1,18 +1,12 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Nov 25, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_System_Config_Source_Additionallist
|
9 |
{
|
10 |
public function toOptionArray()
|
11 |
{
|
|
|
12 |
$options = array();
|
13 |
|
14 |
-
// $ws = Mage::getModel('emaildirect/wrapper_lists');
|
15 |
-
// $lists = $ws->getLists();
|
16 |
$lists = Mage::getSingleton('emaildirect/wrapper_lists')->getLists();
|
17 |
foreach($lists as $list)
|
18 |
{
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Additionallist
|
4 |
{
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
+
Mage::helper('emaildirect')->setLogArea(EmailDirect_Integration_Helper_Data::IGNORE);
|
8 |
$options = array();
|
9 |
|
|
|
|
|
10 |
$lists = Mage::getSingleton('emaildirect/wrapper_lists')->getLists();
|
11 |
foreach($lists as $list)
|
12 |
{
|
app/code/local/EmailDirect/Integration/Model/System/Config/Source/Checkoutsubscribe.php
CHANGED
@@ -2,18 +2,14 @@
|
|
2 |
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Checkoutsubscribe
|
4 |
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
*/
|
10 |
-
public function toOptionArray()
|
11 |
-
{
|
12 |
-
return array(
|
13 |
array('value' => 1, 'label' => Mage::helper('emaildirect')->__('Enabled - Checked by default')),
|
14 |
array('value' => 2, 'label' => Mage::helper('emaildirect')->__('Enabled - Not Checked by default')),
|
15 |
array('value' => 3, 'label' => Mage::helper('emaildirect')->__('Enabled - Force subscription')),
|
16 |
array('value' => 0, 'label' => Mage::helper('emaildirect')->__('-- Disabled --'))
|
17 |
-
|
18 |
-
|
19 |
}
|
2 |
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Checkoutsubscribe
|
4 |
{
|
5 |
+
|
6 |
+
public function toOptionArray()
|
7 |
+
{
|
8 |
+
return array(
|
|
|
|
|
|
|
|
|
9 |
array('value' => 1, 'label' => Mage::helper('emaildirect')->__('Enabled - Checked by default')),
|
10 |
array('value' => 2, 'label' => Mage::helper('emaildirect')->__('Enabled - Not Checked by default')),
|
11 |
array('value' => 3, 'label' => Mage::helper('emaildirect')->__('Enabled - Force subscription')),
|
12 |
array('value' => 0, 'label' => Mage::helper('emaildirect')->__('-- Disabled --'))
|
13 |
+
);
|
14 |
+
}
|
15 |
}
|
app/code/local/EmailDirect/Integration/Model/System/Config/Source/Export/Batch.php
CHANGED
@@ -1,10 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Dec 6, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_System_Config_Source_Export_Batch
|
9 |
{
|
10 |
public function toOptionArray()
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Export_Batch
|
4 |
{
|
5 |
public function toOptionArray()
|
app/code/local/EmailDirect/Integration/Model/System/Config/Source/List.php
CHANGED
@@ -1,22 +1,17 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Nov 25, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_System_Config_Source_List
|
9 |
{
|
10 |
public function toOptionArray()
|
11 |
{
|
|
|
|
|
12 |
$options = array();
|
13 |
$options[] = array (
|
14 |
'value' => -1,
|
15 |
'label' => '--select--',
|
16 |
);
|
17 |
|
18 |
-
// $ws = Mage::getModel('emaildirect/wrapper_lists');
|
19 |
-
// $lists = $ws->getLists();
|
20 |
$lists = Mage::getSingleton('emaildirect/wrapper_lists')->getLists();
|
21 |
foreach($lists as $list)
|
22 |
{
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_List
|
4 |
{
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
+
Mage::helper('emaildirect')->setLogArea(EmailDirect_Integration_Helper_Data::IGNORE);
|
8 |
+
|
9 |
$options = array();
|
10 |
$options[] = array (
|
11 |
'value' => -1,
|
12 |
'label' => '--select--',
|
13 |
);
|
14 |
|
|
|
|
|
15 |
$lists = Mage::getSingleton('emaildirect/wrapper_lists')->getLists();
|
16 |
foreach($lists as $list)
|
17 |
{
|
app/code/local/EmailDirect/Integration/Model/System/Config/Source/Maxtimes.php
CHANGED
@@ -2,19 +2,14 @@
|
|
2 |
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Maxtimes
|
4 |
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
* @return array
|
9 |
-
*/
|
10 |
-
public function toOptionArray()
|
11 |
-
{
|
12 |
-
return array(
|
13 |
array('value' => 1, 'label' => Mage::helper('emaildirect')->__('1 Times')),
|
14 |
array('value' => 2, 'label' => Mage::helper('emaildirect')->__('2 Times')),
|
15 |
array('value' => 3, 'label' => Mage::helper('emaildirect')->__('3 Times')),
|
16 |
array('value' => 4, 'label' => Mage::helper('emaildirect')->__('4 Times')),
|
17 |
array('value' => 5, 'label' => Mage::helper('emaildirect')->__('5 Times')),
|
18 |
);
|
19 |
-
|
20 |
}
|
2 |
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Maxtimes
|
4 |
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
|
|
|
|
|
|
|
|
|
|
8 |
array('value' => 1, 'label' => Mage::helper('emaildirect')->__('1 Times')),
|
9 |
array('value' => 2, 'label' => Mage::helper('emaildirect')->__('2 Times')),
|
10 |
array('value' => 3, 'label' => Mage::helper('emaildirect')->__('3 Times')),
|
11 |
array('value' => 4, 'label' => Mage::helper('emaildirect')->__('4 Times')),
|
12 |
array('value' => 5, 'label' => Mage::helper('emaildirect')->__('5 Times')),
|
13 |
);
|
14 |
+
}
|
15 |
}
|
app/code/local/EmailDirect/Integration/Model/System/Config/Source/Publication.php
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Dec 6, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_System_Config_Source_Publication
|
9 |
{
|
10 |
public function toOptionArray()
|
11 |
{
|
|
|
|
|
12 |
$options = array();
|
13 |
|
14 |
$publications = Mage::getSingleton('emaildirect/wrapper_publications')->getPublications();
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Publication
|
4 |
{
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
+
Mage::helper('emaildirect')->setLogArea(EmailDirect_Integration_Helper_Data::IGNORE);
|
8 |
+
|
9 |
$options = array();
|
10 |
|
11 |
$publications = Mage::getSingleton('emaildirect/wrapper_publications')->getPublications();
|
app/code/local/EmailDirect/Integration/Model/System/Config/Source/Source.php
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Dec 6, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_System_Config_Source_Source
|
9 |
{
|
10 |
public function toOptionArray()
|
11 |
{
|
|
|
|
|
12 |
$options = array();
|
13 |
|
14 |
$sources = Mage::getSingleton('emaildirect/wrapper_sources')->getSources();
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Source
|
4 |
{
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
+
Mage::helper('emaildirect')->setLogArea(EmailDirect_Integration_Helper_Data::IGNORE);
|
8 |
+
|
9 |
$options = array();
|
10 |
|
11 |
$sources = Mage::getSingleton('emaildirect/wrapper_sources')->getSources();
|
app/code/local/EmailDirect/Integration/Model/System/Config/Source/Time.php
CHANGED
@@ -1,14 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Dec 6, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_System_Config_Source_Time
|
9 |
{
|
10 |
public function toOptionArray()
|
11 |
{
|
|
|
12 |
$options = array(
|
13 |
array('value' => 15,'label' => "15 Minutes"),
|
14 |
array('value' => 30,'label' => "30 Minutes"),
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_System_Config_Source_Time
|
4 |
{
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
+
Mage::helper('emaildirect')->setLogArea(EmailDirect_Integration_Helper_Data::IGNORE);
|
8 |
$options = array(
|
9 |
array('value' => 15,'label' => "15 Minutes"),
|
10 |
array('value' => 30,'label' => "30 Minutes"),
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Abandoned.php
CHANGED
@@ -1,35 +1,21 @@
|
|
1 |
<?php
|
2 |
-
class EmailDirect_Integration_Model_Wrapper_Abandoned
|
3 |
{
|
4 |
public function sendSubscribers($xml)
|
5 |
{
|
6 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("abandoned","","",$xml
|
7 |
return $rc;
|
8 |
}
|
9 |
|
10 |
-
public function getOneSubscriber($
|
11 |
{
|
12 |
-
$
|
13 |
-
$
|
14 |
-
$
|
15 |
-
|
16 |
-
$data = "<CustomFields>";
|
17 |
-
foreach($mergeVars as $key => $value)
|
18 |
-
{
|
19 |
-
$data .= "<CustomField><FieldName>{$key}</FieldName><Value><![CDATA[{$value}]]></Value></CustomField>";
|
20 |
-
}
|
21 |
-
$data .= "</CustomFields>";
|
22 |
-
|
23 |
-
$list_data = "";
|
24 |
-
|
25 |
-
if ($listid != -1)
|
26 |
-
$list_data = "<Lists><int>$listid</int></Lists>";
|
27 |
-
|
28 |
-
$xml = "<Subscriber><EmailAddress>{$mail}</EmailAddress>{$data}<SourceID>{$sourceid}</SourceID>";
|
29 |
-
$xml .= "<Publications><int>{$publicationid}</int></Publications>{$list_data}<Force>true</Force></Subscriber>";
|
30 |
-
|
31 |
-
//Mage::log($xml,null,"1_quote.log");
|
32 |
|
|
|
|
|
33 |
return $xml;
|
34 |
}
|
35 |
}
|
1 |
<?php
|
2 |
+
class EmailDirect_Integration_Model_Wrapper_Abandoned extends EmailDirect_Integration_Model_Wrapper_Abstract
|
3 |
{
|
4 |
public function sendSubscribers($xml)
|
5 |
{
|
6 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("abandoned","","",$xml);
|
7 |
return $rc;
|
8 |
}
|
9 |
|
10 |
+
public function getOneSubscriber($email,$merge_vars)
|
11 |
{
|
12 |
+
$source_data = $this->getSource();
|
13 |
+
$publication_data = $this->getPublications("abandonedpublication");
|
14 |
+
$custom_fields = $this->getCustomFields($merge_vars);
|
15 |
+
$list_data = $this->getLists("abandonedlist");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
$xml = "<Subscriber><EmailAddress>{$email}</EmailAddress>{$custom_fields}{$source_data}{$publication_data}{$list_data}<Force>true</Force></Subscriber>";
|
18 |
+
|
19 |
return $xml;
|
20 |
}
|
21 |
}
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Abstract.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Model_Wrapper_Abstract
|
4 |
+
{
|
5 |
+
protected function getLists($key = "additional_lists")
|
6 |
+
{
|
7 |
+
$lists = Mage::helper('emaildirect')->config($key);
|
8 |
+
|
9 |
+
if ($lists == "")
|
10 |
+
return "";
|
11 |
+
|
12 |
+
$list_ids = explode(",",$lists);
|
13 |
+
|
14 |
+
$list_data = "<Lists>";
|
15 |
+
|
16 |
+
foreach ($list_ids as $id)
|
17 |
+
{
|
18 |
+
$list_data .= "<int>{$id}</int>";
|
19 |
+
}
|
20 |
+
|
21 |
+
$list_data .= "</Lists>";
|
22 |
+
|
23 |
+
return $list_data;
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function getCustomFields($merge_vars)
|
27 |
+
{
|
28 |
+
$data = "<CustomFields>";
|
29 |
+
|
30 |
+
foreach($merge_vars as $key => $value)
|
31 |
+
{
|
32 |
+
$data .= "<CustomField><FieldName>{$key}</FieldName><Value><![CDATA[{$value}]]></Value></CustomField>";
|
33 |
+
}
|
34 |
+
|
35 |
+
$data .= "</CustomFields>";
|
36 |
+
|
37 |
+
return $data;
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function getPublications($key = "publication")
|
41 |
+
{
|
42 |
+
$publication_id = Mage::helper('emaildirect')->config($key); //Mage::getStoreConfig('emaildirect/general/publication');
|
43 |
+
|
44 |
+
return "<Publications><int>{$publication_id}</int></Publications>";
|
45 |
+
}
|
46 |
+
|
47 |
+
protected function getSource()
|
48 |
+
{
|
49 |
+
$source_id = Mage::helper('emaildirect')->config('sourceid');
|
50 |
+
|
51 |
+
return "<SourceID>{$source_id}</SourceID>";
|
52 |
+
}
|
53 |
+
}
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Database.php
CHANGED
@@ -11,21 +11,21 @@ class EmailDirect_Integration_Model_Wrapper_Database
|
|
11 |
$xml .= "<ColumnSize><![CDATA[$size]]></ColumnSize>";
|
12 |
}
|
13 |
$xml .= "</DatabaseColumnAdd>";
|
14 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("database","","",$xml
|
15 |
|
16 |
return $rc;
|
17 |
}
|
18 |
|
19 |
public function get($name)
|
20 |
{
|
21 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("database",$name
|
22 |
|
23 |
return $rc;
|
24 |
}
|
25 |
|
26 |
public function getAllColumns()
|
27 |
{
|
28 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("database"
|
29 |
|
30 |
return $rc;
|
31 |
}
|
11 |
$xml .= "<ColumnSize><![CDATA[$size]]></ColumnSize>";
|
12 |
}
|
13 |
$xml .= "</DatabaseColumnAdd>";
|
14 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("database","","",$xml);
|
15 |
|
16 |
return $rc;
|
17 |
}
|
18 |
|
19 |
public function get($name)
|
20 |
{
|
21 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("database",$name);
|
22 |
|
23 |
return $rc;
|
24 |
}
|
25 |
|
26 |
public function getAllColumns()
|
27 |
{
|
28 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("database");
|
29 |
|
30 |
return $rc;
|
31 |
}
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Execute.php
CHANGED
@@ -1,31 +1,35 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Oct 31, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_Wrapper_Execute
|
9 |
{
|
10 |
-
private $
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
public function sendCommand($command
|
14 |
{
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
$
|
|
|
21 |
$URL .= $urlsuffix;
|
22 |
-
if($id)
|
23 |
$URL .= "/$id";
|
24 |
-
|
25 |
-
if($subcommand) {
|
26 |
$URL .= "/$subcommand";
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
29 |
$ch = curl_init($URL);
|
30 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
31 |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
@@ -33,43 +37,62 @@ class EmailDirect_Integration_Model_Wrapper_Execute
|
|
33 |
curl_setopt($ch, CURLOPT_HEADER, true);
|
34 |
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
35 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
|
|
53 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
54 |
$output = curl_exec($ch);
|
55 |
-
|
56 |
curl_close($ch);
|
57 |
$start = strpos($output,'<?xml',true);
|
58 |
-
if(!$start)
|
|
|
59 |
$start = strpos($output,'<Response>',true);
|
60 |
}
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
$xml = simplexml_load_string($strxml);
|
64 |
}
|
65 |
-
catch(Exception $e)
|
|
|
66 |
Mage::throwException($e->getMessage());
|
67 |
}
|
|
|
|
|
|
|
|
|
68 |
return $xml;
|
69 |
}
|
70 |
-
private function _getApiKey()
|
71 |
-
{
|
72 |
-
$path = 'emaildirect/general/apikey';
|
73 |
-
$this->apiKey = Mage::getStoreConfig($path);
|
74 |
-
}
|
75 |
}
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_Wrapper_Execute
|
4 |
{
|
5 |
+
private function parseHttpResponse($str)
|
6 |
+
{
|
7 |
+
$parts = explode(PHP_EOL,$str,2);
|
8 |
+
|
9 |
+
$http_parts = explode(' ',$parts[0],3);
|
10 |
+
|
11 |
+
return array("code" => $http_parts[1], "msg" => $http_parts[2]);
|
12 |
+
}
|
13 |
|
14 |
+
public function sendCommand($command, $subcommand = null, $id= null, $xmldata=null, $method = "POST")
|
15 |
{
|
16 |
+
$apikey = Mage::helper('emaildirect')->getApiKey();
|
17 |
+
|
18 |
+
if ($xmldata != null)
|
19 |
+
Mage::helper('emaildirect')->log($xmldata,"Xml Data ({$command})");
|
20 |
+
|
21 |
+
$URL = Mage::helper('emaildirect')->config('urls/accesspoint');
|
22 |
+
$urlsuffix = Mage::helper('emaildirect')->config("urls/{$command}");
|
23 |
$URL .= $urlsuffix;
|
24 |
+
if ($id)
|
25 |
$URL .= "/$id";
|
26 |
+
if ($subcommand)
|
|
|
27 |
$URL .= "/$subcommand";
|
28 |
+
|
29 |
+
Mage::helper('emaildirect')->log("API KEY: {$apikey}");
|
30 |
+
Mage::helper('emaildirect')->log("URL: {$URL}");
|
31 |
+
|
32 |
+
$header = array('Content-Type: text/xml','ApiKey: '.$apikey,'Accept: application/xml');
|
33 |
$ch = curl_init($URL);
|
34 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
35 |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
37 |
curl_setopt($ch, CURLOPT_HEADER, true);
|
38 |
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
39 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
40 |
+
|
41 |
+
switch ($method)
|
42 |
+
{
|
43 |
+
case "DELETE":
|
44 |
+
{
|
45 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
46 |
+
} break;
|
47 |
+
case "POST":
|
48 |
+
{
|
49 |
+
curl_setopt($ch, CURLOPT_POST, 0);
|
50 |
+
if($xmldata)
|
51 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmldata);
|
52 |
+
} break;
|
53 |
+
default:
|
54 |
+
{
|
55 |
+
$putString = stripslashes($xmldata);
|
56 |
+
$putData = tmpfile();
|
57 |
+
fwrite($putData, $putString);
|
58 |
+
fseek($putData, 0);
|
59 |
+
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
|
60 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
61 |
+
curl_setopt($ch, CURLOPT_PUT, true);
|
62 |
+
curl_setopt($ch, CURLOPT_INFILE, $putData);
|
63 |
+
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($putString));
|
64 |
+
} break;
|
65 |
}
|
66 |
+
|
67 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
68 |
$output = curl_exec($ch);
|
69 |
+
|
70 |
curl_close($ch);
|
71 |
$start = strpos($output,'<?xml',true);
|
72 |
+
if(!$start)
|
73 |
+
{
|
74 |
$start = strpos($output,'<Response>',true);
|
75 |
}
|
76 |
+
if (!$start)
|
77 |
+
{
|
78 |
+
$results = $this->parseHttpResponse($output);
|
79 |
+
$strxml = "<Response><ErrorCode>{$results['code']}</ErrorCode><Message>{$results['msg']}</Message></Response>";
|
80 |
+
}
|
81 |
+
else
|
82 |
+
$strxml = substr($output,$start);
|
83 |
+
|
84 |
+
try
|
85 |
+
{
|
86 |
$xml = simplexml_load_string($strxml);
|
87 |
}
|
88 |
+
catch(Exception $e)
|
89 |
+
{
|
90 |
Mage::throwException($e->getMessage());
|
91 |
}
|
92 |
+
|
93 |
+
if ($command != 'Database')
|
94 |
+
Mage::helper('emaildirect')->log($xml, "Response");
|
95 |
+
|
96 |
return $xml;
|
97 |
}
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Ftp.php
CHANGED
@@ -10,7 +10,7 @@ class EmailDirect_Integration_Model_Wrapper_Ftp
|
|
10 |
$xml .= "<FolderPath>{$folder}</FolderPath>";
|
11 |
$xml .= "</FileUpload>";
|
12 |
|
13 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("ftp","","",$xml
|
14 |
|
15 |
return $rc;
|
16 |
}
|
10 |
$xml .= "<FolderPath>{$folder}</FolderPath>";
|
11 |
$xml .= "</FileUpload>";
|
12 |
|
13 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("ftp","","",$xml);
|
14 |
|
15 |
return $rc;
|
16 |
}
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Lists.php
CHANGED
@@ -1,19 +1,7 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Nov 14, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_Wrapper_Lists
|
9 |
{
|
10 |
-
public function __construct($args)
|
11 |
-
{
|
12 |
-
$storeId = isset($args['store']) ? $args['store'] : null;
|
13 |
-
$apikey = (!isset($args['apikey']) ? Mage::helper('emaildirect')->getApiKey($storeId) : $args['apikey']);
|
14 |
-
|
15 |
-
}
|
16 |
-
|
17 |
public function getLists()
|
18 |
{
|
19 |
$lists = array();
|
@@ -30,30 +18,32 @@ class EmailDirect_Integration_Model_Wrapper_Lists
|
|
30 |
return $lists;
|
31 |
}
|
32 |
|
33 |
-
public function listUnsubscribe($
|
34 |
{
|
35 |
-
$xml = "<Subscribers><EmailAddress
|
36 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('lists','RemoveEmails',$
|
37 |
-
if(isset($rc->ErrorCode))
|
38 |
{
|
39 |
Mage::getSingleton('customer/session')->addError((string)$rc->Message);
|
40 |
Mage::throwException((string)$rc->Message);
|
41 |
}
|
42 |
-
elseif((int)$rc->ContactsSubmitted != (int)$rc->Successes)
|
|
|
43 |
Mage::getSingleton('customer/session')->addError((string)$rc->Failures->Failure->Message);
|
44 |
Mage::throwException((string)$rc->Failures->Failure->Message);
|
45 |
}
|
46 |
}
|
47 |
|
48 |
-
public function listSubscribe($
|
49 |
{
|
50 |
// ask if the customer is a subscriber
|
51 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('subscribers',null,$email
|
|
|
52 |
// if already a subscriber
|
53 |
-
if(isset($rc->EmailID))
|
54 |
-
|
55 |
-
$xml = "<Subscribers><EmailAddress
|
56 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('lists','AddEmails',$
|
57 |
}
|
58 |
else {
|
59 |
// Mage::log("add subscriber and subscribe to list");
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_Wrapper_Lists
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
public function getLists()
|
6 |
{
|
7 |
$lists = array();
|
18 |
return $lists;
|
19 |
}
|
20 |
|
21 |
+
public function listUnsubscribe($list_id, $email)
|
22 |
{
|
23 |
+
$xml = "<Subscribers><EmailAddress>{$email}</EmailAddress></Subscribers>";
|
24 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('lists','RemoveEmails',$list_id,$xml);
|
25 |
+
if (isset($rc->ErrorCode))
|
26 |
{
|
27 |
Mage::getSingleton('customer/session')->addError((string)$rc->Message);
|
28 |
Mage::throwException((string)$rc->Message);
|
29 |
}
|
30 |
+
elseif((int)$rc->ContactsSubmitted != (int)$rc->Successes)
|
31 |
+
{
|
32 |
Mage::getSingleton('customer/session')->addError((string)$rc->Failures->Failure->Message);
|
33 |
Mage::throwException((string)$rc->Failures->Failure->Message);
|
34 |
}
|
35 |
}
|
36 |
|
37 |
+
public function listSubscribe($list_id, $email)
|
38 |
{
|
39 |
// ask if the customer is a subscriber
|
40 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('subscribers',null,$email);
|
41 |
+
|
42 |
// if already a subscriber
|
43 |
+
if (isset($rc->EmailID))
|
44 |
+
{
|
45 |
+
$xml = "<Subscribers><EmailAddress>{$email}</EmailAddress></Subscribers>";
|
46 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('lists','AddEmails',$list_id,$xml);
|
47 |
}
|
48 |
else {
|
49 |
// Mage::log("add subscriber and subscribe to list");
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Orders.php
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class EmailDirect_Integration_Model_Wrapper_Orders
|
4 |
{
|
5 |
-
|
6 |
public function getOrderXml($order, $email = null)
|
7 |
{
|
8 |
-
$prefix = Mage::helper('emaildirect')->config('prefix');
|
9 |
-
|
10 |
$date = $order->getCreatedAt();
|
11 |
-
$orderNum = $
|
12 |
|
13 |
$items = $order->getAllItems();
|
14 |
|
@@ -17,7 +14,8 @@ class EmailDirect_Integration_Model_Wrapper_Orders
|
|
17 |
$xml .= "<EmailAddress><![CDATA[{$email}]]></EmailAddress>";
|
18 |
$xml .= "<PurchaseDate>{$date}</PurchaseDate>";
|
19 |
$xml .= "<OrderNumber>{$orderNum}</OrderNumber>";
|
20 |
-
|
|
|
21 |
{
|
22 |
$xml .= "<Items>";
|
23 |
foreach($items as $item)
|
@@ -31,7 +29,6 @@ class EmailDirect_Integration_Model_Wrapper_Orders
|
|
31 |
$xml .= "<ProductName><![CDATA[$name]]></ProductName>";
|
32 |
$sku = $item->getSku();
|
33 |
$xml .= "<SKU><![CDATA[{$sku}]]></SKU>";
|
34 |
-
|
35 |
$xml .= "<Quantity>{$qty}</Quantity>";
|
36 |
$price = $item->getPrice();
|
37 |
$xml .= "<UnitPrice>{$price}</UnitPrice>";
|
@@ -40,7 +37,6 @@ class EmailDirect_Integration_Model_Wrapper_Orders
|
|
40 |
$status = 'Completed';
|
41 |
$xml .= "<Status>{$status}</Status>";
|
42 |
$xml .= "</OrderItem>";
|
43 |
-
|
44 |
}
|
45 |
$xml .= "</Items>";
|
46 |
}
|
@@ -49,73 +45,18 @@ class EmailDirect_Integration_Model_Wrapper_Orders
|
|
49 |
return $xml;
|
50 |
}
|
51 |
|
52 |
-
public function addSubscriberOrder($
|
53 |
{
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
if($uselist)
|
59 |
-
$listid = Mage::helper('emaildirect')->config('list',$store->getId());
|
60 |
-
else
|
61 |
-
$listid = -1;
|
62 |
-
|
63 |
-
$data = "<CustomFields>";
|
64 |
-
foreach($mergeVars as $key => $value)
|
65 |
-
{
|
66 |
-
$data .= "<CustomField><FieldName>{$key}</FieldName><Value><![CDATA[{$value}]]></Value></CustomField>";
|
67 |
-
}
|
68 |
-
$data .= "</CustomFields>";
|
69 |
-
|
70 |
-
$list_data = "";
|
71 |
-
|
72 |
-
if ($listid != -1)
|
73 |
-
$list_data = "<Lists><int>{$listid}</int></Lists>";
|
74 |
-
|
75 |
-
$order_data = "<Orders>" . $this->getOrderXml($order) . "</Orders>";
|
76 |
-
|
77 |
-
$xml = "<Subscriber><EmailAddress>{$mail}</EmailAddress>{$data}<SourceID>{$sourceid}</SourceID>{$order_data}<Publications><int>{$publicationid}</int></Publications>{$list_data}<Force>true</Force></Subscriber>";
|
78 |
-
|
79 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","","",$xml,false);
|
80 |
-
|
81 |
-
return $rc;
|
82 |
}
|
83 |
|
84 |
-
public function addSubscriberTracking($
|
85 |
{
|
86 |
-
|
87 |
-
|
88 |
-
$publicationid = Mage::helper('emaildirect')->config('publication',$store->getId());
|
89 |
-
|
90 |
-
if($uselist)
|
91 |
-
$listid = Mage::helper('emaildirect')->config('list',$store->getId());
|
92 |
-
else
|
93 |
-
$listid = -1;
|
94 |
-
|
95 |
-
$data = "<CustomFields>";
|
96 |
-
foreach($mergeVars as $key => $value)
|
97 |
-
{
|
98 |
-
$data .= "<CustomField><FieldName>{$key}</FieldName><Value><![CDATA[{$value}]]></Value></CustomField>";
|
99 |
-
}
|
100 |
-
$data .= "</CustomFields>";
|
101 |
-
|
102 |
-
$list_data = "";
|
103 |
-
|
104 |
-
if ($listid != -1)
|
105 |
-
$list_data = "<Lists><int>{$listid}</int></Lists>";
|
106 |
-
|
107 |
-
$xml = "<Subscriber><EmailAddress>{$mail}</EmailAddress>{$data}<SourceID>{$sourceid}</SourceID><Publications><int>{$publicationid}</int></Publications>{$list_data}<Force>true</Force></Subscriber>";
|
108 |
-
|
109 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","","",$xml,false);
|
110 |
-
|
111 |
-
return $rc;
|
112 |
}
|
113 |
|
114 |
-
public function addOrder($order)
|
115 |
-
{
|
116 |
-
$xml = $this->getOrderXml($order, $order->getCustomerEmail());
|
117 |
-
|
118 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("orders","","",$xml,false);
|
119 |
-
return $rc;
|
120 |
-
}
|
121 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class EmailDirect_Integration_Model_Wrapper_Orders extends EmailDirect_Integration_Model_Wrapper_Abstract
|
4 |
{
|
|
|
5 |
public function getOrderXml($order, $email = null)
|
6 |
{
|
|
|
|
|
7 |
$date = $order->getCreatedAt();
|
8 |
+
$orderNum = $order->getIncrementId();
|
9 |
|
10 |
$items = $order->getAllItems();
|
11 |
|
14 |
$xml .= "<EmailAddress><![CDATA[{$email}]]></EmailAddress>";
|
15 |
$xml .= "<PurchaseDate>{$date}</PurchaseDate>";
|
16 |
$xml .= "<OrderNumber>{$orderNum}</OrderNumber>";
|
17 |
+
|
18 |
+
if (is_array($items))
|
19 |
{
|
20 |
$xml .= "<Items>";
|
21 |
foreach($items as $item)
|
29 |
$xml .= "<ProductName><![CDATA[$name]]></ProductName>";
|
30 |
$sku = $item->getSku();
|
31 |
$xml .= "<SKU><![CDATA[{$sku}]]></SKU>";
|
|
|
32 |
$xml .= "<Quantity>{$qty}</Quantity>";
|
33 |
$price = $item->getPrice();
|
34 |
$xml .= "<UnitPrice>{$price}</UnitPrice>";
|
37 |
$status = 'Completed';
|
38 |
$xml .= "<Status>{$status}</Status>";
|
39 |
$xml .= "</OrderItem>";
|
|
|
40 |
}
|
41 |
$xml .= "</Items>";
|
42 |
}
|
45 |
return $xml;
|
46 |
}
|
47 |
|
48 |
+
public function addSubscriberOrder($email, $order, $merge_vars)
|
49 |
{
|
50 |
+
$order_data = "<Orders>" . $this->getOrderXml($order) . "</Orders>";
|
51 |
+
|
52 |
+
// Same call just different adding the order info
|
53 |
+
return Mage::getSingleton('emaildirect/wrapper_subscribers')->subscriberAdd($email, $merge_vars, $order_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
|
56 |
+
public function addSubscriberTracking($email,$merge_vars)
|
57 |
{
|
58 |
+
// Same call just different Merge Vars
|
59 |
+
return Mage::getSingleton('emaildirect/wrapper_subscribers')->subscriberAdd($email, $merge_vars);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Publications.php
CHANGED
@@ -1,10 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Dec 6, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_Wrapper_Publications
|
9 |
{
|
10 |
public function getPublications()
|
@@ -24,17 +19,18 @@ class EmailDirect_Integration_Model_Wrapper_Publications
|
|
24 |
}
|
25 |
public function subscribe($id, $email)
|
26 |
{
|
27 |
-
$xml = "<Subscribers><EmailAddress
|
28 |
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('publications','AddEmails',$id,$xml);
|
29 |
return $rc;
|
30 |
}
|
31 |
public function unsubscribe($id,$email)
|
32 |
{
|
33 |
-
$xml = "<Subscribers><EmailAddress
|
34 |
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('publications','RemoveEmails',$id,$xml);
|
35 |
return $rc;
|
36 |
}
|
37 |
-
public function getPublication($id)
|
|
|
38 |
$xml = "";
|
39 |
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('publications','',$id,$xml);
|
40 |
return $rc;
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_Wrapper_Publications
|
4 |
{
|
5 |
public function getPublications()
|
19 |
}
|
20 |
public function subscribe($id, $email)
|
21 |
{
|
22 |
+
$xml = "<Subscribers><EmailAddress>{$email}</EmailAddress></Subscribers>";
|
23 |
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('publications','AddEmails',$id,$xml);
|
24 |
return $rc;
|
25 |
}
|
26 |
public function unsubscribe($id,$email)
|
27 |
{
|
28 |
+
$xml = "<Subscribers><EmailAddress>{$email}</EmailAddress></Subscribers>";
|
29 |
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('publications','RemoveEmails',$id,$xml);
|
30 |
return $rc;
|
31 |
}
|
32 |
+
public function getPublication($id)
|
33 |
+
{
|
34 |
$xml = "";
|
35 |
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('publications','',$id,$xml);
|
36 |
return $rc;
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Relays.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Created on Dec 22, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
-
class EmailDirect_Integration_Model_Wrapper_Relays
|
9 |
-
{
|
10 |
-
public function addCategory($name)
|
11 |
-
{
|
12 |
-
$categoryId = $this->getCategory($name);
|
13 |
-
if($categoryId) {
|
14 |
-
return $categoryId;
|
15 |
-
}
|
16 |
-
$xml = "<string>$name</string>";
|
17 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("relays","","",$xml,false);
|
18 |
-
if(isset($rc->RelaySendCategory->RelaySendCategoryID)) {
|
19 |
-
return $rc->RelaySendCategory->RelaySendCategoryID;
|
20 |
-
}
|
21 |
-
else {
|
22 |
-
return 0;
|
23 |
-
}
|
24 |
-
}
|
25 |
-
public function getCategory($name)
|
26 |
-
{
|
27 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("relays","","",null);
|
28 |
-
foreach($rc->Category as $category) {
|
29 |
-
if($category->Name == $name) {
|
30 |
-
return $category->RelaySendCategoryID;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
return false;
|
34 |
-
}
|
35 |
-
|
36 |
-
public function sendMail($senderName,$senderEmail,$toEmail,$toName,$subject,$text)
|
37 |
-
{
|
38 |
-
$relayId = Mage::Helper('emaildirect')->config('relayid');
|
39 |
-
// $text = htmlentities($text);
|
40 |
-
|
41 |
-
if(is_array($toEmail)) {
|
42 |
-
$auxemail = implode(",",$toEmail);
|
43 |
-
}
|
44 |
-
else {
|
45 |
-
$auxemail = $toEmail;
|
46 |
-
}
|
47 |
-
if(is_array($toName)) {
|
48 |
-
$auxname = implode(",",$toName);
|
49 |
-
}
|
50 |
-
else {
|
51 |
-
$auxname = $toName;
|
52 |
-
}
|
53 |
-
|
54 |
-
// $xml = "<RelaySend><ToEmail>$toEmail</ToEmail><ToName>$toName</ToName><FromName>$senderName</FromName><FromEmail>$senderEmail</FromEmail><Subject>$subject</Subject><HTML>$text</HTML><Text>$text</Text></RelaySend>";
|
55 |
-
//// $xml = "<RelaySend><ToEmail><![CDATA[$auxemail]]></ToEmail><ToName><![CDATA[$auxname]]></ToName><FromName><![CDATA[$senderName]]></FromName><FromEmail><![CDATA[$senderEmail]]></FromEmail><Subject><![CDATA[$subject]]></Subject><HTML><![CDATA[$text]]></HTML></RelaySend>";
|
56 |
-
//// if(Mage::registry('track')==1) {
|
57 |
-
$replace = '<br><img src="[Link_Impression]" width="5" height="5" \></body>';
|
58 |
-
$textmail = preg_replace("/\<\/body\>/",$replace,$text);
|
59 |
-
$xml = "<RelaySend><ToEmail><![CDATA[$auxemail]]></ToEmail><TrackLinks>true</TrackLinks><Force>true</Force><ToName><![CDATA[$auxname]]></ToName><FromName><![CDATA[$senderName]]></FromName><FromEmail><![CDATA[$senderEmail]]></FromEmail><Subject><![CDATA[$subject]]></Subject><HTML><![CDATA[$textmail]]></HTML></RelaySend>";
|
60 |
-
//// }
|
61 |
-
//// else {
|
62 |
-
//// $xml = "<RelaySend><ToEmail><![CDATA[$auxemail]]></ToEmail><ToName><![CDATA[$auxname]]></ToName><FromName><![CDATA[$senderName]]></FromName><FromEmail><![CDATA[$senderEmail]]></FromEmail><Subject><![CDATA[$subject]]></Subject><HTML><![CDATA[$text]]></HTML></RelaySend>";
|
63 |
-
//// }
|
64 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("relays","",$relayId,$xml);
|
65 |
-
}
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Sources.php
CHANGED
@@ -1,16 +1,14 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* Created on Dec 6, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
class EmailDirect_Integration_Model_Wrapper_Sources
|
9 |
{
|
10 |
public function getSources()
|
11 |
{
|
12 |
$sources = array();
|
13 |
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('sources');
|
|
|
|
|
|
|
14 |
foreach($rc->Source as $source)
|
15 |
{
|
16 |
$newsource = array('id' => (int)$source->SourceID,
|
@@ -22,10 +20,11 @@ class EmailDirect_Integration_Model_Wrapper_Sources
|
|
22 |
}
|
23 |
return $sources;
|
24 |
}
|
|
|
25 |
public function addSource($name)
|
26 |
{
|
27 |
-
$xml = "<Source><Name
|
28 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('sources',"",null,$xml
|
29 |
return $rc;
|
30 |
}
|
31 |
}
|
1 |
<?php
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
3 |
class EmailDirect_Integration_Model_Wrapper_Sources
|
4 |
{
|
5 |
public function getSources()
|
6 |
{
|
7 |
$sources = array();
|
8 |
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('sources');
|
9 |
+
if (isset($rc->ErrorCode))
|
10 |
+
return (string) $rc->Message;
|
11 |
+
|
12 |
foreach($rc->Source as $source)
|
13 |
{
|
14 |
$newsource = array('id' => (int)$source->SourceID,
|
20 |
}
|
21 |
return $sources;
|
22 |
}
|
23 |
+
|
24 |
public function addSource($name)
|
25 |
{
|
26 |
+
$xml = "<Source><Name>{$name}</Name><Description>{$name}</Description></Source>";
|
27 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand('sources',"",null,$xml);
|
28 |
return $rc;
|
29 |
}
|
30 |
}
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Subscribers.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Model_Wrapper_subscribers extends EmailDirect_Integration_Model_Wrapper_Abstract
|
4 |
+
{
|
5 |
+
public function subscriberModify($email,$merge_vars)
|
6 |
+
{
|
7 |
+
$source_data = $this->getSource();
|
8 |
+
$custom_fields = $this->getCustomFields($merge_vars);
|
9 |
+
$list_data = $this->getLists();
|
10 |
+
$publication_data = $this->getPublications();
|
11 |
+
|
12 |
+
$xml = "<Subscriber><EmailAddress>{$email}</EmailAddress>{$custom_fields}{$source_data}{$publication_data}{$list_data}</Subscriber>";
|
13 |
+
|
14 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","",$email,$xml,"PUT");
|
15 |
+
if(isset($rc->ErrorCode)) {
|
16 |
+
return false;
|
17 |
+
}
|
18 |
+
return true;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function subscriberAdd($email,$merge_vars, $extra_data = "", $use_lists = true)
|
22 |
+
{
|
23 |
+
$source_data = $this->getSource();
|
24 |
+
$publication_data = $this->getPublications();
|
25 |
+
$list_data = "";
|
26 |
+
|
27 |
+
if ($use_lists)
|
28 |
+
$list_data = $this->getLists();
|
29 |
+
|
30 |
+
$custom_fields = $this->getCustomFields($merge_vars);
|
31 |
+
|
32 |
+
$xml = "<Subscriber><EmailAddress>{$email}</EmailAddress>{$custom_fields}{$source_data}{$extra_data}{$publication_data}{$list_data}<Force>true</Force></Subscriber>";
|
33 |
+
|
34 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","","",$xml);
|
35 |
+
|
36 |
+
return $rc;
|
37 |
+
}
|
38 |
+
|
39 |
+
public function subscriberDelete($email)
|
40 |
+
{
|
41 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers",null,$email,null,"DELETE");
|
42 |
+
return $rc;
|
43 |
+
}
|
44 |
+
|
45 |
+
private function fixBouncedMail($old_mail,$new_mail)
|
46 |
+
{
|
47 |
+
$xml = "<Subscriber><EmailAddress>{$old_mail}</EmailAddress><Force>true</Force></Subscriber>";
|
48 |
+
|
49 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","","",$xml);
|
50 |
+
|
51 |
+
if (isset($rc->ErrorCode))
|
52 |
+
{
|
53 |
+
Mage::getSingleton('customer/session')->addError((string)$rc->Message);
|
54 |
+
Mage::throwException((string)$rc->Message);
|
55 |
+
}
|
56 |
+
|
57 |
+
$xml = "<Subscriber><EmailAddress>{$new_mail}</EmailAddress></Subscriber>";
|
58 |
+
|
59 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","ChangeEmail",$old_mail,$xml);
|
60 |
+
|
61 |
+
if (isset($rc->ErrorCode))
|
62 |
+
{
|
63 |
+
Mage::getSingleton('customer/session')->addError((string)$rc->Message);
|
64 |
+
Mage::throwException((string)$rc->Message);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
public function mailModify($old_mail,$new_mail)
|
69 |
+
{
|
70 |
+
$xml = "<Subscriber><EmailAddress>{$new_mail}</EmailAddress></Subscriber>";
|
71 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","ChangeEmail",$old_mail,$xml);
|
72 |
+
|
73 |
+
if(isset($rc->ErrorCode))
|
74 |
+
{
|
75 |
+
if ($rc->ErrorCode == 202)
|
76 |
+
{
|
77 |
+
$this->fixBouncedMail($old_mail, $new_mail);
|
78 |
+
}
|
79 |
+
else
|
80 |
+
{
|
81 |
+
Mage::getSingleton('customer/session')->addError((string)$rc->Message);
|
82 |
+
Mage::throwException((string)$rc->Message);
|
83 |
+
}
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
public function getProperties($email)
|
88 |
+
{
|
89 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","Properties",$email);
|
90 |
+
return $rc;
|
91 |
+
}
|
92 |
+
}
|
app/code/local/EmailDirect/Integration/Model/Wrapper/Suscribers.php
DELETED
@@ -1,165 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Created on Nov 29, 2011
|
4 |
-
*
|
5 |
-
* To change the template for this generated file go to
|
6 |
-
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
7 |
-
*/
|
8 |
-
class EmailDirect_Integration_Model_Wrapper_Suscribers
|
9 |
-
{
|
10 |
-
public function suscriberModify($mail,$mergeVars)
|
11 |
-
{
|
12 |
-
$sourceid = Mage::helper('emaildirect')->config('sourceid'); //Mage::getStoreConfig('emaildirect/general/sourceid');
|
13 |
-
$publicationid = Mage::helper('emaildirect')->config('publication'); //Mage::getStoreConfig('emaildirect/general/publication');
|
14 |
-
$listid = Mage::helper('emaildirect')->config('list');
|
15 |
-
$data = "<CustomFields>";
|
16 |
-
foreach($mergeVars as $key => $value)
|
17 |
-
{
|
18 |
-
$data .= "<CustomField><FieldName>$key</FieldName><Value><![CDATA[$value]]></Value></CustomField>";
|
19 |
-
}
|
20 |
-
$data .= "</CustomFields>";
|
21 |
-
if($listid != -1) {
|
22 |
-
$xml = "<Subscriber><EmailAddress>$mail</EmailAddress>$data<SourceID>$sourceid</SourceID><Publications><int>$publicationid</int></Publications><Lists><int>$listid</int></Lists></Subscriber>";
|
23 |
-
}
|
24 |
-
else {
|
25 |
-
$xml = "<Subscriber><EmailAddress>$mail</EmailAddress>$data<SourceID>$sourceid</SourceID><Publications><int>$publicationid</int></Publications></Subscriber>";
|
26 |
-
}
|
27 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","",$mail,$xml,true);
|
28 |
-
if(isset($rc->ErrorCode)) {
|
29 |
-
return FALSE;
|
30 |
-
}
|
31 |
-
return TRUE;
|
32 |
-
}
|
33 |
-
public function suscriberAdd($mail,$mergeVars,$uselist = TRUE)
|
34 |
-
{
|
35 |
-
$store = Mage::app()->getStore();
|
36 |
-
$sourceid = Mage::helper('emaildirect')->config('sourceid',$store->getId());
|
37 |
-
$publicationid = Mage::helper('emaildirect')->config('publication',$store->getId());
|
38 |
-
if($uselist) {
|
39 |
-
$listid = Mage::helper('emaildirect')->config('list',$store->getId());
|
40 |
-
}
|
41 |
-
else {
|
42 |
-
$listid = -1;
|
43 |
-
}
|
44 |
-
$data = "<CustomFields>";
|
45 |
-
foreach($mergeVars as $key => $value)
|
46 |
-
{
|
47 |
-
$data .= "<CustomField><FieldName>$key</FieldName><Value><![CDATA[$value]]></Value></CustomField>";
|
48 |
-
}
|
49 |
-
$data .= "</CustomFields>";
|
50 |
-
if($listid != -1) {
|
51 |
-
$xml = "<Subscriber><EmailAddress>$mail</EmailAddress>$data<SourceID>$sourceid</SourceID><Publications><int>$publicationid</int></Publications><Lists><int>$listid</int></Lists><Force>true</Force></Subscriber>";
|
52 |
-
}
|
53 |
-
else {
|
54 |
-
$xml = "<Subscriber><EmailAddress>$mail</EmailAddress>$data<SourceID>$sourceid</SourceID><Publications><int>$publicationid</int></Publications><Force>true</Force></Subscriber>";
|
55 |
-
}
|
56 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","","",$xml,false);
|
57 |
-
}
|
58 |
-
|
59 |
-
public function modifyAddress($mail,$address)
|
60 |
-
{
|
61 |
-
// Mage::log($address);
|
62 |
-
$streets = $address->getStreet();
|
63 |
-
$street = $streets[0];
|
64 |
-
if(isset($streets[1])) {
|
65 |
-
$street .= " ".$streets[1];
|
66 |
-
}
|
67 |
-
$zip = $address->getPostcode();
|
68 |
-
$city = $address->getCity();
|
69 |
-
$state = $address->getRegion();
|
70 |
-
$phone = $address->getTelephone();
|
71 |
-
$data = "<CustomFields>";
|
72 |
-
$data .= "<CustomField><FieldName>Address</FieldName><Value><![CDATA[$street]]></Value></CustomField>";
|
73 |
-
$data .= "<CustomField><FieldName>Zip</FieldName><Value><![CDATA[$zip]]></Value></CustomField>";
|
74 |
-
$data .= "<CustomField><FieldName>City</FieldName><Value><![CDATA[$city]]></Value></CustomField>";
|
75 |
-
$data .= "<CustomField><FieldName>State</FieldName><Value><![CDATA[$state]]></Value></CustomField>";
|
76 |
-
$data .= "<CustomField><FieldName>Phone</FieldName><Value><![CDATA[$phone]]></Value></CustomField>";
|
77 |
-
$data .= "</CustomFields>";
|
78 |
-
$xml = "<Subscriber><EmailAddress>$mail</EmailAddress>$data<Force>true</Force></Subscriber>";
|
79 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","","",$xml,false);
|
80 |
-
}
|
81 |
-
|
82 |
-
// Not used
|
83 |
-
public function abandonedAdd($mail,$mergeVars)
|
84 |
-
{
|
85 |
-
$sourceid = Mage::helper('emaildirect')->config('sourceid');
|
86 |
-
$publicationid = Mage::helper('emaildirect')->config('abandonedpublication');
|
87 |
-
$listid = Mage::helper('emaildirect')->config('abandonedlist');
|
88 |
-
$data = "<CustomFields>";
|
89 |
-
foreach($mergeVars as $key => $value)
|
90 |
-
{
|
91 |
-
$data .= "<CustomField><FieldName>$key</FieldName><Value><![CDATA[$value]]></Value></CustomField>";
|
92 |
-
}
|
93 |
-
$data .= "</CustomFields>";
|
94 |
-
if($listid != -1) {
|
95 |
-
$xml = "<Subscriber><EmailAddress>$mail</EmailAddress>$data<SourceID>$sourceid</SourceID><Publications><int>$publicationid</int></Publications><Lists><int>$listid</int></Lists><Force>true</Force></Subscriber>";
|
96 |
-
}
|
97 |
-
else {
|
98 |
-
$xml = "<Subscriber><EmailAddress>$mail</EmailAddress>$data<SourceID>$sourceid</SourceID><Publications><int>$publicationid</int></Publications><Force>true</Force></Subscriber>";
|
99 |
-
}
|
100 |
-
|
101 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","","",$xml,false);
|
102 |
-
}
|
103 |
-
|
104 |
-
|
105 |
-
private function fixBouncedMail($oldmail,$newmail)
|
106 |
-
{
|
107 |
-
$xml = "<Subscriber><EmailAddress>$oldmail</EmailAddress><Force>true</Force></Subscriber>";
|
108 |
-
|
109 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","","",$xml, false);
|
110 |
-
|
111 |
-
if(isset($rc->ErrorCode))
|
112 |
-
{
|
113 |
-
Mage::getSingleton('customer/session')->addError((string)$rc->Message);
|
114 |
-
Mage::throwException((string)$rc->Message);
|
115 |
-
}
|
116 |
-
|
117 |
-
$xml = "<Subscriber><EmailAddress>$newmail</EmailAddress></Subscriber>";
|
118 |
-
|
119 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","ChangeEmail",$oldmail,$xml);
|
120 |
-
|
121 |
-
if(isset($rc->ErrorCode))
|
122 |
-
{
|
123 |
-
Mage::getSingleton('customer/session')->addError((string)$rc->Message);
|
124 |
-
Mage::throwException((string)$rc->Message);
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
public function mailModify($oldmail,$newmail)
|
129 |
-
{
|
130 |
-
$xml = "<Subscriber><EmailAddress>$newmail</EmailAddress></Subscriber>";
|
131 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","ChangeEmail",$oldmail,$xml);
|
132 |
-
if(isset($rc->ErrorCode))
|
133 |
-
{
|
134 |
-
if ($rc->ErrorCode == 202)
|
135 |
-
{
|
136 |
-
$this->fixBouncedMail($oldmail, $newmail);
|
137 |
-
}
|
138 |
-
else
|
139 |
-
{
|
140 |
-
Mage::getSingleton('customer/session')->addError((string)$rc->Message);
|
141 |
-
Mage::throwException((string)$rc->Message);
|
142 |
-
}
|
143 |
-
}
|
144 |
-
}
|
145 |
-
public function listsForEmail($email)
|
146 |
-
{
|
147 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","Properties",$email);
|
148 |
-
// Mage::log($rc);
|
149 |
-
// foreach($rc->Lists->List as $list)
|
150 |
-
// {
|
151 |
-
//
|
152 |
-
// }
|
153 |
-
return array();
|
154 |
-
}
|
155 |
-
public function suscriberHistory($mail)
|
156 |
-
{
|
157 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","History",$mail);
|
158 |
-
return $rc;
|
159 |
-
}
|
160 |
-
public function getProperties($mail)
|
161 |
-
{
|
162 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_execute')->sendCommand("subscribers","Properties",$mail);
|
163 |
-
return $rc;
|
164 |
-
}
|
165 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmailDirect/Integration/controllers/AbandonedController.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
class EmailDirect_Integration_AbandonedController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
public function restoreAction()
|
5 |
{
|
6 |
$coded_cart = Mage::app()->getRequest()->getParam('cart');
|
1 |
<?php
|
2 |
class EmailDirect_Integration_AbandonedController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
public function restoreAction()
|
5 |
{
|
6 |
$coded_cart = Mage::app()->getRequest()->getParam('cart');
|
app/code/local/EmailDirect/Integration/controllers/Admin/AbandonedController.php
CHANGED
@@ -6,7 +6,7 @@ class Emaildirect_Integration_Admin_AbandonedController extends Mage_Adminhtml_C
|
|
6 |
{
|
7 |
$this->loadLayout();
|
8 |
|
9 |
-
$this->_setActiveMenu('
|
10 |
$this->renderLayout();
|
11 |
}
|
12 |
|
6 |
{
|
7 |
$this->loadLayout();
|
8 |
|
9 |
+
$this->_setActiveMenu('sales');
|
10 |
$this->renderLayout();
|
11 |
}
|
12 |
|
app/code/local/EmailDirect/Integration/controllers/Admin/TroubleshootingController.php
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Emaildirect_Integration_Admin_TroubleshootingController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$this->loadLayout();
|
8 |
+
|
9 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('EmailDirect Troubleshooting'));
|
10 |
+
$this->_setActiveMenu('system');
|
11 |
+
$this->renderLayout();
|
12 |
+
}
|
13 |
+
|
14 |
+
public function sendAction()
|
15 |
+
{
|
16 |
+
$params = $this->getRequest()->getParams();
|
17 |
+
|
18 |
+
$customer = array();
|
19 |
+
|
20 |
+
$customer['Customer Name'] = $params['customer_name'];
|
21 |
+
$customer['Email'] = $params['customer_email'];
|
22 |
+
if ($params['customer_company'] != "")
|
23 |
+
$customer['Company'] = $params['customer_company'];
|
24 |
+
$customer['Comments'] = $params['customer_comments'];
|
25 |
+
|
26 |
+
$message = Mage::helper('emaildirect')->getReport($customer);
|
27 |
+
|
28 |
+
$to = Mage::helper('emaildirect')->troubleConfig('email');
|
29 |
+
$subject = Mage::helper('emaildirect')->troubleConfig('subject');
|
30 |
+
$from = $params['customer_email'];
|
31 |
+
|
32 |
+
$headers = "From: {$from}\r\n";
|
33 |
+
$headers .= "Content-type: text/html\r\n";
|
34 |
+
|
35 |
+
// now lets send the email.
|
36 |
+
$sent = mail($to, $subject, $message, $headers);
|
37 |
+
|
38 |
+
if ($sent)
|
39 |
+
{
|
40 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('emaildirect')->__('Troubleshooting Report was sent to EmailDirect'));
|
41 |
+
|
42 |
+
if (isset($params['turn_off']))
|
43 |
+
Mage::helper('emaildirect')->turnOffTroubleshooting();
|
44 |
+
|
45 |
+
$this->_redirect('adminhtml/system_config/edit/',array('section' => 'emaildirect'));
|
46 |
+
}
|
47 |
+
else
|
48 |
+
{
|
49 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('emaildirect')->__('Failed to send Report Email'));
|
50 |
+
|
51 |
+
$this->_redirect('emaildirect/admin_troubleshooting/');
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
public function downloadAction()
|
56 |
+
{
|
57 |
+
$output = Mage::helper('emaildirect')->getReport();
|
58 |
+
|
59 |
+
$this->_prepareDownloadResponse(Mage::helper('emaildirect')->troubleConfig('report_file'), $output);
|
60 |
+
|
61 |
+
// echo $output;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Declare headers and content file in responce for file download
|
66 |
+
*
|
67 |
+
* @param string $fileName
|
68 |
+
* @param string|array $content set to null to avoid starting output, $contentLength should be set explicitly in
|
69 |
+
* that case
|
70 |
+
* @param string $contentType
|
71 |
+
* @param int $contentLength explicit content length, if strlen($content) isn't applicable
|
72 |
+
* @return Mage_Core_Controller_Varien_Action
|
73 |
+
*/
|
74 |
+
protected function _prepareDownloadResponse(
|
75 |
+
$fileName,
|
76 |
+
$content,
|
77 |
+
$contentType = 'application/octet-stream',
|
78 |
+
$contentLength = null)
|
79 |
+
{
|
80 |
+
$session = Mage::getSingleton('admin/session');
|
81 |
+
if ($session->isFirstPageAfterLogin()) {
|
82 |
+
$this->_redirect($session->getUser()->getStartupPageUrl());
|
83 |
+
return $this;
|
84 |
+
}
|
85 |
+
|
86 |
+
$isFile = false;
|
87 |
+
$file = null;
|
88 |
+
if (is_array($content)) {
|
89 |
+
if (!isset($content['type']) || !isset($content['value'])) {
|
90 |
+
return $this;
|
91 |
+
}
|
92 |
+
if ($content['type'] == 'filename') {
|
93 |
+
$isFile = true;
|
94 |
+
$file = $content['value'];
|
95 |
+
$contentLength = filesize($file);
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
$this->getResponse()
|
100 |
+
->setHttpResponseCode(200)
|
101 |
+
->setHeader('Pragma', 'public', true)
|
102 |
+
->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
|
103 |
+
->setHeader('Content-type', $contentType, true)
|
104 |
+
->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength)
|
105 |
+
->setHeader('Content-Disposition', 'attachment; filename="'.$fileName.'"')
|
106 |
+
->setHeader('Last-Modified', date('r'));
|
107 |
+
|
108 |
+
if (!is_null($content)) {
|
109 |
+
if ($isFile) {
|
110 |
+
$file_content = "";
|
111 |
+
//$this->getResponse()->clearBody();
|
112 |
+
//$this->getResponse()->sendHeaders();
|
113 |
+
|
114 |
+
$ioAdapter = new Varien_Io_File();
|
115 |
+
$ioAdapter->open(array('path' => $ioAdapter->dirname($file)));
|
116 |
+
$ioAdapter->streamOpen($file, 'r');
|
117 |
+
while ($buffer = $ioAdapter->streamRead()) {
|
118 |
+
$file_content .= $buffer;
|
119 |
+
}
|
120 |
+
$ioAdapter->streamClose();
|
121 |
+
if (!empty($content['rm'])) {
|
122 |
+
$ioAdapter->rm($file);
|
123 |
+
}
|
124 |
+
$this->getResponse()->setBody($file_content);
|
125 |
+
} else {
|
126 |
+
$this->getResponse()->setBody($content);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
return $this;
|
130 |
+
}
|
131 |
+
}
|
app/code/local/EmailDirect/Integration/controllers/Customer/AccountController.php
CHANGED
@@ -44,70 +44,137 @@ class EmailDirect_Integration_Customer_AccountController extends Mage_Core_Contr
|
|
44 |
|
45 |
public function saveadditionalAction()
|
46 |
{
|
47 |
-
// Mage::log(__METHOD__);
|
48 |
-
$customerSession = Mage::getSingleton('customer/session');
|
49 |
-
|
50 |
-
if($this->getRequest()->isPost()){
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
//<state> param is an html serialized field containing the default form state
|
53 |
//before submission, we need to parse it as a request in order to save it to $odata and process it
|
54 |
-
parse_str($
|
|
|
|
|
55 |
|
56 |
-
$
|
57 |
$lists = $this->getRequest()->getPost('list', array());
|
|
|
|
|
|
|
58 |
$customer = Mage::helper('customer')->getCustomer();
|
59 |
$email = $customer->getEmail();
|
60 |
|
|
|
|
|
61 |
// Manage the main publication and subscription
|
62 |
$publication = (TRUE === array_key_exists('publication', $odata)) ? $odata['publication'] : array();
|
63 |
-
$pub_selection
|
|
|
|
|
64 |
$general = Mage::helper('emaildirect')->config('publication');
|
65 |
|
66 |
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
67 |
$subscriber->setImportMode(false);
|
68 |
$rc = Mage::getSingleton('emaildirect/wrapper_publications')->getPublication($general);
|
69 |
$subscriber->setListName((string)$rc->Name);
|
|
|
|
|
70 |
|
|
|
|
|
|
|
71 |
|
72 |
-
|
73 |
-
if(!$pub_selection)
|
74 |
-
|
|
|
|
|
|
|
|
|
75 |
$subscriber->unsubscribe();
|
76 |
// unsuscribe for all the lists
|
77 |
-
foreach($
|
78 |
-
|
|
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
80 |
$this->_redirect('*/*/index');
|
|
|
81 |
}
|
82 |
-
elseif($publication != $pub_selection)
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
-
else
|
89 |
-
|
|
|
|
|
90 |
}
|
91 |
$subscriber->subscribe($email);
|
92 |
}
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
}
|
99 |
}
|
|
|
100 |
//Subscribe to new lists
|
101 |
-
$subscribe = array_diff_key($lists, $
|
102 |
-
if(
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
-
|
107 |
}
|
108 |
-
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
111 |
$this->_redirect('*/*/index');
|
112 |
}
|
113 |
}
|
44 |
|
45 |
public function saveadditionalAction()
|
46 |
{
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
$helper = Mage::helper('emaildirect');
|
49 |
+
|
50 |
+
$helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
|
51 |
+
$helper->log('Save Additional Start');
|
52 |
+
|
53 |
+
$session = Mage::getSingleton('customer/session');
|
54 |
+
|
55 |
+
if ($this->getRequest()->isPost())
|
56 |
+
{
|
57 |
+
$state = $this->getRequest()->getPost('state');
|
58 |
+
$helper->log($state, 'State Serialized');
|
59 |
//<state> param is an html serialized field containing the default form state
|
60 |
//before submission, we need to parse it as a request in order to save it to $odata and process it
|
61 |
+
parse_str($state, $odata);
|
62 |
+
|
63 |
+
$helper->log($odata, 'State Data');
|
64 |
|
65 |
+
$active_lists = (TRUE === array_key_exists('list', $odata)) ? $odata['list'] : array();
|
66 |
$lists = $this->getRequest()->getPost('list', array());
|
67 |
+
|
68 |
+
$helper->log($lists, 'List Selection');
|
69 |
+
|
70 |
$customer = Mage::helper('customer')->getCustomer();
|
71 |
$email = $customer->getEmail();
|
72 |
|
73 |
+
$helper->log("Email: {$email}");
|
74 |
+
|
75 |
// Manage the main publication and subscription
|
76 |
$publication = (TRUE === array_key_exists('publication', $odata)) ? $odata['publication'] : array();
|
77 |
+
$pub_selection = $this->getRequest()->getPost('publication', array());
|
78 |
+
|
79 |
+
$helper->log($pub_selection, 'Publication Selection');
|
80 |
$general = Mage::helper('emaildirect')->config('publication');
|
81 |
|
82 |
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
83 |
$subscriber->setImportMode(false);
|
84 |
$rc = Mage::getSingleton('emaildirect/wrapper_publications')->getPublication($general);
|
85 |
$subscriber->setListName((string)$rc->Name);
|
86 |
+
|
87 |
+
$new_subscriber = false;
|
88 |
|
89 |
+
// SCENARIO - User is not in EmailDirect yet but has selected only the main publication.
|
90 |
+
// When adding to EmailDirect we automatically subscribe to ALL lists selected.
|
91 |
+
// Make it work with only the selected lists
|
92 |
|
93 |
+
|
94 |
+
if (!$pub_selection)
|
95 |
+
{
|
96 |
+
$helper->log("Unsubscribe from All");
|
97 |
+
|
98 |
+
// Publication is deslected so Unsubscribe from all.
|
99 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_publications')->unsubscribe($general,$email);
|
100 |
$subscriber->unsubscribe();
|
101 |
// unsuscribe for all the lists
|
102 |
+
foreach($active_lists as $listId => $list)
|
103 |
+
{
|
104 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_lists')->listUnsubscribe($listId, $email);
|
105 |
}
|
106 |
+
|
107 |
+
$session->addSuccess('Successfully unsubscribed from Newsletter');
|
108 |
+
|
109 |
+
$helper->log("Unsubscribe from all success redirect");
|
110 |
+
|
111 |
$this->_redirect('*/*/index');
|
112 |
+
return;
|
113 |
}
|
114 |
+
elseif ($publication != $pub_selection)
|
115 |
+
{
|
116 |
+
$helper->log("Publication != Publication Selection");
|
117 |
+
|
118 |
+
if($subscriber->isObjectNew())
|
119 |
+
{
|
120 |
+
// This code happens when ->subscribe is called below
|
121 |
+
$helper->log("New Subscriber");
|
122 |
+
|
123 |
+
$additional_lists = Mage::helper('emaildirect')->config('additional_lists');
|
124 |
+
if ($additional_lists != "")
|
125 |
+
{
|
126 |
+
$helper->log("Get New Active Lists");
|
127 |
+
$temp_lists = explode(",",$additional_lists);
|
128 |
+
$active_lists = array();
|
129 |
+
|
130 |
+
foreach ($temp_lists as $temp_id)
|
131 |
+
{
|
132 |
+
$active_lists[$temp_id] = array('subscribed' => $temp_id);
|
133 |
+
}
|
134 |
+
|
135 |
+
$helper->log($active_lists,"New Active Lists Data");
|
136 |
+
}
|
137 |
+
|
138 |
+
$new_subscriber = true;
|
139 |
}
|
140 |
+
else
|
141 |
+
{
|
142 |
+
$helper->log("Existing Subscriber");
|
143 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_publications')->subscribe($general,$email);
|
144 |
}
|
145 |
$subscriber->subscribe($email);
|
146 |
}
|
147 |
+
|
148 |
+
if( !empty($active_lists) )
|
149 |
+
{
|
150 |
+
$helper->log("Active Lists");
|
151 |
+
foreach($active_lists as $listId => $list)
|
152 |
+
{
|
153 |
+
if (FALSE === array_key_exists($listId, $lists))
|
154 |
+
{
|
155 |
+
$helper->log("Unsubscribe from list {$listId}");
|
156 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_lists')->listUnsubscribe($listId, $email);
|
157 |
}
|
158 |
}
|
159 |
}
|
160 |
+
|
161 |
//Subscribe to new lists
|
162 |
+
$subscribe = array_diff_key($lists, $active_lists);
|
163 |
+
if (!empty($subscribe))
|
164 |
+
{
|
165 |
+
$helper->log("Subscribe to new lists");
|
166 |
+
foreach($subscribe as $listId => $slist)
|
167 |
+
{
|
168 |
+
$helper->log("Subscribe to list {$listId}");
|
169 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_lists')->listSubscribe($listId, $email);
|
170 |
}
|
|
|
171 |
}
|
|
|
172 |
}
|
173 |
|
174 |
+
$session->addSuccess('Subscriptions Updated');
|
175 |
+
|
176 |
+
$helper->log('Save Additional End');
|
177 |
+
|
178 |
$this->_redirect('*/*/index');
|
179 |
}
|
180 |
}
|
app/code/local/EmailDirect/Integration/controllers/ExportController.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class EmailDirect_Integration_ExportController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
-
public function downloadAction()
|
5 |
-
{
|
6 |
-
$file_name = "emaildirect_products_" . $this->getRequest()->getParam('filename');
|
7 |
-
$file = Mage::helper('emaildirect')->getExportFileName($file_name);
|
8 |
-
|
9 |
-
$this->_prepareDownloadResponse(Mage::helper('emaildirect')->getExportFileName($file_name,false), file_get_contents($file));
|
10 |
-
}
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmailDirect/Integration/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<EmailDirect_Integration>
|
5 |
-
<version>1.
|
6 |
</EmailDirect_Integration>
|
7 |
</modules>
|
8 |
<global>
|
@@ -39,14 +39,6 @@
|
|
39 |
</emaildirect_order_save_after>
|
40 |
</observers>
|
41 |
</sales_order_save_after>
|
42 |
-
<sales_quote_save_after>
|
43 |
-
<observers>
|
44 |
-
<emaildirect_quote_save_after>
|
45 |
-
<class>emaildirect/observer</class>
|
46 |
-
<method>quoteSaveAfter</method>
|
47 |
-
</emaildirect_quote_save_after>
|
48 |
-
</observers>
|
49 |
-
</sales_quote_save_after>
|
50 |
</events>
|
51 |
<models>
|
52 |
<emaildirect>
|
@@ -90,7 +82,7 @@
|
|
90 |
<class>EmailDirect_Integration_Helper</class>
|
91 |
</emaildirect>
|
92 |
</helpers>
|
93 |
-
|
94 |
<email>
|
95 |
<newsletter_subscription_success_email_template translate="label" module="emaildirect">
|
96 |
<label>Newsletter subscription success</label>
|
@@ -103,7 +95,7 @@
|
|
103 |
<type>html</type>
|
104 |
</newsletter_subscription_un_email_template>
|
105 |
</email>
|
106 |
-
|
107 |
</global>
|
108 |
<frontend>
|
109 |
<translate>
|
@@ -148,14 +140,14 @@
|
|
148 |
</emaildirect_subscribe_checkoutsuccess>
|
149 |
</observers>
|
150 |
</checkout_onepage_controller_success_action>
|
151 |
-
<
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
</events>
|
160 |
</frontend>
|
161 |
<admin>
|
@@ -178,7 +170,6 @@
|
|
178 |
<sort_order>100</sort_order>
|
179 |
<action>emaildirect/admin_abandoned</action>
|
180 |
</emaildirect_abandoned>
|
181 |
-
|
182 |
</children>
|
183 |
</sales>
|
184 |
</menu>
|
@@ -190,24 +181,11 @@
|
|
190 |
<emaildirect_abandoned>
|
191 |
<title>EmailDirect - Abandoned Carts</title>
|
192 |
</emaildirect_abandoned>
|
193 |
-
|
194 |
</sales>
|
195 |
-
<system>
|
196 |
-
<children>
|
197 |
-
<config>
|
198 |
-
<children>
|
199 |
-
<factory_customers>
|
200 |
-
<title>Customers Configuration</title>
|
201 |
-
</factory_customers>
|
202 |
-
</children>
|
203 |
-
</config>
|
204 |
-
</children>
|
205 |
-
</system>
|
206 |
</children>
|
207 |
</admin>
|
208 |
</resources>
|
209 |
</acl>
|
210 |
-
|
211 |
<layout>
|
212 |
<updates>
|
213 |
<emaildirect>
|
@@ -225,6 +203,14 @@
|
|
225 |
</modules>
|
226 |
</translate>
|
227 |
<events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
<sales_order_shipment_track_save_after>
|
229 |
<observers>
|
230 |
<googlecheckout>
|
@@ -264,14 +250,13 @@
|
|
264 |
<sourceid>0</sourceid>
|
265 |
<source>Magento</source>
|
266 |
<max_times>1</max_times>
|
267 |
-
<list>-1</list>
|
268 |
<address_fields><![CDATA[a:5:{s:2:"a1";a:2:{s:7:"magento";s:6:"street";s:11:"emaildirect";s:7:"Address";}s:2:"a2";a:2:{s:7:"magento";s:4:"city";s:11:"emaildirect";s:4:"City";}s:2:"a3";a:2:{s:7:"magento";s:10:"state_code";s:11:"emaildirect";s:5:"State";}s:2:"a4";a:2:{s:7:"magento";s:8:"postcode";s:11:"emaildirect";s:3:"Zip";}s:2:"a5";a:2:{s:7:"magento";s:9:"telephone";s:11:"emaildirect";s:5:"Phone";}}]]></address_fields>
|
269 |
<map_fields><![CDATA[a:2:{i:0;a:2:{s:7:"magento";s:9:"firstname";s:11:"emaildirect";s:9:"FirstName";}i:1;a:2:{s:7:"magento";s:8:"lastname";s:11:"emaildirect";s:8:"LastName";}}]]></map_fields>
|
270 |
<abandonedtime>30</abandonedtime>
|
271 |
-
<abandonedlist>-1</abandonedlist>
|
272 |
<sendabandoned>0</sendabandoned>
|
273 |
<abandonedsetup>0</abandonedsetup>
|
274 |
-
<
|
|
|
275 |
<save_latest_order>0</save_latest_order>
|
276 |
<product_fields>3</product_fields>
|
277 |
<related_fields>2</related_fields>
|
@@ -281,6 +266,13 @@
|
|
281 |
<include_disabled>1</include_disabled>
|
282 |
<batch>100</batch>
|
283 |
</export>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
</emaildirect>
|
285 |
</default>
|
286 |
<crontab>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<EmailDirect_Integration>
|
5 |
+
<version>1.5.0</version>
|
6 |
</EmailDirect_Integration>
|
7 |
</modules>
|
8 |
<global>
|
39 |
</emaildirect_order_save_after>
|
40 |
</observers>
|
41 |
</sales_order_save_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
</events>
|
43 |
<models>
|
44 |
<emaildirect>
|
82 |
<class>EmailDirect_Integration_Helper</class>
|
83 |
</emaildirect>
|
84 |
</helpers>
|
85 |
+
<!--<template>
|
86 |
<email>
|
87 |
<newsletter_subscription_success_email_template translate="label" module="emaildirect">
|
88 |
<label>Newsletter subscription success</label>
|
95 |
<type>html</type>
|
96 |
</newsletter_subscription_un_email_template>
|
97 |
</email>
|
98 |
+
</template>-->
|
99 |
</global>
|
100 |
<frontend>
|
101 |
<translate>
|
140 |
</emaildirect_subscribe_checkoutsuccess>
|
141 |
</observers>
|
142 |
</checkout_onepage_controller_success_action>
|
143 |
+
<sales_quote_save_after>
|
144 |
+
<observers>
|
145 |
+
<emaildirect_quote_save_after>
|
146 |
+
<class>emaildirect/observer</class>
|
147 |
+
<method>quoteSaveAfter</method>
|
148 |
+
</emaildirect_quote_save_after>
|
149 |
+
</observers>
|
150 |
+
</sales_quote_save_after>
|
151 |
</events>
|
152 |
</frontend>
|
153 |
<admin>
|
170 |
<sort_order>100</sort_order>
|
171 |
<action>emaildirect/admin_abandoned</action>
|
172 |
</emaildirect_abandoned>
|
|
|
173 |
</children>
|
174 |
</sales>
|
175 |
</menu>
|
181 |
<emaildirect_abandoned>
|
182 |
<title>EmailDirect - Abandoned Carts</title>
|
183 |
</emaildirect_abandoned>
|
|
|
184 |
</sales>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
</children>
|
186 |
</admin>
|
187 |
</resources>
|
188 |
</acl>
|
|
|
189 |
<layout>
|
190 |
<updates>
|
191 |
<emaildirect>
|
203 |
</modules>
|
204 |
</translate>
|
205 |
<events>
|
206 |
+
<core_block_abstract_to_html_before>
|
207 |
+
<observers>
|
208 |
+
<emaildirect_newsletter_massaction>
|
209 |
+
<class>emaildirect/observer</class>
|
210 |
+
<method>updateNewsletterMassAction</method>
|
211 |
+
</emaildirect_newsletter_massaction>
|
212 |
+
</observers>
|
213 |
+
</core_block_abstract_to_html_before>
|
214 |
<sales_order_shipment_track_save_after>
|
215 |
<observers>
|
216 |
<googlecheckout>
|
250 |
<sourceid>0</sourceid>
|
251 |
<source>Magento</source>
|
252 |
<max_times>1</max_times>
|
|
|
253 |
<address_fields><![CDATA[a:5:{s:2:"a1";a:2:{s:7:"magento";s:6:"street";s:11:"emaildirect";s:7:"Address";}s:2:"a2";a:2:{s:7:"magento";s:4:"city";s:11:"emaildirect";s:4:"City";}s:2:"a3";a:2:{s:7:"magento";s:10:"state_code";s:11:"emaildirect";s:5:"State";}s:2:"a4";a:2:{s:7:"magento";s:8:"postcode";s:11:"emaildirect";s:3:"Zip";}s:2:"a5";a:2:{s:7:"magento";s:9:"telephone";s:11:"emaildirect";s:5:"Phone";}}]]></address_fields>
|
254 |
<map_fields><![CDATA[a:2:{i:0;a:2:{s:7:"magento";s:9:"firstname";s:11:"emaildirect";s:9:"FirstName";}i:1;a:2:{s:7:"magento";s:8:"lastname";s:11:"emaildirect";s:8:"LastName";}}]]></map_fields>
|
255 |
<abandonedtime>30</abandonedtime>
|
|
|
256 |
<sendabandoned>0</sendabandoned>
|
257 |
<abandonedsetup>0</abandonedsetup>
|
258 |
+
<setup>0</setup>
|
259 |
+
<debug>0</debug>
|
260 |
<save_latest_order>0</save_latest_order>
|
261 |
<product_fields>3</product_fields>
|
262 |
<related_fields>2</related_fields>
|
266 |
<include_disabled>1</include_disabled>
|
267 |
<batch>100</batch>
|
268 |
</export>
|
269 |
+
<troubleshooting>
|
270 |
+
<enabled>0</enabled>
|
271 |
+
<email>Kevinl@EmailDirect.com</email>
|
272 |
+
<subject>EmailDirect Magento Module Troubleshooting Report</subject>
|
273 |
+
<report_file>troubleshootingreport.html</report_file>
|
274 |
+
<max_file_size>1048576</max_file_size>
|
275 |
+
</troubleshooting>
|
276 |
</emaildirect>
|
277 |
</default>
|
278 |
<crontab>
|
app/code/local/EmailDirect/Integration/etc/system.xml
CHANGED
@@ -2,247 +2,252 @@
|
|
2 |
<config>
|
3 |
<sections>
|
4 |
<emaildirect translate="label" module="emaildirect">
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
<
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
</
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
|
|
|
|
|
|
|
|
|
|
248 |
</config>
|
2 |
<config>
|
3 |
<sections>
|
4 |
<emaildirect translate="label" module="emaildirect">
|
5 |
+
<class>emaildirect-section</class>
|
6 |
+
<label>EmailDirect Configuration</label>
|
7 |
+
<header_css>emaildirect-header</header_css>
|
8 |
+
<tab>customer</tab>
|
9 |
+
<sort_order>404</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<groups>
|
14 |
+
<hint>
|
15 |
+
<frontend_model>emaildirect/adminhtml_system_config_fieldset_hint</frontend_model>
|
16 |
+
<sort_order>0</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
</hint>
|
21 |
+
<general translate="label comment">
|
22 |
+
<label>General</label>
|
23 |
+
<frontend_type>text</frontend_type>
|
24 |
+
<sort_order>660</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>1</show_in_store>
|
28 |
+
<fields>
|
29 |
+
<active translate="label">
|
30 |
+
<label>Enabled</label>
|
31 |
+
<frontend_type>select</frontend_type>
|
32 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
33 |
+
<sort_order>10</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>1</show_in_store>
|
37 |
+
</active>
|
38 |
+
<apikey translate="label comment">
|
39 |
+
<label>API Key</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>20</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>0</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<comment>Enter your EmailDirect API Key here</comment>
|
46 |
+
</apikey>
|
47 |
+
<publication translate="label comment">
|
48 |
+
<label>Publication</label>
|
49 |
+
<frontend_type>select</frontend_type>
|
50 |
+
<source_model>emaildirect/system_config_source_publication</source_model>
|
51 |
+
<sort_order>24</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>0</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
<can_be_empty>1</can_be_empty>
|
56 |
+
<comment>This is the Publication that emails will be subscribed to and is required</comment>
|
57 |
+
</publication>
|
58 |
+
<additional_lists translate="label comment">
|
59 |
+
<label>Additional Lists</label>
|
60 |
+
<frontend_type>multiselect</frontend_type>
|
61 |
+
<source_model>emaildirect/system_config_source_additionallist</source_model>
|
62 |
+
<sort_order>35</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>0</show_in_website>
|
65 |
+
<show_in_store>1</show_in_store>
|
66 |
+
<can_be_empty>1</can_be_empty>
|
67 |
+
<comment>Choose one or more Lists to allow your subscribers more options when subscribing. Not required</comment>
|
68 |
+
</additional_lists>
|
69 |
+
<source translate="label comment">
|
70 |
+
<label>Source</label>
|
71 |
+
<frontend_type>text</frontend_type>
|
72 |
+
<sort_order>42</sort_order>
|
73 |
+
<show_in_default>1</show_in_default>
|
74 |
+
<show_in_website>0</show_in_website>
|
75 |
+
<show_in_store>1</show_in_store>
|
76 |
+
<can_be_empty>0</can_be_empty>
|
77 |
+
<comment><![CDATA[This is the main source used with the Magento General Subscription.<br/> If you leave this field blank <b>Magento</b> is used]]></comment>
|
78 |
+
</source>
|
79 |
+
<address_fields translate="label comment">
|
80 |
+
<label>Address Fields Mapping</label>
|
81 |
+
<frontend_model>emaildirect/adminhtml_system_config_form_field_addressmapfields</frontend_model>
|
82 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
83 |
+
<sort_order>72</sort_order>
|
84 |
+
<show_in_default>1</show_in_default>
|
85 |
+
<show_in_website>0</show_in_website>
|
86 |
+
<show_in_store>1</show_in_store>
|
87 |
+
</address_fields>
|
88 |
+
<map_fields translate="label comment">
|
89 |
+
<label>Customer Fields Mapping</label>
|
90 |
+
<frontend_model>emaildirect/adminhtml_system_config_form_field_mapfields</frontend_model>
|
91 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
92 |
+
<sort_order>70</sort_order>
|
93 |
+
<show_in_default>1</show_in_default>
|
94 |
+
<show_in_website>0</show_in_website>
|
95 |
+
<show_in_store>1</show_in_store>
|
96 |
+
</map_fields>
|
97 |
+
<shipping_fields translate="label comment">
|
98 |
+
<label>Shipping Fields Mapping</label>
|
99 |
+
<frontend_model>emaildirect/adminhtml_system_config_form_field_shippingmapfields</frontend_model>
|
100 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
101 |
+
<sort_order>75</sort_order>
|
102 |
+
<show_in_default>1</show_in_default>
|
103 |
+
<show_in_website>0</show_in_website>
|
104 |
+
<show_in_store>1</show_in_store>
|
105 |
+
</shipping_fields>
|
106 |
+
<checkout_subscribe translate="label comment">
|
107 |
+
<label>Subscribe On Checkout</label>
|
108 |
+
<frontend_type>select</frontend_type>
|
109 |
+
<source_model>emaildirect/system_config_source_checkoutsubscribe</source_model>
|
110 |
+
<sort_order>80</sort_order>
|
111 |
+
<show_in_default>1</show_in_default>
|
112 |
+
<show_in_website>0</show_in_website>
|
113 |
+
<show_in_store>1</show_in_store>
|
114 |
+
<comment>Show Newsletter Subscribe checkbox in the last Checkout Step (Order Review)</comment>
|
115 |
+
</checkout_subscribe>
|
116 |
+
<sendorder translate="label">
|
117 |
+
<label>Send orders to EmailDirect</label>
|
118 |
+
<frontend_type>select</frontend_type>
|
119 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
120 |
+
<sort_order>85</sort_order>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>1</show_in_website>
|
123 |
+
<show_in_store>1</show_in_store>
|
124 |
+
<comment>Sends all completed orders to EmailDirect Purchase Behavior for detailed reporting, filtering and targeting</comment>
|
125 |
+
</sendorder>
|
126 |
+
<save_latest_order translate="label">
|
127 |
+
<label>Save Latest Order Information</label>
|
128 |
+
<frontend_type>select</frontend_type>
|
129 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
130 |
+
<sort_order>86</sort_order>
|
131 |
+
<show_in_default>1</show_in_default>
|
132 |
+
<show_in_website>1</show_in_website>
|
133 |
+
<show_in_store>1</show_in_store>
|
134 |
+
<comment>Save information from the latest order along with the first 3 products from that order</comment>
|
135 |
+
</save_latest_order>
|
136 |
+
<sendabandoned translate="label">
|
137 |
+
<label>Add Abandoned Carts To EmailDirect</label>
|
138 |
+
<frontend_type>select</frontend_type>
|
139 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
140 |
+
<sort_order>90</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>1</show_in_store>
|
144 |
+
<comment>This will add any abandoned shopping carts to the EmailDirect database with AbandonedDate and AbandonedURL database fields. These fields can be used with Workflows to time your own Abandoned Shopping Cart emails or send a series of emails. This allows for complete customization of the email.</comment>
|
145 |
+
</sendabandoned>
|
146 |
+
<abandonedtime translate="label comment">
|
147 |
+
<label>Abandoned Time</label>
|
148 |
+
<frontend_type>select</frontend_type>
|
149 |
+
<source_model>emaildirect/system_config_source_time</source_model>
|
150 |
+
<sort_order>100</sort_order>
|
151 |
+
<show_in_default>1</show_in_default>
|
152 |
+
<show_in_website>1</show_in_website>
|
153 |
+
<show_in_store>1</show_in_store>
|
154 |
+
<comment>How long before a cart is considered abandoned?</comment>
|
155 |
+
</abandonedtime>
|
156 |
+
<abandonedpublication translate="label comment">
|
157 |
+
<label>Abandoned Publication</label>
|
158 |
+
<frontend_type>select</frontend_type>
|
159 |
+
<source_model>emaildirect/system_config_source_publication</source_model>
|
160 |
+
<sort_order>110</sort_order>
|
161 |
+
<show_in_default>1</show_in_default>
|
162 |
+
<show_in_website>1</show_in_website>
|
163 |
+
<show_in_store>1</show_in_store>
|
164 |
+
<can_be_empty>1</can_be_empty>
|
165 |
+
<comment>This is the Publication that you will put abandoned shoppers into</comment>
|
166 |
+
</abandonedpublication>
|
167 |
+
<abandonedlist translate="label comment">
|
168 |
+
<label>Abandoned List</label>
|
169 |
+
<frontend_type>select</frontend_type>
|
170 |
+
<source_model>emaildirect/system_config_source_abandonedlist</source_model>
|
171 |
+
<sort_order>120</sort_order>
|
172 |
+
<show_in_default>1</show_in_default>
|
173 |
+
<show_in_website>1</show_in_website>
|
174 |
+
<show_in_store>1</show_in_store>
|
175 |
+
<can_be_empty>1</can_be_empty>
|
176 |
+
<comment>This is the List that you will put abandoned shoppers into. Not Required.</comment>
|
177 |
+
</abandonedlist>
|
178 |
+
</fields>
|
179 |
+
</general>
|
180 |
+
<export translate="label comment">
|
181 |
+
<label>Export Options</label>
|
182 |
+
<frontend_type>text</frontend_type>
|
183 |
+
<sort_order>670</sort_order>
|
184 |
+
<show_in_default>1</show_in_default>
|
185 |
+
<show_in_website>1</show_in_website>
|
186 |
+
<show_in_store>1</show_in_store>
|
187 |
+
<expanded>1</expanded>
|
188 |
+
<fields>
|
189 |
+
<send_to_emaildirect translate="label">
|
190 |
+
<label>Send File to Emaildirect</label>
|
191 |
+
<frontend_type>select</frontend_type>
|
192 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
193 |
+
<sort_order>10</sort_order>
|
194 |
+
<show_in_default>1</show_in_default>
|
195 |
+
<show_in_website>1</show_in_website>
|
196 |
+
<show_in_store>1</show_in_store>
|
197 |
+
<comment>This will add the category file to your EmailDirect account FTP. In your EmailDirect account go to Purchase Behavior, Orders, Import Order File and choose 'Select From FTP' to complete the import process.</comment>
|
198 |
+
</send_to_emaildirect>
|
199 |
+
<include_disabled translate="label">
|
200 |
+
<label>Include disabled Products?</label>
|
201 |
+
<frontend_type>select</frontend_type>
|
202 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
203 |
+
<sort_order>20</sort_order>
|
204 |
+
<show_in_default>1</show_in_default>
|
205 |
+
<show_in_website>1</show_in_website>
|
206 |
+
<show_in_store>1</show_in_store>
|
207 |
+
</include_disabled>
|
208 |
+
<batch translate="label comment">
|
209 |
+
<label>Batch Size</label>
|
210 |
+
<frontend_type>select</frontend_type>
|
211 |
+
<source_model>emaildirect/system_config_source_export_batch</source_model>
|
212 |
+
<sort_order>20</sort_order>
|
213 |
+
<show_in_default>0</show_in_default>
|
214 |
+
<show_in_website>0</show_in_website>
|
215 |
+
<show_in_store>0</show_in_store>
|
216 |
+
<comment>Number of Products to Export at a time (SAVE CONFIG BEFORE EXPORTING)</comment>
|
217 |
+
</batch>
|
218 |
+
<export_button>
|
219 |
+
<label>Export Products</label>
|
220 |
+
<frontend_model>emaildirect/adminhtml_system_config_form_field_button</frontend_model>
|
221 |
+
<sort_order>130</sort_order>
|
222 |
+
<show_in_default>1</show_in_default>
|
223 |
+
<show_in_website>1</show_in_website>
|
224 |
+
<show_in_store>1</show_in_store>
|
225 |
+
<can_be_empty>1</can_be_empty>
|
226 |
+
<comment>Export Orders to CSV and send the CSV file to Emaildirect (opens in new window)</comment>
|
227 |
+
</export_button>
|
228 |
+
</fields>
|
229 |
+
</export>
|
230 |
+
<troubleshooting translate="label comment">
|
231 |
+
<label>Troubleshooting</label>
|
232 |
+
<frontend_type>text</frontend_type>
|
233 |
+
<sort_order>900</sort_order>
|
234 |
+
<show_in_default>1</show_in_default>
|
235 |
+
<show_in_website>0</show_in_website>
|
236 |
+
<show_in_store>1</show_in_store>
|
237 |
+
<expanded>1</expanded>
|
238 |
+
<fields>
|
239 |
+
<enabled translate="label">
|
240 |
+
<label>Troubleshooting System</label>
|
241 |
+
<frontend_model>emaildirect/adminhtml_system_config_form_field_troubleshooting</frontend_model>
|
242 |
+
<sort_order>10</sort_order>
|
243 |
+
<show_in_default>1</show_in_default>
|
244 |
+
<show_in_website>1</show_in_website>
|
245 |
+
<show_in_store>1</show_in_store>
|
246 |
+
<comment></comment>
|
247 |
+
</enabled>
|
248 |
+
</fields>
|
249 |
+
</troubleshooting>
|
250 |
+
</groups>
|
251 |
+
</emaildirect>
|
252 |
+
</sections>
|
253 |
</config>
|
app/design/adminhtml/default/default/layout/emaildirect.xml
CHANGED
@@ -5,29 +5,6 @@
|
|
5 |
<action method="addCss"><stylesheet>emaildirect/emaildirect.css</stylesheet></action>
|
6 |
</reference>
|
7 |
</adminhtml_system_config_edit>
|
8 |
-
|
9 |
-
<emaildirect_adminhtml_ctemplate_edit>
|
10 |
-
<reference name="head">
|
11 |
-
<action method="addCss"><stylesheet>emaildirect/emaildirect.css</stylesheet></action>
|
12 |
-
<action method="addItem"><type>skin_js</type><name>emaildirect/emaildirect.js</name></action>
|
13 |
-
</reference>
|
14 |
-
</emaildirect_adminhtml_ctemplate_edit>
|
15 |
-
|
16 |
-
<emaildirect_adminhtml_ctemplate_new>
|
17 |
-
<reference name="head">
|
18 |
-
<action method="addCss"><stylesheet>emaildirect/emaildirect.css</stylesheet></action>
|
19 |
-
<action method="addItem"><type>skin_js</type><name>emaildirect/emaildirect.js</name></action>
|
20 |
-
</reference>
|
21 |
-
</emaildirect_adminhtml_ctemplate_new>
|
22 |
-
|
23 |
-
<!--adminhtml_customer_edit>
|
24 |
-
<reference name="customer_edit_tabs">
|
25 |
-
<action method="addTab">
|
26 |
-
<name>customer_edit_tab_emaildirect_memberactivity</name>
|
27 |
-
<block>emaildirect/adminhtml_customer_edit_tab_memberactivity</block>
|
28 |
-
</action>
|
29 |
-
</reference>
|
30 |
-
</adminhtml_customer_edit-->
|
31 |
|
32 |
<emaildirect_admin_export_run>
|
33 |
<remove name="root"/>
|
@@ -43,13 +20,39 @@
|
|
43 |
</block>
|
44 |
</emaildirect_admin_export_run>
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
<emaildirect_admin_abandoned_index>
|
47 |
<reference name="head">
|
48 |
<action method="addCss"><stylesheet>emaildirect/emaildirect.css</stylesheet></action>
|
49 |
|
50 |
</reference>
|
51 |
<reference name="content">
|
52 |
-
<block type="emaildirect/adminhtml_abandoned" name="abandoned_details" template="
|
|
|
|
|
53 |
</reference>
|
54 |
</emaildirect_admin_abandoned_index>
|
55 |
|
5 |
<action method="addCss"><stylesheet>emaildirect/emaildirect.css</stylesheet></action>
|
6 |
</reference>
|
7 |
</adminhtml_system_config_edit>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
<emaildirect_admin_export_run>
|
10 |
<remove name="root"/>
|
20 |
</block>
|
21 |
</emaildirect_admin_export_run>
|
22 |
|
23 |
+
<emaildirect_admin_troubleshooting_index>
|
24 |
+
<reference name="head">
|
25 |
+
<action method="addCss"><stylesheet>emaildirect/emaildirect.css</stylesheet>
|
26 |
+
</action>
|
27 |
+
|
28 |
+
</reference>
|
29 |
+
<reference name="content">
|
30 |
+
<block type="emaildirect/adminhtml_troubleshooting_view" name="troubleshooting_view"></block>
|
31 |
+
</reference>
|
32 |
+
<reference name="left">
|
33 |
+
<block type="emaildirect/adminhtml_troubleshooting_tabs" name="trouble.tabs" as="trouble.tabs" template="widget/tabs.phtml" >
|
34 |
+
<block type="emaildirect/adminhtml_troubleshooting_view_tab_info" name="troubleshooting_tab_info" template="emaildirect/troubleshooting/view/tab/info.phtml">
|
35 |
+
|
36 |
+
</block>
|
37 |
+
<action method="addTab"><name>trouble_info</name><block>troubleshooting_tab_info</block></action>
|
38 |
+
<action method="addTab"><name>trouble_log</name><block>emaildirect/adminhtml_troubleshooting_view_tab_log</block></action>
|
39 |
+
<action method="addTab"><name>trouble_submit</name><block>emaildirect/adminhtml_troubleshooting_view_tab_submit</block></action>
|
40 |
+
<action method="addTab"><name>trouble_download</name><block>emaildirect/adminhtml_troubleshooting_view_tab_download</block></action>
|
41 |
+
<!--<action method="addTab" translate="title" module="catalog"><alias>troubleshooting</alias><title>Info</title><block>emaildirect/adminhtml_troubleshooting</block><template>emaildirect/troubleshooting/details.phtml</template></action>-->
|
42 |
+
</block>
|
43 |
+
<!--<block type="emaildirect/adminhtml_troubleshooting" name="troubleshooting_details" template="emaildirect/troubleshooting/details.phtml" />-->
|
44 |
+
</reference>
|
45 |
+
</emaildirect_admin_troubleshooting_index>
|
46 |
+
|
47 |
<emaildirect_admin_abandoned_index>
|
48 |
<reference name="head">
|
49 |
<action method="addCss"><stylesheet>emaildirect/emaildirect.css</stylesheet></action>
|
50 |
|
51 |
</reference>
|
52 |
<reference name="content">
|
53 |
+
<block type="emaildirect/adminhtml_abandoned" name="abandoned_details" template="report/grid/container.phtml">
|
54 |
+
|
55 |
+
</block>
|
56 |
</reference>
|
57 |
</emaildirect_admin_abandoned_index>
|
58 |
|
app/design/adminhtml/default/default/template/emaildirect/system/config/form/field/trouble.phtml
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--<button id='emaildirect_export' onClick="window.open('<?php echo $this->getUrl("emaildirect/admin_export/run/"); ?>'); return false;">Export</button>-->
|
2 |
+
<?php
|
3 |
+
$element = $this->getElement();
|
4 |
+
|
5 |
+
$enabled = $element->getValue();
|
6 |
+
?>
|
7 |
+
|
8 |
+
<span class='trouble_status'>Status: <strong><?php if ($enabled) echo "Enabled"; else echo "Disabled" ?></strong></span>
|
9 |
+
<button id='emaildirect_trouble' onClick="toggle_trouble();"><?php if ($enabled) echo "Disable"; else echo "Enable" ?></button>
|
10 |
+
<input type='hidden' name='<?php echo $this->getElement()->getName() ?>' value='<?php echo $this->getElement()->getValue() ?>'/>
|
11 |
+
|
12 |
+
<?php if ($enabled): ?>
|
13 |
+
<div id='emaildirect_trouble_details'>
|
14 |
+
<table>
|
15 |
+
<tr>
|
16 |
+
<td>Start Date:</td>
|
17 |
+
<td><?php echo $this->getStartDate() ?></td>
|
18 |
+
</tr>
|
19 |
+
<tr>
|
20 |
+
<td>Log File:</td>
|
21 |
+
<td><?php echo $this->getLogInfo() ?></td>
|
22 |
+
</tr>
|
23 |
+
<tr>
|
24 |
+
<td>EmailDirect:</td>
|
25 |
+
<td><?php echo $this->getEDirectInfo() ?></td>
|
26 |
+
</tr>
|
27 |
+
<tr>
|
28 |
+
<td>Abandoned Carts:</td>
|
29 |
+
<td><?php echo $this->getAbandonedInfo() ?></td>
|
30 |
+
</tr>
|
31 |
+
</table>
|
32 |
+
<p>Now that Troubleshooting is enabled you need to perform the actions that are currently not sending data to EmailDirect.</p>
|
33 |
+
<p>See the lists below to troubleshoot the areas you are having problems with.</p>
|
34 |
+
<p>
|
35 |
+
<strong>Abandoned Carts: </strong>
|
36 |
+
<ul>
|
37 |
+
<li>Make sure Abandoned Carts are enabled (see above).</li>
|
38 |
+
<li>Abandon at least one cart in the front end of your store. You must have a logged in account for a cart to be abandoned.</li>
|
39 |
+
<li>To test whether cron is working, wait at least one hour for the abandoned process to run before sending the report.</li>
|
40 |
+
<li>Go to the <a href='<?php echo $this->getUrl('emaildirect/admin_abandoned/index'); ?>'>Abandoned Carts page</a> and click "Run Now" to see if it works without cron.</li>
|
41 |
+
</ul>
|
42 |
+
</p>
|
43 |
+
<p>
|
44 |
+
<strong>Orders: </strong>
|
45 |
+
<ul>
|
46 |
+
<li>Create at least one order and process it in the Admin until it is complete.</li>
|
47 |
+
<li>To test Shipping Tracking, save a tracking number for a completed order.</li>
|
48 |
+
</ul>
|
49 |
+
</p>
|
50 |
+
<p>
|
51 |
+
<strong>Customers: </strong>
|
52 |
+
<ul>
|
53 |
+
<li>Add a new customer with any additional fields you have mapped.</li>
|
54 |
+
<li>Update a customers information and subscription preferences.</li>
|
55 |
+
</ul>
|
56 |
+
</p>
|
57 |
+
<button id='emaildirect_send_trouble' onClick="view_details(); return false;">View information to Send to EmailDirect</button>
|
58 |
+
</div>
|
59 |
+
<?php endif; ?>
|
60 |
+
|
61 |
+
<script type='text/javascript'>
|
62 |
+
function toggle_trouble()
|
63 |
+
{
|
64 |
+
var form = $('config_edit_form');
|
65 |
+
var trouble = form['<?php echo $element->getName() ?>'];
|
66 |
+
var val = $(trouble).getValue()
|
67 |
+
|
68 |
+
val = 1 - val;
|
69 |
+
|
70 |
+
$(trouble).setValue(val);
|
71 |
+
}
|
72 |
+
function view_details()
|
73 |
+
{
|
74 |
+
var form = $('config_edit_form');
|
75 |
+
var url = '<?php echo $this->getUrl("emaildirect/admin_troubleshooting/"); ?>';
|
76 |
+
|
77 |
+
//url += 'send_to_emaildirect/' + $(send_to_ed).getValue() + '/include_disabled/' + $(include_disabled).getValue() + '/';
|
78 |
+
|
79 |
+
window.location = url;
|
80 |
+
}
|
81 |
+
</script>
|
app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view.phtml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php echo $this->getFormInitScripts() ?>
|
2 |
+
<div class="content-header">
|
3 |
+
<?php echo $this->getHeaderHtml() ?>
|
4 |
+
<p class="form-buttons"><?php echo $this->getButtonsHtml('header') ?></p>
|
5 |
+
</div>
|
6 |
+
<?php if ($this->isLogFileTooLarge()): ?>
|
7 |
+
<p class='log_note'><strong>Note:</strong> The log file is too large to send the entire file. Only the last <?php echo $this->getMaxLogFileSize() ?> will be sent.</p>
|
8 |
+
<p>To send the entire log, please compress the file and send it to <a href="mailto:<?php echo $this->getTroubleEmail() ?>?subject=<?php echo $this->getTroubleSubject() ?>"><?php echo $this->getTroubleEmail() ?></a>.<br />This file will be called <strong><?php echo $this->getLogFileName() ?></strong> and will most likely be located in the <strong>var/log</strong> folder in the root of your Magento Installation.</p>
|
9 |
+
<br />
|
10 |
+
<?php elseif ($this->getLogFileSize() == 0): ?>
|
11 |
+
<p class='log_note'><strong>Note:</strong> The log file is currently empty. Sending the report is not recommended until log data has been captured.</p>
|
12 |
+
<br />
|
13 |
+
<?php endif; ?>
|
14 |
+
<?php echo $this->getFormHtml() ?>
|
15 |
+
<?php if ($this->hasFooterButtons()): ?>
|
16 |
+
<div class="content-footer">
|
17 |
+
<p class="form-buttons"><?php echo $this->getButtonsHtml('footer') ?></p>
|
18 |
+
</div>
|
19 |
+
<?php endif; ?>
|
20 |
+
<script type="text/javascript">
|
21 |
+
editForm = new varienForm('edit_form', '<?php echo $this->getValidationUrl() ?>');
|
22 |
+
</script>
|
23 |
+
<?php echo $this->getFormScripts() ?>
|
app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view/form.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<div class="entry-edit" id="troubleshooting_view"></div>
|
app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view/tab/download.phtml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit">
|
2 |
+
<div class="entry-edit-head">
|
3 |
+
<h4>Download Report to send to EmailDirect</h4>
|
4 |
+
</div>
|
5 |
+
<div id="_accountbase_fieldset" class="fieldset ">
|
6 |
+
<div class="hor-scroll">
|
7 |
+
<p>Click the button below to download the troubleshooting report.</p>
|
8 |
+
<p>You can then send this report along with your contact information and description of the problem you are having to <a href="mailto:<?php echo $this->getTroubleEmail() ?>?subject=<?php echo $this->getTroubleSubject() ?>"><?php echo $this->getTroubleEmail() ?></a>.</p>
|
9 |
+
<button onclick="setLocation('<?php echo $this->getUrl('emaildirect/admin_troubleshooting/download/') ?>'); return false;">Download Report</button>
|
10 |
+
</div>
|
11 |
+
</div>
|
12 |
+
</div>
|
13 |
+
|
app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view/tab/info.phtml
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
<?php
|
4 |
+
$environment = $this->getEnvironmentInfo();
|
5 |
+
$store_configuration = $this->getConfigurationInfo();
|
6 |
+
$row = "even";
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="entry-edit">
|
10 |
+
<div class="entry-edit-head">
|
11 |
+
<h4 class="icon-head"><?php echo Mage::helper('emaildirect')->__('General Configuration') ?></h4>
|
12 |
+
</div>
|
13 |
+
</div>
|
14 |
+
<div class="grid np">
|
15 |
+
<div class="hor-scroll">
|
16 |
+
<table cellspacing="0" class="data ed-config-table">
|
17 |
+
<thead>
|
18 |
+
<tr class="headings">
|
19 |
+
<th>Setting</th>
|
20 |
+
<th>Value</th>
|
21 |
+
</tr>
|
22 |
+
</thead>
|
23 |
+
<?php foreach ($environment as $key => $value): ?>
|
24 |
+
<tbody class="<?php echo $row ?>">
|
25 |
+
<tr class='border'>
|
26 |
+
<td><?php echo $key; ?></td>
|
27 |
+
<td><?php echo $value; ?></td>
|
28 |
+
</tr>
|
29 |
+
</tbody>
|
30 |
+
<?php $row = ($row == 'even' ? 'odd' : 'even'); ?>
|
31 |
+
<?php endforeach; ?>
|
32 |
+
</table>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
<br />
|
36 |
+
<?php foreach ($store_configuration as $code => $configuration): ?>
|
37 |
+
<div class="entry-edit">
|
38 |
+
<div class="entry-edit-head">
|
39 |
+
<h4 class="icon-head">Module Configuration for store: <?php echo $code ?></h4>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
<div class="grid np">
|
43 |
+
<div class="hor-scroll">
|
44 |
+
<table cellspacing="0" class="data ed-config-table">
|
45 |
+
<thead>
|
46 |
+
<tr class="headings">
|
47 |
+
<th>Setting</th>
|
48 |
+
<th>Value</th>
|
49 |
+
</tr>
|
50 |
+
</thead>
|
51 |
+
<?php $row = 'even';
|
52 |
+
foreach ($configuration as $key => $value): ?>
|
53 |
+
<tbody class="<?php echo $row ?>">
|
54 |
+
<tr class='border'>
|
55 |
+
<td><?php echo $key; ?></td>
|
56 |
+
<td><?php echo $value; ?></td>
|
57 |
+
</tr>
|
58 |
+
</tbody>
|
59 |
+
<?php $row = ($row == 'even' ? 'odd' : 'even'); ?>
|
60 |
+
<?php endforeach; ?>
|
61 |
+
</table>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
<br />
|
65 |
+
<?php endforeach; ?>
|
app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view/tab/log.phtml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit entry-logfile">
|
2 |
+
<div class="entry-edit-head">
|
3 |
+
<h4 class="icon-head"><?php echo Mage::helper('emaildirect')->__('EmailDirect Log File') ?></h4>
|
4 |
+
</div>
|
5 |
+
<fieldset>
|
6 |
+
<div>
|
7 |
+
|
8 |
+
<pre><?php echo $this->getLogFile() ?></pre>
|
9 |
+
</div>
|
10 |
+
</fieldset>
|
11 |
+
</div>
|
app/design/adminhtml/default/default/template/emaildirect/troubleshooting/view/tab/submit.phtml
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit">
|
2 |
+
<div class="entry-edit-head">
|
3 |
+
<h4>Send Information to EmailDirect</h4>
|
4 |
+
</div>
|
5 |
+
<div id="_accountbase_fieldset" class="fieldset ">
|
6 |
+
<div class="hor-scroll">
|
7 |
+
<form id='emaildirect_submit_form' action='<?php echo $this->getUrl("emaildirect/admin_troubleshooting/send"); ?>' method='post'>
|
8 |
+
<input type="hidden" name="form_key" value="<? echo $this->getFormKey(); ?>" />
|
9 |
+
<table cellspacing="0" class="form-list">
|
10 |
+
<tbody>
|
11 |
+
<tr>
|
12 |
+
<td class="label"><label for="customer_name">Your Name <span class="required">*</span></label></td>
|
13 |
+
<td class="value">
|
14 |
+
<input type="text" class="required-entry input-text required-entry" value="" name="customer_name" id="customer_name">
|
15 |
+
</td>
|
16 |
+
</tr>
|
17 |
+
<tr>
|
18 |
+
<td class="label"><label for="customer_email">Email <span class="required">*</span></label></td>
|
19 |
+
<td class="value">
|
20 |
+
<input type="text" class="input-text required-entry validate-email" value="" name="customer_email" id="customer_email">
|
21 |
+
</td>
|
22 |
+
</tr>
|
23 |
+
<tr>
|
24 |
+
<td class="label"><label for="customer_company">Company</label></td>
|
25 |
+
<td class="value">
|
26 |
+
<input type="text" class="input-text" value="" name="customer_company" id="customer_company">
|
27 |
+
</td>
|
28 |
+
</tr>
|
29 |
+
<tr>
|
30 |
+
<td class="label"><label for="customer_comments">Problem(s) encountered <span class="required">*</span></label></td>
|
31 |
+
<td class="value">
|
32 |
+
<textarea name='customer_comments' id='customer_comments' class='required-entry'></textarea>
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
<tr>
|
36 |
+
<td class="label"></td>
|
37 |
+
<td class="value">
|
38 |
+
<input type="checkbox" value="off" name="turn_off" id="turn_off">
|
39 |
+
<label for="turn_off">Turn off Troubleshooting after sending?</label>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
+
<tr>
|
43 |
+
<td class="label"></td>
|
44 |
+
<td class="value">
|
45 |
+
<button>Send to EmailDirect</button>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
</tbody>
|
49 |
+
</table>
|
50 |
+
</form>
|
51 |
+
<script type="text/javascript">
|
52 |
+
var ed_form = new varienForm('emaildirect_submit_form' );
|
53 |
+
</script>
|
54 |
+
</div>
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
|
app/design/frontend/base/default/layout/emaildirect.xml
CHANGED
@@ -7,14 +7,6 @@
|
|
7 |
</reference>
|
8 |
</checkout_onepage_review>
|
9 |
|
10 |
-
<emaildirect_email_order_items>
|
11 |
-
<block type="emaildirect/email_order_items" name="items" template="emaildirect/email/order/items.phtml">
|
12 |
-
<action method="addItemRender"><type>default</type><block>emaildirect/email_order_items_order_default</block><template>emaildirect/email/order/items/order/default.phtml</template></action>
|
13 |
-
<action method="addItemRender"><type>grouped</type><block>emaildirect/email_order_items_order_grouped</block><template>emaildirect/email/order/items/order/default.phtml</template></action>
|
14 |
-
</block>
|
15 |
-
<block type="core/text_list" name="additional.product.info" />
|
16 |
-
</emaildirect_email_order_items>
|
17 |
-
|
18 |
<!-- Customer -->
|
19 |
<customer_account>
|
20 |
<reference name="head">
|
@@ -28,31 +20,25 @@
|
|
28 |
</action>
|
29 |
</reference>
|
30 |
</customer_account>
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
</
|
40 |
</reference>
|
41 |
-
|
42 |
|
43 |
<emaildirect_customer_account_index>
|
44 |
<label>Customer My Account Emaildirect</label>
|
45 |
<update handle="customer_account"/>
|
46 |
-
<!--reference name="head">
|
47 |
-
<action method="addCss"><stylesheet>magemonkey/magemonkey.css</stylesheet></action>
|
48 |
-
</reference-->
|
49 |
<reference name="my.account.wrapper">
|
50 |
<block type="emaildirect/customer_account_lists" name="emaildirect_additionallists" template="emaildirect/customer/account/lists.phtml" />
|
51 |
<block type="customer/account_dashboard" name="customer.account.link.back" template="customer/account/link/back.phtml"/>
|
52 |
</reference>
|
53 |
</emaildirect_customer_account_index>
|
54 |
<!-- Customer -->
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
</layout>
|
7 |
</reference>
|
8 |
</checkout_onepage_review>
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
<!-- Customer -->
|
11 |
<customer_account>
|
12 |
<reference name="head">
|
20 |
</action>
|
21 |
</reference>
|
22 |
</customer_account>
|
23 |
+
<customer_account_index>
|
24 |
+
<reference name="my.account.wrapper">
|
25 |
+
<reference name="customer_account_dashboard">
|
26 |
+
<block type="emaildirect/customer_account_dashboard_info" name="emaildirect.customer_account_dashboard_info" as="info" template="customer/account/dashboard/info.phtml">
|
27 |
+
<action method="setTemplate" ifconfig="emaildirect/general/active">
|
28 |
+
<template>emaildirect/customer/account/dashboard/info.phtml</template>
|
29 |
+
</action>
|
30 |
+
</block>
|
31 |
+
</reference>
|
32 |
</reference>
|
33 |
+
</customer_account_index>
|
34 |
|
35 |
<emaildirect_customer_account_index>
|
36 |
<label>Customer My Account Emaildirect</label>
|
37 |
<update handle="customer_account"/>
|
|
|
|
|
|
|
38 |
<reference name="my.account.wrapper">
|
39 |
<block type="emaildirect/customer_account_lists" name="emaildirect_additionallists" template="emaildirect/customer/account/lists.phtml" />
|
40 |
<block type="customer/account_dashboard" name="customer.account.link.back" template="customer/account/link/back.phtml"/>
|
41 |
</reference>
|
42 |
</emaildirect_customer_account_index>
|
43 |
<!-- Customer -->
|
44 |
+
</layout>
|
|
|
|
|
|
app/design/frontend/base/default/template/emaildirect/boxes/additionalNewsletter.phtml
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php echo "toy aca"; ?>
|
2 |
-
<?php if($this->isEmailDirectEnabled($this->getCustomer()->getStoreId())): ?>
|
3 |
-
<?php if($this->getSubscribedAdditionalLists()): ?>
|
4 |
-
<div class="box-title">
|
5 |
-
<h3><?php echo $this->__('Additional Newsletters Lists') ?></h3>
|
6 |
-
</div>
|
7 |
-
<div class="box-content">
|
8 |
-
<?php foreach ($this->getSubscribedAdditionalLists() as $_list): ?>
|
9 |
-
<?php if($_list->getIsSubscribed()): ?>
|
10 |
-
<p style="margin-bottom:0px;"><?php echo $this->htmlEscape($_list->getName()) ?></p>
|
11 |
-
<?php endif; ?>
|
12 |
-
<?php endforeach;?>
|
13 |
-
</div>
|
14 |
-
<?php endif;?>
|
15 |
-
<img alt="Powered By EmailDirect" src="<?php echo $this->getSkinUrl('emaildirect/images/mailchimp_tile.png') ?>" style="float:right;"/>
|
16 |
-
<?php endif;?>
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/emaildirect/boxes/additionalNewsletterBox.phtml
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php $store = $this->getCustomer()->getStoreId();?>
|
2 |
-
<?php if($this->isMailChimpProEnabled($store)): ?>
|
3 |
-
<?php if($this->getAdditionalLists($store)): ?>
|
4 |
-
<div class="subscribed-additional">
|
5 |
-
<form action="<?php echo $this->getFormMultiActionUrl() ?>" method="post" id="form-validate">
|
6 |
-
<input type="hidden" name="additional" id="additional" value="1" />
|
7 |
-
<?php echo $this->getBlockHtml('formkey')?>
|
8 |
-
<div class="page-title">
|
9 |
-
<h1><?php echo $this->__('Additional Newsletters Lists') ?></h1>
|
10 |
-
</div>
|
11 |
-
<fieldset id="additionalFieldset">
|
12 |
-
<ul class="form-list">
|
13 |
-
<?php foreach ($this->getAdditionalLists($store) as $_list): ?>
|
14 |
-
<li class="control">
|
15 |
-
<?php $inputId = 'list['.$_list->getListId().']'; ?>
|
16 |
-
<?php $fieldsetId = 'additionalFieldset'.$_list->getListId() ;?>
|
17 |
-
<input onclick="unCheckGroups('<?php echo $fieldsetId; ?>')" type="checkbox" value="<?php echo $_list->getIsSubscribed()?>" <?php if($_list->getIsSubscribed()) echo 'checked="checked"'; ?> name="<?php echo $inputId; ?>" id="<?php echo $inputId; ?>" title="<?php echo $this->__('Is Subscribed') ?>" class="checkbox" />
|
18 |
-
<label for="subscription"><?php echo $this->htmlEscape($_list->getName()) ?></label>
|
19 |
-
<?php if($this->getGroups($_list->getListId(),null)): ?>
|
20 |
-
<fieldset id="<?php echo $fieldsetId; ?>">
|
21 |
-
<?php echo $this->getGroupInputs($_list->getListId(),$this->getCustomer()->getStoreId(),true); ?>
|
22 |
-
</fieldset>
|
23 |
-
<?php endif; ?>
|
24 |
-
</li>
|
25 |
-
<?php endforeach; ?>
|
26 |
-
</ul>
|
27 |
-
<div class="buttons-set">
|
28 |
-
<?php /*<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>« </small><?php echo $this->__('Back') ?></a></p>*/ ?>
|
29 |
-
<button type="submit" title="<?php echo $this->__('Update Additional Lists') ?>" class="form-button right" ><span><span><?php echo $this->__('Update Additional Lists') ?></span></span></button>
|
30 |
-
</div>
|
31 |
-
<img alt="Powered By MailChimp" src="<?php echo $this->getSkinUrl('mailchimppro/images/mailchimp_tile.gif') ?>" class="poweredByMailchimp"/>
|
32 |
-
</fieldset>
|
33 |
-
</form>
|
34 |
-
</div>
|
35 |
-
<?php endif;?>
|
36 |
-
<?php endif;?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/emaildirect/boxes/generalNewsletter.phtml
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
|
2 |
-
<?php $store = $this->getCustomer()->getStoreId();?>
|
3 |
-
|
4 |
-
<?php if($this->isEmailDirectEnabled($store)): ?>
|
5 |
-
|
6 |
-
<input type="hidden" name="is_general" id="is_general" value="1" />
|
7 |
-
|
8 |
-
<?php if($this->getGroups(null,$store)): ?>
|
9 |
-
<fieldset id="generalFieldset" >
|
10 |
-
<?php echo $this->getGroupInputs(null,$store,false); ?>
|
11 |
-
<script type="text/javascript">
|
12 |
-
var id = ($('subscription'))? $('subscription'): $('is_subscribed');
|
13 |
-
Mailchimppro.general.initialize(id,'generalFieldset');
|
14 |
-
</script>
|
15 |
-
</fieldset>
|
16 |
-
<?php endif; ?>
|
17 |
-
|
18 |
-
<?php if($this->isForcedToRegisterSubscribe()): ?>
|
19 |
-
<script type="text/javascript">
|
20 |
-
Mailchimppro.general.hide('is_subscribed');
|
21 |
-
</script>
|
22 |
-
<?php endif; ?>
|
23 |
-
|
24 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/emaildirect/boxes/generalNewsletterBox.phtml
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
|
2 |
-
<?php if($this->canShowSmallBox()): ?>
|
3 |
-
<div class="block block-subscribe">
|
4 |
-
<div class="block-title">
|
5 |
-
<strong><span><?php echo $this->__('Newsletter') ?></span></strong>
|
6 |
-
</div>
|
7 |
-
<form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail">
|
8 |
-
<?php echo $this->getBlockHtml('formkey')?>
|
9 |
-
<div class="block-content">
|
10 |
-
<label for="newsletter"><?php echo $this->__('Sign Up for Our Newsletter:') ?></label>
|
11 |
-
<div class="input-box">
|
12 |
-
<?php $customModel = Mage::getSingleton('customer/session'); ?>
|
13 |
-
<?php if($customModel->isLoggedIn()): ?>
|
14 |
-
<input type="hidden" name="email" id="newsletter" value="<?php echo $customModel->getCustomer()->getEmail();?>"/>
|
15 |
-
<input type="checkbox" name="is_subscribed" id="subscription" value="1" title="<?php echo $this->__('General Subscription') ?>"<?php if($this->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="subscription"><?php echo $this->__('General Subscription') ?></label>
|
16 |
-
<?php else: ?>
|
17 |
-
<input type="text" name="email" id="newsletter" title="<?php echo $this->__('Sign up for our newsletter') ?>" class="input-text required-entry validate-email" />
|
18 |
-
<input type="hidden" name="is_subscribed" id="is_subscribed" value="1" />
|
19 |
-
<?php endif; ?>
|
20 |
-
</div>
|
21 |
-
<?php echo $this->getChildHtml('generalNewsletter') ?>
|
22 |
-
<div class="actions">
|
23 |
-
<button type="submit" title="<?php echo $this->__('Subscribe') ?>" class="button"><span><span><?php echo $this->__('Subscribe') ?></span></span></button>
|
24 |
-
<img alt="Powered By MailChimp" src="<?php echo $this->getSkinUrl('mailchimppro/images/mailchimp_tile.gif') ?>" style="float:right;"/>
|
25 |
-
</div>
|
26 |
-
</div>
|
27 |
-
</form>
|
28 |
-
<script type="text/javascript">
|
29 |
-
//<![CDATA[
|
30 |
-
var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
|
31 |
-
//]]>
|
32 |
-
</script>
|
33 |
-
</div>
|
34 |
-
<?php endif;?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/emaildirect/boxes/generalNewsletterMediumBox.phtml
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
|
2 |
-
<?php if($this->canShowMediumBox() && !$this->isForcedToSubscribeCheckout()): ?>
|
3 |
-
<div class="block block-subscribe">
|
4 |
-
<div class="block-title">
|
5 |
-
<strong><span><?php echo $this->__('Newsletter') ?></span></strong>
|
6 |
-
</div>
|
7 |
-
<div class="block-content">
|
8 |
-
<label for="newsletter"><?php echo $this->__('Sign Up for Our Newsletter:') ?></label>
|
9 |
-
<br/>
|
10 |
-
<ul class="form-list">
|
11 |
-
<li class="control">
|
12 |
-
<input type="checkbox" name="is_subscribed" id="subscription" value="1" title="<?php echo $this->__('General Subscription') ?>"<?php if($this->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
|
13 |
-
<label for="subscription"><?php echo $this->__('General Subscription') ?></label>
|
14 |
-
</li>
|
15 |
-
<?php echo $this->getChildHtml('generalNewsletter'); ?>
|
16 |
-
</ul>
|
17 |
-
<div class="actions">
|
18 |
-
<img alt="Powered By MailChimp" src="<?php echo $this->getSkinUrl('mailchimppro/images/mailchimp_tile.gif') ?>" style="float:right;"/>
|
19 |
-
</div>
|
20 |
-
</div>
|
21 |
-
</div>
|
22 |
-
<?php endif;?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/emaildirect/checkout/subscribe.phtml
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
$auto = (($check === 1) OR ($check === 3));
|
4 |
?>
|
5 |
<script type="text/javascript">
|
6 |
-
addSubscribeToPost = function (element)
|
|
|
7 |
|
8 |
if( $('emaildirect-subscribe') ){
|
9 |
$('emaildirect-subscribe').remove();
|
3 |
$auto = (($check === 1) OR ($check === 3));
|
4 |
?>
|
5 |
<script type="text/javascript">
|
6 |
+
addSubscribeToPost = function (element)
|
7 |
+
{
|
8 |
|
9 |
if( $('emaildirect-subscribe') ){
|
10 |
$('emaildirect-subscribe').remove();
|
app/design/frontend/base/default/template/emaildirect/customer/account/dashboard/info.phtml
CHANGED
@@ -22,13 +22,31 @@
|
|
22 |
<a href="<?php echo $this->getUrl('newsletter/manage') ?>"><?php echo $this->__('Edit') ?></a>
|
23 |
</div>
|
24 |
<div class="box-content">
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
</div>
|
33 |
</div>
|
34 |
</div>
|
22 |
<a href="<?php echo $this->getUrl('newsletter/manage') ?>"><?php echo $this->__('Edit') ?></a>
|
23 |
</div>
|
24 |
<div class="box-content">
|
25 |
+
|
26 |
+
<?php $subscriptions = $this->getSubscriptions();
|
27 |
+
|
28 |
+
if ($subscriptions['count'] > 0)
|
29 |
+
{
|
30 |
+
echo "<p>You are currently subscribed to: <br />" . $subscriptions['publication']['name'] . "</p>";
|
31 |
+
|
32 |
+
if ($subscriptions['list_count'] > 0)
|
33 |
+
{
|
34 |
+
echo "<strong>Interests:</strong>";
|
35 |
+
echo "<ul>";
|
36 |
+
foreach ($subscriptions['lists'] as $list)
|
37 |
+
{
|
38 |
+
echo "<li>{$list['name']}</li>";
|
39 |
+
}
|
40 |
+
echo "</ul>";
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
}
|
45 |
+
else
|
46 |
+
echo "<p>" . $this->__('You are currently not subscribed to any newsletter.') . "</p>";
|
47 |
+
|
48 |
+
?>
|
49 |
+
|
50 |
</div>
|
51 |
</div>
|
52 |
</div>
|
app/design/frontend/base/default/template/emaildirect/customer/account/lists.phtml
CHANGED
@@ -1,65 +1,63 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
$
|
4 |
-
$
|
5 |
-
$
|
6 |
|
7 |
?>
|
8 |
<div class="page-title">
|
9 |
-
|
10 |
</div>
|
|
|
11 |
<form action="<?php echo $this->getUrl('emaildirect/customer_account/saveadditional'); ?>" name="emaildirect_additional" id="emaildirect-additional" method="post">
|
12 |
<div class="fieldset">
|
13 |
<?php echo $this->getBlockHtml('formkey'); ?>
|
14 |
<ul class="emaildirect-additional-lists">
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
<li class="listdata"><?php echo $this->listLabel($generalList,$list); ?>
|
25 |
</li>
|
26 |
-
|
27 |
<?php endforeach; ?>
|
28 |
-
<!-- Additional Lists -->
|
29 |
-
|
30 |
</ul>
|
|
|
31 |
</div>
|
32 |
<input type="hidden" name="state" value="" id="form-state" />
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
</form>
|
37 |
<script type="text/javascript">
|
38 |
-
document.observe("dom:loaded", function()
|
|
|
39 |
removeManageNewsletter();
|
40 |
-
$$('.emaildirect-publication-subscriber').first().observe('change', function()
|
|
|
41 |
var groupings = $$('.emaildirect-list-subscriber');
|
42 |
|
43 |
-
if(groupings)
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}.bind(this));
|
52 |
-
}else{
|
53 |
-
groupings.each(function(index, item){
|
54 |
-
if(this.value != index.value){
|
55 |
-
index.writeAttribute('disabled', 'disabled');
|
56 |
-
}
|
57 |
-
|
58 |
-
}.bind(this));
|
59 |
}
|
60 |
}
|
61 |
-
});
|
62 |
$('form-state').writeAttribute('value', $('emaildirect-additional').serialize());
|
63 |
-
|
64 |
});
|
65 |
</script>
|
1 |
<?php
|
2 |
|
3 |
+
$subscriptions = $this->getSubscriptions();
|
4 |
+
$publication_data = $subscriptions['publication'];
|
5 |
+
$list_data = $subscriptions['lists'];
|
6 |
|
7 |
?>
|
8 |
<div class="page-title">
|
9 |
+
<h1><?php echo $this->__('Newsletter Subscription'); ?></h1>
|
10 |
</div>
|
11 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
12 |
<form action="<?php echo $this->getUrl('emaildirect/customer_account/saveadditional'); ?>" name="emaildirect_additional" id="emaildirect-additional" method="post">
|
13 |
<div class="fieldset">
|
14 |
<?php echo $this->getBlockHtml('formkey'); ?>
|
15 |
<ul class="emaildirect-additional-lists">
|
16 |
+
<li class="listdata">General Subscription: <?php echo $this->showCheckbox($publication_data, 'publication'); ?>
|
17 |
+
</ul>
|
18 |
+
<br />
|
19 |
+
<?php if (count($list_data) > 0): ?>
|
20 |
+
<strong>Interests:</strong>
|
21 |
+
<ul class="emaildirect-additional-lists">
|
22 |
+
<?php foreach($list_data as $list): ?>
|
23 |
+
<li class="listdata">
|
24 |
+
<?php echo $this->showCheckbox($list); ?>
|
|
|
25 |
</li>
|
|
|
26 |
<?php endforeach; ?>
|
|
|
|
|
27 |
</ul>
|
28 |
+
<?php endif; ?>
|
29 |
</div>
|
30 |
<input type="hidden" name="state" value="" id="form-state" />
|
31 |
+
<div class="buttons-set">
|
32 |
+
<button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
|
33 |
+
</div>
|
34 |
</form>
|
35 |
<script type="text/javascript">
|
36 |
+
document.observe("dom:loaded", function()
|
37 |
+
{
|
38 |
removeManageNewsletter();
|
39 |
+
$$('.emaildirect-publication-subscriber').first().observe('change', function()
|
40 |
+
{
|
41 |
var groupings = $$('.emaildirect-list-subscriber');
|
42 |
|
43 |
+
if(groupings)
|
44 |
+
{
|
45 |
+
if(this.checked)
|
46 |
+
{
|
47 |
+
groupings.each(function(index, item)
|
48 |
+
{
|
49 |
+
index.removeAttribute('disabled');
|
50 |
+
}.bind(this));
|
51 |
+
}
|
52 |
+
else
|
53 |
+
{
|
54 |
+
groupings.each(function(index, item)
|
55 |
+
{
|
56 |
+
index.writeAttribute('disabled', 'disabled');
|
57 |
}.bind(this));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
}
|
60 |
+
});
|
61 |
$('form-state').writeAttribute('value', $('emaildirect-additional').serialize());
|
|
|
62 |
});
|
63 |
</script>
|
package.xml
CHANGED
@@ -1,18 +1,31 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>EmailDirect_Integration</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>EmailDirect integration for magento</summary>
|
10 |
<description>EmailDirect integration for magento</description>
|
11 |
-
<notes>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
<authors><author><name>Kevin Linden</name><user>auto-converted</user><email>Kevin@EmailDirect.com</email></author></authors>
|
13 |
-
<date>2013-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="EmailDirect"><dir name="Integration"><dir name="Block"><dir name="Adminhtml"><dir name="Abandoned"><file name="Grid.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>EmailDirect_Integration</name>
|
4 |
+
<version>1.5.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>EmailDirect integration for magento</summary>
|
10 |
<description>EmailDirect integration for magento</description>
|
11 |
+
<notes>Release Notes:
|
12 |
+
- Currency Symbol added to Cost Fields
|
13 |
+
- Troubleshooting system implemented
|
14 |
+
- Customer Account Dashboard Improvements
|
15 |
+
- Subscribe/Unsubscribe to Newsletter and Interests (Lists)
|
16 |
+
- Bug Fixes
|
17 |
+
- Bad API Key fix
|
18 |
+
- Multi-store Support Improved
|
19 |
+
- Separate API keys per Store
|
20 |
+
- Abandoned Cart process runs per Store
|
21 |
+
- Improved support for Disabling of Module
|
22 |
+
- Disabling module stops calls to API and turns off custom blocks on front end
|
23 |
+
- Disable module per store
|
24 |
+
- Tested on Enterprise 1.13</notes>
|
25 |
<authors><author><name>Kevin Linden</name><user>auto-converted</user><email>Kevin@EmailDirect.com</email></author></authors>
|
26 |
+
<date>2013-06-09</date>
|
27 |
+
<time>01:24:35</time>
|
28 |
+
<contents><target name="magelocal"><dir name="EmailDirect"><dir name="Integration"><dir name="Block"><dir name="Adminhtml"><dir name="Abandoned"><file name="Grid.php" hash="193034247dab3a6c367c980b21032ebc"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="7649b64cf2319484207c5179df7b4e9f"/></dir><dir name="Form"><dir name="Field"><file name="Addressmapfields.php" hash="2e8456508018770ac0a41b7cdbb8616f"/><file name="Button.php" hash="ca555e93c55812795d2504ee6de13f3a"/><file name="Common.php" hash="98d9d69a46e88033eb308f8cd0a0fca7"/><file name="Mapfields.php" hash="82d6fe522f46880685ab047ee67b839f"/><file name="Shippingmapfields.php" hash="9e464ed63d0315ef0f534d036517ceb6"/><file name="Troubleshooting.php" hash="fe89a76362a109ab778796d58040386e"/></dir></dir><file name="Account.php" hash="60fa8e43a87e1f2ff71c319c979556b2"/></dir><dir name="Convert"><dir name="Profile"><file name="Export.php" hash="95956414af4ec5b400244b246b8f1cf9"/></dir></dir></dir><dir name="Troubleshooting"><dir name="View"><dir name="Tab"><file name="Download.php" hash="9315a364a46f9e39972bbd0a47152e90"/><file name="Info.php" hash="6714b756a3fa7a5812356e544fe48f1b"/><file name="Log.php" hash="7c3661722d1197cd8a564f76275353c7"/><file name="Submit.php" hash="8831d886858fde08a4323eea66ec76d2"/></dir><file name="Form.php" hash="e527a3a2335b109c48a69f06c1b0d01f"/></dir><file name="Tabs.php" hash="ab1fdbe561e8572c2c50cdbec9573f82"/><file name="View.php" hash="1693280ace7a4a5f2c537644b646a452"/></dir><file name="Abandoned.php" hash="9d69cb3b2d561a97d0df0b456aa8f7b5"/><file name="Troubleshooting.php" hash="e6bc8a637c05d17bd98384d1df331b48"/></dir><dir name="Checkout"><file name="Subscribe.php" hash="ae325e815a54bde93507562cf0d86b8a"/></dir><dir name="Customer"><dir name="Account"><dir name="Dashboard"><file name="Info.php" hash="0d56c53c7c98046c435a2b87621c3e3b"/></dir><file name="Lists.php" hash="e56926d8681b4dacd5ecf8d0ccc31fc7"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="AbandonedMinutes.php" hash="22e33be85dc8348fce9b49637ead919d"/><file name="Action.php" hash="b85ef0454ab5c65ef0c43c7ef057ecc2"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5651ea1611cde7c85bde0b4cfa0be807"/><file name="Fields.php" hash="d1728e9d1ee85ba45c6e9c1ad4618d3a"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Export"><file name="Batch.php" hash="fd2fcedc80472895b2081e21af8fa7f5"/></dir><file name="Abandoned.php" hash="d4985049dbd47d79a9d8f3361528bc87"/><file name="Abandonedlist.php" hash="a5d3b987ea2a2d8672c9c2c3473c24e2"/><file name="Additionallist.php" hash="1fcede7a1efe84ce13104194f3dc9962"/><file name="Checkoutsubscribe.php" hash="fd90252a1f19649a420dae136ad2a2ba"/><file name="List.php" hash="00611b9215b54e86171a8e4a9a5e54db"/><file name="Maxtimes.php" hash="465ffb2acf45adf594b6e8c720dd23dc"/><file name="Publication.php" hash="903657f0b2a911af97f8bccb6d9cffab"/><file name="Source.php" hash="fb706f2418208b2a8f7a29a6050e815d"/><file name="Time.php" hash="0e26839880e25ec0eedce1ce8a663c0f"/></dir></dir></dir><dir name="Wrapper"><file name="Abandoned.php" hash="f33d3ef289c147ce572bcafdce47665c"/><file name="Abstract.php" hash="90935a39addc872b82639ae97855c894"/><file name="Database.php" hash="3cceb467358d13584baff58c043762ec"/><file name="Execute.php" hash="4e8cf3590be46182ca282f0cc16a8756"/><file name="Ftp.php" hash="d5335cfb68f99761d6902dd390a3d7a8"/><file name="Lists.php" hash="07436322d71a6065e75b3fcb902a5952"/><file name="Orders.php" hash="0c5f01418fa2f0fabc8bed26b4434704"/><file name="Publications.php" hash="72ccdc495868308d9831cbf01ddea3b0"/><file name="Sources.php" hash="c67d1e8877e7f3ce907090d8fb7d4f00"/><file name="Subscribers.php" hash="c3093bd2f86fdc3a7e4b2a2d4beadd2b"/></dir><file name="Observer.php" hash="5aa6f7d15e858bdf7889b37b143acf1a"/></dir><dir name="controllers"><dir name="Admin"><file name="AbandonedController.php" hash="e0345fe3a43f469ec53e992a24c70fb9"/><file name="ExportController.php" hash="d23ab90df4910a7ae4f9c5c491e8fd33"/><file name="TroubleshootingController.php" hash="7a4939b33d875417f19429614d8896ae"/></dir><dir name="Customer"><file name="AccountController.php" hash="16bfdb6de4804a5d71cb972afbff4537"/></dir><file name="AbandonedController.php" hash="12d8655ed118d280320e5457f4933881"/></dir><dir name="etc"><file name="adminhtml.xml" hash="896c10d8a3f932346e7d301052b1b6a6"/><file name="config.xml" hash="8efc48e5f7d62906d56dc44274558f9b"/><file name="system.xml" hash="fb3e4ced708718df052a9e429bbfa8ed"/></dir><dir name="sql"><dir name="emaildirect_setup"><file name="mysql4-install-1.0.0.php" hash="9dc51edb346e9676735e15d3e78fa3eb"/><file name="mysql4-upgrade-1.0.13-1.0.14.php" hash="c42e2677b3960a049d7137b622552084"/><file name="mysql4-upgrade-1.0.19-1.2.0.php" hash="742be042b7f56e7ff2002b0606270ca6"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="emaildirect"><file name="emaildirect-connected-ebizmarts-title.png" hash="faf3858f23eafe3a89cce144fef6bd2a"/><file name="emaildirect-section-background.png" hash="c205ce454fe63280d7d7dd74428b7ea4"/><file name="emaildirect-tab.png" hash="9ddb077b74a7078ac509d79b024631a1"/><file name="emaildirect.css" hash="016ecc627aa3e7e971d53ec73d52858e"/><file name="emaildirect.js" hash="ce03dd6f51ea529fc4acdc5116f4e030"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="emaildirect"><dir name="images"><file name="bkg_block-title.gif" hash="f8c1f130ad69464fe7aff2f589b2ec75"/><file name="dotted_divider.gif" hash="260ebae91ffb1b7c663906b29a069925"/><file name="emaildirect-tile.png" hash="86a0ed36169ab9691480fc995ab674a8"/><file name="i_block-subscribe.gif" hash="9e5fee06a543742045118a95f2debcb8"/></dir><file name="integration.js" hash="d8c8d5bf0ddb4f6ead23bec8a2814475"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="emaildirect.xml" hash="91d689f9f169c4b1e5c59cf19aa89301"/></dir><dir name="template"><dir name="emaildirect"><dir name="abandoned"><file name="grid.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="4d7607ecb15d13cfe8bb0cc889cb724f"/></dir><dir name="form"><dir name="field"><file name="array.phtml" hash="d6af9f840f4dda9c73d106e167ec1bc6"/><file name="button.phtml" hash="ad2811d37509d0919d3b41ecad1f37df"/><file name="trouble.phtml" hash="2d83e8be9aa43e2330bce9fa84435fac"/></dir></dir></dir><dir name="convert"><dir name="profile"><file name="export.phtml" hash="86339d17e83bd8dcc2a268b3ace3d9e7"/></dir></dir></dir><dir name="troubleshooting"><dir name="view"><dir name="tab"><file name="download.phtml" hash="78ec34fd9c3c8b660b19f9e799d8e76e"/><file name="info.phtml" hash="547b1e906ed142983d1034e05f6251bd"/><file name="log.phtml" hash="c9e2c9493a2dad579bba4ed53795cf5e"/><file name="submit.phtml" hash="c2269f4a6a52d66bff5eac660d0831bd"/></dir><file name="form.phtml" hash="d2338bfe3598e9315ca8f5ac8d9b5516"/></dir><file name="view.phtml" hash="ee6af3fe79d916af764f41e7e8c5cc37"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="emaildirect.xml" hash="578a3bd30d7ccba863a6f22027108647"/></dir><dir name="template"><dir name="emaildirect"><dir name="checkout"><file name="subscribe.phtml" hash="351ea790305f0a3ec99c34180bbee235"/></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="4256a03d67ec2a6f97867a87564cff92"/></dir><file name="lists.phtml" hash="4c697dcfa63ece1db7885cadb02982d1"/></dir></dir><dir name="email"><dir name="order"><dir name="items"><dir name="order"><file name="default.phtml" hash="2d65f3d02b9baa08969d68f2a2cca348"/></dir></dir><file name="items.phtml" hash="e6b15e6460010c5acae66017d177bfb9"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="newsletter_subscr_success_emaildirect.html" hash="f6afb69d207bbc3f8920e7a72ac9dd07"/><file name="newsletter_unsub_success_emaildirect.html" hash="bd9f97e8f5485180d4420097b5200ef4"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EmailDirect_Integration.xml" hash="2d2666e6d9cd8d40a4974d5e242721d6"/></dir></target></contents>
|
29 |
<compatible/>
|
30 |
<dependencies/>
|
31 |
</package>
|
skin/adminhtml/default/default/emaildirect/emaildirect.css
CHANGED
@@ -32,4 +32,25 @@ div.emaildirect-notice h4 div.abandoned
|
|
32 |
}
|
33 |
|
34 |
.ab_ok { color: green; }
|
35 |
-
.ab_ng { color: red; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
.ab_ok { color: green; }
|
35 |
+
.ab_ng { color: red; }
|
36 |
+
|
37 |
+
#emaildirect_trouble { float: right; }
|
38 |
+
#emaildirect_trouble_details { margin-top: 10px; }
|
39 |
+
#emaildirect_trouble_details table { margin-bottom: 10px; width: 100%; border-collapse: collapse;}
|
40 |
+
#emaildirect_trouble_details table tr td { border: solid 1px; padding: 2px; }
|
41 |
+
#emaildirect_trouble_details table tr td:first-child{ width: 80px; }
|
42 |
+
#emaildirect_trouble_details ul { list-style: disc outside none; margin-left: 14px;}
|
43 |
+
|
44 |
+
#log_file_contents { width: 796px; height: 396px; overflow:scroll; border:solid 1px; padding: 2px;}
|
45 |
+
#config_details { }
|
46 |
+
#config_details table { width: 100%; border-collapse: collapse;}
|
47 |
+
.ed-config-table tr td:first-child { width: 180px; }
|
48 |
+
|
49 |
+
.entry-logfile { overflow: scroll; height: 600px;}
|
50 |
+
|
51 |
+
.grid .ed-config-subtable tr.headings {
|
52 |
+
background: url("../images/sort_row_bg.gif") repeat-x scroll 0 50% transparent !important;
|
53 |
+
}
|
54 |
+
|
55 |
+
.log_note { color: red; padding: 5px 0;}
|
56 |
+
.log_size_warning { color: red;}
|