Criteek_Reviewsystem - Version 1.0.0

Version Notes

Customer Review video content

Download this release

Release Info

Developer Criteek
Extension Criteek_Reviewsystem
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (41) hide show
  1. app/code/community/Criteek/.DS_Store +0 -0
  2. app/code/community/Criteek/Reviewsystem/.DS_Store +0 -0
  3. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics.php +23 -0
  4. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics/Grid.php +98 -0
  5. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics/Grid/Renderer/Reopened.php +30 -0
  6. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics/Grid/Renderer/Status.php +54 -0
  7. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category.php +36 -0
  8. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category/Edit.php +43 -0
  9. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category/Edit/Form.php +43 -0
  10. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category/Grid.php +130 -0
  11. app/code/community/Criteek/Reviewsystem/Helper/Data.php +388 -0
  12. app/code/community/Criteek/Reviewsystem/Model/.DS_Store +0 -0
  13. app/code/community/Criteek/Reviewsystem/Model/Category.php +20 -0
  14. app/code/community/Criteek/Reviewsystem/Model/Cron.php +65 -0
  15. app/code/community/Criteek/Reviewsystem/Model/EmailQueue.php +19 -0
  16. app/code/community/Criteek/Reviewsystem/Model/Mysql4/.DS_Store +0 -0
  17. app/code/community/Criteek/Reviewsystem/Model/Mysql4/Category.php +25 -0
  18. app/code/community/Criteek/Reviewsystem/Model/Mysql4/Category/Collection.php +26 -0
  19. app/code/community/Criteek/Reviewsystem/Model/Mysql4/EmailQueue.php +25 -0
  20. app/code/community/Criteek/Reviewsystem/Model/Mysql4/EmailQueue/Collection.php +55 -0
  21. app/code/community/Criteek/Reviewsystem/Model/Observer.php +168 -0
  22. app/code/community/Criteek/Reviewsystem/Model/Order/Status.php +29 -0
  23. app/code/community/Criteek/Reviewsystem/controllers/Adminhtml/AnalyticsController.php +172 -0
  24. app/code/community/Criteek/Reviewsystem/controllers/Adminhtml/CategoryController.php +128 -0
  25. app/code/community/Criteek/Reviewsystem/controllers/Adminhtml/DashboardController.php +30 -0
  26. app/code/community/Criteek/Reviewsystem/data/.DS_Store +0 -0
  27. app/code/community/Criteek/Reviewsystem/data/reviewsystem_setup/data-install-1.0.0.php +28 -0
  28. app/code/community/Criteek/Reviewsystem/etc/adminhtml.xml +58 -0
  29. app/code/community/Criteek/Reviewsystem/etc/config.xml +181 -0
  30. app/code/community/Criteek/Reviewsystem/etc/system.xml +112 -0
  31. app/code/community/Criteek/Reviewsystem/sql/.DS_Store +0 -0
  32. app/code/community/Criteek/Reviewsystem/sql/reviewsystem_setup/mysql4-install-1.0.0.php +72 -0
  33. app/design/adminhtml/default/default/layout/reviewsystem.xml +34 -0
  34. app/design/adminhtml/default/default/template/reviewsystem/emailanalytics.phtml +295 -0
  35. app/design/adminhtml/default/default/template/reviewsystem/grid.phtml +213 -0
  36. app/design/adminhtml/default/default/template/reviewsystem/grid/container.phtml +45 -0
  37. app/design/frontend/base/default/template/reviewsystem/reviewcode.phtml +23 -0
  38. app/etc/modules/Criteek_Reviewsystem.xml +10 -0
  39. app/locale/en_US/template/email/account_new_confirmation.html +50 -0
  40. js/reviewsystem/widgetcode.js +26 -0
  41. package.xml +20 -0
app/code/community/Criteek/.DS_Store ADDED
Binary file
app/code/community/Criteek/Reviewsystem/.DS_Store ADDED
Binary file
app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Block_Adminhtml_Analytics extends Mage_Adminhtml_Block_Widget_Grid_Container {
15
+
16
+ public function __construct() {
17
+ $this->_blockGroup = 'reviewsystem';
18
+ $this->_controller = 'adminhtml_analytics';
19
+ $this->_headerText = Mage::helper('reviewsystem')->__('Email Analytics');
20
+ parent::__construct();
21
+ $this->_removeButton('add');
22
+ }
23
+ }
app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics/Grid.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Block_Adminhtml_Analytics_Grid extends Mage_Adminhtml_Block_Report_Grid
15
+ {
16
+
17
+ public function __construct()
18
+ {
19
+ parent::__construct();
20
+ $this->setId('gridAnalytics');
21
+ $this->setTemplate('reviewsystem/grid.phtml');
22
+ $this->setDefaultSort('id');
23
+
24
+ }
25
+
26
+ protected function _prepareCollection()
27
+ {
28
+ parent::_prepareCollection();
29
+ $this->_prepareTotals('customer_name,reopened');
30
+ return $this->getCollection()->initReport('reviewsystem/emailQueue_collection');
31
+
32
+ }
33
+
34
+ protected function _prepareColumns()
35
+ {
36
+ $this->addColumn('product_name', array(
37
+ 'header' =>Mage::helper('reviewsystem')->__('Product Name'),
38
+ 'index' =>'product_name',
39
+ 'sortable' => false,
40
+ 'filter' => false,
41
+ ));
42
+
43
+ $this->addColumn('customer_name', array(
44
+ 'header' =>Mage::helper('reviewsystem')->__('Customern Name'),
45
+ 'index' =>'customer_name',
46
+ 'sortable' => false,
47
+ 'filter' => false,
48
+ ));
49
+
50
+ $this->addColumn('customer_email', array(
51
+ 'header' =>Mage::helper('reviewsystem')->__('Email received'),
52
+ 'index' =>'customer_email',
53
+ 'sortable' => false,
54
+ 'filter' => false,
55
+ ));
56
+
57
+ $this->addColumn('reopened', array(
58
+ 'header' =>Mage::helper('reviewsystem')->__('Responded by Customer'),
59
+ 'index' =>'reopened',
60
+ 'sortable' => false,
61
+ 'renderer' => 'Criteek_Reviewsystem_Block_Adminhtml_Analytics_Grid_Renderer_Reopened',
62
+ 'filter' => false,
63
+ ));
64
+
65
+ $this->addColumn('status', array(
66
+ 'header' =>Mage::helper('reviewsystem')->__('Review Uploaded by Customer'),
67
+ 'index' =>'status',
68
+ 'renderer' => 'Criteek_Reviewsystem_Block_Adminhtml_Analytics_Grid_Renderer_Status',
69
+ ));
70
+
71
+ $this->addExportType('*/*/exportSimpleCsv', Mage::helper('reviewsystem')->__('CSV'));
72
+
73
+ return parent::_prepareColumns();
74
+ }
75
+
76
+ protected function _prepareTotals($columns = null){
77
+ $columns=explode(',',$columns);
78
+ if(!$columns){
79
+ return;
80
+ }
81
+ $this->_countTotals = true;
82
+ $totals = new Varien_Object();
83
+ $fields = array();
84
+ foreach($columns as $column){
85
+ $fields[$column] = 0;
86
+ }
87
+ foreach ($this->getCollection() as $item) {
88
+ foreach($fields as $field=>$value){
89
+ $fields[$field]+=$item->getData($field);
90
+ }
91
+ }
92
+ $totals->setData($fields);
93
+ $this->setTotals($totals);
94
+ return;
95
+ }
96
+
97
+
98
+ }
app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics/Grid/Renderer/Reopened.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Block_Adminhtml_Analytics_Grid_Renderer_Reopened extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
15
+ {
16
+ public function render(Varien_Object $row)
17
+ {
18
+ return $this->_getValue($row);
19
+ }
20
+ protected function _getValue(Varien_Object $row)
21
+ {
22
+ $val = $row->getData($this->getColumn()->getIndex());
23
+ if($val==1)
24
+ {$val="Yes";
25
+ }else{
26
+ $val="No";
27
+ }
28
+ return $val;
29
+ }
30
+ }
app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics/Grid/Renderer/Status.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Block_Adminhtml_Analytics_Grid_Renderer_Status extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
15
+ {
16
+ public function render(Varien_Object $row)
17
+ {
18
+ return $this->_getValue($row);
19
+ }
20
+ protected function _getValue(Varien_Object $row)
21
+ {
22
+ $val = $row->getData();
23
+ $cutomer_email =$val['customer_email'];
24
+ $customer_time = $val['email_time'];
25
+ $dt = new DateTime($customer_time);
26
+ $date_mail = $dt->format('Y-m-d');
27
+ $product_id = $val['product_id'];
28
+ $customer_name = $val['customer_name'];
29
+ $collection= Mage::getModel('catalog/product')->getCollection()->addFieldToFilter('entity_id', $product_id)->getFirstItem();
30
+ $sku =$collection->getSku();
31
+ if ($col =Mage::getModel('reviewsystem/product')->getCollection()->addFieldToFilter('product_sku', $sku)->getFirstItem())
32
+ {
33
+ $pid =$col->getPid();
34
+ $i=0;
35
+ foreach(Mage::helper('reviewsystem')->fetchReviewersInfo($pid)->message as $info)
36
+ {
37
+
38
+ $reviewerEmail =$info->reviewer_email;
39
+ $reviewerName =$info->reviewer_name;
40
+
41
+ if(strcasecmp($reviewerEmail, $cutomer_email)==0 && (strtotime(substr($info->reviewdate,0,11))>strtotime($date_mail))){
42
+ $i++;
43
+ }
44
+
45
+ }
46
+ if($i>0){
47
+ $value= Mage::helper('reviewsystem')->__('Yes(').$i.")";
48
+ }else{
49
+ $value= Mage::helper('reviewsystem')->__('No(').$i.")";
50
+ }
51
+ }
52
+ return $value;
53
+ }
54
+ }
app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+
15
+ class Criteek_Reviewsystem_Block_Adminhtml_Category extends Mage_Adminhtml_Block_Widget_Grid_Container {
16
+
17
+ /**
18
+ * constructor
19
+ *
20
+ */
21
+ public function __construct() {
22
+ $this->_controller = 'adminhtml_category';
23
+ $this->_blockGroup = 'reviewsystem';
24
+ $this->_headerText = 'Top Level Categories';
25
+ $data = array(
26
+ 'label' => 'Back',
27
+ 'onclick' => "goToParent('".$this->getUrl('*/*/grid', array('_current'=>false))."')",
28
+ 'id' => "back-to-parent",
29
+ //'class' => 'back'
30
+ );
31
+ parent::__construct();
32
+ $this->_removeButton('add');
33
+ $this->_removeButton('back');
34
+
35
+ }
36
+ }
app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category/Edit.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Block_Adminhtml_Category_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
15
+ {
16
+ public function __construct()
17
+ {
18
+ parent::__construct();
19
+
20
+ $this->_objectId = 'id';
21
+ $this->_blockGroup = 'reviewsystem';
22
+ $this->_controller = 'adminhtml_category';
23
+ $this->_mode = 'edit';
24
+ $this->_removeButton('delete');
25
+ $this->_updateButton('save', 'label', Mage::helper('reviewsystem')->__('Save Interval for Category'));
26
+
27
+
28
+ }
29
+
30
+ public function getHeaderText()
31
+ { $categoryId =$this->getRequest()->getParam('id');
32
+
33
+ if ($categoryId )
34
+ { $category=Mage::getModel('catalog/category')->load($categoryId);
35
+ return Mage::helper('reviewsystem')->__('Set Interval for category "%s"', $this->htmlEscape($category->getName()));
36
+ } else {
37
+ return Mage::helper('reviewsystem')->__('Set Interval for category');
38
+ }
39
+ }
40
+
41
+
42
+
43
+ }
app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category/Edit/Form.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+
15
+ class Criteek_Reviewsystem_Block_Adminhtml_Category_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
16
+ {
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
22
+ 'method' => 'post'
23
+
24
+ )
25
+ );
26
+
27
+ $fieldset = $form->addFieldset('category_form', array(
28
+ 'legend' =>Mage::helper('reviewsystem')->__('Category information')
29
+ ));
30
+ $fieldset->addField('interval', 'text', array(
31
+ 'label' => Mage::helper('reviewsystem')->__('Set Interval'),
32
+ 'class' => 'required-entry',
33
+ 'required' => true,
34
+ 'name' => 'interval',
35
+ 'value' =>10,
36
+ 'note' => Mage::helper('reviewsystem')->__('Set the interval in days here.'),
37
+ ));
38
+
39
+ $form->setUseContainer(true);
40
+ $this->setForm($form);
41
+ return parent::_prepareForm();
42
+ }
43
+ }
app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category/Grid.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Block_Adminhtml_Category_Grid extends Mage_Adminhtml_Block_Widget_Grid
15
+ {
16
+ /**
17
+ * Constructor
18
+ *
19
+ * @return unknown
20
+ */
21
+ public function __construct()
22
+ {
23
+ parent::__construct();
24
+
25
+ $this->setId('category_grid');
26
+ $this->setUseAjax(true);
27
+ $this->setPagerVisibility(true);
28
+ $this->setFilterVisibility(false);
29
+ }
30
+
31
+ /**
32
+ * prepare collection for grid
33
+ *
34
+ */
35
+ protected function _prepareCollection()
36
+ {
37
+
38
+ $collection = new Varien_Data_Collection();
39
+
40
+ $helper = Mage::helper('reviewsystem');
41
+
42
+ $model = Mage::getModel('reviewsystem/category')->getCollection();
43
+
44
+ if($model){
45
+
46
+ foreach( $model as $category) {
47
+ $categoryCollection=Mage::getModel('catalog/category')->load($category->getCategoryId());
48
+ //$main_cat_title[] = $main_cat['title']; // Main Category title
49
+ $rowObj = new Varien_Object();
50
+ $rowObj->setName($categoryCollection->getName());
51
+
52
+ $rowObj->setId($category->getCategoryId());
53
+ $rowObj->setCategoryinterval($category->getInterval());
54
+ $collection->addItem($rowObj);
55
+ }
56
+ }
57
+
58
+ $this->setCollection($collection);
59
+ return parent::_prepareCollection();
60
+ }
61
+
62
+ /**
63
+ * prepare columns for grid
64
+ *
65
+ * @return object
66
+ */
67
+ protected function _prepareColumns()
68
+ {
69
+
70
+
71
+
72
+ $this->addColumn('id', array(
73
+ 'header' => Mage::helper('reviewsystem')->__('Top Category Id'),
74
+ 'index' => 'id',
75
+ ));
76
+ $this->addColumn('name', array(
77
+ 'header' => Mage::helper('reviewsystem')->__('Top Category Name'),
78
+ 'index' => 'name',
79
+ ));
80
+ $this->addColumn('categoryinterval', array(
81
+ 'header' => Mage::helper('reviewsystem')->__('Interval'),
82
+ 'index' => 'categoryinterval',
83
+ ));
84
+ $this->addColumn('interval',array(
85
+ 'header' => Mage::helper('reviewsystem')->__('edit'),
86
+ 'type' => 'action',
87
+ 'getter' => 'getId',
88
+ 'actions' => array(
89
+ array(
90
+ 'caption' => Mage::helper('reviewsystem')->__('edit'),
91
+ 'url' => array(
92
+ 'base'=>'*/*/edit'),
93
+ 'field' => 'id',
94
+
95
+ )),
96
+ 'filter' => false,
97
+ 'sortable' => false,
98
+ 'index' => 'interval',
99
+ 'is_system' => true,
100
+ ));
101
+ return parent::_prepareColumns();
102
+
103
+ }
104
+
105
+ /**
106
+ * Prepare for mass action for selected rows
107
+ */
108
+ protected function _prepareMassaction()
109
+ {
110
+
111
+ $this->setMassactionIdField('id');
112
+ $this->getMassactionBlock()->setFormFieldName('id');
113
+
114
+ $this->getMassactionBlock()->addItem('interval', array(
115
+ 'label' => Mage::helper('reviewsystem')->__('Add Default Intervel'),
116
+ 'url' => $this->getUrl('*/*/massIntervel', array('id' =>$this->getRequest()->getParam('id'))),
117
+ 'confirm' => Mage::helper('reviewsystem')->__('Are you sure?')
118
+ ));
119
+
120
+
121
+ return $this;
122
+ }
123
+
124
+
125
+ public function getGridUrl() {
126
+ return $this->getUrl('*/*/grid', array('_current' => true));
127
+ }
128
+
129
+
130
+ }
app/code/community/Criteek/Reviewsystem/Helper/Data.php ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Helper_Data extends Mage_Core_Helper_Abstract
15
+ {
16
+ /**
17
+ * get Api key - Get api key from config
18
+ *
19
+ * @return string
20
+ */
21
+ function getApiUsername(){
22
+ return Mage::getStoreConfig('reviewsystem/product_review_config/api_app_key'); // Api app Key
23
+ }
24
+ function isModuleEnable(){
25
+ if(Mage::getStoreConfig('reviewsystem/product_review_config/criteek_synch'))
26
+ {
27
+ return true;
28
+ }else{
29
+ return false;
30
+ }
31
+ }
32
+
33
+
34
+ /**
35
+ * get Api secret - Get api secret from config
36
+ *
37
+ * @return string
38
+ */
39
+ function getApiPassword(){
40
+ return Mage::getStoreConfig('reviewsystem/product_review_config/api_app_secret'); // Api app seceret
41
+ }
42
+
43
+ /**
44
+ * sendRequest for token - initiate curl request
45
+ *
46
+ *
47
+ *
48
+ * @return token
49
+ */
50
+ function getToken(){
51
+ $json = '';
52
+ $url="http://api.criteek.tv/api/v1/login";
53
+ $curl = curl_init($url);
54
+ $postData= array("apikey" => $this->getApiUsername(), "secretkey" => $this->getApiPassword());
55
+ curl_setopt($curl, CURLOPT_URL, $url);
56
+ curl_setopt($curl, CURLOPT_HEADER, false);
57
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
58
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
59
+ curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($postData));
60
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
61
+
62
+ $response = curl_exec($curl);
63
+
64
+ if (empty($response)) {
65
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
66
+ curl_close($curl); // close cURL handler
67
+ } else {
68
+ $info = curl_getinfo($curl);
69
+
70
+ if (empty($info['http_code'])) {
71
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
72
+
73
+ } else {
74
+ // load the HTTP codes
75
+
76
+ if($info['http_code']!=200){
77
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
78
+
79
+ }
80
+ else{
81
+ $json = json_decode($response);
82
+ }
83
+ }
84
+ }
85
+ //echo $info['http_code'];
86
+ $token =$json->message->token;
87
+ return $token;
88
+ }
89
+ /**
90
+ * getdomainId - Send curl request to Api to get Domain Id
91
+ *
92
+ *
93
+ * @return array
94
+ */
95
+ function getDomainId() {
96
+
97
+ $json = '';
98
+ $token = $this->getToken();
99
+ $url="http://api.criteek.tv/api/v1/mydomain?name=".$_SERVER['HTTP_HOST']."&token=".$token;
100
+ $headers= array("token:".$token);
101
+ $curl = curl_init($url);
102
+ curl_setopt($curl, CURLOPT_URL, $url);
103
+ curl_setopt($curl, CURLOPT_HEADER, false);
104
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
105
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
106
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
107
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
108
+ $response = curl_exec($curl);
109
+ if (empty($response)) {
110
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
111
+
112
+ curl_close($curl); // close cURL handler
113
+ } else {
114
+ $info = curl_getinfo($curl);
115
+
116
+ if (empty($info['http_code'])) {
117
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
118
+
119
+ } else {
120
+ // load the HTTP codes
121
+
122
+ if($info['http_code']!=200){
123
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
124
+ }
125
+ else{
126
+ $json = json_decode($response);
127
+ }
128
+ }
129
+ }
130
+ $domain_id =$json->message->domainid;
131
+ return $domain_id ;
132
+ }
133
+ /**
134
+ * fetchProductsInfo - Send curl request to huuto to fetch products Details
135
+ *
136
+ *
137
+ *
138
+ */
139
+
140
+ function fetchProductInfo() {
141
+ $json = '';
142
+ $token = $this->getToken();
143
+ $doaminId= $this->getDomainId();
144
+ $url="http://api.criteek.tv/api/v1/widgetproduct?domainid=".$doaminId."&token=".$token;
145
+ $headers= array("token:".$token);
146
+ $curl = curl_init($url);
147
+ curl_setopt($curl, CURLOPT_URL, $url);
148
+ curl_setopt($curl, CURLOPT_HEADER, false);
149
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
150
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
151
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
152
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
153
+ $response = curl_exec($curl);
154
+ if (empty($response)) {
155
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
156
+
157
+ curl_close($curl); // close cURL handler
158
+ } else {
159
+ $info = curl_getinfo($curl);
160
+
161
+ if (empty($info['http_code'])) {
162
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
163
+ } else {
164
+ // load the HTTP codes
165
+
166
+ if($info['http_code']!=200){
167
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
168
+ }
169
+ else{
170
+ $json = json_decode($response);
171
+ }
172
+ }
173
+ }
174
+ $productData =$json->message;
175
+ return $productData ;
176
+ }
177
+
178
+ /**
179
+ * setDoamin On Off - Send curl request to huuto to fetch products Details
180
+ *
181
+ * param value for domain value
182
+ *
183
+ */
184
+
185
+ function setDomainOnOff($value) {
186
+ $json = '';
187
+ $token = $this->getToken();
188
+ $doaminId= $this->getDomainId();
189
+ $url="http://api.criteek.tv/api/v1/domain/".$doaminId;
190
+ $putData= array("default"=>$value);
191
+ $headers= array("token:".$token);
192
+ $curl = curl_init($url);
193
+ curl_setopt($curl, CURLOPT_URL, $url);
194
+ curl_setopt($curl, CURLOPT_HEADER, false);
195
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
196
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
197
+ // Instead of POST fields use these settings
198
+ curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($putData));
199
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
200
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
201
+ $response = curl_exec($curl);
202
+ if (empty($response)) {
203
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
204
+ curl_close($curl); // close cURL handler
205
+ } else {
206
+ $info = curl_getinfo($curl);
207
+
208
+ if (empty($info['http_code'])) {
209
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
210
+ } else {
211
+ // load the HTTP codes
212
+
213
+ if($info['http_code']!=200){
214
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
215
+ }
216
+ else{
217
+ $json = json_decode($response);
218
+ }
219
+ }
220
+ }
221
+
222
+ return $json ;
223
+ }
224
+
225
+ /**
226
+ * set product widget On Off - Send curl request to huuto to fetch products Details
227
+ *
228
+ * param value for id and value
229
+ *
230
+ */
231
+ function setProductOnOff($id,$value) {
232
+ $json = '';
233
+ $token = $this->getToken();
234
+ $doaminId= $this->getDomainId();
235
+ $url="http://api.criteek.tv/api/v1/widgetproduct/".$id;
236
+ $putData= array("domainid"=>$doaminId, "widget"=>$value);
237
+ $headers= array("token:".$token);
238
+ $curl = curl_init($url);
239
+ curl_setopt($curl, CURLOPT_URL, $url);
240
+ curl_setopt($curl, CURLOPT_HEADER, false);
241
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
242
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
243
+ // Instead of POST fields use these settings
244
+ curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($putData));
245
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
246
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
247
+ $response = curl_exec($curl);
248
+ if (empty($response)) {
249
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
250
+ curl_close($curl); // close cURL handler
251
+ } else {
252
+ $info = curl_getinfo($curl);
253
+
254
+ if (empty($info['http_code'])) {
255
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
256
+ } else {
257
+ // load the HTTP codes
258
+
259
+ if($info['http_code']!=200){
260
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
261
+ }
262
+ else{
263
+ $json = json_decode($response);
264
+ }
265
+ }
266
+ }
267
+
268
+ return $json ;
269
+ }
270
+
271
+ /**
272
+ * fetchReviwersInfo - Send curl request to huuto to fetch reviews Details
273
+ *
274
+ *
275
+ *
276
+ */
277
+
278
+ function fetchReviewersInfo($productid) {
279
+ $json = '';
280
+ $token = $this->getToken();
281
+ $doaminId= $this->getDomainId();
282
+ $url="http://api.criteek.tv/api/v1/widgetproductreviewers?domainid=".$doaminId."&productid=".$productid;
283
+ $headers= array("token:".$token);
284
+ $curl = curl_init($url);
285
+ curl_setopt($curl, CURLOPT_URL, $url);
286
+ curl_setopt($curl, CURLOPT_HEADER, false);
287
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
288
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
289
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
290
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
291
+ $response = curl_exec($curl);
292
+ if (empty($response)) {
293
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
294
+ curl_close($curl); // close cURL handler
295
+ } else {
296
+ $info = curl_getinfo($curl);
297
+
298
+ if (empty($info['http_code'])) {
299
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
300
+ } else {
301
+ // load the HTTP codes
302
+
303
+ if($info['http_code']!=200){
304
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
305
+ }
306
+ else{
307
+ $json = json_decode($response);
308
+ }
309
+ }
310
+ }
311
+ return $json ;
312
+ }
313
+
314
+ function setProductDeleteArchive($id,$value) {
315
+ $json = '';
316
+ $token = $this->getToken();
317
+ $doaminId= $this->getDomainId();
318
+ $putData= array("productid"=>array($id), "widget"=>$value);
319
+ $url="http://api.criteek.tv/api/v1/widgets?data=".$putData;
320
+
321
+ $headers= array("token:".$token);
322
+ $curl = curl_init($url);
323
+ curl_setopt($curl, CURLOPT_URL, $url);
324
+ curl_setopt($curl, CURLOPT_HEADER, false);
325
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
326
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
327
+ // Instead of POST fields use these settings
328
+ curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($putData));
329
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
330
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
331
+ $response = curl_exec($curl);
332
+ if (empty($response)) {
333
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
334
+ curl_close($curl); // close cURL handler
335
+ } else {
336
+ $info = curl_getinfo($curl);
337
+
338
+ if (empty($info['http_code'])) {
339
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
340
+ } else {
341
+ // load the HTTP codes
342
+
343
+ if($info['http_code']!=200){
344
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
345
+ }
346
+ else{
347
+ $json = json_decode($response);
348
+ }
349
+ }
350
+ }
351
+
352
+ return $json ;
353
+ }
354
+ function fetchReviewersStatus($streamId,$email) {
355
+ $json = '';
356
+ $token = $this->getToken();
357
+ $url="http://api.criteek.tv/api/v1/widgetproductcheckreviewers?streamingid=".$streamId."&emailid=".$email;
358
+ $headers= array("token:".$token);
359
+ $curl = curl_init($url);
360
+ curl_setopt($curl, CURLOPT_URL, $url);
361
+ curl_setopt($curl, CURLOPT_HEADER, false);
362
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
363
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
364
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
365
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
366
+ $response = curl_exec($curl);
367
+ if (empty($response)) {
368
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
369
+ curl_close($curl); // close cURL handler
370
+ } else {
371
+ $info = curl_getinfo($curl);
372
+
373
+ if (empty($info['http_code'])) {
374
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
375
+ } else {
376
+ // load the HTTP codes
377
+
378
+ if($info['http_code']!=200){
379
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
380
+ }
381
+ else{
382
+ $json = json_decode($response);
383
+ }
384
+ }
385
+ }
386
+ return $json ;
387
+ }
388
+ }
app/code/community/Criteek/Reviewsystem/Model/.DS_Store ADDED
Binary file
app/code/community/Criteek/Reviewsystem/Model/Category.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+
15
+ class Criteek_Reviewsystem_Model_Category extends Mage_Core_Model_Abstract {
16
+ public function _construct() {
17
+ parent::_construct();
18
+ $this->_init('reviewsystem/category');
19
+ }
20
+ }
app/code/community/Criteek/Reviewsystem/Model/Cron.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Model_Cron
15
+ {
16
+
17
+ /**
18
+ *
19
+ * Send Email via Cron - Send Email to review product
20
+ *
21
+ */
22
+
23
+ public function sendEmail()
24
+ {
25
+ if(Mage::helper('reviewsystem')->isModuleEnable()){
26
+ $sender_email= Mage::getStoreConfig('trans_email/ident_general/email');
27
+ $sender_name =Mage::getStoreConfig('trans_email/ident_general/name');
28
+
29
+ $collection = Mage::getModel('reviewsystem/emailQueue')->getCollection();
30
+ foreach($collection as $queue)
31
+ {$current_date =Mage::getModel('core/date')->date('Y-m-d');
32
+ $emailtime = $queue->getEmailTime();
33
+ $customer_email= $queue->getCustomerEmail();
34
+ $customerid =$queue->getId();
35
+ $customer_name = $queue->getCustomerName();
36
+ $product_id = $queue->getProductId();
37
+ $date_time = new DateTime($emailtime);
38
+ $date = $date_time->format('Y-m-d');
39
+ $time = $date_time->format('H:i:s');
40
+ $product = Mage::getModel('catalog/product')->load($product_id);
41
+ if( $current_date>= $date ){
42
+ if($queue->getStatus()==0){
43
+ $emailTemplateVariables = array();
44
+ $emailTemplateVariables['product_url'] = Mage::getBaseUrl().Mage::getResourceSingleton('catalog/product')
45
+ ->getAttributeRawValue($product_id, 'url_path', Mage::app()->getStore())."?criteek=".$customerid ;
46
+ $emailTemplateVariables['product_name'] = $product->getName();
47
+ $emailTemplateVariables['customer_name'] = $customer_name;
48
+ $emailTemplate = Mage::getModel('core/email_template')
49
+ ->loadDefault('product_review_email_template');
50
+ $emailTemplate->setSenderName($sender_name);
51
+ $emailTemplate->setSenderEmail($sender_email);
52
+ $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
53
+ $emailTemplate->send($customer_email,$customer_name, $emailTemplateVariables);
54
+ $data = array('status'=>1);
55
+ $status= Mage::getModel('reviewsystem/emailQueue')->load($queue->getId())->addData($data)->save();
56
+
57
+
58
+ }
59
+ }
60
+ }
61
+
62
+
63
+ }
64
+ }
65
+ }
app/code/community/Criteek/Reviewsystem/Model/EmailQueue.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Model_EmailQueue extends Mage_Core_Model_Abstract {
15
+ public function _construct() {
16
+ parent::_construct();
17
+ $this->_init('reviewsystem/emailQueue');
18
+ }
19
+ }
app/code/community/Criteek/Reviewsystem/Model/Mysql4/.DS_Store ADDED
Binary file
app/code/community/Criteek/Reviewsystem/Model/Mysql4/Category.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Model_Mysql4_Category extends Mage_Core_Model_Mysql4_Abstract {
15
+
16
+ /**
17
+ * Constructor
18
+ *
19
+ * @return unknown
20
+ */
21
+ public function _construct() {
22
+ // Note that the category_id refers to the key field in your database table.
23
+ $this->_init('reviewsystem/category', 'id');
24
+ }
25
+ }
app/code/community/Criteek/Reviewsystem/Model/Mysql4/Category/Collection.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Model_Mysql4_Category_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
15
+ {
16
+ /**
17
+ * Constructor
18
+ *
19
+ * @return unknown
20
+ */
21
+ public function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('reviewsystem/category');
25
+ }
26
+ }
app/code/community/Criteek/Reviewsystem/Model/Mysql4/EmailQueue.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Model_Mysql4_EmailQueue extends Mage_Core_Model_Mysql4_Abstract {
15
+
16
+ /**
17
+ * Constructor
18
+ *
19
+ * @return unknown
20
+ */
21
+ public function _construct() {
22
+ // Note that the id refers to the key field in your database table.
23
+ $this->_init('reviewsystem/emailQueue','id');
24
+ }
25
+ }
app/code/community/Criteek/Reviewsystem/Model/Mysql4/EmailQueue/Collection.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Model_Mysql4_EmailQueue_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
15
+ {
16
+ /**
17
+ * Constructor
18
+ *
19
+ * @return unknown
20
+ */
21
+ public function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('reviewsystem/emailQueue');
25
+ }
26
+ protected function _joinFields($from = '', $to = '')
27
+ {
28
+ $this->addFieldToFilter('email_time' , array("from" => $from, "to" => $to, "datetime" => true));
29
+ // $this->getSelect()->group('email_time');
30
+ $this->getSelect();
31
+ return $this;
32
+ }
33
+
34
+ public function setDateRange($from, $to)
35
+ {
36
+ $this->_reset()
37
+ ->_joinFields($from, $to);
38
+ return $this;
39
+ }
40
+
41
+ public function load($printQuery = false, $logQuery = false)
42
+ {
43
+ if ($this->isLoaded()) {
44
+ return $this;
45
+ }
46
+ parent::load($printQuery, $logQuery);
47
+ return $this;
48
+ }
49
+
50
+ public function setStoreIds($storeIds)
51
+ {
52
+ return $this;
53
+ }
54
+
55
+ }
app/code/community/Criteek/Reviewsystem/Model/Observer.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Model_Observer
15
+ {
16
+ public function getOrder(Varien_Event_Observer $observer)
17
+ {
18
+ if(Mage::helper('reviewsystem')->isModuleEnable()){
19
+ $order = $observer->getEvent()->getOrder();
20
+ $orderId= $order->getId();
21
+ $orderStatus = $order->getStatus();
22
+ $status = Mage::getStoreConfig('reviewsystem/product_review_config/allowed_status');
23
+ $customerEmail = $order->getCustomerEmail();
24
+ $customerName = $order->getCustomerName();
25
+
26
+ if($orderStatus == $status ){
27
+ foreach( $order->getAllVisibleItems() as $item ) {
28
+ $itemProductId = $item->getProductId();
29
+ $product = Mage::getModel('catalog/product')->load($itemProductId);
30
+ $cats = $product->getCategoryIds();
31
+ $categoryId =array();
32
+ foreach ($cats as $category_id) {
33
+ $category = Mage::getModel('catalog/category')->load($category_id);
34
+ //each category has a path attribute
35
+ $path = $category->getPath(); //should look like 1/3/14/23/55.
36
+ //split the path by slash
37
+ $pathParts = explode('/', $path);
38
+ if (count($pathParts) == 3) {
39
+ //it means the category is already a top level category
40
+ $categoryname = $category->getName();
41
+ $categoryId[]= $category->getId();
42
+ }
43
+ elseif (isset($pathParts[2])) {
44
+ $topCategory = Mage::getModel('catalog/category')->load($pathParts[2]);
45
+ $categoryname = $topCategory->getName();
46
+ $categoryId[]= $topCategory->getId();
47
+ }
48
+ }
49
+ if(!empty($categoryId)){
50
+ $Interval =array();
51
+ foreach($categoryId as $topId)
52
+ {
53
+ $model = Mage::getModel('reviewsystem/category');
54
+ $model->load($topId, 'category_id');
55
+ $Interval[$topId]= $model->getInterval();
56
+ }
57
+ if(count(array_keys($Interval, min($Interval)))==1)
58
+ {
59
+
60
+ $cat_id=array_keys($Interval, min($Interval));
61
+
62
+ $catModel=Mage::getModel('reviewsystem/category')->getCollection()->addFieldToFilter('category_id', $cat_id[0])->addFieldToSelect('interval')->getData();
63
+
64
+ }else{
65
+ $catModel=Mage::getModel('reviewsystem/category')->getCollection()->addFieldToFilter('category_id', $categoryId[0])->addFieldToSelect('interval')->getData();
66
+ }
67
+ $interval_days = $catModel[0]['interval'];
68
+ $email_date= date('Y-m-d H:i:s', strtotime('+'.$interval_days.' days') );
69
+ $productModel = Mage::getModel('reviewsystem/emailQueue');
70
+ $productModel->setProductId($itemProductId)
71
+ ->setOrderId($orderId)
72
+ ->setStatus(0)
73
+ ->setProductSku($item->getSku())
74
+ ->setProductName($item->getName())
75
+ ->setEmailTime($email_date)
76
+ ->setCustomerEmail($customerEmail)
77
+ ->setCustomerName($customerName)
78
+ ->save();
79
+ }
80
+ }
81
+ }
82
+ }
83
+ return $observer;
84
+ }
85
+
86
+ public function getCategory($observer)
87
+ { if(Mage::helper('reviewsystem')->isModuleEnable()){
88
+ $event = $observer->getEvent();
89
+ $category = $event->getCategory();
90
+ $interval =10;
91
+ $category_id= $category->getId();
92
+ $model = Mage::getModel('reviewsystem/category');
93
+ $categories = Mage::getModel('reviewsystem/category')->getCollection()
94
+ ;
95
+ $catId =array();
96
+ foreach($categories as $category){
97
+ $catId[] = $category->getCategoryId();
98
+
99
+ }
100
+
101
+ if(in_array($category_id,$catId))
102
+ {
103
+
104
+ }else{
105
+ $category = Mage::getModel('catalog/category')->load($category_id);
106
+ $path = $category->getPath(); //should look like 1/3/14/23/55.
107
+ //split the path by slash
108
+ $pathParts = explode('/', $path);
109
+ if (count($pathParts) == 3) {
110
+ $categoryname = $category->getName();
111
+ $category_id= $category->getId();
112
+ $model->setCategoryId($category_id)
113
+ ->setInterval($interval)
114
+ ->save();
115
+ }
116
+ }}
117
+ return $observer;
118
+
119
+ }
120
+ public function adminSystemConfigChangedSection()
121
+ {
122
+ if(Mage::getStoreConfig('manage_widget/manage_widget_config/widget_synch')==1){
123
+ $value="on";
124
+ Mage::helper('reviewsystem')->setDomainOnOff($value);
125
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('reviewsystem')->__('Widget is ON for Domain.'));
126
+ }else{
127
+ $value="off";
128
+ Mage::helper('reviewsystem')->setDomainOnOff($value);
129
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('reviewsystem')->__('Widget is OFF for Domain.'));
130
+ }
131
+ return true;
132
+ }
133
+ public function getproductData($observer)
134
+ {
135
+ if(Mage::helper('reviewsystem')->isModuleEnable()){
136
+ $currentUrl =$_SERVER['REQUEST_URI'];
137
+ if (strpos($currentUrl,'?criteek=') !== false) {
138
+ $customer_email= $_GET['criteek'];
139
+
140
+ $collection =Mage::getModel('reviewsystem/emailQueue')->getCollection()
141
+ ->addFieldToFilter('status', array('eq'=>1))
142
+ ->addFieldToFilter('id', array('eq'=>$customer_email))
143
+ ->addFieldToSelect('*');
144
+ if($collection->getData())
145
+ {
146
+ foreach($collection as $data)
147
+ {
148
+ $data->setReopened(1);
149
+ $data->save();
150
+ }
151
+ }
152
+ }
153
+ }
154
+ return $observer;
155
+ }
156
+
157
+ public function adminSystemConfigApiAuthenticationSection()
158
+ {
159
+
160
+ if(Mage::getStoreConfig('reviewsystem/product_review_config/criteek_synch')==1){
161
+
162
+ if(Mage::helper('reviewsystem')->getToken()==""){
163
+ return Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again'));
164
+ }
165
+ }
166
+ return ;
167
+ }
168
+ }
app/code/community/Criteek/Reviewsystem/Model/Order/Status.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Model_Order_Status
15
+ {
16
+ public function toOptionArray()
17
+ {
18
+ $orderStatusCollection = Mage::getModel('sales/order_status')->getResourceCollection()->getData();
19
+ $status = array();
20
+ $status = array('-1'=>'Please Select..');
21
+
22
+ foreach($orderStatusCollection as $orderStatus) {
23
+ $status[] = array (
24
+ 'value' => $orderStatus['status'], 'label' => $orderStatus['label']);
25
+ }
26
+ return $status;
27
+ }
28
+
29
+ }
app/code/community/Criteek/Reviewsystem/controllers/Adminhtml/AnalyticsController.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Adminhtml_AnalyticsController extends Mage_Adminhtml_Controller_action {
15
+
16
+ public function _initAction()
17
+ {
18
+
19
+ $this->loadLayout()
20
+ ->_addBreadcrumb(Mage::helper('reviewsystem')->__('Email Analytics'), Mage::helper('reviewsystem')->__('Email Analytics'));
21
+ return $this;
22
+ }
23
+
24
+ public function indexAction()
25
+ {
26
+ $this->_title($this->__('Email Analytics'))->_title($this->__('Email Analytics'))->_title($this->__('Email Analytics Report'));
27
+
28
+ $this->_initAction()
29
+ // ->_setActiveMenu('reviewsystem/report')
30
+ ->_addBreadcrumb(Mage::helper('reviewsystem')->__('Email Analytics'), Mage::helper('reviewsystem')->__('Email Analytics Report'));
31
+ $this->getLayout()->getBlock('grid.filter.form');
32
+ $this->renderLayout();
33
+
34
+ }
35
+
36
+ public function exportCsvAction()
37
+ {
38
+ $datarow =array();
39
+ if ($data = $this->getRequest()->getPost()) {
40
+ $orders_csv_row ="Date,Product Name,Order Id,Customer Email,Customer Name,Email Send to Customer,Responded By Customer,Review uploaded By Customer";
41
+ $orders_csv_row.="\n";
42
+ $from = $_REQUEST['from'];
43
+ $to = $_REQUEST['to'];
44
+ $from_date = date('Y-m-d' . ' 00:00:00', strtotime($from));
45
+ $to_date = date('Y-m-d' . ' 23:59:59', strtotime($to));
46
+ if(!empty($_REQUEST['from']) && !empty($_REQUEST['to'])){
47
+
48
+ $orders_row = array();
49
+ $filter_type = $_REQUEST['filter_type'];
50
+ $from = $_REQUEST['from'];
51
+ $to = $_REQUEST['to'];
52
+ $from_date = date('Y-m-d' . ' 00:00:00', strtotime($from));
53
+ $to_date = date('Y-m-d' . ' 23:59:59', strtotime($to));
54
+ $_orderCollections = Mage::getModel('reviewsystem/emailQueue')->getCollection()
55
+ ->addFieldToFilter('email_time', array('from'=>$from_date, 'to'=>$to_date))
56
+ ->load();
57
+ $result_order = $_orderCollections->count();
58
+ $result_clicked =$_orderCollections->addFieldToFilter('reopened', array('eq'=>1))->getData();
59
+ $result_status = $_orderCollections->addFieldToFilter('uploaded_review', array('eq'=>1))->getData();
60
+ $i=0;
61
+ foreach($_orderCollections as $key=>$single_order) {
62
+ $clicked =$single_order->getReopened();
63
+ $email =$single_order->getCustomerEmail();
64
+ $streamid =$single_order->getProductSku();
65
+ $helper = Mage::helper('reviewsystem');
66
+ $status =$single_order->getStatus();
67
+ $helper->fetchReviewersStatus($streamid ,$email)->message;
68
+
69
+ if($clicked ==0)
70
+ {
71
+ $clicked= "No";
72
+ }elseif($clicked==1)
73
+ {
74
+ $clicked= "Yes";
75
+ }
76
+ if($helper->fetchReviewersStatus($status ,$email)->message =="Reviewer present")
77
+ {
78
+ Mage::getModel('reviewsystem/emailQueue')->load($single_order->getId())->addData(array('uploaded_review'=>1))->save();
79
+ $upload= "Yes";
80
+ }else
81
+ {
82
+ $upload= "No";
83
+ }
84
+ if($status ==0)
85
+ {
86
+ $status= "No";
87
+ }else
88
+ {
89
+ $status= "Yes";
90
+ }
91
+ $order = Mage::getModel('sales/order')->load($single_order->getOrderId());
92
+ $Incrementid = $order->getIncrementId();
93
+ $datarow = array(date("m/d/Y",strtotime($single_order->getEmailTime())), $single_order->getProductName(),$Incrementid ,$email,$single_order->getCustomerName(),$status,$clicked,$upload);
94
+ }
95
+ }else{
96
+ $orders_row = array();
97
+
98
+ $_orderCollections = Mage::getModel('reviewsystem/emailQueue')->getCollection()
99
+ ->load();
100
+ $result_order = $_orderCollections->count();
101
+ $result_clicked =$_orderCollections->addFieldToFilter('reopened', array('eq'=>1))->getData();
102
+ $result_status = Mage::getModel('reviewsystem/emailQueue')->getCollection()
103
+ ->load()->addFieldToFilter('uploaded_review', array('eq'=>1))->getData();
104
+ $i=0;
105
+ foreach($_orderCollections as $key=>$single_order) {
106
+ $clicked =$single_order->getReopened();
107
+ $email =$single_order->getCustomerEmail();
108
+ $streamid =$single_order->getProductSku();
109
+ $helper = Mage::helper('reviewsystem');
110
+ $status =$single_order->getStatus();
111
+ $helper->fetchReviewersStatus($streamid ,$email)->message;
112
+
113
+ if($clicked ==0)
114
+ {
115
+ $clicked= "No";
116
+ }elseif($clicked==1)
117
+ {
118
+ $clicked= "Yes";
119
+ }
120
+ if($helper->fetchReviewersStatus($status ,$email)->message =="Reviewer present")
121
+ {
122
+ Mage::getModel('reviewsystem/emailQueue')->load($single_order->getId())->addData(array('uploaded_review'=>1))->save();
123
+ $upload= "Yes";
124
+ }else
125
+ {
126
+ $upload= "No";
127
+ }
128
+ if($status ==0)
129
+ {
130
+ $status= "No";
131
+ }else
132
+ {
133
+ $status= "Yes";
134
+ }
135
+ $order = Mage::getModel('sales/order')->load($single_order->getOrderId());
136
+ $Incrementid = $order->getIncrementId();
137
+ $datarow = array(date("m/d/Y",strtotime($single_order->getEmailTime())), $single_order->getProductName(),$Incrementid ,$email,$single_order->getCustomerName(),$status,$clicked,$upload);
138
+ $line = "";
139
+ $comma = "";
140
+ foreach($datarow as $titlename) {
141
+ $line .= $comma . str_replace(array(','),array(""), $titlename);
142
+ $comma = ",";
143
+ }
144
+
145
+ $line .= "\n";
146
+
147
+ $orders_csv_row .=$line;
148
+
149
+ }
150
+
151
+ }
152
+ }
153
+ $fileName = 'analytics_report.csv';
154
+ $this->_sendUploadResponse($fileName, $orders_csv_row);
155
+
156
+ }
157
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
158
+ {
159
+ $response = $this->getResponse();
160
+ $response->setHeader('HTTP/1.1 200 OK','');
161
+ $response->setHeader('Pragma', 'public', true);
162
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
163
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
164
+ $response->setHeader('Last-Modified', date('r'));
165
+ $response->setHeader('Accept-Ranges', 'bytes');
166
+ $response->setHeader('Content-Length', strlen($content));
167
+ $response->setHeader('Content-type', $contentType);
168
+ $response->setBody($content);
169
+ $response->sendResponse();
170
+ die;
171
+ }
172
+ }
app/code/community/Criteek/Reviewsystem/controllers/Adminhtml/CategoryController.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Adminhtml_CategoryController extends Mage_Adminhtml_Controller_action {
15
+
16
+
17
+ /**
18
+ * _initAction
19
+ *
20
+ * @return object
21
+ */
22
+ protected function _initAction() {
23
+ $this->loadLayout()
24
+ ->_setActiveMenu('reviewsystem/reviewsystem_category_int')
25
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Synchronize Categories'), Mage::helper('adminhtml')->__('Synchronize Categories'));
26
+ return $this;
27
+ }
28
+
29
+ /**
30
+ * indexAction
31
+ *
32
+ * @return
33
+ */
34
+ public function indexAction() {
35
+
36
+ $this->_initAction();
37
+ $this->renderLayout();
38
+ }
39
+
40
+
41
+ /**
42
+ * gridAction
43
+ *
44
+ * @return object
45
+ */
46
+ public function gridAction()
47
+ {
48
+
49
+ $this->loadLayout();
50
+ $this->getResponse()->setBody(
51
+ $this->getLayout()->createBlock('reviewsystem/adminhtml_category_grid')->toHtml()
52
+ );
53
+ }
54
+
55
+ /**
56
+ * editAction
57
+ *
58
+ * @return object
59
+ */
60
+
61
+ public function editAction()
62
+ {
63
+ $this->loadLayout();
64
+ $this->renderLayout();
65
+ }
66
+ /**
67
+ * saveAction
68
+ *
69
+ * @return object
70
+ */
71
+
72
+ public function saveAction()
73
+ {
74
+ if ($data = $this->getRequest()->getPost())
75
+ {
76
+ $categoryId = $this->getRequest()->getParam('id');
77
+ $collectForId = Mage::getModel('reviewsystem/category')->getCollection()->addFieldToFilter('category_id',$categoryId)->addFieldToSelect('id')->getData();
78
+
79
+ $id= $collectForId[0]['id'];
80
+ $model =Mage::getModel('reviewsystem/category')->load($id);
81
+ $interval= $this->getRequest()->getParam('interval');
82
+ try {
83
+ if ($model) {
84
+ $model
85
+ ->setInterval($interval)
86
+ ->save();
87
+ }
88
+
89
+
90
+ if (!$model->getId()) {
91
+ Mage::throwException(Mage::helper('reviewsystem')->__('Error saving interval'));
92
+ }
93
+
94
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('reviewsystem')->__('Interval is saved successfully.'));
95
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
96
+ $this->_redirect('*/*/');
97
+
98
+ } catch (Exception $e) {
99
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
100
+ if ($model && $model->getId()) {
101
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
102
+ } else {
103
+ $this->_redirect('*/*/');
104
+ }
105
+ }
106
+
107
+ return;
108
+ }
109
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('No data found to save'));
110
+ $this->_redirect('*/*/');
111
+ }
112
+
113
+
114
+ public function massIntervelAction() {
115
+
116
+ $helper = Mage::helper('reviewsystem');
117
+ $categoryIds = $this->getRequest()->getParam('id');
118
+ foreach( $categoryIds as $categoryId) {
119
+ $data = array('interval'=>10);
120
+ $colId =Mage::getModel('reviewsystem/category')->getCollection()->addFieldToFilter('category_id', $categoryId)->getFirstItem()->getId();
121
+ Mage::getModel('reviewsystem/category')->load($colId)->addData($data)->save();
122
+
123
+ }
124
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('reviewsystem')->__('Default Interval is saved successfully.'));
125
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
126
+ $this->_redirect('*/*/');
127
+ }
128
+ }
app/code/community/Criteek/Reviewsystem/controllers/Adminhtml/DashboardController.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ class Criteek_Reviewsystem_Adminhtml_DashboardController extends Mage_Adminhtml_Controller_action {
15
+
16
+ /**
17
+ * indexAction
18
+ *
19
+ * @return
20
+ */
21
+ public function indexAction() {
22
+
23
+ $domainID = Mage::helper('reviewsystem')->getDomainId();
24
+ if($domainID)
25
+ $this->_redirectUrl('http://www.criteek.tv/widget/widgetProducts/userProducts/did/'.$domainID);
26
+ else
27
+ $this->_redirectUrl('http://www.criteek.tv/user/login');
28
+ }
29
+
30
+ }
app/code/community/Criteek/Reviewsystem/data/.DS_Store ADDED
Binary file
app/code/community/Criteek/Reviewsystem/data/reviewsystem_setup/data-install-1.0.0.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+ $installer = $this;
14
+ $categories = Mage::getModel('catalog/category')->getCollection()
15
+ ->addAttributeToSelect('*')//or you can just add some attributes
16
+ ->addAttributeToFilter('level', 2)//2 is actually the first level
17
+ ->addAttributeToFilter('is_active', 1)//if you want only active categories
18
+ ;
19
+ $interval=10;
20
+
21
+ foreach( $categories as $category) {
22
+ $model = Mage::getModel('reviewsystem/category');
23
+ $model->setCategoryId($category->getId())
24
+ ->setInterval($interval)
25
+ ->save();
26
+ }
27
+
28
+ ?>
app/code/community/Criteek/Reviewsystem/etc/adminhtml.xml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <config>
4
+ <menu>
5
+ <reviewsystem translate="title" module="reviewsystem">
6
+ <title>Criteek</title>
7
+ <depends>
8
+ <config>reviewsystem/product_review_config/criteek_synch</config>
9
+ </depends>
10
+ <sort_order>400</sort_order>
11
+ <children>
12
+ <reviewsystem_category_int translate="title" module="reviewsystem">
13
+ <sort_order>3</sort_order>
14
+ <title>Set Category based Email sending Interval</title>
15
+ <action>reviewsystem/adminhtml_category/index</action>
16
+ </reviewsystem_category_int>
17
+ </children>
18
+ <children>
19
+ <reviewsystem_manage_widget translate="title" module="reviewsystem">
20
+ <sort_order>1</sort_order>
21
+ <title>Dashboard</title>
22
+ <action>reviewsystem/adminhtml_dashboard/index</action>
23
+ </reviewsystem_manage_widget>
24
+ </children>
25
+ <children>
26
+ <reviewsystem_analytics_report translate="title" module="reviewsystem">
27
+ <sort_order>2</sort_order>
28
+ <title>Email Analytics</title>
29
+ <action>reviewsystem/adminhtml_analytics/index</action>
30
+ </reviewsystem_analytics_report>
31
+ </children>
32
+ </reviewsystem>
33
+ </menu>
34
+ <acl>
35
+ <resources>
36
+ <admin>
37
+ <children>
38
+ <system>
39
+ <children>
40
+ <config>
41
+ <children>
42
+ <reviewsystem translate="title" module="reviewsystem">
43
+ <title>reviewsystem</title>
44
+ <sort_order>999</sort_order>
45
+ </reviewsystem>
46
+ <manage_widget translate="title" module="reviewsystem">
47
+ <title>criteek manage widget</title>
48
+ <sort_order>990</sort_order>
49
+ </manage_widget>
50
+ </children>
51
+ </config>
52
+ </children>
53
+ </system>
54
+ </children>
55
+ </admin>
56
+ </resources>
57
+ </acl>
58
+ </config>
app/code/community/Criteek/Reviewsystem/etc/config.xml ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Criteek_Reviewsystem>
6
+ <version>1.0.0</version>
7
+ </Criteek_Reviewsystem>
8
+ </modules>
9
+ <admin>
10
+ <routers>
11
+ <reviewsystem>
12
+ <use>admin</use>
13
+ <args>
14
+ <module>Criteek_Reviewsystem</module>
15
+ <frontName>reviewsystem</frontName>
16
+ </args>
17
+ </reviewsystem>
18
+ </routers>
19
+ </admin>
20
+ <adminhtml>
21
+
22
+ <acl>
23
+ <resources>
24
+ <all>
25
+ <title>Allow Everything</title>
26
+ </all>
27
+ <admin>
28
+ <children>
29
+ <Criteek_Reviewsystem>
30
+ <title>Criteek Reviewsystem Module</title>
31
+ <sort_order>10</sort_order>
32
+ </Criteek_Reviewsystem>
33
+ </children>
34
+ </admin>
35
+ </resources>
36
+ </acl>
37
+ <layout>
38
+ <updates>
39
+ <reviewsystem>
40
+ <file>reviewsystem.xml</file>
41
+ </reviewsystem>
42
+ </updates>
43
+ </layout>
44
+ </adminhtml>
45
+ <global>
46
+ <models>
47
+ <reviewsystem>
48
+ <class>Criteek_Reviewsystem_Model</class>
49
+ <resourceModel>reviewsystem_mysql4</resourceModel>
50
+ </reviewsystem>
51
+ <reviewsystem_mysql4>
52
+ <class>Criteek_Reviewsystem_Model_Mysql4</class>
53
+ <entities>
54
+ <category>
55
+ <table>criteek_reviewsystem_category</table>
56
+ </category>
57
+ </entities>
58
+ <entities>
59
+ <emailQueue>
60
+ <table>criteek_reviewsystem_queue</table>
61
+ </emailQueue>
62
+ </entities>
63
+ </reviewsystem_mysql4>
64
+ </models>
65
+ <helpers>
66
+ <reviewsystem>
67
+ <class>Criteek_Reviewsystem_Helper</class>
68
+ </reviewsystem>
69
+ </helpers>
70
+ <resources>
71
+ <reviewsystem_setup>
72
+ <setup>
73
+ <module>Criteek_Reviewsystem</module>
74
+ </setup>
75
+ <connection>
76
+ <use>core_setup</use>
77
+ </connection>
78
+ </reviewsystem_setup>
79
+ <reviewsystem_write>
80
+ <connection>
81
+ <use>core_write</use>
82
+ </connection>
83
+ </reviewsystem_write>
84
+ <reviewsystem_read>
85
+ <connection>
86
+ <use>core_read</use>
87
+ </connection>
88
+ </reviewsystem_read>
89
+ </resources>
90
+ <blocks>
91
+ <reviewsystem>
92
+ <class>Criteek_Reviewsystem_Block</class>
93
+ </reviewsystem>
94
+ </blocks>
95
+ <sales>
96
+ <order>
97
+ <statuses>
98
+ <shipped translate="label">
99
+ <label>Complete</label>
100
+ </shipped>
101
+ </statuses>
102
+
103
+ </order>
104
+ </sales>
105
+ <events>
106
+ <sales_order_save_commit_after><!-- observe the event -->
107
+ <observers>
108
+ <reviewsystem>
109
+ <class>reviewsystem/observer</class>
110
+ <method>getOrder</method>
111
+ </reviewsystem>
112
+ </observers>
113
+ </sales_order_save_commit_after>
114
+ <catalog_category_save_commit_after><!-- observe the event -->
115
+ <observers>
116
+ <reviewsystem_category>
117
+ <class>reviewsystem/observer</class>
118
+ <method>getCategory</method>
119
+ </reviewsystem_category>
120
+ </observers>
121
+ </catalog_category_save_commit_after>
122
+ <admin_system_config_changed_section_manage_widget>
123
+ <observers>
124
+ <reviewsystem>
125
+ <type>singleton</type>
126
+ <class>reviewsystem/observer</class>
127
+ <method>adminSystemConfigChangedSection</method>
128
+ </reviewsystem>
129
+ </observers>
130
+ </admin_system_config_changed_section_manage_widget>
131
+ <admin_system_config_changed_section_reviewsystem>
132
+ <observers>
133
+ <reviewsystem>
134
+ <type>singleton</type>
135
+ <class>reviewsystem/observer</class>
136
+ <method>adminSystemConfigApiAuthenticationSection</method>
137
+ </reviewsystem>
138
+ </observers>
139
+ </admin_system_config_changed_section_reviewsystem>
140
+ <controller_action_predispatch_catalog_product_view><!-- observe the event -->
141
+ <observers>
142
+ <reviewsystem_analytics>
143
+ <class>reviewsystem/observer</class>
144
+ <method>getproductData</method>
145
+ </reviewsystem_analytics>
146
+ </observers>
147
+ </controller_action_predispatch_catalog_product_view>
148
+ </events>
149
+ <template>
150
+ <email>
151
+ <product_review_email_template>
152
+ <label>Criteek Reviewsystem Review Email</label>
153
+ <file>product_review_email.html</file>
154
+ <type>html</type>
155
+ </product_review_email_template>
156
+ </email>
157
+ </template>
158
+ </global>
159
+ <default>
160
+ <reviewsystem>
161
+ <product_review_config>
162
+ <allowed_status>complete</allowed_status>
163
+ <criteek_synch>0</criteek_synch>
164
+ </product_review_config>
165
+ <manage_widget_config>
166
+ <widget_js_code><![CDATA[<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('criteek-js-code')->toHtml();
167
+ ?>
168
+ ]]></widget_js_code>
169
+ <widget_synch>0</widget_synch>
170
+ </manage_widget_config>
171
+ </reviewsystem>
172
+ </default>
173
+ <crontab>
174
+ <jobs>
175
+ <reviewsystem>
176
+ <schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
177
+ <run><model>reviewsystem/cron::sendEmail</model></run>
178
+ </reviewsystem>
179
+ </jobs>
180
+ </crontab>
181
+ </config>
app/code/community/Criteek/Reviewsystem/etc/system.xml ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <tabs>
5
+ <criteek translate="label" module="reviewsystem">
6
+ <label>Criteek Review</label>
7
+ <sort_order>209</sort_order>
8
+ </criteek>
9
+ </tabs>
10
+ <sections>
11
+ <reviewsystem translate="label" module="reviewsystem">
12
+ <label>Criteek Review System</label>
13
+ <tab>criteek</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>112</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>0</show_in_website>
18
+ <show_in_store>0</show_in_store>
19
+ <groups>
20
+ <product_review_config translate="label">
21
+ <label>Enable/Disable Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>0</show_in_website>
26
+ <show_in_store>0</show_in_store>
27
+ <expanded>1</expanded>
28
+ <comment><![CDATA[Please enter in your Api App Key and Secret in the fields below to finish the installation.If you need help the Criteek support team is here 24/7, don't hesitate to contact us.<br/> <a target="_blank" href="https://www.criteek.tv/">Click here</a> for the advanced customization guide.]]></comment>
29
+ <fields>
30
+ <criteek_synch translate="label">
31
+ <label>Enable API Module</label>
32
+ <frontend_type>select</frontend_type>
33
+ <source_model>adminhtml/system_config_source_yesno</source_model>
34
+ <sort_order>1</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </criteek_synch>
39
+ <api_app_key translate="label">
40
+ <label>API Key</label>
41
+ <frontend_type>text</frontend_type>
42
+ <comment><![CDATA[Get your API Key at your Criteek account setting page. Click here to sign in to <a target="_blank" href="https://www.criteek.tv/user/login">Criteek</a>]]></comment>
43
+ <sort_order>4</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>0</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ <validate>required-entry</validate>
48
+ <depends><criteek_synch>1</criteek_synch></depends>
49
+ </api_app_key>
50
+ <api_app_secret translate="label">
51
+ <label>API Secret</label>
52
+ <comment><![CDATA[Get your API Secret at your Criteek account setting page. Click here to sign in to <a target="_blank" href="https://www.criteek.tv/user/login">Criteek</a>]]></comment>
53
+ <frontend_type>Password</frontend_type>
54
+ <sort_order>5</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>0</show_in_website>
57
+ <show_in_store>0</show_in_store>
58
+ <validate>required-entry</validate>
59
+ <depends><criteek_synch>1</criteek_synch></depends>
60
+ </api_app_secret>
61
+ <allowed_status translate="label">
62
+ <label> Custom Mail After Purchase Order Status</label>
63
+ <frontend_type>select</frontend_type>
64
+ <source_model>reviewsystem/order_status</source_model>
65
+ <sort_order>10</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>0</show_in_store>
69
+ <can_be_empty>1</can_be_empty>
70
+ </allowed_status>
71
+
72
+ </fields>
73
+ </product_review_config>
74
+
75
+ </groups>
76
+ <groups>
77
+ <manage_widget_config translate="label">
78
+ <label>Manage Widget Settings</label>
79
+ <frontend_type>text</frontend_type>
80
+ <sort_order>113</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>0</show_in_website>
83
+ <show_in_store>0</show_in_store>
84
+ <expanded>1</expanded>
85
+ <fields>
86
+ <widget_synch translate="label">
87
+ <label>Enable/Disable Widget</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>adminhtml/system_config_source_yesno</source_model>
90
+ <sort_order>1</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
+ </widget_synch>
95
+ <widget_js_code translate="label">
96
+ <label> Widget JS Code</label>
97
+ <frontend_type>textarea</frontend_type>
98
+ <comment>Please don't change this code</comment>
99
+ <sort_order>10</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
+ <depends><widget_synch>1</widget_synch></depends>
104
+ </widget_js_code>
105
+ </fields>
106
+ </manage_widget_config>
107
+ </groups>
108
+ </reviewsystem>
109
+ </sections>
110
+ </config>
111
+
112
+
app/code/community/Criteek/Reviewsystem/sql/.DS_Store ADDED
Binary file
app/code/community/Criteek/Reviewsystem/sql/reviewsystem_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+ $installer = $this;
14
+ $connection = $installer->getConnection();
15
+ $installer->startSetup();
16
+ $connection->insert($installer->getTable('cms/block'), array(
17
+ 'title' => 'Criteek Js Code',
18
+ 'identifier' => 'criteek-js-code',
19
+ 'content' => '{{block type="core/template" template="reviewsystem/reviewcode.phtml"}}',
20
+ 'creation_time' => now(),
21
+ 'update_time' => now(),
22
+ ));
23
+ $connection->insert($installer->getTable('cms/block_store'), array(
24
+ 'block_id' => $connection->lastInsertId(),
25
+ 'store_id' => 0
26
+ ));
27
+ $installer->run("
28
+ -- DROP TABLE IF EXISTS {$this->getTable('criteek_reviewsystem_category')};
29
+ CREATE TABLE {$this->getTable('criteek_reviewsystem_category')} (
30
+ `id` int(11) unsigned NOT NULL auto_increment,
31
+ `category_id` int(10) NOT NULL,
32
+ `interval` int(10) NULL,
33
+ PRIMARY KEY (`id`),
34
+ KEY `IDX_CRITEEK_REVIEWSYSTEM_CATEGORY_CATEGORY_ID` (`category_id`),
35
+ CONSTRAINT `FK_W3C_HTSH_CTGR_CTGR_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`category_id`) REFERENCES `{$this->getTable('catalog_category_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
36
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
37
+
38
+ -- DROP TABLE IF EXISTS {$this->getTable('criteek_reviewsystem_queue')};
39
+ CREATE TABLE {$this->getTable('criteek_reviewsystem_queue')} (
40
+ `id` int( 10 ) unsigned NOT NULL auto_increment,
41
+ `product_id` int( 10 ) unsigned NOT NULL DEFAULT 0,
42
+ `product_name` varchar (64) default NULL,
43
+ `product_sku` varchar (64) default NULL,
44
+ `order_id` int( 10 ) unsigned NOT NULL DEFAULT 0,
45
+ `email_time` datetime NOT NULL default '0000-00-00 00:00:00',
46
+ `customer_email` varchar (64) default NULL,
47
+ `customer_name` varchar (64) default NULL,
48
+ `status` tinyint (10) unsigned NOT NULL DEFAULT 0,
49
+ `uploaded_review` tinyint (10) unsigned NOT NULL DEFAULT 0,
50
+ `reopened` tinyint (10) unsigned NOT NULL DEFAULT 0,
51
+ PRIMARY KEY (`id`)
52
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
53
+ ");
54
+
55
+ $statusTable = $installer->getTable('sales/order_status');
56
+ $statusStateTable = $installer->getTable('sales/order_status_state');
57
+ //$statusLabelTable = $installer->getTable('sales/order_status_label');
58
+
59
+ $data = array(
60
+ array('status' => 'shipped', 'label' => 'Shipped')
61
+ );
62
+ $installer->getConnection()->insertArray($statusTable, array('status', 'label'), $data);
63
+ $installer->getConnection()->insertArray(
64
+ $statusStateTable, array('status', 'state', 'is_default'),array( array(
65
+ 'status' => 'shipped',
66
+ 'state' => 'complete',
67
+ 'is_default' => 0
68
+ )
69
+ )
70
+ );
71
+
72
+ ?>
app/design/adminhtml/default/default/layout/reviewsystem.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <layout version="1.0.0">
4
+ <reviewsystem_adminhtml_category_index>
5
+ <reference name="content">
6
+ <block type="reviewsystem/adminhtml_category" name="reviewsystem_category" />
7
+ </reference>
8
+ </reviewsystem_adminhtml_category_index>
9
+ <reviewsystem_adminhtml_product_index>
10
+ <reference name="content">
11
+ <block type="reviewsystem/adminhtml_product" name="reviewsystem_product" />
12
+ </reference>
13
+ </reviewsystem_adminhtml_product_index>
14
+ <reviewsystem_adminhtml_analytics_index>
15
+ <reference name="content">
16
+ <block type="adminhtml/template" name="sales" template="reviewsystem/emailanalytics.phtml"/>
17
+ </reference>
18
+ </reviewsystem_adminhtml_analytics_index>
19
+ <reviewsystem_adminhtml_product_review>
20
+ <reference name="content">
21
+ <block type="reviewsystem/adminhtml_product_review" name="reviewsystem_product_list" />
22
+ </reference>
23
+ </reviewsystem_adminhtml_product_review>
24
+ <reviewsystem_adminhtml_category_edit>
25
+ <reference name="content">
26
+ <block type="reviewsystem/adminhtml_category_edit" name="reviewsystem_category_edit" />
27
+ </reference>
28
+ </reviewsystem_adminhtml_category_edit>
29
+ <default>
30
+ <reference name="head">
31
+ <action method="addJs"><script>reviewsystem/widgetcode.js</script></action>
32
+ </reference>
33
+ </default>
34
+ </layout>
app/design/adminhtml/default/default/template/reviewsystem/emailanalytics.phtml ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ $to="";
15
+ $from="";
16
+
17
+ $result_order = 0;
18
+
19
+ if(!empty($_REQUEST['from']) && !empty($_REQUEST['to'])){
20
+
21
+ $orders_row = array();
22
+ $filter_type = $_REQUEST['filter_type'];
23
+ $from = $_REQUEST['from'];
24
+ $to = $_REQUEST['to'];
25
+ $from_date = date('Y-m-d' . ' 00:00:00', strtotime($from));
26
+ $to_date = date('Y-m-d' . ' 23:59:59', strtotime($to));
27
+ $_orderCollections = Mage::getModel('reviewsystem/emailQueue')->getCollection()
28
+ ->addFieldToFilter('email_time', array('from'=>$from_date, 'to'=>$to_date))
29
+ ->load();
30
+ $result_order = $_orderCollections->count();
31
+ $result_clicked =$_orderCollections->addFieldToFilter('reopened', array('eq'=>1))->getData();
32
+ $result_status = $_orderCollections->addFieldToFilter('uploaded_review', array('eq'=>1))->getData();
33
+ $i=0;
34
+ foreach($_orderCollections as $key=>$single_order) {
35
+ $clicked =$single_order->getReopened();
36
+ $email =$single_order->getCustomerEmail();
37
+ $streamid =$single_order->getProductSku();
38
+ $helper = Mage::helper('reviewsystem');
39
+ $status =$single_order->getStatus();
40
+ $helper->fetchReviewersStatus($streamid ,$email)->message;
41
+
42
+ if($clicked ==0)
43
+ {
44
+ $clicked= "No";
45
+ }elseif($clicked==1)
46
+ {
47
+ $clicked= "Yes";
48
+ }
49
+ if($helper->fetchReviewersStatus($status ,$email)->message =="Reviewer present")
50
+ {
51
+ Mage::getModel('reviewsystem/emailQueue')->load($single_order->getId())->addData(array('uploaded_review'=>1))->save();
52
+ $upload= "Yes";
53
+ }else
54
+ {
55
+ $upload= "No";
56
+ }
57
+ if($status ==0)
58
+ {
59
+ $status= "No";
60
+ }else
61
+ {
62
+ $status= "Yes";
63
+ }
64
+ $order = Mage::getModel('sales/order')->load($single_order->getOrderId());
65
+ $Incrementid = $order->getIncrementId();
66
+ $orders_row[] = array(date("m/d/Y",strtotime($single_order->getEmailTime())), $single_order->getProductName(),$Incrementid ,$email,$single_order->getCustomerName(),$status,$clicked,$upload);
67
+ }
68
+ }else{
69
+ $orders_row = array();
70
+
71
+ $_orderCollections = Mage::getModel('reviewsystem/emailQueue')->getCollection()
72
+ ->load();
73
+ $result_order = $_orderCollections->count();
74
+ $result_clicked =$_orderCollections->addFieldToFilter('reopened', array('eq'=>1))->getData();
75
+ $result_status = Mage::getModel('reviewsystem/emailQueue')->getCollection()
76
+ ->load()->addFieldToFilter('uploaded_review', array('eq'=>1))->getData();
77
+ $i=0;
78
+ foreach($_orderCollections as $key=>$single_order) {
79
+ $clicked =$single_order->getReopened();
80
+ $email =$single_order->getCustomerEmail();
81
+ $streamid =$single_order->getProductSku();
82
+ $helper = Mage::helper('reviewsystem');
83
+ $status =$single_order->getStatus();
84
+ $helper->fetchReviewersStatus($streamid ,$email)->message;
85
+
86
+ if($clicked ==0)
87
+ {
88
+ $clicked= "No";
89
+ }elseif($clicked==1)
90
+ {
91
+ $clicked= "Yes";
92
+ }
93
+ if($helper->fetchReviewersStatus($status ,$email)->message =="Reviewer present")
94
+ {
95
+ Mage::getModel('reviewsystem/emailQueue')->load($single_order->getId())->addData(array('uploaded_review'=>1))->save();
96
+ $upload= "Yes";
97
+ }else
98
+ {
99
+ $upload= "No";
100
+ }
101
+ if($status ==0)
102
+ {
103
+ $status= "No";
104
+ }else
105
+ {
106
+ $status= "Yes";
107
+ }
108
+ $order = Mage::getModel('sales/order')->load($single_order->getOrderId());
109
+ $Incrementid = $order->getIncrementId();
110
+ $orders_row[] = array(date("m/d/Y",strtotime($single_order->getEmailTime())), $single_order->getProductName(),$Incrementid ,$email,$single_order->getCustomerName(),$status,$clicked,$upload);
111
+
112
+
113
+ }
114
+
115
+ }
116
+
117
+ ?>
118
+
119
+ <div id="anchor-content" class="middle">
120
+ <div id="page:main-container">
121
+ <div class="content-header">
122
+ <table cellspacing="0">
123
+ <tbody>
124
+ <tr>
125
+ <td style="width:50%;"><h3 class="icon-head head-report-sales-sales"><?php echo $this->__("Email Analytics");?></h3></td>
126
+ <td class="form-buttons"><button style="" onclick="filterFormSubmit.submit()" class="scalable " type="button" id="id_<?php echo Mage::getSingleton('core/session')->getFormKey() ?>"><span>Show Report</span></button></td>
127
+ </tr>
128
+ </tbody>
129
+ </table>
130
+ </div>
131
+ <div>
132
+ <div class="entry-edit">
133
+ <form method="get" action="<?php echo Mage::helper('core/url')->getCurrentUrl();?>" id="filter_form">
134
+ <?php /*?><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><?php */?>
135
+ <div class="entry-edit-head">
136
+ <h4 class="icon-head head-edit-form fieldset-legend">Filter</h4>
137
+ <div class="form-buttons"></div>
138
+ </div>
139
+ <div id="sales_report_base_fieldset" class="fieldset">
140
+ <div class="hor-scroll">
141
+ <table cellspacing="0" class="form-list">
142
+ <tbody>
143
+ <tr>
144
+ <td class="label"><label for="sales_report_from">From <span class="required">*</span></label></td>
145
+ <td class="value"><input type="text" style="width:110px !important;" class="input-text" title="From" value="<?php echo $from; ?>" id="sales_report_from" name="from" />
146
+ <img style="" title="Select Date" id="sales_report_from_trig" class="v-middle" alt="" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);?>skin/adminhtml/default/default/images/grid-cal.gif">
147
+ <script type="text/javascript">
148
+ //<![CDATA[
149
+ Calendar.setup({
150
+ inputField: "sales_report_from",
151
+ ifFormat: "%m/%e/%y",
152
+ showsTime: false,
153
+ button: "sales_report_from_trig",
154
+ align: "Bl",
155
+ singleClick : true
156
+ });
157
+ //]]>
158
+ </script></td>
159
+ </tr>
160
+ <tr>
161
+ <td class="label"><label for="sales_report_to">To <span class="required">*</span></label></td>
162
+ <td class="value"><input type="text" style="width:110px !important;" class=" input-text" title="To" value="<?php echo $to; ?>" id="sales_report_to" name="to" />
163
+ <img style="" title="Select Date" id="sales_report_to_trig" class="v-middle" alt="" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);?>skin/adminhtml/default/default/images/grid-cal.gif">
164
+ <script type="text/javascript">
165
+ //<![CDATA[
166
+ Calendar.setup({
167
+ inputField: "sales_report_to",
168
+ ifFormat: "%m/%e/%y",
169
+ showsTime: false,
170
+ button: "sales_report_to_trig",
171
+ align: "Bl",
172
+ singleClick : true
173
+ });
174
+ //]]>
175
+ </script></td>
176
+ </tr>
177
+ </tbody>
178
+ </table>
179
+ </div>
180
+ </div>
181
+ </form>
182
+ </div>
183
+ <script type="text/javascript">
184
+ //<![CDATA[
185
+ var filterFormSubmit = new varienForm('filter_form');
186
+ function changeStatusOption(optionvalue){
187
+ var filter_date = document.getElementById("hide_for_shipping_date");
188
+ var hide_status_for_shipping_date = document.getElementById("hide_status_for_shipping_date");
189
+ if(optionvalue=="shipping_date"){
190
+ filter_date.className = "no-display";
191
+ hide_status_for_shipping_date.style.display = "none";
192
+ }
193
+ if(optionvalue=="order_date"){
194
+ filter_date.className = "";
195
+ }
196
+ }
197
+ //]]>
198
+ </script>
199
+ <script type="text/javascript"> new FormElementDependenceController({"sales_report_order_statuses":{"sales_report_show_order_statuses":"1"}}); </script>
200
+ <style type="text/css">
201
+ .no-display{display:none;}
202
+ </style>
203
+ </div>
204
+
205
+ <div>
206
+ <?php if($result_order>0){?>
207
+ <table cellspacing="0" class="actions">
208
+ <tbody>
209
+ <tr>
210
+
211
+ <td class="filter-actions a-left">
212
+ Mail sent: <?php echo $result_order?></br>
213
+ Customer clicked on links: <?php echo count($result_clicked) ?></br>
214
+ Review uploaded: <?php echo count($result_status) ?></td>
215
+ <td class="pager">&nbsp;</td>
216
+ <td class="export a-right">
217
+ <form method="post" action="<?php echo $this->getUrl('*/*/exportCsv')?>" id="csv_form">
218
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
219
+ <input type="hidden" value="<?php echo $from; ?>" id="sales_report_from" name="from" />
220
+ <input type="hidden" value="<?php echo $to; ?>" id="sales_report_to" name="to" />
221
+ </form>
222
+ <script type="text/javascript">
223
+ //<![CDATA[
224
+ var csvFormSubmit = new varienForm('csv_form');
225
+ //]]>
226
+ </script>
227
+ </td>
228
+ <td class="filter-actions a-right">
229
+ <img class="v-middle" alt="" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);?>skin/adminhtml/default/default/images/icon_export.gif">&nbsp; Export to:
230
+ <select style="width:8em;" id="sales_order_grid_export" name="sales_order_grid_export">
231
+ <option value="<?php echo $this->getUrl('*/*/exportCsv')?>">CSV</option>
232
+ </select>
233
+ <button onclick="csvFormSubmit.submit()" class="scalable task" type="button"><span>Export</span></button>
234
+ </td>
235
+ </tr>
236
+ </tbody>
237
+ </table>
238
+ <?php } ?>
239
+ <div id="id_<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" class="print_<?php echo Mage::getSingleton('core/session')->getFormKey() ?>">
240
+ <div class="grid">
241
+ <div class="hor-scroll">
242
+ <table cellspacing="0" id="id_<?php echo Mage::getSingleton('core/session')->getFormKey() ?>_table" class="data">
243
+ <colgroup>
244
+ <col>
245
+ <col>
246
+ <col>
247
+ <col>
248
+ <col>
249
+ <col>
250
+ <col>
251
+ <col>
252
+ </colgroup>
253
+ <thead>
254
+ <tr class="headings">
255
+ <th class=" no-link"><span class="nobr">Date</span></th>
256
+ <th class=" no-link"><span class="nobr">Product Name</span></th>
257
+ <th class=" no-link"><span class="nobr">Order Id</span></th>
258
+ <th class=" no-link"><span class="nobr">Customer Email</span></th>
259
+ <th class=" no-link"><span class="nobr">Customer Name</span></th>
260
+ <th class=" no-link"><span class="nobr">Email Send to Customer</span></th>
261
+ <th class=" no-link"><span class="nobr">Responded By Customer</span></th>
262
+ <th class=" no-link"><span class="nobr">Review uploaded By Customer</span></th>
263
+
264
+
265
+ </tr>
266
+ </thead>
267
+ <tbody id="">
268
+ <?php
269
+ if(count($orders_row)>0){
270
+ foreach($orders_row as $singlerows){
271
+ if(!empty($singlerows)){
272
+ echo "<tr>";
273
+ foreach($singlerows as $value){
274
+ ?>
275
+ <td><?php echo $value;?></td>
276
+ <?php
277
+ }
278
+ echo "</tr>";
279
+ }
280
+ }
281
+ }else{
282
+ ?>
283
+ <tr class="even">
284
+ <td colspan="13" class="empty-text a-center">No records found.</td>
285
+ </tr>
286
+ <?php } ?>
287
+ </tbody>
288
+
289
+ </table>
290
+ </div>
291
+ </div>
292
+ </div>
293
+ </div>
294
+ </div>
295
+ </div>
app/design/adminhtml/default/default/template/reviewsystem/grid.phtml ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ $numColumns = sizeof($this->getColumns());
15
+ ?>
16
+ <?php if($this->getCollection()): ?>
17
+ <?php if($this->canDisplayContainer()): ?>
18
+ <?php if($this->getGridHeader()): ?>
19
+ <div class="content-header">
20
+ <table cellspacing="0">
21
+ <tr>
22
+ <td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
23
+ </tr>
24
+ </table>
25
+ </div>
26
+ <?php endif ?>
27
+ <div id="<?php echo $this->getId() ?>">
28
+ <?php else: ?>
29
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
30
+ <?php endif; ?>
31
+ <?php if($this->getStoreSwitcherVisibility() || $this->getDateFilterVisibility()): ?>
32
+ <?php if($this->getStoreSwitcherVisibility()): ?>
33
+ <?php echo $this->getStoreSwitcherHtml() ?>
34
+ <?php endif ?>
35
+ <table cellspacing="0" class="actions">
36
+ <tr>
37
+ <?php if($this->getDateFilterVisibility()): ?>
38
+ <td class="a-left filter">
39
+ <div class="f-left">
40
+ <div><?php echo $this->__('From') ?>:&nbsp;<input class="input-text no-changes required-entry" type="text" id="period_date_from" name="report_from" value="<?php echo $this->getFilter('report_from') ?>" style="width:5em" /> <img src="<?php echo $this->getSkinUrl('images/grid-cal.gif') ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Select Date')) ?>" id="period_date_from_trig" alt="<?php echo Mage::helper('core')->quoteEscape($this->__('Select Date')) ?>" class="v-middle"/>&nbsp;&nbsp;</div>
41
+ <div id="period_date_from_advaice"></div>
42
+ </div>
43
+
44
+ <div class="f-left">
45
+ <div><?php echo $this->__('To') ?>:&nbsp;<input class="input-text no-changes required-entry" type="text" id="period_date_to" name="report_to" value="<?php echo $this->getFilter('report_to') ?>" style="width:5em" /> <img src="<?php echo $this->getSkinUrl('images/grid-cal.gif') ?>" class="v-middle" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Select Date')) ?>"id="period_date_to_trig" alt="<?php echo Mage::helper('core')->quoteEscape($this->__('Select Date')) ?>"/>&nbsp;&nbsp;</div>
46
+ <div id="period_date_to_advaice"></div>
47
+ </div>
48
+
49
+ <div class="f-left">
50
+ <?php echo $this->__('Show By') ?>:
51
+ <select name="report_period" id="report_period" style="width:6em;">
52
+ <?php foreach ($this->getPeriods() as $_value=>$_label): ?>
53
+ <option value="<?php echo $_value ?>" <?php if($this->getFilter('report_period')==$_value): ?> selected<?php endif; ?>><?php echo $_label ?></option>
54
+ <?php endforeach; ?>
55
+ </select>
56
+ <?php echo $this->getRefreshButtonHtml() ?>
57
+ </div>
58
+ <script type="text/javascript">
59
+ <!--
60
+ Calendar.setup({
61
+ inputField : 'period_date_from',
62
+ ifFormat : '<?php echo $this->getDateFormat() ?>',
63
+ button : 'period_date_from_trig',
64
+ align : 'Bl',
65
+ singleClick : true
66
+ });
67
+ Calendar.setup({
68
+ inputField : 'period_date_to',
69
+ ifFormat : '<?php echo $this->getDateFormat() ?>',
70
+ button : 'period_date_to_trig',
71
+ align : 'Bl',
72
+ singleClick : true
73
+ });
74
+ //-->
75
+ </script>
76
+ </td>
77
+ <?php endif; ?>
78
+ <?php if($this->getExportVisibility()): ?>
79
+ <td class="a-right">
80
+ <img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/>&nbsp; <?php echo $this->__('Export to:') ?>
81
+ <select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
82
+ <?php foreach ($this->getExportTypes() as $_type): ?>
83
+ <option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
84
+ <?php endforeach; ?>
85
+ </select>
86
+ <?php echo $this->getExportButtonHtml() ?>
87
+ </td>
88
+ <?php endif; ?>
89
+ </tr>
90
+ </table>
91
+ <?php endif; ?>
92
+
93
+ <div class="grid">
94
+ <table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
95
+ <col/>
96
+ <?php foreach ($this->getColumns() as $_column): ?>
97
+ <col <?php echo $_column->getHtmlProperty() ?>/>
98
+ <?php endforeach; ?>
99
+ <?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
100
+ <thead>
101
+ <?php if ($this->getHeadersVisibility()): ?>
102
+ <tr class="headings">
103
+ <th class="no-link" style="width:100px"><span class="no-br"><?php echo $this->getPeriodText() ?></span></th>
104
+ <?php foreach ($this->getColumns() as $_column): ?>
105
+ <th <?php echo $_column->getHeaderHtmlProperty() ?>><span class="no-br"><?php echo $_column->getHeaderHtml() ?></span></th>
106
+ <?php endforeach; ?>
107
+ </tr>
108
+ <?php endif; ?>
109
+ </thead>
110
+ <?php endif; ?>
111
+ <tbody>
112
+ <?php if ($this->getCollection()->getSize()): ?>
113
+ <?php foreach ($this->getCollection()->getIntervals() as $_index => $_item): ?>
114
+ <tr>
115
+ <?php $report=$this->getReport($_item['start'], $_item['end']) ?>
116
+ <?php $rows=count($report) ?>
117
+ <?php if ($rows > 0 ): ?>
118
+ <td rowspan="<?php echo $rows + ($this->getCountTotals() && $this->getSubtotalVisibility()?1:0) ?>"><?php echo $_index ?></td>
119
+ <?php $i=0;foreach ($report as $_subIndex=>$_subItem): ?>
120
+ <?php if($i>0): ?>
121
+ <tr>
122
+ <?php endif; ?>
123
+ <?php $i++; ?>
124
+ <?php $j=0;foreach ($this->getColumns() as $_column): ?>
125
+ <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$j==$numColumns?'last':'' ?>">
126
+ <?php echo (($_html = $_column->getRowField($_subItem)) != '' ? $_html : '&nbsp;') ?>
127
+ </td>
128
+ <?php endforeach; ?>
129
+ </tr>
130
+ <?php endforeach; ?>
131
+ <?php if($this->getCountTotals() && $rows > 0 && $this->getSubtotalVisibility()): ?>
132
+ <tr>
133
+ <?php $j=0;foreach ($this->getColumns() as $_column): ?>
134
+ <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$j==$numColumns?'last':'' ?> subtotal">
135
+ <?php echo ($j==1)?$this->getSubtotalText():$_column->getRowField($this->getTotals()) ?>
136
+ </td>
137
+ <?php endforeach; ?>
138
+ </tr>
139
+ <?php endif; ?>
140
+ <?php else: ?>
141
+ <?php /*?><td><?php echo $_index ?></td>
142
+ <td colspan="<?php echo $numColumns ?>" class="empty-text <?php echo $this->getEmptyTextClass() ?> last"><?php echo $this->getEmptyText() ?></td><?php */?>
143
+ <?php endif; ?>
144
+ </tr>
145
+ <?php endforeach; ?>
146
+ <?php elseif ($this->getEmptyText()): ?>
147
+ <?php /*?> <tr>
148
+ <td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="<?php echo $numColumns + 1 ?>"><?php echo $this->getEmptyText() ?></td>
149
+ </tr><?php */?>
150
+ <?php endif; ?>
151
+ </tbody>
152
+ <?php if ($this->getCountTotals() && $this->getCollection()->getSize()): ?>
153
+ <tfoot>
154
+ <tr><th><?php echo $this->getTotalText() ?></th>
155
+ <?php $j=0;foreach ($this->getColumns() as $_column): ?>
156
+ <th class="<?php echo $_column->getCssProperty() ?> <?php echo ++$j==$numColumns?'last':'' ?>"><?php echo $_column->getRowField($this->getGrandTotals()) ?></th>
157
+ <?php endforeach; ?>
158
+ </tr>
159
+ </tfoot>
160
+ <?php endif; ?>
161
+ </table>
162
+ </div>
163
+ <?php if($this->canDisplayContainer()): ?>
164
+ </div>
165
+ <script type="text/javascript">
166
+ //<![CDATA[
167
+ <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
168
+ <?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
169
+ <?php if($this->getDateFilterVisibility()):?>
170
+ <?php echo $this->getJsObjectName() ?>.doFilterCallback = validateFilterDate;
171
+ var period_date_from = $('period_date_from');
172
+ var period_date_to = $('period_date_to');
173
+ period_date_from.advaiceContainer = $('period_date_from_advaice');
174
+ period_date_to.advaiceContainer = $('period_date_to_advaice');
175
+
176
+ function validateFilterDate()
177
+ {
178
+ if (period_date_from && period_date_to) {
179
+ return Validation.validate(period_date_from) && Validation.validate(period_date_to);
180
+ }
181
+ else {
182
+ return true;
183
+ }
184
+ }
185
+ <?php endif;?>
186
+ /* Overwrite function from switcher.phtml widget*/
187
+ function switchStore(obj){
188
+ if (obj.options[obj.selectedIndex].getAttribute('website') == 'true') {
189
+ var selectionType = 'website';
190
+ } else if (obj.options[obj.selectedIndex].getAttribute('group') == 'true') {
191
+ var selectionType = 'group';
192
+ } else {
193
+ var selectionType = 'store';
194
+ }
195
+ var storeParam = obj.value ? selectionType + '/' + obj.value + '/' : '';
196
+ if(obj.switchParams){
197
+ storeParam+= obj.switchParams;
198
+ }
199
+ var formParam = new Array('period_date_from', 'period_date_to', 'report_period');
200
+ var paramURL = '';
201
+ var switchURL = '<?php echo $this->getAbsoluteGridUrl(array('_current' => false)); ?>'.replace(/(store|group|website)\/\d+\//,'');
202
+
203
+ for(var i=0;i<formParam.length;i++){
204
+ if ($(formParam[i]).value && $(formParam[i]).name) {
205
+ paramURL+= $(formParam[i]).name + '=' + escape($(formParam[i]).value) + '&';
206
+ }
207
+ }
208
+ setLocation(switchURL + storeParam + '?' + paramURL);
209
+ }
210
+ //]]>
211
+ </script>
212
+ <?php endif; ?>
213
+ <?php endif; ?>
app/design/adminhtml/default/default/template/reviewsystem/grid/container.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+ ?>
14
+ <div class="content-header">
15
+ <table cellspacing="0">
16
+ <tr>
17
+ <td style="<?php echo $this->getHeaderWidth() ?>"><?php echo $this->getHeaderHtml() ?></td>
18
+ <td class="form-buttons"><?php echo $this->getButtonsHtml() ?></td>
19
+ </tr>
20
+ </table>
21
+ </div>
22
+ <div>
23
+ <?php echo $this->getChildHtml('store.switcher') ?>
24
+ </div>
25
+ <div>
26
+ <?php echo $this->getChildHtml('grid.filter.form') ?>
27
+ </div>
28
+ <div>
29
+ <?php echo $this->getGridHtml() ?>
30
+ </div>
31
+ <script type="text/javascript">
32
+ //<![CDATA[
33
+ function filterFormSubmit() {
34
+ var filters = $$('#filter_form input', '#filter_form select');
35
+ var elements = [];
36
+ for(var i in filters){
37
+ if(filters[i].value && filters[i].value.length && !filters[i].disabled) elements.push(filters[i]);
38
+ }
39
+ var validator = new Validation('filter_form');
40
+ if (validator.validate()) {
41
+ setLocation('<?php echo $this->getFilterUrl(); ?>filter/'+encode_base64(Form.serializeElements(elements))+'/');
42
+ }
43
+ }
44
+ //]]>
45
+ </script>
app/design/frontend/base/default/template/reviewsystem/reviewcode.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ *
7
+ * @category Criteek
8
+ * @package Criteek_Reviewsystem
9
+ * @copyright Copyright (c) 2016 Criteek Comm LLC.
10
+ * @author Criteek Developer
11
+ * @license https://www.criteek.tv/terms-of-use CRITEEK TERMS OF USE
12
+ */
13
+
14
+ if(Mage::getStoreConfig('reviewsystem/manage_widget_config/widget_synch')==1) {
15
+ $_product = Mage::registry('current_product');
16
+ echo '<div id="criteek-widget"
17
+ data-product-id="' . $_product->getSku() . '"data-name="' . $_product->getName() . '"
18
+ data-url="' . $_product->getProductUrl() . '" data-description="' . $_product->getName() . '"
19
+ data-product-spec-brand="PRODUCT BRAND"data-product-spec-upc="' . $_product->getUpc() . '"
20
+ data-product-spec-ean="EAN" data-product-spec-sku="' . $_product->getSku() . '"></div>
21
+ <script id="criteekwidget"src="https://widget.criteek.tv/servicewidget_v1.js"></script>';
22
+ }
23
+ ?>
app/etc/modules/Criteek_Reviewsystem.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Criteek_Reviewsystem>
6
+ <active>true</active>
7
+ <codePool>community</codePool>
8
+ </Criteek_Reviewsystem>
9
+ </modules>
10
+ </config>
app/locale/en_US/template/email/account_new_confirmation.html ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Account confirmation for {{var customer.name}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "store url=\"customer/account/\"":"Customer Account Url",
7
+ "htmlescape var=$customer.name":"Customer Name",
8
+ "var customer.email":"Customer Email",
9
+ "store url=\"customer/account/confirm/\" _query_id=$customer.id _query_key=$customer.confirmation _query_back_url=$back_url":"Confirmation Url",
10
+ "htmlescape var=$customer.password":"Customer password"}
11
+ @-->
12
+
13
+ <!--@styles
14
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
15
+ @-->
16
+
17
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
18
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
19
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
20
+ <tr>
21
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
22
+ <!-- [ header starts here] -->
23
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
24
+ <tr>
25
+ <td valign="top">
26
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a>
27
+ </td>
28
+ </tr>
29
+ <!-- [ middle starts here] -->
30
+ <tr>
31
+ <td valign="top">
32
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{htmlescape var=$customer.name}},</h1>
33
+ <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Your e-mail {{var customer.email}} must be confirmed before using it to log in to our store.</p>
34
+ <p style="font-size:12px; line-height:16px; margin:0 0 8px 0;">To confirm the e-mail and instantly log in, please, use <a href="{{store url="customer/account/confirm/" _query_id=$customer.id _query_key=$customer.confirmation _query_back_url=$back_url}}" style="color:#1E7EC8;">this confirmation link</a>. This link is valid only once.</p>
35
+ <p style="border:1px solid #E0E0E0; font-size:12px; line-height:16px; margin:0 0 16px 0; padding:13px 18px; background:#f9f9f9;">
36
+ Use the following values when prompted to log in:<br/>
37
+ <strong>E-mail:</strong> {{var customer.email}}<br/>
38
+ <strong>Password:</strong> {{htmlescape var=$customer.password}}<p>
39
+ <p style="font-size:12px; line-height:16px; margin:0;">If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.</p>
40
+ </td>
41
+ </tr>
42
+ <tr>
43
+ <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>
44
+ </tr>
45
+ </table>
46
+ </td>
47
+ </tr>
48
+ </table>
49
+ </div>
50
+ </body>
js/reviewsystem/widgetcode.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function PrintDivOnly(str) {
2
+
3
+ var popupWin = window.open('', '_blank', 'width=400,height=400');
4
+ popupWin.document.open();
5
+ popupWin.document.write('<html><body>'+htmlEscape(str)+'</html>');
6
+ }
7
+ function htmlEscape(str) {
8
+ return str
9
+ .replace(/&/g, '&amp;')
10
+ .replace(/"/g, '&quot;')
11
+ .replace(/'/g, '&#39;')
12
+ .replace(/</g, '&lt;')
13
+ .replace(/>/g, '&gt;');
14
+ }
15
+ function setonoff(str) {
16
+ new Ajax.Request(str, {
17
+ method: 'post',
18
+ onComplete: function(data) {
19
+
20
+ $('html-body').innerHTML = data.responseText;
21
+
22
+
23
+ }
24
+ });
25
+ return false;
26
+ }
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Criteek_Reviewsystem</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://www.criteek.tv/terms-of-use">CRITEEK TERMS OF SERVICE</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Criteek is authentic video review provider for website</summary>
10
+ <description>Research shows that consumers trust other shoppers 12 times more than Brand and Retail messaging, and that 4x as many consumers would rather watch a video about a product than read about it. Authentic video reviews allow shoppers to get a live look at the product, as well as seeing the person reviewing it, giving a much more authentic review than text alone. And, with a live look at the product itself, shoppers have a better idea of what to expect when the shipment arrives.&#xD;
11
+ &#xD;
12
+ Why send shoppers off-site looking for shopper-generated video reviews when you can engage them right on your product page? Criteek helps Magento users gather valuable, shopper-generated video reviews and play them right on your site. This ensures that your pages are engaging and informative, and to help you increase your conversions.</description>
13
+ <notes>Customer Review video content</notes>
14
+ <authors><author><name>Criteek</name><user>criteek</user><email>magento@criteek.com</email></author></authors>
15
+ <date>2016-12-13</date>
16
+ <time>18:37:23</time>
17
+ <contents><target name="magecommunity"><dir name="Criteek"><dir name="Reviewsystem"><dir name="Block"><dir name="Adminhtml"><dir name="Analytics"><dir name="Grid"><dir name="Renderer"><file name="Reopened.php" hash="d7b28100902b61e56bd837d62d0fea69"/><file name="Status.php" hash="2ff6a6aeeaa123bc6f78e8ebda18de4d"/></dir></dir><file name="Grid.php" hash="c29f0792f78ceee09537c97bc5f35dee"/></dir><file name="Analytics.php" hash="60f4d362b37224b08736f9c90d249161"/><dir name="Category"><dir name="Edit"><file name="Form.php" hash="59b961e58ef1ea3e52fa504829ebf3ed"/></dir><file name="Edit.php" hash="b842c3eb073cddc2172762b4c794196b"/><file name="Grid.php" hash="6797c71162a7038a027bef9334caa5af"/></dir><file name="Category.php" hash="a07c49510594b4bca5add58ebc0287f0"/></dir></dir><dir name="Helper"><file name="Data.php" hash="ab9e90d35f3013aa4f73981fc37de2ed"/></dir><dir name="Model"><file name="Category.php" hash="361107d8711866c1884fdaab00346d1e"/><file name="Cron.php" hash="ba8067ba8bd2d77e3e3c5830cd56ec2f"/><file name="EmailQueue.php" hash="05abd26984c184561eaa9f0d7a5982e4"/><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="baf3a474e3f07b7668a8c541157d3f8a"/></dir><file name="Category.php" hash="24edf193ee0822d43731f22676f96e09"/><dir name="EmailQueue"><file name="Collection.php" hash="085430864d992ab6e78ec0a8a0671cea"/></dir><file name="EmailQueue.php" hash="b115f255dc02aafe236cb392e64dabd6"/><file name=".DS_Store" hash="03e637b0c75d61ce70bd2ebc19e29167"/></dir><file name="Observer.php" hash="96cc5eefcac01e1ba142e06140b4a656"/><dir name="Order"><file name="Status.php" hash="a617781b24f485cdba4cbd6042629cb5"/></dir><file name=".DS_Store" hash="2b994f33b8ef1f769c7616192223b8c3"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AnalyticsController.php" hash="2fb5496d659e7f9785d954cf4dbd79a3"/><file name="CategoryController.php" hash="63f3aab18a7b4e469a8101fde7ee1806"/><file name="DashboardController.php" hash="ddd7ecaaab1891dc8544aebf5b82ad1f"/></dir></dir><dir name="data"><dir name="reviewsystem_setup"><file name="data-install-1.0.0.php" hash="7fcb8aa1e0563ac89f455c9c2fdf5abd"/></dir><file name=".DS_Store" hash="10014a21f6297fe3a2fabeea8eedb94a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c0ebe7a3ad3f59fa26edc386e5bf96c0"/><file name="config.xml" hash="179fe8784f82b95fba165c34c87e804e"/><file name="system.xml" hash="6f17a3aa6ce41b4b4e9da8dce2a4e94b"/></dir><dir name="sql"><dir name="reviewsystem_setup"><file name="mysql4-install-1.0.0.php" hash="ff33a16e711b63a157612a8bf2345521"/></dir><file name=".DS_Store" hash="65130c07f5fede8820727e7eac5818b8"/></dir><file name=".DS_Store" hash="cf1b6d8add2255fafe6ad348e4cc2741"/></dir><file name=".DS_Store" hash="4dc7314aa36a1f003076a9650125b694"/></dir><dir name="."><dir name="app"><dir name="code"><dir name="community"><dir name="Criteek"><dir name="Reviewsystem"><dir name="Block"><dir name="Adminhtml"><file name="Analytics.php" hash=""/><file name="Category.php" hash=""/><dir name="Analytics"><file name="Grid.php" hash=""/><dir name="Grid"><dir name="Renderer"><file name="Reopened.php" hash=""/><file name="Status.php" hash=""/></dir></dir></dir><dir name="Category"><file name="Edit.php" hash=""/><file name="Grid.php" hash=""/><dir name="Edit"><file name="Form.php" hash=""/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AnalyticsController.php" hash=""/><file name="DashboardController.php" hash=""/></dir></dir><dir name="data"><dir name="reviewsystem_setup"><file name="data-install-1.0.0.php" hash=""/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash=""/><file name="config.xml" hash=""/><file name="system.xml" hash=""/></dir><dir name="Helper"><file name="Data.php" hash=""/></dir><dir name="Model"><file name="Category.php" hash=""/><file name="Cron.php" hash=""/><file name="EmailQueue.php" hash=""/><file name="Observer.php" hash=""/><dir name="Mysql4"><file name="Category.php" hash=""/><file name="EmailQueue.php" hash=""/><dir name="Category"><file name="Collection.php" hash=""/></dir><dir name="EmailQueue"><file name="Collection.php" hash=""/></dir></dir><dir name="Order"><file name="Status.php" hash=""/></dir></dir><dir name="sql"><dir name="reviewsystem_setup"><file name="mysql4-install-1.0.0.php" hash=""/></dir></dir></dir></dir></dir></dir></dir></dir><dir><dir name="app"><dir name="code"><dir name="community"><dir name="Criteek"><dir name="Reviewsystem"><dir name="controllers"><dir name="Adminhtml"><file name="CategoryController.php" hash=""/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Criteek_Reviewsystem.xml" hash="fd6c4599b033d203219941584f168ac3"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="reviewsystem"><file name="reviewcode.phtml" hash="fad589935be5bd10537b3ae18d088f6b"/><file name="reviewcode.phtml" hash="fad589935be5bd10537b3ae18d088f6b"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="reviewsystem.xml" hash="2c6832f61dd4cbe6677efe205b315daa"/></dir><dir name="template"><dir name="reviewsystem"><file name="emailanalytics.phtml" hash="cb02173398d56a22c2404f036300e18a"/><dir name="grid"><file name="container.phtml" hash="ac6ba197b568ae8393085b904961b9de"/><file name="container.phtml" hash="ac6ba197b568ae8393085b904961b9de"/><file name="container.phtml" hash="ac6ba197b568ae8393085b904961b9de"/></dir><file name="grid.phtml" hash="ac7d47e7d88823e98abbad14d46e21cc"/><file name="emailanalytics.phtml" hash="cb02173398d56a22c2404f036300e18a"/><file name="grid.phtml" hash="ac7d47e7d88823e98abbad14d46e21cc"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="reviewsystem"><file name="widgetcode.js" hash="d44957f1ebca75ba67ddd57c60af20a8"/></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="account_new_confirmation.html" hash="46a81d771b81c580872c15937a2f5fdd"/></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>7.0.2</max></php></required></dependencies>
20
+ </package>