web4pro_Abandonedcart - Version 1.0.0

Version Notes

fixed minor bugs

Download this release

Release Info

Developer Andrii Mutylo
Extension web4pro_Abandonedcart
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (44) hide show
  1. app/code/community/Web4pro/Abandonedcart/Block/Adminhtml/Abandonedmails.php +27 -0
  2. app/code/community/Web4pro/Abandonedcart/Block/Adminhtml/Abandonedmails/Grid.php +96 -0
  3. app/code/community/Web4pro/Abandonedcart/Block/Adminhtml/Abandonedorder.php +28 -0
  4. app/code/community/Web4pro/Abandonedcart/Block/Adminhtml/Abandonedorder/Grid.php +144 -0
  5. app/code/community/Web4pro/Abandonedcart/Block/Adminhtml/System/Config/Date.php +20 -0
  6. app/code/community/Web4pro/Abandonedcart/Block/Email/Order/Items.php +50 -0
  7. app/code/community/Web4pro/Abandonedcart/Helper/Data.php +86 -0
  8. app/code/community/Web4pro/Abandonedcart/Model/Config.php +74 -0
  9. app/code/community/Web4pro/Abandonedcart/Model/Cron.php +386 -0
  10. app/code/community/Web4pro/Abandonedcart/Model/EventObserver.php +62 -0
  11. app/code/community/Web4pro/Abandonedcart/Model/Mailssent.php +18 -0
  12. app/code/community/Web4pro/Abandonedcart/Model/Resource/Mailssent.php +19 -0
  13. app/code/community/Web4pro/Abandonedcart/Model/Resource/Mailssent/Collection.php +18 -0
  14. app/code/community/Web4pro/Abandonedcart/Model/Resource/Order/Collection.php +211 -0
  15. app/code/community/Web4pro/Abandonedcart/Model/System/Config/Automatic.php +25 -0
  16. app/code/community/Web4pro/Abandonedcart/Model/System/Config/Cmspage.php +22 -0
  17. app/code/community/Web4pro/Abandonedcart/Model/System/Config/Customergroup.php +24 -0
  18. app/code/community/Web4pro/Abandonedcart/Model/System/Config/Discounttype.php +31 -0
  19. app/code/community/Web4pro/Abandonedcart/Model/System/Config/Maxemails.php +22 -0
  20. app/code/community/Web4pro/Abandonedcart/Model/System/Config/Unit.php +24 -0
  21. app/code/community/Web4pro/Abandonedcart/controllers/AbandonedController.php +65 -0
  22. app/code/community/Web4pro/Abandonedcart/controllers/Adminhtml/AbandonedmailsController.php +61 -0
  23. app/code/community/Web4pro/Abandonedcart/controllers/Adminhtml/AbandonedorderController.php +76 -0
  24. app/code/community/Web4pro/Abandonedcart/etc/adminhtml.xml +71 -0
  25. app/code/community/Web4pro/Abandonedcart/etc/config.xml +189 -0
  26. app/code/community/Web4pro/Abandonedcart/etc/system.xml +403 -0
  27. app/code/community/Web4pro/Abandonedcart/sql/web4proabandonedcart_setup/mysql4-install-1.0.0.php +47 -0
  28. app/design/adminhtml/default/default/layout/abandonedcart.xml +33 -0
  29. app/design/adminhtml/default/default/template/web4pro/abandonedcart/dashboard/index.phtml +72 -0
  30. app/design/adminhtml/default/default/template/web4pro/abandonedcart/dashboard/salebar.phtml +10 -0
  31. app/design/adminhtml/default/default/template/web4pro/abandonedcart/dashboard/totalbar.phtml +27 -0
  32. app/design/frontend/base/default/template/web4pro_abandonedcart/email/order/items.phtml +98 -0
  33. app/design/frontend/base/default/template/web4pro_abandonedcart/email/order/items/order/default.phtml +125 -0
  34. app/etc/modules/Web4pro_Abandonedcart.xml +9 -0
  35. app/locale/en_US/Web4pro_Abandonedcart.csv +61 -0
  36. app/locale/en_US/template/email/web4pro/abandonedcart/cart_mail_1.html +44 -0
  37. app/locale/en_US/template/email/web4pro/abandonedcart/cart_mail_2.html +47 -0
  38. app/locale/en_US/template/email/web4pro/abandonedcart/cart_mail_3.html +46 -0
  39. app/locale/ru_RU/Web4pro_Abandonedcart.csv +60 -0
  40. app/locale/ru_RU/template/email/web4pro/abandonedcart/cart_mail_1.html +44 -0
  41. app/locale/ru_RU/template/email/web4pro/abandonedcart/cart_mail_2.html +45 -0
  42. app/locale/ru_RU/template/email/web4pro/abandonedcart/cart_mail_3.html +46 -0
  43. package.xml +30 -0
  44. skin/adminhtml/default/default/abandonedcart/abandonedcart.css +5 -0
app/code/community/Web4pro/Abandonedcart/Block/Adminhtml/Abandonedmails.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Block_Adminhtml_Abandonedmails extends Mage_Adminhtml_Block_Widget_Grid_Container
13
+ {
14
+ public function __construct()
15
+ {
16
+ // The blockGroup must match the first half of how we call the block, and controller matches the second half
17
+ // ie. foo_bar/adminhtml_baz
18
+ $this->_blockGroup = 'web4pro_abandonedcart';
19
+ $this->_controller = 'adminhtml_abandonedmails';
20
+ $this->_headerText = $this->__('Mails sent from abandoned carts');
21
+
22
+ parent::__construct();
23
+ $this->removeButton('add');
24
+
25
+ }
26
+
27
+ }
app/code/community/Web4pro/Abandonedcart/Block/Adminhtml/Abandonedmails/Grid.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Block_Adminhtml_Abandonedmails_Grid extends Mage_Adminhtml_Block_Widget_Grid
13
+ {
14
+ public function __construct()
15
+ {
16
+ parent::__construct();
17
+ $this->setDefaultSort('id');
18
+ $this->setId('web4pro_abandonedcart_abandonedmails_grid');
19
+ $this->setUseAjax(true);
20
+ $this->setDefaultSort('created_at');
21
+ $this->setDefaultDir('DESC');
22
+ $this->setSaveParametersInSession(true);
23
+ }
24
+
25
+ protected function _prepareCollection()
26
+ {
27
+ $collection = Mage::getResourceModel('web4pro_abandonedcart/mailssent_collection');
28
+ $this->setCollection($collection);
29
+ return parent::_prepareCollection();
30
+ }
31
+ protected function _prepareColumns()
32
+ {
33
+
34
+ $this->addColumn('store', array(
35
+ 'header' => Mage::helper('web4pro_abandonedcart')->__('Store'),
36
+ 'type' => 'store',
37
+ 'index' => 'store_id'
38
+ ));
39
+
40
+ $this->addColumn('sent_at', array(
41
+ 'header' => Mage::helper('web4pro_abandonedcart')->__('Sent At'),
42
+ 'index' => 'sent_at',
43
+ 'filter_index' => 'sent_at',
44
+ 'type' => 'datetime',
45
+ 'width' => '100px',
46
+ ));
47
+
48
+ $this->addColumn('customer_email', array(
49
+ 'header' => Mage::helper('web4pro_abandonedcart')->__('Customer Email'),
50
+ 'index' => 'customer_email',
51
+ ));
52
+
53
+ $this->addColumn('customer_name', array(
54
+ 'header' => Mage::helper('web4pro_abandonedcart')->__('Customer Name'),
55
+ 'index' => 'customer_name',
56
+ ));
57
+
58
+ $this->addColumn('mail_type', array(
59
+ 'header' => Mage::helper('web4pro_abandonedcart')->__('Mail Type'),
60
+ 'index' => 'mail_type',
61
+ 'type' => 'options',
62
+ 'options' => $this->getMailTypeOptions(),
63
+ ));
64
+ $this->addColumn('coupon', array(
65
+ 'header' => Mage::helper('web4pro_abandonedcart')->__('Coupon #'),
66
+ 'index' => 'coupon_number',
67
+ ));
68
+ $this->addColumn('coupon_type', array(
69
+ 'header' => Mage::helper('web4pro_abandonedcart')->__('Coupon type'),
70
+ 'type' => 'options',
71
+ 'index' => 'coupon_type',
72
+ 'options' => Mage::getModel('Web4pro_Abandonedcart_Model_System_Config_Discounttype')->options(),
73
+ ));
74
+ $this->addColumn('coupon_amount', array(
75
+ 'header' => Mage::helper('web4pro_abandonedcart')->__('Coupon amount'),
76
+ 'index' => 'coupon_amount',
77
+ ));
78
+
79
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
80
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
81
+
82
+ return parent::_prepareColumns();
83
+ }
84
+
85
+ public function getGridUrl()
86
+ {
87
+ return $this->getUrl('*/*/grid', array('_current'=>true));
88
+ }
89
+
90
+ protected function getMailTypeOptions()
91
+ {
92
+ return array('abandoned cart'=>'abandoned cart','new order'=>'new order', 'related products'=>'related products',
93
+ 'product review'=>'product review', 'no activity'=>'no activity', 'wishlist'=>'wishlist');
94
+ }
95
+
96
+ }
app/code/community/Web4pro/Abandonedcart/Block/Adminhtml/Abandonedorder.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+
13
+ class Web4pro_Abandonedcart_Block_Adminhtml_Abandonedorder extends Mage_Adminhtml_Block_Widget_Grid_Container
14
+ {
15
+ public function __construct()
16
+ {
17
+ // The blockGroup must match the first half of how we call the block, and controller matches the second half
18
+ // ie. foo_bar/adminhtml_baz
19
+ $this->_blockGroup = 'web4pro_abandonedcart';
20
+ $this->_controller = 'adminhtml_abandonedorder';
21
+ $this->_headerText = $this->__('Orders made from abandoned carts');
22
+
23
+ parent::__construct();
24
+ $this->removeButton('add');
25
+
26
+ }
27
+
28
+ }
app/code/community/Web4pro/Abandonedcart/Block/Adminhtml/Abandonedorder/Grid.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Block_Adminhtml_Abandonedorder_Grid extends Mage_Adminhtml_Block_Widget_Grid
13
+ {
14
+ /**
15
+ *
16
+ */
17
+ public function __construct()
18
+ {
19
+ parent::__construct();
20
+ // defaults for grid
21
+ $this->setDefaultSort('id');
22
+ $this->setId('web4pro_abandonedcart_abandonedorder_grid');
23
+ $this->setUseAjax(true);
24
+ $this->setDefaultSort('created_at');
25
+ $this->setDefaultDir('DESC');
26
+ $this->setSaveParametersInSession(true);
27
+ }
28
+
29
+ /**
30
+ * @return this
31
+ */
32
+ protected function _prepareCollection()
33
+ {
34
+ $collection = Mage::getResourceModel('sales/order_grid_collection');
35
+ $this->setCollection($collection);
36
+ $sales_flat_order_table = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
37
+ $collection->getSelect()->join($sales_flat_order_table , 'main_table.increment_id = '.$sales_flat_order_table.'.increment_id', 'web4pro_abandonedcart_flag');
38
+ $collection->addFieldToFilter($sales_flat_order_table.'.web4pro_abandonedcart_flag',array('eq' => 1));
39
+ return parent::_prepareCollection();
40
+ }
41
+
42
+ /**
43
+ * @return Mage_Adminhtml_Block_Widget_Grid
44
+ */
45
+ protected function _prepareColumns()
46
+ {
47
+
48
+ $this->addColumn('real_order_id', array(
49
+ 'header'=> Mage::helper('sales')->__('Order #'),
50
+ 'width' => '80px',
51
+ 'type' => 'text',
52
+ 'index' => 'increment_id',
53
+ ));
54
+
55
+ if (!Mage::app()->isSingleStoreMode()) {
56
+ $this->addColumn('store_id', array(
57
+ 'header' => Mage::helper('sales')->__('Purchased From'),
58
+ 'index' => 'store_id',
59
+ 'filter_index' => 'main_table.store_id',
60
+ 'type' => 'store',
61
+ 'store_view'=> true,
62
+ 'display_deleted' => true,
63
+ ));
64
+ }
65
+
66
+ $this->addColumn('created_at', array(
67
+ 'header' => Mage::helper('sales')->__('Purchased On'),
68
+ 'index' => 'created_at',
69
+ 'filter_index' => 'main_table.created_at',
70
+ 'type' => 'datetime',
71
+ 'width' => '100px',
72
+ ));
73
+
74
+ $this->addColumn('billing_name', array(
75
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
76
+ 'index' => 'billing_name',
77
+ ));
78
+
79
+ $this->addColumn('shipping_name', array(
80
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
81
+ 'index' => 'shipping_name',
82
+ ));
83
+
84
+ $this->addColumn('base_grand_total', array(
85
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
86
+ 'index' => 'base_grand_total',
87
+ 'type' => 'currency',
88
+ 'currency' => 'base_currency_code',
89
+ ));
90
+
91
+ $this->addColumn('grand_total', array(
92
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
93
+ 'index' => 'grand_total',
94
+ 'type' => 'currency',
95
+ 'currency' => 'order_currency_code',
96
+ ));
97
+
98
+ $this->addColumn('status', array(
99
+ 'header' => Mage::helper('sales')->__('Status'),
100
+ 'index' => 'main_table.status',
101
+ 'type' => 'options',
102
+ 'width' => '70px',
103
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
104
+ ));
105
+
106
+
107
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
108
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
109
+
110
+ return parent::_prepareColumns();
111
+ }
112
+
113
+ /**
114
+ * @return $this
115
+ */
116
+ protected function _prepareMassaction()
117
+ {
118
+ $this->setMassactionIdField('entity_id');
119
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
120
+ $this->getMassactionBlock()->setUseSelectAll(false);
121
+ return $this;
122
+
123
+ }
124
+
125
+ /**
126
+ * @param $row
127
+ * @return bool|string
128
+ */
129
+ public function getRowUrl($row)
130
+ {
131
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
132
+ return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
133
+ }
134
+ return false;
135
+ }
136
+
137
+ /**
138
+ * @return string
139
+ */
140
+ public function getGridUrl()
141
+ {
142
+ return $this->getUrl('*/*/grid', array('_current'=>true));
143
+ }
144
+ }
app/code/community/Web4pro/Abandonedcart/Block/Adminhtml/System/Config/Date.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
13
+ {
14
+ public function render(Varien_Data_Form_Element_Abstract $element)
15
+ {
16
+ $element->setFormat(Varien_Date::DATE_INTERNAL_FORMAT);
17
+ $element->setImage($this->getSkinUrl('images/grid-cal.gif'));
18
+ return parent::render($element);
19
+ }
20
+ }
app/code/community/Web4pro/Abandonedcart/Block/Email/Order/Items.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+
13
+ class Web4pro_Abandonedcart_Block_Email_Order_Items extends Mage_Sales_Block_Items_Abstract
14
+ {
15
+ public function _construct()
16
+ {
17
+ $this->setTemplate('web4pro_abandonedcart/email_order_items.phtml');
18
+ }
19
+
20
+ public function getTax($_item)
21
+ {
22
+ if (Mage::helper('tax')->displayCartPriceInclTax()){
23
+ $subtotal = Mage::helper('tax')->__('Incl. Tax') . ' : ' .Mage::helper('checkout')->formatPrice($_item['row_total_incl_tax']);
24
+ } elseif(Mage::helper('tax')->displayCartBothPrices()) {
25
+ $subtotal = Mage::helper('tax')->__('Excl. Tax') . ' : ' . Mage::helper('checkout')->formatPrice($_item['row_total']) . '<br>'. Mage::helper('tax')->__('Incl. Tax') . ' : ' . Mage::helper('checkout')->formatPrice($_item['row_total_incl_tax']);
26
+ } else {
27
+ $subtotal = Mage::helper('tax')->__('Excl. Tax') . ' : ' . Mage::helper('checkout')->formatPrice($_item['row_total']);
28
+ }
29
+ return $subtotal;
30
+ }
31
+
32
+ public function getImage($_item)
33
+ {
34
+ $product = Mage::getModel('catalog/product')
35
+ ->load($_item->getProductId());
36
+ if($product->getImage()=="no_selection"&&$product->getTypeId() == "configurable") {
37
+ $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
38
+ $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
39
+ foreach ($simple_collection as $simple_product) {
40
+ if ($simple_product->getImage() != "no_selection") {
41
+ $imageUrl = $simple_product->getThumbnailUrl();
42
+ }
43
+ }
44
+ } else {
45
+ $imageUrl = $product->getThumbnailUrl();
46
+ }
47
+ return $imageUrl;
48
+ }
49
+
50
+ }
app/code/community/Web4pro/Abandonedcart/Helper/Data.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+
13
+ class Web4pro_Abandonedcart_Helper_Data extends Mage_Core_Helper_Abstract
14
+ {
15
+ /**
16
+ * @return array
17
+ */
18
+ public function getDatePeriods()
19
+ {
20
+ return array(
21
+ '24h' => $this->__('Last 24 Hours'),
22
+ '7d' => $this->__('Last 7 Days'),
23
+ '30d' => $this->__('Last 30 Days'),
24
+ '60d' => $this->__('Last 60 Days'),
25
+ '90d' => $this->__('Last 90 Days'),
26
+ 'lifetime' => $this->__('Lifetime'),
27
+ );
28
+ }
29
+
30
+ /**
31
+ * @param $message
32
+ * @param string $filename
33
+ */
34
+ public function log($message, $filename = 'Web4pro_Abandonedcart.log')
35
+ {
36
+ if(Mage::getStoreConfig(Web4pro_AbandonedCart_Model_Config::LOG)) {
37
+ Mage::log($message, null, $filename);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * @param $mailType
43
+ * @param $mail
44
+ * @param $name
45
+ * @param $couponCode
46
+ * @param $storeId
47
+ */
48
+ public function saveMail($mailType,$mail,$name,$couponCode,$storeId)
49
+ {
50
+ if(!empty($couponCode)) {
51
+ $coupon = Mage::getModel('salesrule/coupon')->load($couponCode, 'code');
52
+ $rule = Mage::getModel('salesrule/rule')->load($coupon->getRuleId());
53
+ $couponAmount = $rule->getDiscountAmount();
54
+ switch($rule->getSimpleAction()) {
55
+ case 'cart_fixed':
56
+ $couponType = 1;
57
+ break;
58
+ case 'by_percent':
59
+ $couponType = 2;
60
+ break;
61
+ }
62
+ }
63
+ else {
64
+ $couponType = 0;
65
+ $couponAmount = 0;
66
+ }
67
+ $sent = Mage::getModel('web4pro_abandonedcart/mailssent');
68
+ $sent->setMailType($mailType)
69
+ ->setStoreId($storeId)
70
+ ->setCustomerEmail($mail)
71
+ ->setCustomerName($name);
72
+ if(!empty($couponCode)){
73
+ $sent->setCouponNumber($couponCode);
74
+ }
75
+ if(!empty($couponType)){
76
+ $sent->setCouponType($couponType);
77
+ }
78
+
79
+ if(!empty($couponAmount)){
80
+ $sent->setCouponAmount($couponAmount);
81
+ }
82
+
83
+ $sent->setSentAt(Mage::getModel('core/date')->gmtDate())->save();
84
+ }
85
+
86
+ }
app/code/community/Web4pro/Abandonedcart/Model/Config.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_AbandonedCart_Model_Config
13
+ {
14
+ const ACTIVE = "web4pro_abandonedcart/general/active";
15
+ const FIRST_EMAIL_TEMPLATE_XML_PATH = 'web4pro_abandonedcart/general/template1';
16
+ const SECOND_EMAIL_TEMPLATE_XML_PATH = 'web4pro_abandonedcart/general/template2';
17
+ const THIRD_EMAIL_TEMPLATE_XML_PATH = 'web4pro_abandonedcart/general/template3';
18
+ const EMAIL_TEMPLATE_XML_PATH_W_COUPON = 'web4pro_abandonedcart/general/coupon_template';
19
+ const DAYS_1 = "web4pro_abandonedcart/general/days1";
20
+ const DAYS_2 = "web4pro_abandonedcart/general/days2";
21
+ const DAYS_3 = "web4pro_abandonedcart/general/days3";
22
+ const DAYS_4 = "web4pro_abandonedcart/general/days4";
23
+ const DAYS_5 = "web4pro_abandonedcart/general/days5";
24
+ const UNIT = "web4pro_abandonedcart/general/unit";
25
+ const SENDER = "web4pro_abandonedcart/general/identity";
26
+ const MAXTIMES = "web4pro_abandonedcart/general/max";
27
+ const MAXTIMES_NUM = 3;
28
+ const CUSTOMER_GROUPS = "web4pro_abandonedcart/general/customer";
29
+ const FIRST_SUBJECT = "web4pro_abandonedcart/general/subject1";
30
+ const SECOND_SUBJECT = "web4pro_abandonedcart/general/subject2";
31
+ const THIRD_SUBJECT = "web4pro_abandonedcart/general/subject3";
32
+ const FOURTH_SUBJECT = "web4pro_abandonedcart/general/subject4";
33
+ const FIFTH_SUBJECT = "web4pro_abandonedcart/general/subject5";
34
+ const LOG = "web4pro_abandonedcart/general/log";
35
+ const AUTOLOGIN = "web4pro_abandonedcart/general/autologin";
36
+ const ABANDONED_TAGS = '';
37
+ const IN_DAYS = 0;
38
+ const IN_HOURS = 1;
39
+ const PAGE = 'web4pro_abandonedcart/general/page';
40
+
41
+
42
+ const COUPON_DAYS = "web4pro_abandonedcart/coupon/sendon";
43
+ const SEND_COUPON = "web4pro_abandonedcart/coupon/create";
44
+ const FIRST_DATE = "web4pro_abandonedcart/general/firstdate";
45
+ const COUPON_AMOUNT = "web4pro_abandonedcart/coupon/discount";
46
+ const COUPON_AUTOMATIC = "web4pro_abandonedcart/coupon/automatic";
47
+ const COUPON_CODE = "web4pro_abandonedcart/coupon/couponcode";
48
+ const COUPON_EXPIRE = "web4pro_abandonedcart/coupon/expire";
49
+ const COUPON_TYPE = "web4pro_abandonedcart/coupon/discounttype";
50
+ const COUPON_LENGTH = "web4pro_abandonedcart/coupon/length";
51
+ const COUPON_LABEL = "web4pro_abandonedcart/coupon/couponlabel";
52
+
53
+
54
+ const ENABLE_POPUP = 'web4pro_abandonedcart/emailcatcher/popup_general';
55
+ const POPUP_HEADING = 'web4pro_abandonedcart/emailcatcher/popup_heading';
56
+ const POPUP_TEXT = 'web4pro_abandonedcart/emailcatcher/popup_text';
57
+ const POPUP_WIDTH = 'web4pro_abandonedcart/emailcatcher/popup_width';
58
+ const POPUP_SUBSCRIPTION = 'web4pro_abandonedcart/emailcatcher/popup_subscription';
59
+ const POPUP_CAN_CANCEL = 'web4pro_abandonedcart/emailcatcher/popup_cancel';
60
+ const POPUP_COOKIE_TIME = 'web4pro_abandonedcart/emailcatcher/popup_cookie_time';
61
+ const POPUP_INSIST = 'web4pro_abandonedcart/emailcatcher/popup_insist';
62
+ const POPUP_CREATE_COUPON = 'web4pro_abandonedcart/emailcatcher/popup_coupon';
63
+ const POPUP_COUPON_MANDRILL_TAG = 'web4pro_abandonedcart/emailcatcher/popup_coupon_mandrill_tag';
64
+ const POPUP_COUPON_MAIL_SUBJECT = 'web4pro_abandonedcart/emailcatcher/popup_coupon_mail_subject';
65
+ const POPUP_COUPON_TEMPLATE_XML_PATH = 'web4pro_abandonedcart/emailcatcher/popup_coupon_template';
66
+ const POPUP_COUPON_AUTOMATIC = 'web4pro_abandonedcart/emailcatcher/popup_automatic';
67
+ const POPUP_COUPON_CODE = 'web4pro_abandonedcart/emailcatcher/popup_coupon_code';
68
+ const POPUP_COUPON_EXPIRE = 'web4pro_abandonedcart/emailcatcher/popup_expire';
69
+ const POPUP_COUPON_LENGTH = 'web4pro_abandonedcart/emailcatcher/popup_length';
70
+ const POPUP_COUPON_DISCOUNTTYPE = 'web4pro_abandonedcart/emailcatcher/popup_discounttype';
71
+ const POPUP_COUPON_DISCOUNT = 'web4pro_abandonedcart/emailcatcher/popup_discount';
72
+ const POPUP_COUPON_LABEL = 'web4pro_abandonedcart/emailcatcher/popup_couponlabel';
73
+
74
+ }
app/code/community/Web4pro/Abandonedcart/Model/Cron.php ADDED
@@ -0,0 +1,386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_AbandonedCart_Model_Cron
13
+ {
14
+ const EMAIL_TEMPLATE_XML_PATH = 'web4pro_abandonedcart/general/template';
15
+ const EMAIL_TEMPLATE_XML_PATH_W_COUPON = 'web4pro_abandonedcart/general/coupon_template';
16
+
17
+ /**
18
+ *
19
+ */
20
+ public function abandoned()
21
+ {
22
+ $allStores = Mage::app()->getStores();
23
+ foreach($allStores as $storeid => $val)
24
+ {
25
+ if(Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::ACTIVE,$storeid)) {
26
+ $this->_proccess($storeid);
27
+ }
28
+ }
29
+ }
30
+
31
+ public function cleanAbandonedCartExpiredCoupons(){
32
+ $allStores = Mage::app()->getStores();
33
+ foreach($allStores as $storeid => $val){
34
+ if(Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::ACTIVE,$storeid)) {
35
+ $this->_cleanCoupons($storeid);
36
+ }
37
+ }
38
+ }
39
+
40
+ /**
41
+ * @param $storeId
42
+ */
43
+ protected function _proccess($storeId)
44
+ {
45
+ Mage::unregister('_singleton/core/design_package' );
46
+ Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
47
+ Mage::getSingleton('core/design_package' )->setStore($storeId);
48
+
49
+ $adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
50
+ $days = array(
51
+ 0 => Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::DAYS_1, $storeId),
52
+ 1 => Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::DAYS_2, $storeId),
53
+ 2 => Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::DAYS_3, $storeId),
54
+ 3 => Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::DAYS_4, $storeId),
55
+ 4 => Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::DAYS_5, $storeId)
56
+ );
57
+ $maxtimes = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::MAXTIMES, $storeId)+1;
58
+ $sendcoupondays = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::COUPON_DAYS, $storeId);
59
+ $sendcoupon = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::SEND_COUPON, $storeId);
60
+ $firstdate = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::FIRST_DATE, $storeId);
61
+ $unit = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::UNIT, $storeId);
62
+ $customergroups = explode(",",Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::CUSTOMER_GROUPS, $storeId));
63
+
64
+ //coupon vars
65
+ $couponamount = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::COUPON_AMOUNT, $storeId);
66
+ $couponexpiredays = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::COUPON_EXPIRE, $storeId);
67
+ $coupontype = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::COUPON_TYPE, $storeId);
68
+ $couponlength = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::COUPON_LENGTH, $storeId);
69
+ $couponlabel = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::COUPON_LABEL, $storeId);
70
+
71
+ // iterates one time for each mail number
72
+ for($run=0;$run<$maxtimes;$run++){
73
+ if(!$days[$run]){
74
+ return;
75
+ }
76
+
77
+ // subtract days from latest run to get difference from the actual abandon date of the cart
78
+ $diff = $days[$run];
79
+ if($run == 1 && $unit == Web4pro_Abandonedcart_Model_Config::IN_HOURS){
80
+ $diff -= $days[0]/24;
81
+ }elseif($run != 0){
82
+ $diff -= $days[$run-1];
83
+ }
84
+
85
+ // set the top date of the carts to get
86
+ $expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($diff, 'DAY'));
87
+ if($run == 0 && $unit == Web4pro_Abandonedcart_Model_Config::IN_HOURS) {
88
+ $expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($diff, 'HOUR'));
89
+ }
90
+ $from = new Zend_Db_Expr($expr);
91
+
92
+ // get collection of abandoned carts with cart_counter == $run
93
+ $collection = Mage::getResourceModel('reports/quote_collection');
94
+ $collection->addFieldToFilter('items_count', array('neq' => '0'))
95
+ ->addFieldToFilter('main_table.is_active', '1')
96
+ ->addFieldToFilter('main_table.store_id',array('eq'=>$storeId))
97
+ ->addSubtotal($storeId)
98
+ ->setOrder('updated_at');
99
+
100
+ $collection->addFieldToFilter('main_table.converted_at', array(array('null'=>true)))
101
+ ->addFieldToFilter('main_table.updated_at', array('to' => $from,'from' => $firstdate))
102
+ ->addFieldToFilter('main_table.web4pro_abandonedcart_counter', array('eq' => $run));
103
+
104
+ $collection->addFieldToFilter('main_table.customer_email', array('neq' => ''));
105
+ if(count($customergroups)) {
106
+ $collection->addFieldToFilter('main_table.customer_group_id', array('in', $customergroups));
107
+ }
108
+
109
+ // for each cart of the current run
110
+ foreach($collection as $quote) {
111
+ foreach ($quote->getAllVisibleItems() as $item) {
112
+ $removeFromQuote = false;
113
+ $product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($item->getProductId());
114
+ if (!$product || $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED)
115
+ {
116
+ Mage::log('AbandonedCart; ' . $product->getSku() .' is no longer present or enabled; remove from quote ' . $quote->getId() . ' for email',null,'Web4pro_Abandonedcart.log');
117
+ $removeFromQuote = true;
118
+ }
119
+
120
+ if ($product->getTypeId() == 'configurable') {
121
+ $simpleProductId = Mage::getModel('catalog/product')->getIdBySku($item->getSku());
122
+ $simpleProduct = Mage::getModel('catalog/product')->load($simpleProductId);
123
+ $stock = $simpleProduct->getStockItem();
124
+ $stockQty = $stock->getQty();
125
+ } elseif ($product->getTypeId() == 'bundle') {
126
+ $options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());
127
+ $bundled_product = new Mage_Catalog_Model_Product();
128
+ $bundled_product->load($product->getId());
129
+ $selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(
130
+ $bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product
131
+ );
132
+ $stockQty = -1;
133
+ foreach ($selectionCollection as $option) {
134
+ foreach ($options['bundle_options'] as $bundle) {
135
+ if ($bundle['value'][0]['title'] == $option->getName()) {
136
+ $label = $bundle['label'];
137
+ $qty = $bundle['value'][0]['qty'];
138
+ if ($stockQty == -1 || $stockQty > $qty) {
139
+ $stockQty = $qty;
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ } else {
146
+ $stock = $product->getStockItem();
147
+ $stockQty = $stock->getQty();
148
+ }
149
+
150
+ if (
151
+ (
152
+ is_object($stock) && ($stock->getManageStock() ||
153
+ ($stock->getUseConfigManageStock() && Mage::getStoreConfig('cataloginventory/item_options/manage_stock', $quote->getStoreId())))
154
+ )
155
+ && $stockQty < $item->getQty())
156
+ {
157
+ Mage::log('AbandonedCart; ' . $product->getSku() .' is no longer in stock; remove from quote ' . $quote->getId() . ' for email',null,'Web4pro_Abandonedcart.log');
158
+ $removeFromQuote = true;
159
+ }
160
+ if ($removeFromQuote)
161
+ {
162
+ $quote->removeItem($item->getId());
163
+ }
164
+ }
165
+
166
+ if (count($quote->getAllVisibleItems()) < 1) {
167
+ $quote2 = Mage::getModel('sales/quote')->loadByIdWithoutStore($quote->getId());
168
+ $quote2->setWeb4proAbandonedcartCounter($quote2->getWeb4proAbandonedcartCounter() + 1);
169
+ $quote2->save();
170
+ continue;
171
+ }
172
+ // check if they are any order from the customer with date >=
173
+ $collection2 = Mage::getResourceModel('reports/quote_collection');
174
+ $collection2->addFieldToFilter('main_table.is_active', '0')
175
+ ->addFieldToFilter('main_table.reserved_order_id', array('neq' => 'NULL'))
176
+ ->addFieldToFilter('main_table.customer_email', array('eq' => $quote->getCustomerEmail()))
177
+ ->addFieldToFilter('main_table.updated_at', array('from' => $quote->getUpdatedAt()));
178
+ if ($collection2->getSize()) {
179
+ continue;
180
+ }
181
+
182
+ $token = md5(rand(0,9999999));
183
+ $url = Mage::getModel('core/url')->setStore($storeId)->getUrl('',array('_nosid'=>true)).'web4pro_abandonedcart/abandoned/loadquote?id='.$quote->getEntityId().'&token='.$token;
184
+
185
+ $data = array('AbandonedURL'=>$url, 'AbandonedDate' => $quote->getUpdatedAt());
186
+
187
+ // send email
188
+ $senderid = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::SENDER, $storeId);
189
+ $sender = array('name'=>Mage::getStoreConfig("trans_email/ident_$senderid/name",$storeId), 'email'=> Mage::getStoreConfig("trans_email/ident_$senderid/email",$storeId));
190
+
191
+ $email = $quote->getCustomerEmail();
192
+
193
+ $name = $quote->getCustomerFirstname() . ' ' . $quote->getCustomerLastname();
194
+ $quote2 = Mage::getModel('sales/quote')->loadByIdWithoutStore($quote->getId());
195
+ //unsibscribe functionality for future improvement
196
+ //$unsubscribeUrl = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'web4pro/autoresponder/unsubscribe?list=abandonedcart&email=' . $email . '&store=' . $storeId;
197
+ //$couponcode = '';
198
+ $unsubscribeUrl = '';
199
+
200
+ //if hour is set for first run calculates hours since cart was created else calculates days
201
+ $today = idate('U', strtotime(now()));
202
+ $updatedAt = idate('U', strtotime($quote2->getUpdatedAt()));
203
+ $updatedAtDiff = ($today - $updatedAt) / 60 / 60 / 24;
204
+ if ($unit == Web4pro_Abandonedcart_Model_Config::IN_HOURS && $run == 0) {
205
+ $updatedAtDiff = ($today - $updatedAt) / 60 / 60;
206
+ }
207
+
208
+ // if days have passed proceed to send mail
209
+ if ($updatedAtDiff >= $diff) {
210
+
211
+ $mailsubject = $this->_getMailSubject($run, $storeId);
212
+ $templateId = $this->_getTemplateId($run, $storeId);
213
+ if ($sendcoupon && $run + 1 == $sendcoupondays) {
214
+ // create a new coupon
215
+ if (Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::COUPON_AUTOMATIC) == 2) {
216
+ list($couponcode, $discount, $toDate) = $this->_createNewCoupon($storeId, $email, $couponamount, $couponexpiredays, $coupontype, $couponlength, $couponlabel);
217
+ $url .= '&coupon='.$couponcode;
218
+ $vars = array('quote' => $quote, 'url' => $url, 'couponcode' => $couponcode, 'discount' => $discount,
219
+ 'todate' => $toDate, 'name' => $name, 'unsubscribeurl' => $unsubscribeUrl);
220
+ } else {
221
+ $couponcode = Mage::getStoreConfig(Web4pro_AbandonedCart_Model_Config::COUPON_CODE);
222
+ $url .= '&coupon='.$couponcode;
223
+ $vars = array('quote' => $quote, 'url' => $url, 'couponcode' => $couponcode, 'name' => $name, 'unsubscribeurl' => $unsubscribeUrl);
224
+ }
225
+ } else {
226
+
227
+ $couponcode = '';
228
+ $vars = array('quote' => $quote, 'url' => $url, 'unsubscribeurl' => $unsubscribeUrl);
229
+
230
+ }
231
+ Mage::app()->getTranslator()->init('frontend', true);
232
+ $translate = Mage::getSingleton('core/translate');
233
+ $mail = Mage::getModel('core/email_template')->setTemplateSubject($mailsubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
234
+ $translate->setTranslateInLine(true);
235
+ $quote2->setData('web4pro_abandonedcart_counter',$quote2->getData('web4pro_abandonedcart_counter') + 1);
236
+ $quote2->setData('web4pro_abandonedcart_token',$token);
237
+ $quote2->save();
238
+ Mage::helper('web4pro_abandonedcart')->saveMail('abandoned cart', $email, $name, $couponcode, $storeId);
239
+ }
240
+ }
241
+ }
242
+ }
243
+
244
+
245
+ /**
246
+ * @param $store
247
+ * @param $email
248
+ * @return array
249
+ */
250
+ protected function _createNewCoupon($store, $email, $couponamount, $couponexpiredays, $coupontype, $couponlength, $couponlabel)
251
+ {
252
+ $collection = Mage::getModel('salesrule/rule')->getCollection()
253
+ ->addFieldToFilter('name', array('like'=>'Abandoned coupon ' . $email));
254
+ if (!count($collection)) {
255
+
256
+ $websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId();
257
+
258
+ $fromDate = date("Y-m-d");
259
+ $toDate = date('Y-m-d', strtotime($fromDate . " + $couponexpiredays day"));
260
+ if ($coupontype == 1) {
261
+ $action = 'cart_fixed';
262
+ $discount = Mage::app()->getStore($store)->getCurrentCurrencyCode() . "$couponamount";
263
+ } elseif ($coupontype == 2) {
264
+ $action = 'by_percent';
265
+ $discount = "$couponamount%";
266
+ }
267
+ $customer_group = new Mage_Customer_Model_Group();
268
+ $allGroups = $customer_group->getCollection()->toOptionHash();
269
+ $groups = array();
270
+ foreach ($allGroups as $groupid => $name) {
271
+ $groups[] = $groupid;
272
+ }
273
+ $coupon_rule = Mage::getModel('salesrule/rule');
274
+ $coupon_rule->setName("Abandoned coupon $email")
275
+ ->setDescription("Abandoned coupon $email")
276
+ ->setStopRulesProcessing(0)
277
+ ->setFromDate($fromDate)
278
+ ->setToDate($toDate)
279
+ ->setIsActive(1)
280
+ ->setCouponType(2)
281
+ ->setUsesPerCoupon(1)
282
+ ->setUsesPerCustomer(1)
283
+ ->setCustomerGroupIds($groups)
284
+ ->setProductIds('')
285
+ ->setLengthMin($couponlength)
286
+ ->setLengthMax($couponlength)
287
+ ->setSortOrder(0)
288
+ ->setStoreLabels(array($couponlabel))
289
+ ->setSimpleAction($action)
290
+ ->setDiscountAmount($couponamount)
291
+ ->setDiscountQty(0)
292
+ ->setDiscountStep('0')
293
+ ->setSimpleFreeShipping('0')
294
+ ->setApplyToShipping('0')
295
+ ->setIsRss(0)
296
+ ->setWebsiteIds($websiteid);
297
+ $uniqueId = Mage::getSingleton('salesrule/coupon_codegenerator', array('length' => $couponlength))->generateCode();
298
+ $coupon_rule->setCouponCode($uniqueId);
299
+ $coupon_rule->save();
300
+ return array($uniqueId, $discount, $toDate);
301
+ }else{
302
+ $coupon = $collection->getFirstItem();
303
+ if ($coupon->getSimpleAction() == 'cart_fixed') {
304
+ $discount = Mage::app()->getStore($store)->getCurrentCurrencyCode() . ($coupon->getDiscountAmount()+0);
305
+ } else{
306
+ $discount = $coupon->getDiscountAmount()+0;
307
+ }
308
+ return array($coupon->getCode(), $discount, $coupon->getToDate());
309
+ }
310
+ }
311
+
312
+ /**
313
+ * @param $interval
314
+ * @param $unit
315
+ * @return string
316
+ */
317
+ function _getIntervalUnitSql($interval, $unit)
318
+ {
319
+ return sprintf('INTERVAL %d %s', $interval, $unit);
320
+ }
321
+
322
+
323
+
324
+ /**
325
+ * @param $currentCount
326
+ * @param $store
327
+ * @return mixed|null
328
+ */
329
+ protected function _getMailSubject($currentCount, $store){
330
+
331
+ $ret = NULL;
332
+ switch($currentCount){
333
+ case 0:
334
+ $ret = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::FIRST_SUBJECT, $store);
335
+ break;
336
+ case 1:
337
+ $ret = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::SECOND_SUBJECT, $store);
338
+ break;
339
+ case 2:
340
+ $ret = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::THIRD_SUBJECT, $store);
341
+ break;
342
+ case 3:
343
+ $ret = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::FOURTH_SUBJECT, $store);
344
+ break;
345
+ case 4:
346
+ $ret = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::FIFTH_SUBJECT, $store);
347
+ break;
348
+ }
349
+ return $ret;
350
+
351
+ }
352
+
353
+ /**
354
+ * @param $currentCount
355
+ * @return mixed
356
+ */
357
+ protected function _getTemplateId($currentCount, $store){
358
+
359
+ $ret = NULL;
360
+ switch($currentCount){
361
+ case 0:
362
+ $ret = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::FIRST_EMAIL_TEMPLATE_XML_PATH, $store);
363
+ break;
364
+ case 1:
365
+ $ret = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::SECOND_EMAIL_TEMPLATE_XML_PATH, $store);
366
+ break;
367
+ case 2:
368
+ $ret = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::THIRD_EMAIL_TEMPLATE_XML_PATH, $store);
369
+ break;
370
+ }
371
+ return $ret;
372
+
373
+ }
374
+
375
+ protected function _cleanCoupons($store){
376
+ $today = date('Y-m-d');
377
+ $collection = Mage::getModel('salesrule/rule')->getCollection()
378
+ ->addFieldToFilter('name', array('like'=>'Abandoned coupon%'))
379
+ ->addFieldToFilter('to_date', array('lt'=> $today));
380
+
381
+ foreach ($collection as $toDelete) {
382
+ $toDelete->delete();
383
+ }
384
+
385
+ }
386
+ }
app/code/community/Web4pro/Abandonedcart/Model/EventObserver.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_ModuleName
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Model_EventObserver
13
+ {
14
+ public function saveConfig(Varien_Event_Observer $observer)
15
+ {
16
+ if(Mage::app()->getRequest()->getParam('store')) {
17
+ $scope = 'store';
18
+ }
19
+ elseif(Mage::app()->getRequest()->getParam('website')) {
20
+ $scope = 'website';
21
+ }
22
+ else {
23
+ $scope = 'default';
24
+ }
25
+
26
+ $store = is_null($observer->getEvent()->getStore()) ? Mage::app()->getDefaultStoreView()->getCode(): $observer->getEvent()->getStore();
27
+
28
+ $config = new Mage_Core_Model_Config();
29
+ $config->saveConfig(Web4pro_Abandonedcart_Model_Config::ACTIVE,true,$scope,$store);
30
+ Mage::getConfig()->cleanCache();
31
+
32
+ }
33
+
34
+ public function loadCustomer(Varien_Event_Observer $observer){
35
+ $quote = $observer->getEvent()->getQuote();
36
+ if(!Mage::getSingleton('customer/session')->isLoggedIn()) {
37
+ $action = Mage::app()->getRequest()->getActionName();
38
+ $onCheckout = $action == 'saveOrder' || $action == 'savePayment' || $action == 'saveShippingMethod' || $action == 'saveBilling';
39
+ if (isset($_COOKIE['email']) && $_COOKIE['email'] != 'none' && !$onCheckout) {
40
+ $email = str_replace(' ', '+', $_COOKIE['email']);
41
+ if($quote->getCustomerEmail() != $email){
42
+ $quote->setCustomerEmail($email)
43
+ ->save();
44
+ }
45
+ }
46
+ }
47
+ return $observer;
48
+ }
49
+
50
+ public function saveAbandonedCartFlagToOrder(Varien_Event_Observer $observer){
51
+ $order = $observer->getEvent()->getOrder();
52
+ $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
53
+ $flag = $quote->getData('web4pro_abandonedcart_flag');
54
+ $counter = $quote->getData('web4pro_abandonedcart_counter');
55
+ if($order->getData('web4pro_abandonedcart_flag')){
56
+ $order->setData('web4pro_abandonedcart_flag',$flag);
57
+ $order->setData('web4pro_abandonedcart_counter',$counter);
58
+ $order->save();
59
+ }
60
+ return $observer;
61
+ }
62
+ }
app/code/community/Web4pro/Abandonedcart/Model/Mailssent.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_ModuleName
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Model_Mailssent extends Mage_Core_Model_Abstract
13
+ {
14
+ public function _construct() {
15
+ $this->_init('web4pro_abandonedcart/mailssent','id');
16
+ }
17
+
18
+ }
app/code/community/Web4pro/Abandonedcart/Model/Resource/Mailssent.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Model_Resource_Mailssent extends Mage_Core_Model_Mysql4_Abstract
13
+ {
14
+ public function _construct()
15
+ {
16
+ $this->_init('web4pro_abandonedcart/mailssent','id');
17
+ }
18
+
19
+ }
app/code/community/Web4pro/Abandonedcart/Model/Resource/Mailssent/Collection.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Model_Resource_Mailssent_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
13
+ {
14
+ protected function _construct()
15
+ {
16
+ $this->_init('web4pro_abandonedcart/mailssent');
17
+ }
18
+ }
app/code/community/Web4pro/Abandonedcart/Model/Resource/Order/Collection.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Model_Resource_Order_Collection extends Mage_Reports_Model_Mysql4_Order_Collection
13
+ {
14
+ public function isLive()
15
+ {
16
+ return true;
17
+ }
18
+
19
+ /**
20
+ * @param string $period
21
+ * @return Web4pro_Abandonedcart_Model_Resource_Order_Collection|Mage_Reports_Model_Resource_Order_Collection
22
+ */
23
+ public function addCreateAtPeriodFilter($period)
24
+ {
25
+ list($from, $to) = $this->getDateRange($period, 0, 0, true);
26
+
27
+ $this->checkIsLive($period);
28
+
29
+ if ($this->isLive()) {
30
+ $fieldToFilter = 'main_table.created_at';
31
+ } else {
32
+ $fieldToFilter = 'period';
33
+ }
34
+
35
+ $this->addFieldToFilter($fieldToFilter, array(
36
+ 'from' => $from->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
37
+ 'to' => $to->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
38
+ ));
39
+
40
+ return $this;
41
+ }
42
+
43
+ /**
44
+ * @param int $isFilter
45
+ * @return Web4pro_Abandonedcart_Model_Resource_Order_Collection|Mage_Reports_Model_Resource_Order_Collection
46
+ */
47
+ public function calculateSales($isFilter = 0)
48
+ {
49
+ $statuses = Mage::getSingleton('sales/config')
50
+ ->getOrderStatusesForState(Mage_Sales_Model_Order::STATE_CANCELED);
51
+
52
+ if (empty($statuses)) {
53
+ $statuses = array(0);
54
+ }
55
+ $adapter = $this->getConnection();
56
+
57
+ if (Mage::getStoreConfig('sales/dashboard/use_aggregated_data')==8) {
58
+ $this->setMainTable('sales/order_aggregated_created');
59
+ $this->removeAllFieldsFromSelect();
60
+ $averageExpr = $adapter->getCheckSql(
61
+ 'SUM(main_table.orders_count) > 0',
62
+ 'SUM(main_table.total_revenue_amount)/SUM(main_table.orders_count)',
63
+ 0);
64
+ $this->getSelect()->columns(array(
65
+ 'lifetime' => 'SUM(main_table.total_revenue_amount)',
66
+ 'average' => $averageExpr
67
+ ));
68
+
69
+ if (!$isFilter) {
70
+ $this->addFieldToFilter('main_table.store_id',
71
+ array('eq' => Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->getId())
72
+ );
73
+ }
74
+ $this->getSelect()->where('main_table.order_status NOT IN(?)', $statuses);
75
+ } else {
76
+ $this->setMainTable('sales/order');
77
+ $this->removeAllFieldsFromSelect();
78
+ if(version_compare(Mage::getVersion(), '1.6.0.0')==1) {
79
+ $expr = 'IFNULL(main_table.base_subtotal, 0) - IFNULL(main_table.base_subtotal_refunded, 0)'
80
+ . ' - IFNULL(main_table.base_subtotal_canceled, 0) - ABS(IFNULL(main_table.base_discount_amount, 0))'
81
+ . ' + IFNULL(main_table.base_discount_refunded, 0)';
82
+ }
83
+ else if(version_compare(Mage::getVersion(), '1.6.0.0', '<')) {
84
+ $expr = sprintf('%s - %s - %s - (%s - %s - %s)',
85
+ "IFNULL('main_table.base_total_invoiced', 0)",
86
+ "IFNULL('main_table.base_tax_invoiced', 0)",
87
+ "IFNULL('main_table.base_shipping_invoiced', 0)",
88
+ "IFNULL('main_table.base_total_refunded', 0)",
89
+ "IFNULL('main_table.base_tax_refunded', 0)",
90
+ "IFNULL('main_table.base_shipping_refunded', 0)"
91
+ );
92
+ }
93
+ else {
94
+ $expr = sprintf('%s - %s - %s - (%s - %s - %s)',
95
+ $adapter->getIfNullSql('main_table.base_total_invoiced', 0),
96
+ $adapter->getIfNullSql('main_table.base_tax_invoiced', 0),
97
+ $adapter->getIfNullSql('main_table.base_shipping_invoiced', 0),
98
+ $adapter->getIfNullSql('main_table.base_total_refunded', 0),
99
+ $adapter->getIfNullSql('main_table.base_tax_refunded', 0),
100
+ $adapter->getIfNullSql('main_table.base_shipping_refunded', 0)
101
+ );
102
+ }
103
+
104
+ if ($isFilter == 0) {
105
+ $expr = '(' . $expr . ') * main_table.base_to_global_rate';
106
+ }
107
+
108
+ $this->getSelect()
109
+ ->columns(array(
110
+ 'lifetime' => "SUM({$expr})",
111
+ 'average' => "AVG({$expr})"
112
+ ))
113
+ ->where('main_table.status NOT IN(?)', $statuses)
114
+ ->where('main_table.state NOT IN(?)', array(
115
+ Mage_Sales_Model_Order::STATE_NEW,
116
+ Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)
117
+ );
118
+ }
119
+ return $this;
120
+ }
121
+
122
+ /**
123
+ * @param string $range
124
+ * @param string $customStart
125
+ * @param string $customEnd
126
+ * @param bool $returnObjects
127
+ * @return array
128
+ */
129
+ public function getDateRange($range, $customStart, $customEnd, $returnObjects = false)
130
+ {
131
+ $dateEnd = Mage::app()->getLocale()->date();
132
+ $dateStart = clone $dateEnd;
133
+
134
+ // go to the end of a day
135
+ $dateEnd->setHour(23);
136
+ $dateEnd->setMinute(59);
137
+ $dateEnd->setSecond(59);
138
+
139
+ $dateStart->setHour(0);
140
+ $dateStart->setMinute(0);
141
+ $dateStart->setSecond(0);
142
+
143
+ switch ($range)
144
+ {
145
+ case '24h':
146
+ $dateEnd = Mage::app()->getLocale()->date();
147
+ $dateEnd->addHour(1);
148
+ $dateStart = clone $dateEnd;
149
+ $dateStart->subDay(1);
150
+ break;
151
+
152
+ case '7d':
153
+ // substract 6 days we need to include
154
+ // only today and not the last one from range
155
+ $dateStart->subDay(6);
156
+ break;
157
+ case '30d':
158
+ $dateEnd = Mage::app()->getLocale()->date();
159
+ $dateEnd->addHour(1);
160
+ $dateStart = clone $dateEnd;
161
+ $dateStart->subMonth(1);
162
+ break;
163
+ case '60d':
164
+ $dateEnd = Mage::app()->getLocale()->date();
165
+ $dateEnd->addHour(1);
166
+ $dateStart = clone $dateEnd;
167
+ $dateStart->subMonth(2);
168
+ break;
169
+ case '90d':
170
+ $dateEnd = Mage::app()->getLocale()->date();
171
+ $dateEnd->addHour(1);
172
+ $dateStart = clone $dateEnd;
173
+ $dateStart->subMonth(3);
174
+ break;
175
+
176
+ case '1m':
177
+ $dateStart->setDay(Mage::getStoreConfig('reports/dashboard/mtd_start'));
178
+ break;
179
+ case 'custom':
180
+ $dateStart = $customStart ? $customStart : $dateEnd;
181
+ $dateEnd = $customEnd ? $customEnd : $dateEnd;
182
+ break;
183
+
184
+ case '1y':
185
+ case '2y':
186
+ case 'lifetime':
187
+ $startMonthDay = explode(',', Mage::getStoreConfig('reports/dashboard/ytd_start'));
188
+ $startMonth = isset($startMonthDay[0]) ? (int)$startMonthDay[0] : 1;
189
+ $startDay = isset($startMonthDay[1]) ? (int)$startMonthDay[1] : 1;
190
+ $dateStart->setMonth($startMonth);
191
+ $dateStart->setDay($startDay);
192
+ if ($range == '2y') {
193
+ $dateStart->subYear(1);
194
+ }
195
+ elseif($range == 'lifetime') {
196
+ $dateStart->subYear(1000);
197
+ }
198
+ break;
199
+ }
200
+
201
+ $dateStart->setTimezone('Etc/UTC');
202
+ $dateEnd->setTimezone('Etc/UTC');
203
+
204
+ if ($returnObjects) {
205
+ return array($dateStart, $dateEnd);
206
+ } else {
207
+ return array('from' => $dateStart, 'to' => $dateEnd, 'datetime' => true);
208
+ }
209
+ }
210
+
211
+ }
app/code/community/Web4pro/Abandonedcart/Model/System/Config/Automatic.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Model_System_Config_Automatic
13
+ {
14
+ /**
15
+ * @return array
16
+ */
17
+ public function toOptionArray()
18
+ {
19
+ $options = array(
20
+ array('value'=> 1, 'label' => Mage::helper('web4pro_abandonedcart')->__('Specific')),
21
+ array('value'=> 2, 'label' => Mage::helper('web4pro_abandonedcart')->__('Automatic'))
22
+ );
23
+ return $options;
24
+ }
25
+ }
app/code/community/Web4pro/Abandonedcart/Model/System/Config/Cmspage.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+
13
+ class Web4pro_Abandonedcart_Model_System_Config_Cmspage
14
+ {
15
+
16
+ public function toOptionArray()
17
+ {
18
+ $collection = Mage::getModel('cms/page')->getCollection()->addOrder('title', 'asc');
19
+ return array('checkout/cart'=> "Shopping Cart page") + $collection->toOptionIdArray();
20
+ }
21
+
22
+ }
app/code/community/Web4pro/Abandonedcart/Model/System/Config/Customergroup.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Model_System_Config_Customergroup
13
+ {
14
+ protected $_options;
15
+
16
+ public function toOptionArray()
17
+ {
18
+ if (!$this->_options) {
19
+ $this->_options = Mage::getResourceModel('customer/group_collection')
20
+ ->loadData()->toOptionArray();
21
+ }
22
+ return $this->_options;
23
+ }
24
+ }
app/code/community/Web4pro/Abandonedcart/Model/System/Config/Discounttype.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Model_System_Config_Discounttype
13
+ {
14
+ /**
15
+ * @return array
16
+ */
17
+ public function toOptionArray()
18
+ {
19
+ $options = array(
20
+ array('value'=> 1, 'label' => Mage::helper('web4pro_abandonedcart')->__('Fixed amount')),
21
+ array('value'=> 2, 'label' => Mage::helper('web4pro_abandonedcart')->__('Percentage'))
22
+ );
23
+ return $options;
24
+ }
25
+ public function options()
26
+ {
27
+ $options[1] = Mage::helper('web4pro_abandonedcart')->__('Fixed amount');
28
+ $options[2] = Mage::helper('web4pro_abandonedcart')->__('Percentage');
29
+ return $options;
30
+ }
31
+ }
app/code/community/Web4pro/Abandonedcart/Model/System/Config/Maxemails.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Model_System_Config_Maxemails
13
+ {
14
+ public function toOptionArray()
15
+ {
16
+ $options = array();
17
+ for($i = 0; $i < Web4pro_Abandonedcart_Model_Config::MAXTIMES_NUM; $i++){
18
+ $options[]=array('value'=> $i, 'label' => $i+1);
19
+ }
20
+ return $options;
21
+ }
22
+ }
app/code/community/Web4pro/Abandonedcart/Model/System/Config/Unit.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+
13
+ class Web4pro_Abandonedcart_Model_System_Config_Unit
14
+ {
15
+ public function toOptionArray()
16
+ {
17
+ $options = array(
18
+ array('value'=> Web4pro_Abandonedcart_Model_Config::IN_DAYS, 'label' => Mage::helper('web4pro_abandonedcart')->__('Days')),
19
+ array('value'=> Web4pro_Abandonedcart_Model_Config::IN_HOURS, 'label' => Mage::helper('web4pro_abandonedcart')->__('Hour(s)'))
20
+ );
21
+ return $options;
22
+ }
23
+
24
+ }
app/code/community/Web4pro/Abandonedcart/controllers/AbandonedController.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+
13
+ require_once Mage::getModuleDir('controllers','Mage_Checkout').DS.'CartController.php';
14
+
15
+ class Web4pro_Abandonedcart_AbandonedController extends Mage_Checkout_CartController
16
+ {
17
+
18
+ public function loadquoteAction()
19
+ {
20
+ $params = $this->getRequest()->getParams();
21
+ if(isset($params['id']))
22
+ {
23
+ //get quote
24
+ $quote = Mage::getModel('sales/quote')->load($params['id']);
25
+ //url redirect to
26
+ $url = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::PAGE,$quote->getStoreId());
27
+ if(isset($params['coupon'])){
28
+ $quote->setCouponCode($params['coupon']);
29
+ $quote->save();
30
+ }
31
+ if((!isset($params['token']) || (isset($params['token'])&&$params['token']!=$quote->getData('web4pro_abandonedcart_token'))) && Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::AUTOLOGIN, $quote->getStoreId())) {
32
+ Mage::getSingleton('customer/session')->addNotice($this->__("Your abandoned cart token is not valid or incorrect"));
33
+ $this->_redirect($url);
34
+ }
35
+ else {
36
+ $url = Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::PAGE,$quote->getStoreId());
37
+ $quote->setData('web4pro_abandonedcart_flag',1);
38
+ $quote->save();
39
+ if(!$quote->getCustomerId()) {
40
+ $this->_getSession()->setQuoteId($quote->getId());
41
+ $this->_redirect($url);
42
+ }
43
+ else {
44
+ if(Mage::getStoreConfig(Web4pro_Abandonedcart_Model_Config::AUTOLOGIN,$quote->getStoreId())) {
45
+ $customer = Mage::getModel('customer/customer')->load($quote->getCustomerId());
46
+ if($customer->getId())
47
+ {
48
+ Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
49
+ }
50
+ $this->_redirect($url);
51
+ }
52
+ else {
53
+ if(Mage::helper('customer')->isLoggedIn()) {
54
+ $this->_redirect($url);
55
+ }
56
+ else {
57
+ Mage::getSingleton('customer/session')->addNotice($this->__("Please, login to complete your order"));
58
+ $this->_redirect('customer/account');
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
app/code/community/Web4pro/Abandonedcart/controllers/Adminhtml/AbandonedmailsController.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+
13
+ class Web4pro_Abandonedcart_Adminhtml_AbandonedmailsController extends Mage_Adminhtml_Controller_Action
14
+ {
15
+
16
+ public function indexAction()
17
+ {
18
+ $this->_initAction()
19
+ ->renderLayout();
20
+ }
21
+
22
+
23
+ protected function _initAction()
24
+ {
25
+ $this->loadLayout()
26
+ ->_setActiveMenu('newsletter/web4pro_emails')
27
+ ->_title($this->__('Newsletter'))->_title($this->__('Abandoned Cart Emails Sent'))
28
+ ->_addBreadcrumb($this->__('Newsletter'), $this->__('Newsletter'))
29
+ ->_addBreadcrumb($this->__('abandonedorder'), $this->__('Mails'));
30
+
31
+ return $this;
32
+ }
33
+
34
+ /**
35
+ * Export csv action
36
+ */
37
+ public function exportCsvAction()
38
+ {
39
+ $fileName = 'orders.csv';
40
+ $grid = $this->getLayout()->createBlock('web4pro_abandonedcart/adminhtml_abandonedmails_grid');
41
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
42
+ }
43
+
44
+ /**
45
+ * Export order grid to Excel XML format
46
+ */
47
+ public function exportExcelAction()
48
+ {
49
+ $fileName = 'orders.xml';
50
+ $grid = $this->getLayout()->createBlock('web4pro_abandonedcart/adminhtml_abandonedmails_grid');
51
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
52
+ }
53
+
54
+
55
+ public function gridAction()
56
+ {
57
+ $this->loadLayout(false);
58
+ $this->renderLayout();
59
+ }
60
+
61
+ }
app/code/community/Web4pro/Abandonedcart/controllers/Adminhtml/AbandonedorderController.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_Abandonedcart
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ class Web4pro_Abandonedcart_Adminhtml_AbandonedorderController extends Mage_Adminhtml_Controller_Action
13
+ {
14
+
15
+ public function indexAction()
16
+ {
17
+ $this->_initAction()
18
+ ->renderLayout();
19
+ }
20
+
21
+ protected function _initAction()
22
+ {
23
+ $this->loadLayout()
24
+ ->_setActiveMenu('sales/web4pro_abandonedcart')
25
+ ->_title($this->__('Sales'))->_title($this->__('Abandoned'))
26
+ ->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
27
+ ->_addBreadcrumb($this->__('abandonedorder'), $this->__('Abandoned'));
28
+
29
+ return $this;
30
+ }
31
+
32
+ public function exportCsvAction()
33
+ {
34
+ $fileName = 'orders.csv';
35
+ $grid = $this->getLayout()->createBlock('web4pro_abandonedcart/adminhtml_abandonedorder_grid');
36
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
37
+ }
38
+
39
+ /**
40
+ * Export order grid to Excel XML format
41
+ */
42
+ public function exportExcelAction()
43
+ {
44
+ $fileName = 'orders.xml';
45
+ $grid = $this->getLayout()->createBlock('web4pro_abandonedcart/adminhtml_abandonedorder_grid');
46
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
47
+ }
48
+
49
+ public function gridAction()
50
+ {
51
+ $this->loadLayout(false);
52
+ $this->renderLayout();
53
+ }
54
+
55
+ public function dashboardAction()
56
+ {
57
+ $this->loadLayout()
58
+ ->_setActiveMenu('dashboard/web4pro_abandonedcart')
59
+ ->_title($this->__('Dashboard'))->_title($this->__('Abandoned'))
60
+ ->_addBreadcrumb($this->__('Dashboard'), $this->__('Dashboard'))
61
+ ->_addBreadcrumb($this->__('abandonedorder'), $this->__('Abandoned'))
62
+ ->renderLayout();
63
+
64
+ }
65
+
66
+ public function ajaxBlockAction()
67
+ {
68
+ $output = '';
69
+ $blockTab = $this->getRequest()->getParam('block');
70
+ if ($blockTab =='totals') {
71
+ $output = $this->getLayout()->createBlock('web4pro_abandonedcart/adminhtml_dashboard_' . $blockTab)->toHtml();
72
+ }
73
+ $this->getResponse()->setBody($output);
74
+ return;
75
+ }
76
+ }
app/code/community/Web4pro/Abandonedcart/etc/adminhtml.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <menu>
4
+ <sales>
5
+ <children>
6
+ <web4pro_abandonedcart translate="title" module="web4pro_abandonedcart">
7
+ <title>Orders from Abandoned Carts</title>
8
+ <sort_order>800</sort_order>
9
+ <action>adminhtml/abandonedorder/index</action>
10
+ </web4pro_abandonedcart>
11
+ </children>
12
+ </sales>
13
+ <newsletter>
14
+ <children>
15
+ <web4pro_emails translate="title" module="web4pro_abandonedcart">
16
+ <title>Emails Sent from Abandoned Cart</title>
17
+ <sort_order>810</sort_order>
18
+ <action>adminhtml/abandonedmails/index</action>
19
+ </web4pro_emails>
20
+ </children>
21
+ </newsletter>
22
+ </menu>
23
+ <acl>
24
+ <resources>
25
+ <admin>
26
+ <children>
27
+ <sales>
28
+ <children>
29
+ <web4pro_abandonedcart translate="title" module="web4pro_abandonedcart">
30
+ <title>Orders from Abandoned Carts</title>
31
+ </web4pro_abandonedcart>
32
+ </children>
33
+ </sales>
34
+ <newsletter>
35
+ <children>
36
+ <web4pro_emails translate="title" module="web4pro_abandonedcart">
37
+ <title>Emails Sent from Abandoned Cart</title>
38
+ </web4pro_emails>
39
+ </children>
40
+ </newsletter>
41
+ <system>
42
+ <children>
43
+ <config>
44
+ <children>
45
+ <web4proall module="web4proall">
46
+ <title>Web4proAll Section</title>
47
+ </web4proall>
48
+ <web4pro_abandonedcart translate="title" module="web4pro_abandonedcart">
49
+ <title>Web4pro Abandoned Cart</title>
50
+ </web4pro_abandonedcart>
51
+ <web4pro_emails translate="title" module="web4pro_abandonedcart">
52
+ <title>Web4pro Emails</title>
53
+ </web4pro_emails>
54
+ </children>
55
+ </config>
56
+ </children>
57
+ </system>
58
+ </children>
59
+ </admin>
60
+ </resources>
61
+ </acl>
62
+ <translate>
63
+ <modules>
64
+ <Web4pro_Abandonedcart>
65
+ <files>
66
+ <default>Web4pro_Abandonedcart.csv</default>
67
+ </files>
68
+ </Web4pro_Abandonedcart>
69
+ </modules>
70
+ </translate>
71
+ </config>
app/code/community/Web4pro/Abandonedcart/etc/config.xml ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Web4pro_Abandonedcart>
5
+ <version>1.0.0</version>
6
+ </Web4pro_Abandonedcart>
7
+ </modules>
8
+ <global>
9
+ <template>
10
+ <email>
11
+ <web4pro_abandonedcart_general_template1 translate="label" module="web4pro_abandonedcart">
12
+ <label>First Abandoned Cart Mail</label>
13
+ <file>web4pro/abandonedcart/cart_mail_1.html</file>
14
+ <type>html</type>
15
+ </web4pro_abandonedcart_general_template1>
16
+ <web4pro_abandonedcart_general_template2 translate="label" module="web4pro_abandonedcart">
17
+ <label>Second Abandoned Cart Mail</label>
18
+ <file>web4pro/abandonedcart/cart_mail_2.html</file>
19
+ <type>html</type>
20
+ </web4pro_abandonedcart_general_template2>
21
+ <web4pro_abandonedcart_general_template3 translate="label" module="web4pro_abandonedcart">
22
+ <label>Third Abandoned Cart Mail</label>
23
+ <file>web4pro/abandonedcart/cart_mail_3.html</file>
24
+ <type>html</type>
25
+ </web4pro_abandonedcart_general_template3>
26
+ <web4pro_abandonedcart_general_template4 translate="label" module="web4pro_abandonedcart">
27
+ <label>Fourth Abandoned Cart Mail</label>
28
+ <file>web4pro/abandonedcart/cart_mail_generic.html</file>
29
+ <type>html</type>
30
+ </web4pro_abandonedcart_general_template4>
31
+ <web4pro_abandonedcart_general_template5 translate="label" module="web4pro_abandonedcart">
32
+ <label>Fifth Abandoned Cart Mail</label>
33
+ <file>web4pro/abandonedcart/cart_mail_generic.html</file>
34
+ <type>html</type>
35
+ </web4pro_abandonedcart_general_template5>
36
+ <web4pro_abandonedcart_emailcatcher_popup_coupon_template>
37
+ <label>Pop up Coupon Email</label>
38
+ <file>web4pro/abandonedcart/popup_coupon_template.html</file>
39
+ <type>html</type>
40
+ </web4pro_abandonedcart_emailcatcher_popup_coupon_template>
41
+ </email>
42
+ </template>
43
+ <blocks>
44
+ <web4pro_abandonedcart>
45
+ <class>Web4pro_Abandonedcart_Block</class>
46
+ </web4pro_abandonedcart>
47
+ </blocks>
48
+ <helpers>
49
+ <web4pro_abandonedcart>
50
+ <class>Web4pro_Abandonedcart_Helper</class>
51
+ </web4pro_abandonedcart>
52
+ </helpers>
53
+ <resources>
54
+ <web4proabandonedcart_setup>
55
+ <setup>
56
+ <module>Web4pro_Abandonedcart</module>
57
+ </setup>
58
+ <connection>
59
+ <use>core_setup</use>
60
+ </connection>
61
+ </web4proabandonedcart_setup>
62
+ </resources>
63
+ <models>
64
+ <web4pro_abandonedcart>
65
+ <class>Web4pro_Abandonedcart_Model</class>
66
+ <resourceModel>web4pro_abandonedcart_resource</resourceModel>
67
+ </web4pro_abandonedcart>
68
+ <web4pro_abandonedcart_resource>
69
+ <class>Web4pro_Abandonedcart_Model_Resource</class>
70
+ <deprecatedNode>web4pro_abandonedcart_mysql4</deprecatedNode>
71
+ <entities>
72
+ <mailssent>
73
+ <table>web4pro_mails_sent</table>
74
+ </mailssent>
75
+ <popup>
76
+ <table>web4pro_abandonedcart_popup</table>
77
+ </popup>
78
+ </entities>
79
+ </web4pro_abandonedcart_resource>
80
+ </models>
81
+ <fieldsets>
82
+ <sales_convert_quote>
83
+ <web4pro_abandonedcart_flag>
84
+ <to_order>*</to_order>
85
+ </web4pro_abandonedcart_flag>
86
+ </sales_convert_quote>
87
+ </fieldsets>
88
+ <events>
89
+ <sales_quote_save_after>
90
+ <observers>
91
+ <web4pro_abandoned_quote_init>
92
+ <class>web4pro_abandonedcart/eventObserver</class>
93
+ <method>loadCustomer</method>
94
+ </web4pro_abandoned_quote_init>
95
+ </observers>
96
+ </sales_quote_save_after>
97
+ <sales_order_place_after>
98
+ <observers>
99
+ <web4pro_abandoned_quote_convert>
100
+ <class>web4pro_abandonedcart/eventObserver</class>
101
+ <method>saveAbandonedCartFlagToOrder</method>
102
+ </web4pro_abandoned_quote_convert>
103
+ </observers>
104
+ </sales_order_place_after>
105
+ </events>
106
+ </global>
107
+ <admin>
108
+ <routers>
109
+ <adminhtml>
110
+ <args>
111
+ <modules>
112
+ <web4pro_abandonedcart before="Mage_Adminhtml">Web4pro_Abandonedcart_Adminhtml</web4pro_abandonedcart>
113
+ </modules>
114
+ </args>
115
+ </adminhtml>
116
+ </routers>
117
+ </admin>
118
+ <frontend>
119
+ <translate>
120
+ <modules>
121
+ <Web4pro_AbandonedCart>
122
+ <files>
123
+ <default>Web4pro_Abandonedcart.csv</default>
124
+ </files>
125
+ </Web4pro_AbandonedCart>
126
+ </modules>
127
+ </translate>
128
+ <routers>
129
+ <web4pro_abandonedcart>
130
+ <use>standard</use>
131
+ <args>
132
+ <module>Web4pro_Abandonedcart</module>
133
+ <frontName>web4pro_abandonedcart</frontName>
134
+ </args>
135
+ </web4pro_abandonedcart>
136
+ </routers>
137
+ <layout>
138
+ <updates>
139
+ <web4pro_abandonedcart>
140
+ <file>web4pro/abandonedcart.xml</file>
141
+ </web4pro_abandonedcart>
142
+ </updates>
143
+ </layout>
144
+ </frontend>
145
+ <adminhtml>
146
+ <translate>
147
+ <modules>
148
+ <Web4pro_AbandonedCart>
149
+ <files>
150
+ <default>Web4pro_Abandonedcart.csv</default>
151
+ </files>
152
+ </Web4pro_AbandonedCart>
153
+ </modules>
154
+ </translate>
155
+ <layout>
156
+ <updates>
157
+ <abandonedcart>
158
+ <file>abandonedcart.xml</file>
159
+ </abandonedcart>
160
+ </updates>
161
+ </layout>
162
+ <events>
163
+ <admin_system_config_changed_section_web4pro_abandonedcart>
164
+ <observers>
165
+ <web4pro_abandoned_save_config>
166
+ <class>web4pro_abandonedcart/eventObserver</class>
167
+ <method>saveConfig</method>
168
+ </web4pro_abandoned_save_config>
169
+ </observers>
170
+ </admin_system_config_changed_section_web4pro_abandonedcart>
171
+ </events>
172
+ </adminhtml>
173
+ <crontab>
174
+ <jobs>
175
+ <web4pro_abandonedcart>
176
+ <schedule>
177
+ <cron_expr>0 */1 * * *</cron_expr>
178
+ </schedule>
179
+ <run>
180
+ <model>web4pro_abandonedcart/cron::abandoned</model>
181
+ </run>
182
+ </web4pro_abandonedcart>
183
+ <web4pro_abandonedcart_clean_expiredcoupons>
184
+ <schedule><cron_expr>0 0 1 * *</cron_expr></schedule>
185
+ <run><model>web4pro_abandonedcart/cron::cleanCartExpiredCoupons</model></run>
186
+ </web4pro_abandonedcart_clean_expiredcoupons>
187
+ </jobs>
188
+ </crontab>
189
+ </config>
app/code/community/Web4pro/Abandonedcart/etc/system.xml ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <web4pro>
5
+ <label>Web4pro</label>
6
+ <sort_order>100</sort_order>
7
+ </web4pro>
8
+ </tabs>
9
+ <sections>
10
+ <web4pro_abandonedcart translate="label" module="web4pro_abandonedcart">
11
+ <label><![CDATA[Abandoned Cart]]></label>
12
+ <tab>web4pro</tab>
13
+ <sort_order>300</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <general translate="label comment">
19
+ <label>General</label>
20
+ <sort_order>1</sort_order>
21
+ <frontend_type>text</frontend_type>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <active translate="label">
27
+ <label>Enabled</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_yesno</source_model>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </active>
35
+ <log translate="label">
36
+ <label>Log activated</label>
37
+ <frontend_type>select</frontend_type>
38
+ <source_model>adminhtml/system_config_source_yesno</source_model>
39
+ <sort_order>11</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
+ <depends>
44
+ <active>1</active>
45
+ </depends>
46
+ </log>
47
+ <firstdate translate="label">
48
+ <label>First date</label>
49
+ <frontend_type>date</frontend_type>
50
+ <frontend_model>web4pro_abandonedcart/adminhtml_system_config_date</frontend_model>
51
+ <sort_order>12</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <comment><![CDATA[Carts will be ignored before this date!]]></comment>
56
+ <depends>
57
+ <active>1</active>
58
+ </depends>
59
+ </firstdate>
60
+ <identity translate="label">
61
+ <label>Sender</label>
62
+ <frontend_type>select</frontend_type>
63
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
64
+ <sort_order>15</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ <depends>
69
+ <active>1</active>
70
+ </depends>
71
+ </identity>
72
+ <page translate="label comment">
73
+ <label>Redirect page</label>
74
+ <frontend_type>select</frontend_type>
75
+ <config_path>web4pro_abandonedcart/general/page</config_path>
76
+ <source_model>web4pro_abandonedcart/system_config_cmspage</source_model>
77
+ <sort_order>26</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ <comment><![CDATA[Url to redirect the customer]]></comment>
82
+ <depends>
83
+ <active>1</active>
84
+ </depends>
85
+ </page>
86
+ <max translate="label comment">
87
+ <label>Max number of email to send</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>web4pro_abandonedcart/system_config_maxemails</source_model>
90
+ <sort_order>33</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ <can_be_empty>0</can_be_empty>
95
+ <comment><![CDATA[Number of emails to be send]]></comment>
96
+ <depends>
97
+ <active>1</active>
98
+ </depends>
99
+ </max>
100
+ <subject1 translate="label comment">
101
+ <label>First Email Subject</label>
102
+ <frontend_type>text</frontend_type>
103
+ <sort_order>35</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>1</show_in_store>
107
+ <can_be_empty>0</can_be_empty>
108
+ <comment><![CDATA[The subject for the first email abandoned cart]]></comment>
109
+ <depends>
110
+ <max separator=",">0,1,2,3,4</max>
111
+ <active>1</active>
112
+ </depends>
113
+ </subject1>
114
+ <template1 translate="label">
115
+ <label>First Email Template</label>
116
+ <frontend_type>select</frontend_type>
117
+ <config_path>web4pro_abandonedcart/general/template1</config_path>
118
+ <source_model>adminhtml/system_config_source_email_template</source_model>
119
+ <sort_order>36</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ <depends>
124
+ <max separator=",">0,1,2,3,4</max>
125
+ <active>1</active>
126
+ </depends>
127
+ </template1>
128
+ <days1 translate="label comment">
129
+ <label>Send email after</label>
130
+ <frontend_type>text</frontend_type>
131
+ <sort_order>37</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ <can_be_empty>0</can_be_empty>
136
+ <comment><![CDATA[This value depends of the next unit parameter]]></comment>
137
+ <depends>
138
+ <max separator=",">0,1,2,3,4</max>
139
+ <active>1</active>
140
+ </depends>
141
+ </days1>
142
+ <unit translate="label comment">
143
+ <label>Unit</label>
144
+ <frontend_type>select</frontend_type>
145
+ <source_model>web4pro_abandonedcart/system_config_unit</source_model>
146
+ <sort_order>38</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>1</show_in_store>
150
+ <can_be_empty>0</can_be_empty>
151
+ <comment><![CDATA[Enter the unit for considering in the first email]]></comment>
152
+ <depends>
153
+ <max separator=",">0,1,2,3,4</max>
154
+ <active>1</active>
155
+ </depends>
156
+ </unit>
157
+ <subject2 translate="label comment">
158
+ <label>Second Email Subject</label>
159
+ <frontend_type>text</frontend_type>
160
+ <sort_order>41</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>1</show_in_store>
164
+ <can_be_empty>0</can_be_empty>
165
+ <comment><![CDATA[The subject for the second email abandoned cart]]></comment>
166
+ <depends>
167
+ <max separator=",">1,2,3,4</max>
168
+ <active>1</active>
169
+ </depends>
170
+ </subject2>
171
+ <template2 translate="label">
172
+ <label>Second Email Template</label>
173
+ <frontend_type>select</frontend_type>
174
+ <config_path>web4pro_abandonedcart/general/template2</config_path>
175
+ <source_model>adminhtml/system_config_source_email_template</source_model>
176
+ <sort_order>42</sort_order>
177
+ <show_in_default>1</show_in_default>
178
+ <show_in_website>1</show_in_website>
179
+ <show_in_store>1</show_in_store>
180
+ <depends>
181
+ <max separator=",">1,2,3,4</max>
182
+ <active>1</active>
183
+ </depends>
184
+ </template2>
185
+ <days2 translate="label comment">
186
+ <label>Send email after</label>
187
+ <frontend_type>text</frontend_type>
188
+ <sort_order>43</sort_order>
189
+ <show_in_default>1</show_in_default>
190
+ <show_in_website>1</show_in_website>
191
+ <show_in_store>1</show_in_store>
192
+ <can_be_empty>0</can_be_empty>
193
+ <comment><![CDATA[This value is the days and is set since the moment cart was abandoned.]]></comment>
194
+ <depends>
195
+ <max separator=",">1,2,3,4</max>
196
+ <active>1</active>
197
+ </depends>
198
+ </days2>
199
+ <subject3 translate="label comment">
200
+ <label>Third Email Subject</label>
201
+ <frontend_type>text</frontend_type>
202
+ <sort_order>44</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>1</show_in_website>
205
+ <show_in_store>1</show_in_store>
206
+ <can_be_empty>0</can_be_empty>
207
+ <comment><![CDATA[The subject for the third email abandoned cart]]></comment>
208
+ <depends>
209
+ <max separator=",">2,3,4</max>
210
+ <active>1</active>
211
+ </depends>
212
+ </subject3>
213
+ <template3 translate="label">
214
+ <label>Third Email Template</label>
215
+ <frontend_type>select</frontend_type>
216
+ <config_path>web4pro_abandonedcart/general/template3</config_path>
217
+ <source_model>adminhtml/system_config_source_email_template</source_model>
218
+ <sort_order>45</sort_order>
219
+ <show_in_default>1</show_in_default>
220
+ <show_in_website>1</show_in_website>
221
+ <show_in_store>1</show_in_store>
222
+ <depends>
223
+ <max separator=",">2,3,4</max>
224
+ <active>1</active>
225
+ </depends>
226
+ </template3>
227
+ <days3 translate="label comment">
228
+ <label>Send email after</label>
229
+ <frontend_type>text</frontend_type>
230
+ <sort_order>46</sort_order>
231
+ <show_in_default>1</show_in_default>
232
+ <show_in_website>1</show_in_website>
233
+ <show_in_store>1</show_in_store>
234
+ <can_be_empty>0</can_be_empty>
235
+ <comment><![CDATA[This value is the days and is set since the cart was abandoned.]]></comment>
236
+ <depends>
237
+ <max separator=",">2,3,4</max>
238
+ <active>1</active>
239
+ </depends>
240
+ </days3>
241
+ <customer translate="label comment">
242
+ <label>Customer Groups</label>
243
+ <frontend_type>multiselect</frontend_type>
244
+ <source_model>web4pro_abandonedcart/system_config_customergroup</source_model>
245
+ <sort_order>70</sort_order>
246
+ <show_in_default>1</show_in_default>
247
+ <show_in_website>1</show_in_website>
248
+ <show_in_store>1</show_in_store>
249
+ <can_be_empty>0</can_be_empty>
250
+ <comment><![CDATA[Choose customer group]]></comment>
251
+ <depends>
252
+ <active>1</active>
253
+ </depends>
254
+ </customer>
255
+ <autologin translate="label comment">
256
+ <label>Auto Login link</label>
257
+ <frontend_type>select</frontend_type>
258
+ <source_model>adminhtml/system_config_source_yesno</source_model>
259
+ <sort_order>80</sort_order>
260
+ <show_in_default>1</show_in_default>
261
+ <show_in_website>1</show_in_website>
262
+ <show_in_store>1</show_in_store>
263
+ <comment><![CDATA[The client will be autologed when click on link in email he receive]]></comment>
264
+ <depends>
265
+ <active>1</active>
266
+ </depends>
267
+ </autologin>
268
+
269
+ </fields>
270
+ </general>
271
+ <coupon>
272
+ <label>Coupon</label>
273
+ <sort_order>99</sort_order>
274
+ <frontend_type>text</frontend_type>
275
+ <show_in_default>1</show_in_default>
276
+ <show_in_website>1</show_in_website>
277
+ <show_in_store>1</show_in_store>
278
+ <fields>
279
+ <create translate="label">
280
+ <label>Create Coupon?</label>
281
+ <frontend_type>select</frontend_type>
282
+ <source_model>adminhtml/system_config_source_yesno</source_model>
283
+ <sort_order>100</sort_order>
284
+ <show_in_default>1</show_in_default>
285
+ <show_in_website>1</show_in_website>
286
+ <show_in_store>1</show_in_store>
287
+ </create>
288
+ <sendon translate="label">
289
+ <label>Include in email number</label>
290
+ <frontend_type>text</frontend_type>
291
+ <sort_order>110</sort_order>
292
+ <show_in_default>1</show_in_default>
293
+ <show_in_website>1</show_in_website>
294
+ <show_in_store>1</show_in_store>
295
+ <can_be_empty>0</can_be_empty>
296
+ <comment><![CDATA[What email number to be set with?]]></comment>
297
+ <depends>
298
+ <create>1</create>
299
+ </depends>
300
+ </sendon>
301
+ <automatic translate="label">
302
+ <label>Option</label>
303
+ <frontend_type>select</frontend_type>
304
+ <source_model>web4pro_abandonedcart/system_config_automatic</source_model>
305
+ <sort_order>115</sort_order>
306
+ <show_in_default>1</show_in_default>
307
+ <show_in_website>1</show_in_website>
308
+ <show_in_store>1</show_in_store>
309
+ <depends>
310
+ <create>1</create>
311
+ </depends>
312
+ </automatic>
313
+ <couponcode>
314
+ <label>Coupon Code</label>
315
+ <frontend_type>text</frontend_type>
316
+ <sort_order>120</sort_order>
317
+ <show_in_default>1</show_in_default>
318
+ <show_in_website>1</show_in_website>
319
+ <show_in_store>1</show_in_store>
320
+ <can_be_empty>0</can_be_empty>
321
+ <comment><![CDATA[The code of an existing coupon]]></comment>
322
+ <depends>
323
+ <create>1</create>
324
+ <automatic>1</automatic>
325
+ </depends>
326
+ </couponcode>
327
+ <expire>
328
+ <label>Expire on</label>
329
+ <frontend_type>text</frontend_type>
330
+ <sort_order>120</sort_order>
331
+ <show_in_default>1</show_in_default>
332
+ <show_in_website>1</show_in_website>
333
+ <show_in_store>1</show_in_store>
334
+ <can_be_empty>0</can_be_empty>
335
+ <comment><![CDATA[The coupon expiration in days]]></comment>
336
+ <depends>
337
+ <create>1</create>
338
+ <automatic>2</automatic>
339
+ </depends>
340
+ </expire>
341
+ <length>
342
+ <label>Coupon length</label>
343
+ <frontend_type>text</frontend_type>
344
+ <sort_order>130</sort_order>
345
+ <show_in_default>1</show_in_default>
346
+ <show_in_website>1</show_in_website>
347
+ <show_in_store>1</show_in_store>
348
+ <can_be_empty>0</can_be_empty>
349
+ <comment><![CDATA[The coupon length]]></comment>
350
+ <depends>
351
+ <create>1</create>
352
+ <automatic>2</automatic>
353
+ </depends>
354
+ </length>
355
+ <discounttype>
356
+ <label>Discount type</label>
357
+ <frontend_type>select</frontend_type>
358
+ <source_model>web4pro_abandonedcart/system_config_discounttype</source_model>
359
+ <sort_order>140</sort_order>
360
+ <show_in_default>1</show_in_default>
361
+ <show_in_website>1</show_in_website>
362
+ <show_in_store>1</show_in_store>
363
+ <can_be_empty>0</can_be_empty>
364
+ <comment><![CDATA[Select percentage or fixed discount]]></comment>
365
+ <depends>
366
+ <create>1</create>
367
+ <automatic>2</automatic>
368
+ </depends>
369
+ </discounttype>
370
+ <discount>
371
+ <label>Discount amount</label>
372
+ <frontend_type>text</frontend_type>
373
+ <sort_order>150</sort_order>
374
+ <show_in_default>1</show_in_default>
375
+ <show_in_website>1</show_in_website>
376
+ <show_in_store>1</show_in_store>
377
+ <can_be_empty>0</can_be_empty>
378
+ <comment><![CDATA[Set discount amount]]></comment>
379
+ <depends>
380
+ <create>1</create>
381
+ <automatic>2</automatic>
382
+ </depends>
383
+ </discount>
384
+ <couponlabel>
385
+ <label>Label for coupon</label>
386
+ <frontend_type>text</frontend_type>
387
+ <sort_order>160</sort_order>
388
+ <show_in_default>1</show_in_default>
389
+ <show_in_website>1</show_in_website>
390
+ <show_in_store>1</show_in_store>
391
+ <can_be_empty>0</can_be_empty>
392
+ <comment><![CDATA[Set coupon label]]></comment>
393
+ <depends>
394
+ <create>1</create>
395
+ <automatic>2</automatic>
396
+ </depends>
397
+ </couponlabel>
398
+ </fields>
399
+ </coupon>
400
+ </groups>
401
+ </web4pro_abandonedcart>
402
+ </sections>
403
+ </config>
app/code/community/Web4pro/Abandonedcart/sql/web4proabandonedcart_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_ModuleName
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+
13
+ $installer = $this;
14
+
15
+ $installer->startSetup();
16
+
17
+ $conn->addColumn($installer->getTable('sales_flat_quote'), 'web4pro_abandonedcart_counter', 'INT(11) NULL DEFAULT 0');
18
+
19
+ $conn->addColumn($installer->getTable('sales_flat_quote'), 'web4pro_abandonedcart_flag', 'INT(11) NULL DEFAULT 0');
20
+
21
+ $installer->getConnection()->addColumn(
22
+ $installer->getTable('sales_flat_quote'), 'web4pro_abandonedcart_token', 'varchar(255)', null, array('default' => 'null')
23
+ );
24
+
25
+
26
+ $conn->addColumn($installer->getTable('sales_flat_order'), 'web4pro_abandonedcart_counter', 'INT(11) NULL DEFAULT 0');
27
+
28
+
29
+ $conn->addColumn($installer->getTable('sales_flat_order'), 'web4pro_abandonedcart_flag', 'INT(11) NULL DEFAULT 0');
30
+
31
+ $installer->run("
32
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('web4pro_mails_sent')}` (
33
+ `id` INT(10) unsigned NOT NULL auto_increment,
34
+ `store_id` smallint(5),
35
+ `mail_type` ENUM('abandoned cart','new order', 'wishlist') NOT NULL,
36
+ `customer_email` varchar(255),
37
+ `customer_name` varchar(255),
38
+ `coupon_number` varchar(255),
39
+ `coupon_type` smallint(2),
40
+ `coupon_amount` decimal(10,2),
41
+ `sent_at` DATETIME NOT NULL ,
42
+ PRIMARY KEY (`id`)
43
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
44
+ ");
45
+
46
+
47
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/abandonedcart.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <adminhtml_abandonedorder_grid>
4
+ <update handle="formkey"/>
5
+ <block type="web4pro_abandonedcart/adminhtml_abandonedorder_grid" name="web4pro_abandonedcart_abandonedorder.grid" output="toHtml"></block>
6
+ </adminhtml_abandonedorder_grid>
7
+ <adminhtml_abandonedmails_grid>
8
+ <update handle="formkey"/>
9
+ <block type="web4pro_abandonedcart/adminhtml_abandonedmails_grid" name="web4pro_abandonedcart_abandonedmails.grid" output="toHtml"></block>
10
+ </adminhtml_abandonedmails_grid>
11
+ <adminhtml_abandonedorder_index>
12
+ <reference name="content">
13
+ <block type="web4pro_abandonedcart/adminhtml_abandonedorder" name="web4pro_abandonedcart_abandonedorder.grid.container"></block>
14
+ </reference>
15
+ </adminhtml_abandonedorder_index>
16
+ <adminhtml_abandonedmails_index>
17
+ <reference name="content">
18
+ <block type="web4pro_abandonedcart/adminhtml_abandonedmails" name="web4pro_abandonedcart_abandonedmails.grid.container"></block>
19
+ </reference>
20
+ </adminhtml_abandonedmails_index>
21
+ <adminhtml_abandonedorder_dashboard>
22
+ <reference name="head">
23
+ <action method="addCss"><stylesheet>abandonedcart/abandonedcart.css</stylesheet></action>
24
+ </reference>
25
+ <reference name="content">
26
+ <block type="web4pro_abandonedcart/adminhtml_dashboard" name="web4pro_abandonedcart_abandonedorder.dashboard">
27
+ <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher" template="store/switcher.phtml">
28
+ <action method="setUseConfirm"><params>0</params></action>
29
+ </block>
30
+ </block>
31
+ </reference>
32
+ </adminhtml_abandonedorder_dashboard>
33
+ </layout>
app/design/adminhtml/default/default/template/web4pro/abandonedcart/dashboard/index.phtml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ function changeDiagramsPeriod(periodObj) {
4
+ periodParam = periodObj.value ? 'period/' + periodObj.value + '/' : '';
5
+ ajaxBlockUrl = '<?php echo $this->getUrl('*/*/ajaxBlock', array('_current' => true, 'block' => 'totals', 'period' => '')) ?>' + periodParam;
6
+ new Ajax.Request(ajaxBlockUrl, {
7
+ parameters: {isAjax: 'true', form_key: FORM_KEY},
8
+ onSuccess: function(transport) {
9
+ tabContentElementId = 'dashboard_diagram_totals';
10
+ try {
11
+ if (transport.responseText.isJSON()) {
12
+ var response = transport.responseText.evalJSON()
13
+ if (response.error) {
14
+ alert(response.message);
15
+ }
16
+ if(response.ajaxExpired && response.ajaxRedirect) {
17
+ setLocation(response.ajaxRedirect);
18
+ }
19
+ } else {
20
+ $(tabContentElementId).replace(transport.responseText);
21
+ }
22
+ }
23
+ catch (e) {
24
+ $(tabContentElementId).replace(transport.responseText);
25
+ }
26
+ }
27
+ });
28
+ }
29
+
30
+ function toggleCal(id) {
31
+ $('dashboard_'+id+'_cal_div').toggle();
32
+ $('dashboard_'+id+'_range_div').toggle();
33
+ }
34
+ //]]>
35
+ </script>
36
+
37
+
38
+
39
+ <div class="content-header">
40
+ <table cellspacing="0">
41
+ <tr>
42
+ <td style="width:50%;"><h3>Abandoned Cart Dashboard (Web4pro)</h3></td>
43
+ </tr>
44
+ </table>
45
+ </div>
46
+
47
+ <div class="dashboard-container">
48
+ <?php echo $this->getChildHtml('store_switcher') ?>
49
+ <table cellspacing='25' width='100%'>
50
+ <tr>
51
+ <td>
52
+ <?php echo $this->getChildHtml('sales') ?>
53
+ </td>
54
+ <td>
55
+ <div class="entry-edit" style="border: 1px solid #ccc;">
56
+ <div style="margin: 20px;">
57
+ <p class="switcher a-right" style="padding: 5px 10px;">
58
+ Select a range:
59
+ <select name="period" id="order__period" onchange="changeDiagramsPeriod(this);">
60
+ <?php foreach ($this->helper('web4pro_abandonedcart')->getDatePeriods() as $_value=>$_label): ?>
61
+ <?php if(in_array($_value, array('custom'))) continue; ?>
62
+ <option value="<?php echo $_value ?>" <?php if($this->getRequest()->getParam('period')==$_value): ?> selected="selected"<?php endif; ?>><?php echo $_label ?></option>
63
+ <?php endforeach; ?>
64
+ </select></p><br/>
65
+ </p>
66
+ <?php echo $this->getChildHtml('totals') ?>
67
+ </div>
68
+ </div>
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
app/design/adminhtml/default/default/template/web4pro/abandonedcart/dashboard/salebar.phtml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php if( sizeof($this->getTotals()) > 0 ): ?>
2
+ <?php foreach( $this->getTotals() as $_total ): ?>
3
+ <div class="entry-edit">
4
+ <div class="entry-edit-head"><h4><?php echo $_total['label'] ?></h4></div>
5
+ <fieldset class="a-center bold">
6
+ <span class="nowrap" style="font-size:18px;"><?php echo $_total['value'] ?><span style="font-size:14px; color:#686868;"><?php echo $_total['decimals'] ?></span></span>
7
+ </fieldset>
8
+ </div>
9
+ <?php endforeach; ?>
10
+ <?php endif; ?>
app/design/adminhtml/default/default/template/web4pro/abandonedcart/dashboard/totalbar.phtml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if( sizeof($this->getTotals()) > 0 ): ?>
2
+ <?php
3
+ $last = '';
4
+ $total = array();
5
+ foreach($this->getTotals() as $_total):
6
+ $words = explode(' ',$_total['label']);
7
+ $total[$words[0]][] = $_total;
8
+ endforeach;
9
+ ?>
10
+ <div class="box" id="dashboard_diagram_totals">
11
+ <?php foreach( $total as $label => $_auxtotal ): ?>
12
+ <div class="entry-edit">
13
+ <div class="entry-edit-head"><h4><?php echo $label ?></h4></div>
14
+ <table cellspacing="0" width="100%">
15
+ <tr>
16
+ <?php foreach( $_auxtotal as $_total ): ?>
17
+ <td class="a-center bold">
18
+ <span><?php echo $_total['label'] ?></span><br />
19
+ <span class="nowrap" style="font-size:18px; color:#EA7601;"><?php echo $_total['value'] ?><span style="font-size:14px; color:#DE8946;"><?php echo $_total['decimals'] ?></span></span>
20
+ </td>
21
+ <?php endforeach; ?>
22
+ </tr>
23
+ </table>
24
+ </div>
25
+ <?php endforeach; ?>
26
+ </div>
27
+ <?php endif; ?>
app/design/frontend/base/default/template/web4pro_abandonedcart/email/order/items.phtml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_ModuleName
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ $_imageHelper = Mage::helper('catalog/image');
13
+ $_quote = $this->getQuote();
14
+ ?>
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
16
+ <thead>
17
+ <tr>
18
+ <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Item') ?></th>
19
+ <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>
20
+ <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Image') ?></th>
21
+ <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Qty') ?></th>
22
+ <th align="right" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Subtotal') ?></th>
23
+ </tr>
24
+ </thead>
25
+ <?php if (is_object($_quote)) :?>
26
+ <?php $i=0; foreach ($_quote->getAllItems() as $_item):?>
27
+ <?php if($_item->getParentItemId()) continue; else $i++; ?>
28
+ <?php if($_item->getProductType() == 'configurable' || $_item->getProductType() == 'bundle') :
29
+ $finalResult = array();
30
+ $result = array();
31
+ $options = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
32
+ // Check for options
33
+ if ($options) {
34
+ if (isset($options['options'])) {
35
+ $result = array_merge($result, $options['options']);
36
+ }
37
+ if (isset($options['additional_options'])) {
38
+ $result = array_merge($result, $options['additional_options']);
39
+ }
40
+ if (!empty($options['attributes_info'])) {
41
+ $result = array_merge($options['attributes_info'], $result);
42
+ }
43
+ if(isset($options['bundle_options'])) {
44
+
45
+
46
+ $bundled_product = new Mage_Catalog_Model_Product();
47
+ $bundled_product->load($_item->getProduct()->getId());
48
+ $selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(
49
+ $bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product
50
+ );
51
+
52
+ $bundled_items = array();
53
+ $label = '';
54
+ $qty = '';
55
+ foreach($selectionCollection as $option)
56
+ {
57
+ foreach($options['bundle_options'] as $bundle){
58
+ if($bundle['value'][0]['title'] == $option->getName()){
59
+ $label = $bundle['label'];
60
+ $qty = $bundle['value'][0]['qty'];
61
+ $aux_options[] = array('label' => $label, 'value' => $qty .' x '. $option->getName() .' '. Mage::helper('checkout')->formatPrice($option->getPrice()), 'sku' => $option->getSku());
62
+ }
63
+
64
+ }
65
+ }
66
+
67
+ $result = array_merge($result, $aux_options);
68
+ }
69
+ }
70
+ $options = array_merge($finalResult, $result);
71
+ endif; ?>
72
+ <tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>>
73
+ <tr>
74
+ <td valign="top" align="left" style="padding:3px 9px">
75
+ <?php echo $_item['name'];?>
76
+ <?php if(isset($options) && is_array($options)) :?>
77
+ <?php foreach($options as $option) :?>
78
+ <br /><strong><em><?php echo $option['label'];?> </em></strong> <?php echo $option['value'];?>
79
+ <?php if(isset($option['sku'])) :?>
80
+ <?php echo ' ' . $option['sku'];?>
81
+ <?php endif; ?>
82
+ <?php endforeach; ?>
83
+ <?php $options = null; ?>
84
+ <?php endif; ?>
85
+ </td>
86
+ <td valign="top" align="left" style="padding:3px 9px"><?php echo $_item['sku'];?></td>
87
+ <td valign="top" align="left" style="padding:3px 9px">
88
+ <a href="{{var url}}"><img src="<?php echo $_imageHelper->init($_item->getProduct(), 'thumbnail');?>"/>
89
+ </a>
90
+ </td>
91
+ <td valign="top" align="center" style="padding:3px 9px"><?php echo $_item['qty'];?></td>
92
+ <td valign="top" align="right" style="padding:3px 9px"><?php echo $this->getTax($_item);?></td>
93
+
94
+ </tr>
95
+ </tbody>
96
+ <?php endforeach; ?>
97
+ <?php endif;?>
98
+ </table>
app/design/frontend/base/default/template/web4pro_abandonedcart/email/order/items/order/default.phtml ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEB4PRO - Creating profitable online stores
4
+ *
5
+ *
6
+ * @author WEB4PRO <amutylo@web4pro.com.ua>
7
+ * @category WEB4PRO
8
+ * @package Web4pro_ModuleName
9
+ * @copyright Copyright (c) 2014 WEB4PRO (http://www.web4pro.net)
10
+ * @license http://www.web4pro.net/license.txt
11
+ */
12
+ ?>
13
+ <?php
14
+ $_item = $this->getItem();
15
+ $_quote = $this->getItem()->getQuote();
16
+ ?>
17
+ <tr>
18
+ <td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
19
+ <strong style="font-size:11px;"><?php echo $this->htmlEscape($_item->getName()) ?></strong>
20
+ <?php if ($this->getItemOptions()): ?>
21
+ <dl style="margin:0; padding:0;">
22
+ <?php foreach ($this->getItemOptions() as $option): ?>
23
+ <dt><strong><em><?php echo $option['label'] ?></em></strong></dt>
24
+ <dd style="margin:0; padding:0 0 0 9px;">
25
+ <?php echo nl2br($this->escapeHtml($option['value'])) ?>
26
+ </dd>
27
+ <?php endforeach; ?>
28
+ </dl>
29
+ <?php endif; ?>
30
+ <?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
31
+ <?php if ($addInfoBlock) :?>
32
+ <?php echo $addInfoBlock->setItem($_item)->toHtml(); ?>
33
+ <?php endif; ?>
34
+ <?php echo $this->escapeHtml($_item->getDescription()) ?>
35
+ </td>
36
+ <td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->htmlEscape($this->getSku($_item)) ?></td>
37
+ <td align="center" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $_item->getQtyOrdered()*1 ?></td>
38
+ <td align="right" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
39
+ <?php if ($this->helper('tax')->displaySalesPriceExclTax($_quote->getStoreId()) || $this->helper('tax')->displaySalesBothPrices($_quote->getStore())): ?>
40
+ <?php if ($this->helper('tax')->displaySalesBothPrices($_quote->getStoreId())): ?>
41
+ <span class="label"><?php echo Mage::helper('tax')->__('Excl. Tax'); ?>:</span>
42
+ <?php endif; ?>
43
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_quote->getStore())): ?>
44
+ <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
45
+ <!-- --><?php //echo $_quote->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
46
+ <?php else: ?>
47
+ <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_item->getRowTotal()) ?>
48
+ <?php endif; ?>
49
+
50
+
51
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
52
+ <br />
53
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_quote->getStore())): ?>
54
+ <small>
55
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
56
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount'],true,true); ?></span><br />
57
+ <?php endforeach; ?>
58
+ </small>
59
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStoreId())): ?>
60
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
61
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
62
+ <?php endforeach; ?>
63
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_quote->getStoreId())): ?>
64
+ <small>
65
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
66
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'],true,true); ?></span><br />
67
+ <?php endforeach; ?>
68
+ </small>
69
+ <?php endif; ?>
70
+
71
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStore())): ?>
72
+ <br />
73
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
74
+ <?php endif; ?>
75
+ <?php endif; ?>
76
+ <?php endif; ?>
77
+
78
+
79
+ <?php if ($this->helper('tax')->displaySalesPriceInclTax($_quote->getStoreId()) || $this->helper('tax')->displaySalesBothPrices($_quote->getStoreId())): ?>
80
+ <?php if ($this->helper('tax')->displaySalesBothPrices($_quote->getStoreId())): ?>
81
+ <br /><span class="label"><?php echo Mage::helper('tax')->__('Incl. Tax'); ?>:</span>
82
+ <?php endif; ?>
83
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
84
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_quote->getStoreId())): ?>
85
+ <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
86
+ <?php else: ?>
87
+ <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_incl-$_item->getWeeeTaxRowDisposition()) ?>
88
+ <?php endif; ?>
89
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
90
+ <br />
91
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_quote->getStore())): ?>
92
+ <small>
93
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
94
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount'],true,true); ?></span><br />
95
+ <?php endforeach; ?>
96
+ </small>
97
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStoreId())): ?>
98
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
99
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
100
+ <?php endforeach; ?>
101
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_quote->getStoreId())): ?>
102
+ <small>
103
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
104
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'],true,true); ?></span><br />
105
+ <?php endforeach; ?>
106
+ </small>
107
+ <?php endif; ?>
108
+
109
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStoreId())): ?>
110
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
111
+ <?php endif; ?>
112
+ <?php endif; ?>
113
+ <?php endif; ?>
114
+ </td>
115
+ </tr>
116
+ <?php if ($_item->getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_item->getGiftMessageId())): ?>
117
+ <tr>
118
+ <td colspan="4" style=" border-bottom:2px solid #CCCCCC; padding:3px 9px;">
119
+ <strong style="color:#444444; font-size:11px;"><?php echo $this->__('Gift Message') ?></strong>
120
+ <?php echo $this->__('From:'); ?> <?php echo $this->htmlEscape($_giftMessage->getSender()) ?><br />
121
+ <?php echo $this->__('To:'); ?> <?php echo $this->htmlEscape($_giftMessage->getRecipient()) ?><br />
122
+ <strong><?php echo $this->__('Message:'); ?></strong><br /><?php echo $this->htmlEscape($_giftMessage->getMessage()) ?>
123
+ </td>
124
+ </tr>
125
+ <?php endif; ?>
app/etc/modules/Web4pro_Abandonedcart.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Web4pro_Abandonedcart>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Web4pro_Abandonedcart>
8
+ </modules>
9
+ </config>
app/locale/en_US/Web4pro_Abandonedcart.csv ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Web4pro Emails","Web4pro Emails"
2
+ "Web4pro Abandoned Cart","Web4pro Abandoned Cart"
3
+ "Orders from Abandoned Carts","Orders from Abandoned Carts"
4
+ "Emails Sent from Abandoned Cart","Emails Sent from Abandoned Cart"
5
+ "Sent At","Sent At"
6
+ "Mail Type","Mail Type"
7
+ "Coupon #","Coupon #"
8
+ "Coupon type","Coupon type"
9
+ "Coupon amount","Coupon amount"
10
+ "Order #","Order #"
11
+ "Purchased From","Purchased From"
12
+ "Purchased On","Purchased On"
13
+ "Bill to Name","Bill to Name"
14
+ "Ship to Name","Ship to Name"
15
+ "G.T. (Base)","G.T. (Base)"
16
+ "G.T. (Purchased)","G.T. (Purchased)"
17
+ "Status","Status"
18
+ "Store","Store"
19
+ "Sent At","Sent At"
20
+ "Customer Email","Customer Email"
21
+ "Customer Name","Customer Name"
22
+ "Your abandoned cart token is not valid or incorrect","Your abandoned cart token is not valid or incorrect"
23
+ "General","General"
24
+ "Please, login to complete your order","Please, login to complete your order"
25
+ "Abandoned","Abandoned"
26
+ "Last 24 Hours","Last 24 Hours"
27
+ "Last 7 Days","Last 7 Days"
28
+ "Last 30 Days","Last 30 Days"
29
+ "Last 60 Days","Last 60 Days"
30
+ "Last 90 Days","Last 90 Days"
31
+ "Lifetime","Lifetime"
32
+ "My Abandoned Carts","My Abandoned Carts"
33
+ "Log activated","Log activated"
34
+ "First date","First date"
35
+ "Carts will be ignored before this date!","Carts will be ignored before this date!"
36
+ "Sender","Sender"
37
+ "Redirect page","Redirect page"
38
+ "Url to redirect the customer", "Url to redirect the customer"
39
+ "Max number of email to send","Max number of email to send"
40
+ "Number of emails to be send","Number of emails to be send"
41
+ "First Email Subject","First Email Subject"
42
+ "The subject for the first email abandoned cart","The subject for the first email abandoned cart"
43
+ "First Email Template","First Email Template"
44
+ "Send email after","Send email after"
45
+ "This value depends of the next unit parameter","This value depends of the next unit parameter"
46
+ "Unit","Unit"
47
+ "Enter the unit for considering in the first email","Enter the unit for considering in the first email"
48
+ "Second Email Subject","Second Email Subject"
49
+ "The subject for the second email abandoned cart","The subject for the second email abandoned cart"
50
+ "This value is the days and is set since the moment cart was abandoned.","This value is the days and is set since the moment cart was abandoned."
51
+ "The subject for the third email abandoned cart","The subject for the third email abandoned cart"
52
+ "Choose customer group","Choose customer group"
53
+ "The client will be autologed when click on link in email he receive","The client will be autologed when click on link in email he receive"
54
+ "What email number to be set with?","What email number to be set with?"
55
+ "The code of an existing coupon","The code of an existing coupon"
56
+ "The coupon expiration in days","The coupon expiration in days"
57
+ "The coupon length","The coupon length"
58
+ "Select percentage or fixed discount","Select percentage or fixed discount"
59
+ "Set discount amount","Set discount amount"
60
+ "Set coupon label","Set coupon label"
61
+
app/locale/en_US/template/email/web4pro/abandonedcart/cart_mail_1.html ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; margin:0; padding:0;">
2
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; margin:0; padding:0;">
3
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
4
+ <tr>
5
+ <td valign="top">
6
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" style="border:1px solid #E0E0E0;">
7
+ <tr>
8
+ <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
9
+ </tr>
10
+ <tr>
11
+ <td valign="top">
12
+ <h1 style="font-size:18px; font-weight:normal; line-height:18px; margin:0 0 6px 0;">Hello, Mr. {{htmlescape var=$name}}</h1>
13
+ <p style="font-size:14px; line-height:14px; margin:0;">
14
+ You have not finish your order at {{var store.getFrontendName()}}.
15
+ <br>You can access your cart with order <a href="{{var url}}" style="color:#1E7EC8;">here</a>.
16
+ {{depend couponcode}}
17
+ <br>To complete the order you can use this coupon code <b>{{var couponcode}}</b>
18
+ {{/depend}}
19
+ {{depend discount}}
20
+ and get a discount of {{var discount}} until {{var todate}}
21
+ {{/depend}}
22
+ <br>If you have any questions regarding your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us <span class="nobr">{{config path='general/store_information/phone'}}</span>
23
+ </p>
24
+ </td>
25
+ </tr>
26
+ <tr>
27
+ <td rel="cart-content">
28
+ {{block type='web4pro_abandonedcart/email_order_items' area='frontend' template='web4pro_abandonedcart/email/order/items.phtml' quote=$quote url}}
29
+ </td>
30
+ </tr>
31
+ <tr>
32
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA;"><p style="font-size:12px; margin:0;">Thank you for shopping with us, <strong>{{var store.getFrontendName()}}</strong></p></td>
33
+ </tr>
34
+ <tr>
35
+ <td>
36
+ <div style="margin-top: 20px; margin-bottom:20px;"><a bgcolor="#EAEAEA" style="background:#EAEAEA; text-align:center; display:cell-block; color:black; border-radius: 10px; text-decoration:none; padding:22px; box-shadow: inset 0px 1px 1px #909193, 0px 1px 0px #fff; font-size:15px" href="{{var url}}" >Resume your oder {{depend couponcode}} and redeem coupon code {{/depend}}{{var couponcode}} {{depend discount}} to get {{var discount}}% off!{{/depend}}</a></div>
37
+ </td>
38
+ </tr>
39
+ </table>
40
+ </td>
41
+ </tr>
42
+ </table>
43
+ </div>
44
+ </body>
app/locale/en_US/template/email/web4pro/abandonedcart/cart_mail_2.html ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
2
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
3
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
4
+ <tr>
5
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
6
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
7
+ <!-- [ header starts here] -->
8
+ <tr>
9
+ <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
10
+ </tr>
11
+ <!-- [ middle starts here] -->
12
+ <tr>
13
+ <td valign="top">
14
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$name}}</h1>
15
+ <p style="font-size:12px; line-height:16px; margin:0;">
16
+ You have an abandoned cart at {{var store.getFrontendName()}}.
17
+ Please remember our stock is not unlimited, it is recommended to take advantage of this great opportunity to get your desired products in the comfort of your home.
18
+ <br>You can access your cart <a href="{{var url}}" style="color:#1E7EC8;">here</a>.
19
+ {{depend couponcode}}
20
+ <br>You can use this coupon code <b>{{var couponcode}}</b>
21
+ {{/depend}}
22
+ {{depend discount}}
23
+ and obtain a discount of {{var discount}} only until {{var todate}}
24
+ {{/depend}}
25
+ <br>If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span>
26
+ </p>
27
+ </td>
28
+ </tr>
29
+ <tr>
30
+ <td>
31
+ {{block type='web4pro_abandonedcart/email_order_items' area='frontend' template='web4pro_abandonedcart/email/order/items.phtml' quote=$quote url}}
32
+ </td>
33
+ </tr>
34
+ <tr>
35
+ <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>
36
+ </tr>
37
+ <tr>
38
+ <td align="center">
39
+ <div style="margin-top: 30px; margin-bottom:20px;"><a bgcolor="#EAEAEA" style="background:#EAEAEA; text-align:center; display:cell-block; color:black; border-radius: 10px; text-decoration:none; padding:22px; box-shadow: inset 0px 1px 1px #909193, 0px 1px 0px #fff; font-size:15px" href="{{var url}}" >Resume your oder {{depend couponcode}} and redeem coupon code {{/depend}}{{var couponcode}} {{depend discount}} to get {{var discount}}% off!{{/depend}}</a></div>
40
+ </td>
41
+ </tr>
42
+ </table>
43
+ </td>
44
+ </tr>
45
+ </table>
46
+ </div>
47
+ </body>
app/locale/en_US/template/email/web4pro/abandonedcart/cart_mail_3.html ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
2
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
3
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
4
+ <tr>
5
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
6
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
7
+ <!-- [ header starts here] -->
8
+ <tr>
9
+ <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
10
+ </tr>
11
+ <!-- [ middle starts here] -->
12
+ <tr>
13
+ <td valign="top">
14
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$name}}</h1>
15
+ <p style="font-size:12px; line-height:16px; margin:0;">
16
+ You have an abandoned cart at {{var store.getFrontendName()}}.
17
+ {{depend couponcode}}
18
+ <br>You were chosen to receive a coupon which can be used with this code <b>{{var couponcode}}</b>
19
+ {{/depend}}
20
+ {{depend discount}}
21
+ and obtain a discount of {{var discount}} only until {{var todate}}
22
+ {{/depend}}
23
+ <br>You can access your cart <a href="{{var url}}" style="color:#1E7EC8;">here</a>.
24
+ <br>If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span>
25
+ </p>
26
+ </td>
27
+ </tr>
28
+ <tr>
29
+ <td>
30
+ {{block type='web4pro_abandonedcart/email_order_items' area='frontend' template='web4pro_abandonedcart/email/order/items.phtml' quote=$quote url}}
31
+ </td>
32
+ </tr>
33
+ <tr>
34
+ <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>
35
+ </tr>
36
+ <tr>
37
+ <td align="center">
38
+ <div style="margin-top: 30px; margin-bottom:20px;"><a bgcolor="#EAEAEA" style="background:#EAEAEA; text-align:center; display:cell-block; color:black; border-radius: 10px; text-decoration:none; padding:22px; box-shadow: inset 0px 1px 1px #909193, 0px 1px 0px #fff; font-size:15px" href="{{var url}}" >Resume your oder {{depend couponcode}} and redeem coupon code {{/depend}}{{var couponcode}} {{depend discount}} to get {{var discount}}% off!{{/depend}}</a></div>
39
+ </td>
40
+ </tr>
41
+ </table>
42
+ </td>
43
+ </tr>
44
+ </table>
45
+ </div>
46
+ </body>
app/locale/ru_RU/Web4pro_Abandonedcart.csv ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Web4pro Emails","Web4pro Emails"
2
+ "Web4pro Abandoned Cart","Web4pro брошенная корзина"
3
+ "Orders from Abandoned Carts","Заказы сделанные из брошенных корзин"
4
+ "Emails Sent from Abandoned Cart","Отосланные письма"
5
+ "Sent At","Дата отправки"
6
+ "Mail Type","Тип email"
7
+ "Coupon #","№ купона"
8
+ "Coupon type","Тип купона"
9
+ "Coupon amount","Размер скидки"
10
+ "Order #","№ заказа"
11
+ "Purchased From","Магазин"
12
+ "Purchased On","Дата покупки"
13
+ "Bill to Name","Оплата на имя"
14
+ "Ship to Name","Доставка на имя"
15
+ "G.T. (Base)","Сумма(основная)"
16
+ "G.T. (Purchased)","Сумма(окончательная)"
17
+ "Status","Статус"
18
+ "Store","Магазин"
19
+ "Sent At","Дата отправки"
20
+ "Customer Email","Email Клиента"
21
+ "Customer Name","Имя клиента"
22
+ "Your abandoned cart token is not valid or incorrect","Ваш токен брошенной корзины не действителен или неправильный"
23
+ "General","Общее"
24
+ "Please, login to complete your order","Пожалуйста, залогиньтесь для завершения заказа"
25
+ "Abandoned","Брошенный"
26
+ "Last 24 Hours","Последние 24 часа"
27
+ "Last 7 Days","Последние 7 Days"
28
+ "Last 30 Days","Последние 30 Days"
29
+ "Last 60 Days","Последние 60 Days"
30
+ "Last 90 Days","Последние 90 Days"
31
+ "Lifetime","Все время"
32
+ "My Abandoned Carts","Мои брошенные корзины"
33
+ "Log activated","Включить логирование"
34
+ "First date","Первая дата отправки"
35
+ "Carts will be ignored before this date!","Корзины до этой даты будут игнорироваться!"
36
+ "Sender","Отправитель"
37
+ "Redirect page","Перенаправление на страницу"
38
+ "Url to redirect the customer", "Url перенаправления клиента"
39
+ "Max number of email to send","Максималное количество email"
40
+ "Number of emails to be send","Количество email для отправки"
41
+ "First Email Subject","Тема первого email"
42
+ "The subject for the first email abandoned cart","Тема для первого email брошенной корзины"
43
+ "First Email Template","Шаблон первого Email"
44
+ "Send email after","Отправить email после"
45
+ "This value depends of the next unit parameter","Это значение зависит от следующего параметра измерения"
46
+ "Unit","Единица измерения"
47
+ "Enter the unit for considering in the first email","Введите единицу измерения для вышеуказанного email"
48
+ "Second Email Subject","Вторая тема email"
49
+ "The subject for the second email abandoned cart","Тема второго email брошенной корзины"
50
+ "This value is the days and is set since the moment cart was abandoned.","Это значение в днях с тех пор как корзина была брошена."
51
+ "The subject for the third email abandoned cart","Тема шаблона третьего email"
52
+ "Choose customer group","Выберите группу пользователя"
53
+ "The client will be autologed when click on link in email he receive","Клиент будет залогинен автоматически после того как он кликнет на линк в сообщении email."
54
+ "What email number to be set with?","С каким email ассоциировать купон на скидку"
55
+ "The code of an existing coupon","Введите номер существующего купона на скидку"
56
+ "The coupon expiration in days","Время устаревания купона в днях"
57
+ "The coupon length","Длинна купона"
58
+ "Select percentage or fixed discount","Выберите тип скидки: в процентах или фиксированные размер"
59
+ "Set discount amount","Установите размер скидки"
60
+ "Set coupon label","Задайте название купона"
app/locale/ru_RU/template/email/web4pro/abandonedcart/cart_mail_1.html ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
2
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; margin:0; padding:0;">
3
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
4
+ <tr>
5
+ <td valign="top" style="padding:10px 0 10px 0">
6
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" style="border:1px solid #E0E0E0;">
7
+ <tr>
8
+ <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:5px;" border="0"/></a></td>
9
+ </tr>
10
+ <tr>
11
+ <td valign="top">
12
+ <h1 style="font-size:18px; font-weight:normal; line-height:18px; margin:0 0 6px 0;">Добрый день, {{htmlescape var=$name}}</h1>
13
+ <p style="font-size:14px; line-height:16px; margin:0;">
14
+ Вы оставили корзину с заказом без продолжения на {{var store.getFrontendName()}}.
15
+ <br>Вы можете перейти на Вашу корзину с заказом нажав <a href="{{var url}}" style="color:#1E7EC8;">здесь</a>.
16
+ {{depend couponcode}}
17
+ <br>Вы можете использовать купон на скидку <b>{{var couponcode}}</b>
18
+ {{/depend}}
19
+ {{depend discount}}
20
+ и получить скидку {{var discount}} только до {{var todate}}
21
+ {{/depend}}
22
+ <br>Если у Вас еще остались вопросы по Вашему заказу пожалуйста напишите нам на <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> или позвоните нам по тел. <span class="nobr">{{config path='general/store_information/phone'}}</span>
23
+ </p>
24
+ </td>
25
+ </tr>
26
+ <tr>
27
+ <td rel="cart-content">
28
+ {{block type='web4pro_abandonedcart/email_order_items' area='frontend' template='web4pro_abandonedcart/email/order/items.phtml' quote=$quote url}}
29
+ </td>
30
+ </tr>
31
+ <tr>
32
+ <td bgcolor="#EAEAEA" style="background:#EAEAEA;"><p style="font-size:14px; margin:0;">Спасибо Вам за покупки с нами <strong>{{var store.getFrontendName()}}</strong></p></td>
33
+ </tr>
34
+ <tr>
35
+ <td>
36
+ <div style="margin-top: 10px; margin-bottom:10px;"><a bgcolor="#EAEAEA" style="background:#EAEAEA; display:cell-block; color:black; border-radius: 10px; text-decoration:none; padding:22px; box-shadow: inset 0px 1px 1px #909193, 0px 1px 0px #fff; font-size:15px" href="{{var url}}" >Нажмите для восстановления вашего заказа {{depend couponcode}} с купоном {{/depend}}{{var couponcode}} {{depend discount}} для получения скидки в размере {{var discount}} !{{/depend}}</a></div>
37
+ </td>
38
+ </tr>
39
+ </table>
40
+ </td>
41
+ </tr>
42
+ </table>
43
+ </div>
44
+ </body>
app/locale/ru_RU/template/email/web4pro/abandonedcart/cart_mail_2.html ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; margin:0; padding:0;">
2
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; margin:0; padding:0;">
3
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
4
+ <tr>
5
+ <td align="center" valign="top" style="padding:10px 0 10px 0">
6
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="100%" style="border:1px solid #E0E0E0;">
7
+ <tr>
8
+ <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
9
+ </tr>
10
+ <tr>
11
+ <td valign="top">
12
+ <h1 style="font-size:18px; font-weight:normal; line-height:22px; margin:0 0 6px 0;">Hello, {{htmlescape var=$name}}</h1>
13
+ <p style="font-size:14px; line-height:16px; margin:0;">
14
+ Вы оставили корзину с заказом без продолжения на {{var store.getFrontendName()}}.
15
+ Количество товара ограничено, поэтому мы рекомендуем Вамo поспешить и получить Ваши желаемые товары в домашнем комфорте.
16
+ <br>Вы можете перейти на Вашу корзину с заказом нажав <a href="{{var url}}" style="color:#1E7EC8;">здесь</a>.
17
+ {{depend couponcode}}
18
+ <br>Вы можете использовать купон на скидку <b>{{var couponcode}}</b>
19
+ {{/depend}}
20
+ {{depend discount}}
21
+ и получить скидку {{var discount}} только до {{var todate}}
22
+ {{/depend}}
23
+ <br>Если у Вас еще остались вопросы по Вашему заказу пожалуйста напишите нам на <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> или позвоните нам по тел. <span class="nobr">{{config path='general/store_information/phone'}}</span>
24
+ </p>
25
+ </td>
26
+ </tr>
27
+ <tr>
28
+ <td rel="cart-content">
29
+ {{block type='web4pro_abandonedcart/email_order_items' area='frontend' template='web4pro_abandonedcart/email/order/items.phtml' quote=$quote url}}
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <td bgcolor="#EAEAEA" style="background:#EAEAEA; text-align:center;"><p style="font-size:12px; margin:0;">Спасибо Вам за покупки с нами <strong>{{var store.getFrontendName()}}</strong></p></td>
34
+ </tr>
35
+ <tr>
36
+ <td align="center">
37
+ <div style="margin-top: 30px; margin-bottom:20px;"><a bgcolor="#EAEAEA" style="background:#EAEAEA; text-align:center; display:cell-block; color:black; border-radius: 10px; text-decoration:none; padding:22px; box-shadow: inset 0px 1px 1px #909193, 0px 1px 0px #fff; font-size:15px" href="{{var url}}" >Нажмите для восстановления вашего заказа {{depend couponcode}} с купоном {{/depend}}{{var couponcode}} {{depend discount}} для получения скидки в размере {{var discount}}% off!{{/depend}}</a></div>
38
+ </td>
39
+ </tr>
40
+ </table>
41
+ </td>
42
+ </tr>
43
+ </table>
44
+ </div>
45
+ </body>
app/locale/ru_RU/template/email/web4pro/abandonedcart/cart_mail_3.html ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
2
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
3
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
4
+ <tr>
5
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
6
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
7
+ <!-- [ header starts here] -->
8
+ <tr>
9
+ <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
10
+ </tr>
11
+ <!-- [ middle starts here] -->
12
+ <tr>
13
+ <td valign="top">
14
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$name}}</h1>
15
+ <p style="font-size:12px; line-height:16px; margin:0;">
16
+ You have an abandoned cart at {{var store.getFrontendName()}}.
17
+ {{depend couponcode}}
18
+ <br>You were chosen to receive a coupon which can be used with this code <b>{{var couponcode}}</b>
19
+ {{/depend}}
20
+ {{depend discount}}
21
+ and obtain a discount of {{var discount}} only until {{var todate}}
22
+ {{/depend}}
23
+ <br>You can access your cart <a href="{{var url}}" style="color:#1E7EC8;">here</a>.
24
+ <br>If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span>
25
+ </p>
26
+ </td>
27
+ </tr>
28
+ <tr>
29
+ <td>
30
+ {{block type='web4pro_abandonedcart/email_order_items' area='frontend' template='web4pro_abandonedcart/email/order/items.phtml' quote=$quote url}}
31
+ </td>
32
+ </tr>
33
+ <tr>
34
+ <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>
35
+ </tr>
36
+ <tr>
37
+ <td align="center">
38
+ <div style="margin-top: 30px; margin-bottom:20px;"><a bgcolor="#EAEAEA" style="background:#EAEAEA; text-align:center; display:cell-block; color:black; border-radius: 10px; text-decoration:none; padding:22px; box-shadow: inset 0px 1px 1px #909193, 0px 1px 0px #fff; font-size:15px" href="{{var url}}" >Resume your oder {{depend couponcode}} and redeem coupon code {{/depend}}{{var couponcode}} {{depend discount}} to get {{var discount}}% off!{{/depend}}</a></div>
39
+ </td>
40
+ </tr>
41
+ </table>
42
+ </td>
43
+ </tr>
44
+ </table>
45
+ </div>
46
+ </body>
package.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>web4pro_Abandonedcart</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/lisenses/osl-3.0.php">OSL v.3</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Recover abandoned cart. Send reminder via email. &#xD;
10
+ Encourage customer to come back and place an order.</summary>
11
+ <description>Why do customers abandon their carts?&#xD;
12
+ According to recent research the average abandonment rate in the sales sector is over 70%.&#xD;
13
+ Some of the common reasons for that, customers tell the following:&#xD;
14
+ - High shipping costs &#xD;
15
+ - Hesitation, simply being not ready to purchase &#xD;
16
+ - Too high product prices &#xD;
17
+ Removing these hesitations with the Web4Pro Abandoned Cart extension will boost your sales, by motivating customers to restore their abandoned shopping carts.&#xD;
18
+ Customized ready-to-send email templates will easily draw customers&#x2019; attention to their abandoned carts.&#xD;
19
+ Customer will easy restore abandoned cart by click on restore link in remainder email.&#xD;
20
+ Extension also allows to attach discount coupons into any of the abandoned cart emails.&#xD;
21
+ Customer will be motivated to come back to store and finish the order. &#xD;
22
+ Customers will brings back approximately up to $5 after finishing their abandoned carts with real order. (According to recent research)</description>
23
+ <notes>fixed minor bugs</notes>
24
+ <authors><author><name>Andrii Mutylo</name><user>amutylo</user><email>amutylo@corp.web4pro.com.ua</email></author></authors>
25
+ <date>2015-03-13</date>
26
+ <time>11:38:59</time>
27
+ <contents><target name="magecommunity"><dir name="Web4pro"><dir name="Abandonedcart"><dir name="Block"><dir name="Adminhtml"><dir name="Abandonedmails"><file name="Grid.php" hash="9060093a6fb849d49abafbf410e3e166"/></dir><file name="Abandonedmails.php" hash="b9b637019b7bee1e9ab15f8e91e68ea9"/><dir name="Abandonedorder"><file name="Grid.php" hash="e6f960f9f84176329d50f0816cad10cb"/></dir><file name="Abandonedorder.php" hash="d7283ab5b5f0f9e12f7c2083c63c60a5"/><dir name="System"><dir name="Config"><file name="Date.php" hash="eec4283dfbea788691f72c6e1d6ba6d0"/></dir></dir></dir><dir name="Email"><dir name="Order"><file name="Items.php" hash="114b49b530574d132bfdf4a5e044056b"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="99cccbf6c0c6976e0002affc65499fee"/></dir><dir name="Model"><file name="Config.php" hash="b393a597dd4718a350332e9684dae477"/><file name="Cron.php" hash="d7d2d05cea0dd522c2cb3cd9ce8cbd9a"/><file name="EventObserver.php" hash="983faacb97c468a3b8b04a43819949c7"/><file name="Mailssent.php" hash="e23cb66f30c701827cf20a5868b1fea1"/><dir name="Resource"><dir name="Mailssent"><file name="Collection.php" hash="f142bdbbd4a0703f72baf8797831124e"/></dir><file name="Mailssent.php" hash="9fe7ddd15b8248eedd59dc3d2dd19fbf"/><dir name="Order"><file name="Collection.php" hash="2df2382b217b74eee8a6b46cdab65ac1"/></dir></dir><dir name="System"><dir name="Config"><file name="Automatic.php" hash="2deb05f63b07c6c33a2c0e794a0e32f7"/><file name="Cmspage.php" hash="f7a7bb1f5231bf6b87ca66a69985a571"/><file name="Customergroup.php" hash="79e9d343f7c3652e471aa2625d082776"/><file name="Discounttype.php" hash="2af8b70e00c27733cebd618d069f716c"/><file name="Maxemails.php" hash="ad14060e3419baa017ec20e0b6325ee1"/><file name="Unit.php" hash="0277c1563bb886a900714ff835940c6c"/></dir></dir></dir><dir name="controllers"><file name="AbandonedController.php" hash="b08db36123eefaf21376f3edd531f8eb"/><dir name="Adminhtml"><file name="AbandonedmailsController.php" hash="e293d702027111882a5d4ef472c361aa"/><file name="AbandonedorderController.php" hash="ec4b9d2e8bde09bd9c4681b8c512e312"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e7fb2c87b8a89f3ed5454019362a0990"/><file name="config.xml" hash="1a44e154cf6e676dd8c2a80e0afc01ae"/><file name="system.xml" hash="0e185c279e92656a9ac7feef29e94a6a"/></dir><dir name="sql"><dir name="web4proabandonedcart_setup"><file name="mysql4-install-1.0.0.php" hash="54f435815c3990d6248240786eb25a3b"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="abandonedcart.xml" hash="c2100d5a8920e210ecf328847749a471"/></dir><dir name="template"><dir><dir name="web4pro"><dir name="abandonedcart"><dir name="dashboard"><file name="index.phtml" hash="a9d0b6cfcc61a16d012da405651867c0"/><file name="salebar.phtml" hash="50a0c2645e2f651da9ba72fd875986cb"/><file name="totalbar.phtml" hash="24d4a799cd6ee507a715469d2aa2e877"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="web4pro_abandonedcart"><dir name="email"><dir name="order"><dir name="items"><dir name="order"><file name="default.phtml" hash="432a0a2b0091d4d542cbb4fd336b0dc5"/></dir></dir><file name="items.phtml" hash="b0ca6101958f8fe4befc2bc37cc70263"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Web4pro_Abandonedcart.xml" hash="f4e9e29e9a8ab24284c94527b9968e7a"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Web4pro_Abandonedcart.csv" hash="22871350e337cdb63b237849a4afe0a9"/><file name="Web4pro_Abandonedcart.csv" hash="22871350e337cdb63b237849a4afe0a9"/></dir><dir name="ru_RU"><file name="Web4pro_Abandonedcart.csv" hash="242331ad0713202848862a6fc6ffc764"/><file name="Web4pro_Abandonedcart.csv" hash="242331ad0713202848862a6fc6ffc764"/></dir></dir></target><target name="mage"><dir name="app"><dir name="locale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="web4pro"><dir name="abandonedcart"><file name="cart_mail_1.html" hash="165b29db632494dbb8bd0cf93ef831c0"/><file name="cart_mail_2.html" hash="f1d5a66c87eaad5fbbc507a7fcbb9759"/><file name="cart_mail_3.html" hash="49570b750dffb7c46204ac5276cebc9b"/></dir></dir></dir></dir></dir><dir name="ru_RU"><dir name="template"><dir name="email"><dir name="web4pro"><dir name="abandonedcart"><file name="cart_mail_1.html" hash="55241321d0de99bcc1602ed9c1000106"/><file name="cart_mail_2.html" hash="be09f53b6c121ac6a427d15c648847d0"/><file name="cart_mail_3.html" hash="49570b750dffb7c46204ac5276cebc9b"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="abandonedcart"><file name="abandonedcart.css" hash="b0d9cf44b4dd26f66e51a5376a1382e0"/></dir></dir></dir></dir></target></contents>
28
+ <compatible/>
29
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
30
+ </package>
skin/adminhtml/default/default/abandonedcart/abandonedcart.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ .adminhtml-abandonedorder-dashboard .warning-msg {
2
+ background: url("../images/warning_msg_icon.gif") no-repeat scroll 5px 2px #E6E6E6 !important;
3
+ padding: 2px 2px 2px 30px;
4
+ margin-top:10px;
5
+ }