Version Notes
Abandoned Cart process improvements.
Improved HTTPS support.
Download this release
Release Info
Developer | Magento Core Team |
Extension | EmailDirect_Integration |
Version | 2.0.13 |
Comparing to | |
See all releases |
Code changes from version 2.0.12 to 2.0.13
- app/code/community/EmailDirect/Integration/Block/Adminhtml/System/Config/Fieldset/Hint.php +32 -32
- app/code/community/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View.php +4 -4
- app/code/community/EmailDirect/Integration/Block/Customer/Account/Dashboard/Info.php +0 -27
- app/code/community/EmailDirect/Integration/Block/Customer/Account/Lists.php +8 -8
- app/code/community/EmailDirect/Integration/Block/Signup.php +4 -6
- app/code/community/EmailDirect/Integration/Helper/Data.php +215 -210
- app/code/community/EmailDirect/Integration/Helper/Fields.php +169 -169
- app/code/community/EmailDirect/Integration/Model/Abandoned/Observer.php +324 -318
- app/code/community/EmailDirect/Integration/Model/Customer/Observer.php +258 -259
- app/code/community/EmailDirect/Integration/Model/Newsletter/Observer.php +248 -248
- app/code/community/EmailDirect/Integration/controllers/AbandonedController.php +53 -53
- app/code/community/EmailDirect/Integration/controllers/Admin/TroubleshootingController.php +47 -47
- app/code/community/EmailDirect/Integration/controllers/Customer/AccountController.php +172 -167
- app/code/community/EmailDirect/Integration/etc/adminhtml.xml +51 -51
- app/code/community/EmailDirect/Integration/etc/config.xml +2 -2
- app/code/community/EmailDirect/Integration/etc/system.xml +14 -14
- app/design/frontend/base/default/layout/emaildirect.xml +46 -46
- app/design/frontend/base/default/template/emaildirect/customer/account/dashboard/info.phtml +50 -47
- package.xml +7 -5
- skin/frontend/base/default/emaildirect/integration.js +0 -1
app/code/community/EmailDirect/Integration/Block/Adminhtml/System/Config/Fieldset/Hint.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
<?php
|
2 |
|
3 |
class EmailDirect_Integration_Block_Adminhtml_System_Config_Fieldset_Hint
|
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 |
}
|
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
|
6 |
{
|
7 |
+
protected $_template = 'emaildirect/system/config/fieldset/hint.phtml';
|
8 |
|
9 |
+
/**
|
10 |
+
* Render fieldsetset html
|
11 |
+
*
|
12 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
16 |
+
{
|
17 |
+
return $this->toHtml();
|
18 |
+
}
|
19 |
|
20 |
+
public function getEmaildirectVersion()
|
21 |
+
{
|
22 |
+
return (string) Mage::getConfig()->getNode('modules/EmailDirect_Integration/version');
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getAbandonedLastRunHtml()
|
26 |
+
{
|
27 |
+
return Mage::helper('emaildirect')->getAbandonedLastRunHtml();
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getAbandonedEnabled()
|
31 |
+
{
|
32 |
+
return Mage::helper('emaildirect')->getAbandonedEnabled();
|
33 |
+
}
|
34 |
+
|
35 |
+
public function isWebsiteConfig()
|
36 |
+
{
|
37 |
+
return Mage::helper('emaildirect')->isWebsiteConfig();
|
38 |
+
}
|
39 |
}
|
app/code/community/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View.php
CHANGED
@@ -9,17 +9,17 @@ class EmailDirect_Integration_Block_Adminhtml_Troubleshooting_View extends Mage_
|
|
9 |
$this->_mode = 'view';
|
10 |
|
11 |
parent::__construct();
|
12 |
-
|
13 |
$this->_removeButton('delete');
|
14 |
$this->_removeButton('reset');
|
15 |
$this->_removeButton('save');
|
16 |
$this->setId('troubleshooting_view');
|
17 |
-
|
18 |
$this->_addButton('refresh', array(
|
19 |
'label' => Mage::helper('emaildirect')->__('Refresh'),
|
20 |
'onclick' => 'window.location.reload();',
|
21 |
));
|
22 |
-
|
23 |
$this->setTemplate('emaildirect/troubleshooting/view.phtml');
|
24 |
}
|
25 |
|
@@ -32,7 +32,7 @@ class EmailDirect_Integration_Block_Adminhtml_Troubleshooting_View extends Mage_
|
|
32 |
{
|
33 |
return parent::getUrl($params, $params2);
|
34 |
}
|
35 |
-
|
36 |
public function getBackUrl()
|
37 |
{
|
38 |
return Mage::helper('emaildirect')->getAdminUrl('adminhtml/system_config/edit/section/emaildirect');
|
9 |
$this->_mode = 'view';
|
10 |
|
11 |
parent::__construct();
|
12 |
+
|
13 |
$this->_removeButton('delete');
|
14 |
$this->_removeButton('reset');
|
15 |
$this->_removeButton('save');
|
16 |
$this->setId('troubleshooting_view');
|
17 |
+
|
18 |
$this->_addButton('refresh', array(
|
19 |
'label' => Mage::helper('emaildirect')->__('Refresh'),
|
20 |
'onclick' => 'window.location.reload();',
|
21 |
));
|
22 |
+
|
23 |
$this->setTemplate('emaildirect/troubleshooting/view.phtml');
|
24 |
}
|
25 |
|
32 |
{
|
33 |
return parent::getUrl($params, $params2);
|
34 |
}
|
35 |
+
|
36 |
public function getBackUrl()
|
37 |
{
|
38 |
return Mage::helper('emaildirect')->getAdminUrl('adminhtml/system_config/edit/section/emaildirect');
|
app/code/community/EmailDirect/Integration/Block/Customer/Account/Dashboard/Info.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class EmailDirect_Integration_Block_Customer_Account_Dashboard_Info extends Mage_Customer_Block_Account_Dashboard_Info
|
4 |
-
{
|
5 |
-
protected function _toHtml()
|
6 |
-
{
|
7 |
-
if (!Mage::helper('emaildirect')->canEDirect())
|
8 |
-
return parent::_toHtml();
|
9 |
-
|
10 |
-
return parent::_toHtml();
|
11 |
-
}
|
12 |
-
|
13 |
-
public function getSubscriptions()
|
14 |
-
{
|
15 |
-
return Mage::helper('emaildirect')->getSubscriptions($this->_getEmail());
|
16 |
-
}
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Retrieve email from Customer object in session
|
20 |
-
*
|
21 |
-
* @return string Email address
|
22 |
-
*/
|
23 |
-
protected function _getEmail()
|
24 |
-
{
|
25 |
-
return $this->helper('customer')->getCustomer()->getEmail();
|
26 |
-
}
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/EmailDirect/Integration/Block/Customer/Account/Lists.php
CHANGED
@@ -3,16 +3,16 @@
|
|
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')
|
@@ -20,12 +20,12 @@ class EmailDirect_Integration_Block_Customer_Account_Lists extends Mage_Core_Blo
|
|
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 |
|
@@ -40,7 +40,7 @@ class EmailDirect_Integration_Block_Customer_Account_Lists extends Mage_Core_Blo
|
|
40 |
|
41 |
return $checkbox->getLabelHtml() . $checkbox->getElementHtml();
|
42 |
}
|
43 |
-
|
44 |
/**
|
45 |
* Utility to generate HTML name for element
|
46 |
* @param string $list
|
@@ -70,7 +70,7 @@ class EmailDirect_Integration_Block_Customer_Account_Lists extends Mage_Core_Blo
|
|
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 |
}
|
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')
|
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 |
|
40 |
|
41 |
return $checkbox->getLabelHtml() . $checkbox->getElementHtml();
|
42 |
}
|
43 |
+
|
44 |
/**
|
45 |
* Utility to generate HTML name for element
|
46 |
* @param string $list
|
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 |
}
|
app/code/community/EmailDirect/Integration/Block/Signup.php
CHANGED
@@ -22,13 +22,11 @@ class EmailDirect_Integration_Block_Signup extends Mage_Core_Block_Template
|
|
22 |
|
23 |
public function getSignupCheckUrl()
|
24 |
{
|
|
|
|
|
25 |
if (Mage::app()->getStore()->isCurrentlySecure())
|
26 |
-
|
27 |
-
return Mage::getUrl('emaildirect/signup/check',array(
|
28 |
-
'_secure' => true
|
29 |
-
));
|
30 |
-
}
|
31 |
|
32 |
-
return $this->getUrl('emaildirect/signup/check');
|
33 |
}
|
34 |
}
|
22 |
|
23 |
public function getSignupCheckUrl()
|
24 |
{
|
25 |
+
$arguments = array();
|
26 |
+
|
27 |
if (Mage::app()->getStore()->isCurrentlySecure())
|
28 |
+
$arguments['_secure'] = true;
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
return $this->getUrl('emaildirect/signup/check', $arguments);
|
31 |
}
|
32 |
}
|
app/code/community/EmailDirect/Integration/Helper/Data.php
CHANGED
@@ -3,44 +3,49 @@
|
|
3 |
class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
const DATE_FORMAT = "Y-m-d H:i:s";
|
6 |
-
|
7 |
const DISABLED_REASON_PREFIX = "Skipping";
|
8 |
-
|
9 |
protected $_logger = null;
|
10 |
-
|
11 |
public function __construct()
|
12 |
{
|
13 |
$this->_logger = Mage::helper('emaildirect/troubleshooting');
|
14 |
}
|
15 |
-
|
16 |
protected function logAndDebug($data)
|
17 |
{
|
18 |
$this->_logger->logAndDebug($data);
|
19 |
}
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
21 |
protected function debug($data)
|
22 |
{
|
23 |
$this->_logger->debug($data);
|
24 |
}
|
25 |
-
|
26 |
protected function debugHeader($data, $level = 2)
|
27 |
{
|
28 |
$this->_logger->debugHeader($data, $level);
|
29 |
}
|
30 |
-
|
31 |
public function getMergeVars($customer)
|
32 |
{
|
33 |
$merge_vars = array();
|
34 |
$maps = unserialize( $this->config('map_fields', $customer->getStoreId()) );
|
35 |
-
|
36 |
if ($maps)
|
37 |
{
|
38 |
$this->debug("Customer Field Mapping");
|
39 |
$this->processMap($merge_vars, $maps, $customer);
|
40 |
}
|
41 |
-
|
42 |
$address_maps = unserialize( $this->config('address_fields', $customer->getStoreId()) );
|
43 |
-
|
44 |
// Process address
|
45 |
if ($address_maps)
|
46 |
{
|
@@ -58,19 +63,19 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
58 |
protected function processMap(&$merge_vars,$maps, $data)
|
59 |
{
|
60 |
$request = Mage::app()->getRequest();
|
61 |
-
|
62 |
$this->debug("Mappings");
|
63 |
$this->debug($maps);
|
64 |
-
|
65 |
$this->debug("Map Data");
|
66 |
$this->debug($data);
|
67 |
-
|
68 |
foreach ($maps as $map)
|
69 |
{
|
70 |
// Make sure we have values for both
|
71 |
if (!isset($map['magento']) || !isset($map['emaildirect']))
|
72 |
continue;
|
73 |
-
|
74 |
$custom_field = $map['magento'];
|
75 |
$emaildirect_field = $map['emaildirect'];
|
76 |
|
@@ -81,17 +86,17 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
81 |
case 'state_code':
|
82 |
{
|
83 |
$region_id = $data->getData('region_id');
|
84 |
-
|
85 |
if (!$region_id)
|
86 |
continue;
|
87 |
|
88 |
$region = Mage::getModel('directory/region')->load($region_id);
|
89 |
-
|
90 |
if (!$region)
|
91 |
continue;
|
92 |
-
|
93 |
$state_code = $region->getCode();
|
94 |
-
|
95 |
if ($state_code != "")
|
96 |
$merge_vars[$emaildirect_field] = $state_code;
|
97 |
} break;
|
@@ -108,25 +113,25 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
108 |
protected function getProduct($item)
|
109 |
{
|
110 |
$product_id = $item->getProductId();
|
111 |
-
|
112 |
if (!$product_id)
|
113 |
return null;
|
114 |
-
|
115 |
$product = Mage::getModel('catalog/product')->load($product_id);
|
116 |
-
|
117 |
if ($product == null || !$product->getId())
|
118 |
return null;
|
119 |
-
|
120 |
return $product;
|
121 |
}
|
122 |
-
|
123 |
// Used to restore configurable products to the cart
|
124 |
public function getConfigurableOptions($product, $simple_product_id)
|
125 |
{
|
126 |
$type_instance = $product->getTypeInstance(true);
|
127 |
$child_products = $type_instance->getUsedProducts(null, $product);
|
128 |
$attrbutes = $type_instance->getUsedProductAttributes($product);
|
129 |
-
|
130 |
$super_attrbutes = array();
|
131 |
|
132 |
foreach ($child_products as $child)
|
@@ -139,15 +144,15 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
139 |
}
|
140 |
}
|
141 |
}
|
142 |
-
|
143 |
return $super_attrbutes;
|
144 |
}
|
145 |
-
|
146 |
public function getStoreId($code)
|
147 |
{
|
148 |
if ($code == null)
|
149 |
return 0;
|
150 |
-
|
151 |
try
|
152 |
{
|
153 |
$store = Mage::getModel("core/store")->load($code);
|
@@ -158,51 +163,51 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
158 |
return 0;
|
159 |
}
|
160 |
}
|
161 |
-
|
162 |
public function getAdminStore()
|
163 |
{
|
164 |
$code = Mage::app()->getRequest()->getParam('store');
|
165 |
-
|
166 |
return $this->getStoreId($code);
|
167 |
}
|
168 |
-
|
169 |
public function getUrlParams()
|
170 |
{
|
171 |
$param_options = array('store','group','website');
|
172 |
-
|
173 |
$request = Mage::app()->getRequest();
|
174 |
-
|
175 |
foreach ($param_options as $param)
|
176 |
{
|
177 |
if ($request->getParam($param) != null)
|
178 |
return array($param => $request->getParam($param));
|
179 |
}
|
180 |
-
|
181 |
return array();
|
182 |
}
|
183 |
-
|
184 |
public function forceSubscribe()
|
185 |
{
|
186 |
$option = (int)$this->config('checkout_subscribe');
|
187 |
-
|
188 |
// Force subscribe on
|
189 |
if ($option == 3)
|
190 |
return true;
|
191 |
-
|
192 |
return false;
|
193 |
}
|
194 |
-
|
195 |
public function getOrderExportCollection($from, $to, $include, $store = null)
|
196 |
{
|
197 |
$from_date = Mage::getModel('core/date')->gmtDate(null,strtotime($from)); // 2010-05-11 15:00:00
|
198 |
-
|
199 |
$to_date = Mage::getModel('core/date')->gmtDate(null,strtotime($to)); // 2010-05-11 15:00:00
|
200 |
-
|
201 |
$orders = Mage::getModel('sales/order')->getCollection()
|
202 |
->addAttributeToFilter('created_at', array('from' => $from_date, 'to' => $to_date));
|
203 |
-
|
204 |
$mode = $this->config('send_field');
|
205 |
-
|
206 |
if ($mode == 'state')
|
207 |
{
|
208 |
$states = Mage::helper('emaildirect')->config('send_states');
|
@@ -215,10 +220,10 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
215 |
$status_list = explode(",",$statuses);
|
216 |
$orders->addAttributeToFilter('status', array('in' => $status_list));
|
217 |
}
|
218 |
-
|
219 |
if ($store != null && $store != 0)
|
220 |
$orders->addAttributeToFilter('store_id', array('eq' => $store));
|
221 |
-
|
222 |
if (!$include)
|
223 |
{
|
224 |
$orders->getSelect()->joinLeft(array('ed_or' => Mage::getSingleton('core/resource')->getTableName("emaildirect/order")),"ed_or.order_id=main_table.entity_id",array(
|
@@ -226,37 +231,37 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
226 |
));
|
227 |
$orders->getSelect()->where('`ed_or`.`date_sent` IS NULL');
|
228 |
}
|
229 |
-
|
230 |
return $orders;
|
231 |
}
|
232 |
-
|
233 |
public function getProductExportCollection($include = false, $store = null)
|
234 |
{
|
235 |
$products = Mage::getModel('catalog/product')->getCollection();
|
236 |
-
|
237 |
if ($include == false)
|
238 |
$products->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
239 |
-
|
240 |
if ($store != null && $store != 0)
|
241 |
$products->addStoreFilter($store);
|
242 |
-
|
243 |
return $products;
|
244 |
}
|
245 |
-
|
246 |
public function formatSize($size)
|
247 |
{
|
248 |
try
|
249 |
{
|
250 |
if ($size == 0 || $size == null || $size == "")
|
251 |
return "0 b";
|
252 |
-
|
253 |
$unit = array('b','kb','mb','gb','tb','pb');
|
254 |
-
|
255 |
$numeric_size = @round($size/pow(1024,($i=$size?floor(log($size,1024)):0)),2);
|
256 |
-
|
257 |
if (!isset($unit[$i]))
|
258 |
return "Unknown";
|
259 |
-
|
260 |
return "{$numeric_size} {$unit[$i]}";
|
261 |
}
|
262 |
catch (Exception $e)
|
@@ -265,17 +270,17 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
265 |
return "Unknown";
|
266 |
}
|
267 |
}
|
268 |
-
|
269 |
public function getDuration($timeline, $zero = false)
|
270 |
{
|
271 |
$periods = array('day' => 86400, 'hour' => 3600, 'minute' => 60);
|
272 |
-
|
273 |
$ret = "";
|
274 |
|
275 |
foreach($periods as $name => $seconds)
|
276 |
{
|
277 |
$num = floor($timeline / $seconds);
|
278 |
-
|
279 |
if ($num > 0 || ($num == 0 && $zero == true))
|
280 |
{
|
281 |
$timeline -= ($num * $seconds);
|
@@ -285,27 +290,27 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
285 |
|
286 |
return trim($ret);
|
287 |
}
|
288 |
-
|
289 |
public function timeElapsed2string($time)
|
290 |
{
|
291 |
if ($time == "")
|
292 |
return "";
|
293 |
-
|
294 |
if (is_string($time))
|
295 |
$time = strtotime($time);
|
296 |
-
|
297 |
$timeline = time() - $time;
|
298 |
-
|
299 |
return $this->getDuration($timeline);
|
300 |
}
|
301 |
|
302 |
public function getExportFileName($name,$full = true)
|
303 |
{
|
304 |
$filename = "{$name}.csv";
|
305 |
-
|
306 |
if ($full)
|
307 |
return Mage::getBaseDir('export').'/' . $filename;
|
308 |
-
|
309 |
return $filename;
|
310 |
}
|
311 |
|
@@ -313,66 +318,66 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
313 |
{
|
314 |
return $this->config('apikey',$store);
|
315 |
}
|
316 |
-
|
317 |
public function isWebsiteConfig()
|
318 |
{
|
319 |
$request = Mage::app()->getRequest();
|
320 |
-
|
321 |
if ($request->getParam('website') && !$request->getParam('store'))
|
322 |
return true;
|
323 |
-
|
324 |
return false;
|
325 |
}
|
326 |
-
|
327 |
public function updateConfig($path, $value, $store = 0, $base_path = 'general')
|
328 |
{
|
329 |
$scope = "stores";
|
330 |
-
|
331 |
if ($store == null)
|
332 |
$store = $this->getCurrentStore();
|
333 |
-
|
334 |
if ($store == 0)
|
335 |
$scope = "default";
|
336 |
-
|
337 |
$config = Mage::getConfig();
|
338 |
$config->saveConfig("emaildirect/{$base_path}/{$path}",$value,$scope,$store);
|
339 |
$config->cleanCache();
|
340 |
}
|
341 |
-
|
342 |
public function deleteConfig($path, $store = 0, $base_path = 'general')
|
343 |
{
|
344 |
$scope = "stores";
|
345 |
-
|
346 |
if ($store == null)
|
347 |
$store = $this->getCurrentStore();
|
348 |
-
|
349 |
if ($store == 0)
|
350 |
$scope = "default";
|
351 |
-
|
352 |
$config = Mage::getConfig();
|
353 |
$config->deleteConfig("emaildirect/{$base_path}/{$path}",$scope,$store);
|
354 |
$config->cleanCache();
|
355 |
}
|
356 |
-
|
357 |
public function resetCurrentStore()
|
358 |
{
|
359 |
$this->_current_store = null;
|
360 |
}
|
361 |
-
|
362 |
public function getCurrentStore()
|
363 |
{
|
364 |
$store = Mage::app()->getStore()->getId();
|
365 |
$config_store = Mage::app()->getRequest()->getParam('store');
|
366 |
$on_config = $this->onConfigPage();
|
367 |
-
|
368 |
if ($config_store && $on_config)
|
369 |
$store = $config_store;
|
370 |
//else if (!is_null($this->_current_store))
|
371 |
// $store = $this->_current_store;
|
372 |
-
|
373 |
if (is_string($store))
|
374 |
return $this->getStoreId($store);
|
375 |
-
|
376 |
return $store;
|
377 |
}
|
378 |
|
@@ -380,11 +385,11 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
380 |
{
|
381 |
if (is_null($store))
|
382 |
$store = $this->getCurrentStore();
|
383 |
-
|
384 |
//echo "emaildirect/{$section}/{$value}";
|
385 |
-
|
386 |
$realvalue = Mage::getStoreConfig("emaildirect/{$section}/{$value}", $store);
|
387 |
-
|
388 |
return $realvalue;
|
389 |
}
|
390 |
|
@@ -392,57 +397,57 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
392 |
{
|
393 |
return $this->_config($value,'general',$store);
|
394 |
}
|
395 |
-
|
396 |
public function exportConfig($value, $store = null)
|
397 |
{
|
398 |
return $this->_config($value,'export',$store);
|
399 |
}
|
400 |
-
|
401 |
public function troubleConfig($value, $store = null)
|
402 |
{
|
403 |
return $this->_config($value,'troubleshooting',$store);
|
404 |
}
|
405 |
-
|
406 |
public function getEmailDirectColumnOptions()
|
407 |
{
|
408 |
$columns = Mage::getSingleton('emaildirect/wrapper_database')->getAllColumns();
|
409 |
-
|
410 |
$custom_fields = Mage::helper('emaildirect/fields')->getCustomFields(true);
|
411 |
-
|
412 |
$invalid_columns = array();
|
413 |
-
|
414 |
foreach ($custom_fields as $cf)
|
415 |
{
|
416 |
$invalid_columns[] = $cf['name'];
|
417 |
}
|
418 |
-
|
419 |
$options = array();
|
420 |
-
|
421 |
if (!isset($columns))
|
422 |
return $options;
|
423 |
-
|
424 |
foreach ($columns as $column)
|
425 |
{
|
426 |
if ($column->IsCustom == 'true' && !in_array((string)$column->ColumnName,$invalid_columns))
|
427 |
{
|
428 |
$key = (string)$column->ColumnName;
|
429 |
-
|
430 |
$options[$key] = $key;
|
431 |
}
|
432 |
}
|
433 |
-
|
434 |
return $options;
|
435 |
}
|
436 |
-
|
437 |
public function getShippingColumnOptions()
|
438 |
{
|
439 |
$options = array(
|
440 |
'shipping_code' => 'Shipping Code',
|
441 |
'shipping_description' => 'Shipping Description',
|
442 |
'carrier_code' => 'Tracking Carrier Code',
|
443 |
-
'title' => 'Tracking Title',
|
444 |
'number' => 'Tracking Number');
|
445 |
-
|
446 |
return $options;
|
447 |
}
|
448 |
|
@@ -450,20 +455,20 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
450 |
{
|
451 |
return $this->config('publication', $storeId);
|
452 |
}
|
453 |
-
|
454 |
public function isSignupTest()
|
455 |
{
|
456 |
return Mage::app()->getRequest()->getParam('signup_test') == "true";
|
457 |
}
|
458 |
-
|
459 |
public function canCapture()
|
460 |
{
|
461 |
if (!$this->canEdirect())
|
462 |
return false;
|
463 |
-
|
464 |
if ((bool)($this->config('capture_enabled') != 0) && !Mage::helper('customer')->isLoggedIn())
|
465 |
return true;
|
466 |
-
|
467 |
return false;
|
468 |
}
|
469 |
|
@@ -471,21 +476,21 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
471 |
{
|
472 |
if (!$this->canEdirect())
|
473 |
return false;
|
474 |
-
|
475 |
if (Mage::helper('customer')->isLoggedIn() && (bool)($this->config('wishlist_enabled') != 0))
|
476 |
return true;
|
477 |
-
|
478 |
return false;
|
479 |
}
|
480 |
-
|
481 |
public function canSendLastLogin()
|
482 |
{
|
483 |
if (!$this->canEdirect())
|
484 |
return false;
|
485 |
-
|
486 |
if (Mage::helper('customer')->isLoggedIn() && (bool)($this->config('lastlogin_enabled') != 0))
|
487 |
return true;
|
488 |
-
|
489 |
return false;
|
490 |
}
|
491 |
|
@@ -493,25 +498,25 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
493 |
{
|
494 |
if (!$this->canEdirect())
|
495 |
return false;
|
496 |
-
|
497 |
if ((bool)($this->config('signup_enabled') == 0) || (bool)($this->config('signup_activated') == 0))
|
498 |
return false;
|
499 |
-
|
500 |
return true;
|
501 |
}
|
502 |
-
|
503 |
public function canShowSignup()
|
504 |
{
|
505 |
if ($this->isSignupTest())
|
506 |
return true;
|
507 |
-
|
508 |
if (!$this->isSignupEnabled())
|
509 |
return false;
|
510 |
-
|
511 |
$last_closed = Mage::getModel('core/cookie')->get('ed_signup');
|
512 |
-
|
513 |
$recurrence = $this->config('signup_recurrence');
|
514 |
-
|
515 |
if ($last_closed == "")
|
516 |
return true;
|
517 |
|
@@ -521,42 +526,42 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
521 |
default:
|
522 |
$last_closed = strtotime("+{$recurrence}",$last_closed); break;
|
523 |
}
|
524 |
-
|
525 |
if ($last_closed > time())
|
526 |
return false;
|
527 |
-
|
528 |
return true;
|
529 |
}
|
530 |
-
|
531 |
public function canCheckoutSubscribe()
|
532 |
{
|
533 |
if (!$this->canEdirect())
|
534 |
return false;
|
535 |
-
|
536 |
return (bool)($this->config('checkout_subscribe') != 0);
|
537 |
}
|
538 |
-
|
539 |
public function canEdirect()
|
540 |
{
|
541 |
// Necessary?
|
542 |
//Mage::helper('core')->isModuleOutputEnabled('EmailDirect_Integration');
|
543 |
-
|
544 |
$active = $this->config('active');
|
545 |
$setup = $this->config('setup');
|
546 |
-
|
547 |
if ($active && $setup)
|
548 |
return true;
|
549 |
-
|
550 |
return $this->onConfigPage();
|
551 |
}
|
552 |
-
|
553 |
public function onConfigPage()
|
554 |
{
|
555 |
$controller = Mage::app()->getRequest()->getControllerName();
|
556 |
-
|
557 |
if ($controller == 'system_config')
|
558 |
return true;
|
559 |
-
|
560 |
return false;
|
561 |
}
|
562 |
|
@@ -576,81 +581,81 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
576 |
$customer->setPrimaryShippingAddress($order->getShippingAddress());
|
577 |
Mage::register('ed_guest_customer', $customer, TRUE);
|
578 |
}
|
579 |
-
|
580 |
public function getFullStoreName($store)
|
581 |
{
|
582 |
if ($store == null)
|
583 |
return "Unknown";
|
584 |
-
|
585 |
$store_name = "";
|
586 |
-
|
587 |
if ($website = $store->getWebsite())
|
588 |
$store_name .= $website->getName() . " - ";
|
589 |
-
|
590 |
if ($group = $store->getGroup())
|
591 |
$store_name .= $group->getName() . " - ";
|
592 |
-
|
593 |
$store_name .= $store->getName();
|
594 |
-
|
595 |
return $store_name;
|
596 |
}
|
597 |
-
|
598 |
public function getFullStoreNameById($store_id)
|
599 |
{
|
600 |
$store = Mage::getModel('core/store')->load($store_id);
|
601 |
-
|
602 |
return $this->getFullStoreName($store);
|
603 |
}
|
604 |
-
|
605 |
public function getAbandonedStatus()
|
606 |
{
|
607 |
$stores = Mage::app()->getStores();
|
608 |
-
|
609 |
$abandoned_status = array(
|
610 |
'enabled' => false,
|
611 |
'cron_last_run' => $this->getCronLastRunHtml(),
|
612 |
'stores' => array()
|
613 |
);
|
614 |
-
|
615 |
foreach ($stores as $store)
|
616 |
{
|
617 |
$data = array();
|
618 |
-
|
619 |
$data['id'] = $store->getId();
|
620 |
$data['name'] = $this->getFullStoreName($store);
|
621 |
$data['enabled'] = $this->getAbandonedEnabled($store->getId());
|
622 |
if ($data['enabled'])
|
623 |
$abandoned_status['enabled'] = true;
|
624 |
-
|
625 |
$data['last_run'] = $this->getAbandonedLastRunhtml($store->getId());
|
626 |
-
|
627 |
$abandoned_status['stores'][] = $data;
|
628 |
}
|
629 |
-
|
630 |
return $abandoned_status;
|
631 |
}
|
632 |
-
|
633 |
public function getCronLastRun($store = null, $config = 'abandoned_last_run')
|
634 |
{
|
635 |
$last_run = $this->config($config, $store);
|
636 |
-
|
637 |
$data = array();
|
638 |
-
|
639 |
if ($last_run != null)
|
640 |
{
|
641 |
$data['last_run'] = $last_run;
|
642 |
-
|
643 |
$minutes = round(abs(time() - strtotime($last_run)) / 60,0);
|
644 |
-
|
645 |
$data['minutes'] = $minutes;
|
646 |
-
|
647 |
if ($minutes > 60)
|
648 |
$data['class'] = 'ab_ng';
|
649 |
else
|
650 |
$data['class'] = 'ab_ok';
|
651 |
-
|
652 |
$data['last_run_display'] = Mage::helper('core')->formatTime($last_run, 'long', true);
|
653 |
-
$data['time_elapsed'] = $this->timeElapsed2string($last_run);
|
654 |
}
|
655 |
else
|
656 |
{
|
@@ -660,7 +665,7 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
660 |
$data['time_elapsed'] = "";
|
661 |
$data['class'] = 'ab_ng';
|
662 |
}
|
663 |
-
|
664 |
return $data;
|
665 |
}
|
666 |
|
@@ -668,15 +673,15 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
668 |
{
|
669 |
$data = $this->getCronLastRun($store,$config);
|
670 |
$warning_img = "";
|
671 |
-
|
672 |
if ($data['class'] == "ab_ng")
|
673 |
$warning_img = "<a href='" . $this->getAdminUrl("ed_integration/admin_troubleshooting/index") . "#abandoned_carts' target='_blank'><img src='" . Mage::getDesign()->getSkinUrl('images/warning_msg_icon.gif') . "' class='cron_warning' /></a>";
|
674 |
-
|
675 |
$time_elapsed = "";
|
676 |
-
|
677 |
if ($data['time_elapsed'] != '')
|
678 |
$time_elapsed = "({$data['time_elapsed']})";
|
679 |
-
|
680 |
return "<span class='{$data['class']}'>{$data['last_run_display']} {$time_elapsed}</span>{$warning_img}";
|
681 |
}
|
682 |
|
@@ -684,7 +689,7 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
684 |
{
|
685 |
return $this->getLastRunHtml($store);
|
686 |
}
|
687 |
-
|
688 |
public function getCronLastRunHtml()
|
689 |
{
|
690 |
return $this->getLastRunHtml(0, 'cron_last_run');
|
@@ -694,152 +699,152 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
694 |
{
|
695 |
$request = Mage::app()->getRequest();
|
696 |
$url_params = array('website','store');
|
697 |
-
|
698 |
foreach ($url_params as $up)
|
699 |
{
|
700 |
if ($request->getParam($up))
|
701 |
$params[$up] = $request->getParam($up);
|
702 |
}
|
703 |
-
|
704 |
return $params;
|
705 |
}
|
706 |
-
|
707 |
public function getAdminUrl($url, $params = array())
|
708 |
{
|
709 |
$params = $this->getAdminUrlParams($params);
|
710 |
-
|
711 |
return Mage::helper("adminhtml")->getUrl($url, $params);
|
712 |
}
|
713 |
-
|
714 |
public function getOrdersEnabled()
|
715 |
{
|
716 |
$active = $this->config('active');
|
717 |
$setup = $this->config('setup');
|
718 |
$sendit = $this->config('sendorder');
|
719 |
-
|
720 |
if (!$sendit || !$setup || !$active)
|
721 |
return false;
|
722 |
-
|
723 |
return true;
|
724 |
}
|
725 |
-
|
726 |
public function getBatchEnabled()
|
727 |
{
|
728 |
$active = $this->config('active');
|
729 |
$setup = $this->config('setup');
|
730 |
$batch = $this->config('batch_enabled');
|
731 |
-
|
732 |
if (!$batch || !$setup || !$active)
|
733 |
return false;
|
734 |
-
|
735 |
return true;
|
736 |
}
|
737 |
-
|
738 |
public function getBatchOnly()
|
739 |
{
|
740 |
$batch_only = $this->config('batch_only');
|
741 |
-
|
742 |
if (!$batch_only)
|
743 |
return false;
|
744 |
-
|
745 |
return true;
|
746 |
}
|
747 |
-
|
748 |
public function getDisabledReason()
|
749 |
{
|
750 |
if (!$this->config('active'))
|
751 |
return "EmailDirect Module is Disabled.";
|
752 |
-
|
753 |
if (!$this->config('setup'))
|
754 |
return "EmailDirect Module is not configured with a valid API Key.";
|
755 |
-
|
756 |
return "";
|
757 |
}
|
758 |
-
|
759 |
public function getOrdersDisabledReason()
|
760 |
{
|
761 |
$base = $this->getDisabledReason();
|
762 |
-
|
763 |
if ($base != "")
|
764 |
return $base;
|
765 |
-
|
766 |
return "Sending Orders is disabled.";
|
767 |
}
|
768 |
-
|
769 |
public function getWishlistDisabledReason()
|
770 |
{
|
771 |
$base = $this->getDisabledReason();
|
772 |
-
|
773 |
if ($base != "")
|
774 |
return $base;
|
775 |
-
|
776 |
if (!Mage::helper('customer')->isLoggedIn())
|
777 |
return "Customer not logged in";
|
778 |
-
|
779 |
return "Wishlist is disabled.";
|
780 |
}
|
781 |
-
|
782 |
public function getLastLoginDisabledReason()
|
783 |
{
|
784 |
$base = $this->getDisabledReason();
|
785 |
-
|
786 |
if ($base != "")
|
787 |
return $base;
|
788 |
-
|
789 |
//if (!Mage::helper('customer')->isLoggedIn())
|
790 |
//return "Customer not logged in";
|
791 |
-
|
792 |
return "Last Login is disabled.";
|
793 |
}
|
794 |
-
|
795 |
public function getBatchDisabledReason()
|
796 |
{
|
797 |
$base = $this->getDisabledReason();
|
798 |
-
|
799 |
if ($base != "")
|
800 |
return $base;
|
801 |
-
|
802 |
return "Sending Orders in batch is disabled.";
|
803 |
}
|
804 |
-
|
805 |
public function getAbandonedEnabled($store = null)
|
806 |
{
|
807 |
$active = $this->config('active', $store);
|
808 |
$setup = $this->config('setup', $store);
|
809 |
$sendit = $this->config('sendabandoned', $store);
|
810 |
$abandoned_setup = $this->config('abandonedsetup', $store);
|
811 |
-
|
812 |
if (!$sendit || !$setup || !$active || !$abandoned_setup)
|
813 |
return false;
|
814 |
-
|
815 |
return true;
|
816 |
}
|
817 |
|
818 |
public function getAbandonedDisabledReason()
|
819 |
{
|
820 |
$base = $this->getDisabledReason();
|
821 |
-
|
822 |
if ($base != "")
|
823 |
return $base;
|
824 |
-
|
825 |
if (!$this->config('abandonedsetup'))
|
826 |
return "Abandoned Cart Processing Not Setup.";
|
827 |
-
|
828 |
return "Sending Abandoned Carts is Disabled";
|
829 |
}
|
830 |
-
|
831 |
// Newsletter
|
832 |
-
|
833 |
private function getSubscriberData($data, $email)
|
834 |
{
|
835 |
$properties = Mage::getSingleton('emaildirect/wrapper_subscribers')->getProperties($email);
|
836 |
$pub_count = 0;
|
837 |
$list_count = 0;
|
838 |
$publication_subscribed = false;
|
839 |
-
|
840 |
if (!isset($properties->Publications->Publication))
|
841 |
return $data;
|
842 |
-
|
843 |
foreach($properties->Publications->Publication as $publication)
|
844 |
{
|
845 |
if ((int) $publication->PublicationID == $data['publication']['id'])
|
@@ -849,9 +854,9 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
849 |
$pub_count++;
|
850 |
}
|
851 |
}
|
852 |
-
|
853 |
$data['count'] = $pub_count;
|
854 |
-
|
855 |
// Disable the lists if the publication is not subscribed
|
856 |
if (!$publication_subscribed)
|
857 |
{
|
@@ -862,27 +867,27 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
862 |
$data['list_count'] = 0;
|
863 |
return $data;
|
864 |
}
|
865 |
-
|
866 |
if (!isset($properties->Lists->List))
|
867 |
return $data;
|
868 |
-
|
869 |
foreach($properties->Lists->List as $list)
|
870 |
{
|
871 |
$list_id = (int)$list->ListID;
|
872 |
-
|
873 |
if (isset($data['lists'][$list_id]))
|
874 |
{
|
875 |
$data['lists'][$list_id]['subscribed'] = true;
|
876 |
$list_count++;
|
877 |
}
|
878 |
}
|
879 |
-
|
880 |
$data['count'] = $pub_count + $list_count;
|
881 |
$data['list_count'] = $list_count;
|
882 |
-
|
883 |
return $data;
|
884 |
}
|
885 |
-
|
886 |
private function getPublication()
|
887 |
{
|
888 |
$general = $this->config('publication');
|
@@ -895,14 +900,14 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
895 |
{
|
896 |
$list_data = array();
|
897 |
$additional_lists = $this->config('additional_lists');
|
898 |
-
|
899 |
if ($additional_lists == "")
|
900 |
return $list_data;
|
901 |
-
|
902 |
$active_lists = explode(",",$additional_lists);
|
903 |
-
|
904 |
$all_lists = Mage::getSingleton('emaildirect/wrapper_lists')->getLists();
|
905 |
-
|
906 |
foreach($all_lists as $list)
|
907 |
{
|
908 |
if (in_array($list['id'],$active_lists))
|
@@ -912,31 +917,31 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
912 |
'subscribed' => false,
|
913 |
'disabled' => false);
|
914 |
}
|
915 |
-
|
916 |
return $list_data;
|
917 |
}
|
918 |
-
|
919 |
public function getSubscriptions($email)
|
920 |
{
|
921 |
$this->_logger->setLogArea(EmailDirect_Integration_Helper_Troubleshooting::CUSTOMER);
|
922 |
$this->_logger->setLogLevel(EmailDirect_Integration_Helper_Troubleshooting::LOG_LEVEL_LOW);
|
923 |
-
|
924 |
$data = array(
|
925 |
'publication' => array('id' => -1,'name' => 'Unknown', 'subscribed' => false, 'disabled' => true),
|
926 |
'lists' => array(),
|
927 |
'count' => 0,
|
928 |
'list_count' => 0
|
929 |
);
|
930 |
-
|
931 |
try
|
932 |
{
|
933 |
$data['publication'] = $this->getPublication();
|
934 |
$data['lists'] = $this->getLists();
|
935 |
-
|
936 |
$data = $this->getSubscriberData($data, $email);
|
937 |
-
|
938 |
$this->_logger->resetLogLevel();
|
939 |
-
|
940 |
return $data;
|
941 |
}
|
942 |
catch (Exception $e)
|
3 |
class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
const DATE_FORMAT = "Y-m-d H:i:s";
|
6 |
+
|
7 |
const DISABLED_REASON_PREFIX = "Skipping";
|
8 |
+
|
9 |
protected $_logger = null;
|
10 |
+
|
11 |
public function __construct()
|
12 |
{
|
13 |
$this->_logger = Mage::helper('emaildirect/troubleshooting');
|
14 |
}
|
15 |
+
|
16 |
protected function logAndDebug($data)
|
17 |
{
|
18 |
$this->_logger->logAndDebug($data);
|
19 |
}
|
20 |
+
|
21 |
+
public function log($data)
|
22 |
+
{
|
23 |
+
$this->_logger->log($data);
|
24 |
+
}
|
25 |
+
|
26 |
protected function debug($data)
|
27 |
{
|
28 |
$this->_logger->debug($data);
|
29 |
}
|
30 |
+
|
31 |
protected function debugHeader($data, $level = 2)
|
32 |
{
|
33 |
$this->_logger->debugHeader($data, $level);
|
34 |
}
|
35 |
+
|
36 |
public function getMergeVars($customer)
|
37 |
{
|
38 |
$merge_vars = array();
|
39 |
$maps = unserialize( $this->config('map_fields', $customer->getStoreId()) );
|
40 |
+
|
41 |
if ($maps)
|
42 |
{
|
43 |
$this->debug("Customer Field Mapping");
|
44 |
$this->processMap($merge_vars, $maps, $customer);
|
45 |
}
|
46 |
+
|
47 |
$address_maps = unserialize( $this->config('address_fields', $customer->getStoreId()) );
|
48 |
+
|
49 |
// Process address
|
50 |
if ($address_maps)
|
51 |
{
|
63 |
protected function processMap(&$merge_vars,$maps, $data)
|
64 |
{
|
65 |
$request = Mage::app()->getRequest();
|
66 |
+
|
67 |
$this->debug("Mappings");
|
68 |
$this->debug($maps);
|
69 |
+
|
70 |
$this->debug("Map Data");
|
71 |
$this->debug($data);
|
72 |
+
|
73 |
foreach ($maps as $map)
|
74 |
{
|
75 |
// Make sure we have values for both
|
76 |
if (!isset($map['magento']) || !isset($map['emaildirect']))
|
77 |
continue;
|
78 |
+
|
79 |
$custom_field = $map['magento'];
|
80 |
$emaildirect_field = $map['emaildirect'];
|
81 |
|
86 |
case 'state_code':
|
87 |
{
|
88 |
$region_id = $data->getData('region_id');
|
89 |
+
|
90 |
if (!$region_id)
|
91 |
continue;
|
92 |
|
93 |
$region = Mage::getModel('directory/region')->load($region_id);
|
94 |
+
|
95 |
if (!$region)
|
96 |
continue;
|
97 |
+
|
98 |
$state_code = $region->getCode();
|
99 |
+
|
100 |
if ($state_code != "")
|
101 |
$merge_vars[$emaildirect_field] = $state_code;
|
102 |
} break;
|
113 |
protected function getProduct($item)
|
114 |
{
|
115 |
$product_id = $item->getProductId();
|
116 |
+
|
117 |
if (!$product_id)
|
118 |
return null;
|
119 |
+
|
120 |
$product = Mage::getModel('catalog/product')->load($product_id);
|
121 |
+
|
122 |
if ($product == null || !$product->getId())
|
123 |
return null;
|
124 |
+
|
125 |
return $product;
|
126 |
}
|
127 |
+
|
128 |
// Used to restore configurable products to the cart
|
129 |
public function getConfigurableOptions($product, $simple_product_id)
|
130 |
{
|
131 |
$type_instance = $product->getTypeInstance(true);
|
132 |
$child_products = $type_instance->getUsedProducts(null, $product);
|
133 |
$attrbutes = $type_instance->getUsedProductAttributes($product);
|
134 |
+
|
135 |
$super_attrbutes = array();
|
136 |
|
137 |
foreach ($child_products as $child)
|
144 |
}
|
145 |
}
|
146 |
}
|
147 |
+
|
148 |
return $super_attrbutes;
|
149 |
}
|
150 |
+
|
151 |
public function getStoreId($code)
|
152 |
{
|
153 |
if ($code == null)
|
154 |
return 0;
|
155 |
+
|
156 |
try
|
157 |
{
|
158 |
$store = Mage::getModel("core/store")->load($code);
|
163 |
return 0;
|
164 |
}
|
165 |
}
|
166 |
+
|
167 |
public function getAdminStore()
|
168 |
{
|
169 |
$code = Mage::app()->getRequest()->getParam('store');
|
170 |
+
|
171 |
return $this->getStoreId($code);
|
172 |
}
|
173 |
+
|
174 |
public function getUrlParams()
|
175 |
{
|
176 |
$param_options = array('store','group','website');
|
177 |
+
|
178 |
$request = Mage::app()->getRequest();
|
179 |
+
|
180 |
foreach ($param_options as $param)
|
181 |
{
|
182 |
if ($request->getParam($param) != null)
|
183 |
return array($param => $request->getParam($param));
|
184 |
}
|
185 |
+
|
186 |
return array();
|
187 |
}
|
188 |
+
|
189 |
public function forceSubscribe()
|
190 |
{
|
191 |
$option = (int)$this->config('checkout_subscribe');
|
192 |
+
|
193 |
// Force subscribe on
|
194 |
if ($option == 3)
|
195 |
return true;
|
196 |
+
|
197 |
return false;
|
198 |
}
|
199 |
+
|
200 |
public function getOrderExportCollection($from, $to, $include, $store = null)
|
201 |
{
|
202 |
$from_date = Mage::getModel('core/date')->gmtDate(null,strtotime($from)); // 2010-05-11 15:00:00
|
203 |
+
|
204 |
$to_date = Mage::getModel('core/date')->gmtDate(null,strtotime($to)); // 2010-05-11 15:00:00
|
205 |
+
|
206 |
$orders = Mage::getModel('sales/order')->getCollection()
|
207 |
->addAttributeToFilter('created_at', array('from' => $from_date, 'to' => $to_date));
|
208 |
+
|
209 |
$mode = $this->config('send_field');
|
210 |
+
|
211 |
if ($mode == 'state')
|
212 |
{
|
213 |
$states = Mage::helper('emaildirect')->config('send_states');
|
220 |
$status_list = explode(",",$statuses);
|
221 |
$orders->addAttributeToFilter('status', array('in' => $status_list));
|
222 |
}
|
223 |
+
|
224 |
if ($store != null && $store != 0)
|
225 |
$orders->addAttributeToFilter('store_id', array('eq' => $store));
|
226 |
+
|
227 |
if (!$include)
|
228 |
{
|
229 |
$orders->getSelect()->joinLeft(array('ed_or' => Mage::getSingleton('core/resource')->getTableName("emaildirect/order")),"ed_or.order_id=main_table.entity_id",array(
|
231 |
));
|
232 |
$orders->getSelect()->where('`ed_or`.`date_sent` IS NULL');
|
233 |
}
|
234 |
+
|
235 |
return $orders;
|
236 |
}
|
237 |
+
|
238 |
public function getProductExportCollection($include = false, $store = null)
|
239 |
{
|
240 |
$products = Mage::getModel('catalog/product')->getCollection();
|
241 |
+
|
242 |
if ($include == false)
|
243 |
$products->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
244 |
+
|
245 |
if ($store != null && $store != 0)
|
246 |
$products->addStoreFilter($store);
|
247 |
+
|
248 |
return $products;
|
249 |
}
|
250 |
+
|
251 |
public function formatSize($size)
|
252 |
{
|
253 |
try
|
254 |
{
|
255 |
if ($size == 0 || $size == null || $size == "")
|
256 |
return "0 b";
|
257 |
+
|
258 |
$unit = array('b','kb','mb','gb','tb','pb');
|
259 |
+
|
260 |
$numeric_size = @round($size/pow(1024,($i=$size?floor(log($size,1024)):0)),2);
|
261 |
+
|
262 |
if (!isset($unit[$i]))
|
263 |
return "Unknown";
|
264 |
+
|
265 |
return "{$numeric_size} {$unit[$i]}";
|
266 |
}
|
267 |
catch (Exception $e)
|
270 |
return "Unknown";
|
271 |
}
|
272 |
}
|
273 |
+
|
274 |
public function getDuration($timeline, $zero = false)
|
275 |
{
|
276 |
$periods = array('day' => 86400, 'hour' => 3600, 'minute' => 60);
|
277 |
+
|
278 |
$ret = "";
|
279 |
|
280 |
foreach($periods as $name => $seconds)
|
281 |
{
|
282 |
$num = floor($timeline / $seconds);
|
283 |
+
|
284 |
if ($num > 0 || ($num == 0 && $zero == true))
|
285 |
{
|
286 |
$timeline -= ($num * $seconds);
|
290 |
|
291 |
return trim($ret);
|
292 |
}
|
293 |
+
|
294 |
public function timeElapsed2string($time)
|
295 |
{
|
296 |
if ($time == "")
|
297 |
return "";
|
298 |
+
|
299 |
if (is_string($time))
|
300 |
$time = strtotime($time);
|
301 |
+
|
302 |
$timeline = time() - $time;
|
303 |
+
|
304 |
return $this->getDuration($timeline);
|
305 |
}
|
306 |
|
307 |
public function getExportFileName($name,$full = true)
|
308 |
{
|
309 |
$filename = "{$name}.csv";
|
310 |
+
|
311 |
if ($full)
|
312 |
return Mage::getBaseDir('export').'/' . $filename;
|
313 |
+
|
314 |
return $filename;
|
315 |
}
|
316 |
|
318 |
{
|
319 |
return $this->config('apikey',$store);
|
320 |
}
|
321 |
+
|
322 |
public function isWebsiteConfig()
|
323 |
{
|
324 |
$request = Mage::app()->getRequest();
|
325 |
+
|
326 |
if ($request->getParam('website') && !$request->getParam('store'))
|
327 |
return true;
|
328 |
+
|
329 |
return false;
|
330 |
}
|
331 |
+
|
332 |
public function updateConfig($path, $value, $store = 0, $base_path = 'general')
|
333 |
{
|
334 |
$scope = "stores";
|
335 |
+
|
336 |
if ($store == null)
|
337 |
$store = $this->getCurrentStore();
|
338 |
+
|
339 |
if ($store == 0)
|
340 |
$scope = "default";
|
341 |
+
|
342 |
$config = Mage::getConfig();
|
343 |
$config->saveConfig("emaildirect/{$base_path}/{$path}",$value,$scope,$store);
|
344 |
$config->cleanCache();
|
345 |
}
|
346 |
+
|
347 |
public function deleteConfig($path, $store = 0, $base_path = 'general')
|
348 |
{
|
349 |
$scope = "stores";
|
350 |
+
|
351 |
if ($store == null)
|
352 |
$store = $this->getCurrentStore();
|
353 |
+
|
354 |
if ($store == 0)
|
355 |
$scope = "default";
|
356 |
+
|
357 |
$config = Mage::getConfig();
|
358 |
$config->deleteConfig("emaildirect/{$base_path}/{$path}",$scope,$store);
|
359 |
$config->cleanCache();
|
360 |
}
|
361 |
+
|
362 |
public function resetCurrentStore()
|
363 |
{
|
364 |
$this->_current_store = null;
|
365 |
}
|
366 |
+
|
367 |
public function getCurrentStore()
|
368 |
{
|
369 |
$store = Mage::app()->getStore()->getId();
|
370 |
$config_store = Mage::app()->getRequest()->getParam('store');
|
371 |
$on_config = $this->onConfigPage();
|
372 |
+
|
373 |
if ($config_store && $on_config)
|
374 |
$store = $config_store;
|
375 |
//else if (!is_null($this->_current_store))
|
376 |
// $store = $this->_current_store;
|
377 |
+
|
378 |
if (is_string($store))
|
379 |
return $this->getStoreId($store);
|
380 |
+
|
381 |
return $store;
|
382 |
}
|
383 |
|
385 |
{
|
386 |
if (is_null($store))
|
387 |
$store = $this->getCurrentStore();
|
388 |
+
|
389 |
//echo "emaildirect/{$section}/{$value}";
|
390 |
+
|
391 |
$realvalue = Mage::getStoreConfig("emaildirect/{$section}/{$value}", $store);
|
392 |
+
|
393 |
return $realvalue;
|
394 |
}
|
395 |
|
397 |
{
|
398 |
return $this->_config($value,'general',$store);
|
399 |
}
|
400 |
+
|
401 |
public function exportConfig($value, $store = null)
|
402 |
{
|
403 |
return $this->_config($value,'export',$store);
|
404 |
}
|
405 |
+
|
406 |
public function troubleConfig($value, $store = null)
|
407 |
{
|
408 |
return $this->_config($value,'troubleshooting',$store);
|
409 |
}
|
410 |
+
|
411 |
public function getEmailDirectColumnOptions()
|
412 |
{
|
413 |
$columns = Mage::getSingleton('emaildirect/wrapper_database')->getAllColumns();
|
414 |
+
|
415 |
$custom_fields = Mage::helper('emaildirect/fields')->getCustomFields(true);
|
416 |
+
|
417 |
$invalid_columns = array();
|
418 |
+
|
419 |
foreach ($custom_fields as $cf)
|
420 |
{
|
421 |
$invalid_columns[] = $cf['name'];
|
422 |
}
|
423 |
+
|
424 |
$options = array();
|
425 |
+
|
426 |
if (!isset($columns))
|
427 |
return $options;
|
428 |
+
|
429 |
foreach ($columns as $column)
|
430 |
{
|
431 |
if ($column->IsCustom == 'true' && !in_array((string)$column->ColumnName,$invalid_columns))
|
432 |
{
|
433 |
$key = (string)$column->ColumnName;
|
434 |
+
|
435 |
$options[$key] = $key;
|
436 |
}
|
437 |
}
|
438 |
+
|
439 |
return $options;
|
440 |
}
|
441 |
+
|
442 |
public function getShippingColumnOptions()
|
443 |
{
|
444 |
$options = array(
|
445 |
'shipping_code' => 'Shipping Code',
|
446 |
'shipping_description' => 'Shipping Description',
|
447 |
'carrier_code' => 'Tracking Carrier Code',
|
448 |
+
'title' => 'Tracking Title',
|
449 |
'number' => 'Tracking Number');
|
450 |
+
|
451 |
return $options;
|
452 |
}
|
453 |
|
455 |
{
|
456 |
return $this->config('publication', $storeId);
|
457 |
}
|
458 |
+
|
459 |
public function isSignupTest()
|
460 |
{
|
461 |
return Mage::app()->getRequest()->getParam('signup_test') == "true";
|
462 |
}
|
463 |
+
|
464 |
public function canCapture()
|
465 |
{
|
466 |
if (!$this->canEdirect())
|
467 |
return false;
|
468 |
+
|
469 |
if ((bool)($this->config('capture_enabled') != 0) && !Mage::helper('customer')->isLoggedIn())
|
470 |
return true;
|
471 |
+
|
472 |
return false;
|
473 |
}
|
474 |
|
476 |
{
|
477 |
if (!$this->canEdirect())
|
478 |
return false;
|
479 |
+
|
480 |
if (Mage::helper('customer')->isLoggedIn() && (bool)($this->config('wishlist_enabled') != 0))
|
481 |
return true;
|
482 |
+
|
483 |
return false;
|
484 |
}
|
485 |
+
|
486 |
public function canSendLastLogin()
|
487 |
{
|
488 |
if (!$this->canEdirect())
|
489 |
return false;
|
490 |
+
|
491 |
if (Mage::helper('customer')->isLoggedIn() && (bool)($this->config('lastlogin_enabled') != 0))
|
492 |
return true;
|
493 |
+
|
494 |
return false;
|
495 |
}
|
496 |
|
498 |
{
|
499 |
if (!$this->canEdirect())
|
500 |
return false;
|
501 |
+
|
502 |
if ((bool)($this->config('signup_enabled') == 0) || (bool)($this->config('signup_activated') == 0))
|
503 |
return false;
|
504 |
+
|
505 |
return true;
|
506 |
}
|
507 |
+
|
508 |
public function canShowSignup()
|
509 |
{
|
510 |
if ($this->isSignupTest())
|
511 |
return true;
|
512 |
+
|
513 |
if (!$this->isSignupEnabled())
|
514 |
return false;
|
515 |
+
|
516 |
$last_closed = Mage::getModel('core/cookie')->get('ed_signup');
|
517 |
+
|
518 |
$recurrence = $this->config('signup_recurrence');
|
519 |
+
|
520 |
if ($last_closed == "")
|
521 |
return true;
|
522 |
|
526 |
default:
|
527 |
$last_closed = strtotime("+{$recurrence}",$last_closed); break;
|
528 |
}
|
529 |
+
|
530 |
if ($last_closed > time())
|
531 |
return false;
|
532 |
+
|
533 |
return true;
|
534 |
}
|
535 |
+
|
536 |
public function canCheckoutSubscribe()
|
537 |
{
|
538 |
if (!$this->canEdirect())
|
539 |
return false;
|
540 |
+
|
541 |
return (bool)($this->config('checkout_subscribe') != 0);
|
542 |
}
|
543 |
+
|
544 |
public function canEdirect()
|
545 |
{
|
546 |
// Necessary?
|
547 |
//Mage::helper('core')->isModuleOutputEnabled('EmailDirect_Integration');
|
548 |
+
|
549 |
$active = $this->config('active');
|
550 |
$setup = $this->config('setup');
|
551 |
+
|
552 |
if ($active && $setup)
|
553 |
return true;
|
554 |
+
|
555 |
return $this->onConfigPage();
|
556 |
}
|
557 |
+
|
558 |
public function onConfigPage()
|
559 |
{
|
560 |
$controller = Mage::app()->getRequest()->getControllerName();
|
561 |
+
|
562 |
if ($controller == 'system_config')
|
563 |
return true;
|
564 |
+
|
565 |
return false;
|
566 |
}
|
567 |
|
581 |
$customer->setPrimaryShippingAddress($order->getShippingAddress());
|
582 |
Mage::register('ed_guest_customer', $customer, TRUE);
|
583 |
}
|
584 |
+
|
585 |
public function getFullStoreName($store)
|
586 |
{
|
587 |
if ($store == null)
|
588 |
return "Unknown";
|
589 |
+
|
590 |
$store_name = "";
|
591 |
+
|
592 |
if ($website = $store->getWebsite())
|
593 |
$store_name .= $website->getName() . " - ";
|
594 |
+
|
595 |
if ($group = $store->getGroup())
|
596 |
$store_name .= $group->getName() . " - ";
|
597 |
+
|
598 |
$store_name .= $store->getName();
|
599 |
+
|
600 |
return $store_name;
|
601 |
}
|
602 |
+
|
603 |
public function getFullStoreNameById($store_id)
|
604 |
{
|
605 |
$store = Mage::getModel('core/store')->load($store_id);
|
606 |
+
|
607 |
return $this->getFullStoreName($store);
|
608 |
}
|
609 |
+
|
610 |
public function getAbandonedStatus()
|
611 |
{
|
612 |
$stores = Mage::app()->getStores();
|
613 |
+
|
614 |
$abandoned_status = array(
|
615 |
'enabled' => false,
|
616 |
'cron_last_run' => $this->getCronLastRunHtml(),
|
617 |
'stores' => array()
|
618 |
);
|
619 |
+
|
620 |
foreach ($stores as $store)
|
621 |
{
|
622 |
$data = array();
|
623 |
+
|
624 |
$data['id'] = $store->getId();
|
625 |
$data['name'] = $this->getFullStoreName($store);
|
626 |
$data['enabled'] = $this->getAbandonedEnabled($store->getId());
|
627 |
if ($data['enabled'])
|
628 |
$abandoned_status['enabled'] = true;
|
629 |
+
|
630 |
$data['last_run'] = $this->getAbandonedLastRunhtml($store->getId());
|
631 |
+
|
632 |
$abandoned_status['stores'][] = $data;
|
633 |
}
|
634 |
+
|
635 |
return $abandoned_status;
|
636 |
}
|
637 |
+
|
638 |
public function getCronLastRun($store = null, $config = 'abandoned_last_run')
|
639 |
{
|
640 |
$last_run = $this->config($config, $store);
|
641 |
+
|
642 |
$data = array();
|
643 |
+
|
644 |
if ($last_run != null)
|
645 |
{
|
646 |
$data['last_run'] = $last_run;
|
647 |
+
|
648 |
$minutes = round(abs(time() - strtotime($last_run)) / 60,0);
|
649 |
+
|
650 |
$data['minutes'] = $minutes;
|
651 |
+
|
652 |
if ($minutes > 60)
|
653 |
$data['class'] = 'ab_ng';
|
654 |
else
|
655 |
$data['class'] = 'ab_ok';
|
656 |
+
|
657 |
$data['last_run_display'] = Mage::helper('core')->formatTime($last_run, 'long', true);
|
658 |
+
$data['time_elapsed'] = $this->timeElapsed2string($last_run);
|
659 |
}
|
660 |
else
|
661 |
{
|
665 |
$data['time_elapsed'] = "";
|
666 |
$data['class'] = 'ab_ng';
|
667 |
}
|
668 |
+
|
669 |
return $data;
|
670 |
}
|
671 |
|
673 |
{
|
674 |
$data = $this->getCronLastRun($store,$config);
|
675 |
$warning_img = "";
|
676 |
+
|
677 |
if ($data['class'] == "ab_ng")
|
678 |
$warning_img = "<a href='" . $this->getAdminUrl("ed_integration/admin_troubleshooting/index") . "#abandoned_carts' target='_blank'><img src='" . Mage::getDesign()->getSkinUrl('images/warning_msg_icon.gif') . "' class='cron_warning' /></a>";
|
679 |
+
|
680 |
$time_elapsed = "";
|
681 |
+
|
682 |
if ($data['time_elapsed'] != '')
|
683 |
$time_elapsed = "({$data['time_elapsed']})";
|
684 |
+
|
685 |
return "<span class='{$data['class']}'>{$data['last_run_display']} {$time_elapsed}</span>{$warning_img}";
|
686 |
}
|
687 |
|
689 |
{
|
690 |
return $this->getLastRunHtml($store);
|
691 |
}
|
692 |
+
|
693 |
public function getCronLastRunHtml()
|
694 |
{
|
695 |
return $this->getLastRunHtml(0, 'cron_last_run');
|
699 |
{
|
700 |
$request = Mage::app()->getRequest();
|
701 |
$url_params = array('website','store');
|
702 |
+
|
703 |
foreach ($url_params as $up)
|
704 |
{
|
705 |
if ($request->getParam($up))
|
706 |
$params[$up] = $request->getParam($up);
|
707 |
}
|
708 |
+
|
709 |
return $params;
|
710 |
}
|
711 |
+
|
712 |
public function getAdminUrl($url, $params = array())
|
713 |
{
|
714 |
$params = $this->getAdminUrlParams($params);
|
715 |
+
|
716 |
return Mage::helper("adminhtml")->getUrl($url, $params);
|
717 |
}
|
718 |
+
|
719 |
public function getOrdersEnabled()
|
720 |
{
|
721 |
$active = $this->config('active');
|
722 |
$setup = $this->config('setup');
|
723 |
$sendit = $this->config('sendorder');
|
724 |
+
|
725 |
if (!$sendit || !$setup || !$active)
|
726 |
return false;
|
727 |
+
|
728 |
return true;
|
729 |
}
|
730 |
+
|
731 |
public function getBatchEnabled()
|
732 |
{
|
733 |
$active = $this->config('active');
|
734 |
$setup = $this->config('setup');
|
735 |
$batch = $this->config('batch_enabled');
|
736 |
+
|
737 |
if (!$batch || !$setup || !$active)
|
738 |
return false;
|
739 |
+
|
740 |
return true;
|
741 |
}
|
742 |
+
|
743 |
public function getBatchOnly()
|
744 |
{
|
745 |
$batch_only = $this->config('batch_only');
|
746 |
+
|
747 |
if (!$batch_only)
|
748 |
return false;
|
749 |
+
|
750 |
return true;
|
751 |
}
|
752 |
+
|
753 |
public function getDisabledReason()
|
754 |
{
|
755 |
if (!$this->config('active'))
|
756 |
return "EmailDirect Module is Disabled.";
|
757 |
+
|
758 |
if (!$this->config('setup'))
|
759 |
return "EmailDirect Module is not configured with a valid API Key.";
|
760 |
+
|
761 |
return "";
|
762 |
}
|
763 |
+
|
764 |
public function getOrdersDisabledReason()
|
765 |
{
|
766 |
$base = $this->getDisabledReason();
|
767 |
+
|
768 |
if ($base != "")
|
769 |
return $base;
|
770 |
+
|
771 |
return "Sending Orders is disabled.";
|
772 |
}
|
773 |
+
|
774 |
public function getWishlistDisabledReason()
|
775 |
{
|
776 |
$base = $this->getDisabledReason();
|
777 |
+
|
778 |
if ($base != "")
|
779 |
return $base;
|
780 |
+
|
781 |
if (!Mage::helper('customer')->isLoggedIn())
|
782 |
return "Customer not logged in";
|
783 |
+
|
784 |
return "Wishlist is disabled.";
|
785 |
}
|
786 |
+
|
787 |
public function getLastLoginDisabledReason()
|
788 |
{
|
789 |
$base = $this->getDisabledReason();
|
790 |
+
|
791 |
if ($base != "")
|
792 |
return $base;
|
793 |
+
|
794 |
//if (!Mage::helper('customer')->isLoggedIn())
|
795 |
//return "Customer not logged in";
|
796 |
+
|
797 |
return "Last Login is disabled.";
|
798 |
}
|
799 |
+
|
800 |
public function getBatchDisabledReason()
|
801 |
{
|
802 |
$base = $this->getDisabledReason();
|
803 |
+
|
804 |
if ($base != "")
|
805 |
return $base;
|
806 |
+
|
807 |
return "Sending Orders in batch is disabled.";
|
808 |
}
|
809 |
+
|
810 |
public function getAbandonedEnabled($store = null)
|
811 |
{
|
812 |
$active = $this->config('active', $store);
|
813 |
$setup = $this->config('setup', $store);
|
814 |
$sendit = $this->config('sendabandoned', $store);
|
815 |
$abandoned_setup = $this->config('abandonedsetup', $store);
|
816 |
+
|
817 |
if (!$sendit || !$setup || !$active || !$abandoned_setup)
|
818 |
return false;
|
819 |
+
|
820 |
return true;
|
821 |
}
|
822 |
|
823 |
public function getAbandonedDisabledReason()
|
824 |
{
|
825 |
$base = $this->getDisabledReason();
|
826 |
+
|
827 |
if ($base != "")
|
828 |
return $base;
|
829 |
+
|
830 |
if (!$this->config('abandonedsetup'))
|
831 |
return "Abandoned Cart Processing Not Setup.";
|
832 |
+
|
833 |
return "Sending Abandoned Carts is Disabled";
|
834 |
}
|
835 |
+
|
836 |
// Newsletter
|
837 |
+
|
838 |
private function getSubscriberData($data, $email)
|
839 |
{
|
840 |
$properties = Mage::getSingleton('emaildirect/wrapper_subscribers')->getProperties($email);
|
841 |
$pub_count = 0;
|
842 |
$list_count = 0;
|
843 |
$publication_subscribed = false;
|
844 |
+
|
845 |
if (!isset($properties->Publications->Publication))
|
846 |
return $data;
|
847 |
+
|
848 |
foreach($properties->Publications->Publication as $publication)
|
849 |
{
|
850 |
if ((int) $publication->PublicationID == $data['publication']['id'])
|
854 |
$pub_count++;
|
855 |
}
|
856 |
}
|
857 |
+
|
858 |
$data['count'] = $pub_count;
|
859 |
+
|
860 |
// Disable the lists if the publication is not subscribed
|
861 |
if (!$publication_subscribed)
|
862 |
{
|
867 |
$data['list_count'] = 0;
|
868 |
return $data;
|
869 |
}
|
870 |
+
|
871 |
if (!isset($properties->Lists->List))
|
872 |
return $data;
|
873 |
+
|
874 |
foreach($properties->Lists->List as $list)
|
875 |
{
|
876 |
$list_id = (int)$list->ListID;
|
877 |
+
|
878 |
if (isset($data['lists'][$list_id]))
|
879 |
{
|
880 |
$data['lists'][$list_id]['subscribed'] = true;
|
881 |
$list_count++;
|
882 |
}
|
883 |
}
|
884 |
+
|
885 |
$data['count'] = $pub_count + $list_count;
|
886 |
$data['list_count'] = $list_count;
|
887 |
+
|
888 |
return $data;
|
889 |
}
|
890 |
+
|
891 |
private function getPublication()
|
892 |
{
|
893 |
$general = $this->config('publication');
|
900 |
{
|
901 |
$list_data = array();
|
902 |
$additional_lists = $this->config('additional_lists');
|
903 |
+
|
904 |
if ($additional_lists == "")
|
905 |
return $list_data;
|
906 |
+
|
907 |
$active_lists = explode(",",$additional_lists);
|
908 |
+
|
909 |
$all_lists = Mage::getSingleton('emaildirect/wrapper_lists')->getLists();
|
910 |
+
|
911 |
foreach($all_lists as $list)
|
912 |
{
|
913 |
if (in_array($list['id'],$active_lists))
|
917 |
'subscribed' => false,
|
918 |
'disabled' => false);
|
919 |
}
|
920 |
+
|
921 |
return $list_data;
|
922 |
}
|
923 |
+
|
924 |
public function getSubscriptions($email)
|
925 |
{
|
926 |
$this->_logger->setLogArea(EmailDirect_Integration_Helper_Troubleshooting::CUSTOMER);
|
927 |
$this->_logger->setLogLevel(EmailDirect_Integration_Helper_Troubleshooting::LOG_LEVEL_LOW);
|
928 |
+
|
929 |
$data = array(
|
930 |
'publication' => array('id' => -1,'name' => 'Unknown', 'subscribed' => false, 'disabled' => true),
|
931 |
'lists' => array(),
|
932 |
'count' => 0,
|
933 |
'list_count' => 0
|
934 |
);
|
935 |
+
|
936 |
try
|
937 |
{
|
938 |
$data['publication'] = $this->getPublication();
|
939 |
$data['lists'] = $this->getLists();
|
940 |
+
|
941 |
$data = $this->getSubscriberData($data, $email);
|
942 |
+
|
943 |
$this->_logger->resetLogLevel();
|
944 |
+
|
945 |
return $data;
|
946 |
}
|
947 |
catch (Exception $e)
|
app/code/community/EmailDirect/Integration/Helper/Fields.php
CHANGED
@@ -1,173 +1,173 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class EmailDirect_Integration_Helper_Fields extends
|
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 |
-
|
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 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class EmailDirect_Integration_Helper_Fields extends EmailDirect_Integration_Helper_Data
|
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 |
+
$this->log("Error adding {$name} field");
|
26 |
+
Mage::throwException("Error adding {$name} field");
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
private function getMultiFields($fields, $prefix = "", $count = null)
|
31 |
+
{
|
32 |
+
if ($count == null)
|
33 |
+
$count = Mage::helper('emaildirect')->config('product_fields');
|
34 |
+
|
35 |
+
for ($i = 1; $i <= $count; $i++)
|
36 |
+
{
|
37 |
+
$fields[] =
|
38 |
+
$this->addField("{$prefix}ProductName{$i}", 'Text', '200');
|
39 |
+
|
40 |
+
if ($prefix != 'Related')
|
41 |
+
$fields[] = $this->addField("{$prefix}ParentName{$i}", 'Text', '200');
|
42 |
+
$fields[] = $this->addField("{$prefix}SKU{$i}", 'Text', '50');
|
43 |
+
$fields[] = $this->addField("{$prefix}URL{$i}", 'Text', '200');
|
44 |
+
$fields[] = $this->addField("{$prefix}Image{$i}", 'Text', '200');
|
45 |
+
$fields[] = $this->addField("{$prefix}Description{$i}", 'Text', '200');
|
46 |
+
$fields[] = $this->addField("{$prefix}Cost{$i}", 'Text', '20');
|
47 |
+
}
|
48 |
+
|
49 |
+
return $fields;
|
50 |
+
}
|
51 |
+
|
52 |
+
private function getExistingColumns()
|
53 |
+
{
|
54 |
+
$columns = Mage::getSingleton('emaildirect/wrapper_database')->getAllColumns();
|
55 |
+
|
56 |
+
$existing = array();
|
57 |
+
|
58 |
+
if (!isset($columns))
|
59 |
+
return $existing;
|
60 |
+
|
61 |
+
foreach ($columns as $column)
|
62 |
+
{
|
63 |
+
$name = (string)$column->ColumnName;
|
64 |
+
|
65 |
+
$existing[$name] = $name;
|
66 |
+
}
|
67 |
+
|
68 |
+
return $existing;
|
69 |
+
}
|
70 |
+
|
71 |
+
private function getMissingColumns($fields)
|
72 |
+
{
|
73 |
+
$columns = $this->getExistingColumns();
|
74 |
+
|
75 |
+
$check_columns = array();
|
76 |
+
|
77 |
+
foreach ($columns as $key => $column)
|
78 |
+
{
|
79 |
+
$check_columns[strtolower($key)] = $column;
|
80 |
+
}
|
81 |
+
|
82 |
+
$missing = array();
|
83 |
+
|
84 |
+
foreach ($fields as $field)
|
85 |
+
{
|
86 |
+
if (!isset($check_columns[strtolower($field['name'])]))
|
87 |
+
{
|
88 |
+
$missing[] = $field;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
return $missing;
|
93 |
+
}
|
94 |
+
|
95 |
+
private function addField($name, $type, $size = null)
|
96 |
+
{
|
97 |
+
$new_field = array('name' => $name, 'type' => $type);
|
98 |
+
|
99 |
+
if ($size != null)
|
100 |
+
$new_field['size'] = $size;
|
101 |
+
|
102 |
+
return $new_field;
|
103 |
+
}
|
104 |
+
|
105 |
+
public function getCustomFields($force_product = false)
|
106 |
+
{
|
107 |
+
$fields = array();
|
108 |
+
|
109 |
+
if (Mage::helper('emaildirect')->config('save_latest_order') || $force_product)
|
110 |
+
{
|
111 |
+
$fields[] = $this->addField('LastOrderNumber', 'Text', '30');
|
112 |
+
$fields[] = $this->addField('LastPurchaseDate', 'Date');
|
113 |
+
$fields[] = $this->addField('LastPurchaseTotal', 'Text', '20');
|
114 |
+
|
115 |
+
$fields = $this->getMultiFields($fields);
|
116 |
+
|
117 |
+
$fields = $this->getMultiFields($fields,"Related", Mage::helper('emaildirect')->config('related_fields'));
|
118 |
+
}
|
119 |
+
|
120 |
+
if (Mage::helper('emaildirect')->config('wishlist_enabled'))
|
121 |
+
{
|
122 |
+
$fields[] = $this->addField('WishListDate', 'Date');
|
123 |
+
$fields[] = $this->addField('WishListUrl', 'Text', '200');
|
124 |
+
}
|
125 |
+
|
126 |
+
$fields[] = $this->addField('LastLogin', 'Date');
|
127 |
+
|
128 |
+
$fields[] = $this->addField('AbandonedDate', 'Date');
|
129 |
+
$fields[] = $this->addField('AbandonedUrl', 'Text', '1000');
|
130 |
+
|
131 |
+
$fields = $this->getMultiFields($fields,"AB");
|
132 |
+
|
133 |
+
return $fields;
|
134 |
+
}
|
135 |
+
|
136 |
+
public function verifyFields($force_product = false)
|
137 |
+
{
|
138 |
+
$fields = $this->getCustomFields($force_product);
|
139 |
+
|
140 |
+
$missing = $this->getMissingColumns($fields);
|
141 |
+
|
142 |
+
if (count($missing) > 0)
|
143 |
+
{
|
144 |
+
foreach ($missing as $data)
|
145 |
+
{
|
146 |
+
$this->addDatabaseField($data);
|
147 |
+
}
|
148 |
+
|
149 |
+
$missing_check = $this->getMissingColumns($fields);
|
150 |
+
|
151 |
+
if (count($missing_check) != 0)
|
152 |
+
{
|
153 |
+
$this->log("Error creating fields");
|
154 |
+
$this->log($missing_check, "Missing Check");
|
155 |
+
Mage::throwException("Error creating fields");
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
// Save version so we know if we are up to date or not
|
160 |
+
Mage::getConfig()->saveConfig(self::ABANDONED_SETUP_PATH, 1,"default","default");
|
161 |
+
Mage::getConfig()->saveConfig(self::SETUP_VERSION_PATH, $this->getVersion(),"default","default");
|
162 |
+
}
|
163 |
+
|
164 |
+
public function checkFields()
|
165 |
+
{
|
166 |
+
$version = $this->getVersion();
|
167 |
+
|
168 |
+
$setup_version = Mage::helper('emaildirect')->config('setup_version');
|
169 |
+
|
170 |
+
if ($setup_version == NULL || (version_compare($setup_version, $version) < 0))
|
171 |
+
$this->verifyFields();
|
172 |
+
}
|
173 |
}
|
app/code/community/EmailDirect/Integration/Model/Abandoned/Observer.php
CHANGED
@@ -2,327 +2,333 @@
|
|
2 |
|
3 |
class EmailDirect_Integration_Model_Abandoned_Observer extends EmailDirect_Integration_Model_Observer_Abstract
|
4 |
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
12 |
-
|
13 |
-
$date = $date - $time;
|
14 |
-
|
15 |
-
return date($this->_date_format, $date);
|
16 |
-
}
|
17 |
-
|
18 |
-
private function setSentToEmailDirectDate($quote_id, $date)
|
19 |
-
{
|
20 |
-
try
|
21 |
-
{
|
22 |
-
$abandoned = Mage::getModel('emaildirect/abandoned')->loadByQuoteId($quote_id);
|
23 |
-
|
24 |
-
$abandoned->setDateSent($date);
|
25 |
-
$abandoned->save();
|
26 |
-
}
|
27 |
-
catch (Exception $e)
|
28 |
-
{
|
29 |
-
Mage::logException($e);
|
30 |
-
$this->_logException($e);
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
private function processAbandoned($quote)
|
35 |
-
{
|
36 |
-
$this->_log("ProcessAbandoned Start");
|
37 |
-
$email = $quote->getCustomerEmail();
|
38 |
-
|
39 |
-
if ($email == null)
|
40 |
-
$email = $quote->getEmail();
|
41 |
-
|
42 |
-
$abandonedDate = $quote->getUpdatedAt();
|
43 |
-
|
44 |
-
$merge_vars = array();
|
45 |
-
|
46 |
-
$merge_vars['FirstName'] = $quote->getData('customer_firstname');
|
47 |
-
$merge_vars['LastName'] = $quote->getData('customer_lastname');
|
48 |
-
|
49 |
-
$merge_vars['AbandonedDate'] = $abandonedDate;
|
50 |
-
$merge_vars['AbandonedUrl'] = Mage::helper('emaildirect/abandoned')->getAbandonedUrl($quote);
|
51 |
-
|
52 |
-
Mage::helper('emaildirect/abandoned')->addSequence($merge_vars);
|
53 |
-
|
54 |
-
$merge_vars = Mage::helper('emaildirect/order')->getMergeOrderItems($quote, $merge_vars, "AB");
|
55 |
-
|
56 |
-
if ($this->_helper->config('save_latest_order'))
|
57 |
-
{
|
58 |
-
$this->_log("Processing Last Order");
|
59 |
-
$order = Mage::helper('emaildirect/abandoned')->getLastOrder($quote);
|
60 |
-
|
61 |
-
if ($order != null)
|
62 |
-
$merge_vars = Mage::helper('emaildirect/order')->processOrderItems($order, $merge_vars);
|
63 |
-
else
|
64 |
-
$this->_log("Order not found");
|
65 |
-
}
|
66 |
-
|
67 |
-
$xml = Mage::getSingleton('emaildirect/wrapper_abandoned')->getOneSubscriber($email,$merge_vars);
|
68 |
-
|
69 |
-
$this->_log("ProcessAbandoned End");
|
70 |
-
|
71 |
-
return $xml;
|
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 |
-
Mage::app()->setCurrentStore($store->getCode());
|
225 |
-
|
226 |
-
$this->abandonedStoreProcessor($store, $check_date);
|
227 |
-
}
|
228 |
-
|
229 |
-
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
230 |
-
|
231 |
-
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
232 |
-
$date = date($this->_date_format, $date);
|
233 |
-
|
234 |
-
$this->_log("Saving Last Cron Run Date: {$date}");
|
235 |
-
$this->_helper->updateConfig("cron_last_run", $date);
|
236 |
-
|
237 |
-
$this->_log("Abandoned Carts Processor End");
|
238 |
-
}
|
239 |
-
catch (Exception $e)
|
240 |
-
{
|
241 |
-
Mage::logException($e);
|
242 |
-
$this->_logException($e);
|
243 |
-
}
|
244 |
-
}
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
}
|
303 |
-
|
304 |
// END ABANDONED CRON
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
}
|
327 |
// END QUOTE SAVE AFTER
|
328 |
-
}
|
2 |
|
3 |
class EmailDirect_Integration_Model_Abandoned_Observer extends EmailDirect_Integration_Model_Observer_Abstract
|
4 |
{
|
5 |
+
// START ABANDONED CRON
|
6 |
+
private function getAbandonedTime()
|
7 |
+
{
|
8 |
+
$time = $this->_helper->config('abandonedtime');
|
9 |
+
$time *= 60; // Adjust to seconds.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
12 |
+
|
13 |
+
$date = $date - $time;
|
14 |
+
|
15 |
+
return date($this->_date_format, $date);
|
16 |
+
}
|
17 |
+
|
18 |
+
private function setSentToEmailDirectDate($quote_id, $date)
|
19 |
+
{
|
20 |
+
try
|
21 |
+
{
|
22 |
+
$abandoned = Mage::getModel('emaildirect/abandoned')->loadByQuoteId($quote_id);
|
23 |
+
|
24 |
+
$abandoned->setDateSent($date);
|
25 |
+
$abandoned->save();
|
26 |
+
}
|
27 |
+
catch (Exception $e)
|
28 |
+
{
|
29 |
+
Mage::logException($e);
|
30 |
+
$this->_logException($e);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
private function processAbandoned($quote)
|
35 |
+
{
|
36 |
+
$this->_log("ProcessAbandoned Start");
|
37 |
+
$email = $quote->getCustomerEmail();
|
38 |
+
|
39 |
+
if ($email == null)
|
40 |
+
$email = $quote->getEmail();
|
41 |
+
|
42 |
+
$abandonedDate = $quote->getUpdatedAt();
|
43 |
+
|
44 |
+
$merge_vars = array();
|
45 |
+
|
46 |
+
$merge_vars['FirstName'] = $quote->getData('customer_firstname');
|
47 |
+
$merge_vars['LastName'] = $quote->getData('customer_lastname');
|
48 |
+
|
49 |
+
$merge_vars['AbandonedDate'] = $abandonedDate;
|
50 |
+
$merge_vars['AbandonedUrl'] = Mage::helper('emaildirect/abandoned')->getAbandonedUrl($quote);
|
51 |
+
|
52 |
+
Mage::helper('emaildirect/abandoned')->addSequence($merge_vars);
|
53 |
+
|
54 |
+
$merge_vars = Mage::helper('emaildirect/order')->getMergeOrderItems($quote, $merge_vars, "AB");
|
55 |
+
|
56 |
+
if ($this->_helper->config('save_latest_order'))
|
57 |
+
{
|
58 |
+
$this->_log("Processing Last Order");
|
59 |
+
$order = Mage::helper('emaildirect/abandoned')->getLastOrder($quote);
|
60 |
+
|
61 |
+
if ($order != null)
|
62 |
+
$merge_vars = Mage::helper('emaildirect/order')->processOrderItems($order, $merge_vars);
|
63 |
+
else
|
64 |
+
$this->_log("Order not found");
|
65 |
+
}
|
66 |
+
|
67 |
+
$xml = Mage::getSingleton('emaildirect/wrapper_abandoned')->getOneSubscriber($email,$merge_vars);
|
68 |
+
|
69 |
+
$this->_log("ProcessAbandoned End");
|
70 |
+
|
71 |
+
return $xml;
|
72 |
+
}
|
73 |
+
|
74 |
+
private function _abandonedCartsProcessor($collection, $store = null, $mark_time = true)
|
75 |
+
{
|
76 |
+
// Store the time we last run
|
77 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
78 |
+
$date = date($this->_date_format, $date);
|
79 |
+
|
80 |
+
if ($mark_time)
|
81 |
+
{
|
82 |
+
$this->_log("Saving Last Run Date: {$date}");
|
83 |
+
$this->_helper->updateConfig("abandoned_last_run", $date, $store);
|
84 |
+
}
|
85 |
+
|
86 |
+
$subscribers = false;
|
87 |
+
|
88 |
+
$xml = "<Subscribers>";
|
89 |
+
|
90 |
+
$quote_list = array();
|
91 |
+
|
92 |
+
// Get the data for each abandoned cart
|
93 |
+
foreach ($collection as $quote)
|
94 |
+
{
|
95 |
+
$quote_list[] = $quote->getId();
|
96 |
+
$xml .= $this->processAbandoned($quote, $date);
|
97 |
+
$subscribers = true;
|
98 |
+
}
|
99 |
+
|
100 |
+
$xml .= "</Subscribers>";
|
101 |
+
|
102 |
+
if (!$subscribers)
|
103 |
+
{
|
104 |
+
$this->_logReason("No Carts Found");
|
105 |
+
return; // No abandoned carts found
|
106 |
+
}
|
107 |
+
|
108 |
+
$this->_log("Sending Abandoned Carts");
|
109 |
+
// Send them all at once
|
110 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_abandoned')->sendSubscribers($xml);
|
111 |
+
|
112 |
+
if (isset($rc->ErrorCode))
|
113 |
+
{
|
114 |
+
$this->_log("EmailDirect Error: (" . (string) $rc->ErrorCode . "): " . (string)$rc->Message);
|
115 |
+
}
|
116 |
+
else
|
117 |
+
{
|
118 |
+
$this->_log("Setting date sent for all quotes Start");
|
119 |
+
$this->setDateSent($quote_list,$date);
|
120 |
+
$this->_log("Setting date sent for all quotes End");
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
private function setDateSent($quote_list, $date)
|
125 |
+
{
|
126 |
+
foreach ($quote_list as $quote_id)
|
127 |
+
{
|
128 |
+
$this->setSentToEmailDirectDate($quote_id, $date);
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
public function abandonedStoreProcessor($store, $check_date)
|
133 |
+
{
|
134 |
+
try
|
135 |
+
{
|
136 |
+
$store_code = $store->getCode();
|
137 |
+
|
138 |
+
$this->_log("Processing Store: {$store_code}");
|
139 |
+
|
140 |
+
if (!$this->_helper->getAbandonedEnabled())
|
141 |
+
{
|
142 |
+
$this->_logReason($this->_helper->getAbandonedDisabledReason());
|
143 |
+
return;
|
144 |
+
}
|
145 |
+
|
146 |
+
Mage::helper('emaildirect/fields')->checkFields();
|
147 |
+
|
148 |
+
// Setup sequence for this store
|
149 |
+
Mage::helper('emaildirect/abandoned')->setupSequence();
|
150 |
+
|
151 |
+
// Get abandoned collection
|
152 |
+
$collection = Mage::getResourceModel('emaildirect/abandoned_collection');
|
153 |
+
|
154 |
+
$collection->prepareForAbandonedProcess($check_date, $store->getId());
|
155 |
+
|
156 |
+
$this->_log("SQL: " . $collection->getSelect()->__toString());
|
157 |
+
|
158 |
+
$this->_abandonedCartsProcessor($collection, $store->getId());
|
159 |
+
|
160 |
+
Mage::helper('emaildirect/abandoned')->saveCurrentSequence();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
+
$this->_log("Finished Processing Store: {$store_code}");
|
163 |
+
}
|
164 |
+
catch (Exception $e)
|
165 |
+
{
|
166 |
+
Mage::logException($e);
|
167 |
+
$this->_logException($e);
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
public function manualCartsProcessor($store_id = null)
|
172 |
+
{
|
173 |
+
try
|
174 |
+
{
|
175 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
176 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::ABANDONED_CART);
|
177 |
+
$this->_log("Manual Abandoned Carts Processor Start");
|
178 |
+
|
179 |
+
$check_date = $this->getAbandonedTime();
|
180 |
+
|
181 |
+
$this->_log("Check Date: {$check_date}");
|
182 |
+
|
183 |
+
$stores = Mage::app()->getStores();
|
184 |
+
|
185 |
+
foreach ($stores as $store)
|
186 |
+
{
|
187 |
+
if ($store_id == null || $store_id == $store->getId())
|
188 |
+
{
|
189 |
+
Mage::app()->setCurrentStore($store->getCode());
|
190 |
+
|
191 |
+
$this->abandonedStoreProcessor($store, $check_date);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
196 |
+
|
197 |
+
$this->_log("Manual Abandoned Carts Processor End");
|
198 |
+
}
|
199 |
+
catch (Exception $e)
|
200 |
+
{
|
201 |
+
Mage::logException($e);
|
202 |
+
$this->_logException($e);
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
public function abandonedCartsProcessor()
|
207 |
+
{
|
208 |
+
try
|
209 |
+
{
|
210 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
211 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::ABANDONED_CART);
|
212 |
+
$this->_log("Abandoned Carts Processor Start");
|
213 |
+
|
214 |
+
$check_date = $this->getAbandonedTime();
|
215 |
+
|
216 |
+
$this->_log("Check Date: {$check_date}");
|
217 |
+
|
218 |
+
$stores = Mage::app()->getStores();
|
219 |
+
|
220 |
+
//$starting_store = Mage::app()->getStore()->getCode();
|
221 |
+
|
222 |
+
foreach ($stores as $store)
|
223 |
+
{
|
224 |
+
Mage::app()->setCurrentStore($store->getCode());
|
225 |
+
|
226 |
+
$this->abandonedStoreProcessor($store, $check_date);
|
227 |
+
}
|
228 |
+
|
229 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
230 |
+
|
231 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
232 |
+
$date = date($this->_date_format, $date);
|
233 |
+
|
234 |
+
$this->_log("Saving Last Cron Run Date: {$date}");
|
235 |
+
$this->_helper->updateConfig("cron_last_run", $date);
|
236 |
+
|
237 |
+
$this->_log("Abandoned Carts Processor End");
|
238 |
+
}
|
239 |
+
catch (Exception $e)
|
240 |
+
{
|
241 |
+
Mage::logException($e);
|
242 |
+
$this->_logException($e);
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
public function SendAbandonedCarts($id_list)
|
247 |
+
{
|
248 |
+
try
|
249 |
+
{
|
250 |
+
$count = 0;
|
251 |
+
|
252 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
253 |
+
|
254 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::ABANDONED_CART);
|
255 |
+
$this->_log("Sending Specific Abandoned Carts Start");
|
256 |
+
|
257 |
+
Mage::helper('emaildirect/fields')->checkFields();
|
258 |
+
|
259 |
+
$this->_log($id_list, "ID LIST");
|
260 |
+
|
261 |
+
$stores = Mage::app()->getStores();
|
262 |
+
|
263 |
+
foreach ($stores as $store)
|
264 |
+
{
|
265 |
+
$this->_log("Checking for valid carts in store: {$store->getName()} ({$store->getId()})");
|
266 |
+
if (!Mage::helper('emaildirect')->getAbandonedEnabled($store->getId()))
|
267 |
+
{
|
268 |
+
$this->_log('Abandoned Carts not enabled...');
|
269 |
+
continue;
|
270 |
+
}
|
271 |
+
|
272 |
+
Mage::app()->setCurrentStore($store->getCode());
|
273 |
+
|
274 |
+
// Get abandoned collection
|
275 |
+
$collection = Mage::getResourceModel('emaildirect/abandoned_collection');
|
276 |
+
|
277 |
+
$collection->prepareForManualAbandonedProcess($id_list, $store->getId());
|
278 |
+
|
279 |
+
$count += count($collection);
|
280 |
+
|
281 |
+
$this->_log("SQL: " . $collection->getSelect()->__toString());
|
282 |
+
|
283 |
+
// Setup sequence for this store
|
284 |
+
Mage::helper('emaildirect/abandoned')->setupSequence();
|
285 |
+
|
286 |
+
$this->_abandonedCartsProcessor($collection, $store, false);
|
287 |
+
|
288 |
+
Mage::helper('emaildirect/abandoned')->saveCurrentSequence();
|
289 |
+
}
|
290 |
+
|
291 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
292 |
+
|
293 |
+
$this->_log("Sending Specific Abandoned Carts End");
|
294 |
+
|
295 |
+
return $count;
|
296 |
+
}
|
297 |
+
catch (Exception $e)
|
298 |
+
{
|
299 |
+
Mage::logException($e);
|
300 |
+
$this->_logException($e);
|
301 |
+
}
|
302 |
}
|
303 |
+
|
304 |
// END ABANDONED CRON
|
305 |
+
|
306 |
+
// START QUOTE SAVE AFTER
|
307 |
+
public function quoteSaveAfter(Varien_Event_Observer $observer)
|
308 |
+
{
|
309 |
+
try
|
310 |
+
{
|
311 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::ABANDONED_CART);
|
312 |
+
$this->_logger->setLogLevel(EmailDirect_Integration_Helper_Troubleshooting::LOG_LEVEL_LOW);
|
313 |
+
$this->_log("Quote Save After Start");
|
314 |
+
|
315 |
+
if (!$this->_helper->getAbandonedEnabled())
|
316 |
+
{
|
317 |
+
$this->_logReason($this->_helper->getAbandonedDisabledReason());
|
318 |
+
return;
|
319 |
+
}
|
320 |
+
|
321 |
+
Mage::getSingleton('emaildirect/session')->init();
|
322 |
+
|
323 |
+
$this->_log("Quote Save After End");
|
324 |
+
$this->_logger->resetLogLevel();
|
325 |
+
}
|
326 |
+
catch (Exception $e)
|
327 |
+
{
|
328 |
+
$this->_logger->resetLogLevel();
|
329 |
+
Mage::logException($e);
|
330 |
+
$this->_logException($e);
|
331 |
+
}
|
332 |
}
|
333 |
// END QUOTE SAVE AFTER
|
334 |
+
}
|
app/code/community/EmailDirect/Integration/Model/Customer/Observer.php
CHANGED
@@ -2,262 +2,261 @@
|
|
2 |
|
3 |
class EmailDirect_Integration_Model_Customer_Observer extends EmailDirect_Integration_Model_Observer_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 |
-
|
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 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
}
|
2 |
|
3 |
class EmailDirect_Integration_Model_Customer_Observer extends EmailDirect_Integration_Model_Observer_Abstract
|
4 |
{
|
5 |
+
private function hasCustomerChanged($customer)
|
6 |
+
{
|
7 |
+
$maps = unserialize( $this->_helper->config('map_fields', $customer->getStoreId()) );
|
8 |
+
|
9 |
+
$this->_log('Checking for mapped data changes');
|
10 |
+
|
11 |
+
foreach ($maps as $map)
|
12 |
+
{
|
13 |
+
$field = $map['magento'];
|
14 |
+
$original = $customer->getOrigData($field);
|
15 |
+
$current = $customer->getData($field);
|
16 |
+
|
17 |
+
$this->_log("Original: {$original} - Current: {$current}");
|
18 |
+
|
19 |
+
if ($original != $current)
|
20 |
+
return true;
|
21 |
+
}
|
22 |
+
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function getMergeCustomer($object = NULL)
|
27 |
+
{
|
28 |
+
//Initialize as GUEST customer
|
29 |
+
$customer = new Varien_Object;
|
30 |
+
|
31 |
+
$this->_log("Observer Merge Vars");
|
32 |
+
|
33 |
+
$regCustomer = Mage::registry('current_customer');
|
34 |
+
$guestCustomer = Mage::registry('ed_guest_customer');
|
35 |
+
|
36 |
+
if (Mage::helper('customer')->isLoggedIn())
|
37 |
+
{
|
38 |
+
$this->_log("Logged in Customer");
|
39 |
+
$customer = Mage::helper('customer')->getCustomer();
|
40 |
+
}
|
41 |
+
else if ($regCustomer)
|
42 |
+
{
|
43 |
+
$this->_log("Current Customer");
|
44 |
+
$customer = $regCustomer;
|
45 |
+
}
|
46 |
+
else if ($guestCustomer)
|
47 |
+
{
|
48 |
+
$this->_log("Guest Customer");
|
49 |
+
$customer = $guestCustomer;
|
50 |
+
}
|
51 |
+
else
|
52 |
+
{
|
53 |
+
$this->_log("Parameter Customer");
|
54 |
+
$customer = $object;
|
55 |
+
}
|
56 |
+
|
57 |
+
$address = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
|
58 |
+
if ($address)
|
59 |
+
$customer->setBillingAddress($address);
|
60 |
+
|
61 |
+
return $customer;
|
62 |
+
}
|
63 |
+
|
64 |
+
public function customerLogin(Varien_Event_Observer $observer)
|
65 |
+
{
|
66 |
+
try
|
67 |
+
{
|
68 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::CUSTOMER);
|
69 |
+
$this->_log("Customer Login Start");
|
70 |
+
|
71 |
+
if (!$this->_helper->canSendLastLogin())
|
72 |
+
{
|
73 |
+
$this->_logReason($this->_helper->getLastLoginDisabledReason());
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
+
$customer = $observer->getEvent()->getCustomer();
|
78 |
+
|
79 |
+
if (!$customer)
|
80 |
+
{
|
81 |
+
$this->_logReason("Customer not found");
|
82 |
+
return;
|
83 |
+
}
|
84 |
+
|
85 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
86 |
+
$date = date($this->_date_format, $date);
|
87 |
+
|
88 |
+
$this->_log("Last Login Date: {$date}");
|
89 |
+
|
90 |
+
$email = $customer->getEmail();
|
91 |
+
|
92 |
+
$this->_log("Email: {$email}");
|
93 |
+
|
94 |
+
Mage::getSingleton('emaildirect/wrapper_subscribers')->sendLastLogin($email, $date);
|
95 |
+
|
96 |
+
$this->_log("Customer Login End");
|
97 |
+
}
|
98 |
+
catch (Exception $e)
|
99 |
+
{
|
100 |
+
Mage::logException($e);
|
101 |
+
$this->_logException($e);
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
public function updateCustomer(Varien_Event_Observer $observer)
|
106 |
+
{
|
107 |
+
try
|
108 |
+
{
|
109 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::CUSTOMER);
|
110 |
+
$this->_log("Update Customer Start");
|
111 |
+
|
112 |
+
if (!$this->_helper->canEdirect())
|
113 |
+
{
|
114 |
+
$this->_logReason($this->_helper->getDisabledReason());
|
115 |
+
return;
|
116 |
+
}
|
117 |
+
|
118 |
+
$customer = $observer->getEvent()->getCustomer();
|
119 |
+
|
120 |
+
if (!$customer)
|
121 |
+
{
|
122 |
+
$this->_logReason("Customer not found");
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
$customer = $this->getMergeCustomer($customer);
|
127 |
+
|
128 |
+
$merge_vars = $this->_helper->getMergeVars($customer);
|
129 |
+
|
130 |
+
$this->_log($merge_vars,"Merge Vars");
|
131 |
+
|
132 |
+
$api = Mage::getSingleton('emaildirect/wrapper_subscribers');
|
133 |
+
|
134 |
+
$oldEmail = $customer->getOrigData('email');
|
135 |
+
$email = $customer->getEmail();
|
136 |
+
|
137 |
+
if ($oldEmail == '')
|
138 |
+
{
|
139 |
+
$this->_log("Original Email was blank. Adding Subscriber");
|
140 |
+
$rc = $api->subscriberAdd($email,$merge_vars,"",false);
|
141 |
+
}
|
142 |
+
elseif ($oldEmail != $email)
|
143 |
+
{
|
144 |
+
$this->_log("Modifying Email");
|
145 |
+
|
146 |
+
// If this fails we just add the subscriber
|
147 |
+
$rc = $api->mailModify($oldEmail,$email);
|
148 |
+
|
149 |
+
$this->_log("Adding Subscriber");
|
150 |
+
$rc = $api->subscriberAdd($email,$merge_vars,"",false);
|
151 |
+
}
|
152 |
+
else
|
153 |
+
{
|
154 |
+
if ($this->hasCustomerChanged($customer))
|
155 |
+
{
|
156 |
+
$this->_log("Updating Subscriber");
|
157 |
+
$rc = $api->subscriberAdd($email,$merge_vars,"",false);
|
158 |
+
}
|
159 |
+
else
|
160 |
+
$this->_logReason("Neither Email nor Mapped Data changed");
|
161 |
+
}
|
162 |
+
|
163 |
+
$this->_log("Update Customer End");
|
164 |
+
}
|
165 |
+
catch (Exception $e)
|
166 |
+
{
|
167 |
+
Mage::logException($e);
|
168 |
+
$this->_logException($e);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
public function updateCustomerAdmin(Varien_Event_Observer $observer)
|
173 |
+
{
|
174 |
+
try
|
175 |
+
{
|
176 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::CUSTOMER);
|
177 |
+
$this->_log("Update Customer (Admin) Start");
|
178 |
+
|
179 |
+
$starting_store = Mage::app()->getStore()->getCode();
|
180 |
+
|
181 |
+
$customer = $observer->getEvent()->getCustomer();
|
182 |
+
|
183 |
+
if (!$customer)
|
184 |
+
{
|
185 |
+
$this->_logReason("Customer not found");
|
186 |
+
return;
|
187 |
+
}
|
188 |
+
|
189 |
+
$customer_store = $customer->getStore()->getId();
|
190 |
+
|
191 |
+
$current_store = Mage::app()->getStore()->getId();
|
192 |
+
|
193 |
+
$this->_log("Checking store");
|
194 |
+
|
195 |
+
if ($current_store == 0)
|
196 |
+
{
|
197 |
+
$this->_log("Admin store current");
|
198 |
+
if ($customer_store == 0)
|
199 |
+
{
|
200 |
+
$this->_logReason("Customer store can't be determined");
|
201 |
+
return;
|
202 |
+
}
|
203 |
+
else
|
204 |
+
Mage::app()->setCurrentStore($customer_store);
|
205 |
+
}
|
206 |
+
|
207 |
+
$this->_log("Correct store found");
|
208 |
+
|
209 |
+
if (!$this->_helper->canEdirect())
|
210 |
+
{
|
211 |
+
$this->_logReason($this->_helper->getDisabledReason());
|
212 |
+
Mage::app()->setCurrentStore($starting_store);
|
213 |
+
return;
|
214 |
+
}
|
215 |
+
|
216 |
+
$merge_vars = $this->_helper->getMergeVars($customer);
|
217 |
+
|
218 |
+
$this->_log($merge_vars,"Merge Vars");
|
219 |
+
|
220 |
+
$api = Mage::getSingleton('emaildirect/wrapper_subscribers');
|
221 |
+
|
222 |
+
$oldEmail = $customer->getOrigData('email');
|
223 |
+
$email = $customer->getEmail();
|
224 |
+
|
225 |
+
if ($oldEmail == '')
|
226 |
+
{
|
227 |
+
$this->_log("Original Email was blank. Adding Subscriber");
|
228 |
+
$rc = $api->subscriberAdd($email,$merge_vars,"",false);
|
229 |
+
}
|
230 |
+
elseif ($oldEmail != $email)
|
231 |
+
{
|
232 |
+
$this->_log("Modifying Email");
|
233 |
+
|
234 |
+
// If this fails we just add the subscriber
|
235 |
+
$rc = $api->mailModify($oldEmail,$email);
|
236 |
+
|
237 |
+
$this->_log("Adding Subscriber");
|
238 |
+
$rc = $api->subscriberAdd($email,$merge_vars,"",false);
|
239 |
+
}
|
240 |
+
else
|
241 |
+
{
|
242 |
+
if ($this->hasCustomerChanged($customer))
|
243 |
+
{
|
244 |
+
$this->_log("Updating Subscriber");
|
245 |
+
$rc = $api->subscriberAdd($email,$merge_vars,"",false);
|
246 |
+
}
|
247 |
+
else
|
248 |
+
$this->_logReason("Neither Email nor Mapped Data changed");
|
249 |
+
}
|
250 |
+
|
251 |
+
$this->_log("Update Customer End");
|
252 |
+
}
|
253 |
+
catch (Exception $e)
|
254 |
+
{
|
255 |
+
Mage::logException($e);
|
256 |
+
$this->_logException($e);
|
257 |
+
}
|
258 |
+
|
259 |
+
Mage::app()->setCurrentStore($starting_store);
|
260 |
+
return;
|
261 |
+
}
|
262 |
+
}
|
|
app/code/community/EmailDirect/Integration/Model/Newsletter/Observer.php
CHANGED
@@ -2,251 +2,251 @@
|
|
2 |
|
3 |
class EmailDirect_Integration_Model_Newsletter_Observer extends EmailDirect_Integration_Model_Observer_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 |
-
|
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 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
}
|
2 |
|
3 |
class EmailDirect_Integration_Model_Newsletter_Observer extends EmailDirect_Integration_Model_Observer_Abstract
|
4 |
{
|
5 |
+
/**
|
6 |
+
* Handle Subscriber object saving process
|
7 |
+
*/
|
8 |
+
public function handleSubscriber(Varien_Event_Observer $observer)
|
9 |
+
{
|
10 |
+
try
|
11 |
+
{
|
12 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::NEWSLETTER);
|
13 |
+
$this->_log('handleSubscriber Start');
|
14 |
+
|
15 |
+
if (!$this->_helper->canEdirect())
|
16 |
+
{
|
17 |
+
$this->_logReason($this->_helper->getDisabledReason());
|
18 |
+
return;
|
19 |
+
}
|
20 |
+
|
21 |
+
$subscriber = $observer->getEvent()->getSubscriber();
|
22 |
+
$subscriber->setImportMode(false);
|
23 |
+
|
24 |
+
$email = $subscriber->getSubscriberEmail();
|
25 |
+
$listId = $this->_helper->getDefaultPublication($subscriber->getStoreId());
|
26 |
+
$isConfirmNeed = (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $subscriber->getStoreId()) == 1) ? TRUE : FALSE;
|
27 |
+
|
28 |
+
//New subscriber, just add
|
29 |
+
if ($subscriber->isObjectNew())
|
30 |
+
{
|
31 |
+
$this->_log("New Subscriber");
|
32 |
+
if (TRUE === $isConfirmNeed)
|
33 |
+
{
|
34 |
+
$this->_log("Confirmation Needed");
|
35 |
+
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
36 |
+
if (!Mage::helper('customer')->isLoggedIn() && Mage::registry('ed_guest_customer'))
|
37 |
+
{
|
38 |
+
$this->_log("Guest Customer");
|
39 |
+
$guestCustomer = Mage::registry('ed_guest_customer');
|
40 |
+
$subscriber->setFirstname($guestCustomer->getFirstname());
|
41 |
+
$subscriber->setLastname($guestCustomer->getLastname());
|
42 |
+
Mage::unregister('ed_guest_customer');
|
43 |
+
$subscriber->save();
|
44 |
+
}
|
45 |
+
else
|
46 |
+
$this->_log("Not a Guest Customer (Doing Nothing?)");
|
47 |
+
}
|
48 |
+
else
|
49 |
+
{
|
50 |
+
$this->_log("Confirmation Not Required");
|
51 |
+
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
52 |
+
$merge_vars = $this->_helper->getMergeVars($subscriber);
|
53 |
+
|
54 |
+
$this->_log($merge_vars,"Merge Vars");
|
55 |
+
|
56 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
|
57 |
+
->subscriberAdd($email,$merge_vars);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
else
|
61 |
+
{
|
62 |
+
$this->_log("Existing Subscriber");
|
63 |
+
$status = (int)$subscriber->getData('subscriber_status');
|
64 |
+
|
65 |
+
$oldSubscriber = Mage::getModel('newsletter/subscriber')
|
66 |
+
->load($subscriber->getId());
|
67 |
+
$oldstatus = (int)$oldSubscriber->getOrigData('subscriber_status');
|
68 |
+
if ($oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED && $status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
69 |
+
{
|
70 |
+
$this->_log("Unconfirmed to Subscribed");
|
71 |
+
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
72 |
+
$merge_vars = $this->_helper->getMergeVars($subscriber);
|
73 |
+
|
74 |
+
$this->_log($merge_vars,"Merge Vars");
|
75 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
|
76 |
+
->subscriberAdd($email,$merge_vars);
|
77 |
+
}
|
78 |
+
elseif( $status !== $oldstatus )
|
79 |
+
{
|
80 |
+
//Status change
|
81 |
+
$this->_log("Status Change");
|
82 |
+
|
83 |
+
//Unsubscribe customer
|
84 |
+
if($status == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
|
85 |
+
{
|
86 |
+
$this->_log("Unsubscribed");
|
87 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_publications')
|
88 |
+
->unsubscribe($listId, $email);
|
89 |
+
}
|
90 |
+
else if($status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
91 |
+
{
|
92 |
+
$this->_log("Subscribed");
|
93 |
+
if( $oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE || $oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED )
|
94 |
+
{
|
95 |
+
$this->_log("Changing Status");
|
96 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_publications')
|
97 |
+
->subscribe($listId, $email);
|
98 |
+
}
|
99 |
+
else
|
100 |
+
$this->_log("Status Not Changed");
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
$this->_log('handleSubscriber End');
|
105 |
+
}
|
106 |
+
catch (Exception $e)
|
107 |
+
{
|
108 |
+
Mage::logException($e);
|
109 |
+
$this->_logException($e);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
// Remove Unsubscribe option from Newsletter grid
|
114 |
+
public function updateNewsletterMassAction($observer)
|
115 |
+
{
|
116 |
+
try
|
117 |
+
{
|
118 |
+
if (!$this->_helper->canEdirect())
|
119 |
+
return;
|
120 |
+
|
121 |
+
$block = $observer->getEvent()->getBlock();
|
122 |
+
|
123 |
+
if (get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
|
124 |
+
&& $block->getRequest()->getControllerName() == 'newsletter_subscriber')
|
125 |
+
{
|
126 |
+
$block->removeItem('unsubscribe');
|
127 |
+
}
|
128 |
+
}
|
129 |
+
catch (Exception $e)
|
130 |
+
{
|
131 |
+
Mage::logException($e);
|
132 |
+
$this->_logException($e);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Handle Subscriber deletion from Magento, unsubcribes email
|
138 |
+
* and sends the delete_member flag so the subscriber gets deleted.
|
139 |
+
*/
|
140 |
+
public function handleSubscriberDeletion(Varien_Event_Observer $observer)
|
141 |
+
{
|
142 |
+
try
|
143 |
+
{
|
144 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::NEWSLETTER);
|
145 |
+
$this->_log("Handle Subscriber Deletion Start");
|
146 |
+
|
147 |
+
if (!$this->_helper->canEdirect())
|
148 |
+
{
|
149 |
+
$this->_logReason($this->_helper->getDisabledReason());
|
150 |
+
return;
|
151 |
+
}
|
152 |
+
|
153 |
+
$subscriber = $observer->getEvent()->getSubscriber();
|
154 |
+
|
155 |
+
$email = $subscriber->getSubscriberEmail();
|
156 |
+
|
157 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
|
158 |
+
->subscriberDelete($email);
|
159 |
+
|
160 |
+
$this->_log("Handle Subscriber Deletion End");
|
161 |
+
}
|
162 |
+
catch (Exception $e)
|
163 |
+
{
|
164 |
+
Mage::logException($e);
|
165 |
+
$this->_logException($e);
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
public function registerCheckoutSubscribe(Varien_Event_Observer $observer)
|
170 |
+
{
|
171 |
+
try
|
172 |
+
{
|
173 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::NEWSLETTER);
|
174 |
+
$this->_log("Register Checkout Subscribe Start");
|
175 |
+
if (!$this->_helper->canEdirect())
|
176 |
+
{
|
177 |
+
$this->_logReason($this->_helper->getDisabledReason());
|
178 |
+
return;
|
179 |
+
}
|
180 |
+
$subscribe = Mage::app()->getRequest()->getPost('emaildirect_subscribe');
|
181 |
+
|
182 |
+
if (!is_null($subscribe) || $this->_helper->forceSubscribe())
|
183 |
+
Mage::getSingleton('core/session')->setEmaildirectCheckout($subscribe);
|
184 |
+
|
185 |
+
$this->_log("Register Checkout Subscribe End");
|
186 |
+
}
|
187 |
+
catch (Exception $e)
|
188 |
+
{
|
189 |
+
Mage::logException($e);
|
190 |
+
$this->_logException($e);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Subscribe customer to Newsletter if flag on session is present
|
196 |
+
*/
|
197 |
+
public function registerCheckoutSuccess(Varien_Event_Observer $observer)
|
198 |
+
{
|
199 |
+
try
|
200 |
+
{
|
201 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::NEWSLETTER);
|
202 |
+
$this->_log("Register Checkout Success Start");
|
203 |
+
|
204 |
+
if (!$this->_helper->canEdirect())
|
205 |
+
{
|
206 |
+
$this->_logReason($this->_helper->getDisabledReason());
|
207 |
+
return;
|
208 |
+
}
|
209 |
+
|
210 |
+
$sessionFlag = Mage::getSingleton('core/session')->getEmaildirectCheckout(TRUE);
|
211 |
+
if (!$sessionFlag && !$this->_helper->forceSubscribe())
|
212 |
+
{
|
213 |
+
$this->_logReason("Session flag not found.");
|
214 |
+
return;
|
215 |
+
}
|
216 |
+
|
217 |
+
$order_id = (int)current($observer->getEvent()->getOrderIds());
|
218 |
+
|
219 |
+
if (!$order_id)
|
220 |
+
{
|
221 |
+
$this->_logReason("Order ID not found.");
|
222 |
+
return;
|
223 |
+
}
|
224 |
+
|
225 |
+
$order = Mage::getModel('sales/order')->load($order_id);
|
226 |
+
if (!$order->getId())
|
227 |
+
{
|
228 |
+
$this->_logReason("Failed to Load Order ({$order_id}).");
|
229 |
+
return;
|
230 |
+
}
|
231 |
+
|
232 |
+
$this->_log("Processing Order # " . $order->getIncrementId());
|
233 |
+
|
234 |
+
//Guest Checkout
|
235 |
+
if ((int)$order->getCustomerGroupId() === Mage_Customer_Model_Group::NOT_LOGGED_IN_ID )
|
236 |
+
{
|
237 |
+
$this->_log("Guest Checkout");
|
238 |
+
$this->_helper->registerGuestCustomer($order);
|
239 |
+
}
|
240 |
+
|
241 |
+
$subscriber = Mage::getModel('newsletter/subscriber')
|
242 |
+
->subscribe($order->getCustomerEmail());
|
243 |
+
|
244 |
+
$this->_log("Register Checkout Success End");
|
245 |
+
}
|
246 |
+
catch (Exception $e)
|
247 |
+
{
|
248 |
+
Mage::logException($e);
|
249 |
+
$this->_logException($e);
|
250 |
+
}
|
251 |
+
}
|
252 |
+
}
|
app/code/community/EmailDirect/Integration/controllers/AbandonedController.php
CHANGED
@@ -7,12 +7,12 @@ class EmailDirect_Integration_AbandonedController extends EmailDirect_Integratio
|
|
7 |
try
|
8 |
{
|
9 |
$coded_cart = Mage::app()->getRequest()->getParam('cart');
|
10 |
-
|
11 |
$cart_data = unserialize(base64_decode($coded_cart));
|
12 |
-
|
13 |
$this->clearCart($cart_data['quote']);
|
14 |
$this->restoreCartItems($cart_data);
|
15 |
-
|
16 |
$this->_redirect("checkout/cart");
|
17 |
}
|
18 |
catch (Exception $e)
|
@@ -22,73 +22,73 @@ class EmailDirect_Integration_AbandonedController extends EmailDirect_Integratio
|
|
22 |
$this->_redirect("checkout/cart");
|
23 |
}
|
24 |
}
|
25 |
-
|
26 |
private function processBundleOptions($option)
|
27 |
{
|
28 |
$option_data = explode("-", $option);
|
29 |
-
|
30 |
$bundle_option = array();
|
31 |
$bundle_option_qty = array();
|
32 |
-
|
33 |
foreach ($option_data as $od)
|
34 |
{
|
35 |
$od_parts = explode("=",$od);
|
36 |
-
|
37 |
$option_id = $od_parts[0];
|
38 |
-
|
39 |
$products = $od_parts[1];
|
40 |
-
|
41 |
if (strpos($products,"~"))
|
42 |
{
|
43 |
// Single Item with Qty
|
44 |
$option_products = explode("~",$products);
|
45 |
-
|
46 |
$bundle_option[$option_id] = $option_products[0];
|
47 |
-
|
48 |
$bundle_option_qty[$option_id] = $option_products[1];
|
49 |
}
|
50 |
else
|
51 |
{
|
52 |
// 1 or more items with no qty
|
53 |
$option_products = explode(":",$products);
|
54 |
-
|
55 |
foreach ($option_products as $op)
|
56 |
{
|
57 |
$bundle_option[$option_id][] = $op;
|
58 |
}
|
59 |
}
|
60 |
}
|
61 |
-
|
62 |
return array('bundle_option' => $bundle_option, 'bundle_option_qty' => $bundle_option_qty);
|
63 |
}
|
64 |
-
|
65 |
private function prepareCartItems($cart_data)
|
66 |
{
|
67 |
$id_list = explode(",",$cart_data['id']);
|
68 |
$qty_list = explode(",",$cart_data['qty']);
|
69 |
-
|
70 |
$item_list = array();
|
71 |
$group_list = array();
|
72 |
$position = 0;
|
73 |
-
|
74 |
foreach ($id_list as $key => $item_id)
|
75 |
{
|
76 |
$position++;
|
77 |
$qty = $qty_list[$key];
|
78 |
-
|
79 |
$id_parts = explode('|',$item_id);
|
80 |
-
|
81 |
// If there is more than just an id then we have a complex product
|
82 |
if (count($id_parts) > 1)
|
83 |
{
|
84 |
$id = $id_parts[0];
|
85 |
$option = $id_parts[1];
|
86 |
-
|
87 |
// MAKE SURE WE CAN LOAD THE PRODUCT
|
88 |
$product = Mage::getModel('catalog/product')->load($id);
|
89 |
if (!$product)
|
90 |
continue;
|
91 |
-
|
92 |
switch ($product->getTypeId())
|
93 |
{
|
94 |
case "configurable":
|
@@ -103,10 +103,10 @@ class EmailDirect_Integration_AbandonedController extends EmailDirect_Integratio
|
|
103 |
case "simple": // Grouped simple products
|
104 |
{
|
105 |
$parent_product = Mage::getModel('catalog/product')->load($option);
|
106 |
-
|
107 |
if (!$parent_product)
|
108 |
continue;
|
109 |
-
|
110 |
if (!isset($group_list[$option]))
|
111 |
{
|
112 |
$group_list[$option] = array(
|
@@ -116,7 +116,7 @@ class EmailDirect_Integration_AbandonedController extends EmailDirect_Integratio
|
|
116 |
'option' => array('super_group' => array())
|
117 |
);
|
118 |
}
|
119 |
-
|
120 |
$group_list[$option]['option']['super_group'][$id] = $qty;
|
121 |
} break;
|
122 |
case "bundle":
|
@@ -133,12 +133,12 @@ class EmailDirect_Integration_AbandonedController extends EmailDirect_Integratio
|
|
133 |
else
|
134 |
{
|
135 |
// Simple Product
|
136 |
-
|
137 |
// MAKE SURE WE CAN LOAD THE PRODUCT
|
138 |
$product = Mage::getModel('catalog/product')->load($item_id);
|
139 |
if (!$product)
|
140 |
continue;
|
141 |
-
|
142 |
$item_list[] = array(
|
143 |
'product_type' => 'simple',
|
144 |
'product' => $product,
|
@@ -146,25 +146,25 @@ class EmailDirect_Integration_AbandonedController extends EmailDirect_Integratio
|
|
146 |
);
|
147 |
}
|
148 |
}
|
149 |
-
|
150 |
// Merge the group and simple products
|
151 |
foreach ($group_list as $group)
|
152 |
{
|
153 |
$item_list[$group['position']] = $group;
|
154 |
}
|
155 |
-
|
156 |
// Sort it so that the order matches the cart order
|
157 |
ksort($item_list);
|
158 |
-
|
159 |
return $item_list;
|
160 |
}
|
161 |
-
|
162 |
private function restoreCartItems($cart_data)
|
163 |
{
|
164 |
$quote = $this->getQuote();
|
165 |
-
|
166 |
$item_list = $this->prepareCartItems($cart_data);
|
167 |
-
|
168 |
foreach ($item_list as $item)
|
169 |
{
|
170 |
$this->addItemToCart($item);
|
@@ -174,23 +174,23 @@ class EmailDirect_Integration_AbandonedController extends EmailDirect_Integratio
|
|
174 |
$quote->getBillingAddress();
|
175 |
$quote->collectTotals();
|
176 |
$quote->save();
|
177 |
-
|
178 |
$this->getCheckout()->setQuoteId($quote->getId());
|
179 |
}
|
180 |
-
|
181 |
private function addItemToCart($item)
|
182 |
{
|
183 |
try
|
184 |
{
|
185 |
$product = $item['product'];
|
186 |
-
|
187 |
$data = array(
|
188 |
'options' => array()
|
189 |
);
|
190 |
-
|
191 |
if (isset($item['qty']))
|
192 |
$data['qty'] = $item['qty'];
|
193 |
-
|
194 |
if (isset($item['option']))
|
195 |
{
|
196 |
foreach ($item['option'] as $key => $option)
|
@@ -200,66 +200,66 @@ class EmailDirect_Integration_AbandonedController extends EmailDirect_Integratio
|
|
200 |
}
|
201 |
|
202 |
$quote = $this->getQuote();
|
203 |
-
|
204 |
// add the product to our quote
|
205 |
$quote->addProductAdvanced($product, new Varien_Object($data));
|
206 |
|
207 |
return true;
|
208 |
-
}
|
209 |
catch (Exception $e)
|
210 |
{
|
211 |
Mage::logException($e);
|
212 |
return false;
|
213 |
}
|
214 |
}
|
215 |
-
|
216 |
private function removeOldQuote($original_quote_id)
|
217 |
{
|
218 |
$quote = Mage::getModel('sales/quote')->load($original_quote_id);
|
219 |
-
|
220 |
if ($quote->getId() == $original_quote_id)
|
221 |
$quote->delete();
|
222 |
}
|
223 |
-
|
224 |
private function clearCart($original_quote_id)
|
225 |
{
|
226 |
$customer_session = Mage::getSingleton('customer/session');
|
227 |
-
|
228 |
$checkout = $this->getCheckout();
|
229 |
-
|
230 |
$checkout->clear();
|
231 |
-
|
232 |
$quote = $this->getQuote();
|
233 |
-
|
234 |
// Check to see if we need to remove the quote
|
235 |
// if they aren't logged in then we will need to otherwise when they login the items won't match
|
236 |
$test_mode = Mage::app()->getRequest()->getParam('test_mode') == "true";
|
237 |
-
|
238 |
if ((!$test_mode && $quote->getId() != $original_quote_id))
|
239 |
$this->removeOldQuote($original_quote_id);
|
240 |
-
|
241 |
-
foreach ($quote->getItemsCollection() as $item)
|
242 |
{
|
243 |
$item->isDeleted(true);
|
244 |
}
|
245 |
-
|
246 |
$quote->getBillingAddress();
|
247 |
$quote->getShippingAddress();
|
248 |
$quote->getPayment();
|
249 |
$quote->setEmailDirectAbandonedDate(null);
|
250 |
-
|
251 |
$customer = $customer_session->getCustomer();
|
252 |
if ($customer)
|
253 |
$quote->assignCustomer($customer);
|
254 |
-
|
255 |
$quote->save();
|
256 |
}
|
257 |
-
|
258 |
private function getQuote()
|
259 |
{
|
260 |
return Mage::getSingleton('checkout/session')->getQuote();
|
261 |
}
|
262 |
-
|
263 |
private function getCheckout()
|
264 |
{
|
265 |
return Mage::getSingleton('checkout/session');
|
7 |
try
|
8 |
{
|
9 |
$coded_cart = Mage::app()->getRequest()->getParam('cart');
|
10 |
+
|
11 |
$cart_data = unserialize(base64_decode($coded_cart));
|
12 |
+
|
13 |
$this->clearCart($cart_data['quote']);
|
14 |
$this->restoreCartItems($cart_data);
|
15 |
+
|
16 |
$this->_redirect("checkout/cart");
|
17 |
}
|
18 |
catch (Exception $e)
|
22 |
$this->_redirect("checkout/cart");
|
23 |
}
|
24 |
}
|
25 |
+
|
26 |
private function processBundleOptions($option)
|
27 |
{
|
28 |
$option_data = explode("-", $option);
|
29 |
+
|
30 |
$bundle_option = array();
|
31 |
$bundle_option_qty = array();
|
32 |
+
|
33 |
foreach ($option_data as $od)
|
34 |
{
|
35 |
$od_parts = explode("=",$od);
|
36 |
+
|
37 |
$option_id = $od_parts[0];
|
38 |
+
|
39 |
$products = $od_parts[1];
|
40 |
+
|
41 |
if (strpos($products,"~"))
|
42 |
{
|
43 |
// Single Item with Qty
|
44 |
$option_products = explode("~",$products);
|
45 |
+
|
46 |
$bundle_option[$option_id] = $option_products[0];
|
47 |
+
|
48 |
$bundle_option_qty[$option_id] = $option_products[1];
|
49 |
}
|
50 |
else
|
51 |
{
|
52 |
// 1 or more items with no qty
|
53 |
$option_products = explode(":",$products);
|
54 |
+
|
55 |
foreach ($option_products as $op)
|
56 |
{
|
57 |
$bundle_option[$option_id][] = $op;
|
58 |
}
|
59 |
}
|
60 |
}
|
61 |
+
|
62 |
return array('bundle_option' => $bundle_option, 'bundle_option_qty' => $bundle_option_qty);
|
63 |
}
|
64 |
+
|
65 |
private function prepareCartItems($cart_data)
|
66 |
{
|
67 |
$id_list = explode(",",$cart_data['id']);
|
68 |
$qty_list = explode(",",$cart_data['qty']);
|
69 |
+
|
70 |
$item_list = array();
|
71 |
$group_list = array();
|
72 |
$position = 0;
|
73 |
+
|
74 |
foreach ($id_list as $key => $item_id)
|
75 |
{
|
76 |
$position++;
|
77 |
$qty = $qty_list[$key];
|
78 |
+
|
79 |
$id_parts = explode('|',$item_id);
|
80 |
+
|
81 |
// If there is more than just an id then we have a complex product
|
82 |
if (count($id_parts) > 1)
|
83 |
{
|
84 |
$id = $id_parts[0];
|
85 |
$option = $id_parts[1];
|
86 |
+
|
87 |
// MAKE SURE WE CAN LOAD THE PRODUCT
|
88 |
$product = Mage::getModel('catalog/product')->load($id);
|
89 |
if (!$product)
|
90 |
continue;
|
91 |
+
|
92 |
switch ($product->getTypeId())
|
93 |
{
|
94 |
case "configurable":
|
103 |
case "simple": // Grouped simple products
|
104 |
{
|
105 |
$parent_product = Mage::getModel('catalog/product')->load($option);
|
106 |
+
|
107 |
if (!$parent_product)
|
108 |
continue;
|
109 |
+
|
110 |
if (!isset($group_list[$option]))
|
111 |
{
|
112 |
$group_list[$option] = array(
|
116 |
'option' => array('super_group' => array())
|
117 |
);
|
118 |
}
|
119 |
+
|
120 |
$group_list[$option]['option']['super_group'][$id] = $qty;
|
121 |
} break;
|
122 |
case "bundle":
|
133 |
else
|
134 |
{
|
135 |
// Simple Product
|
136 |
+
|
137 |
// MAKE SURE WE CAN LOAD THE PRODUCT
|
138 |
$product = Mage::getModel('catalog/product')->load($item_id);
|
139 |
if (!$product)
|
140 |
continue;
|
141 |
+
|
142 |
$item_list[] = array(
|
143 |
'product_type' => 'simple',
|
144 |
'product' => $product,
|
146 |
);
|
147 |
}
|
148 |
}
|
149 |
+
|
150 |
// Merge the group and simple products
|
151 |
foreach ($group_list as $group)
|
152 |
{
|
153 |
$item_list[$group['position']] = $group;
|
154 |
}
|
155 |
+
|
156 |
// Sort it so that the order matches the cart order
|
157 |
ksort($item_list);
|
158 |
+
|
159 |
return $item_list;
|
160 |
}
|
161 |
+
|
162 |
private function restoreCartItems($cart_data)
|
163 |
{
|
164 |
$quote = $this->getQuote();
|
165 |
+
|
166 |
$item_list = $this->prepareCartItems($cart_data);
|
167 |
+
|
168 |
foreach ($item_list as $item)
|
169 |
{
|
170 |
$this->addItemToCart($item);
|
174 |
$quote->getBillingAddress();
|
175 |
$quote->collectTotals();
|
176 |
$quote->save();
|
177 |
+
|
178 |
$this->getCheckout()->setQuoteId($quote->getId());
|
179 |
}
|
180 |
+
|
181 |
private function addItemToCart($item)
|
182 |
{
|
183 |
try
|
184 |
{
|
185 |
$product = $item['product'];
|
186 |
+
|
187 |
$data = array(
|
188 |
'options' => array()
|
189 |
);
|
190 |
+
|
191 |
if (isset($item['qty']))
|
192 |
$data['qty'] = $item['qty'];
|
193 |
+
|
194 |
if (isset($item['option']))
|
195 |
{
|
196 |
foreach ($item['option'] as $key => $option)
|
200 |
}
|
201 |
|
202 |
$quote = $this->getQuote();
|
203 |
+
|
204 |
// add the product to our quote
|
205 |
$quote->addProductAdvanced($product, new Varien_Object($data));
|
206 |
|
207 |
return true;
|
208 |
+
}
|
209 |
catch (Exception $e)
|
210 |
{
|
211 |
Mage::logException($e);
|
212 |
return false;
|
213 |
}
|
214 |
}
|
215 |
+
|
216 |
private function removeOldQuote($original_quote_id)
|
217 |
{
|
218 |
$quote = Mage::getModel('sales/quote')->load($original_quote_id);
|
219 |
+
|
220 |
if ($quote->getId() == $original_quote_id)
|
221 |
$quote->delete();
|
222 |
}
|
223 |
+
|
224 |
private function clearCart($original_quote_id)
|
225 |
{
|
226 |
$customer_session = Mage::getSingleton('customer/session');
|
227 |
+
|
228 |
$checkout = $this->getCheckout();
|
229 |
+
|
230 |
$checkout->clear();
|
231 |
+
|
232 |
$quote = $this->getQuote();
|
233 |
+
|
234 |
// Check to see if we need to remove the quote
|
235 |
// if they aren't logged in then we will need to otherwise when they login the items won't match
|
236 |
$test_mode = Mage::app()->getRequest()->getParam('test_mode') == "true";
|
237 |
+
|
238 |
if ((!$test_mode && $quote->getId() != $original_quote_id))
|
239 |
$this->removeOldQuote($original_quote_id);
|
240 |
+
|
241 |
+
foreach ($quote->getItemsCollection() as $item)
|
242 |
{
|
243 |
$item->isDeleted(true);
|
244 |
}
|
245 |
+
|
246 |
$quote->getBillingAddress();
|
247 |
$quote->getShippingAddress();
|
248 |
$quote->getPayment();
|
249 |
$quote->setEmailDirectAbandonedDate(null);
|
250 |
+
|
251 |
$customer = $customer_session->getCustomer();
|
252 |
if ($customer)
|
253 |
$quote->assignCustomer($customer);
|
254 |
+
|
255 |
$quote->save();
|
256 |
}
|
257 |
+
|
258 |
private function getQuote()
|
259 |
{
|
260 |
return Mage::getSingleton('checkout/session')->getQuote();
|
261 |
}
|
262 |
+
|
263 |
private function getCheckout()
|
264 |
{
|
265 |
return Mage::getSingleton('checkout/session');
|
app/code/community/EmailDirect/Integration/controllers/Admin/TroubleshootingController.php
CHANGED
@@ -4,38 +4,38 @@ class EmailDirect_Integration_Admin_TroubleshootingController extends Mage_Admin
|
|
4 |
{
|
5 |
private $_output = array();
|
6 |
private $_config = null;
|
7 |
-
|
8 |
public function indexAction()
|
9 |
{
|
10 |
$this->loadLayout();
|
11 |
$this->getLayout()->getBlock('head')->setTitle($this->__('EmailDirect Troubleshooting'));
|
12 |
-
$this->_setActiveMenu('
|
13 |
$this->renderLayout();
|
14 |
}
|
15 |
-
|
16 |
public function validateAction()
|
17 |
{
|
18 |
$apikey = $this->getRequest()->getParam('apikey');
|
19 |
-
|
20 |
$valid = Mage::helper('emaildirect/troubleshooting')->validateApiKey($apikey);
|
21 |
-
|
22 |
$result = array('valid' => $valid);
|
23 |
$this->getResponse()->setBody(json_encode($result));
|
24 |
}
|
25 |
-
|
26 |
private function getLogFile()
|
27 |
{
|
28 |
$empty = false;
|
29 |
$too_large = false;
|
30 |
$file_size = Mage::helper('emaildirect/troubleshooting')->getLogFileSize();
|
31 |
-
|
32 |
if ($file_size == 0)
|
33 |
$empty = true;
|
34 |
else
|
35 |
$too_large = Mage::helper('emaildirect/troubleshooting')->isLogFileTooLarge();
|
36 |
-
|
37 |
$max_size = Mage::helper('emaildirect')->formatSize(Mage::helper('emaildirect/troubleshooting')->getMaxLogFileSize());
|
38 |
-
|
39 |
$result = array(
|
40 |
'success' => true,
|
41 |
'empty' => $empty,
|
@@ -44,13 +44,13 @@ class EmailDirect_Integration_Admin_TroubleshootingController extends Mage_Admin
|
|
44 |
'contents' => Mage::helper('emaildirect/troubleshooting')->getLogFileContents());
|
45 |
return $result;
|
46 |
}
|
47 |
-
|
48 |
public function ajaxAction()
|
49 |
{
|
50 |
$method = $this->getRequest()->getParam('method');
|
51 |
-
|
52 |
$result = array('success' => false);
|
53 |
-
|
54 |
switch ($method)
|
55 |
{
|
56 |
case "status": $result = $this->getStatus(); break;
|
@@ -58,71 +58,71 @@ class EmailDirect_Integration_Admin_TroubleshootingController extends Mage_Admin
|
|
58 |
case "test_logging": $result = $this->testLogging(); break;
|
59 |
case "erase_log": $result = $this->eraseLog(); break;
|
60 |
}
|
61 |
-
|
62 |
$this->getResponse()->setBody(json_encode($result));
|
63 |
-
|
64 |
return $result;
|
65 |
}
|
66 |
|
67 |
private function eraseLog()
|
68 |
{
|
69 |
Mage::helper('emaildirect/troubleshooting')->eraseLog();
|
70 |
-
|
71 |
return $this->getLogFile();
|
72 |
}
|
73 |
-
|
74 |
private function testLogging()
|
75 |
{
|
76 |
Mage::helper('emaildirect/troubleshooting')->forceLog('======================= LOG TEST =======================');
|
77 |
-
|
78 |
return $this->getLogFile();
|
79 |
}
|
80 |
-
|
81 |
private function getStatus()
|
82 |
{
|
83 |
$status = Mage::helper('emaildirect/troubleshooting')->getStatus();
|
84 |
-
|
85 |
$result = array();
|
86 |
$result['success'] = true;
|
87 |
$result['status'] = $status;
|
88 |
-
|
89 |
return $result;
|
90 |
}
|
91 |
-
|
92 |
public function sendAction()
|
93 |
{
|
94 |
$params = $this->getRequest()->getParams();
|
95 |
-
|
96 |
$customer = array();
|
97 |
-
|
98 |
$customer['Customer Name'] = $params['customer_name'];
|
99 |
$customer['Email'] = $params['customer_email'];
|
100 |
if ($params['customer_company'] != "")
|
101 |
$customer['Company'] = $params['customer_company'];
|
102 |
$customer['Comments'] = $params['customer_comments'];
|
103 |
-
|
104 |
$message = Mage::helper('emaildirect/troubleshooting')->getReport($customer);
|
105 |
-
|
106 |
$to = Mage::helper('emaildirect')->troubleConfig('email');
|
107 |
$subject = Mage::helper('emaildirect')->troubleConfig('subject');
|
108 |
$from = $params['customer_email'];
|
109 |
-
|
110 |
$headers = "From: {$from}\r\n";
|
111 |
$headers .= "Content-type: text/html\r\n";
|
112 |
|
113 |
// now lets send the email.
|
114 |
$sent = mail($to, $subject, $message, $headers);
|
115 |
-
|
116 |
if ($sent)
|
117 |
{
|
118 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('emaildirect')->__('Troubleshooting Report was sent to EmailDirect'));
|
119 |
-
|
120 |
$this->_redirect('adminhtml/system_config/edit/',array('section' => 'emaildirect'));
|
121 |
}
|
122 |
else
|
123 |
{
|
124 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('emaildirect')->__('Failed to send Report Email'));
|
125 |
-
|
126 |
$this->_redirect('ed_integration/admin_troubleshooting/');
|
127 |
}
|
128 |
}
|
@@ -130,7 +130,7 @@ class EmailDirect_Integration_Admin_TroubleshootingController extends Mage_Admin
|
|
130 |
public function downloadAction()
|
131 |
{
|
132 |
$output = Mage::helper('emaildirect/troubleshooting')->getReport();
|
133 |
-
|
134 |
$this->_prepareDownloadResponse(Mage::helper('emaildirect')->troubleConfig('report_file'), $output);
|
135 |
}
|
136 |
|
@@ -142,44 +142,44 @@ class EmailDirect_Integration_Admin_TroubleshootingController extends Mage_Admin
|
|
142 |
public function saveAction()
|
143 |
{
|
144 |
$params = $this->getRequest()->getParams();
|
145 |
-
|
146 |
$this->_config = Mage::getConfig();
|
147 |
-
|
148 |
$enabled = $params['logging_enabled'];
|
149 |
-
|
150 |
if ($enabled == "yes")
|
151 |
{
|
152 |
$this->updateConfig('logging_enabled',1);
|
153 |
-
|
154 |
$date_format = EmailDirect_Integration_Helper_Data::DATE_FORMAT;
|
155 |
$start_date = date($date_format, Mage::getModel('core/date')->gmtTimestamp());
|
156 |
-
|
157 |
$this->updateConfig("logging_start_date",$start_date);
|
158 |
-
|
159 |
$advanced_enabled = $params['logging_advanced_enabled'];
|
160 |
-
|
161 |
if ($advanced_enabled)
|
162 |
{
|
163 |
$this->updateConfig("logging_advanced_enabled", 1);
|
164 |
-
|
165 |
$logging_stores = $params['logging_stores'];
|
166 |
-
|
167 |
if ($logging_stores == "selected")
|
168 |
{
|
169 |
if (isset($params['logging_stores_selected']))
|
170 |
$this->updateConfig("logging_stores_selected", implode(",",$params['logging_stores_selected']));
|
171 |
}
|
172 |
-
|
173 |
$this->updateConfig("logging_stores", $logging_stores);
|
174 |
-
|
175 |
$logging_areas = $params['logging_areas'];
|
176 |
-
|
177 |
if ($logging_areas == "selected")
|
178 |
{
|
179 |
if (isset($params['logging_areas_selected']))
|
180 |
$this->updateConfig("logging_areas_selected", implode(",",$params['logging_areas_selected']));
|
181 |
}
|
182 |
-
|
183 |
$this->updateConfig("logging_areas", $logging_areas);
|
184 |
$this->updateConfig("logging_duration", $params['logging_duration']);
|
185 |
}
|
@@ -191,13 +191,13 @@ class EmailDirect_Integration_Admin_TroubleshootingController extends Mage_Admin
|
|
191 |
}
|
192 |
else
|
193 |
$this->updateConfig('logging_enabled',0);
|
194 |
-
|
195 |
$this->updateConfig('diagnostic_enabled',$params['diagnostic_enabled']);
|
196 |
-
|
197 |
$this->_config->cleanCache();
|
198 |
-
|
199 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('emaildirect')->__('Troubleshooting settings updated!'));
|
200 |
-
|
201 |
$this->_redirect("*/*/index",Mage::helper('emaildirect')->getAdminUrlParams(array('tab' => 'troubleshooting_view_tabs_trouble_settings')));
|
202 |
}
|
203 |
}
|
4 |
{
|
5 |
private $_output = array();
|
6 |
private $_config = null;
|
7 |
+
|
8 |
public function indexAction()
|
9 |
{
|
10 |
$this->loadLayout();
|
11 |
$this->getLayout()->getBlock('head')->setTitle($this->__('EmailDirect Troubleshooting'));
|
12 |
+
$this->_setActiveMenu('emaildirect');
|
13 |
$this->renderLayout();
|
14 |
}
|
15 |
+
|
16 |
public function validateAction()
|
17 |
{
|
18 |
$apikey = $this->getRequest()->getParam('apikey');
|
19 |
+
|
20 |
$valid = Mage::helper('emaildirect/troubleshooting')->validateApiKey($apikey);
|
21 |
+
|
22 |
$result = array('valid' => $valid);
|
23 |
$this->getResponse()->setBody(json_encode($result));
|
24 |
}
|
25 |
+
|
26 |
private function getLogFile()
|
27 |
{
|
28 |
$empty = false;
|
29 |
$too_large = false;
|
30 |
$file_size = Mage::helper('emaildirect/troubleshooting')->getLogFileSize();
|
31 |
+
|
32 |
if ($file_size == 0)
|
33 |
$empty = true;
|
34 |
else
|
35 |
$too_large = Mage::helper('emaildirect/troubleshooting')->isLogFileTooLarge();
|
36 |
+
|
37 |
$max_size = Mage::helper('emaildirect')->formatSize(Mage::helper('emaildirect/troubleshooting')->getMaxLogFileSize());
|
38 |
+
|
39 |
$result = array(
|
40 |
'success' => true,
|
41 |
'empty' => $empty,
|
44 |
'contents' => Mage::helper('emaildirect/troubleshooting')->getLogFileContents());
|
45 |
return $result;
|
46 |
}
|
47 |
+
|
48 |
public function ajaxAction()
|
49 |
{
|
50 |
$method = $this->getRequest()->getParam('method');
|
51 |
+
|
52 |
$result = array('success' => false);
|
53 |
+
|
54 |
switch ($method)
|
55 |
{
|
56 |
case "status": $result = $this->getStatus(); break;
|
58 |
case "test_logging": $result = $this->testLogging(); break;
|
59 |
case "erase_log": $result = $this->eraseLog(); break;
|
60 |
}
|
61 |
+
|
62 |
$this->getResponse()->setBody(json_encode($result));
|
63 |
+
|
64 |
return $result;
|
65 |
}
|
66 |
|
67 |
private function eraseLog()
|
68 |
{
|
69 |
Mage::helper('emaildirect/troubleshooting')->eraseLog();
|
70 |
+
|
71 |
return $this->getLogFile();
|
72 |
}
|
73 |
+
|
74 |
private function testLogging()
|
75 |
{
|
76 |
Mage::helper('emaildirect/troubleshooting')->forceLog('======================= LOG TEST =======================');
|
77 |
+
|
78 |
return $this->getLogFile();
|
79 |
}
|
80 |
+
|
81 |
private function getStatus()
|
82 |
{
|
83 |
$status = Mage::helper('emaildirect/troubleshooting')->getStatus();
|
84 |
+
|
85 |
$result = array();
|
86 |
$result['success'] = true;
|
87 |
$result['status'] = $status;
|
88 |
+
|
89 |
return $result;
|
90 |
}
|
91 |
+
|
92 |
public function sendAction()
|
93 |
{
|
94 |
$params = $this->getRequest()->getParams();
|
95 |
+
|
96 |
$customer = array();
|
97 |
+
|
98 |
$customer['Customer Name'] = $params['customer_name'];
|
99 |
$customer['Email'] = $params['customer_email'];
|
100 |
if ($params['customer_company'] != "")
|
101 |
$customer['Company'] = $params['customer_company'];
|
102 |
$customer['Comments'] = $params['customer_comments'];
|
103 |
+
|
104 |
$message = Mage::helper('emaildirect/troubleshooting')->getReport($customer);
|
105 |
+
|
106 |
$to = Mage::helper('emaildirect')->troubleConfig('email');
|
107 |
$subject = Mage::helper('emaildirect')->troubleConfig('subject');
|
108 |
$from = $params['customer_email'];
|
109 |
+
|
110 |
$headers = "From: {$from}\r\n";
|
111 |
$headers .= "Content-type: text/html\r\n";
|
112 |
|
113 |
// now lets send the email.
|
114 |
$sent = mail($to, $subject, $message, $headers);
|
115 |
+
|
116 |
if ($sent)
|
117 |
{
|
118 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('emaildirect')->__('Troubleshooting Report was sent to EmailDirect'));
|
119 |
+
|
120 |
$this->_redirect('adminhtml/system_config/edit/',array('section' => 'emaildirect'));
|
121 |
}
|
122 |
else
|
123 |
{
|
124 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('emaildirect')->__('Failed to send Report Email'));
|
125 |
+
|
126 |
$this->_redirect('ed_integration/admin_troubleshooting/');
|
127 |
}
|
128 |
}
|
130 |
public function downloadAction()
|
131 |
{
|
132 |
$output = Mage::helper('emaildirect/troubleshooting')->getReport();
|
133 |
+
|
134 |
$this->_prepareDownloadResponse(Mage::helper('emaildirect')->troubleConfig('report_file'), $output);
|
135 |
}
|
136 |
|
142 |
public function saveAction()
|
143 |
{
|
144 |
$params = $this->getRequest()->getParams();
|
145 |
+
|
146 |
$this->_config = Mage::getConfig();
|
147 |
+
|
148 |
$enabled = $params['logging_enabled'];
|
149 |
+
|
150 |
if ($enabled == "yes")
|
151 |
{
|
152 |
$this->updateConfig('logging_enabled',1);
|
153 |
+
|
154 |
$date_format = EmailDirect_Integration_Helper_Data::DATE_FORMAT;
|
155 |
$start_date = date($date_format, Mage::getModel('core/date')->gmtTimestamp());
|
156 |
+
|
157 |
$this->updateConfig("logging_start_date",$start_date);
|
158 |
+
|
159 |
$advanced_enabled = $params['logging_advanced_enabled'];
|
160 |
+
|
161 |
if ($advanced_enabled)
|
162 |
{
|
163 |
$this->updateConfig("logging_advanced_enabled", 1);
|
164 |
+
|
165 |
$logging_stores = $params['logging_stores'];
|
166 |
+
|
167 |
if ($logging_stores == "selected")
|
168 |
{
|
169 |
if (isset($params['logging_stores_selected']))
|
170 |
$this->updateConfig("logging_stores_selected", implode(",",$params['logging_stores_selected']));
|
171 |
}
|
172 |
+
|
173 |
$this->updateConfig("logging_stores", $logging_stores);
|
174 |
+
|
175 |
$logging_areas = $params['logging_areas'];
|
176 |
+
|
177 |
if ($logging_areas == "selected")
|
178 |
{
|
179 |
if (isset($params['logging_areas_selected']))
|
180 |
$this->updateConfig("logging_areas_selected", implode(",",$params['logging_areas_selected']));
|
181 |
}
|
182 |
+
|
183 |
$this->updateConfig("logging_areas", $logging_areas);
|
184 |
$this->updateConfig("logging_duration", $params['logging_duration']);
|
185 |
}
|
191 |
}
|
192 |
else
|
193 |
$this->updateConfig('logging_enabled',0);
|
194 |
+
|
195 |
$this->updateConfig('diagnostic_enabled',$params['diagnostic_enabled']);
|
196 |
+
|
197 |
$this->_config->cleanCache();
|
198 |
+
|
199 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('emaildirect')->__('Troubleshooting settings updated!'));
|
200 |
+
|
201 |
$this->_redirect("*/*/index",Mage::helper('emaildirect')->getAdminUrlParams(array('tab' => 'troubleshooting_view_tabs_trouble_settings')));
|
202 |
}
|
203 |
}
|
app/code/community/EmailDirect/Integration/controllers/Customer/AccountController.php
CHANGED
@@ -1,171 +1,176 @@
|
|
1 |
<?php
|
2 |
class EmailDirect_Integration_Customer_AccountController extends EmailDirect_Integration_Controller_Front_Abstract
|
3 |
{
|
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 |
-
|
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 |
}
|
1 |
<?php
|
2 |
class EmailDirect_Integration_Customer_AccountController extends EmailDirect_Integration_Controller_Front_Abstract
|
3 |
{
|
4 |
+
/**
|
5 |
+
* Action predispatch
|
6 |
+
*
|
7 |
+
* Check customer authentication for some actions
|
8 |
+
*/
|
9 |
+
public function preDispatch()
|
10 |
+
{
|
11 |
+
parent::preDispatch();
|
12 |
+
|
13 |
+
if (!$this->getRequest()->isDispatched()) {
|
14 |
+
return;
|
15 |
+
}
|
16 |
+
|
17 |
+
if (!$this->_getCustomerSession()->authenticate($this)) {
|
18 |
+
$this->setFlag('', 'no-dispatch', true);
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Retrieve customer session model object
|
24 |
+
*
|
25 |
+
* @return Mage_Customer_Model_Session
|
26 |
+
*/
|
27 |
+
protected function _getCustomerSession()
|
28 |
+
{
|
29 |
+
return Mage::getSingleton('customer/session');
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Display data
|
34 |
+
*/
|
35 |
+
public function indexAction()
|
36 |
+
{
|
37 |
+
$this->loadLayout();
|
38 |
+
$this->_initLayoutMessages('customer/session');
|
39 |
+
|
40 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Newsletter Subscription'));
|
41 |
+
$this->renderLayout();
|
42 |
+
}
|
43 |
+
|
44 |
+
public function saveadditionalAction()
|
45 |
+
{
|
46 |
+
$this->_setLogArea(EmailDirect_Integration_Helper_Troubleshooting::NEWSLETTER);
|
47 |
+
$this->_log('Save Additional Start');
|
48 |
+
|
49 |
+
$arguments = array();
|
50 |
+
|
51 |
+
if (Mage::app()->getStore()->isCurrentlySecure())
|
52 |
+
$arguments['_secure'] = true;
|
53 |
+
|
54 |
+
$session = Mage::getSingleton('customer/session');
|
55 |
+
|
56 |
+
if ($this->getRequest()->isPost())
|
57 |
+
{
|
58 |
+
$state = $this->getRequest()->getPost('state');
|
59 |
+
$this->_log($state, 'State Serialized');
|
60 |
+
//<state> param is an html serialized field containing the default form state
|
61 |
+
//before submission, we need to parse it as a request in order to save it to $odata and process it
|
62 |
+
parse_str($state, $odata);
|
63 |
+
|
64 |
+
$this->_log($odata, 'State Data');
|
65 |
+
|
66 |
+
$active_lists = (TRUE === array_key_exists('list', $odata)) ? $odata['list'] : array();
|
67 |
+
$lists = $this->getRequest()->getPost('list', array());
|
68 |
+
|
69 |
+
$this->_log($lists, 'List Selection');
|
70 |
+
|
71 |
+
$customer = Mage::helper('customer')->getCustomer();
|
72 |
+
$email = $customer->getEmail();
|
73 |
+
|
74 |
+
$this->_log("Email: {$email}");
|
75 |
+
|
76 |
+
// Manage the main publication and subscription
|
77 |
+
$publication = (TRUE === array_key_exists('publication', $odata)) ? $odata['publication'] : array();
|
78 |
+
$pub_selection = $this->getRequest()->getPost('publication', array());
|
79 |
+
|
80 |
+
$this->_log($pub_selection, 'Publication Selection');
|
81 |
+
$general = Mage::helper('emaildirect')->config('publication');
|
82 |
+
|
83 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
84 |
+
$subscriber->setImportMode(false);
|
85 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_publications')->getPublication($general);
|
86 |
+
$subscriber->setListName((string)$rc->Name);
|
87 |
+
|
88 |
+
$new_subscriber = false;
|
89 |
+
|
90 |
+
if (!$pub_selection)
|
91 |
+
{
|
92 |
+
$this->_log("Unsubscribe from All");
|
93 |
+
|
94 |
+
// Publication is deslected so Unsubscribe from all.
|
95 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_publications')->unsubscribe($general,$email);
|
96 |
+
$subscriber->unsubscribe();
|
97 |
+
// unsuscribe for all the lists
|
98 |
+
foreach($active_lists as $listId => $list)
|
99 |
+
{
|
100 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_lists')->listUnsubscribe($listId, $email);
|
101 |
+
}
|
102 |
+
|
103 |
+
$session->addSuccess('Successfully unsubscribed from Newsletter');
|
104 |
+
|
105 |
+
$this->_log("Unsubscribe from all success redirect");
|
106 |
+
|
107 |
+
$this->_redirect('*/*/index', $arguments);
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
elseif ($publication != $pub_selection)
|
111 |
+
{
|
112 |
+
$this->_log("Publication != Publication Selection");
|
113 |
+
|
114 |
+
if($subscriber->isObjectNew())
|
115 |
+
{
|
116 |
+
// This code happens when ->subscribe is called below
|
117 |
+
$this->_log("New Subscriber");
|
118 |
+
|
119 |
+
$additional_lists = Mage::helper('emaildirect')->config('additional_lists');
|
120 |
+
if ($additional_lists != "")
|
121 |
+
{
|
122 |
+
$this->_log("Get New Active Lists");
|
123 |
+
$temp_lists = explode(",",$additional_lists);
|
124 |
+
$active_lists = array();
|
125 |
+
|
126 |
+
foreach ($temp_lists as $temp_id)
|
127 |
+
{
|
128 |
+
$active_lists[$temp_id] = array('subscribed' => $temp_id);
|
129 |
+
}
|
130 |
+
|
131 |
+
$this->_log($active_lists,"New Active Lists Data");
|
132 |
+
}
|
133 |
+
|
134 |
+
$new_subscriber = true;
|
135 |
+
}
|
136 |
+
else
|
137 |
+
{
|
138 |
+
$this->_log("Existing Subscriber");
|
139 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_publications')->subscribe($general,$email);
|
140 |
+
}
|
141 |
+
$subscriber->subscribe($email);
|
142 |
+
}
|
143 |
+
|
144 |
+
if( !empty($active_lists) )
|
145 |
+
{
|
146 |
+
$this->_log("Active Lists");
|
147 |
+
foreach($active_lists as $listId => $list)
|
148 |
+
{
|
149 |
+
if (FALSE === array_key_exists($listId, $lists))
|
150 |
+
{
|
151 |
+
$this->_log("Unsubscribe from list {$listId}");
|
152 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_lists')->listUnsubscribe($listId, $email);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
//Subscribe to new lists
|
158 |
+
$subscribe = array_diff_key($lists, $active_lists);
|
159 |
+
if (!empty($subscribe))
|
160 |
+
{
|
161 |
+
$this->_log("Subscribe to new lists");
|
162 |
+
foreach($subscribe as $listId => $slist)
|
163 |
+
{
|
164 |
+
$this->_log("Subscribe to list {$listId}");
|
165 |
+
$rc = Mage::getSingleton('emaildirect/wrapper_lists')->listSubscribe($listId, $email);
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
$session->addSuccess('Subscriptions Updated');
|
171 |
+
|
172 |
+
$this->_log('Save Additional End');
|
173 |
+
|
174 |
+
$this->_redirect('*/*/index', $arguments);
|
175 |
+
}
|
176 |
}
|
app/code/community/EmailDirect/Integration/etc/adminhtml.xml
CHANGED
@@ -1,54 +1,54 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
-
|
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 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
</config>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
+
<menu>
|
4 |
+
<emaildirect module='emaildirect'>
|
5 |
+
<title>EmailDirect</title>
|
6 |
+
<sort_order>80</sort_order>
|
7 |
+
<children>
|
8 |
+
<emaildirect_abandoned module='emaildirect'>
|
9 |
+
<title>Abandoned Carts</title>
|
10 |
+
<sort_order>100</sort_order>
|
11 |
+
<action>ed_integration/admin_abandoned</action>
|
12 |
+
</emaildirect_abandoned>
|
13 |
+
<emaildirect_troubleshooting module='emaildirect'>
|
14 |
+
<title>Troubleshooting</title>
|
15 |
+
<sort_order>110</sort_order>
|
16 |
+
<action>ed_integration/admin_troubleshooting</action>
|
17 |
+
</emaildirect_troubleshooting>
|
18 |
+
<emaildirect_config module='emaildirect'>
|
19 |
+
<title>Configuration</title>
|
20 |
+
<sort_order>1000</sort_order>
|
21 |
+
<action>adminhtml/system_config/edit/section/emaildirect</action>
|
22 |
+
</emaildirect_config>
|
23 |
+
</children>
|
24 |
+
</emaildirect>
|
25 |
+
</menu>
|
26 |
+
<acl>
|
27 |
+
<resources>
|
28 |
+
<admin>
|
29 |
+
<children>
|
30 |
+
<system>
|
31 |
+
<children>
|
32 |
+
<config>
|
33 |
+
<children>
|
34 |
+
<emaildirect translate="title" module="emaildirect">
|
35 |
+
<title>EmailDirect Configuration</title>
|
36 |
+
</emaildirect>
|
37 |
+
</children>
|
38 |
+
</config>
|
39 |
+
</children>
|
40 |
+
</system>
|
41 |
+
</children>
|
42 |
+
</admin>
|
43 |
+
</resources>
|
44 |
+
</acl>
|
45 |
+
<translate>
|
46 |
+
<modules>
|
47 |
+
<EmailDirect_Integration>
|
48 |
+
<files>
|
49 |
+
<default>EmailDirect_Integration.csv</default>
|
50 |
+
</files>
|
51 |
+
</EmailDirect_Integration>
|
52 |
+
</modules>
|
53 |
+
</translate>
|
54 |
</config>
|
app/code/community/EmailDirect/Integration/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<EmailDirect_Integration>
|
5 |
-
<version>2.0.
|
6 |
</EmailDirect_Integration>
|
7 |
</modules>
|
8 |
<global>
|
@@ -246,7 +246,7 @@
|
|
246 |
<categories>ProductCategories</categories>
|
247 |
<orders>Orders</orders>
|
248 |
<database>Database</database>
|
249 |
-
<abandoned>Import/
|
250 |
<ftp>FTP</ftp>
|
251 |
</urls>
|
252 |
<active>0</active>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<EmailDirect_Integration>
|
5 |
+
<version>2.0.13</version>
|
6 |
</EmailDirect_Integration>
|
7 |
</modules>
|
8 |
<global>
|
246 |
<categories>ProductCategories</categories>
|
247 |
<orders>Orders</orders>
|
248 |
<database>Database</database>
|
249 |
+
<abandoned>Import/Subscribers</abandoned>
|
250 |
<ftp>FTP</ftp>
|
251 |
</urls>
|
252 |
<active>0</active>
|
app/code/community/EmailDirect/Integration/etc/system.xml
CHANGED
@@ -17,7 +17,7 @@
|
|
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>
|
@@ -78,7 +78,7 @@
|
|
78 |
<show_in_website>0</show_in_website>
|
79 |
<show_in_store>1</show_in_store>
|
80 |
</apikey_instructions>
|
81 |
-
|
82 |
<checkout_subscribe translate="label comment">
|
83 |
<label>Subscribe On Checkout</label>
|
84 |
<frontend_type>select</frontend_type>
|
@@ -131,7 +131,7 @@
|
|
131 |
<show_in_store>1</show_in_store>
|
132 |
<comment>If set to "Yes", the source will be updated when an existing customer is updated.</comment>
|
133 |
</override_source>
|
134 |
-
|
135 |
<heading_mappings translate="label">
|
136 |
<label>Field Mappings</label>
|
137 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
@@ -140,7 +140,7 @@
|
|
140 |
<show_in_website>0</show_in_website>
|
141 |
<show_in_store>1</show_in_store>
|
142 |
</heading_mappings>
|
143 |
-
|
144 |
<address_fields translate="label comment">
|
145 |
<label>Address Fields Mapping</label>
|
146 |
<frontend_model>emaildirect/adminhtml_system_config_form_field_addressmapfields</frontend_model>
|
@@ -168,7 +168,7 @@
|
|
168 |
<show_in_website>0</show_in_website>
|
169 |
<show_in_store>1</show_in_store>
|
170 |
</shipping_fields>
|
171 |
-
|
172 |
<heading_orders translate="label">
|
173 |
<label>Orders</label>
|
174 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
@@ -251,7 +251,7 @@
|
|
251 |
<comment>Orders will only be sent in the background process.</comment>
|
252 |
<depends><batch_enabled>1</batch_enabled></depends>
|
253 |
</batch_only>
|
254 |
-
|
255 |
<save_latest_order translate="label">
|
256 |
<label>Save Latest Order Information</label>
|
257 |
<frontend_type>select</frontend_type>
|
@@ -263,7 +263,7 @@
|
|
263 |
<comment>Save information from the latest order along with the first 3 products from that order</comment>
|
264 |
<depends><sendorder>1</sendorder></depends>
|
265 |
</save_latest_order>
|
266 |
-
|
267 |
<heading_abandoned translate="label">
|
268 |
<label>Abandoned Carts</label>
|
269 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
@@ -272,7 +272,7 @@
|
|
272 |
<show_in_website>0</show_in_website>
|
273 |
<show_in_store>1</show_in_store>
|
274 |
</heading_abandoned>
|
275 |
-
|
276 |
<sendabandoned translate="label">
|
277 |
<label>Add Abandoned Carts To EmailDirect</label>
|
278 |
<frontend_type>select</frontend_type>
|
@@ -329,7 +329,7 @@
|
|
329 |
<comment>When enabled, this feature will capture guest emails from various forms within the site to be used with abandoned carts.</comment>
|
330 |
<depends><sendabandoned>1</sendabandoned></depends>
|
331 |
</capture_enabled>
|
332 |
-
|
333 |
<!-- SEQUENCES -->
|
334 |
<heading_sequence translate="label">
|
335 |
<label>Abandoned Cart Sequences</label>
|
@@ -374,7 +374,7 @@
|
|
374 |
<comment>Enter one sequence per line to be appended.</comment>
|
375 |
<depends><sendabandoned>1</sendabandoned><abandonedsequence_enabled>1</abandonedsequence_enabled></depends>
|
376 |
</abandonedsequence_options>
|
377 |
-
|
378 |
<!-- signup -->
|
379 |
<heading_signup translate="label">
|
380 |
<label>EmailDirect Signup Form</label>
|
@@ -475,7 +475,7 @@
|
|
475 |
<comment>Do not activate this form until it has been tested.</comment>
|
476 |
<depends><signup_enabled>1</signup_enabled></depends>
|
477 |
</signup_activated>
|
478 |
-
|
479 |
<!-- Wishlist -->
|
480 |
<heading_wishlist translate="label">
|
481 |
<label>Wishlist</label>
|
@@ -495,7 +495,7 @@
|
|
495 |
<show_in_store>1</show_in_store>
|
496 |
<comment>Send subscriber Wishlist URL and their most recent Wishlist Date to your EmailDirect database.</comment>
|
497 |
</wishlist_enabled>
|
498 |
-
|
499 |
</fields>
|
500 |
</general>
|
501 |
<export translate="label comment">
|
@@ -545,7 +545,7 @@
|
|
545 |
<can_be_empty>1</can_be_empty>
|
546 |
<comment>Export Orders to CSV and send the CSV file to Emaildirect (opens in new window)</comment>
|
547 |
</export_orders_button>
|
548 |
-
|
549 |
<heading_products translate="label">
|
550 |
<label>Category Exports</label>
|
551 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
@@ -591,7 +591,7 @@
|
|
591 |
<show_in_website>0</show_in_website>
|
592 |
<show_in_store>0</show_in_store>
|
593 |
<comment>Please setup your API Key to perform an Export</comment>
|
594 |
-
<!--<depends><setup>0</setup></depends>-->
|
595 |
</export_na>
|
596 |
</fields>
|
597 |
</export>
|
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>
|
78 |
<show_in_website>0</show_in_website>
|
79 |
<show_in_store>1</show_in_store>
|
80 |
</apikey_instructions>
|
81 |
+
|
82 |
<checkout_subscribe translate="label comment">
|
83 |
<label>Subscribe On Checkout</label>
|
84 |
<frontend_type>select</frontend_type>
|
131 |
<show_in_store>1</show_in_store>
|
132 |
<comment>If set to "Yes", the source will be updated when an existing customer is updated.</comment>
|
133 |
</override_source>
|
134 |
+
|
135 |
<heading_mappings translate="label">
|
136 |
<label>Field Mappings</label>
|
137 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
140 |
<show_in_website>0</show_in_website>
|
141 |
<show_in_store>1</show_in_store>
|
142 |
</heading_mappings>
|
143 |
+
|
144 |
<address_fields translate="label comment">
|
145 |
<label>Address Fields Mapping</label>
|
146 |
<frontend_model>emaildirect/adminhtml_system_config_form_field_addressmapfields</frontend_model>
|
168 |
<show_in_website>0</show_in_website>
|
169 |
<show_in_store>1</show_in_store>
|
170 |
</shipping_fields>
|
171 |
+
|
172 |
<heading_orders translate="label">
|
173 |
<label>Orders</label>
|
174 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
251 |
<comment>Orders will only be sent in the background process.</comment>
|
252 |
<depends><batch_enabled>1</batch_enabled></depends>
|
253 |
</batch_only>
|
254 |
+
|
255 |
<save_latest_order translate="label">
|
256 |
<label>Save Latest Order Information</label>
|
257 |
<frontend_type>select</frontend_type>
|
263 |
<comment>Save information from the latest order along with the first 3 products from that order</comment>
|
264 |
<depends><sendorder>1</sendorder></depends>
|
265 |
</save_latest_order>
|
266 |
+
|
267 |
<heading_abandoned translate="label">
|
268 |
<label>Abandoned Carts</label>
|
269 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
272 |
<show_in_website>0</show_in_website>
|
273 |
<show_in_store>1</show_in_store>
|
274 |
</heading_abandoned>
|
275 |
+
|
276 |
<sendabandoned translate="label">
|
277 |
<label>Add Abandoned Carts To EmailDirect</label>
|
278 |
<frontend_type>select</frontend_type>
|
329 |
<comment>When enabled, this feature will capture guest emails from various forms within the site to be used with abandoned carts.</comment>
|
330 |
<depends><sendabandoned>1</sendabandoned></depends>
|
331 |
</capture_enabled>
|
332 |
+
|
333 |
<!-- SEQUENCES -->
|
334 |
<heading_sequence translate="label">
|
335 |
<label>Abandoned Cart Sequences</label>
|
374 |
<comment>Enter one sequence per line to be appended.</comment>
|
375 |
<depends><sendabandoned>1</sendabandoned><abandonedsequence_enabled>1</abandonedsequence_enabled></depends>
|
376 |
</abandonedsequence_options>
|
377 |
+
|
378 |
<!-- signup -->
|
379 |
<heading_signup translate="label">
|
380 |
<label>EmailDirect Signup Form</label>
|
475 |
<comment>Do not activate this form until it has been tested.</comment>
|
476 |
<depends><signup_enabled>1</signup_enabled></depends>
|
477 |
</signup_activated>
|
478 |
+
|
479 |
<!-- Wishlist -->
|
480 |
<heading_wishlist translate="label">
|
481 |
<label>Wishlist</label>
|
495 |
<show_in_store>1</show_in_store>
|
496 |
<comment>Send subscriber Wishlist URL and their most recent Wishlist Date to your EmailDirect database.</comment>
|
497 |
</wishlist_enabled>
|
498 |
+
|
499 |
</fields>
|
500 |
</general>
|
501 |
<export translate="label comment">
|
545 |
<can_be_empty>1</can_be_empty>
|
546 |
<comment>Export Orders to CSV and send the CSV file to Emaildirect (opens in new window)</comment>
|
547 |
</export_orders_button>
|
548 |
+
|
549 |
<heading_products translate="label">
|
550 |
<label>Category Exports</label>
|
551 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
591 |
<show_in_website>0</show_in_website>
|
592 |
<show_in_store>0</show_in_store>
|
593 |
<comment>Please setup your API Key to perform an Export</comment>
|
594 |
+
<!--<depends><setup>0</setup></depends>-->
|
595 |
</export_na>
|
596 |
</fields>
|
597 |
</export>
|
app/design/frontend/base/default/layout/emaildirect.xml
CHANGED
@@ -1,55 +1,55 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
|
3 |
<layout version="0.1.0">
|
4 |
-
|
5 |
-
<default>
|
6 |
-
<reference name="before_body_end">
|
7 |
-
<block type="emaildirect/signup" name="emaildirect_signup" as="emaildirect_signup" template="emaildirect/signup/form.phtml"/>
|
8 |
-
<block type="emaildirect/capture" name="emaildirect_capture" as="emaildirect_capture" template="emaildirect/capture/email.phtml"/>
|
9 |
-
</reference>
|
10 |
-
<reference name="head">
|
11 |
-
<action method="addCss" ifconfig="emaildirect/general/active"><stylesheet>emaildirect/emaildirect.css</stylesheet></action>
|
12 |
-
</reference>
|
13 |
-
</default>
|
14 |
-
|
15 |
-
<checkout_onepage_review>
|
16 |
-
<reference name="checkout.onepage.review.info.items.after">
|
17 |
-
<block type="emaildirect/checkout_subscribe" name="emaildirect.subscribe" template="emaildirect/checkout/subscribe.phtml" />
|
18 |
-
</reference>
|
19 |
-
</checkout_onepage_review>
|
20 |
-
|
21 |
-
<!-- Customer -->
|
22 |
-
<customer_account>
|
23 |
-
<reference name="head">
|
24 |
-
<action method="addItem" ifconfig="emaildirect/general/active"><type>skin_js</type><name>emaildirect/integration.js</name><params/></action>
|
25 |
-
</reference>
|
26 |
-
<reference name="customer_account_navigation">
|
27 |
-
<action method="addLink" ifconfig="emaildirect/general/active" translate="label" module="emaildirect">
|
28 |
-
<name>emaildirect</name>
|
29 |
-
<path>emaildirect/customer_account/index</path>
|
30 |
-
<label>Newsletter Subscriptions</label>
|
31 |
-
</action>
|
32 |
-
</reference>
|
33 |
-
</customer_account>
|
34 |
-
<customer_account_index>
|
35 |
-
<reference name="my.account.wrapper">
|
36 |
-
<reference name="customer_account_dashboard">
|
37 |
-
<block type="emaildirect/customer_account_dashboard_info" name="emaildirect.customer_account_dashboard_info" as="info" template="customer/account/dashboard/info.phtml">
|
38 |
-
<action method="setTemplate" ifconfig="emaildirect/general/active">
|
39 |
-
<template>emaildirect/customer/account/dashboard/info.phtml</template>
|
40 |
-
</action>
|
41 |
-
</block>
|
42 |
-
</reference>
|
43 |
-
</reference>
|
44 |
-
</customer_account_index>
|
45 |
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
<label>Customer My Account Emaildirect</label>
|
48 |
<update handle="customer_account"/>
|
49 |
<reference name="my.account.wrapper">
|
50 |
-
|
51 |
-
|
52 |
</reference>
|
53 |
-
|
54 |
-
|
55 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
|
3 |
<layout version="0.1.0">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
<default>
|
6 |
+
<reference name="before_body_end">
|
7 |
+
<block type="emaildirect/signup" name="emaildirect_signup" as="emaildirect_signup" template="emaildirect/signup/form.phtml"/>
|
8 |
+
<block type="emaildirect/capture" name="emaildirect_capture" as="emaildirect_capture" template="emaildirect/capture/email.phtml"/>
|
9 |
+
</reference>
|
10 |
+
<reference name="head">
|
11 |
+
<action method="addCss" ifconfig="emaildirect/general/active"><stylesheet>emaildirect/emaildirect.css</stylesheet></action>
|
12 |
+
</reference>
|
13 |
+
</default>
|
14 |
+
|
15 |
+
<checkout_onepage_review>
|
16 |
+
<reference name="checkout.onepage.review.info.items.after">
|
17 |
+
<block type="emaildirect/checkout_subscribe" name="emaildirect.subscribe" template="emaildirect/checkout/subscribe.phtml" />
|
18 |
+
</reference>
|
19 |
+
</checkout_onepage_review>
|
20 |
+
|
21 |
+
<!-- Customer -->
|
22 |
+
<customer_account>
|
23 |
+
<reference name="head">
|
24 |
+
<action method="addItem" ifconfig="emaildirect/general/active"><type>skin_js</type><name>emaildirect/integration.js</name><params/></action>
|
25 |
+
</reference>
|
26 |
+
<reference name="customer_account_navigation">
|
27 |
+
<action method="addLink" ifconfig="emaildirect/general/active" translate="label" module="emaildirect">
|
28 |
+
<name>emaildirect</name>
|
29 |
+
<path>emaildirect/customer_account/index</path>
|
30 |
+
<label>Newsletter Subscriptions</label>
|
31 |
+
</action>
|
32 |
+
</reference>
|
33 |
+
</customer_account>
|
34 |
+
<customer_account_index>
|
35 |
+
<reference name="my.account.wrapper">
|
36 |
+
<reference name="customer_account_dashboard">
|
37 |
+
<block type="emaildirect/customer_account_dashboard_info" name="emaildirect.customer_account_dashboard_info" as="info" template="customer/account/dashboard/info.phtml">
|
38 |
+
<action method="setTemplate" ifconfig="emaildirect/general/active">
|
39 |
+
<template>emaildirect/customer/account/dashboard/info.phtml</template>
|
40 |
+
</action>
|
41 |
+
</block>
|
42 |
+
</reference>
|
43 |
+
</reference>
|
44 |
+
</customer_account_index>
|
45 |
+
|
46 |
+
<emaildirect_customer_account_index>
|
47 |
<label>Customer My Account Emaildirect</label>
|
48 |
<update handle="customer_account"/>
|
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 |
</layout>
|
app/design/frontend/base/default/template/emaildirect/customer/account/dashboard/info.phtml
CHANGED
@@ -1,49 +1,52 @@
|
|
1 |
<div class="col2-set">
|
2 |
-
|
3 |
-
|
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 |
</div>
|
1 |
<div class="col2-set">
|
2 |
+
<div class="col-1">
|
3 |
+
<div class="box">
|
4 |
+
<div class="box-title">
|
5 |
+
<h3><?php echo $this->__('Contact Information') ?></h3>
|
6 |
+
<a href="<?php echo $this->getUrl('customer/account/edit') ?>"><?php echo $this->__('Edit') ?></a>
|
7 |
+
</div>
|
8 |
+
<div class="box-content">
|
9 |
+
<p>
|
10 |
+
<?php echo $this->htmlEscape($this->getCustomer()->getName()) ?><br />
|
11 |
+
<?php echo $this->htmlEscape($this->getCustomer()->getEmail()) ?><br />
|
12 |
+
<a href="<?php echo $this->getChangePasswordUrl() ?>"><?php echo $this->__('Change Password') ?></a>
|
13 |
+
</p>
|
14 |
+
</div>
|
15 |
+
</div>
|
16 |
+
</div>
|
17 |
+
<?php if ($this->isNewsletterEnabled()): ?>
|
18 |
+
<div class="col-2">
|
19 |
+
<div class="box">
|
20 |
+
<div class="box-title">
|
21 |
+
<h3><?php echo $this->__('Newsletters') ?></h3>
|
22 |
+
<a href="<?php echo $this->getUrl('newsletter/manage') ?>"><?php echo $this->__('Edit') ?></a>
|
23 |
+
</div>
|
24 |
+
<div class="box-content">
|
25 |
+
<?php
|
26 |
+
$email = $this->helper('customer')->getCustomer()->getEmail();
|
27 |
+
$subscriptions = Mage::helper('emaildirect')->getSubscriptions($email);
|
28 |
+
|
29 |
+
if ($subscriptions['count'] > 0)
|
30 |
+
{
|
31 |
+
echo "<p>You are currently subscribed to: <br />" . $subscriptions['publication']['name'] . "</p>";
|
32 |
+
|
33 |
+
if ($subscriptions['list_count'] > 0)
|
34 |
+
{
|
35 |
+
echo "<strong>Interests:</strong>";
|
36 |
+
echo "<ul>";
|
37 |
+
foreach ($subscriptions['lists'] as $list)
|
38 |
+
{
|
39 |
+
if ($list['subscribed'])
|
40 |
+
echo "<li>{$list['name']}</li>";
|
41 |
+
}
|
42 |
+
echo "</ul>";
|
43 |
+
}
|
44 |
+
}
|
45 |
+
else
|
46 |
+
echo "<p>" . $this->__('You are currently not subscribed to any newsletter.') . "</p>";
|
47 |
+
?>
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
<?php endif; ?>
|
52 |
</div>
|
package.xml
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>EmailDirect_Integration</name>
|
4 |
-
<version>2.0.
|
5 |
<stability>stable</stability>
|
6 |
<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>2015-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="EmailDirect"><dir name="Integration"><dir name="Block"><dir name="Adminhtml"><dir name="Abandoned"><dir name="Details"><dir name="Tab"><dir name="Diagnostics"><file name="Status.php" hash="8706487c8f465a5ce762cd923258bb35"/></dir><file name="Cart.php" hash="09e9331f6c72157f581ad7135b7f147c"/><file name="Diagnostics.php" hash="eba18ce04ccb125ce4aa6ed5e473734a"/></dir><file name="Abstract.php" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="Form.php" hash="dffc6e49eb95db2f83050706eee1fd55"/></dir><file name="Details.php" hash="9f98f4dd9ea741f9f7dd2eb018af0d7d"/><file name="Grid.php" hash="e0a15673636acb7e113fdf6e3bcd8879"/><file name="Status.php" hash="9a740fd8c63148532bbcf07d19f462df"/><file name="Tabs.php" hash="19e184e72777dfc5b0c35b7027a3e1cf"/></dir><dir name="Diagnostics"><dir name="Status"><file name="Abstract.php" hash="4a54d82d748f880fc5bb8263935ddc98"/></dir></dir><dir name="Order"><dir name="View"><dir name="Tab"><dir name="Diagnostics"><file name="Status.php" hash="b4dd8410aa9ce649e603762d5d14f314"/></dir><file name="Diagnostics.php" hash="91bb6af0c9a0e6f41d2575651e8a59ef"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="d01c241e1c4a42cd08f087ad784ed78e"/></dir><dir name="Form"><dir name="Field"><dir name="Export"><file name="Orders.php" hash="5b101fadb6a64044b276eb07b21cf0a5"/><file name="Products.php" hash="32e13d4b7250890bf84aba87f25de03c"/><file name="Range.php" hash="4adac96fa53fa8e1449bae943a8cca80"/></dir><dir name="Signup"><file name="Test.php" hash="3b773dda25c62bc8cb28031931d67f9f"/></dir><file name="Addressmapfields.php" hash="97b75c8340d561e863a3985ad73ce228"/><file name="Api.php" hash="77dabda85973dc72227937397392c411"/><file name="Common.php" hash="6a86cce53f6df6857ea79241fa281939"/><file name="Diagnostics.php" hash="7efe5c8b90db90e9c512842388d3263d"/><file name="Info.php" hash="246de52ea5d2349ecd7f103cbba8cb8f"/><file name="Logging.php" hash="53b0b7d28d2680e479bfa89b6884802d"/><file name="Mapfields.php" hash="16894c5d76df1293e63128e349700e05"/><file name="Note.php" hash="ef99a474bbc3a828c7a618132a80fe66"/><file name="Shippingmapfields.php" hash="589a74260f394a5eae1b57ca89a74a8b"/><file name="Troubleshooting.php" hash="ff22589730034e7742978e884766d139"/></dir></dir></dir><dir name="Convert"><dir name="Profile"><dir name="Export"><file name="Orders.php" hash="947af2b0d8e3f7bc47c47b32cd434f18"/><file name="Products.php" hash="3f93e4789dbeb6710cd2742587d61726"/></dir><file name="Export.php" hash="ba879607ac0693e9db6251bbbc1676a1"/></dir></dir></dir><dir name="Troubleshooting"><dir name="View"><dir name="Tab"><file name="Download.php" hash="619916677df7c833e559aae74dae2aa0"/><file name="Help.php" hash="ad4007af59687653f4d6692f2b42b31d"/><file name="Info.php" hash="be5c15da32ef0e042c53d8ac007f8bd6"/><file name="Log.php" hash="a61e66923a287beee5910511b7282a0a"/><file name="Settings.php" hash="f15e57cdc6539c4da84042c98f0ab25c"/><file name="Submit.php" hash="81ae0e0636b66a329cf8f39939788d1d"/></dir><file name="Form.php" hash="e527a3a2335b109c48a69f06c1b0d01f"/></dir><file name="Status.php" hash="d140afcad424ff531bebb412539d6f1c"/><file name="Tabs.php" hash="5d4168cec60212beb87997e6391282e9"/><file name="View.php" hash="1ecabf7011ada6012f761c93343bb097"/></dir><file name="Abandoned.php" hash="1ee964e54b38a6c24c09f7b3aa6ce411"/></dir><dir name="Checkout"><file name="Subscribe.php" hash="12f6e5c467fb632e11c9ced35c82ebe6"/></dir><dir name="Customer"><dir name="Account"><dir name="Dashboard"><file name="Info.php" hash="20e74d9c2b2c02611c8f69b254d81ef5"/></dir><file name="Lists.php" hash="3c3bdb9482ecf4a71740a80395bd5465"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><dir name="Abandoned"><file name="Minutes.php" hash="e311f6de480fd4b63aee7f46ea412372"/></dir><file name="Action.php" hash="bf2243f50c9c6dafca26a5bcb889f372"/></dir></dir></dir></dir><file name="Capture.php" hash="e44034ad875957a566d3ac89abb408ed"/><file name="Signup.php" hash="9a3bfbe1ec37f6de4bbbbc55273b9410"/></dir><dir name="Controller"><dir name="Front"><file name="Abstract.php" hash="48d93179d5f8a6b416fd82dd8763daf9"/></dir></dir><dir name="Helper"><file name="Abandoned.php" hash="7910bd8db8a030ae22adae9469d91fe7"/><file name="Data.php" hash="01ae2fc7bb1eea8911dc2dda3673ef6a"/><file name="Diagnostic.php" hash="68867fd906405a6be98e14c1568437b6"/><file name="Fields.php" hash="e56519892ee2583c2978c262ffb9880e"/><file name="Order.php" hash="11404d27039db36e1b71bd5c4b97b6fa"/><file name="Troubleshooting.php" hash="cf422b72b445a86326e73cbc6f506e18"/></dir><dir name="Model"><dir name="Abandoned"><file name="Observer.php" hash="b97f35f4bb49ce7127d0879a0bdabad1"/></dir><dir name="Configuration"><file name="Observer.php" hash="9a188656d5f7d73c91bf4221cc6e4aac"/></dir><dir name="Customer"><file name="Observer.php" hash="a26dd056b55d0578c96a082d00508659"/></dir><dir name="Mysql4"><dir name="Abandoned"><file name="Collection.php" hash="1a9129267942a98ac3830ceaf714c2ab"/></dir><dir name="Order"><file name="Collection.php" hash="43d343562cf7e54f1b36315aa5d1d4a7"/></dir><dir name="Session"><file name="Collection.php" hash="7d6a8283fdbc1207d709e2bbbc78906d"/></dir><file name="Abandoned.php" hash="485b3771906783d383de75ae9761e55c"/><file name="Order.php" hash="8d538a5737095a1ba0ad448c027b3afb"/><file name="Session.php" hash="516eeeb28038416dc885ed7af6a8a8b0"/></dir><dir name="Newsletter"><file name="Observer.php" hash="5d73fdd62c69b16f7312a13b721d3a37"/></dir><dir name="Observer"><file name="Abstract.php" hash="1db39dc86bed51af1d2a3b4df50099bd"/></dir><dir name="Order"><file name="Observer.php" hash="81416e0d6f8ce63513aae67a53005eb9"/></dir><dir name="Resource"><file name="Setup.php" hash="5435dccf0f14ec402018bb45af56ecb5"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Export"><file name="Batch.php" hash="96c51fc5c0b947750be4e612e32c83ab"/></dir><dir name="Send"><file name="Field.php" hash="8ecffa8ccce40f3b2db6513b24eb9200"/></dir><dir name="Signup"><file name="Opacity.php" hash="8eabed4c72e7347f0376c3d4cc1023a7"/><file name="Recurrence.php" hash="e11200bbc204b00486c373d8a4e6675e"/></dir><file name="Abandoned.php" hash="9881811b94f38be90bd20a99951a1903"/><file name="Abandonedlist.php" hash="b81d7f2cb03b8482debea5cd6a2bd1c5"/><file name="Additionallist.php" hash="9f109ab04c7ae7832887572b26868e3a"/><file name="Checkoutsubscribe.php" hash="fd90252a1f19649a420dae136ad2a2ba"/><file name="List.php" hash="84c1c8e27f579d5d33992fcb15202748"/><file name="Publication.php" hash="a5bc0192605fc558fe59b37cc0462825"/><file name="Sequence.php" hash="a599f218882d2cfc68dfcf4d58a98a41"/><file name="Source.php" hash="44815cbf4ac6443032df1e7d9c4cadef"/><file name="States.php" hash="a746affc786d8165a98801e68cbf80ab"/><file name="Statuses.php" hash="9844a7a9c3b5c68df45c8f6c518acf16"/><file name="Time.php" hash="8acbb5cb33e66de1e408cf55d17a9398"/></dir></dir></dir><dir name="Wrapper"><file name="Abandoned.php" hash="ef81d36a7276737f2d0aa1a5d783a83b"/><file name="Abstract.php" hash="9e97ce6a12e0d074921bb3a1391f3648"/><file name="Database.php" hash="3cceb467358d13584baff58c043762ec"/><file name="Execute.php" hash="e38737d197b2ccd6700ec87ec1836456"/><file name="Ftp.php" hash="d5335cfb68f99761d6902dd390a3d7a8"/><file name="Lists.php" hash="425d64b9256bbdbafa899c4138e78368"/><file name="Orders.php" hash="66be3441f9204048279fb4921a04e375"/><file name="Publications.php" hash="1bebd172a8bba669d075f09589785652"/><file name="Sources.php" hash="c6caf0274f7d0c50114324bc47a490c4"/><file name="Subscribers.php" hash="f9abcadf5b793640a4301495462d6ea7"/><file name="Wishlist.php" hash="2ceb111bbeaa06c4f13f61281aaa5b5e"/></dir><file name="Abandoned.php" hash="93bd43b59b143dec15858a6fba6ae568"/><file name="Observer.php" hash="24d421b11e04e228cbdf3eee0b852572"/><file name="Order.php" hash="b21426543cd46f799cd0743525120fb8"/><file name="Session.php" hash="c56ecf779dbfb2dae0030935af31911a"/></dir><dir name="controllers"><dir name="Admin"><file name="AbandonedController.php" hash="7366ad52662d5494e1b0e65988ee1dc7"/><file name="DiagnosticController.php" hash="aa0f4e9bf3c22124c61c3f46729372a9"/><file name="ExportController.php" hash="3ff11560de77d99bccb2cc257d14b8ab"/><file name="TroubleshootingController.php" hash="be806ede9ec0e1986dcfe720e0dd7b74"/></dir><dir name="Customer"><file name="AccountController.php" hash="5bd831a8b452d9853db29967fc2b28b4"/></dir><file name="AbandonedController.php" hash="dce0db1b2148889d067fce613c0d6914"/><file name="CaptureController.php" hash="89e043bb3864617a062e915d2209dcf4"/><file name="ExportController.php" hash="7ca147debc5c1436b3bf2d9501592f33"/><file name="SignupController.php" hash="fe975d44cc11f1270d34d9d82c7d4be9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5dd2b99c6efd1d0958579d2873fe8b69"/><file name="config.xml" hash="304efd7e08c8de7594deb58f53aa448d"/><file name="system.xml" hash="0c1b20f5e671e3004d42d0a8d65c5901"/></dir><dir name="sql"><dir name="emaildirect_setup"><file name="mysql4-install-2.0.0.php" hash="bdc5e09fe949b36534c50c85fd198e66"/><file name="mysql4-upgrade-1.5.8-2.0.0.php" hash="8f33c7f6dca96cfa8210ec1fe016d95b"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="emaildirect"><file name="emaildirect-tab.png" hash="9ddb077b74a7078ac509d79b024631a1"/><file name="emaildirect.css" hash="61d3d7b29b97f75023f2232cae6eb0c1"/><file name="logo.png" hash="2e7e39ced387c798ef27b77dd69f073e"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="emaildirect"><dir name="images"><file name="window_close.png" hash="3af14f053f360bf31f8ba2df73ec7f1e"/></dir><file name="emaildirect.css" hash="c9caf9ea168efa3b0d6f4b881bcf093c"/><file name="integration.js" hash="e02936e3295b737424d7fc3aed429a1f"/></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="7767cd483e20d1930c0f1d79fee03b2a"/></dir><dir name="template"><dir name="emaildirect"><dir name="abandoned"><dir name="details"><dir name="tab"><dir name="diagnostics"><file name="status.phtml" hash="24829356b9dba966e53fb1cfe0f192b6"/></dir><file name="cart.phtml" hash="be7ca2b147fc836c2ca547b290ffe841"/></dir><file name="form.phtml" hash="60633d212382770e99d11d24ae919e47"/></dir><file name="details.phtml" hash="9d467b97a2d773aec950bea7061c6730"/><file name="status.phtml" hash="9e7723dc1fe5f8693345db9cc7cda808"/></dir><dir name="order"><dir name="view"><dir name="tab"><dir name="diagnostics"><file name="status.phtml" hash="a3bdecb1ec08903dd1b61dce6992e190"/></dir></dir></dir></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="176f3ddb8ea667a64a06967351526f3c"/></dir><dir name="form"><dir name="field"><dir name="export"><file name="date_range.phtml" hash="6a37b1e58456e1dcec734c48deb8c0c1"/><file name="orders.phtml" hash="1dfa19a712b18d2c95c2f4b938f6acef"/><file name="products.phtml" hash="098b7b21b6424c2a4eea26194883a623"/></dir><dir name="signup"><file name="test.phtml" hash="636501cd90c6ab4231bea54efb16b2ff"/></dir><file name="api.phtml" hash="468f33b2a23dbe2828489c1620000c74"/><file name="array.phtml" hash="5415eeff311735624354468c886d39b5"/><file name="diagnostics.phtml" hash="3327dba9e03362077f7562e3045180b7"/><file name="info.phtml" hash="44ab79fdfc5fb5b0cd7e15e79bfd9502"/><file name="logging.phtml" hash="3c7bd2a6f48a84efca1d0f1e75097a8a"/><file name="note.phtml" hash="6625a3771ba10daba5ded5570574716f"/><file name="trouble.phtml" hash="fe706c8465a404ae8fd9cf645db0491c"/></dir></dir><file name="setup_check.phtml" hash="1814302f58a15fb1629446e074a7e1e0"/></dir><dir name="convert"><dir name="profile"><file name="export.phtml" hash="c829eeccb120ffe4c0b9f0ddf9c7ff9a"/></dir></dir></dir><dir name="troubleshooting"><dir name="view"><dir name="tab"><file name="download.phtml" hash="d5701a0af7a8f308467fa5552d0de6b2"/><file name="help.phtml" hash="e1cb1209995b357bdbceb45a4197e17f"/><file name="info.phtml" hash="bd19bb1072ce1d60a4fb7bda660a0ce7"/><file name="log.phtml" hash="724a65165770bc92ed08ea32d20c1fe7"/><file name="settings.phtml" hash="b8661b58c492283b6670c377803fd03f"/><file name="submit.phtml" hash="2929f5910bcd809777d6f4634717d93e"/></dir><file name="form.phtml" hash="d2338bfe3598e9315ca8f5ac8d9b5516"/></dir><file name="status.phtml" hash="fac61e17efe7bd4cf67a47eb67786496"/><file name="view.phtml" hash="6ddfc8c6efe25d30e63f792b19a95c84"/></dir><file name="diagnostics.phtml" hash="f1f43a89824cad9f39e599df21ac44b4"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="emaildirect.xml" hash="0e97169b46f1b866e6ff2e49f9b6575a"/></dir><dir name="template"><dir name="emaildirect"><dir name="capture"><file name="email.phtml" hash="fa273ff1a48a12eb386f58f3e3e78f66"/></dir><dir name="checkout"><file name="subscribe.phtml" hash="d57eb93aab4e0f1d58f1ec8b9ed24c50"/></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="fb89b2a726be35932de32ec9417ba81a"/></dir><file name="lists.phtml" hash="4c697dcfa63ece1db7885cadb02982d1"/></dir></dir><dir name="signup"><file name="form.phtml" hash="3d483079d29b79ad4daf306228120c0f"/></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="90a441f2d0dff6c247f810274e8a76ab"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>EmailDirect_Integration</name>
|
4 |
+
<version>2.0.13</version>
|
5 |
<stability>stable</stability>
|
6 |
<license/>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>EmailDirect integration for magento</summary>
|
10 |
<description>EmailDirect integration for magento</description>
|
11 |
+
<notes>Abandoned Cart process improvements.
|
12 |
+

|
13 |
+
Improved HTTPS support.</notes>
|
14 |
<authors><author><name>Kevin Linden</name><user>auto-converted</user><email>Kevin@EmailDirect.com</email></author></authors>
|
15 |
+
<date>2015-03-06</date>
|
16 |
+
<time>21:03:27</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="EmailDirect"><dir name="Integration"><dir name="Block"><dir name="Adminhtml"><dir name="Abandoned"><dir name="Details"><dir name="Tab"><dir name="Diagnostics"><file name="Status.php" hash="8706487c8f465a5ce762cd923258bb35"/></dir><file name="Cart.php" hash="09e9331f6c72157f581ad7135b7f147c"/><file name="Diagnostics.php" hash="eba18ce04ccb125ce4aa6ed5e473734a"/></dir><file name="Abstract.php" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="Form.php" hash="dffc6e49eb95db2f83050706eee1fd55"/></dir><file name="Details.php" hash="9f98f4dd9ea741f9f7dd2eb018af0d7d"/><file name="Grid.php" hash="e0a15673636acb7e113fdf6e3bcd8879"/><file name="Status.php" hash="9a740fd8c63148532bbcf07d19f462df"/><file name="Tabs.php" hash="19e184e72777dfc5b0c35b7027a3e1cf"/></dir><dir name="Diagnostics"><dir name="Status"><file name="Abstract.php" hash="4a54d82d748f880fc5bb8263935ddc98"/></dir></dir><dir name="Order"><dir name="View"><dir name="Tab"><dir name="Diagnostics"><file name="Status.php" hash="b4dd8410aa9ce649e603762d5d14f314"/></dir><file name="Diagnostics.php" hash="91bb6af0c9a0e6f41d2575651e8a59ef"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="25796ead15053f86d7adcd551b8b49e7"/></dir><dir name="Form"><dir name="Field"><dir name="Export"><file name="Orders.php" hash="5b101fadb6a64044b276eb07b21cf0a5"/><file name="Products.php" hash="32e13d4b7250890bf84aba87f25de03c"/><file name="Range.php" hash="4adac96fa53fa8e1449bae943a8cca80"/></dir><dir name="Signup"><file name="Test.php" hash="3b773dda25c62bc8cb28031931d67f9f"/></dir><file name="Addressmapfields.php" hash="97b75c8340d561e863a3985ad73ce228"/><file name="Api.php" hash="77dabda85973dc72227937397392c411"/><file name="Common.php" hash="6a86cce53f6df6857ea79241fa281939"/><file name="Diagnostics.php" hash="7efe5c8b90db90e9c512842388d3263d"/><file name="Info.php" hash="246de52ea5d2349ecd7f103cbba8cb8f"/><file name="Logging.php" hash="53b0b7d28d2680e479bfa89b6884802d"/><file name="Mapfields.php" hash="16894c5d76df1293e63128e349700e05"/><file name="Note.php" hash="ef99a474bbc3a828c7a618132a80fe66"/><file name="Shippingmapfields.php" hash="589a74260f394a5eae1b57ca89a74a8b"/><file name="Troubleshooting.php" hash="ff22589730034e7742978e884766d139"/></dir></dir></dir><dir name="Convert"><dir name="Profile"><dir name="Export"><file name="Orders.php" hash="947af2b0d8e3f7bc47c47b32cd434f18"/><file name="Products.php" hash="3f93e4789dbeb6710cd2742587d61726"/></dir><file name="Export.php" hash="ba879607ac0693e9db6251bbbc1676a1"/></dir></dir></dir><dir name="Troubleshooting"><dir name="View"><dir name="Tab"><file name="Download.php" hash="619916677df7c833e559aae74dae2aa0"/><file name="Help.php" hash="ad4007af59687653f4d6692f2b42b31d"/><file name="Info.php" hash="be5c15da32ef0e042c53d8ac007f8bd6"/><file name="Log.php" hash="a61e66923a287beee5910511b7282a0a"/><file name="Settings.php" hash="f15e57cdc6539c4da84042c98f0ab25c"/><file name="Submit.php" hash="81ae0e0636b66a329cf8f39939788d1d"/></dir><file name="Form.php" hash="e527a3a2335b109c48a69f06c1b0d01f"/></dir><file name="Status.php" hash="d140afcad424ff531bebb412539d6f1c"/><file name="Tabs.php" hash="5d4168cec60212beb87997e6391282e9"/><file name="View.php" hash="47efa0685db07fb73544ad477a0e2c85"/></dir><file name="Abandoned.php" hash="1ee964e54b38a6c24c09f7b3aa6ce411"/></dir><dir name="Checkout"><file name="Subscribe.php" hash="12f6e5c467fb632e11c9ced35c82ebe6"/></dir><dir name="Customer"><dir name="Account"><file name="Lists.php" hash="e1b911c77a78995d3b3390363926ae5a"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><dir name="Abandoned"><file name="Minutes.php" hash="e311f6de480fd4b63aee7f46ea412372"/></dir><file name="Action.php" hash="bf2243f50c9c6dafca26a5bcb889f372"/></dir></dir></dir></dir><file name="Capture.php" hash="e44034ad875957a566d3ac89abb408ed"/><file name="Signup.php" hash="c51c2e5cb93978170a65dc4b69d197bf"/></dir><dir name="Controller"><dir name="Front"><file name="Abstract.php" hash="48d93179d5f8a6b416fd82dd8763daf9"/></dir></dir><dir name="Helper"><file name="Abandoned.php" hash="7910bd8db8a030ae22adae9469d91fe7"/><file name="Data.php" hash="0feafdc257fb6666c35d91e10d6f6350"/><file name="Diagnostic.php" hash="68867fd906405a6be98e14c1568437b6"/><file name="Fields.php" hash="5fa737c45be172f55fe965975aa6db52"/><file name="Order.php" hash="11404d27039db36e1b71bd5c4b97b6fa"/><file name="Troubleshooting.php" hash="cf422b72b445a86326e73cbc6f506e18"/></dir><dir name="Model"><dir name="Abandoned"><file name="Observer.php" hash="00f8e4f8186a6c800df932b74b147844"/></dir><dir name="Configuration"><file name="Observer.php" hash="9a188656d5f7d73c91bf4221cc6e4aac"/></dir><dir name="Customer"><file name="Observer.php" hash="cef8d32ba304c51b448343555ea6a066"/></dir><dir name="Mysql4"><dir name="Abandoned"><file name="Collection.php" hash="1a9129267942a98ac3830ceaf714c2ab"/></dir><dir name="Order"><file name="Collection.php" hash="43d343562cf7e54f1b36315aa5d1d4a7"/></dir><dir name="Session"><file name="Collection.php" hash="7d6a8283fdbc1207d709e2bbbc78906d"/></dir><file name="Abandoned.php" hash="485b3771906783d383de75ae9761e55c"/><file name="Order.php" hash="8d538a5737095a1ba0ad448c027b3afb"/><file name="Session.php" hash="516eeeb28038416dc885ed7af6a8a8b0"/></dir><dir name="Newsletter"><file name="Observer.php" hash="b3365f1de331f3bca220322af3fefe3f"/></dir><dir name="Observer"><file name="Abstract.php" hash="1db39dc86bed51af1d2a3b4df50099bd"/></dir><dir name="Order"><file name="Observer.php" hash="81416e0d6f8ce63513aae67a53005eb9"/></dir><dir name="Resource"><file name="Setup.php" hash="5435dccf0f14ec402018bb45af56ecb5"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Export"><file name="Batch.php" hash="96c51fc5c0b947750be4e612e32c83ab"/></dir><dir name="Send"><file name="Field.php" hash="8ecffa8ccce40f3b2db6513b24eb9200"/></dir><dir name="Signup"><file name="Opacity.php" hash="8eabed4c72e7347f0376c3d4cc1023a7"/><file name="Recurrence.php" hash="e11200bbc204b00486c373d8a4e6675e"/></dir><file name="Abandoned.php" hash="9881811b94f38be90bd20a99951a1903"/><file name="Abandonedlist.php" hash="b81d7f2cb03b8482debea5cd6a2bd1c5"/><file name="Additionallist.php" hash="9f109ab04c7ae7832887572b26868e3a"/><file name="Checkoutsubscribe.php" hash="fd90252a1f19649a420dae136ad2a2ba"/><file name="List.php" hash="84c1c8e27f579d5d33992fcb15202748"/><file name="Publication.php" hash="a5bc0192605fc558fe59b37cc0462825"/><file name="Sequence.php" hash="a599f218882d2cfc68dfcf4d58a98a41"/><file name="Source.php" hash="44815cbf4ac6443032df1e7d9c4cadef"/><file name="States.php" hash="a746affc786d8165a98801e68cbf80ab"/><file name="Statuses.php" hash="9844a7a9c3b5c68df45c8f6c518acf16"/><file name="Time.php" hash="8acbb5cb33e66de1e408cf55d17a9398"/></dir></dir></dir><dir name="Wrapper"><file name="Abandoned.php" hash="ef81d36a7276737f2d0aa1a5d783a83b"/><file name="Abstract.php" hash="9e97ce6a12e0d074921bb3a1391f3648"/><file name="Database.php" hash="3cceb467358d13584baff58c043762ec"/><file name="Execute.php" hash="e38737d197b2ccd6700ec87ec1836456"/><file name="Ftp.php" hash="d5335cfb68f99761d6902dd390a3d7a8"/><file name="Lists.php" hash="425d64b9256bbdbafa899c4138e78368"/><file name="Orders.php" hash="66be3441f9204048279fb4921a04e375"/><file name="Publications.php" hash="1bebd172a8bba669d075f09589785652"/><file name="Sources.php" hash="c6caf0274f7d0c50114324bc47a490c4"/><file name="Subscribers.php" hash="f9abcadf5b793640a4301495462d6ea7"/><file name="Wishlist.php" hash="2ceb111bbeaa06c4f13f61281aaa5b5e"/></dir><file name="Abandoned.php" hash="93bd43b59b143dec15858a6fba6ae568"/><file name="Observer.php" hash="24d421b11e04e228cbdf3eee0b852572"/><file name="Order.php" hash="b21426543cd46f799cd0743525120fb8"/><file name="Session.php" hash="c56ecf779dbfb2dae0030935af31911a"/></dir><dir name="controllers"><dir name="Admin"><file name="AbandonedController.php" hash="7366ad52662d5494e1b0e65988ee1dc7"/><file name="DiagnosticController.php" hash="aa0f4e9bf3c22124c61c3f46729372a9"/><file name="ExportController.php" hash="3ff11560de77d99bccb2cc257d14b8ab"/><file name="TroubleshootingController.php" hash="52847165f3c24c955832455e2c27a7a6"/></dir><dir name="Customer"><file name="AccountController.php" hash="91942750c1c3d20dc31159c1ffbe8200"/></dir><file name="AbandonedController.php" hash="39c9d1a72bca9369a3121ac15f68558e"/><file name="CaptureController.php" hash="89e043bb3864617a062e915d2209dcf4"/><file name="ExportController.php" hash="7ca147debc5c1436b3bf2d9501592f33"/><file name="SignupController.php" hash="fe975d44cc11f1270d34d9d82c7d4be9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5501d4faf3da5ba1e380017b9608e1e8"/><file name="config.xml" hash="f8cdab6f6674d26aeef7027b46791b61"/><file name="system.xml" hash="4d641ef9e5c3a17fa1cd3b3d790f816a"/></dir><dir name="sql"><dir name="emaildirect_setup"><file name="mysql4-install-2.0.0.php" hash="bdc5e09fe949b36534c50c85fd198e66"/><file name="mysql4-upgrade-1.5.8-2.0.0.php" hash="8f33c7f6dca96cfa8210ec1fe016d95b"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="emaildirect"><file name="emaildirect-tab.png" hash="9ddb077b74a7078ac509d79b024631a1"/><file name="emaildirect.css" hash="61d3d7b29b97f75023f2232cae6eb0c1"/><file name="logo.png" hash="2e7e39ced387c798ef27b77dd69f073e"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="emaildirect"><dir name="images"><file name="window_close.png" hash="3af14f053f360bf31f8ba2df73ec7f1e"/></dir><file name="emaildirect.css" hash="c9caf9ea168efa3b0d6f4b881bcf093c"/><file name="integration.js" hash="7980204c0f594b180b9fa336954c9229"/></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="7767cd483e20d1930c0f1d79fee03b2a"/></dir><dir name="template"><dir name="emaildirect"><dir name="abandoned"><dir name="details"><dir name="tab"><dir name="diagnostics"><file name="status.phtml" hash="24829356b9dba966e53fb1cfe0f192b6"/></dir><file name="cart.phtml" hash="be7ca2b147fc836c2ca547b290ffe841"/></dir><file name="form.phtml" hash="60633d212382770e99d11d24ae919e47"/></dir><file name="details.phtml" hash="9d467b97a2d773aec950bea7061c6730"/><file name="status.phtml" hash="9e7723dc1fe5f8693345db9cc7cda808"/></dir><dir name="order"><dir name="view"><dir name="tab"><dir name="diagnostics"><file name="status.phtml" hash="a3bdecb1ec08903dd1b61dce6992e190"/></dir></dir></dir></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="176f3ddb8ea667a64a06967351526f3c"/></dir><dir name="form"><dir name="field"><dir name="export"><file name="date_range.phtml" hash="6a37b1e58456e1dcec734c48deb8c0c1"/><file name="orders.phtml" hash="1dfa19a712b18d2c95c2f4b938f6acef"/><file name="products.phtml" hash="098b7b21b6424c2a4eea26194883a623"/></dir><dir name="signup"><file name="test.phtml" hash="636501cd90c6ab4231bea54efb16b2ff"/></dir><file name="api.phtml" hash="468f33b2a23dbe2828489c1620000c74"/><file name="array.phtml" hash="5415eeff311735624354468c886d39b5"/><file name="diagnostics.phtml" hash="3327dba9e03362077f7562e3045180b7"/><file name="info.phtml" hash="44ab79fdfc5fb5b0cd7e15e79bfd9502"/><file name="logging.phtml" hash="3c7bd2a6f48a84efca1d0f1e75097a8a"/><file name="note.phtml" hash="6625a3771ba10daba5ded5570574716f"/><file name="trouble.phtml" hash="fe706c8465a404ae8fd9cf645db0491c"/></dir></dir><file name="setup_check.phtml" hash="1814302f58a15fb1629446e074a7e1e0"/></dir><dir name="convert"><dir name="profile"><file name="export.phtml" hash="c829eeccb120ffe4c0b9f0ddf9c7ff9a"/></dir></dir></dir><dir name="troubleshooting"><dir name="view"><dir name="tab"><file name="download.phtml" hash="d5701a0af7a8f308467fa5552d0de6b2"/><file name="help.phtml" hash="e1cb1209995b357bdbceb45a4197e17f"/><file name="info.phtml" hash="bd19bb1072ce1d60a4fb7bda660a0ce7"/><file name="log.phtml" hash="724a65165770bc92ed08ea32d20c1fe7"/><file name="settings.phtml" hash="b8661b58c492283b6670c377803fd03f"/><file name="submit.phtml" hash="2929f5910bcd809777d6f4634717d93e"/></dir><file name="form.phtml" hash="d2338bfe3598e9315ca8f5ac8d9b5516"/></dir><file name="status.phtml" hash="fac61e17efe7bd4cf67a47eb67786496"/><file name="view.phtml" hash="6ddfc8c6efe25d30e63f792b19a95c84"/></dir><file name="diagnostics.phtml" hash="f1f43a89824cad9f39e599df21ac44b4"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="emaildirect.xml" hash="d042caab36fccbb10ded229b26971a2f"/></dir><dir name="template"><dir name="emaildirect"><dir name="capture"><file name="email.phtml" hash="fa273ff1a48a12eb386f58f3e3e78f66"/></dir><dir name="checkout"><file name="subscribe.phtml" hash="d57eb93aab4e0f1d58f1ec8b9ed24c50"/></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="50ebf53c50e5e0419dd86a6d5faa2bf9"/></dir><file name="lists.phtml" hash="4c697dcfa63ece1db7885cadb02982d1"/></dir></dir><dir name="signup"><file name="form.phtml" hash="3d483079d29b79ad4daf306228120c0f"/></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="90a441f2d0dff6c247f810274e8a76ab"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|
skin/frontend/base/default/emaildirect/integration.js
CHANGED
@@ -8,7 +8,6 @@ removeManageNewsletter = function(){
|
|
8 |
document.observe("dom:loaded", function() {
|
9 |
|
10 |
var emaildirectEnabled = $$('div.block-content ul li a[href*="emaildirect/customer_account/index"]');
|
11 |
-
|
12 |
if(emaildirectEnabled.length){
|
13 |
removeManageNewsletter();
|
14 |
var editLink = $$('div.my-account a[href*="newsletter/manage"]');
|
8 |
document.observe("dom:loaded", function() {
|
9 |
|
10 |
var emaildirectEnabled = $$('div.block-content ul li a[href*="emaildirect/customer_account/index"]');
|
|
|
11 |
if(emaildirectEnabled.length){
|
12 |
removeManageNewsletter();
|
13 |
var editLink = $$('div.my-account a[href*="newsletter/manage"]');
|