Criteek_Reviewsystem - Version 1.1.0

Version Notes

Customer Review Video Content

Download this release

Release Info

Developer Criteek
Extension Criteek_Reviewsystem
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.0 to 1.1.0

Files changed (44) 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 +0 -23
  4. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics/Grid.php +0 -98
  5. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics/Grid/Renderer/Reopened.php +0 -30
  6. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics/Grid/Renderer/Status.php +0 -54
  7. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category.php +0 -36
  8. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category/Edit.php +0 -43
  9. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category/Edit/Form.php +0 -43
  10. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Category/Grid.php +0 -130
  11. app/code/community/Criteek/Reviewsystem/Block/Adminhtml/System/Config/Button.php +60 -0
  12. app/code/community/Criteek/Reviewsystem/Helper/Data.php +302 -387
  13. app/code/community/Criteek/Reviewsystem/Model/.DS_Store +0 -0
  14. app/code/community/Criteek/Reviewsystem/Model/Category.php +0 -20
  15. app/code/community/Criteek/Reviewsystem/Model/Cron.php +0 -65
  16. app/code/community/Criteek/Reviewsystem/Model/EmailQueue.php +0 -19
  17. app/code/community/Criteek/Reviewsystem/Model/Mysql4/.DS_Store +0 -0
  18. app/code/community/Criteek/Reviewsystem/Model/Mysql4/Category.php +0 -25
  19. app/code/community/Criteek/Reviewsystem/Model/Mysql4/Category/Collection.php +0 -26
  20. app/code/community/Criteek/Reviewsystem/Model/Mysql4/EmailQueue.php +0 -25
  21. app/code/community/Criteek/Reviewsystem/Model/Mysql4/EmailQueue/Collection.php +0 -55
  22. app/code/community/Criteek/Reviewsystem/Model/Observer.php +160 -167
  23. app/code/community/Criteek/Reviewsystem/Model/Order/Status.php +0 -29
  24. app/code/community/Criteek/Reviewsystem/Model/Source/Order/Status.php +27 -0
  25. app/code/community/Criteek/Reviewsystem/controllers/Adminhtml/AnalyticsController.php +0 -172
  26. app/code/community/Criteek/Reviewsystem/controllers/Adminhtml/CategoryController.php +0 -128
  27. app/code/community/Criteek/Reviewsystem/controllers/Adminhtml/ReviewsystemController.php +130 -0
  28. app/code/community/Criteek/Reviewsystem/data/.DS_Store +0 -0
  29. app/code/community/Criteek/Reviewsystem/data/reviewsystem_setup/data-install-1.0.0.php +0 -28
  30. app/code/community/Criteek/Reviewsystem/etc/adminhtml.xml +43 -58
  31. app/code/community/Criteek/Reviewsystem/etc/config.xml +140 -181
  32. app/code/community/Criteek/Reviewsystem/etc/system.xml +152 -112
  33. app/code/community/Criteek/Reviewsystem/sql/.DS_Store +0 -0
  34. app/code/community/Criteek/Reviewsystem/sql/reviewsystem_setup/mysql4-install-1.0.0.php +73 -71
  35. app/code/community/Criteek/Reviewsystem/sql/reviewsystem_setup/mysql4-upgrade-1.0.0-2.0.0.php +28 -0
  36. app/design/adminhtml/default/default/layout/reviewsystem.xml +8 -34
  37. app/design/adminhtml/default/default/template/reviewsystem/emailanalytics.phtml +0 -295
  38. app/design/adminhtml/default/default/template/reviewsystem/grid.phtml +0 -213
  39. app/design/adminhtml/default/default/template/reviewsystem/grid/container.phtml +0 -45
  40. app/design/adminhtml/default/default/template/reviewsystem/system/config/button.phtml +31 -0
  41. app/design/frontend/base/default/template/reviewsystem/reviewcode.phtml +41 -23
  42. app/locale/en_US/template/email/account_new_confirmation.html +0 -50
  43. js/reviewsystem/widgetcode.js +0 -26
  44. package.xml +6 -6
app/code/community/Criteek/.DS_Store CHANGED
Binary file
app/code/community/Criteek/Reviewsystem/.DS_Store CHANGED
Binary file
app/code/community/Criteek/Reviewsystem/Block/Adminhtml/Analytics.php DELETED
@@ -1,23 +0,0 @@
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 DELETED
@@ -1,98 +0,0 @@
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 DELETED
@@ -1,30 +0,0 @@
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 DELETED
@@ -1,54 +0,0 @@
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 DELETED
@@ -1,36 +0,0 @@
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 DELETED
@@ -1,43 +0,0 @@
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 DELETED
@@ -1,43 +0,0 @@
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 DELETED
@@ -1,130 +0,0 @@
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/Block/Adminhtml/System/Config/Button.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class Criteek_Reviewsystem_Block_Adminhtml_System_Config_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
14
+ {
15
+ /**
16
+ * Set template
17
+ */
18
+ protected function _construct()
19
+ {
20
+ parent::_construct();
21
+ $this->setTemplate('reviewsystem/system/config/button.phtml');
22
+ }
23
+
24
+ /**
25
+ * Return element html
26
+ *
27
+ * @param Varien_Data_Form_Element_Abstract $element
28
+ * @return string
29
+ */
30
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
31
+ {
32
+ return $this->_toHtml();
33
+ }
34
+
35
+ /**
36
+ * Return ajax url for button
37
+ *
38
+ * @return string
39
+ */
40
+ public function getAjaxCollectUrl()
41
+ {
42
+ return Mage::helper('adminhtml')->getUrl('reviewsystem/adminhtml_reviewsystem/massMailOnPurchaseComplete');
43
+ }
44
+
45
+ /**
46
+ * Generate button html
47
+ *
48
+ * @return string
49
+ */
50
+ public function getButtonHtml()
51
+ {
52
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
53
+ 'id' => 'reviewsystem_generate_button',
54
+ 'label' => $this->helper('adminhtml')->__('Generate reviews for my past orders'),
55
+ 'onclick' => 'javascript:collectOrders(); return false;'
56
+ ));
57
+ return $button->toHtml();
58
+ }
59
+ }
60
+ ?>
app/code/community/Criteek/Reviewsystem/Helper/Data.php CHANGED
@@ -1,388 +1,303 @@
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
  }
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
+ private $apiUrl = 'https://api.criteek.tv/api/v1/';
18
+ private $widgetJsUrl = 'https://widget.criteek.tv/servicewidget_v1.js';
19
+
20
+ /**
21
+ * get Api key - Get api key from config
22
+ *
23
+ * @return string
24
+ */
25
+ function getApiKey(){
26
+ return Mage::getStoreConfig('reviewsystem/product_review_config/api_app_key'); // Api app Key
27
+ }
28
+
29
+ /**
30
+ * check module is enabled or not
31
+ *
32
+ * @return bool
33
+ */
34
+ function isModuleEnable(){
35
+ if(Mage::getStoreConfig('reviewsystem/product_review_config/criteek_synch')){
36
+ return true;
37
+ }else{
38
+ return false;
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Check if Mail After Purchase feature is enabled
44
+ *
45
+ */
46
+ function isMailAfterPurchaseEnable(){
47
+ if(Mage::getStoreConfig('reviewsystem/product_review_config/enable_mailpurchase')){
48
+ return true;
49
+ }else{
50
+ return false;
51
+ }
52
+ }
53
+
54
+
55
+ /**
56
+ * get Api secret - Get api secret from config
57
+ *
58
+ * @return string
59
+ */
60
+ function getApiSecretKey(){
61
+ return Mage::getStoreConfig('reviewsystem/product_review_config/api_app_secret'); // Api app seceret
62
+ }
63
+
64
+ /**
65
+ * get Api secret - Get api secret from config
66
+ *
67
+ * @return string
68
+ */
69
+ function getModeUrl(){
70
+ return $this->apiUrl;
71
+ }
72
+
73
+ /**
74
+ * get Api secret - Get api secret from config
75
+ *
76
+ * @return string
77
+ */
78
+ function getWidgetjsUrl(){
79
+ return $this->widgetJsUrl;
80
+ }
81
+
82
+ /**
83
+ * sendRequest for token - initiate curl request
84
+ *
85
+ * @return token
86
+ */
87
+ function getToken(){
88
+ $json = '';
89
+ $url = $this->getModeUrl()."login";
90
+ $curl = curl_init($url);
91
+ $postData = array("apikey" => $this->getApiKey(), "secretkey" => $this->getApiSecretKey());
92
+
93
+ curl_setopt($curl, CURLOPT_URL, $url);
94
+ curl_setopt($curl, CURLOPT_HEADER, false);
95
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
96
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
97
+ curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($postData));
98
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
99
+
100
+ $response = curl_exec($curl);
101
+
102
+ if (empty($response)) {
103
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
104
+ curl_close($curl); // close cURL handler
105
+ } else {
106
+ $info = curl_getinfo($curl);
107
+ if (empty($info['http_code'])) {
108
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
109
+ } else {
110
+ // load the HTTP codes
111
+ if($info['http_code']!=200){
112
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
113
+ } else {
114
+ $json = json_decode($response);
115
+ }
116
+ }
117
+ }
118
+ if($json->message->token){
119
+ $token = $json->message->token;
120
+ return $token;
121
+ }
122
+ else{
123
+ return null;
124
+ }
125
+ }
126
+
127
+ /**
128
+ * getdomainId - Send curl request to Api to get Domain Id
129
+ *
130
+ * @return string
131
+ */
132
+ function getDomainId() {
133
+ $json = '';
134
+ $token = $this->getToken();
135
+ $page = 'mydomain';
136
+ $params = "name=".$_SERVER['HTTP_HOST']."&token=".$token;
137
+
138
+ $url = $this->getModeUrl().$page."?".$params;
139
+ $headers = array("token:".$token);
140
+ $curl = curl_init($url);
141
+
142
+ curl_setopt($curl, CURLOPT_URL, $url);
143
+ curl_setopt($curl, CURLOPT_HEADER, false);
144
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
145
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
146
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
147
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
148
+ $response = curl_exec($curl);
149
+
150
+ if (empty($response)) {
151
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
152
+ curl_close($curl); // close cURL handler
153
+ } else {
154
+ $info = curl_getinfo($curl);
155
+ if (empty($info['http_code'])) {
156
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
157
+ } else {
158
+ // load the HTTP codes
159
+ if($info['http_code']!=200){
160
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
161
+ } else {
162
+ $json = json_decode($response);
163
+ }
164
+ }
165
+ }
166
+
167
+ $domain_id = $json->message->domainid;
168
+ return $domain_id ;
169
+ }
170
+
171
+ /**
172
+ * setDoamin On Off - Send curl request to huuto to fetch products Details
173
+ *
174
+ * @param $value
175
+ *
176
+ * @return string
177
+ */
178
+ function setDomainOnOff($value) {
179
+ $json = '';
180
+ $doaminId = $this->getDomainId();
181
+ $token = $this->getToken();
182
+ $putData = array("default"=>$value);
183
+ $url = $this->getModeUrl()."domain/".$doaminId;
184
+ $headers = array("token:".$token);
185
+ $curl = curl_init($url);
186
+
187
+ curl_setopt($curl, CURLOPT_URL, $url);
188
+ curl_setopt($curl, CURLOPT_HEADER, false);
189
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
190
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
191
+ // Instead of POST fields use these settings
192
+ curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($putData));
193
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
194
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
195
+
196
+ $response = curl_exec($curl);
197
+
198
+ if (empty($response)) {
199
+ throw new Exception(Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again')));
200
+ curl_close($curl); // close cURL handler
201
+ } else {
202
+ $info = curl_getinfo($curl);
203
+ if (empty($info['http_code'])) {
204
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
205
+ } else {
206
+ // load the HTTP codes
207
+ if($info['http_code']!=200){
208
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
209
+ }
210
+ else{
211
+ $json = json_decode($response);
212
+ }
213
+ }
214
+ }
215
+ return $json ;
216
+ }
217
+
218
+ /**
219
+ * massCreateOrders - send orders data to api
220
+ *
221
+ * @param $orders, $token, $storeId
222
+ *
223
+ * @return string
224
+ */
225
+
226
+ public function massCreateOrders($orders, $token, $storeId)
227
+ {
228
+ $url = $this->getModeUrl().'emailmarketing';
229
+ $count = count($orders);
230
+ $json = '';
231
+ $postData = array('count'=>$count, 'data'=>$orders);
232
+ $headers= array("token:".$token);
233
+
234
+ $curl = curl_init($url);
235
+ curl_setopt($curl, CURLOPT_URL, $url);
236
+ curl_setopt($curl, CURLOPT_HEADER, false);
237
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
238
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
239
+ curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($postData));
240
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
241
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
242
+
243
+ $response = curl_exec($curl);
244
+
245
+ if (empty($response)) {
246
+ $message = Mage::helper('reviewsystem')->__('Check API key and API secret again');
247
+ curl_close($curl); // close cURL handler
248
+ return $message;
249
+ } else {
250
+ $info = curl_getinfo($curl);
251
+ if (empty($info['http_code'])) {
252
+ Mage::log("No HTTP code was returned", null, 'reviewsystem.log');
253
+ } else {
254
+ // load the HTTP codes
255
+ if($info['http_code']!=200){
256
+ Mage::log("HTTP code was not 200", null, 'reviewsystem.log');
257
+ } else {
258
+ $json = json_decode($response);
259
+
260
+ }
261
+ }
262
+ }
263
+
264
+ Mage::getConfig()->saveConfig('reviewsystem/product_review_config/criteek_order_sent', '1');
265
+ return 1;
266
+ }
267
+
268
+ /**
269
+ * prepareProductsData
270
+ *
271
+ * @param $order
272
+ *
273
+ * @return array
274
+ */
275
+ public function prepareProductsData($order)
276
+ {
277
+ Mage::app()->setCurrentStore($order->getStoreId());
278
+ $products = $order->getAllVisibleItems(); //filter out simple products
279
+ $productsArr = array();
280
+
281
+ foreach ($products as $product) {
282
+ //use configurable product instead of simple if still needed
283
+ $full_product = Mage::getModel('catalog/product')->load($product->getProductId());
284
+ $configurable_product_model = Mage::getModel('catalog/product_type_configurable');
285
+ $parentIds = $configurable_product_model->getParentIdsByChild($full_product->getId());
286
+
287
+ if (count($parentIds) > 0) {
288
+ $full_product = Mage::getModel('catalog/product')->load($parentIds[0]);
289
+ }
290
+
291
+ $productData = array();
292
+
293
+ $productData['name'] = $full_product->getName()!='' ? addslashes($full_product->getName()) : "no_name";
294
+ $productData['price'] = (int)$product->getPrice();
295
+ $productData['quantity'] = (int)$product->getQtyOrdered();
296
+ $productData['productid'] = $product->getId();
297
+ $productData['url'] = $full_product->getProductUrl();
298
+
299
+ $productsArr[] = $productData;
300
+ }
301
+ return $productsArr;
302
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  }
app/code/community/Criteek/Reviewsystem/Model/.DS_Store DELETED
Binary file
app/code/community/Criteek/Reviewsystem/Model/Category.php DELETED
@@ -1,20 +0,0 @@
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 DELETED
@@ -1,65 +0,0 @@
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 DELETED
@@ -1,19 +0,0 @@
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 DELETED
Binary file
app/code/community/Criteek/Reviewsystem/Model/Mysql4/Category.php DELETED
@@ -1,25 +0,0 @@
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 DELETED
@@ -1,26 +0,0 @@
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 DELETED
@@ -1,25 +0,0 @@
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 DELETED
@@ -1,55 +0,0 @@
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 CHANGED
@@ -1,168 +1,161 @@
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
  }
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
+ /**
17
+ * sendOrderToCriteek
18
+ *
19
+ * @param object
20
+ *
21
+ * @return object
22
+ */
23
+ public function sendOrderToCriteek(Varien_Event_Observer $observer)
24
+ {
25
+ if(Mage::helper('reviewsystem')->isModuleEnable() && Mage::helper('reviewsystem')->isMailAfterPurchaseEnable()){
26
+ try {
27
+ ini_set('max_execution_time', 300);
28
+ $result = null;
29
+ $order = $observer->getEvent()->getOrder();
30
+ $store = Mage::app()->getStore($order->getStoreId());
31
+ $storeCode = $store->getCode();
32
+ $storeId = $store->getId();
33
+ $currentStore = $storeCode;
34
+
35
+ if (Mage::getStoreConfig('reviewsystem/product_review_config/api_app_key', $currentStore) == null or Mage::getStoreConfig('reviewsystem/product_review_config/api_app_secret', $currentStore) == null){
36
+ Mage::log('Please make sure you insert your APP KEY and SECRET and save configuration before trying to export past orders');
37
+ return $observer;
38
+ }
39
+
40
+ $token = Mage::helper('reviewsystem')->getToken();
41
+
42
+ if ($token == null)
43
+ {
44
+ Mage::log("Please make sure the APP KEY and SECRET you've entered are correct");
45
+ return $observer;
46
+ }
47
+
48
+ $today = time();
49
+ $last = $today - (60*60*24*90); //90 days ago
50
+ $from = date("Y-m-d", $last);
51
+ $offset = 0;
52
+ $salesModel = Mage::getModel("sales/order");
53
+
54
+ $orderStatuses = Mage::getStoreConfig('reviewsystem/product_review_config/allowed_status', $currentStore);
55
+
56
+ if ($orderStatuses == null) {
57
+ $orderStatuses = array('complete');
58
+ } else {
59
+ $orderStatuses = strtolower($orderStatuses);
60
+ }
61
+
62
+ if($order->getStatus()!=$orderStatuses){
63
+ return $observer;
64
+ }
65
+
66
+ $orderData = array();
67
+ $orderData["name"] = str_replace(' ','',$order->getCustomerName());
68
+ $orderData["email"] = $order->getCustomerEmail();
69
+ $orderData["orderdate"] = $order->getCreatedAtDate()->toString('yyyy-MM-dd');
70
+ $orderData['orderid'] = $order->getIncrementId();
71
+ $orderData['domainid'] = (int)Mage::helper('reviewsystem')->getDomainId();
72
+
73
+ $orderData['product'] = Mage::helper('reviewsystem')->prepareProductsData($order);
74
+
75
+ $orders[] = $orderData;
76
+
77
+ if (count($orders) > 0){
78
+ Mage::helper('reviewsystem')->massCreateOrders($orders, $token, $storeId);
79
+ }
80
+
81
+ } catch(Exception $e) {
82
+ Mage::log('Failed to export past orders. Error: '.$e);
83
+ }
84
+ }
85
+ return $observer;
86
+ }
87
+
88
+ /**
89
+ * adminSystemConfigChangedSection
90
+ *
91
+ * @return bool
92
+ */
93
+ public function adminSystemConfigChangedSection()
94
+ {
95
+ if(Mage::getStoreConfig('manage_widget/manage_widget_config/widget_synch') == 1){
96
+ $value = "on";
97
+ Mage::helper('reviewsystem')->setDomainOnOff($value);
98
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('reviewsystem')->__('Widget is ON for Domain.'));
99
+ } else {
100
+ $value = "off";
101
+ Mage::helper('reviewsystem')->setDomainOnOff($value);
102
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('reviewsystem')->__('Widget is OFF for Domain.'));
103
+ }
104
+ return true;
105
+ }
106
+
107
+ /**
108
+ * getproductData
109
+ *
110
+ * @param object
111
+ */
112
+ public function getproductData($observer)
113
+ {
114
+ if(Mage::helper('reviewsystem')->isModuleEnable()){
115
+ $currentUrl = $_SERVER['REQUEST_URI'];
116
+ if (strpos($currentUrl,'?criteek=') !== false) {
117
+ $customer_email = $_GET['criteek'];
118
+
119
+ $collection = Mage::getModel('reviewsystem/emailQueue')->getCollection()
120
+ ->addFieldToFilter('status', array('eq'=>1))
121
+ ->addFieldToFilter('id', array('eq'=>$customer_email))
122
+ ->addFieldToSelect('*');
123
+
124
+ if($collection->getData()){
125
+ foreach($collection as $data)
126
+ {
127
+ $data->setReopened(1);
128
+ $data->save();
129
+ }
130
+ }
131
+ }
132
+ }
133
+ return $observer;
134
+ }
135
+
136
+ /**
137
+ * adminSystemConfigApiAuthenticationSection
138
+ *
139
+ * @return null
140
+ */
141
+ public function adminSystemConfigApiAuthenticationSection()
142
+ {
143
+ if(Mage::getStoreConfig('reviewsystem/product_review_config/criteek_synch') == 1){
144
+ if(Mage::helper('reviewsystem')->getToken() == ""){
145
+ return Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reviewsystem')->__('Check API key and API secret again'));
146
+ }
147
+ }
148
+
149
+ if(Mage::getStoreConfig('reviewsystem/manage_widget_config/widget_synch') == 1){
150
+ $value = "on";
151
+ Mage::helper('reviewsystem')->setDomainOnOff($value);
152
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('reviewsystem')->__('Widget is ON for Domain.'));
153
+ } else {
154
+ $value = "off";
155
+ Mage::helper('reviewsystem')->setDomainOnOff($value);
156
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('reviewsystem')->__('Widget is OFF for Domain.'));
157
+ }
158
+ return true;
159
+ return ;
160
+ }
 
 
 
 
 
 
 
161
  }
app/code/community/Criteek/Reviewsystem/Model/Order/Status.php DELETED
@@ -1,29 +0,0 @@
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) {