CP_Reviewreminder - Version 1.0.0

Version Notes

Product review reminder

Download this release

Release Info

Developer Commerce Pundit
Extension CP_Reviewreminder
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (28) hide show
  1. app/code/community/CP/Reviewreminder/Block/Adminhtml/AddReminder/Grid.php +211 -0
  2. app/code/community/CP/Reviewreminder/Block/Adminhtml/AddReminder/Renderer/CustomerName.php +42 -0
  3. app/code/community/CP/Reviewreminder/Block/Adminhtml/Addreminder.php +32 -0
  4. app/code/community/CP/Reviewreminder/Block/Adminhtml/Closedreminder.php +34 -0
  5. app/code/community/CP/Reviewreminder/Block/Adminhtml/Closedreminder/Grid.php +195 -0
  6. app/code/community/CP/Reviewreminder/Block/Adminhtml/Reviewreminder.php +33 -0
  7. app/code/community/CP/Reviewreminder/Block/Adminhtml/Reviewreminder/Grid.php +268 -0
  8. app/code/community/CP/Reviewreminder/Helper/Data.php +255 -0
  9. app/code/community/CP/Reviewreminder/Helper/Mail.php +148 -0
  10. app/code/community/CP/Reviewreminder/Model/Adminhtml/System/Config/Source/Days.php +35 -0
  11. app/code/community/CP/Reviewreminder/Model/Adminhtml/System/Config/Source/Status.php +51 -0
  12. app/code/community/CP/Reviewreminder/Model/Adminhtml/System/Config/Source/Times.php +35 -0
  13. app/code/community/CP/Reviewreminder/Model/Observer.php +176 -0
  14. app/code/community/CP/Reviewreminder/Model/Resource/Reviewreminder.php +27 -0
  15. app/code/community/CP/Reviewreminder/Model/Resource/Reviewreminder/Collection.php +86 -0
  16. app/code/community/CP/Reviewreminder/Model/Resource/Setup.php +23 -0
  17. app/code/community/CP/Reviewreminder/Model/Reviewreminder.php +30 -0
  18. app/code/community/CP/Reviewreminder/controllers/Adminhtml/ClosedremindersController.php +91 -0
  19. app/code/community/CP/Reviewreminder/controllers/Adminhtml/ManageremindersController.php +278 -0
  20. app/code/community/CP/Reviewreminder/controllers/IndexController.php +74 -0
  21. app/code/community/CP/Reviewreminder/etc/adminhtml.xml +87 -0
  22. app/code/community/CP/Reviewreminder/etc/config.xml +172 -0
  23. app/code/community/CP/Reviewreminder/etc/system.xml +118 -0
  24. app/code/community/CP/Reviewreminder/sql/cp_reviewreminder_setup/install-1.0.0.php +84 -0
  25. app/design/adminhtml/default/default/layout/cp_reviewreminder.xml +34 -0
  26. app/etc/modules/CP_Reviewreminder.xml +30 -0
  27. app/locale/en_US/template/email/cp_reviewreminder.html +51 -0
  28. package.xml +18 -0
app/code/community/CP/Reviewreminder/Block/Adminhtml/AddReminder/Grid.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Block_Adminhtml_AddReminder_Grid extends Mage_Adminhtml_Block_Widget_Grid
22
+ {
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('addReminderGrid');
27
+ $this->setDefaultSort('created_at');
28
+ $this->setDefaultDir('DESC');
29
+ $this->setSaveParametersInSession(true);
30
+ }
31
+
32
+ /*
33
+ * Customer name filter to the grid
34
+ * @param object $collection
35
+ * @param object $column
36
+ * @return CP_ReviewReminder_Block_Adminhtml_Reviewreminder_Grid
37
+ */
38
+ protected function _customerNameCondition($collection, $column)
39
+ {
40
+ if (!$value = $column->getFilter()->getValue()) {
41
+ return $this;
42
+ }
43
+
44
+ $customerFullName = $value;
45
+ $arrCustomerFullName = explode(' ', $customerFullName);
46
+
47
+ $customerFirstName = isset($arrCustomerFullName[0])? $arrCustomerFullName[0]: '';
48
+ $customerLastName = isset($arrCustomerFullName[1])? $arrCustomerFullName[1]: '';
49
+
50
+ if(!empty($customerFirstName)){
51
+ $collection->getSelect()
52
+ ->where("customer_firstname like '%" . $customerFirstName."%'");
53
+ }
54
+
55
+ if(!empty($customerLastName)){
56
+ $collection->getSelect()
57
+ ->where("customer_lastname like '%" . $customerLastName."%'");
58
+ }
59
+ //echo $collection->getSelect();
60
+ return $this;
61
+ }
62
+
63
+ /*
64
+ * Product name filter to the grid
65
+ * @param object $collection
66
+ * @param object $column
67
+ * @return CP_ReviewReminder_Block_Adminhtml_Reviewreminder_Grid
68
+ */
69
+ protected function _productNameCondition($collection, $column)
70
+ {
71
+ if (!$value = $column->getFilter()->getValue()) {
72
+ return $this;
73
+ }
74
+
75
+ $productName = $value;
76
+ if(!empty($productName)){
77
+ $collection->getSelect()
78
+ ->where("pet.value='" . $productName."'");
79
+ }
80
+ //echo $collection->getSelect();
81
+ return $this;
82
+ }
83
+
84
+ /**
85
+ * Prepare reviewreminder grid collection object
86
+ *
87
+ * @return CP_ReviewReminder_Block_Adminhtml_Reviewreminder_Grid
88
+ */
89
+ protected function _prepareCollection()
90
+ {
91
+ //get order item collection
92
+ $collection = Mage::getModel('sales/order_item')->getCollection();
93
+ //get order table
94
+ $orderTable = Mage::getSingleton('core/resource')->getTableName('sales/order');
95
+ //get review reminder table
96
+ $reviewReminderTable = Mage::getSingleton('core/resource')->getTableName('cp_reviewreminder/reviewreminder');
97
+
98
+ //join with sales_flat_order table
99
+ $collection->getSelect()
100
+ ->joinLeft(array('sfo' => $orderTable), 'main_table.order_id=sfo.entity_id',
101
+ array('sfo.entity_id', 'sfo.status', 'sfo.customer_firstname', 'sfo.customer_lastname', 'sfo.customer_id'));
102
+
103
+ //Check is customer_id not null
104
+ $collection->getSelect()
105
+ ->where('sfo.customer_id IS NOT NULL');
106
+
107
+ //Check is reminder already added
108
+ $collection->getSelect()
109
+ ->where('(sfo.customer_id, main_table.product_id) NOT IN (
110
+ SELECT crr.customer_id, crr.product_id
111
+ FROM ' . $reviewReminderTable . ' AS crr)');
112
+
113
+ //Check is review already added
114
+ //get review table
115
+ $reviewTable = Mage::getSingleton('core/resource')->getTableName('review/review');
116
+ //get review detail table
117
+ $reviewDetailTable = Mage::getSingleton('core/resource')->getTableName('review/review_detail');
118
+ $collection->getSelect()
119
+ ->where('(sfo.customer_id, main_table.product_id) NOT IN (
120
+ SELECT rd.customer_id , r.entity_pk_value AS product_id
121
+ FROM ' . $reviewTable . ' as r
122
+ JOIN ' . $reviewDetailTable . ' as rd ON rd.review_id=r.review_id
123
+ WHERE r.entity_id=1)
124
+ ');
125
+
126
+
127
+ /* @var $collection Mage_Sales_Model_Resource_Order_Collection */
128
+ $this->setCollection($collection);
129
+ //echo $collection->getSelect();
130
+ return parent::_prepareCollection();
131
+ }
132
+
133
+ /**
134
+ * Prepare default grid column
135
+ *
136
+ * @return CP_ReviewReminder_Block_Adminhtml_Reviewreminder_Grid
137
+ */
138
+ protected function _prepareColumns()
139
+ {
140
+ $yesno = Mage::getModel('adminhtml/system_config_source_yesno')->toArray();
141
+
142
+ $this->addColumn('order_id', array(
143
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Order #'),
144
+ 'sortable'=>true,
145
+ 'index'=>'entity_id',
146
+ 'width' => '100px',
147
+ ));
148
+
149
+ $this->addColumn('customer_name', array(
150
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Customer Name'),
151
+ 'sortable'=>true,
152
+ 'index'=>'customer_firstname',
153
+ 'width'=>'60px',
154
+ 'renderer' => 'cp_reviewreminder/adminhtml_addReminder_renderer_customerName',
155
+ 'filter_condition_callback' => array($this, '_customerNameCondition')
156
+ ));
157
+
158
+ /*$this->addColumn('product_name', array(
159
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Product Name'),
160
+ 'sortable'=>true,
161
+ 'index'=>'name',
162
+ ));*/
163
+
164
+ $this->addColumn('order_status', array(
165
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Order Status'),
166
+ 'sortable'=>true,
167
+ 'index'=>'status',
168
+ 'type' => 'options',
169
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
170
+ ));
171
+
172
+ $this->addColumn('order_date', array(
173
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Order Date'),
174
+ 'sortable'=>true,
175
+ 'index'=>'created_at',
176
+ 'type' => 'datetime',
177
+ ));
178
+
179
+ return $this;
180
+ }
181
+
182
+ /**
183
+ * Mass Actions.
184
+ *
185
+ * These used basically to do operations on multiple rows together.
186
+ */
187
+ protected function _prepareMassaction()
188
+ {
189
+ /**
190
+ * id is the database column that serves as the unique identifier
191
+ */
192
+ $this->setMassactionIdField('item_id');
193
+
194
+ /**
195
+ * By using this we can set name of checkbox, used for selection. Which
196
+ * is used to pass all the ids to the controller.
197
+ */
198
+ $this->getMassactionBlock()->setFormFieldName('itemIds');
199
+
200
+ /**
201
+ * url - sets url for the delete action
202
+ * confirm - This shows the user a confirm dialog before submitting the URL
203
+ */
204
+ $this->getMassactionBlock()->addItem('addReminder', array(
205
+ 'label' => Mage::helper('cp_reviewreminder')->__('Add Reminder'),
206
+ 'url' => $this->getUrl('*/*/massAddReminder'),
207
+ 'confirm' => Mage::helper('cp_reviewreminder')->__('Are you sure?')
208
+ ));
209
+ return $this;
210
+ }
211
+ }
app/code/community/CP/Reviewreminder/Block/Adminhtml/AddReminder/Renderer/CustomerName.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Block_Adminhtml_Addreminder_Renderer_CustomerName extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
22
+ {
23
+ /**
24
+ * Render custome name
25
+ * @param object $row order data object
26
+ * @return string
27
+ */
28
+ public function render(Varien_Object $row)
29
+ {
30
+ $firstName = $row->getData('customer_firstname');
31
+ $lastName = $row->getData('customer_lastname');
32
+ if (!empty($firstName) || !empty($lastName)) {
33
+
34
+ if (!empty($lastName)) {
35
+ return $firstName . ' ' . $lastName;
36
+ } else {
37
+ return $firstName;
38
+ }
39
+ }
40
+ }
41
+ }
42
+ ?>
app/code/community/CP/Reviewreminder/Block/Adminhtml/Addreminder.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Block_Adminhtml_Addreminder extends Mage_Adminhtml_Block_Widget_Grid_Container
22
+ {
23
+ public function __construct()
24
+ {
25
+ $this->_controller = 'adminhtml_addReminder';
26
+ $this->_blockGroup = 'cp_reviewreminder';
27
+ $this->_headerText = Mage::helper('cp_reviewreminder')->__('Add Reminders Manually');
28
+ parent::__construct();
29
+ $this->_removeButton('add');
30
+ }
31
+ }
32
+
app/code/community/CP/Reviewreminder/Block/Adminhtml/Closedreminder.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Block_Adminhtml_Closedreminder extends Mage_Adminhtml_Block_Widget_Grid_Container
22
+ {
23
+ public function __construct()
24
+ {
25
+ $this->_controller = 'adminhtml_closedreminder';
26
+ $this->_blockGroup = 'cp_reviewreminder';
27
+ $this->_headerText = Mage::helper('cp_reviewreminder')->__('Closed Reminders');
28
+
29
+ parent::__construct();
30
+
31
+ $this->_removeButton('add');
32
+ }
33
+ }
34
+
app/code/community/CP/Reviewreminder/Block/Adminhtml/Closedreminder/Grid.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Block_Adminhtml_Closedreminder_Grid extends Mage_Adminhtml_Block_Widget_Grid
22
+ {
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('closedremindersGrid');
27
+ $this->setDefaultSort('reminder_id');
28
+ $this->setDefaultDir('DESC');
29
+ $this->setSaveParametersInSession(true);
30
+ }
31
+
32
+ /*
33
+ * Customer name filter to the grid
34
+ * @param object $collection
35
+ * @param object $column
36
+ * @return CP_ReviewReminder_Block_Adminhtml_Closedreminder_Grid
37
+ */
38
+ protected function _customerNameCondition($collection, $column)
39
+ {
40
+ if (!$value = $column->getFilter()->getValue()) {
41
+ return $this;
42
+ }
43
+
44
+ $customerFullName = $value;
45
+ $arrCustomerFullName = explode(' ', $customerFullName);
46
+
47
+ $customerFirstName = isset($arrCustomerFullName[0])? $arrCustomerFullName[0]: '';
48
+ $customerLastName = isset($arrCustomerFullName[1])? $arrCustomerFullName[1]: '';
49
+
50
+ if(!empty($customerFirstName)){
51
+ $collection->getSelect()
52
+ ->where("cust_ent1.value like '%" . $customerFirstName."%'");
53
+ }
54
+
55
+ if(!empty($customerLastName)){
56
+ $collection->getSelect()
57
+ ->where("cust_ent2.value like '%" . $customerLastName."%'");
58
+ }
59
+ //echo $collection->getSelect();
60
+ return $this;
61
+ }
62
+
63
+ /*
64
+ * Product name filter to the grid
65
+ * @param object $collection
66
+ * @param object $column
67
+ * @return Clarion_ReviewReminder_Block_Adminhtml_Closedreminder_Grid
68
+ */
69
+ protected function _productNameCondition($collection, $column)
70
+ {
71
+ if (!$value = $column->getFilter()->getValue()) {
72
+ return $this;
73
+ }
74
+
75
+ $productName = $value;
76
+ if(!empty($productName)){
77
+ $collection->getSelect()
78
+ ->where("pet.value='" . $productName."'");
79
+ }
80
+ //echo $collection->getSelect();
81
+ return $this;
82
+ }
83
+
84
+ /**
85
+ * Prepare closedreminder grid collection object
86
+ *
87
+ * @return Clarion_ReviewReminder_Block_Adminhtml_Closedreminder_Grid
88
+ */
89
+ protected function _prepareCollection()
90
+ {
91
+ $collection = Mage::getModel('cp_reviewreminder/reviewreminder')->getCollection()
92
+ ->addCustomerNameToSelect()
93
+ ->addProductNameToSelect()
94
+ ->addFieldToFilter('is_review_added', 1);
95
+
96
+ /* @var $collection Clarion_ReviewReminder_Model_Resource_Reviewreminder_Collection */
97
+ $this->setCollection($collection);
98
+ //echo $collection->getSelect();
99
+ return parent::_prepareCollection();
100
+ }
101
+
102
+ /**
103
+ * Prepare default grid column
104
+ *
105
+ * @return Clarion_ReviewReminder_Block_Adminhtml_Closedreminder_Grid
106
+ */
107
+ protected function _prepareColumns()
108
+ {
109
+ $yesno = Mage::getModel('adminhtml/system_config_source_yesno')->toArray();
110
+
111
+ $this->addColumn('reminder_id', array(
112
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Reminder Id'),
113
+ 'sortable'=>true,
114
+ 'index'=>'reminder_id',
115
+ 'width' => '100px',
116
+ ));
117
+
118
+ $this->addColumn('order_id', array(
119
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Order #'),
120
+ 'sortable'=>true,
121
+ 'index'=>'order_id',
122
+ 'width' => '100px',
123
+ ));
124
+
125
+ $this->addColumn('customer_name', array(
126
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Customer Name'),
127
+ 'sortable'=>true,
128
+ 'index'=>'customer_name',
129
+ 'width'=>'60px',
130
+ 'filter_condition_callback' => array($this, '_customerNameCondition')
131
+ ));
132
+
133
+ /*$this->addColumn('product_name', array(
134
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Product Name'),
135
+ 'sortable'=>true,
136
+ 'index'=>'product_name',
137
+ 'filter_condition_callback' => array($this, '_productNameCondition')
138
+ ));*/
139
+
140
+ $this->addColumn('is_reminder_sent', array(
141
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Reminder Sent'),
142
+ 'sortable'=>true,
143
+ 'index'=>'is_reminder_sent',
144
+ 'type' => 'options',
145
+ 'options' => $yesno,
146
+ 'width' => '100px',
147
+ ));
148
+
149
+ $this->addColumn('sent_at', array(
150
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Sent At'),
151
+ 'sortable'=>true,
152
+ 'index'=>'sent_at',
153
+ 'type' => 'datetime',
154
+ 'width' => '100px',
155
+ ));
156
+
157
+ $this->addColumn('reminder_count', array(
158
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Reminder #'),
159
+ 'sortable'=>true,
160
+ 'index'=>'reminder_count',
161
+ 'width' => '100px',
162
+ ));
163
+ }
164
+
165
+ /**
166
+ * Mass Actions.
167
+ *
168
+ * These used basically to do operations on multiple rows together.
169
+ */
170
+ protected function _prepareMassaction()
171
+ {
172
+ /**
173
+ * id is the database column that serves as the unique identifier
174
+ */
175
+ $this->setMassactionIdField('reminder_id');
176
+
177
+ /**
178
+ * By using this we can set name of checkbox, used for selection. Which
179
+ * is used to pass all the ids to the controller.
180
+ */
181
+ $this->getMassactionBlock()->setFormFieldName('reminderIds');
182
+
183
+ /**
184
+ * url - sets url for the delete action
185
+ * confirm - This shows the user a confirm dialog before submitting the URL
186
+ */
187
+ $this->getMassactionBlock()->addItem('delete', array(
188
+ 'label' => Mage::helper('cp_reviewreminder')->__('Delete'),
189
+ 'url' => $this->getUrl('*/*/massDelete'),
190
+ 'confirm' => Mage::helper('cp_reviewreminder')->__('Are you sure?')
191
+ ));
192
+
193
+ return $this;
194
+ }
195
+ }
app/code/community/CP/Reviewreminder/Block/Adminhtml/Reviewreminder.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Block_Adminhtml_Reviewreminder extends Mage_Adminhtml_Block_Widget_Grid_Container
22
+ {
23
+ public function __construct()
24
+ {
25
+ $this->_controller = 'adminhtml_reviewreminder';
26
+ $this->_blockGroup = 'cp_reviewreminder';
27
+ $this->_headerText = Mage::helper('cp_reviewreminder')->__('Manage Reminders');
28
+ $this->_addButtonLabel = Mage::helper('cp_reviewreminder')->__('Add Reminders Manually');
29
+ parent::__construct();
30
+ $this->_removeButton('add');
31
+ }
32
+ }
33
+
app/code/community/CP/Reviewreminder/Block/Adminhtml/Reviewreminder/Grid.php ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class cp_reviewreminder_Block_Adminhtml_Reviewreminder_Grid extends Mage_Adminhtml_Block_Widget_Grid
22
+ {
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('reviewreminderGrid');
27
+ $this->setDefaultSort('reminder_id');
28
+ $this->setDefaultDir('DESC');
29
+ $this->setSaveParametersInSession(true);
30
+ }
31
+
32
+ /*
33
+ * Customer name filter to the grid
34
+ * @param object $collection
35
+ * @param object $column
36
+ * @return CP_ReviewReminder_Block_Adminhtml_Reviewreminder_Grid
37
+ */
38
+ protected function _customerNameCondition($collection, $column)
39
+ {
40
+ if (!$value = $column->getFilter()->getValue()) {
41
+ return $this;
42
+ }
43
+
44
+ $customerFullName = $value;
45
+ $arrCustomerFullName = explode(' ', $customerFullName);
46
+
47
+ $customerFirstName = isset($arrCustomerFullName[0])? $arrCustomerFullName[0]: '';
48
+ $customerLastName = isset($arrCustomerFullName[1])? $arrCustomerFullName[1]: '';
49
+
50
+ if(!empty($customerFirstName)){
51
+ $collection->getSelect()
52
+ ->where("cust_ent1.value like '%" . $customerFirstName."%'");
53
+ }
54
+
55
+ if(!empty($customerLastName)){
56
+ $collection->getSelect()
57
+ ->where("cust_ent2.value like '%" . $customerLastName."%'");
58
+ }
59
+ //echo $collection->getSelect();
60
+ return $this;
61
+ }
62
+
63
+ /*
64
+ * Product name filter to the grid
65
+ * @param object $collection
66
+ * @param object $column
67
+ * @return Clarion_ReviewReminder_Block_Adminhtml_Reviewreminder_Grid
68
+ */
69
+ protected function _productNameCondition($collection, $column)
70
+ {
71
+ if (!$value = $column->getFilter()->getValue()) {
72
+ return $this;
73
+ }
74
+
75
+ $productName = $value;
76
+ if(!empty($productName)){
77
+ $collection->getSelect()
78
+ ->where("pet.value='" . $productName."'");
79
+ }
80
+ //echo $collection->getSelect();
81
+ return $this;
82
+ }
83
+
84
+ /**
85
+ * Prepare reviewreminder grid collection object
86
+ *
87
+ * @return Clarion_ReviewReminder_Block_Adminhtml_Reviewreminder_Grid
88
+ */
89
+ protected function _prepareCollection()
90
+ {
91
+ $collection = Mage::getModel('cp_reviewreminder/reviewreminder')->getCollection()
92
+ ->addCustomerNameToSelect()
93
+ ->addProductNameToSelect()
94
+ ->addOrderStatusAndDateToSelect()
95
+ ->addFieldToFilter('is_review_added', 0);
96
+
97
+ /* @var $collection Clarion_ReviewReminder_Model_Resource_Reviewreminder_Collection */
98
+ $this->setCollection($collection);
99
+ //echo $collection->getSelect();
100
+ return parent::_prepareCollection();
101
+ }
102
+
103
+ /**
104
+ * Prepare default grid column
105
+ *
106
+ * @return Clarion_ReviewReminder_Block_Adminhtml_Reviewreminder_Grid
107
+ */
108
+ protected function _prepareColumns()
109
+ {
110
+ $yesno = Mage::getModel('adminhtml/system_config_source_yesno')->toArray();
111
+
112
+ $this->addColumn('reminder_id', array(
113
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Reminder Id'),
114
+ 'sortable'=>true,
115
+ 'index'=>'reminder_id',
116
+ 'width' => '100px',
117
+ ));
118
+
119
+ $this->addColumn('order_incid', array(
120
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Order #'),
121
+ 'sortable'=>true,
122
+ 'index'=>'order_incid',
123
+ 'width' => '100px',
124
+ ));
125
+
126
+ $this->addColumn('customer_name', array(
127
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Customer Name'),
128
+ 'sortable'=>true,
129
+ 'index'=>'customer_name',
130
+ 'width'=>'60px',
131
+ 'filter_condition_callback' => array($this, '_customerNameCondition')
132
+ ));
133
+
134
+ /*$this->addColumn('product_name', array(
135
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Product Name'),
136
+ 'sortable'=>true,
137
+ 'index'=>'product_name',
138
+ 'filter_condition_callback' => array($this, '_productNameCondition')
139
+ ));*/
140
+
141
+ $this->addColumn('order_status', array(
142
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Order Status'),
143
+ 'sortable'=>true,
144
+ 'index'=>'order_status',
145
+ 'type' => 'options',
146
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
147
+ 'filter_condition_callback' => array($this, '_orderStausCondition'),
148
+ 'width' => '100px',
149
+ ));
150
+
151
+ $this->addColumn('order_date', array(
152
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Order Date'),
153
+ 'sortable'=>true,
154
+ 'index'=>'order_date',
155
+ 'type' => 'date',
156
+ 'filter_condition_callback' => array($this, '_orderDateCondition'),
157
+ 'width' => '120px',
158
+ ));
159
+
160
+ $this->addColumn('is_reminder_sent', array(
161
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Reminder Sent'),
162
+ 'sortable'=>true,
163
+ 'index'=>'is_reminder_sent',
164
+ 'type' => 'options',
165
+ 'options' => $yesno,
166
+ 'width' => '100px',
167
+ ));
168
+
169
+ $this->addColumn('sent_at', array(
170
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Sent At'),
171
+ 'sortable'=>true,
172
+ 'index'=>'sent_at',
173
+ 'type' => 'datetime',
174
+ 'width' => '100px',
175
+ ));
176
+
177
+ $this->addColumn('reminder_count', array(
178
+ 'header'=>Mage::helper('cp_reviewreminder')->__('Reminder #'),
179
+ 'sortable'=>true,
180
+ 'index'=>'reminder_count',
181
+ 'width' => '100px',
182
+ ));
183
+ }
184
+
185
+ /**
186
+ * Mass Actions.
187
+ *
188
+ * These used basically to do operations on multiple rows together.
189
+ */
190
+ protected function _prepareMassaction()
191
+ {
192
+ /**
193
+ * id is the database column that serves as the unique identifier
194
+ */
195
+ $this->setMassactionIdField('reminder_id');
196
+
197
+ /**
198
+ * By using this we can set name of checkbox, used for selection. Which
199
+ * is used to pass all the ids to the controller.
200
+ */
201
+ $this->getMassactionBlock()->setFormFieldName('reminderIds');
202
+
203
+ /**
204
+ * url - sets url for the delete action
205
+ * confirm - This shows the user a confirm dialog before submitting the URL
206
+ */
207
+ $this->getMassactionBlock()->addItem('delete', array(
208
+ 'label' => Mage::helper('cp_reviewreminder')->__('Delete'),
209
+ 'url' => $this->getUrl('*/*/massDelete'),
210
+ 'confirm' => Mage::helper('cp_reviewreminder')->__('Are you sure?')
211
+ ));
212
+
213
+ //Send reminder mass action
214
+ $this->getMassactionBlock()->addItem('Send reminder', array(
215
+ 'label' => Mage::helper('cp_reviewreminder')->__('Send reminder'),
216
+ 'url' => $this->getUrl('*/*/massSendReminder'),
217
+ 'confirm' => Mage::helper('cp_reviewreminder')->__('Are you sure?')
218
+ ));
219
+
220
+ return $this;
221
+ }
222
+
223
+ /*
224
+ * Order status filter to the grid
225
+ * @param object $collection
226
+ * @param object $column
227
+ * @return Clarion_ReviewReminder_Block_Adminhtml_Reviewreminder_Grid
228
+ */
229
+ protected function _orderStausCondition($collection, $column)
230
+ {
231
+ if (!$value = $column->getFilter()->getValue()) {
232
+ return $this;
233
+ }
234
+
235
+ $orderStatus = $value;
236
+ if(!empty($orderStatus)){
237
+ $collection->getSelect()
238
+ ->where("sot.status='" . $orderStatus."'");
239
+ }
240
+ //echo $collection->getSelect();
241
+ return $this;
242
+ }
243
+
244
+ /*
245
+ * Order date filter to the grid
246
+ * @param object $collection
247
+ * @param object $column
248
+ * @return Clarion_ReviewReminder_Block_Adminhtml_Reviewreminder_Grid
249
+ */
250
+ protected function _orderDateCondition($collection, $column)
251
+ {
252
+ if (!$value = $column->getFilter()->getValue()) {
253
+ return $this;
254
+ }
255
+
256
+ $orderDate = $value;
257
+
258
+ $fromDate = isset($orderDate['from']) ? (is_object($orderDate['from']) ? date('Y-m-d', $orderDate['from']->get()) :'' ) : '';
259
+ $toDate = isset($orderDate['to']) ? (is_object($orderDate['to']) ? date('Y-m-d', $orderDate['to']->get()) :'' ) : '';
260
+
261
+ if(!empty($fromDate) && !empty($toDate)){
262
+ $collection->getSelect()
263
+ ->where("DATE(sot.created_at) BETWEEN '".$fromDate."' AND '".$toDate."' ");
264
+ }
265
+ //echo $collection->getSelect();
266
+ return $this;
267
+ }
268
+ }
app/code/community/CP/Reviewreminder/Helper/Data.php ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Helper_Data extends Mage_Core_Helper_Abstract
22
+ {
23
+ /**
24
+ * Config extension enabled
25
+ *
26
+ * @var string
27
+ */
28
+ const XML_PATH_EXTENSION_ENABLED = 'review_reminder/status/extension_enable';
29
+ /**
30
+ * Config order status
31
+ *
32
+ * @var string
33
+ */
34
+ const XML_PATH_ORDER_STATUS = 'review_reminder/general_settings/order_status';
35
+
36
+ /**
37
+ * Config number of days after order placed
38
+ *
39
+ * @var string
40
+ */
41
+ const XML_PATH_NUM_OF_DAYS_AFTER_ORDER = 'review_reminder/general_settings/number_of_days';
42
+
43
+ /**
44
+ * check is reminder data already added
45
+ *
46
+ * @param $productId
47
+ * @param $cutomerId
48
+ * @return boolean
49
+ */
50
+ public function isReminderExist($productId, $cutomerId)
51
+ {
52
+ if(empty($productId) || empty($cutomerId)){
53
+ return false;
54
+ }
55
+
56
+ $collection = Mage::getModel('cp_reviewreminder/reviewreminder')->getCollection()
57
+ ->addFieldToFilter('customer_id', $cutomerId)
58
+ ->addFieldToFilter('product_id', $productId);
59
+ //echo $collection->getSelect();
60
+
61
+ if($collection->count() > 0){
62
+ return true;
63
+ }
64
+ return false;
65
+ }
66
+
67
+ /**
68
+ * Get config order status
69
+ *
70
+ * @param integer|string|Mage_Core_Model_Store $store
71
+ * @return string
72
+ */
73
+ public function getConfigOrderStatus($store = null)
74
+ {
75
+ return Mage::getStoreConfig(self::XML_PATH_ORDER_STATUS, $store);
76
+ }
77
+
78
+ /**
79
+ * Get order status
80
+ *
81
+ * @param Clarion_ReviewReminder_Model_Reviewreminder $reminder
82
+ * @return string
83
+ */
84
+ public function getOrderStatus($reminder)
85
+ {
86
+ $orderId = $reminder->getOrderId();
87
+ $order = Mage::getModel('sales/order')->load($orderId);
88
+ $status = $order->getStatus();
89
+
90
+ if($status){
91
+ return $status;
92
+ }
93
+ return false;
94
+ }
95
+
96
+ /**
97
+ * Check is order status match with config order status
98
+ *
99
+ * @param Clarion_ReviewReminder_Model_Reviewreminder $reminder
100
+ * @return boolean
101
+ */
102
+ public function isOrderStatusMatchWithConfig($reminder)
103
+ {
104
+ $storeId = Mage::app()->getStore()->getStoreId();
105
+ $configOrderStatus = $this->getConfigOrderStatus($storeId);
106
+ $orderStatus = $this->getOrderStatus($reminder);
107
+
108
+ if($configOrderStatus == $orderStatus){
109
+ return true;
110
+ } else {
111
+ return false;
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Get config number of days after order placed
117
+ *
118
+ * @param integer|string|Mage_Core_Model_Store $store
119
+ * @return int
120
+ */
121
+ public function getConfigNumOfDaysAfterOrder($store = null)
122
+ {
123
+ return Mage::getStoreConfig(self::XML_PATH_NUM_OF_DAYS_AFTER_ORDER, $store);
124
+ }
125
+
126
+ /**
127
+ * Get order date
128
+ *
129
+ * @param Clarion_ReviewReminder_Model_Reviewreminder $reminder
130
+ * @return string
131
+ */
132
+ public function getOrderDate($reminder)
133
+ {
134
+ $orderId = $reminder->getOrderId();
135
+ $order = Mage::getModel('sales/order')->load($orderId);
136
+ $orderDate = $order->getCreatedAt();
137
+
138
+ if($orderDate){
139
+ return $orderDate;
140
+ }
141
+ return false;
142
+ }
143
+
144
+ /**
145
+ * Get number of days after order placed
146
+ *
147
+ * @param $orderDate
148
+ * @return int
149
+ */
150
+ public function getNumOfDaysAfterOrder($orderDate)
151
+ {
152
+ $days = 0;
153
+ if (version_compare(phpversion(), '5.3.0', '<')===true) {
154
+ $diff = (time() - strtotime($orderDate));
155
+ $days = floor($diff/(60*60*24));
156
+ } else {
157
+ $currentDate = new DateTime();
158
+ $objOrderDate = new DateTime($orderDate);
159
+ $interval = $currentDate->diff($objOrderDate);
160
+ $days = $interval->d;
161
+ }
162
+ return $days;
163
+ }
164
+
165
+ /**
166
+ * check is match number of days after order placed with config number of days
167
+ *
168
+ * @param Clarion_ReviewReminder_Model_Reviewreminder $reminder
169
+ * @return boolean
170
+ */
171
+ public function isMatchNumOfDaysAfterOrder($reminder)
172
+ {
173
+ $storeId = Mage::app()->getStore()->getStoreId();
174
+ $configNumOfDaysAfterOrder = $this->getConfigNumOfDaysAfterOrder($storeId);
175
+ $orderDate = $this->getOrderDate($reminder);
176
+ $numOfDaysAfterOrder = $this->getNumOfDaysAfterOrder($orderDate);
177
+
178
+ if($numOfDaysAfterOrder >= $configNumOfDaysAfterOrder){
179
+ return true;
180
+ } else {
181
+ return false;
182
+ }
183
+ }
184
+
185
+ /**
186
+ * check is reminder satishfies all the config conditions.
187
+ *
188
+ * @param Clarion_ReviewReminder_Model_Reviewreminder $reminder
189
+ * @return boolean
190
+ */
191
+ public function isMatchAllConfigSettings($reminder)
192
+ {
193
+ if(!$this->isOrderStatusMatchWithConfig($reminder)){
194
+ return false;
195
+ }
196
+
197
+ if(!$this->isMatchNumOfDaysAfterOrder($reminder)){
198
+ return false;
199
+ }
200
+
201
+ return true;
202
+ }
203
+
204
+ /**
205
+ * Check is review already added by customer
206
+ *
207
+ * @param $productId
208
+ * @param $cutomerId
209
+ * @return boolean
210
+ */
211
+ public function isReviewAlreadyAdded($productId, $cutomerId)
212
+ {
213
+ if(empty($productId) || empty($cutomerId)){
214
+ return false;
215
+ }
216
+
217
+ $collection = Mage::getModel('review/review')->getProductCollection()
218
+ ->addCustomerFilter($cutomerId)
219
+ ->addEntityFilter($productId);
220
+
221
+ //echo $collection->getSelect();
222
+ //exit;
223
+
224
+ if($collection->count() > 0){
225
+ return true;
226
+ }
227
+ return false;
228
+ }
229
+
230
+ /**
231
+ * Check is extension enabled
232
+ *
233
+ * @return boolean
234
+ */
235
+ public function isExtensionEnabled()
236
+ {
237
+ if($this->getConfigExtensionEnabled()){
238
+ return true;
239
+ }else{
240
+ return false;
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Get config extension enabled
246
+ *
247
+ * @param integer|string|Mage_Core_Model_Store $store
248
+ * @return string
249
+ */
250
+ public function getConfigExtensionEnabled($store = null)
251
+ {
252
+ return Mage::getStoreConfig(self::XML_PATH_EXTENSION_ENABLED, $store);
253
+ }
254
+
255
+ }
app/code/community/CP/Reviewreminder/Helper/Mail.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Helper_Mail extends Mage_Core_Helper_Abstract
22
+ {
23
+ const XML_PATH_EMAIL_TEMPLATE = 'review_reminder/general_settings/email_template';
24
+ const XML_PATH_EMAIL_SENDER = 'review_reminder/general_settings/sender_email_identity';
25
+
26
+ /**
27
+ * Send reminder email
28
+ *
29
+ * @param Clarion_ReviewReminder_Model_Reviewreminder $reminder
30
+ * @return boolean
31
+ */
32
+ public function sendReminderEmail($reminder)
33
+ {
34
+ //echo '<pre>'; print_r($reminder); die;
35
+
36
+ //check is extension enabled
37
+ if (!Mage::helper('cp_reviewreminder')->isExtensionEnabled()) {
38
+ return;
39
+ }
40
+
41
+ $customerId = $reminder->getCustomerId();
42
+ if(!$customerId){
43
+ return false;
44
+ }
45
+
46
+ $customer = Mage::getModel('customer/customer')->load($customerId);
47
+ $customerEmail = $customer->getEmail();
48
+ $firstName = $customer->getFirstname();
49
+ $productId = $reminder->getProductId();
50
+ $product = Mage::getModel('catalog/product')->load($productId);
51
+ $productName = $product->getName();
52
+ $categoryId = $this->getProductCategoryId($product);
53
+
54
+
55
+
56
+ //Send multiple product detail in reviewReminder email
57
+ $orderId = $reminder->getorder_id();
58
+ $order = Mage::getModel('sales/order')->load($orderId);
59
+ $order->getAllVisibleItems();
60
+
61
+ $orderItems = $order->getItemsCollection()
62
+ ->addAttributeToSelect('*')
63
+ ->load();
64
+
65
+
66
+ foreach($orderItems as $sItem)
67
+ {
68
+
69
+ $proId = $sItem->getProductId();
70
+ $proName = $sItem->getName();
71
+
72
+ $product = Mage::getModel('catalog/product')->load($proId);
73
+ $proImage = Mage::getModel('catalog/product_media_config')->getMediaUrl( $product->getSmallImage());
74
+ $catids = $this->getProductCategoryId($product);
75
+
76
+ $reviewUrl = Mage::getBaseUrl()."reviewreminder/index/addReview/id/$proId/category/$catids";
77
+
78
+ $html .= '<div style="clear:both; margin-bottom:18px; margin-top:12px; overflow:hidden; width:100%;">';
79
+ $html .= '<img style="float:left; margin-right:10px;" src="'.$proImage.'" height="50" width="50" />'." ".$proName;
80
+ $html .= '<br>';
81
+ $html .= '<a href="'.$reviewUrl.'" target="_blank">Write a review</a>';
82
+ $html .= '</div>';
83
+ }
84
+
85
+
86
+ $translate = Mage::getSingleton('core/translate');
87
+ /* @var $translate Mage_Core_Model_Translate */
88
+
89
+ $translate->setTranslateInline(false);
90
+ try {
91
+
92
+ $mailTemplate = Mage::getModel('core/email_template');
93
+
94
+ /* @var $mailTemplate Mage_Core_Model_Email_Template */
95
+
96
+ //get configured email template
97
+ $template = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, Mage::app()->getStore()->getId());
98
+
99
+ $mailSender = Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER, Mage::app()->getStore()->getId());
100
+
101
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>Mage::app()->getStore()->getId()))
102
+ ->sendTransactional(
103
+ $template,
104
+ $mailSender,
105
+ $customerEmail,
106
+ $firstName,
107
+ array(
108
+ 'firstName' => $firstName,
109
+ 'productId' => $productId,
110
+ 'productDetail' => $html,
111
+ 'categoryId' => $categoryId
112
+ )
113
+ );
114
+
115
+ if (!$mailTemplate->getSentSuccess()) {
116
+ throw new Exception();
117
+ }
118
+
119
+ $translate->setTranslateInline(true);
120
+ //Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cp_reviewreminder')->__('Your reminder sent successfully.'));
121
+ //$this->_redirect('*/*/');
122
+ return true;
123
+ } catch (Exception $ex) {
124
+ $translate->setTranslateInline(true);
125
+ //Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cp_reviewreminder')->__('Unable to send reminder. Please, try again later'));
126
+ // $this->_redirect('*/*/');
127
+ return false;
128
+ }
129
+ }
130
+
131
+ /**
132
+ * Get product category id
133
+ *
134
+ * @param Mage_Catalog_Model_Product $product
135
+ * @return boolean/int categoryId
136
+ */
137
+ public function getProductCategoryId($product) {
138
+ /* @var $product Mage_Catalog_Model_Product */
139
+ if ($product->getId()) {
140
+ $categoryIds = $product->getCategoryIds();
141
+ if (is_array($categoryIds) and count($categoryIds) > 0) {
142
+ $categoryId = (isset($categoryIds[0]) ? $categoryIds[0] : null);
143
+ return $categoryId;
144
+ };
145
+ }
146
+ return false;
147
+ }
148
+ }
app/code/community/CP/Reviewreminder/Model/Adminhtml/System/Config/Source/Days.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Model_Adminhtml_System_Config_Source_Days
22
+ {
23
+ public function toOptionArray()
24
+ {
25
+ //create option array for days
26
+ $options = array();
27
+ $days = range(1, 20);
28
+ if(!empty($days)){
29
+ foreach ($days as $day) {
30
+ $options[]= array('value'=>$day, 'label'=>Mage::helper('cp_reviewreminder')->__($day));
31
+ }
32
+ }
33
+ return $options;
34
+ }
35
+ }
app/code/community/CP/Reviewreminder/Model/Adminhtml/System/Config/Source/Status.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Model_Adminhtml_System_Config_Source_Status
22
+ {
23
+ public function toOptionArray($isMultiselect = false)
24
+ {
25
+ $options = array(
26
+ array('value'=>'canceled', 'label'=>Mage::helper('cp_reviewreminder')->__('Canceled')),
27
+ array('value'=>'closed', 'label'=>Mage::helper('cp_reviewreminder')->__('Closed')),
28
+ array('value'=>'complete', 'label'=>Mage::helper('cp_reviewreminder')->__('Complete')),
29
+ array('value'=>'holded', 'label'=>Mage::helper('cp_reviewreminder')->__('On Hold')),
30
+ array('value'=>'pending', 'label'=>Mage::helper('cp_reviewreminder')->__('Pending')),
31
+ array('value'=>'processing', 'label'=>Mage::helper('cp_reviewreminder')->__('Processing')),
32
+ );
33
+
34
+ /*
35
+ $statuses = Mage::getModel('sales/order_status')->getResourceCollection()->getData();
36
+ $options = array();
37
+ if(!empty($statuses) && is_array($statuses)){
38
+ foreach ($statuses as $status) {
39
+ $options[] = array('value'=>$status['status'], 'label'=>Mage::helper('cp_reviewreminder')->__($status['label']));
40
+ }
41
+ }
42
+ */
43
+
44
+ if(!$isMultiselect){
45
+
46
+ array_unshift($options, array('value'=>'', 'label'=>Mage::helper('cp_reviewreminder')->__('--Please Select--')));
47
+
48
+ }
49
+ return $options;
50
+ }
51
+ }
app/code/community/CP/Reviewreminder/Model/Adminhtml/System/Config/Source/Times.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Model_Adminhtml_System_Config_Source_Times
22
+ {
23
+ public function toOptionArray()
24
+ {
25
+ //create option array for times
26
+ $options = array();
27
+ $times = range(1, 5);
28
+ if(!empty($times)){
29
+ foreach ($times as $time) {
30
+ $options[]= array('value'=>$time, 'label'=>Mage::helper('cp_reviewreminder')->__($time));
31
+ }
32
+ }
33
+ return $options;
34
+ }
35
+ }
app/code/community/CP/Reviewreminder/Model/Observer.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Model_Observer
22
+ {
23
+ public function addReviewReminderInformation($observer)
24
+ {
25
+ //check is extension enabled
26
+ if (!Mage::helper('cp_reviewreminder')->isExtensionEnabled()) {
27
+ return;
28
+ }
29
+
30
+ $event = $observer->getEvent();
31
+ $orderIds = $event->getOrderIds();
32
+ if(!empty($orderIds) && is_array($orderIds)){
33
+ foreach ($orderIds as $orderId) {
34
+ //check order id
35
+ if(empty($orderId)){
36
+ continue;
37
+ }
38
+
39
+ //get order information
40
+ $order = Mage::getModel('sales/order')->load($orderId);
41
+ $customerId = $order->getCustomerId();
42
+ //Mage::log("cid=".$customerId);
43
+ //check customer id
44
+ if(empty($customerId)){
45
+ continue;
46
+ }
47
+
48
+ $currentTimestamp = time();
49
+
50
+ //product ids from order ids
51
+ $items = $order->getAllVisibleItems();
52
+ //Mage::log($items);
53
+ $productId = array();
54
+ if(!empty($items) && is_array($items)){
55
+ foreach ($items as $item) {
56
+ $productIds[] = $item->getProductId();
57
+ }
58
+ }
59
+ // Mage::log($productIds);
60
+
61
+ //Save data
62
+ if(!empty($productIds) && is_array($productIds)){
63
+
64
+ $transactionSave = Mage::getModel('core/resource_transaction');
65
+
66
+ foreach ($productIds as $productId) {
67
+ //Check is reminder exist
68
+ if(Mage::Helper('cp_reviewreminder')->isReminderExist($productId, $customerId)){
69
+ continue;
70
+ }
71
+
72
+ //Check is review already added by customer
73
+ if(Mage::Helper('cp_reviewreminder')->isReviewAlreadyAdded($productId, $customerId)){
74
+ continue;
75
+ }
76
+
77
+ //add reminder
78
+ $reviewreminder = Mage::getModel('cp_reviewreminder/reviewreminder');
79
+ $reviewreminder->setOrderIncid($order->getIncrementId());
80
+ $reviewreminder->setOrderId($orderId);
81
+ $reviewreminder->setCustomerId($customerId);
82
+ $reviewreminder->setProductId($productId);
83
+ $reviewreminder->setCreatedAt($currentTimestamp);
84
+
85
+ $transactionSave->addObject($reviewreminder);
86
+ break;
87
+ }
88
+ $transactionSave->save();
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Update reminder after review added
96
+ *
97
+ * @param Varien_Event_Observer $observer
98
+ * @return void
99
+ */
100
+ public function reviewSaveAfter(Varien_Event_Observer $observer)
101
+ {
102
+ $event = $observer->getEvent();
103
+ $review = $event->getObject();
104
+ $productId = $review->getEntityPkValue();
105
+ $cutomerId = $review->getCustomerId();
106
+
107
+ if(empty($productId) || empty($cutomerId)){
108
+ return false;
109
+ }
110
+
111
+ //Check is reminder exist
112
+ $isRecordExist = Mage::Helper('cp_reviewreminder')->isReminderExist($productId, $cutomerId);
113
+ //update review flag
114
+ if($isRecordExist){
115
+ $collection = Mage::getModel('cp_reviewreminder/reviewreminder')->getCollection()
116
+ ->addFieldToFilter('customer_id', $cutomerId)
117
+ ->addFieldToFilter('product_id', $productId);
118
+
119
+ if($collection->count() > 0){
120
+ foreach($collection as $reminder){
121
+ $reminder->setIsReviewAdded(1);
122
+ $reminder->save();
123
+ }
124
+ }
125
+ }
126
+ }
127
+
128
+ /**
129
+ * Cron job method to send product review reminder
130
+ *
131
+ * @param Mage_Cron_Model_Schedule $schedule
132
+ */
133
+ public function sendReviewReminder(Mage_Cron_Model_Schedule $schedule)
134
+ {
135
+ //check is extension enabled
136
+ if (!Mage::helper('cp_reviewreminder')->isExtensionEnabled()) {
137
+ return;
138
+ }
139
+
140
+ //get all records to send reminder
141
+ $collection = Mage::getModel('cp_reviewreminder/reviewreminder')->getCollection()
142
+ ->addFieldToFilter('is_review_added', 0)
143
+ ->addFieldToFilter('reminder_count', array('lt' => Mage::getStoreConfig('review_reminder/general_settings/number_of_times')));
144
+
145
+ if($collection->count() > 0){
146
+ foreach ($collection as $reminder){
147
+ $customerId = $reminder->getCustomerId();
148
+ if(empty($customerId)){
149
+ continue;
150
+ }
151
+
152
+ //Check config settings
153
+ if(!Mage::Helper('cp_reviewreminder')->isMatchAllConfigSettings($reminder)){
154
+ continue;
155
+ }
156
+
157
+ //send reminder mail
158
+ $isMailSent = Mage::Helper('cp_reviewreminder/mail')->sendReminderEmail($reminder);
159
+
160
+ //update reminder record
161
+ if($isMailSent){
162
+ $reminder->setIsReminderSent(1);
163
+ $reminderCount = $reminder->getReminderCount();
164
+
165
+ //Increment reminder count by 1
166
+ $reminderCount = $reminderCount + 1;
167
+ $reminder->setReminderCount($reminderCount);
168
+ $currentTimestamp = time();
169
+ $reminder->setSentAt($currentTimestamp);
170
+ $reminder->setUpdatedAt($currentTimestamp);
171
+ $reminder->save();
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
app/code/community/CP/Reviewreminder/Model/Resource/Reviewreminder.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Model_Resource_Reviewreminder extends Mage_Core_Model_Resource_Db_Abstract
22
+ {
23
+ protected function _construct()
24
+ {
25
+ $this->_init('cp_reviewreminder/reviewreminder', 'reminder_id');
26
+ }
27
+ }
app/code/community/CP/Reviewreminder/Model/Resource/Reviewreminder/Collection.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Model_Resource_Reviewreminder_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
22
+ {
23
+ /**
24
+ * Define collection model
25
+ *
26
+ */
27
+ protected function _construct()
28
+ {
29
+ $this->_init('cp_reviewreminder/reviewreminder');
30
+ }
31
+
32
+ /**
33
+ * Get customer name
34
+ */
35
+ public function addCustomerNameToSelect()
36
+ {
37
+ $customerEntityType = Mage::getModel('eav/config')->getEntityType('customer');//@return Mage_Eav_Model_Entity_Type
38
+ $customerEntityTypeId = $customerEntityType->getEntityTypeId();
39
+ $customerEntityTable = $this->getTable($customerEntityType->getEntityTable()); // Retreive entity table name
40
+
41
+ $firstNameAttribute = Mage::getModel('eav/entity_attribute')->loadByCode($customerEntityTypeId, 'firstname');
42
+ $lastNameAttribute = Mage::getModel('eav/entity_attribute')->loadByCode($customerEntityTypeId, 'lastname');
43
+ $custmerEntityVarchar1 = $customerEntityTable. '_' . $firstNameAttribute->getBackendType();
44
+ $custmerEntityVarchar2 = $customerEntityTable. '_' . $lastNameAttribute->getBackendType();
45
+
46
+ $this->getSelect()
47
+ ->join(array('cust_ent1' => $custmerEntityVarchar1), 'cust_ent1.entity_id=main_table.customer_id', array('firstname' => 'value'))
48
+ ->where('cust_ent1.attribute_id=' . $firstNameAttribute->getAttributeId())
49
+ ->join(array('cust_ent2' => $custmerEntityVarchar2), 'cust_ent2.entity_id=main_table.customer_id', array('lastname' => 'value'))
50
+ ->where('cust_ent2.attribute_id=' . $lastNameAttribute->getAttributeId())
51
+ ->columns(new Zend_Db_Expr("CONCAT(`cust_ent1`.`value`, ' ',`cust_ent2`.`value`) AS customer_name"));
52
+ return $this;
53
+ }
54
+
55
+ /**
56
+ * Get product name
57
+ */
58
+ public function addProductNameToSelect()
59
+ {
60
+ //@return entity type object Mage_Eav_Model_Entity_Type
61
+ $productEntityType = Mage::getModel('eav/config')->getEntityType('catalog_product');
62
+ //get entity type id
63
+ $productEntityTypeId = $productEntityType->getEntityTypeId();
64
+ $productEntityTable = $this->getTable($productEntityType->getEntityTable()); // Retreive entity table name
65
+
66
+ $productName = Mage::getModel('eav/entity_attribute')->loadByCode($productEntityType, 'name');
67
+ $productNameAttributeId = $productName->getAttributeId();
68
+ $productEntityTableByType = $productEntityTable. '_' . $productName->getBackendType();
69
+
70
+ $this->getSelect()
71
+ ->join(array('pet' => $productEntityTableByType), 'pet.entity_id=main_table.product_id', array('product_name' => 'value'))
72
+ ->where('pet.attribute_id=' . $productNameAttributeId);
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Add order status in collection
78
+ */
79
+ public function addOrderStatusAndDateToSelect()
80
+ {
81
+ $this->getSelect()
82
+ ->join(array('sot' => $this->getTable('sales/order')), 'sot.entity_id=main_table.order_id',
83
+ array('order_status' => 'status', 'order_date' => 'created_at' ));
84
+ return $this;
85
+ }
86
+ }
app/code/community/CP/Reviewreminder/Model/Resource/Setup.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2015 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
22
+ {
23
+ }
app/code/community/CP/Reviewreminder/Model/Reviewreminder.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Model_Reviewreminder extends Mage_Core_Model_Abstract
22
+ {
23
+ /**
24
+ * Define resource model
25
+ */
26
+ protected function _construct()
27
+ {
28
+ $this->_init('cp_reviewreminder/reviewreminder');
29
+ }
30
+ }
app/code/community/CP/Reviewreminder/controllers/Adminhtml/ClosedremindersController.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Adminhtml_ClosedremindersController extends Mage_Adminhtml_Controller_Action
22
+ {
23
+ /**
24
+ * Pre dispatch action that allows to redirect to no route page in case of
25
+ * disabled extension through admin panel
26
+ */
27
+ public function preDispatch()
28
+ {
29
+ parent::preDispatch();
30
+
31
+ if (!Mage::helper('cp_reviewreminder')->isExtensionEnabled()) {
32
+ $this->setFlag('', 'no-dispatch', true);
33
+ $this->_redirect('noRoute');
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Init actions
39
+ *
40
+ */
41
+ protected function _initAction()
42
+ {
43
+ // load layout, set active menu and breadcrumbs
44
+ $this->_title($this->__('Review Reminder'));
45
+
46
+ $this->loadLayout()
47
+ ->_setActiveMenu('catalog/review_reminder')
48
+ ->_addBreadcrumb(Mage::helper('cp_reviewreminder')->__('Review Reminder')
49
+ , Mage::helper('cp_reviewreminder')->__('Review Reminder'));
50
+ return $this;
51
+ }
52
+
53
+ /**
54
+ * Index action method
55
+ */
56
+ public function indexAction()
57
+ {
58
+ $this->_initAction();
59
+ $this->renderLayout();
60
+ }
61
+
62
+ /**
63
+ * Multiple reminder deletion
64
+ *
65
+ */
66
+ public function massDeleteAction()
67
+ {
68
+ //Get reminder ids from selected checkbox
69
+ $reminderIds = $this->getRequest()->getParam('reminderIds');
70
+
71
+ if (!is_array($reminderIds)) {
72
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select reminder(s).'));
73
+ } else {
74
+ if (!empty($reminderIds)) {
75
+ try {
76
+ foreach ($reminderIds as $reminderId) {
77
+ $reminder = Mage::getSingleton('cp_reviewreminder/reviewreminder')->load($reminderId);
78
+ //delete record
79
+ $reminder->delete();
80
+ }
81
+ Mage::getSingleton('adminhtml/session')->addSuccess(
82
+ $this->__('Total of %d record(s) have been deleted.', count($reminderIds))
83
+ );
84
+ } catch (Exception $e) {
85
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
86
+ }
87
+ }
88
+ }
89
+ $this->_redirect('*/*/');
90
+ }
91
+ }
app/code/community/CP/Reviewreminder/controllers/Adminhtml/ManageremindersController.php ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_Adminhtml_ManageremindersController extends Mage_Adminhtml_Controller_Action
22
+ {
23
+ /**
24
+ * Pre dispatch action that allows to redirect to no route page in case of
25
+ * disabled extension through admin panel
26
+ */
27
+ public function preDispatch()
28
+ {
29
+ parent::preDispatch();
30
+
31
+ if (!Mage::helper('cp_reviewreminder')->isExtensionEnabled()) {
32
+ $this->setFlag('', 'no-dispatch', true);
33
+ $this->_redirect('noRoute');
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Init actions
39
+ *
40
+ */
41
+ protected function _initAction()
42
+ {
43
+ // load layout, set active menu and breadcrumbs
44
+ $this->_title($this->__('Review Reminder'));
45
+
46
+ $this->loadLayout()
47
+ ->_setActiveMenu('catalog/review_reminder')
48
+ ->_addBreadcrumb(Mage::helper('cp_reviewreminder')->__('Review Reminder')
49
+ , Mage::helper('cp_reviewreminder')->__('Review Reminder'));
50
+ return $this;
51
+ }
52
+
53
+ /**
54
+ * Index action method
55
+ */
56
+ public function indexAction()
57
+ {
58
+ $this->_initAction();
59
+ $this->renderLayout();
60
+ }
61
+
62
+ /**
63
+ * Multiple reminder deletion
64
+ *
65
+ */
66
+ public function massDeleteAction()
67
+ {
68
+ //Get reminder ids from selected checkbox
69
+ $reminderIds = $this->getRequest()->getParam('reminderIds');
70
+
71
+ if (!is_array($reminderIds)) {
72
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select reminder(s).'));
73
+ } else {
74
+ if (!empty($reminderIds)) {
75
+ try {
76
+ foreach ($reminderIds as $reminderId) {
77
+ $reminder = Mage::getSingleton('cp_reviewreminder/reviewreminder')->load($reminderId);
78
+ //delete record
79
+ $reminder->delete();
80
+ }
81
+ Mage::getSingleton('adminhtml/session')->addSuccess(
82
+ $this->__('Total of %d record(s) have been deleted.', count($reminderIds))
83
+ );
84
+ } catch (Exception $e) {
85
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
86
+ }
87
+ }
88
+ }
89
+ $this->_redirect('*/*/');
90
+ }
91
+
92
+ /**
93
+ * Send multiple reminder
94
+ *
95
+ */
96
+ public function massSendReminderAction()
97
+ {
98
+ //Get reminder ids from selected checkbox
99
+ $reminderIds = $this->getRequest()->getParam('reminderIds');
100
+
101
+ if (!is_array($reminderIds)) {
102
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select reminder(s).'));
103
+ } else {
104
+ if (!empty($reminderIds)) {
105
+ try {
106
+ $reminderSentCount = 0;
107
+ foreach ($reminderIds as $reminderId) {
108
+ $reminder = Mage::getSingleton('cp_reviewreminder/reviewreminder')->load($reminderId);
109
+ $customerId = $reminder->getCustomerId();
110
+ if($customerId){
111
+
112
+ //check config settings
113
+ /*
114
+ if(!Mage::Helper('cp_reviewreminder')->isMatchAllConfigSettings($reminder)){
115
+ continue;
116
+ }
117
+ */
118
+
119
+ //send reminder mail
120
+ $isMailSent = Mage::Helper('cp_reviewreminder/mail')->sendReminderEmail($reminder);
121
+
122
+ //update reminder record
123
+ if($isMailSent){
124
+ $reminder->setIsReminderSent(1);
125
+ $reminderCount = $reminder->getReminderCount();
126
+ //Increment reminder count by 1
127
+ $reminderCount++;
128
+ $reminder->setReminderCount($reminderCount);
129
+ $currentTimestamp = time();
130
+ $reminder->setSentAt($currentTimestamp);
131
+ $reminder->setUpdatedAt($currentTimestamp);
132
+ $reminder->save();
133
+ }
134
+ }
135
+ $reminderSentCount++;
136
+ }
137
+ Mage::getSingleton('adminhtml/session')->addSuccess(
138
+ $this->__('Total of %d reminder(s) have been sent.', $reminderSentCount)
139
+ );
140
+ } catch (Exception $e) {
141
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
142
+ }
143
+ }
144
+ }
145
+ $this->_redirect('*/*/');
146
+ }
147
+ /**
148
+ * Create new reminder action
149
+ */
150
+ public function newAction()
151
+ {
152
+ $this->_initAction()
153
+ ->_addBreadcrumb(Mage::helper('cp_reviewreminder')->__('Add Reminders'),
154
+ Mage::helper('cp_reviewreminder')->__('Add Reminders'));
155
+ $this->_addContent($this->getLayout()->createBlock('cp_reviewreminder/adminhtml_addreminder'));
156
+ $this->renderLayout();
157
+ }
158
+
159
+ /**
160
+ * Edit store action
161
+ */
162
+ public function editAction()
163
+ {
164
+ $this->_title($this->__('Review Reminder'))
165
+ ->_title($this->__('Manage Review Reminders'));
166
+
167
+ // 1. Get ID and create model
168
+ $id = $this->getRequest()->getParam('reminder_id');
169
+ $model = Mage::getModel('cp_reviewreminder/reviewreminder');
170
+
171
+ // 2. Initial checking
172
+ if ($id) {
173
+ $model->load($id);
174
+ if (! $model->getId()) {
175
+ Mage::getSingleton('adminhtml/session')->addError(
176
+ Mage::helper('cp_reviewreminder')->__('This reminder no longer exists.'));
177
+ $this->_redirect('*/*/');
178
+ return;
179
+ }
180
+ }
181
+
182
+ $this->_title($model->getId() ? $model->getName() : $this->__('New Store'));
183
+
184
+ // 3. Set entered data if was error when we do save
185
+ $data = Mage::getSingleton('adminhtml/session')->getStorelocatorData(true);
186
+ if (!empty($data)) {
187
+ $model->setData($data);
188
+ }
189
+
190
+ // 4. Register model to use later in blocks
191
+ Mage::register('storelocator_data', $model);
192
+
193
+ // 5. Build edit form
194
+ $this->_initAction()
195
+ ->_addBreadcrumb(
196
+ $id ? Mage::helper('cp_reviewreminder')->__('Edit Store')
197
+ : Mage::helper('cp_reviewreminder')->__('New Store'),
198
+ $id ? Mage::helper('cp_reviewreminder')->__('Edit Store')
199
+ : Mage::helper('cp_reviewreminder')->__('New Store'));
200
+
201
+ $this->_addContent($this->getLayout()->createBlock('cp_storelocator/adminhtml_storelocator_edit'))
202
+ ->_addLeft($this->getLayout()->createBlock('cp_storelocator/adminhtml_storelocator_edit_tabs'));
203
+
204
+ $this->renderLayout();
205
+ }
206
+
207
+ /**
208
+ * Add multiple reminder
209
+ *
210
+ */
211
+ public function massAddReminderAction()
212
+ {
213
+ //Get item ids from selected checkbox
214
+ $itemIds = $this->getRequest()->getParam('itemIds');
215
+
216
+ if (!is_array($itemIds)) {
217
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select reminder(s).'));
218
+ } else {
219
+ if (!empty($itemIds)) {
220
+ try {
221
+ $reminderAddCount = 0;
222
+ $transactionSave = Mage::getModel('core/resource_transaction');
223
+ foreach ($itemIds as $itemId) {
224
+ $item = Mage::getModel('sales/order_item')->load($itemId);
225
+ //check order id
226
+ $orderId = $item->getOrderId();
227
+ if(empty($orderId)){
228
+ continue;
229
+ }
230
+
231
+ //check product id
232
+ $productId = $item->getProductId();
233
+ if(empty($productId)){
234
+ continue;
235
+ }
236
+
237
+ //check customer id
238
+ $order = Mage::getModel('sales/order')->load($orderId);
239
+ $customerId = $order->getCustomerId();
240
+ if(empty($customerId)){
241
+ continue;
242
+ }
243
+
244
+ //Check is reminder exist
245
+ if(Mage::Helper('cp_reviewreminder')->isReminderExist($productId, $customerId)){
246
+ continue;
247
+ }
248
+
249
+ //Check is review already added by customer
250
+ if(Mage::Helper('cp_reviewreminder')->isReviewAlreadyAdded($productId, $customerId)){
251
+ continue;
252
+ }
253
+
254
+ //add reminder
255
+ $reviewreminder = Mage::getModel('cp_reviewreminder/reviewreminder');
256
+
257
+ $reviewreminder->setOrderId($orderId);
258
+ $reviewreminder->setCustomerId($customerId);
259
+ $reviewreminder->setProductId($productId);
260
+ $currentTimestamp = time();
261
+ $reviewreminder->setCreatedAt($currentTimestamp);
262
+
263
+ $transactionSave->addObject($reviewreminder);
264
+ $reminderAddCount++;
265
+ }
266
+ $transactionSave->save();
267
+
268
+ Mage::getSingleton('adminhtml/session')->addSuccess(
269
+ $this->__('Total of %d reminder(s) have been added.', $reminderAddCount)
270
+ );
271
+ } catch (Exception $e) {
272
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
273
+ }
274
+ }
275
+ }
276
+ $this->_redirect('*/*/');
277
+ }
278
+ }
app/code/community/CP/Reviewreminder/controllers/IndexController.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class CP_Reviewreminder_IndexController extends Mage_Core_Controller_Front_Action
22
+ {
23
+ /**
24
+ * Pre dispatch action that allows to redirect to no route page in case of
25
+ * disabled extension through admin panel
26
+ */
27
+ public function preDispatch()
28
+ {
29
+ parent::preDispatch();
30
+
31
+ if (!Mage::helper('cp_reviewreminder')->isExtensionEnabled()) {
32
+ $this->setFlag('', 'no-dispatch', true);
33
+ $this->_redirect('noRoute');
34
+ }
35
+ }
36
+
37
+ function indexAction()
38
+ {
39
+ Mage::Helper('cp_reviewreminder')->isExtensionEnabled();
40
+ $this->loadLayout();
41
+ $this->renderLayout();
42
+ }
43
+
44
+ /**
45
+ * Retrieve customer session model object
46
+ *
47
+ * @return Mage_Customer_Model_Session
48
+ */
49
+ protected function _getSession()
50
+ {
51
+ return Mage::getSingleton('customer/session');
52
+ }
53
+
54
+ /**
55
+ * If customer logined in then redirect page to add review otherwise redirect
56
+ * page to login and after login redirect to add review.
57
+ *
58
+ */
59
+
60
+ function addReviewAction()
61
+ {
62
+ $productId = (int) $this->getRequest()->getParam('id');
63
+ $categoryId = (int) $this->getRequest()->getParam('category', false);
64
+
65
+ if ($this->_getSession()->isLoggedIn()) {
66
+ $this->_redirect('review/product/list', array('id' => $productId, 'category' => $categoryId));
67
+ } else {
68
+ $this->_getSession()->setBeforeAuthUrl(Mage::getUrl('review/product/list',
69
+ array('id' => $productId, 'category' => $categoryId)));
70
+ $this->_redirect('customer/account/login');
71
+ }
72
+ return;
73
+ }
74
+ }
app/code/community/CP/Reviewreminder/etc/adminhtml.xml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Commerce Pundit Technologies
17
+ * @package CP_Reviewreminder
18
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
19
+ * @author <<Ravi Soni>>
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <!-- Review Reminder Menu -->
25
+ <menu>
26
+ <catalog>
27
+ <children>
28
+ <review_reminder translate="title" module="cp_reviewreminder">
29
+ <title>Review Reminder</title>
30
+ <sort_order>210</sort_order>
31
+ <children>
32
+ <scheduled_reminders translate="title" module="cp_reviewreminder">
33
+ <title>Manage Reminders</title>
34
+ <sort_order>1</sort_order>
35
+ <action>adminhtml/managereminders</action>
36
+ </scheduled_reminders>
37
+ <reminder_history translate="title" module="cp_reviewreminder">
38
+ <title>Closed Reminders</title>
39
+ <sort_order>2</sort_order>
40
+ <action>adminhtml/closedreminders</action>
41
+ </reminder_history>
42
+ </children>
43
+ </review_reminder>
44
+ </children>
45
+ </catalog>
46
+ </menu>
47
+ <!-- Access permissions -->
48
+ <acl>
49
+ <resources>
50
+ <all>
51
+ <title>Allow Everything</title>
52
+ </all>
53
+ <admin>
54
+ <children>
55
+ <catalog>
56
+ <children>
57
+ <review_reminder translate="title" module="cp_reviewreminder">
58
+ <title>Review Reminder</title>
59
+ <children>
60
+ <scheduled_reminders translate="title" module="cp_reviewreminder">
61
+ <title>Scheduled Reminders</title>
62
+ <sort_order>1</sort_order>
63
+ </scheduled_reminders>
64
+ <reminder_history translate="title" module="cp_reviewreminder">
65
+ <title>Reminder History</title>
66
+ <sort_order>2</sort_order>
67
+ </reminder_history>
68
+ </children>
69
+ </review_reminder>
70
+ </children>
71
+ </catalog>
72
+ <system>
73
+ <children>
74
+ <config>
75
+ <children>
76
+ <review_reminder translate="title" module="cp_reviewreminder">
77
+ <title>Review Reminder</title>
78
+ </review_reminder>
79
+ </children>
80
+ </config>
81
+ </children>
82
+ </system>
83
+ </children>
84
+ </admin>
85
+ </resources>
86
+ </acl>
87
+ </config>
app/code/community/CP/Reviewreminder/etc/config.xml ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Commerce Pundit Technologies
17
+ * @package CP_Reviewreminder
18
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
19
+ * @author <<Ravi Soni>>
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <CP_Reviewreminder>
26
+ <version>1.0.0</version>
27
+ </CP_Reviewreminder>
28
+ </modules>
29
+
30
+ <frontend>
31
+ <routers>
32
+ <cp_reviewreminder>
33
+ <use>standard</use>
34
+ <args>
35
+ <module>CP_Reviewreminder</module>
36
+ <frontName>reviewreminder</frontName>
37
+ </args>
38
+ </cp_reviewreminder>
39
+ </routers>
40
+
41
+ <events>
42
+ <checkout_onepage_controller_success_action>
43
+ <observers>
44
+ <cp_reviewreminder_save_reviewreminder_information>
45
+ <class>cp_reviewreminder/observer</class>
46
+ <method>addReviewReminderInformation</method>
47
+ </cp_reviewreminder_save_reviewreminder_information>
48
+ </observers>
49
+ </checkout_onepage_controller_success_action>
50
+ <review_save_after>
51
+ <observers>
52
+ <cp_reviewreminder_review_save_after>
53
+ <class>cp_reviewreminder/observer</class>
54
+ <method>reviewSaveAfter</method>
55
+ </cp_reviewreminder_review_save_after>
56
+ </observers>
57
+ </review_save_after>
58
+
59
+ <!-- <controller_action_predispatch_checkout_cart_add>
60
+ <observers>
61
+ <cp_reviewreminder_checkout_cart_add>
62
+ <class>cp_reviewreminder/observer</class>
63
+ <method>sendReviewReminder</method>
64
+ </cp_reviewreminder_checkout_cart_add>
65
+ </observers>
66
+ </controller_action_predispatch_checkout_cart_add> -->
67
+
68
+ </events>
69
+ </frontend>
70
+
71
+ <global>
72
+ <models>
73
+ <cp_reviewreminder>
74
+ <class>CP_Reviewreminder_Model</class>
75
+ <resourceModel>reviewreminder_resource</resourceModel>
76
+ </cp_reviewreminder>
77
+ <reviewreminder_resource>
78
+ <class>CP_Reviewreminder_Model_Resource</class>
79
+ <entities>
80
+ <reviewreminder>
81
+ <table>cp_reviewreminder</table>
82
+ </reviewreminder>
83
+ </entities>
84
+ </reviewreminder_resource>
85
+ </models>
86
+ <helpers>
87
+ <cp_reviewreminder>
88
+ <class>CP_Reviewreminder_Helper</class>
89
+ </cp_reviewreminder>
90
+ </helpers>
91
+ <blocks>
92
+ <cp_reviewreminder>
93
+ <class>CP_Reviewreminder_Block</class>
94
+ </cp_reviewreminder>
95
+ </blocks>
96
+
97
+ <!-- Setup resource -->
98
+ <resources>
99
+ <cp_reviewreminder_setup>
100
+ <setup>
101
+ <module>CP_Reviewreminder</module>
102
+ <class>CP_Reviewreminder_Model_Resource_Setup</class>
103
+ </setup>
104
+ </cp_reviewreminder_setup>
105
+ </resources>
106
+
107
+ <!-- Set email template for reminder -->
108
+ <template>
109
+ <email>
110
+ <!-- name is same as in system.xml file -->
111
+ <review_reminder_general_settings_email_template translate="label" module="cp_reviewreminder">
112
+ <label>Product review reminder</label>
113
+ <file>cp_reviewreminder.html</file>
114
+ <type>html</type>
115
+ </review_reminder_general_settings_email_template>
116
+ </email>
117
+ </template>
118
+ </global>
119
+
120
+ <!-- Adminhtml layout xml configuration -->
121
+ <adminhtml>
122
+ <layout>
123
+ <updates>
124
+ <cp_reviewreminder>
125
+ <file>cp_reviewreminder.xml</file>
126
+ </cp_reviewreminder>
127
+ </updates>
128
+ </layout>
129
+ </adminhtml>
130
+
131
+ <!-- Admin router configuration-->
132
+ <admin>
133
+ <routers>
134
+ <adminhtml>
135
+ <args>
136
+ <modules>
137
+ <cp_reviewreminder after="Mage_Adminhtml">CP_Reviewreminder_Adminhtml</cp_reviewreminder>
138
+ </modules>
139
+ </args>
140
+ </adminhtml>
141
+ </routers>
142
+ </admin>
143
+
144
+ <default>
145
+ <!-- Set default values of system configuration varables -->
146
+ <review_reminder>
147
+ <status>
148
+ <extension_enable>1</extension_enable>
149
+ </status>
150
+ <general_settings>
151
+ <order_status>complete</order_status>
152
+ <number_of_days>5</number_of_days>
153
+ <sender_email_identity>general</sender_email_identity>
154
+ <email_template>review_reminder_general_settings_email_template</email_template>
155
+ </general_settings>
156
+ </review_reminder>
157
+ </default>
158
+ <crontab>
159
+ <jobs>
160
+ <cp_reviewreminder>
161
+ <schedule>
162
+ <cron_expr>0 6 * * 1</cron_expr>
163
+ <!-- minute(0-59) Hour(0-23) day of month(1-31) month(1-12) day of week(0-7 0 or 7 is Sunday)-->
164
+ </schedule>
165
+ <run>
166
+ <model>cp_reviewreminder/observer::sendReviewReminder</model>
167
+ </run>
168
+ </cp_reviewreminder>
169
+ </jobs>
170
+ </crontab>
171
+ </config>
172
+
app/code/community/CP/Reviewreminder/etc/system.xml ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Commerce Pundit Technologies
17
+ * @package CP_Reviewreminder
18
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
19
+ * @author <<Ravi Soni>>
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <tabs>
25
+ <review_reminder_tab translate="label" module="cp_reviewreminder">
26
+ <label>Review Reminder</label>
27
+ <sort_order>0</sort_order>
28
+ </review_reminder_tab>
29
+ </tabs>
30
+ <sections>
31
+ <review_reminder translate="label" module="cp_reviewreminder">
32
+ <label>Review Reminder</label>
33
+ <tab>review_reminder_tab</tab>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>130</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <groups>
40
+ <status translate="label">
41
+ <label>Status</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>0</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <fields>
48
+ <extension_enable translate="label">
49
+ <label>Extension enabled</label>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>adminhtml/system_config_source_yesno</source_model>
52
+ <sort_order>0</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </extension_enable>
57
+ </fields>
58
+ </status>
59
+ <general_settings>
60
+ <label>General Settings</label>
61
+ <frontend_type>text</frontend_type>
62
+ <sort_order>1</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ <fields>
67
+ <order_status translate="label">
68
+ <label>Order Status</label>
69
+ <frontend_type>select</frontend_type>
70
+ <source_model>cp_reviewreminder/adminhtml_system_config_source_status</source_model>
71
+ <sort_order>1</sort_order>
72
+ <validate>required-entry</validate>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </order_status>
77
+ <number_of_days translate="label">
78
+ <label>Number of days after order placed</label>
79
+ <frontend_type>select</frontend_type>
80
+ <source_model>cp_reviewreminder/adminhtml_system_config_source_days</source_model>
81
+ <sort_order>2</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </number_of_days>
86
+ <number_of_times translate="label">
87
+ <label>Number of times want to send mail</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>cp_reviewreminder/adminhtml_system_config_source_times</source_model>
90
+ <sort_order>2</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
+ </number_of_times>
95
+ <email_template translate="label">
96
+ <label>Email template</label>
97
+ <frontend_type>select</frontend_type>
98
+ <source_model>adminhtml/system_config_source_email_template</source_model>
99
+ <sort_order>3</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </email_template>
104
+ <sender_email_identity translate="label">
105
+ <label>Email Sender</label>
106
+ <frontend_type>select</frontend_type>
107
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
108
+ <sort_order>4</sort_order>
109
+ <show_in_default>1</show_in_default>
110
+ <show_in_website>1</show_in_website>
111
+ <show_in_store>1</show_in_store>
112
+ </sender_email_identity>
113
+ </fields>
114
+ </general_settings>
115
+ </groups>
116
+ </review_reminder>
117
+ </sections>
118
+ </config>
app/code/community/CP/Reviewreminder/sql/cp_reviewreminder_setup/install-1.0.0.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Commerce Pundit Technologies
16
+ * @package CP_Reviewreminder
17
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
18
+ * @author <<Ravi Soni>>
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ $installer = $this;
22
+ /**
23
+ * Prepare database for install
24
+ */
25
+ $installer->startSetup();
26
+
27
+ /**
28
+ * Create table 'cp_review_reminder'
29
+ */
30
+ $table = $installer->getConnection()
31
+ ->newTable($installer->getTable('cp_reviewreminder/reviewreminder'))
32
+ ->addColumn('reminder_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
33
+ 'identity' => true,
34
+ 'unsigned' => true,
35
+ 'nullable' => false,
36
+ 'primary' => true,
37
+ ), 'Reminder Id')
38
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
39
+ 'unsigned' => true,
40
+ 'nullable' => false,
41
+ 'default' => '0',
42
+ ), 'Order id')
43
+ ->addColumn('order_incid', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
44
+ 'unsigned' => true,
45
+ 'nullable' => false,
46
+ 'default' => '0',
47
+ ), 'Order increment id')
48
+ ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
49
+ 'unsigned' => true,
50
+ 'nullable' => false,
51
+ 'default' => '0',
52
+ ), 'Customer Id')
53
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
54
+ 'unsigned' => true,
55
+ 'nullable' => false,
56
+ 'default' => '0',
57
+ ), 'Product Id')
58
+ ->addColumn('is_reminder_sent', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
59
+ 'unsigned' => true,
60
+ 'nullable' => false,
61
+ 'default' => '0',
62
+ ), 'Is reminder sent')
63
+ ->addColumn('is_review_added', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
64
+ 'unsigned' => true,
65
+ 'nullable' => false,
66
+ 'default' => '0',
67
+ ), 'Is review added')
68
+ ->addColumn('reminder_count', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
69
+ 'unsigned' => true,
70
+ 'nullable' => false,
71
+ 'default' => '0',
72
+ ), 'Reminder count')
73
+ ->addColumn('sent_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
74
+ 'default' => NULL,
75
+ ), 'Reminder sent time')
76
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
77
+ 'default' => NULL,
78
+ ), 'Creation Time')
79
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
80
+ 'default' => NULL,
81
+ ), 'Update Time')
82
+ ->setComment('CP reviewreminder Table');
83
+ $installer->getConnection()->createTable($table);
84
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/cp_reviewreminder.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Commerce Pundit Technologies
17
+ * @package CP_Reviewreminder
18
+ * @copyright Copyright (c) 2015 Commerce Pundit Technologies. (http://www.commercepundit.com)
19
+ * @author <<Ravi Soni>>
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <layout version="0.1.0">
24
+ <adminhtml_managereminders_index>
25
+ <reference name="content">
26
+ <block type="cp_reviewreminder/adminhtml_reviewreminder" name="reviewreminder.grid.container" />
27
+ </reference>
28
+ </adminhtml_managereminders_index>
29
+ <adminhtml_closedreminders_index>
30
+ <reference name="content">
31
+ <block type="cp_reviewreminder/adminhtml_closedreminder" name="closedreminder.grid.container" />
32
+ </reference>
33
+ </adminhtml_closedreminders_index>
34
+ </layout>
app/etc/modules/CP_Reviewreminder.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Commerce Pundit Technologies
17
+ * @package CP_Reviewreminder
18
+ * @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
19
+ * @author <<Ravi Soni>>
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <CP_Reviewreminder>
26
+ <active>true</active>
27
+ <codePool>community</codePool>
28
+ </CP_Reviewreminder>
29
+ </modules>
30
+ </config>
app/locale/en_US/template/email/cp_reviewreminder.html ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Reminder: Product review @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "htmlescape var=$firstName":"First name",
7
+ "var productDetail":"Product Detail",
8
+ "store url=\"review/product/list\" id=$productId category=$categoryId":"Add product review Url",
9
+ "var store.getFrontendName()":"Store Name"}
10
+ @-->
11
+
12
+ <!--@styles
13
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
14
+ @-->
15
+
16
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
17
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
18
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
19
+ <tr>
20
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
21
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
22
+ <tr>
23
+ <td valign="top">
24
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a>
25
+ </td>
26
+ </tr>
27
+ <tr>
28
+ <td valign="top">
29
+
30
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello {{htmlescape var=$firstName}},</h1>
31
+
32
+ <p>We would like to thank you for purchasing from {{var store.getFrontendName()}}. Your opinions are important to us so we would like to invite you to write a review about your recent purchase.</p>
33
+
34
+ <p><strong>Your Recent Purchases</strong></p>
35
+ {{var productDetail}}
36
+ <p>We appreciate your feedback and hope to serve you again in the near future.</p>
37
+
38
+ <p>Sincerely,</p>
39
+
40
+ <p style="margin-bottom: 0px;">{{var store.getFrontendName()}}</p>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
45
+ </tr>
46
+ </table>
47
+ </td>
48
+ </tr>
49
+ </table>
50
+ </div>
51
+ </body>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>CP_Reviewreminder</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Review Reminder extension by Commerce Pundit will help you send product review notification to website user after the purchase product. </summary>
10
+ <description>Review Reminder is used to automated send email notification to customers asking them to review after products purchased.</description>
11
+ <notes>Product review reminder</notes>
12
+ <authors><author><name>Commerce Pundit</name><user>CPExtensions</user><email>support@commercepundit.com</email></author></authors>
13
+ <date>2016-01-21</date>
14
+ <time>13:21:30</time>
15
+ <contents><target name="magecommunity"><dir name="CP"><dir name="Reviewreminder"><dir name="Block"><dir name="Adminhtml"><dir name="AddReminder"><file name="Grid.php" hash="fbc83715a62cb9d71c96728594b067c8"/><dir name="Renderer"><file name="CustomerName.php" hash="f803254f46988cc5e49c4a50d5144567"/></dir></dir><file name="Addreminder.php" hash="87022decb4486e989557ec8a958392c6"/><dir name="Closedreminder"><file name="Grid.php" hash="3556fd4283afe6048d75623b808fc819"/></dir><file name="Closedreminder.php" hash="660a973c43b1373438af253de5f291e0"/><dir name="Reviewreminder"><file name="Grid.php" hash="b77d753a6b571aab4e8ee46b4d7ec250"/></dir><file name="Reviewreminder.php" hash="ea5cd25505b4e70ee08bac7d3dab7b4a"/></dir></dir><dir name="Helper"><file name="Data.php" hash="3fec74978d1c54d054942b886411f200"/><file name="Mail.php" hash="83498623ba352fbb3d14082f88cc2369"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Days.php" hash="47f89a7578ccf50559c54c652386de37"/><file name="Status.php" hash="f2f1b0c5ade45afc6779b009bd72cec8"/><file name="Times.php" hash="f8d9925a701c0fb4460d179fd5b319ed"/></dir></dir></dir></dir><file name="Observer.php" hash="53e9c4ec677077c1ad7215d3bcfa7c7e"/><dir name="Resource"><dir name="Reviewreminder"><file name="Collection.php" hash="c5ea284456d3438d288e2a9c0c388a6f"/></dir><file name="Reviewreminder.php" hash="2e83dfa67182ab84d9cd91790b98a946"/><file name="Setup.php" hash="de08fc56b80dd1004d2e668eb60442b9"/></dir><file name="Reviewreminder.php" hash="cb370485e71236ab6b78c38da3503d38"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ClosedremindersController.php" hash="4e5678d8fea3deecf5cb21b0ec8038c4"/><file name="ManageremindersController.php" hash="5cb90da4e8ca4a1d55441fc134901822"/></dir><file name="IndexController.php" hash="650f7be68a5ba0bc48d23535b9933d0a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="feb763d479df7cb79cb539fd75452ed7"/><file name="config.xml" hash="29e7db4356c528adc47b28e68cf9d1d6"/><file name="system.xml" hash="fc42bb263119aae16fc5e4649716f72f"/></dir><dir name="sql"><dir name="cp_reviewreminder_setup"><file name="install-1.0.0.php" hash="6bf3d34475190247e73c3a6a26ccf048"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CP_Reviewreminder.xml" hash="e69436488e824c1d093327a28e9653fd"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cp_reviewreminder.xml" hash="d0687e6c6981d2cba713198763a41646"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="cp_reviewreminder.html" hash="b744e35c4e0cc4af3d22fb30db62ccb4"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>