Version Notes
Updated abandoned cart process with working status, last run times and grid to manually view/resend records to your EmailDirect account.
Download this release
Release Info
Developer | Magento Core Team |
Extension | EmailDirect_Integration |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.9 to 1.3.0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Abandoned.php +24 -0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/Abandoned/Grid.php +250 -0
- app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Fieldset/Hint.php +10 -1
- app/code/local/EmailDirect/Integration/Block/Widget/Grid/Column/Renderer/AbandonedMinutes.php +28 -0
- app/code/local/EmailDirect/Integration/Block/Widget/Grid/Column/Renderer/Action.php +33 -0
- app/code/local/EmailDirect/Integration/Helper/Data.php +37 -0
- app/code/local/EmailDirect/Integration/Helper/Fields.php +165 -0
- app/code/local/EmailDirect/Integration/Model/Observer.php +122 -162
- app/code/local/EmailDirect/Integration/controllers/AbandonedController.php +1 -28
- app/code/local/EmailDirect/Integration/controllers/Admin/AbandonedController.php +68 -0
- app/code/local/EmailDirect/Integration/etc/config.xml +39 -1
- app/code/local/EmailDirect/Integration/sql/emaildirect_setup/mysql4-install-1.0.0.php +10 -3
- app/code/local/EmailDirect/Integration/sql/emaildirect_setup/mysql4-upgrade-1.0.13-1.0.14.php +7 -0
- app/code/local/EmailDirect/Integration/sql/emaildirect_setup/mysql4-upgrade-1.0.19-1.2.0.php +10 -4
- app/design/adminhtml/default/default/layout/emaildirect.xml +11 -0
- app/design/adminhtml/default/default/template/emaildirect/abandoned/grid.phtml +0 -0
- app/design/adminhtml/default/default/template/emaildirect/system/config/fieldset/hint.phtml +4 -5
- app/design/adminhtml/default/default/template/emaildirect/system/config/form/field/button.phtml +2 -2
- package.xml +5 -5
- skin/adminhtml/default/default/emaildirect/emaildirect.css +15 -2
app/code/local/EmailDirect/Integration/Block/Adminhtml/Abandoned.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Emaildirect_Integration_Block_Adminhtml_Abandoned extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
|
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 |
+
}
|
21 |
+
else
|
22 |
+
$this->_headerText = "Abandoned Carts - <span class='ab_ng'>Disabled</span>";
|
23 |
+
}
|
24 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/Abandoned/Grid.php
ADDED
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminhtml_Block_Report_Grid_Shopcart
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('abandonedGrid');
|
10 |
+
$this->setUseAjax(true);
|
11 |
+
$this->setDefaultSort('updated_at');
|
12 |
+
$this->setSaveParametersInSession(true);
|
13 |
+
$this->setPagerVisibility(true);
|
14 |
+
$this->setTemplate('widget/grid.phtml');
|
15 |
+
$this->setRowClickCallback('openGridRow');
|
16 |
+
}
|
17 |
+
|
18 |
+
private function prepareForAbandonedReport($storeIds, $filter = null)
|
19 |
+
{
|
20 |
+
$collection = $this->getCollection();
|
21 |
+
|
22 |
+
$collection->addFieldToFilter('items_count', array('neq' => '0'))
|
23 |
+
->addFieldToFilter('main_table.is_active', '1')
|
24 |
+
->addSubtotal($storeIds, $filter)
|
25 |
+
->addFieldToFilter('customer_email',array('notnull'=>1))
|
26 |
+
->setOrder('updated_at');
|
27 |
+
if (is_array($storeIds) && !empty($storeIds))
|
28 |
+
{
|
29 |
+
$collection->addFieldToFilter('store_id', array('in' => $storeIds));
|
30 |
+
}
|
31 |
+
|
32 |
+
return $this;
|
33 |
+
}
|
34 |
+
|
35 |
+
protected function _prepareCollection()
|
36 |
+
{
|
37 |
+
/** @var $collection Mage_Reports_Model_Resource_Quote_Collection */
|
38 |
+
$collection = Mage::getResourceModel('reports/quote_collection');
|
39 |
+
|
40 |
+
$filter = $this->getParam($this->getVarNameFilter(), array());
|
41 |
+
if ($filter) {
|
42 |
+
$filter = base64_decode($filter);
|
43 |
+
parse_str(urldecode($filter), $data);
|
44 |
+
}
|
45 |
+
|
46 |
+
$this->setCollection($collection);
|
47 |
+
|
48 |
+
if (!empty($data)) {
|
49 |
+
$this->prepareForAbandonedReport($this->_storeIds, $data);
|
50 |
+
} else {
|
51 |
+
$this->prepareForAbandonedReport($this->_storeIds);
|
52 |
+
}
|
53 |
+
|
54 |
+
return parent::_prepareCollection();
|
55 |
+
}
|
56 |
+
|
57 |
+
protected function _addColumnFilterToCollection($column)
|
58 |
+
{
|
59 |
+
$field = ( $column->getFilterIndex() ) ? $column->getFilterIndex() : $column->getIndex();
|
60 |
+
$skip = array('subtotal', 'customer_name'/*, 'email', 'created_at', 'updated_at'*/);
|
61 |
+
|
62 |
+
if (in_array($field, $skip)) {
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
|
66 |
+
parent::_addColumnFilterToCollection($column);
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
+
private function getCustomerGroups($blank = false)
|
71 |
+
{
|
72 |
+
$options = array();
|
73 |
+
|
74 |
+
$groups = Mage::Helper('customer')->getGroups();
|
75 |
+
|
76 |
+
if ($blank)
|
77 |
+
$options[""] = "";
|
78 |
+
|
79 |
+
foreach($groups as $group)
|
80 |
+
{
|
81 |
+
$options[$group->getData('customer_group_id')] = Mage::helper('catalog')->__($group->getData('customer_group_code'));
|
82 |
+
}
|
83 |
+
|
84 |
+
$options[0] = Mage::helper('catalog')->__('NOT LOGGED IN');
|
85 |
+
|
86 |
+
return $options;
|
87 |
+
}
|
88 |
+
|
89 |
+
protected function _prepareColumns()
|
90 |
+
{
|
91 |
+
$this->addColumn('customer_firstname', array(
|
92 |
+
'header' =>Mage::helper('reports')->__('Customer First Name'),
|
93 |
+
'index' =>'customer_firstname'
|
94 |
+
));
|
95 |
+
|
96 |
+
$this->addColumn('customer_lastname', array(
|
97 |
+
'header' =>Mage::helper('reports')->__('Last Name'),
|
98 |
+
'index' =>'customer_lastname'
|
99 |
+
));
|
100 |
+
|
101 |
+
$this->addColumn('email', array(
|
102 |
+
'header' =>Mage::helper('reports')->__('Email'),
|
103 |
+
'index' =>'customer_email'
|
104 |
+
));
|
105 |
+
|
106 |
+
$this->addColumn('customer_group_id', array(
|
107 |
+
'header' => Mage::helper('sales')->__('Customer Group'),
|
108 |
+
'index' => 'customer_group_id',
|
109 |
+
//'filter_index' => 'IFNULL(cust.group_id,0)',
|
110 |
+
'type' => 'options',
|
111 |
+
'width' => 200,
|
112 |
+
'options' => $this->getCustomerGroups()
|
113 |
+
));
|
114 |
+
|
115 |
+
$this->addColumn('items_count', array(
|
116 |
+
'header' =>Mage::helper('reports')->__('Number of Items'),
|
117 |
+
'width' =>'80px',
|
118 |
+
'align' =>'right',
|
119 |
+
'index' =>'items_count',
|
120 |
+
'type' =>'number'
|
121 |
+
));
|
122 |
+
|
123 |
+
$this->addColumn('items_qty', array(
|
124 |
+
'header' =>Mage::helper('reports')->__('Quantity of Items'),
|
125 |
+
'width' =>'80px',
|
126 |
+
'align' =>'right',
|
127 |
+
'index' =>'items_qty',
|
128 |
+
'type' =>'number'
|
129 |
+
));
|
130 |
+
|
131 |
+
if ($this->getRequest()->getParam('website')) {
|
132 |
+
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
133 |
+
} else if ($this->getRequest()->getParam('group')) {
|
134 |
+
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
135 |
+
} else if ($this->getRequest()->getParam('store')) {
|
136 |
+
$storeIds = array((int)$this->getRequest()->getParam('store'));
|
137 |
+
} else {
|
138 |
+
$storeIds = array();
|
139 |
+
}
|
140 |
+
$this->setStoreIds($storeIds);
|
141 |
+
$currencyCode = $this->getCurrentCurrencyCode();
|
142 |
+
|
143 |
+
$this->addColumn('subtotal', array(
|
144 |
+
'header' => Mage::helper('reports')->__('Subtotal'),
|
145 |
+
'width' => '80px',
|
146 |
+
'type' => 'currency',
|
147 |
+
'currency_code' => $currencyCode,
|
148 |
+
'index' => 'subtotal',
|
149 |
+
'renderer' => 'adminhtml/report_grid_column_renderer_currency',
|
150 |
+
'rate' => $this->getRate($currencyCode),
|
151 |
+
));
|
152 |
+
|
153 |
+
$this->addColumn('updated_at', array(
|
154 |
+
'header' =>Mage::helper('reports')->__('Abandoned Date'),
|
155 |
+
'width' =>'170px',
|
156 |
+
'type' =>'datetime',
|
157 |
+
'index' =>'updated_at',
|
158 |
+
'filter_index'=>'main_table.updated_at'
|
159 |
+
));
|
160 |
+
|
161 |
+
$this->addColumn('abandoned_minutes', array(
|
162 |
+
'header' =>Mage::helper('reports')->__('Minutes'),
|
163 |
+
'width' =>'100px',
|
164 |
+
'renderer' => 'EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_AbandonedMinutes',
|
165 |
+
'index' =>'abandoned_minutes',
|
166 |
+
'sortable' => false,
|
167 |
+
'filter' => false,
|
168 |
+
'filter_index'=>'main_table.updated_at'
|
169 |
+
|
170 |
+
));
|
171 |
+
|
172 |
+
$this->addColumn('remote_ip', array(
|
173 |
+
'header' =>Mage::helper('reports')->__('IP Address'),
|
174 |
+
'width' =>'80px',
|
175 |
+
'index' =>'remote_ip'
|
176 |
+
));
|
177 |
+
|
178 |
+
$this->addColumn('emaildirect_abandoned_date', array(
|
179 |
+
'header' =>Mage::helper('reports')->__('Date Sent to EmailDirect'),
|
180 |
+
//'width' =>'80px',
|
181 |
+
'index' =>'emaildirect_abandoned_date',
|
182 |
+
'type' => 'datetime',
|
183 |
+
|
184 |
+
));
|
185 |
+
|
186 |
+
if (Mage::helper('emaildirect')->getAbandonedEnabled())
|
187 |
+
{
|
188 |
+
|
189 |
+
$this->addColumn('action',
|
190 |
+
array(
|
191 |
+
'header' => Mage::helper('emaildirect')->__('Action'),
|
192 |
+
'width' => '100',
|
193 |
+
'type' => 'action',
|
194 |
+
'getter' => 'getId',
|
195 |
+
'actions' => array(
|
196 |
+
array(
|
197 |
+
'caption' => Mage::helper('emaildirect')->__('Send'),
|
198 |
+
'url' => array('base'=> '*/*/send'),
|
199 |
+
'field' => 'id',
|
200 |
+
'sent' => false
|
201 |
+
),
|
202 |
+
array(
|
203 |
+
'caption' => Mage::helper('emaildirect')->__('Resend'),
|
204 |
+
'url' => array('base'=> '*/*/send'),
|
205 |
+
'field' => 'id',
|
206 |
+
'sent' => true
|
207 |
+
)
|
208 |
+
),
|
209 |
+
'filter' => false,
|
210 |
+
'sortable' => false,
|
211 |
+
'renderer' => 'EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_Action',
|
212 |
+
'index' => 'stores',
|
213 |
+
'is_system' => true,
|
214 |
+
));
|
215 |
+
}
|
216 |
+
|
217 |
+
//$this->addExportType('*/*/exportAbandonedCsv', Mage::helper('reports')->__('CSV'));
|
218 |
+
//$this->addExportType('*/*/exportAbandonedExcel', Mage::helper('reports')->__('Excel XML'));
|
219 |
+
|
220 |
+
return parent::_prepareColumns();
|
221 |
+
}
|
222 |
+
|
223 |
+
protected function _prepareMassaction()
|
224 |
+
{
|
225 |
+
if (!Mage::helper('emaildirect')->getAbandonedEnabled())
|
226 |
+
return $this;
|
227 |
+
|
228 |
+
$this->setMassactionIdField('post_id');
|
229 |
+
$this->getMassactionBlock()->setFormFieldName('id');
|
230 |
+
|
231 |
+
$this->getMassactionBlock()->addItem('send', array(
|
232 |
+
'label' => Mage::helper('emaildirect')->__('Send or Resend'),
|
233 |
+
'url' => $this->getUrl('*/*/massSend')
|
234 |
+
));
|
235 |
+
|
236 |
+
|
237 |
+
return $this;
|
238 |
+
}
|
239 |
+
|
240 |
+
public function getGridUrl()
|
241 |
+
{
|
242 |
+
return $this->getUrl('*/*/grid', array('_current'=> true));
|
243 |
+
}
|
244 |
+
|
245 |
+
public function getRowUrl($row)
|
246 |
+
{
|
247 |
+
return $this->getUrl('adminhtml/customer/edit', array('id'=>$row->getCustomerId(), 'active_tab'=>'cart'));
|
248 |
+
}
|
249 |
+
|
250 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Fieldset/Hint.php
CHANGED
@@ -25,5 +25,14 @@ class EmailDirect_Integration_Block_Adminhtml_System_Config_Fieldset_Hint
|
|
25 |
{
|
26 |
return (string) Mage::getConfig()->getNode('modules/EmailDirect_Integration/version');
|
27 |
}
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
25 |
{
|
26 |
return (string) Mage::getConfig()->getNode('modules/EmailDirect_Integration/version');
|
27 |
}
|
28 |
+
|
29 |
+
public function getAbandonedLastRunHtml()
|
30 |
+
{
|
31 |
+
return Mage::helper('emaildirect')->getAbandonedLastRunHtml();
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getAbandonedEnabled()
|
35 |
+
{
|
36 |
+
return Mage::helper('emaildirect')->getAbandonedEnabled();
|
37 |
+
}
|
38 |
}
|
app/code/local/EmailDirect/Integration/Block/Widget/Grid/Column/Renderer/AbandonedMinutes.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_AbandonedMinutes extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
3 |
+
{
|
4 |
+
public function render(Varien_Object $row)
|
5 |
+
{
|
6 |
+
$processed_date = $row->getData('emaildirect_abandoned_date');
|
7 |
+
|
8 |
+
if ($processed_date != "")
|
9 |
+
{
|
10 |
+
return "";
|
11 |
+
}
|
12 |
+
else
|
13 |
+
{
|
14 |
+
$abandoned_date = strtotime($row->getData('updated_at'));
|
15 |
+
|
16 |
+
$current_date = Mage::getModel('core/date')->gmtTimestamp();
|
17 |
+
|
18 |
+
$minutes = round(abs($current_date - $abandoned_date) / 60,0);
|
19 |
+
|
20 |
+
$class = 'ab_ok';
|
21 |
+
if ($minutes > 60)
|
22 |
+
$class = 'ab_ng';
|
23 |
+
|
24 |
+
return "<span class='{$class}'>{$minutes}</span>";
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
28 |
+
}
|
app/code/local/EmailDirect/Integration/Block/Widget/Grid/Column/Renderer/Action.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function render(Varien_Object $row)
|
7 |
+
{
|
8 |
+
$processed_date = $row->getData('emaildirect_abandoned_date');
|
9 |
+
$processed = $processed_date != "";
|
10 |
+
|
11 |
+
$actions = $this->getColumn()->getActions();
|
12 |
+
if (empty($actions) || !is_array($actions))
|
13 |
+
return ' ';
|
14 |
+
|
15 |
+
$out = "";
|
16 |
+
|
17 |
+
foreach ($actions as $action)
|
18 |
+
{
|
19 |
+
if (is_array($action))
|
20 |
+
{
|
21 |
+
// Change text if cart has already been sent
|
22 |
+
if ($action['sent'] == $processed)
|
23 |
+
{
|
24 |
+
if ($out != "")
|
25 |
+
$out .= "<br />";
|
26 |
+
|
27 |
+
$out .= $this->_toLinkHtml($action, $row);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
return $out;
|
32 |
+
}
|
33 |
+
}
|
app/code/local/EmailDirect/Integration/Helper/Data.php
CHANGED
@@ -295,4 +295,41 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
295 |
|
296 |
}
|
297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
}
|
295 |
|
296 |
}
|
297 |
|
298 |
+
public function getAbandonedLastRunHtml()
|
299 |
+
{
|
300 |
+
$last_run = Mage::helper('emaildirect')->config('abandoned_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 |
+
if ($minutes > 60)
|
314 |
+
$class = 'ab_ng';
|
315 |
+
|
316 |
+
if ($minutes == 1)
|
317 |
+
$minutes = " ({$minutes} minute ago)";
|
318 |
+
else
|
319 |
+
$minutes = " ({$minutes} minutes ago)";
|
320 |
+
|
321 |
+
return "<span class='{$class}'>{$last_run}{$minutes}</span>";
|
322 |
+
}
|
323 |
+
|
324 |
+
public function getAbandonedEnabled()
|
325 |
+
{
|
326 |
+
$active = Mage::helper('emaildirect')->config('active');
|
327 |
+
$sendit = Mage::helper('emaildirect')->config('sendabandoned');
|
328 |
+
$setup = Mage::helper('emaildirect')->config('abandonedsetup');
|
329 |
+
|
330 |
+
if (!$sendit || !$setup || !$active)
|
331 |
+
return false;
|
332 |
+
|
333 |
+
return true;
|
334 |
+
}
|
335 |
}
|
app/code/local/EmailDirect/Integration/Helper/Fields.php
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EmailDirect_Integration_Helper_Fields extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
const ABANDONED_SETUP_PATH = 'emaildirect/general/abandonedsetup';
|
6 |
+
const SETUP_VERSION_PATH = 'emaildirect/general/setup_version';
|
7 |
+
|
8 |
+
private function getVersion()
|
9 |
+
{
|
10 |
+
return (string) Mage::getConfig()->getNode('modules/EmailDirect_Integration/version');
|
11 |
+
}
|
12 |
+
|
13 |
+
private function addDatabaseField($data)
|
14 |
+
{
|
15 |
+
$name = $data['name'];
|
16 |
+
$type = $data['type'];
|
17 |
+
|
18 |
+
if (isset($data['size']))
|
19 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_database')->add($name,$type,$data['size']);
|
20 |
+
else
|
21 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_database')->add($name,$type);
|
22 |
+
|
23 |
+
if(isset($rc->ErrorCode) && $rc->ErrorCode != 233)
|
24 |
+
{
|
25 |
+
Mage::helper('emaildirect')->debugLog("Error adding {$name} field");
|
26 |
+
Mage::helper('emaildirect')->debugLog($rc);
|
27 |
+
Mage::throwException("Error adding {$name} field");
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
private function getMultiFields($fields, $prefix = "", $count = null)
|
32 |
+
{
|
33 |
+
if ($count == null)
|
34 |
+
$count = Mage::helper('emaildirect')->config('product_fields');
|
35 |
+
|
36 |
+
for ($i = 1; $i <= $count; $i++)
|
37 |
+
{
|
38 |
+
$fields[] =
|
39 |
+
array('name' => "{$prefix}ProductName{$i}",
|
40 |
+
'type' => 'Text',
|
41 |
+
'size' => '200');
|
42 |
+
$fields[] =
|
43 |
+
array('name' => "{$prefix}SKU{$i}",
|
44 |
+
'type' => 'Text',
|
45 |
+
'size' => '50');
|
46 |
+
$fields[] =
|
47 |
+
array('name' => "{$prefix}URL{$i}",
|
48 |
+
'type' => 'Text',
|
49 |
+
'size' => '200');
|
50 |
+
$fields[] =
|
51 |
+
array('name' => "{$prefix}Image{$i}",
|
52 |
+
'type' => 'Text',
|
53 |
+
'size' => '200');
|
54 |
+
$fields[] =
|
55 |
+
array('name' => "{$prefix}Description{$i}",
|
56 |
+
'type' => 'Text',
|
57 |
+
'size' => '200');
|
58 |
+
$fields[] =
|
59 |
+
array('name' => "{$prefix}Cost{$i}",
|
60 |
+
'type' => 'Text',
|
61 |
+
'size' => '20');
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
return $fields;
|
66 |
+
}
|
67 |
+
|
68 |
+
private function getExistingColumns()
|
69 |
+
{
|
70 |
+
$columns = Mage::getSingleton('emaildirect/wrapper_database')->getAllColumns();
|
71 |
+
|
72 |
+
$existing = array();
|
73 |
+
|
74 |
+
foreach ($columns as $column)
|
75 |
+
{
|
76 |
+
$name = (string)$column->ColumnName;
|
77 |
+
|
78 |
+
$existing[$name] = $name;
|
79 |
+
}
|
80 |
+
|
81 |
+
return $existing;
|
82 |
+
}
|
83 |
+
|
84 |
+
private function getMissingColumns($fields)
|
85 |
+
{
|
86 |
+
$columns = $this->getExistingColumns();
|
87 |
+
|
88 |
+
$missing = array();
|
89 |
+
|
90 |
+
foreach ($fields as $field)
|
91 |
+
{
|
92 |
+
if (!isset($columns[$field['name']]))
|
93 |
+
{
|
94 |
+
$missing[] = $field;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
return $missing;
|
99 |
+
}
|
100 |
+
|
101 |
+
public function verifyFields($force_product = false)
|
102 |
+
{
|
103 |
+
$fields = array();
|
104 |
+
|
105 |
+
if (Mage::helper('emaildirect')->config('save_latest_order') || $force_product)
|
106 |
+
{
|
107 |
+
$fields[] = array('name' => 'LastOrderNumber',
|
108 |
+
'type' => 'Text',
|
109 |
+
'size' => '30');
|
110 |
+
$fields[] = array('name' => 'LastPurchaseDate',
|
111 |
+
'type' => 'Date');
|
112 |
+
$fields[] = array('name' => 'LastPurchaseTotal',
|
113 |
+
'type' => 'Text',
|
114 |
+
'size' => '20');
|
115 |
+
|
116 |
+
$fields = $this->getMultiFields($fields);
|
117 |
+
|
118 |
+
$fields = $this->getMultiFields($fields,"Related", Mage::helper('emaildirect')->config('related_fields'));
|
119 |
+
}
|
120 |
+
|
121 |
+
$fields[] = array('name' => 'AbandonedDate',
|
122 |
+
'type' => 'Date');
|
123 |
+
$fields[] = array('name' => 'AbandonedUrl',
|
124 |
+
'type' => 'Text',
|
125 |
+
'size' => '1000');
|
126 |
+
|
127 |
+
$fields = $this->getMultiFields($fields,"AB");
|
128 |
+
|
129 |
+
$missing = $this->getMissingColumns($fields);
|
130 |
+
|
131 |
+
if (count($missing) > 0)
|
132 |
+
{
|
133 |
+
foreach ($missing as $data)
|
134 |
+
{
|
135 |
+
$this->addDatabaseField($data);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
$missing_check = $this->getMissingColumns($fields);
|
140 |
+
|
141 |
+
if (count($missing_check) != 0)
|
142 |
+
{
|
143 |
+
Mage::helper('emaildirect')->debugLog("Error creating fields");
|
144 |
+
Mage::helper('emaildirect')->debugLog($missing_check);
|
145 |
+
Mage::helper('emaildirect')->debugLog($rc);
|
146 |
+
Mage::throwException("Error creating fields");
|
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");
|
154 |
+
}
|
155 |
+
|
156 |
+
public function checkFields()
|
157 |
+
{
|
158 |
+
$version = $this->getVersion();
|
159 |
+
|
160 |
+
$setup_version = Mage::helper('emaildirect')->config('setup_version');
|
161 |
+
|
162 |
+
if ($setup_version == NULL || (version_compare($setup_version, $version) < 0))
|
163 |
+
$this->verifyFields();
|
164 |
+
}
|
165 |
+
}
|
app/code/local/EmailDirect/Integration/Model/Observer.php
CHANGED
@@ -7,14 +7,8 @@
|
|
7 |
*/
|
8 |
class EmailDirect_Integration_Model_Observer
|
9 |
{
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
private function getVersion()
|
14 |
-
{
|
15 |
-
return (string) Mage::getConfig()->getNode('modules/EmailDirect_Integration/version');
|
16 |
-
}
|
17 |
-
|
18 |
/**
|
19 |
* Handle Subscriber object saving process
|
20 |
*/
|
@@ -85,120 +79,6 @@ class EmailDirect_Integration_Model_Observer
|
|
85 |
$listId = Mage::helper('emaildirect')->getDefaultList($subscriber->getStoreId());
|
86 |
}
|
87 |
|
88 |
-
private function addDatabaseField($data)
|
89 |
-
{
|
90 |
-
$name = $data['name'];
|
91 |
-
$type = $data['type'];
|
92 |
-
|
93 |
-
if (!Mage::getSingleton('emaildirect/wrapper_database')->exists($name))
|
94 |
-
{
|
95 |
-
if (isset($data['size']))
|
96 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_database')->add($name,$type,$data['size']);
|
97 |
-
else
|
98 |
-
$rc = Mage::getSingleton('emaildirect/wrapper_database')->add($name,$type);
|
99 |
-
|
100 |
-
if(isset($rc->ErrorCode) && $rc->ErrorCode != 233)
|
101 |
-
{
|
102 |
-
Mage::helper('emaildirect')->debugLog("Error adding {$name} field");
|
103 |
-
Mage::helper('emaildirect')->debugLog($rc);
|
104 |
-
Mage::throwException("Error adding {$name} field");
|
105 |
-
}
|
106 |
-
|
107 |
-
if (!Mage::getSingleton('emaildirect/wrapper_database')->exists($name))
|
108 |
-
{
|
109 |
-
Mage::helper('emaildirect')->debugLog("Error creating {$name} field");
|
110 |
-
Mage::helper('emaildirect')->debugLog($rc);
|
111 |
-
Mage::throwException("Error creating {$name} field");
|
112 |
-
}
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
private function addMultiFields($prefix = "", $count = null)
|
117 |
-
{
|
118 |
-
if ($count == null)
|
119 |
-
$count = Mage::helper('emaildirect')->config('product_fields');
|
120 |
-
|
121 |
-
for ($i = 1; $i <= $count; $i++)
|
122 |
-
{
|
123 |
-
$multi_fields = array(
|
124 |
-
array('name' => "{$prefix}ProductName{$i}",
|
125 |
-
'type' => 'Text',
|
126 |
-
'size' => '200'),
|
127 |
-
array('name' => "{$prefix}SKU{$i}",
|
128 |
-
'type' => 'Text',
|
129 |
-
'size' => '50'),
|
130 |
-
array('name' => "{$prefix}URL{$i}",
|
131 |
-
'type' => 'Text',
|
132 |
-
'size' => '200'),
|
133 |
-
array('name' => "{$prefix}Image{$i}",
|
134 |
-
'type' => 'Text',
|
135 |
-
'size' => '200'),
|
136 |
-
array('name' => "{$prefix}Description{$i}",
|
137 |
-
'type' => 'Text',
|
138 |
-
'size' => '200'),
|
139 |
-
array('name' => "{$prefix}Cost{$i}",
|
140 |
-
'type' => 'Text',
|
141 |
-
'size' => '20')
|
142 |
-
);
|
143 |
-
|
144 |
-
Mage::helper('emaildirect')->debugLog("Multi Field:");
|
145 |
-
Mage::helper('emaildirect')->debugLog($multi_fields);
|
146 |
-
|
147 |
-
foreach ($multi_fields as $data)
|
148 |
-
{
|
149 |
-
$this->addDatabaseField($data);
|
150 |
-
|
151 |
-
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
|
155 |
-
private function verifyAbandonedFields()
|
156 |
-
{
|
157 |
-
Mage::helper('emaildirect')->debugLog("verifyAbandonedFields Start");
|
158 |
-
$fields = array(
|
159 |
-
array('name' => 'AbandonedDate',
|
160 |
-
'type' => 'Date'),
|
161 |
-
array('name' => 'AbandonedUrl',
|
162 |
-
'type' => 'Text',
|
163 |
-
'size' => '1000')
|
164 |
-
);
|
165 |
-
|
166 |
-
foreach ($fields as $data)
|
167 |
-
{
|
168 |
-
$this->addDatabaseField($data);
|
169 |
-
}
|
170 |
-
|
171 |
-
$this->addMultiFields("AB");
|
172 |
-
|
173 |
-
// Save version so we know if we are up to date or not
|
174 |
-
Mage::getConfig()->saveConfig(self::ABANDONED_SETUP_PATH, 1,"default","default");
|
175 |
-
Mage::getConfig()->saveConfig(self::ABANDONED_SETUP_VERSION, $this->getVersion(),"default","default");
|
176 |
-
Mage::helper('emaildirect')->debugLog("verifyAbandonedFields End");
|
177 |
-
}
|
178 |
-
|
179 |
-
private function verifyProductFields()
|
180 |
-
{
|
181 |
-
$fields = array(
|
182 |
-
array('name' => 'LastOrderNumber',
|
183 |
-
'type' => 'Text',
|
184 |
-
'size' => '30'),
|
185 |
-
array('name' => 'LastPurchaseDate',
|
186 |
-
'type' => 'Date'),
|
187 |
-
array('name' => 'LastPurchaseTotal',
|
188 |
-
'type' => 'Text',
|
189 |
-
'size' => '20')
|
190 |
-
);
|
191 |
-
|
192 |
-
foreach ($fields as $data)
|
193 |
-
{
|
194 |
-
$this->addDatabaseField($data);
|
195 |
-
}
|
196 |
-
|
197 |
-
$this->addMultiFields();
|
198 |
-
|
199 |
-
$this->addMultiFields("Related", Mage::helper('emaildirect')->config('related_fields'));
|
200 |
-
}
|
201 |
-
|
202 |
public function saveConfig(Varien_Event_Observer $observer)
|
203 |
{
|
204 |
$store = is_null($observer->getEvent()->getStore()) ? 'default': $observer->getEvent()->getStore();
|
@@ -246,13 +126,14 @@ class EmailDirect_Integration_Model_Observer
|
|
246 |
Mage::getConfig()->cleanCache();
|
247 |
}
|
248 |
|
|
|
249 |
if (isset($post['groups']['general']['fields']['save_latest_order']['value']) && $post['groups']['general']['fields']['save_latest_order']['value'] == true)
|
250 |
{
|
251 |
-
$
|
252 |
}
|
253 |
|
254 |
-
//
|
255 |
-
|
256 |
}
|
257 |
|
258 |
public function _mergeVars($object = NULL, $includeEmail = FALSE)
|
@@ -304,7 +185,11 @@ class EmailDirect_Integration_Model_Observer
|
|
304 |
if (is_string($item))
|
305 |
$product_id = $item;
|
306 |
else
|
|
|
|
|
|
|
307 |
$product_id = $item->getProduct()->getId();
|
|
|
308 |
|
309 |
$product = Mage::getModel('catalog/product')->load($product_id);
|
310 |
|
@@ -472,8 +357,6 @@ class EmailDirect_Integration_Model_Observer
|
|
472 |
{
|
473 |
$track = $observer->getEvent()->getTrack();
|
474 |
|
475 |
-
//Zend_debug::dump($track);
|
476 |
-
|
477 |
$order = $track->getShipment()->getOrder();
|
478 |
$shippingMethod = $order->getShippingMethod(); // String in format of 'carrier_method'
|
479 |
if (!$shippingMethod)
|
@@ -522,8 +405,6 @@ class EmailDirect_Integration_Model_Observer
|
|
522 |
|
523 |
if (Mage::helper('emaildirect')->config('save_latest_order'))
|
524 |
{
|
525 |
-
$this->checkProductFields();
|
526 |
-
$this->checkAbandonedFields(true);
|
527 |
|
528 |
$mergeVars['LastOrderNumber'] = $order->getIncrementId();
|
529 |
$mergeVars['LastPurchaseDate'] = $order->getData('created_at');
|
@@ -535,6 +416,8 @@ class EmailDirect_Integration_Model_Observer
|
|
535 |
|
536 |
Mage::helper('emaildirect')->debugLog("MERGE VARS:");
|
537 |
Mage::helper('emaildirect')->debugLog($mergeVars);
|
|
|
|
|
538 |
|
539 |
Mage::getSingleton('emaildirect/wrapper_orders')->addSubscriberOrder($email,$order, $mergeVars);
|
540 |
}
|
@@ -578,7 +461,43 @@ class EmailDirect_Integration_Model_Observer
|
|
578 |
return $order;
|
579 |
}
|
580 |
|
581 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
582 |
{
|
583 |
//$customer = $quote->getCustomer();
|
584 |
$email = $quote->getCustomerEmail();
|
@@ -624,43 +543,25 @@ class EmailDirect_Integration_Model_Observer
|
|
624 |
|
625 |
$xml = Mage::getSingleton('emaildirect/wrapper_abandoned')->getOneSubscriber($email,$mergeVars);
|
626 |
|
627 |
-
|
628 |
-
|
629 |
-
$quote->save();
|
630 |
-
|
631 |
return $xml;
|
632 |
}
|
633 |
-
|
634 |
-
private function checkAbandonedFields()
|
635 |
-
{
|
636 |
-
$version = $this->getVersion();
|
637 |
-
|
638 |
-
$setup_version = Mage::helper('emaildirect')->config('setup_version');
|
639 |
-
|
640 |
-
if ($setup_version == NULL || (version_compare($setup_version, $version) < 0))
|
641 |
-
$this->verifyAbandonedFields();
|
642 |
-
}
|
643 |
-
|
644 |
-
private function checkProductFields()
|
645 |
-
{
|
646 |
-
if (!Mage::helper('emaildirect')->config('save_latest_order'))
|
647 |
-
return;
|
648 |
-
|
649 |
-
$version = $this->getVersion();
|
650 |
-
|
651 |
-
$setup_version = Mage::helper('emaildirect')->config('setup_version');
|
652 |
-
|
653 |
-
if ($setup_version == NULL || (version_compare($setup_version, $version) < 0))
|
654 |
-
$this->verifyProductFields();
|
655 |
-
}
|
656 |
|
657 |
public function abandonedCartsProcessor()
|
658 |
{
|
659 |
Mage::helper('emaildirect')->debugLog("Abandoned Carts Processor Start");
|
660 |
|
|
|
661 |
$sendit = Mage::helper('emaildirect')->config('sendabandoned');
|
662 |
$setup = Mage::helper('emaildirect')->config('abandonedsetup');
|
663 |
|
|
|
|
|
|
|
|
|
|
|
|
|
664 |
if (!$sendit)
|
665 |
{
|
666 |
Mage::helper('emaildirect')->debugLog("Skipping... SendIt = False");
|
@@ -673,8 +574,13 @@ class EmailDirect_Integration_Model_Observer
|
|
673 |
return;
|
674 |
}
|
675 |
|
676 |
-
|
677 |
-
$
|
|
|
|
|
|
|
|
|
|
|
678 |
|
679 |
$check_date = $this->getAbandonedTime();
|
680 |
|
@@ -701,7 +607,7 @@ class EmailDirect_Integration_Model_Observer
|
|
701 |
// Get the data for each abandoned cart
|
702 |
foreach ($collection as $quote)
|
703 |
{
|
704 |
-
$xml .= $this->processAbandoned($quote);
|
705 |
$subscribers = true;
|
706 |
}
|
707 |
|
@@ -725,6 +631,58 @@ class EmailDirect_Integration_Model_Observer
|
|
725 |
|
726 |
Mage::helper('emaildirect')->debugLog("Abandoned Carts Processor End");
|
727 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
728 |
// END ABANDONED CRON
|
729 |
|
730 |
// START QUOTE SAVE AFTER
|
@@ -751,6 +709,9 @@ class EmailDirect_Integration_Model_Observer
|
|
751 |
}
|
752 |
|
753 |
$url_data = array("quote" => $quote->getId(), "id" => $ids, "qty" => $qtys);
|
|
|
|
|
|
|
754 |
|
755 |
$url = base64_encode(serialize($url_data));
|
756 |
|
@@ -782,8 +743,7 @@ class EmailDirect_Integration_Model_Observer
|
|
782 |
|
783 |
Mage::helper('emaildirect')->debugLog("Saving Quote.");
|
784 |
// Re-save quote with new URL
|
785 |
-
$
|
786 |
-
$quote->save();
|
787 |
Mage::helper('emaildirect')->debugLog("Quote Save After End");
|
788 |
}
|
789 |
// END QUOTE SAVE AFTER
|
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 |
*/
|
79 |
$listId = Mage::helper('emaildirect')->getDefaultList($subscriber->getStoreId());
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
public function saveConfig(Varien_Event_Observer $observer)
|
83 |
{
|
84 |
$store = is_null($observer->getEvent()->getStore()) ? 'default': $observer->getEvent()->getStore();
|
126 |
Mage::getConfig()->cleanCache();
|
127 |
}
|
128 |
|
129 |
+
$force_product = false;
|
130 |
if (isset($post['groups']['general']['fields']['save_latest_order']['value']) && $post['groups']['general']['fields']['save_latest_order']['value'] == true)
|
131 |
{
|
132 |
+
$force_product = true;
|
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)
|
185 |
if (is_string($item))
|
186 |
$product_id = $item;
|
187 |
else
|
188 |
+
{
|
189 |
+
if ($item->getProduct() == null)
|
190 |
+
return $mergeVars; // Can't get product so abort
|
191 |
$product_id = $item->getProduct()->getId();
|
192 |
+
}
|
193 |
|
194 |
$product = Mage::getModel('catalog/product')->load($product_id);
|
195 |
|
357 |
{
|
358 |
$track = $observer->getEvent()->getTrack();
|
359 |
|
|
|
|
|
360 |
$order = $track->getShipment()->getOrder();
|
361 |
$shippingMethod = $order->getShippingMethod(); // String in format of 'carrier_method'
|
362 |
if (!$shippingMethod)
|
405 |
|
406 |
if (Mage::helper('emaildirect')->config('save_latest_order'))
|
407 |
{
|
|
|
|
|
408 |
|
409 |
$mergeVars['LastOrderNumber'] = $order->getIncrementId();
|
410 |
$mergeVars['LastPurchaseDate'] = $order->getData('created_at');
|
416 |
|
417 |
Mage::helper('emaildirect')->debugLog("MERGE VARS:");
|
418 |
Mage::helper('emaildirect')->debugLog($mergeVars);
|
419 |
+
|
420 |
+
Mage::helper('emaildirect/fields')->checkFields();
|
421 |
|
422 |
Mage::getSingleton('emaildirect/wrapper_orders')->addSubscriberOrder($email,$order, $mergeVars);
|
423 |
}
|
461 |
return $order;
|
462 |
}
|
463 |
|
464 |
+
private function setSentToEmailDirectDate($quote,$date)
|
465 |
+
{
|
466 |
+
$table_name = Mage::getSingleton('core/resource')->getTableName("sales_flat_quote");
|
467 |
+
|
468 |
+
$sql = "UPDATE {$table_name} SET emaildirect_abandoned_date = '{$date}' WHERE entity_id = {$quote->getId()}";
|
469 |
+
|
470 |
+
try
|
471 |
+
{
|
472 |
+
Mage::getSingleton('core/resource')
|
473 |
+
->getConnection('core_write')
|
474 |
+
->query($sql);
|
475 |
+
}
|
476 |
+
catch (Exception $e)
|
477 |
+
{
|
478 |
+
Mage::logException($e);
|
479 |
+
}
|
480 |
+
}
|
481 |
+
|
482 |
+
private function setAbandonedUrl($quote,$url)
|
483 |
+
{
|
484 |
+
$table_name = Mage::getSingleton('core/resource')->getTableName("sales_flat_quote");
|
485 |
+
|
486 |
+
$sql = "UPDATE {$table_name} SET emaildirect_abandoned_url = '{$url}' WHERE entity_id = {$quote->getId()}";
|
487 |
+
|
488 |
+
try
|
489 |
+
{
|
490 |
+
Mage::getSingleton('core/resource')
|
491 |
+
->getConnection('core_write')
|
492 |
+
->query($sql);
|
493 |
+
}
|
494 |
+
catch (Exception $e)
|
495 |
+
{
|
496 |
+
Mage::logException($e);
|
497 |
+
}
|
498 |
+
}
|
499 |
+
|
500 |
+
private function processAbandoned($quote, $date)
|
501 |
{
|
502 |
//$customer = $quote->getCustomer();
|
503 |
$email = $quote->getCustomerEmail();
|
543 |
|
544 |
$xml = Mage::getSingleton('emaildirect/wrapper_abandoned')->getOneSubscriber($email,$mergeVars);
|
545 |
|
546 |
+
$this->setSentToEmailDirectDate($quote, $date);
|
547 |
+
|
|
|
|
|
548 |
return $xml;
|
549 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
|
551 |
public function abandonedCartsProcessor()
|
552 |
{
|
553 |
Mage::helper('emaildirect')->debugLog("Abandoned Carts Processor Start");
|
554 |
|
555 |
+
$active = Mage::helper('emaildirect')->config('active');
|
556 |
$sendit = Mage::helper('emaildirect')->config('sendabandoned');
|
557 |
$setup = Mage::helper('emaildirect')->config('abandonedsetup');
|
558 |
|
559 |
+
if (!$active)
|
560 |
+
{
|
561 |
+
Mage::helper('emaildirect')->debugLog("Skipping... EmailDirect Module is Disabled");
|
562 |
+
return;
|
563 |
+
}
|
564 |
+
|
565 |
if (!$sendit)
|
566 |
{
|
567 |
Mage::helper('emaildirect')->debugLog("Skipping... SendIt = False");
|
574 |
return;
|
575 |
}
|
576 |
|
577 |
+
// Store the time we last run
|
578 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
579 |
+
$date = date("Y-m-d H:i:s", $date);
|
580 |
+
|
581 |
+
Mage::getConfig()->saveConfig(self::ABANDONED_LAST_RUN, $date,"default","default");
|
582 |
+
|
583 |
+
Mage::helper('emaildirect/fields')->checkFields();
|
584 |
|
585 |
$check_date = $this->getAbandonedTime();
|
586 |
|
607 |
// Get the data for each abandoned cart
|
608 |
foreach ($collection as $quote)
|
609 |
{
|
610 |
+
$xml .= $this->processAbandoned($quote, $date);
|
611 |
$subscribers = true;
|
612 |
}
|
613 |
|
631 |
|
632 |
Mage::helper('emaildirect')->debugLog("Abandoned Carts Processor End");
|
633 |
}
|
634 |
+
|
635 |
+
public function SendAbandonedCarts($id_list)
|
636 |
+
{
|
637 |
+
Mage::helper('emaildirect')->debugLog("Sending Specific Abandoned Carts");
|
638 |
+
|
639 |
+
Mage::helper('emaildirect/fields')->checkFields();
|
640 |
+
|
641 |
+
Mage::helper('emaildirect')->debugLog("ID LIST:");
|
642 |
+
Mage::helper('emaildirect')->debugLog($id_list);
|
643 |
+
|
644 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
645 |
+
$date = date("Y-m-d H:i:s", $date);
|
646 |
+
|
647 |
+
// Get abandoned collection
|
648 |
+
$collection = Mage::getResourceModel('reports/quote_collection');
|
649 |
+
|
650 |
+
$collection->addFieldToFilter('entity_id', array('in' => $id_list))
|
651 |
+
->setOrder('updated_at');
|
652 |
+
|
653 |
+
Mage::helper('emaildirect')->debugLog("SQL: " . $collection->getSelect()->__toString());
|
654 |
+
|
655 |
+
$subscribers = false;
|
656 |
+
|
657 |
+
$xml = "<Subscribers>";
|
658 |
+
|
659 |
+
// Get the data for each abandoned cart
|
660 |
+
foreach ($collection as $quote)
|
661 |
+
{
|
662 |
+
$xml .= $this->processAbandoned($quote,$date);
|
663 |
+
$subscribers = true;
|
664 |
+
}
|
665 |
+
|
666 |
+
$xml .= "</Subscribers>";
|
667 |
+
|
668 |
+
if (!$subscribers)
|
669 |
+
{
|
670 |
+
Mage::helper('emaildirect')->debugLog("Exiting... No Carts Found");
|
671 |
+
return; // No abandoned carts found
|
672 |
+
}
|
673 |
+
|
674 |
+
Mage::helper('emaildirect')->debugLog("Subscriber Xml:");
|
675 |
+
Mage::helper('emaildirect')->debugLog($xml);
|
676 |
+
|
677 |
+
Mage::helper('emaildirect')->debugLog("Sending Abandoned Carts");
|
678 |
+
// Send them all at once
|
679 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_abandoned')->sendSubscribers($xml);
|
680 |
+
|
681 |
+
Mage::helper('emaildirect')->debugLog("Results:");
|
682 |
+
Mage::helper('emaildirect')->debugLog($rc);
|
683 |
+
|
684 |
+
Mage::helper('emaildirect')->debugLog("Sending Specific Abandoned Carts End");
|
685 |
+
}
|
686 |
// END ABANDONED CRON
|
687 |
|
688 |
// START QUOTE SAVE AFTER
|
709 |
}
|
710 |
|
711 |
$url_data = array("quote" => $quote->getId(), "id" => $ids, "qty" => $qtys);
|
712 |
+
|
713 |
+
Mage::helper('emaildirect')->debugLog("Abandoned Url Data:");
|
714 |
+
Mage::helper('emaildirect')->debugLog($url_data);
|
715 |
|
716 |
$url = base64_encode(serialize($url_data));
|
717 |
|
743 |
|
744 |
Mage::helper('emaildirect')->debugLog("Saving Quote.");
|
745 |
// Re-save quote with new URL
|
746 |
+
$this->setAbandonedUrl($quote, $url);
|
|
|
747 |
Mage::helper('emaildirect')->debugLog("Quote Save After End");
|
748 |
}
|
749 |
// END QUOTE SAVE AFTER
|
app/code/local/EmailDirect/Integration/controllers/AbandonedController.php
CHANGED
@@ -1,33 +1,6 @@
|
|
1 |
<?php
|
2 |
class EmailDirect_Integration_AbandonedController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
-
public function testAction()
|
5 |
-
{
|
6 |
-
$order = Mage::getModel('sales/order')->load(56);
|
7 |
-
|
8 |
-
Zend_debug::dump($order->getData());
|
9 |
-
|
10 |
-
$shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')
|
11 |
-
->setOrderFilter($order)
|
12 |
-
->load();
|
13 |
-
foreach($shipmentCollection as $_shipment)
|
14 |
-
{
|
15 |
-
Zend_debug::dump($_shipment->getData());
|
16 |
-
foreach($_shipment->getAllTracks() as $tracknum)
|
17 |
-
{
|
18 |
-
Zend_debug::dump($tracknum->getData());
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
//$method = $order->getPayment()->getMethodInstance();
|
23 |
-
|
24 |
-
//Zend_debug::dump($order->getPayment()->getData());
|
25 |
-
//Zend_debug::dump($order->getPayment()->getAdditionalInformation());
|
26 |
-
//Zend_debug::dump($order->getPayment()->getMethodInstance()->getPaymentInfo());
|
27 |
-
|
28 |
-
|
29 |
-
}
|
30 |
-
|
31 |
public function restoreAction()
|
32 |
{
|
33 |
$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
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Emaildirect_Integration_Admin_AbandonedController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$this->loadLayout();
|
8 |
+
|
9 |
+
$this->_setActiveMenu('system');
|
10 |
+
$this->renderLayout();
|
11 |
+
}
|
12 |
+
|
13 |
+
public function gridAction()
|
14 |
+
{
|
15 |
+
$this->showGrid();
|
16 |
+
}
|
17 |
+
|
18 |
+
private function showGrid()
|
19 |
+
{
|
20 |
+
$this->loadLayout();
|
21 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('emaildirect/adminhtml_abandoned_grid')->toHtml());
|
22 |
+
}
|
23 |
+
|
24 |
+
public function runAction()
|
25 |
+
{
|
26 |
+
Mage::getSingleton('emaildirect/observer')->abandonedCartsProcessor();
|
27 |
+
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The Abandoned Cart process has been run."));
|
28 |
+
$this->_redirect('emaildirect/admin_abandoned/index');
|
29 |
+
}
|
30 |
+
|
31 |
+
public function sendAction()
|
32 |
+
{
|
33 |
+
$id = $this->getRequest()->getParam('id');
|
34 |
+
$id_list = array($id);
|
35 |
+
Mage::getSingleton('emaildirect/observer')->SendAbandonedCarts($id_list);
|
36 |
+
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("Abandoned Carts have been sent."));
|
37 |
+
$this->_redirect('emaildirect/admin_abandoned/index');
|
38 |
+
}
|
39 |
+
|
40 |
+
public function massSendAction()
|
41 |
+
{
|
42 |
+
$params = array();
|
43 |
+
if( $this->getRequest()->isPost() )
|
44 |
+
$params = $this->getRequest()->getPost();
|
45 |
+
|
46 |
+
$id_list = $params['id'];
|
47 |
+
|
48 |
+
if(!is_array($id_list))
|
49 |
+
{
|
50 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select at least one cart to send or resend.'));
|
51 |
+
}
|
52 |
+
else
|
53 |
+
{
|
54 |
+
try
|
55 |
+
{
|
56 |
+
Mage::getSingleton('emaildirect/observer')->SendAbandonedCarts($id_list);
|
57 |
+
|
58 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
59 |
+
Mage::helper('adminhtml')->__('Total of %d carts(s) were sent.', count($id_list)));
|
60 |
+
}
|
61 |
+
catch (Exception $e)
|
62 |
+
{
|
63 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
64 |
+
}
|
65 |
+
}
|
66 |
+
$this->_redirect('*/*/index');
|
67 |
+
}
|
68 |
+
}
|
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>
|
@@ -170,6 +170,44 @@
|
|
170 |
</routers>
|
171 |
</admin>
|
172 |
<adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
<layout>
|
174 |
<updates>
|
175 |
<emaildirect>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<EmailDirect_Integration>
|
5 |
+
<version>1.3.0</version>
|
6 |
</EmailDirect_Integration>
|
7 |
</modules>
|
8 |
<global>
|
170 |
</routers>
|
171 |
</admin>
|
172 |
<adminhtml>
|
173 |
+
<menu>
|
174 |
+
<sales>
|
175 |
+
<children>
|
176 |
+
<emaildirect_abandoned>
|
177 |
+
<title>EmailDirect - Abandoned Carts</title>
|
178 |
+
<sort_order>100</sort_order>
|
179 |
+
<action>emaildirect/admin_abandoned</action>
|
180 |
+
</emaildirect_abandoned>
|
181 |
+
|
182 |
+
</children>
|
183 |
+
</sales>
|
184 |
+
</menu>
|
185 |
+
<acl>
|
186 |
+
<resources>
|
187 |
+
<admin>
|
188 |
+
<children>
|
189 |
+
<sales>
|
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>
|
app/code/local/EmailDirect/Integration/sql/emaildirect_setup/mysql4-install-1.0.0.php
CHANGED
@@ -1,13 +1,20 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
|
|
|
|
7 |
$installer->run("
|
8 |
|
9 |
ALTER TABLE `{$this->getTable('sales_flat_quote')}`
|
10 |
add column emaildirect_counter int(5) default '0'
|
11 |
");
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
1 |
<?php
|
2 |
|
3 |
+
$installer = $this;
|
4 |
|
5 |
+
$installer->startSetup();
|
6 |
|
7 |
+
try
|
8 |
+
{
|
9 |
$installer->run("
|
10 |
|
11 |
ALTER TABLE `{$this->getTable('sales_flat_quote')}`
|
12 |
add column emaildirect_counter int(5) default '0'
|
13 |
");
|
14 |
+
}
|
15 |
+
catch (Exception $e)
|
16 |
+
{
|
17 |
+
// Ignore
|
18 |
+
}
|
19 |
|
20 |
+
$installer->endSetup();
|
app/code/local/EmailDirect/Integration/sql/emaildirect_setup/mysql4-upgrade-1.0.13-1.0.14.php
CHANGED
@@ -3,10 +3,17 @@ $installer = $this;
|
|
3 |
|
4 |
$installer->startSetup();
|
5 |
|
|
|
|
|
6 |
$installer->run("
|
7 |
ALTER TABLE {$this->getTable('newsletter_subscriber')}
|
8 |
ADD firstname varchar(255) NOT NULL default '',
|
9 |
ADD lastname varchar(255) NOT NULL default ''
|
10 |
");
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
$installer->endSetup();
|
3 |
|
4 |
$installer->startSetup();
|
5 |
|
6 |
+
try
|
7 |
+
{
|
8 |
$installer->run("
|
9 |
ALTER TABLE {$this->getTable('newsletter_subscriber')}
|
10 |
ADD firstname varchar(255) NOT NULL default '',
|
11 |
ADD lastname varchar(255) NOT NULL default ''
|
12 |
");
|
13 |
+
}
|
14 |
+
catch (Exception $e)
|
15 |
+
{
|
16 |
+
// Ignore
|
17 |
+
}
|
18 |
|
19 |
$installer->endSetup();
|
app/code/local/EmailDirect/Integration/sql/emaildirect_setup/mysql4-upgrade-1.0.19-1.2.0.php
CHANGED
@@ -1,14 +1,20 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
|
|
|
|
7 |
$installer->run("
|
8 |
-
|
9 |
ALTER TABLE `{$this->getTable('sales_flat_quote')}`
|
10 |
add column emaildirect_abandoned_date TIMESTAMP NULL,
|
11 |
add column emaildirect_abandoned_url Text NULL
|
12 |
");
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
-
|
1 |
<?php
|
2 |
|
3 |
+
$installer = $this;
|
4 |
|
5 |
+
$installer->startSetup();
|
6 |
|
7 |
+
try
|
8 |
+
{
|
9 |
$installer->run("
|
|
|
10 |
ALTER TABLE `{$this->getTable('sales_flat_quote')}`
|
11 |
add column emaildirect_abandoned_date TIMESTAMP NULL,
|
12 |
add column emaildirect_abandoned_url Text NULL
|
13 |
");
|
14 |
+
}
|
15 |
+
catch (Exception $e)
|
16 |
+
{
|
17 |
+
// Ignore
|
18 |
+
}
|
19 |
|
20 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/emaildirect.xml
CHANGED
@@ -42,5 +42,16 @@
|
|
42 |
<block type="emaildirect/adminhtml_system_convert_profile_export" name="system_convert_profile_run" template="emaildirect/system/convert/profile/export.phtml" output="toHtml"/>
|
43 |
</block>
|
44 |
</emaildirect_admin_export_run>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
</layout>
|
42 |
<block type="emaildirect/adminhtml_system_convert_profile_export" name="system_convert_profile_run" template="emaildirect/system/convert/profile/export.phtml" output="toHtml"/>
|
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="autobox_jfj/adminhtml_customer_merge" name="custom" template="factory/customers/change.phtml" />-->
|
53 |
+
<block type="emaildirect/adminhtml_abandoned" name="abandoned_details" template="widget/grid/container.phtml" />
|
54 |
+
</reference>
|
55 |
+
</emaildirect_admin_abandoned_index>
|
56 |
|
57 |
</layout>
|
app/design/adminhtml/default/default/template/emaildirect/abandoned/grid.phtml
ADDED
File without changes
|
app/design/adminhtml/default/default/template/emaildirect/system/config/fieldset/hint.phtml
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
-
<?php
|
2 |
-
?>
|
3 |
<div class="emaildirect-notice">
|
4 |
<h4>
|
5 |
-
|
|
|
|
|
6 |
</h4>
|
7 |
-
</div>
|
8 |
-
|
|
|
|
|
1 |
<div class="emaildirect-notice">
|
2 |
<h4>
|
3 |
+
<div class='abandoned'>Abandoned Cart Processing:
|
4 |
+
<?php if ($this->getAbandonedEnabled()) : ?><span class='ab_ok'>Enabled</span> - Last Run: <?php echo $this->getAbandonedLastRunHtml() ?> - <button onclick="window.location='<?php echo $this->getUrl('emaildirect/admin_abandoned/index'); ?>'; return false;" id="emaildirect_details">Details</button><?php else: ?><span class='ab_ng'>Disabled</span><?php endif; ?></div>
|
5 |
+
<strong>EmailDirect Integration v<?php echo $this->getEmaildirectVersion() ?></strong>
|
6 |
</h4>
|
7 |
+
</div>
|
|
app/design/adminhtml/default/default/template/emaildirect/system/config/form/field/button.phtml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<!--<button id='emaildirect_export' onClick="window.open('<?php echo $this->getUrl("emaildirect/admin_export/run/"); ?>'); return false;">Export</button>-->
|
2 |
-
<button id='emaildirect_export' onClick="
|
3 |
<script type='text/javascript'>
|
4 |
-
function
|
5 |
{
|
6 |
var form = $('config_edit_form');
|
7 |
var send_to_ed = form['groups[export][fields][send_to_emaildirect][value]'];
|
1 |
<!--<button id='emaildirect_export' onClick="window.open('<?php echo $this->getUrl("emaildirect/admin_export/run/"); ?>'); return false;">Export</button>-->
|
2 |
+
<button id='emaildirect_export' onClick="perform_export(); return false;">Export</button>
|
3 |
<script type='text/javascript'>
|
4 |
+
function perform_export()
|
5 |
{
|
6 |
var form = $('config_edit_form');
|
7 |
var send_to_ed = form['groups[export][fields][send_to_emaildirect][value]'];
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
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="Customer"><dir name="Edit"><dir name="Tab"><file name="Memberactivity.php" hash="02dd48c236fcaeeaaf112b6cbf173942"/></dir></dir></dir><dir name="Memberactivity"><file name="Grid.php" hash="c8b6d5b867078f56dc17112eccb8a2ca"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>EmailDirect_Integration</name>
|
4 |
+
<version>1.3.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>Updated abandoned cart process with working status, last run times and grid to manually view/resend records to your EmailDirect account.</notes>
|
12 |
<authors><author><name>Kevin Linden</name><user>auto-converted</user><email>Kevin@EmailDirect.com</email></author></authors>
|
13 |
+
<date>2013-05-08</date>
|
14 |
+
<time>22:15:51</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="fca58a0cf6eeb3fd61a74da55bbc11bf"/></dir><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Memberactivity.php" hash="02dd48c236fcaeeaaf112b6cbf173942"/></dir></dir></dir><dir name="Memberactivity"><file name="Grid.php" hash="c8b6d5b867078f56dc17112eccb8a2ca"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="d0b5f93c52f84e221ef23ba732c30113"/></dir><dir name="Form"><dir name="Field"><file name="Addressmapfields.php" hash="be908f92dac6d326f5c2defd81a0ec1b"/><file name="Button.php" hash="5eeebb8654eb102d1e0c86792b0f4d41"/><file name="Common.php" hash="2fd2afd99ec1dd3e90f023c8664b66d3"/><file name="Mapfields.php" hash="7c1b30bf71e73af7603a64832abf02d2"/><file name="Shippingmapfields.php" hash="13f478f1794275543e52a6684690edaa"/></dir></dir><file name="Account.php" hash="3289f9687d16f1df81ea8cb5dbaebc99"/></dir><dir name="Convert"><dir name="Profile"><file name="Export.php" hash="a1c7cb8c788062a2e2bde92599bf2919"/></dir></dir></dir><file name="Abandoned.php" hash="60d391f474416c3e954f2761160fd19f"/></dir><dir name="Checkout"><file name="Subscribe.php" hash="e79060600f511308acf6c802be4ade3f"/></dir><dir name="Customer"><dir name="Account"><dir name="Dashboard"><file name="Info.php" hash="61aec01f715bb1fa96e9d57ea839fc18"/></dir><file name="Lists.php" hash="fd043743461c6e6278a0476be1f0017d"/></dir><file name="Newsletter.php" hash="99614d12c08728454ac373db1f2370d8"/></dir><dir name="Email"><dir name="Order"><dir name="Items"><dir name="Order"><file name="Default.php" hash="8d70e1810d6f9ffabc026f1477f9ea9b"/><file name="Grouped.php" hash="c6f7a34722d4dc6e17afb83fe572d164"/></dir></dir><file name="Items.php" hash="771dd865fae0ad4954d8efda93cb9389"/></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="15f6709a7fdc2189cbd879ac996e4535"/><file name="Fields.php" hash="ef45b22e8e8d9fd554bd6f20cf52ddb5"/></dir><dir name="Model"><dir name="Custom"><file name="Collection.php" hash="36cac586b65ea06208b2f419f2472fed"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Export"><file name="Batch.php" hash="15452ded72243a699df5d844d55be03e"/></dir><file name="Abandoned.php" hash="7d8090a39de7dbfa1da0bf91906cf051"/><file name="Abandonedlist.php" hash="02579b2052e51c08f43944272504d418"/><file name="Additionallist.php" hash="2cef8c52aa96496bc21991ddff498ee1"/><file name="Checkoutsubscribe.php" hash="f61bf1d4d07950735c6a8979ef973ae0"/><file name="List.php" hash="4dee4e09bde8fc59abb95e097683c0aa"/><file name="Maxtimes.php" hash="a9596823d86d198ac04aebda7f0f7cd8"/><file name="Publication.php" hash="9e70e04ca599a7d808416c17e028df2c"/><file name="Source.php" hash="1d744b9d98b2f6a72c051f76307b4207"/><file name="Time.php" hash="86c0f7c207ada9a0544d024aacfd9940"/></dir></dir></dir><dir name="Wrapper"><file name="Abandoned.php" hash="36596e0163463e4c4dbcf241a345512c"/><file name="Database.php" hash="299e97253a66306c092f6df725a1840d"/><file name="Execute.php" hash="d8c0a2946540396790369de027e24994"/><file name="Ftp.php" hash="13d4214335e36a1174e5c53bdaafd743"/><file name="Lists.php" hash="1b6b799138cecbf22739d72259232b90"/><file name="Orders.php" hash="c1171eb596606af87af17839b09bd485"/><file name="Publications.php" hash="1908c314209f9cb3d1c6b265cf07bbdd"/><file name="Relays.php" hash="b8d5b394582c65846f0da75133ea2732"/><file name="Sources.php" hash="569e1a953b3fc5611e12be95de35555f"/><file name="Suscribers.php" hash="e86874c31f4afc28e710d82380348d7f"/></dir><file name="Observer.php" hash="a3f0ea49d03d81237fc3b0d2716c149b"/></dir><dir name="controllers"><dir name="Admin"><file name="AbandonedController.php" hash="595acc9e1eb906eb0b7c00945a5c82c7"/><file name="ExportController.php" hash="d23ab90df4910a7ae4f9c5c491e8fd33"/></dir><dir name="Customer"><file name="AccountController.php" hash="e53818ca3db2df13d16cb9419799ede0"/></dir><file name="AbandonedController.php" hash="408f2805e7b9bd7fe149797a01970ca0"/><file name="ExportController.php" hash="d34f5f1842db64f5eb1f18b4938c8c29"/></dir><dir name="etc"><file name="adminhtml.xml" hash="896c10d8a3f932346e7d301052b1b6a6"/><file name="config.xml" hash="8e3ad80e47841fa8857129e3c206ce49"/><file name="system.xml" hash="ad884626b4d1eae73beecdbb8d0ea869"/></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="858e72bfab9435df601f96e904b660bf"/><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="b5de29e427b4983773d935f2f891509f"/></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"/></dir></dir></dir><dir name="convert"><dir name="profile"><file name="export.phtml" hash="86339d17e83bd8dcc2a268b3ace3d9e7"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="emaildirect.xml" hash="0a9d6391a114efc879cd0a4690bfc980"/></dir><dir name="template"><dir name="emaildirect"><dir name="boxes"><file name="additionalNewsletter.phtml" hash="0f9d1b59ea045aae31710451f39695f4"/><file name="additionalNewsletterBox.phtml" hash="441b952761083466eaf931e5f7590694"/><file name="generalNewsletter.phtml" hash="fe109f8490e235b98da9d823a5d34ab7"/><file name="generalNewsletterBox.phtml" hash="d98f4fe4582134c0c00cb51490abfbf4"/><file name="generalNewsletterMediumBox.phtml" hash="db51750f55d41dae4b36ec47bc3a0931"/></dir><dir name="checkout"><file name="subscribe.phtml" hash="cfc5c70f68327277616cc6d08cdb2fc8"/></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="ccebdd94f03c03368f6b33780e68875b"/></dir><file name="lists.phtml" hash="c808667ec668455b39c76dfd400b2abb"/></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>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
skin/adminhtml/default/default/emaildirect/emaildirect.css
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
ul.tabs a.emaildirect-section:hover { background-color:#D8E6E6; background-image:url(images/tabs_link_over_bg.gif); }
|
2 |
|
3 |
ul.tabs a.emaildirect-section,
|
4 |
-
ul.tabs a.emaildirect-section:hover {border-bottom:none; padding:0.5em 0.5em 0 1.5em; text-indent:-9999px;}
|
5 |
|
6 |
ul.tabs a.emaildirect-section span,
|
7 |
ul.tabs a.emaildirect-section:hover span { background:url(emaildirect-tab.png) no-repeat 0 0; overflow:hidden; padding:0; width:120px; height:24px;}
|
@@ -18,5 +18,18 @@ div.emaildirect-notice{
|
|
18 |
background:#EAF0EE;
|
19 |
border:1px solid #CCCCCC;
|
20 |
margin-bottom:10px;
|
21 |
-
padding:11px
|
22 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
ul.tabs a.emaildirect-section:hover { background-color:#D8E6E6; background-image:url(images/tabs_link_over_bg.gif); }
|
2 |
|
3 |
ul.tabs a.emaildirect-section,
|
4 |
+
ul.tabs a.emaildirect-section:hover {background: url("../images/tabs_span_bg.gif") repeat-x scroll 0 100% transparent; border-bottom:none; padding:0.5em 0.5em 0.5em 1.5em; text-indent:-9999px;}
|
5 |
|
6 |
ul.tabs a.emaildirect-section span,
|
7 |
ul.tabs a.emaildirect-section:hover span { background:url(emaildirect-tab.png) no-repeat 0 0; overflow:hidden; padding:0; width:120px; height:24px;}
|
18 |
background:#EAF0EE;
|
19 |
border:1px solid #CCCCCC;
|
20 |
margin-bottom:10px;
|
21 |
+
padding:11px 10px 5px;
|
22 |
}
|
23 |
+
|
24 |
+
div.emaildirect-notice h4
|
25 |
+
{
|
26 |
+
color: #EA7601;
|
27 |
+
}
|
28 |
+
|
29 |
+
div.emaildirect-notice h4 div.abandoned
|
30 |
+
{
|
31 |
+
float: right;
|
32 |
+
}
|
33 |
+
|
34 |
+
.ab_ok { color: green; }
|
35 |
+
.ab_ng { color: red; }
|