SSTech_Abandcart - Version 1.0.0

Version Notes

Release version 1.0.0

Download this release

Release Info

Developer SSTech
Extension SSTech_Abandcart
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/SSTech/Abandcart/Block/Debug/Report.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Get debug report button and link in the admin backend
4
+ *
5
+ * Stech Abandcart Debug Report Block
6
+ *
7
+ * @category SSTech
8
+ * @package SSTech_Abandcart
9
+ * @author SSTech
10
+ * */
11
+
12
+ class SSTech_Abandcart_Block_Debug_Report extends Mage_Adminhtml_Block_System_Config_Form_Field
13
+ {
14
+ /**
15
+ * get html element for button
16
+ *
17
+ * @param Varien_Data_Form_Element_Abstract $element
18
+ * @return Mage_Adminhtml_Block_System_Config_Form_Field
19
+ */
20
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
21
+ $this->setElement($element);
22
+ return $this->_getAddRowButtonHtml($this->__('Send Email Now'));
23
+ }
24
+
25
+ /**
26
+ * get row button html for button
27
+ *
28
+ * @param Varien_Data_Form_Element_Abstract $element
29
+ * @return String $html
30
+ */
31
+
32
+ protected function _getAddRowButtonHtml($title) {
33
+ $url = Mage::helper('adminhtml')->getUrl("abandcart/debug/sendreport");
34
+ return $this->getLayout()->createBlock('adminhtml/widget_button')
35
+ ->setType('button')
36
+ ->setLabel($this->__($title))
37
+ ->setOnClick("window.location.href='" . $url . "'")
38
+ ->toHtml();
39
+ }
40
+
41
+ }
app/code/community/SSTech/Abandcart/Helper/Data.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ @package SSTech_Abandcart
4
+ @author SSTech
5
+ Empty helper to keep admin from breaking
6
+ */
7
+ class SSTech_abandcart_Helper_Data extends Mage_Core_Helper_Abstract
8
+ {
9
+ }
app/code/community/SSTech/Abandcart/Model/Cron.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Run cron for abandoned cart
4
+ *
5
+ * Stech Abandcart Cron Model
6
+ *
7
+ * @category SSTech
8
+ * @package SSTech_Abandcart
9
+ * @author SSTech
10
+ * */
11
+ class SSTech_Abandcart_Model_Cron
12
+ {
13
+ /**
14
+ * Send email report to users
15
+ */
16
+ public function emailreport()
17
+ {
18
+ $reporter = Mage::getModel('sstech_abandcart/report');
19
+ // If disabled don't send the email
20
+ if ($reporter->isEnabled()) Mage::log($reporter->sendReport());;
21
+ }
22
+ }
app/code/community/SSTech/Abandcart/Model/Report.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Stech Abandcart Report
4
+ *
5
+ * @category SSTech
6
+ * @package SSTech_Abandcart
7
+ * @author Developer
8
+ */
9
+ class SSTech_Abandcart_Model_Report extends Mage_Core_Model_Abstract
10
+ {
11
+
12
+ private $_enabled = null;
13
+ private $_from_email = null;
14
+ private $_to_email = null;
15
+ private $_template = null;
16
+ private $_days = 7; /* to calculate the number of days*/
17
+ private $_currency = null;
18
+ private $_store_url = null;
19
+ private $_success_count = 0;
20
+ private $_unsuccess_count = 0;
21
+ private $_skin_url = null;
22
+ private $_recepient_email = null;
23
+ private $_recepient_found = null;
24
+ private $_customer_name=null;
25
+ private $_return_cart = null;
26
+
27
+ /**
28
+ * (non-PHPdoc)
29
+ * @see Mage_Shell_Abstract::_construct()
30
+ */
31
+ public function _construct() {
32
+ $this->_enabled = Mage::getStoreConfig('sstech_abandcart/sstech_abandcart_settings/report_enabled');
33
+ $this->_from_email = Mage::getStoreConfig('sstech_abandcart/sstech_abandcart_settings/report_from_email');
34
+ $this->_template = Mage::getStoreConfig('sstech_abandcart/sstech_abandcart_settings/report_template');
35
+ $this->_days = Mage::getStoreConfig('sstech_abandcart/sstech_abandcart_settings/report_days');
36
+ $this->_currency = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
37
+ $this->_store_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
38
+ $this->_skin_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
39
+ $this->_recepient_email = Mage::getStoreConfig('sstech_abandcart/sstech_abandcart_settings/report_to_email');
40
+ } // end
41
+
42
+ /**
43
+ * check if email reporting is enabled
44
+ *
45
+ * @return boolean
46
+ */
47
+
48
+ public function isEnabled() {
49
+ return $this->_enabled;
50
+ }
51
+
52
+ /**
53
+ * send email for abandoned cart to the shopping cart users
54
+ *
55
+ * @return String $fresult
56
+ */
57
+
58
+ public function sendReport() {
59
+
60
+ $html = "";
61
+ $core_helper = Mage::helper('core');
62
+ $image_helper = Mage::helper('catalog/image');
63
+ /* Date Default Function use to calculate the Difference*/
64
+ date_default_timezone_set(date_default_timezone_get());
65
+ $timezone=date_default_timezone_get();
66
+ $datetime = Zend_Date::now();
67
+ $now = $datetime->get('yyyy-MM-dd HH:mm:ss');
68
+
69
+ $from = strtotime($now)-(60*60*24*30); // 30 days before today
70
+ $to = strtotime($now)-(60*60*24*$this->_days);
71
+ $from = date('Y-m-d H:i:s', $from);
72
+ $to = date('Y-m-d H:i:s', $to);
73
+
74
+ try {
75
+ $abandon = $this->_getAllAbandonedCart($now , $from);
76
+ if(empty($abandon)) { return "NOTICE|There is no Abandoned cart present";}
77
+ $products = Mage::getModel('catalog/product');
78
+ foreach($abandon as $a){
79
+ $quotes_item = Mage::getModel('sales/quote_item')->getCollection()->addFieldToFilter('quote_id',$a['entity_id']);
80
+ $b = $quotes_item->getData();
81
+ if($this->isRecepient($a['customer_email'])){
82
+ foreach($b as $c){
83
+ $price = $c['qty']*$c['price'];
84
+ if($c['parent_item_id'] == null){
85
+ $pcache = $products->loadByAttribute('sku', $c['sku']);
86
+ $name = $pcache->getName();
87
+ $thumb = $image_helper->init($pcache, 'thumbnail')->resize(60,60);
88
+ $eurl = $this->_store_url.$this->_getParent($pcache)->getUrlKey();
89
+ $html .= "<tr>";
90
+ $html .= "<td><img src='".$thumb."'></td><td><a href='".$eurl."'>".$name."</a></td><td>".$c['sku']."</td><td>".intval($c['qty'])."</td><td>".$core_helper->formatPrice($price, FALSE)."</td>";
91
+ $html .= "</tr>";
92
+ }
93
+ }
94
+
95
+ $html .= "<tr><td></td><td></td><td></td><td>Subtotal</td><td align='right'>".$core_helper->formatprice($a['subtotal'],false)."</td></tr>";
96
+ $html .= $this->_shippingCost($a['subtotal'],$a['grand_total']);
97
+ $html .= "<tr><td></td><td></td><td></td><td><b>Grand Total</b></td><td><b>".$core_helper->formatprice($a['grand_total'],false)."</b></td></tr>";
98
+ $this->_customer_name = $a['customer_firstname'];
99
+ $this->_return_cart = $this->_getReturnCartForm($a['customer_id']);
100
+ $res = $this->sendEmail($html,$this->_store_url,$this->_customer_name,$this->_return_cart,$a['customer_email']);
101
+ $html=""; //reset html
102
+ $this->_success_count = ($res == "YES") ? ($this->_success_count+1) : $this->_success_count;
103
+ $this->_unsuccess_count = ($res == "NO") ? ($this->_unsuccess_count+1) : $this->_unsuccess_count;
104
+ }
105
+ }
106
+
107
+ if(!is_null($this->_recepient_found) && $this->_recepient_found == "no")
108
+ {
109
+ throw new Exception(' - Provided Recepient does not have abandoned cart');
110
+ }
111
+ }
112
+
113
+ catch (Exception $e)
114
+ {
115
+ return "ERROR|There was a problem sending the email".$e->getMessage();
116
+ }
117
+
118
+ $fresult ="NOTICE|".$this->_success_count." mails sent successfully ".$this->_unsuccess_count." were not delivered";
119
+ return $fresult;
120
+
121
+ } // end
122
+
123
+
124
+
125
+
126
+ /**
127
+ * create return to cart form
128
+ *
129
+ * @param int $id
130
+ * @return String
131
+ */
132
+ private function _getReturnCartForm($id){
133
+
134
+ $customer = Mage::getModel('customer/customer')->load($id);
135
+
136
+ $form = "";
137
+
138
+ $form .= "<form action='http://www.testvitality4life.com.au/vl4/autologin/' method='post'>";
139
+
140
+ $form .= "<input type='hidden' name='login[username]' value='".$customer->getEmail()."'>";
141
+
142
+ $form .= "<input type='hidden' name='login[password]' value='".$customer->getPasswordHash()."'>";
143
+
144
+ $form .= "<input type='submit' value='Return to your cart'>";
145
+
146
+ $form .= "</form>";
147
+
148
+ return $form;
149
+ }
150
+
151
+ /**
152
+ * check if a shipping cost is applied
153
+ *
154
+ * @param double $subtotal
155
+ * @param double $grandtotal
156
+ * @return String
157
+ */
158
+
159
+ private function _shippingCost($subtotal , $grandtotal){
160
+
161
+ $shipping = $grandtotal - $subtotal;
162
+
163
+ if($shipping > 0)
164
+
165
+ {
166
+
167
+ return "<tr><td></td><td></td><td></td><td>Shipping Cost</td><td align='right'>".Mage::helper('core')->formatprice($shipping,false)."</td></tr>";
168
+
169
+ } else {
170
+
171
+ return "";
172
+
173
+ }
174
+
175
+ }
176
+
177
+ /**
178
+ * check if a specific cart user needs to be sent email
179
+ *
180
+ * @param String $email
181
+ * @return boolean
182
+ */
183
+
184
+ private function isRecepient($email){
185
+ if(is_null($this->_recepient_email) || empty($this->_recepient_email)){
186
+ return true;
187
+ }
188
+
189
+ $emails = explode(';',$this->_recepient_email);
190
+
191
+ foreach($emails as $e)
192
+ {
193
+ if($e == $email)
194
+ {
195
+ $this->_recepient_found = "yes";
196
+ return true;
197
+ } else {
198
+ $this->_recepient_found = "no";
199
+ return false;
200
+ }
201
+ }
202
+ }
203
+
204
+ /**
205
+ * get all abandoned cart in given date range
206
+ *
207
+ * @param datetime $to
208
+ * @param datetime $from
209
+ * @return array
210
+ */
211
+
212
+ private function _getAllAbandonedCart( $to , $from){
213
+ $quotes = Mage::getModel('sales/quote')->getCollection();
214
+
215
+ $quotes->addFieldToFilter('updated_at',array('to'=>$to ,'from'=>$from , 'date'=>true));
216
+
217
+ $quotes->addFieldToFilter('is_active', 1);
218
+
219
+ $quotes->addFieldToFilter('customer_email', array('notnull'=>true));
220
+ $quotes->addFieldToFilter('items_count',array('gt'=> 0));
221
+
222
+ $quotes->setOrder('entity_id', 'DESC');
223
+
224
+ #$quotes->setPageSize(1);
225
+
226
+ return $quotes->getData();
227
+ }
228
+
229
+ /**
230
+ * get parent product of the product
231
+ *
232
+ * @param Mage_Catalog_Model_Product $product
233
+ * @return Mage_Catalog_Model_Product $parent
234
+ */
235
+
236
+ private function _getParent($product){
237
+
238
+ if($product->getTypeId() == "simple"){
239
+
240
+ $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId());
241
+
242
+ if(!$parentIds)
243
+
244
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
245
+
246
+ if(isset($parentIds[0])){
247
+
248
+ $parent = Mage::getModel('catalog/product')->load($parentIds[0]);
249
+
250
+ return $parent;
251
+
252
+ } else {
253
+
254
+ return $product;
255
+
256
+ }
257
+
258
+ }
259
+
260
+ }
261
+
262
+ /**
263
+ * send email
264
+ *
265
+ * @param String $html
266
+ * @param String $email
267
+ * @return String YES|NO
268
+ */
269
+
270
+ private function sendEmail($html ,$url,$name, $returncart,$email) {
271
+
272
+ $result = true;
273
+
274
+ try {
275
+
276
+ // send mail to each recipient
277
+ $mail = Mage::getModel('core/email_template');
278
+ $mail->setDesignConfig(array('area' => 'frontend', 'store' => Mage::app()->getStore()->getId()))
279
+ ->sendTransactional(
280
+ $this->_template,
281
+ $this->_from_email,
282
+ trim($email),
283
+ null,
284
+ array('items'=>$html,'store_url'=>$url,'customer_name'=>$name,'return_cart'=>$returncart));
285
+
286
+ $result = $mail->getSentSuccess() ? $result : false;
287
+
288
+ }
289
+ catch (Exception $e)
290
+ {
291
+ log($e->getMessage());
292
+ $exception = $e.getMessage();
293
+ throw new Exception($exception);
294
+ }
295
+
296
+ return $result ? "YES" : "NO";
297
+
298
+ }
299
+
300
+ } // end class
app/code/community/SSTech/Abandcart/controllers/Adminhtml/DebugController.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ *
7
+ *
8
+ * sStech Abandcart Adminhtml Debug Controller
9
+ *
10
+ * @category SSTech
11
+ * @package SSTech Abandcart
12
+ * @author SSTech
13
+ */
14
+ class SSTech_Abandcart_Adminhtml_DebugController extends Mage_Adminhtml_Controller_Action
15
+ {
16
+ /**
17
+ * Generate and send instant report for abandoned cart
18
+ */
19
+ public function sendreportAction()
20
+ {
21
+ $returnVal = Mage::getModel('sstech_abandcart/report')->sendReport();
22
+ $result = explode('|',$returnVal);
23
+ $success = ($result[0] == "NOTICE") ? true : false;
24
+ $msg = $result[1];
25
+ if ($success) {
26
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__($msg));
27
+ }
28
+ else{
29
+ Mage::getSingleton('adminhtml/session')->addError($this->__($msg));
30
+ }
31
+ $this->_redirectReferer();
32
+ }
33
+ }
app/code/community/SSTech/Abandcart/controllers/IndexController.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * To autologin via email
4
+ *
5
+ * SSTech Autologin controller
6
+ *
7
+ * @category SSTech
8
+ * @package SSTech_Abandcart
9
+ * @author SSTech
10
+ * */
11
+ class SSTech_Abandcart_IndexController extends Mage_Core_Controller_Front_Action{
12
+
13
+ const EXCEPTION_EMAIL_NOT_CONFIRMED = 1;
14
+ const EXCEPTION_INVALID_EMAIL_OR_PASSWORD = 2;
15
+
16
+ public function indexAction(){
17
+ if ($this->_getSession()->isLoggedIn()) {
18
+ $this->_redirect('checkout/cart');
19
+ return;
20
+ }
21
+ $session = $this->_getSession();
22
+
23
+ if ($this->getRequest()->isPost()) {
24
+ $login = $this->getRequest()->getPost('login');
25
+ if (!empty($login['username']) && !empty($login['password'])) {
26
+ try {
27
+ $this->login($login['username'], $login['password']);
28
+ } catch (Mage_Core_Exception $e) {
29
+ switch ($e->getCode()) {
30
+ case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED:
31
+ $value = Mage::helper('customer')->getEmailConfirmationUrl($login['username']);
32
+ $message = Mage::helper('customer')->__('This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', $value);
33
+ break;
34
+ case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD:
35
+ $message = $e->getMessage();
36
+ break;
37
+ default:
38
+ $message = $e->getMessage();
39
+ }
40
+ $session->addError($message);
41
+ $session->setUsername($login['username']);
42
+ } catch (Exception $e) {
43
+ // Mage::logException($e); // PA DSS violation: this exception log can disclose customer password
44
+ }
45
+ } else {
46
+ $session->addError($this->__('Login and password are required.'));
47
+ }
48
+ }
49
+
50
+ $this->_redirect('checkout/cart');
51
+ }
52
+
53
+ /**
54
+ * Retrieve customer session model object
55
+ *
56
+ * @return Mage_Customer_Model_Session
57
+ */
58
+ protected function _getSession()
59
+ {
60
+ return Mage::getSingleton('customer/session');
61
+ }
62
+
63
+ public function login($username, $password)
64
+ {
65
+ /** @var $customer Mage_Customer_Model_Customer */
66
+ $session = $this->_getSession();
67
+ $customer = Mage::getModel('customer/customer')
68
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
69
+ $customer->loadByEmail($username);
70
+ if ($this->authenticate($username, $password)) {
71
+ $session->setCustomerAsLoggedIn($customer);
72
+ $session->renewSession();
73
+ return true;
74
+ }
75
+ return false;
76
+ }
77
+
78
+ public function authenticate($login, $password)
79
+ {
80
+ $customer = Mage::getModel('customer/customer');
81
+ $customer->loadByEmail($login);
82
+ if ($customer->getConfirmation() && $customer->isConfirmationRequired()) {
83
+ throw Mage::exception('Mage_Core', Mage::helper('customer')->__('This account is not confirmed.'),
84
+ self::EXCEPTION_EMAIL_NOT_CONFIRMED
85
+ );
86
+ }
87
+
88
+ if (!$this->validatePassword($login,$password)) {
89
+ throw Mage::exception('Mage_Core', Mage::helper('customer')->__('Invalid login or password.'),
90
+ self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD
91
+ );
92
+ }
93
+ return true;
94
+ }
95
+
96
+ /**
97
+ * Validate password with salted hash
98
+ *
99
+ * @param string $password
100
+ * @param string $login
101
+ * @return boolean
102
+ */
103
+
104
+ public function validatePassword($login,$password)
105
+ {
106
+ $customer = Mage::getModel('customer/customer');
107
+ $customer->loadByEmail($login);
108
+ $hash = $customer->getPasswordHash();
109
+ if (!$hash) {
110
+ return false;
111
+ }
112
+ if($password == $hash)
113
+ {
114
+ return true;
115
+ } else {
116
+ return false;
117
+ }
118
+ }
119
+ }
app/code/community/SSTech/Abandcart/etc/adminhtml.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category SSTech
5
+ * @package SSTech_Abandcart
6
+ */
7
+ -->
8
+ <config>
9
+ <acl>
10
+ <resources>
11
+ <admin>
12
+ <children>
13
+ <system>
14
+ <children>
15
+ <config>
16
+ <children>
17
+ <sstech_abandcart translate="title">
18
+ <title>SSTech Section</title>
19
+ </sstech_abandcart>
20
+ </children>
21
+ </config>
22
+ </children>
23
+ </system>
24
+ </children>
25
+ </admin>
26
+ </resources>
27
+ </acl>
28
+ </config>
app/code/community/SSTech/Abandcart/etc/config.xml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category SSTech
5
+ * @package SSTech_Abandcart
6
+ */
7
+ -->
8
+ <config>
9
+ <modules>
10
+ <SSTech_Abandcart>
11
+ <version>0.1.0</version>
12
+ </SSTech_Abandcart>
13
+ </modules>
14
+ <admin>
15
+ <routers>
16
+ <abandcart>
17
+ <use>admin</use>
18
+ <args>
19
+ <modules>
20
+ <abandcart before="Mage_Adminhtml">SSTech_Abandcart_Adminhtml</abandcart>
21
+ </modules>
22
+ <module>SSTech_Abandcart</module>
23
+ <frontName>abandcart</frontName>
24
+ </args>
25
+ </abandcart>
26
+ </routers>
27
+ </admin>
28
+ <global>
29
+ <models>
30
+ <sstech_abandcart>
31
+ <class>SSTech_Abandcart_Model</class>
32
+ </sstech_abandcart>
33
+ </models>
34
+ <helpers>
35
+ <sstech_abandcart>
36
+ <class>SSTech_Abandcart_Helper</class>
37
+ </sstech_abandcart>
38
+ </helpers>
39
+ <blocks>
40
+ <abandcart>
41
+ <class>SSTech_Abandcart_Block</class>
42
+ </abandcart>
43
+ </blocks>
44
+ <template>
45
+ <email>
46
+ <sstech_abandcart_sstech_abandcart_settings_report_template translate="label" module="sstech_abandcart">
47
+ <label>Abandoned Cart Notification</label>
48
+ <file>abandcart/emailreport.html</file>
49
+ <type>html</type>
50
+ </sstech_abandcart_sstech_abandcart_settings_report_template>
51
+ </email>
52
+ </template>
53
+ </global>
54
+ <crontab>
55
+ <jobs>
56
+ <sstech_abandcart_email>
57
+ <run><model>sstech_abandcart/cron::emailreport</model></run>
58
+ <schedule>
59
+ <config_path>sstech_abandcart/sstech_abandcart_settings/report_schedule</config_path>
60
+ </schedule>
61
+ </sstech_abandcart_email>
62
+ </jobs>
63
+ </crontab>
64
+ <default>
65
+ <sstech_abandcart>
66
+ <stech_abandcart_settings>
67
+ <report_enabled>0</report_enabled>
68
+ <report_from_email>general</report_from_email>
69
+ <report_to_email></report_to_email>
70
+ <report_template>sstech_abandcart_sstech_abandcart_settings_report_template</report_template>
71
+ <report_days>7</report_days>
72
+ <report_schedule>0 6 * * *</report_schedule>
73
+ </stech_abandcart_settings>
74
+ </sstech_abandcart>
75
+ </default>
76
+ <frontend>
77
+ <routers>
78
+      <abandcart>
79
+         <use>standard</use>
80
+           <args>
81
+              <module>SSTech_Abandcart</module>
82
+              <frontName>autologin</frontName>
83
+           </args>
84
+      </abandcart>
85
+ </routers>
86
+ </frontend>
87
+ </config>
app/code/community/SSTech/Abandcart/etc/system.xml ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * @category Sstech
5
+ * @package Sstech_Abandcart
6
+ */
7
+ -->
8
+ <config>
9
+ <tabs>
10
+ <sstech translate="label">
11
+ <label>SSTech</label>
12
+ <sort_order>1</sort_order>
13
+ </sstech>
14
+ </tabs>
15
+ <sections>
16
+ <sstech_abandcart translate="label">
17
+ <label><![CDATA[Abandoned Cart Notifications]]></label>
18
+ <tab>sstech</tab>
19
+ <frontend_type>text</frontend_type>
20
+ <sort_order>1000</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>1</show_in_store>
24
+ <groups>
25
+ <sstech_abandcart_settings>
26
+ <label>Abandoned Cart Settings</label>
27
+ <frontend_type>text</frontend_type>
28
+ <sort_order>10</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ <expanded>1</expanded>
33
+ <comment><![CDATA[<p style="font-weight: bold;">Schedule an email to the user for abandoned cart</p>]]></comment>
34
+ <fields>
35
+ <report_enabled translate="label comment">
36
+ <label>Email Enabled</label>
37
+ <frontend_type>select</frontend_type>
38
+ <source_model>adminhtml/system_config_source_yesno</source_model>
39
+ <sort_order>10</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </report_enabled>
44
+ <report_from_email>
45
+ <label>Sender Address</label>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
48
+ <sort_order>20</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </report_from_email>
53
+ <report_to_email>
54
+ <label>Recepient Address</label>
55
+ <comment>send email to a specific user</comment>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>30</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </report_to_email>
62
+ <report_template translate="label">
63
+ <label>Template for the Email</label>
64
+ <frontend_type>select</frontend_type>
65
+ <source_model>adminhtml/system_config_source_email_template</source_model>
66
+ <sort_order>40</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </report_template>
71
+ <report_days translate="label">
72
+ <label>No of Days</label>
73
+ <frontend_type>text</frontend_type>
74
+ <sort_order>60</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ <comment><![CDATA[<p style="font-weight: bold;">No of days when the email will send once cron is set</p>]]></comment>
79
+ </report_days>
80
+ <report_schedule translate="label">
81
+ <label>Email Cron Schedule</label>
82
+ <frontend_type>text</frontend_type>
83
+ <sort_order>70</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ <comment><![CDATA[<p style="font-weight: bold;">Set Cron Time</p>]]></comment>
88
+ </report_schedule>
89
+
90
+ <report_run translate="label">
91
+ <label>Manually Send Email</label>
92
+ <frontend_model>abandcart/debug_report</frontend_model>
93
+ <sort_order>80</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ <comment>Use this button to manually send the email now</comment>
98
+ </report_run>
99
+ </fields>
100
+ </sstech_abandcart_settings>
101
+ </groups>
102
+ </sstech_abandcart>
103
+ </sections>
104
+ </config>
app/etc/modules/SSTech_Abandcart.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SSTech_Abandcart>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </SSTech_Abandcart>
8
+ </modules>
9
+ </config>
app/locale/en_US/template/email/abandcart/emailreport.html ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject You left the cart ? @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "var items":"Low Stock Items",
7
+ "var store_url":"Email Store url"
8
+ }
9
+ @-->
10
+
11
+ <!--@styles
12
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
13
+ @-->
14
+
15
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
16
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
17
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
18
+ <tr>
19
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
20
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
21
+ <!-- [ header starts here] -->
22
+ <tr>
23
+ <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
24
+ </tr>
25
+ <!-- [ middle starts here] -->
26
+ <tr>
27
+ <td valign="top">
28
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Dear,Customer</h1>
29
+ <p style="font-size:12px; line-height:16px; margin:0;">
30
+
31
+ We noticed you didn't complete the checkout process and your items were left in the cart.<br><br>
32
+ If you are having trouble placing your order and need help, please reply to this email
33
+ and we will assist you as soon as possible or feel free to call us at 1800 0000 000
34
+ Monday - Friday, 8am - 5pm PST.
35
+ You can check the items in your Cart <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>.
36
+ </p>
37
+
38
+ </tr>
39
+ <tr>
40
+ <td>
41
+ <table cellspacing="0" cellpadding="10px" style="border: 1px solid rgb(206,206,206);background:rgb(244,244,244);width: 100%;">
42
+ <tr style="background:rgb(229,229,229);">
43
+ <td></td>
44
+ <td style="font-weight: bold;">Item</td>
45
+ <td style="font-weight: bold;">Sku</td>
46
+ <td style="font-weight: bold;">Qty</td>
47
+ <td style="font-weight: bold;">Subtotal</td>
48
+ </tr>
49
+
50
+ {{var items}}
51
+
52
+ </table>
53
+ </td>
54
+ </tr>
55
+
56
+
57
+ <tr>
58
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
59
+ </tr>
60
+ </table>
61
+ </td>
62
+ </tr>
63
+ </table>
64
+ </div>
65
+ </body>
package.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>SSTech_Abandcart</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Abandoned cart module which help client to send a e-mail to the logged in customer who abandoned the cart</summary>
10
+ <description>Abandoned cart module which help client to send a e-mail to the logged in customer who abandoned the cart&#xD;
11
+ &#xD;
12
+ Features &#xD;
13
+ -Easily manage from Admin &#xD;
14
+ -Help to increase the sale &#xD;
15
+ -Just setup cron and mail will send to customer&#xD;
16
+ -Manage number of days when to send mail to customer&#xD;
17
+ -Send mail to specific customer &#xD;
18
+ </description>
19
+ <notes>Release version 1.0.0</notes>
20
+ <authors><author><name>SSTech</name><user>SSTech</user><email>sandynareshg@gmail.com</email></author></authors>
21
+ <date>2014-02-02</date>
22
+ <time>04:41:40</time>
23
+ <contents><target name="mageetc"><dir name="modules"><file name="SSTech_Abandcart.xml" hash="a04c8ebf15d74ed29e5ec727d6cd7f43"/></dir></target><target name="magecommunity"><dir name="SSTech"><dir name="Abandcart"><dir name="Block"><dir name="Debug"><file name="Report.php" hash="2d0c710c5916e9b26e93f4938e6a224f"/></dir></dir><dir name="Helper"><file name="Data.php" hash="df6cb74b034f899329038dfa3634461d"/></dir><dir name="Model"><file name="Cron.php" hash="707a9342421c58b082679c1ab8077655"/><file name="Report.php" hash="50a3a7468689fa097824cc84ba16149f"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DebugController.php" hash="303a78905d4797f9ead284f293123354"/></dir><file name="IndexController.php" hash="249beacfd38003f285cfaaea8790bf47"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d9214c26d702453bd6299f63118a91b2"/><file name="config.xml" hash="d30d2e9b2d1b871d46839fb77166800f"/><file name="system.xml" hash="2d855587eb4d7dacb2e0a00356c9afdd"/></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="abandcart"><file name="emailreport.html" hash="822ce21971e4d8d94c1623cbb71c82af"/></dir></dir></dir></dir></target></contents>
24
+ <compatible/>
25
+ <dependencies><required><php><min>5.2.17</min><max>6.0.0</max></php></required></dependencies>
26
+ </package>