NRApps_TSReviewManagement - Version 1.0.0

Version Notes

#productlove

Download this release

Release Info

Developer integer_net GmbH
Extension NRApps_TSReviewManagement
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (35) hide show
  1. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Form/Container.php +70 -0
  2. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Form/Form.php +107 -0
  3. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Grid/Container.php +27 -0
  4. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Grid/GridForeign.php +172 -0
  5. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Grid/GridOrder.php +208 -0
  6. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Grid/Tabs.php +48 -0
  7. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Info.php +108 -0
  8. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/System/Config/Delete.php +52 -0
  9. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Widget/Grid/Column/Renderer/Line.php +31 -0
  10. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Widget/Grid/Column/Renderer/Mark.php +45 -0
  11. app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Widget/Grid/Column/Renderer/Order.php +34 -0
  12. app/code/community/NRApps/TSReviewManagement/Helper/Data.php +20 -0
  13. app/code/community/NRApps/TSReviewManagement/Model/Client.php +180 -0
  14. app/code/community/NRApps/TSReviewManagement/Model/Config.php +90 -0
  15. app/code/community/NRApps/TSReviewManagement/Model/ImportService.php +230 -0
  16. app/code/community/NRApps/TSReviewManagement/Model/Resource/Review.php +209 -0
  17. app/code/community/NRApps/TSReviewManagement/Model/Resource/Review/Collection.php +27 -0
  18. app/code/community/NRApps/TSReviewManagement/Model/Resource/Shop.php +39 -0
  19. app/code/community/NRApps/TSReviewManagement/Model/Resource/Shop/Collection.php +27 -0
  20. app/code/community/NRApps/TSReviewManagement/Model/Response.php +159 -0
  21. app/code/community/NRApps/TSReviewManagement/Model/Review.php +70 -0
  22. app/code/community/NRApps/TSReviewManagement/Model/ScheduleService.php +86 -0
  23. app/code/community/NRApps/TSReviewManagement/Model/Shop.php +66 -0
  24. app/code/community/NRApps/TSReviewManagement/Model/System/Store.php +34 -0
  25. app/code/community/NRApps/TSReviewManagement/controllers/Adminhtml/Nrappstsreviewmanagement/IndexController.php +228 -0
  26. app/code/community/NRApps/TSReviewManagement/data/nrapps_tsreviewmanagement_setup/data-install-1.0.0.php +27 -0
  27. app/code/community/NRApps/TSReviewManagement/etc/adminhtml.xml +51 -0
  28. app/code/community/NRApps/TSReviewManagement/etc/config.xml +109 -0
  29. app/code/community/NRApps/TSReviewManagement/etc/system.xml +82 -0
  30. app/code/community/NRApps/TSReviewManagement/sql/nrapps_tsreviewmanagement_setup/install-1.0.0.php +206 -0
  31. app/design/adminhtml/default/default/template/nrapps_tsreviewmanagement/info.phtml +174 -0
  32. app/etc/modules/NRApps_TSReviewManagement.xml +20 -0
  33. app/locale/de_DE/NRApps_TSReviewManagement.csv +74 -0
  34. js/nrapps_tsreviewmanagement/script.js +108 -0
  35. package.xml +18 -0
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Form/Container.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_Form_Container
15
+ */
16
+ class NRApps_TSReviewManagement_Block_Adminhtml_Form_Container extends Mage_Adminhtml_Block_Widget_Form_Container
17
+ {
18
+
19
+
20
+ /**
21
+ *
22
+ */
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+
27
+ $this->_removeButton('back');
28
+ $this->_removeButton('save');
29
+ $this->_removeButton('reset');
30
+
31
+ $configUrl = $this->getUrl('*/system_config/edit', array('section' => 'nrapps_tsreviewmanagement'));
32
+
33
+ $this->_addButton('config', array(
34
+ 'label' => $this->__('Configuration'),
35
+ 'onclick' => sprintf("setLocation('%s')", $configUrl),
36
+ ));
37
+
38
+ if(Mage::getSingleton('nrapps_tsreviewmanagement/config')->isDevMode()) {
39
+
40
+ $this->_addButton('delete', array(
41
+ 'label' => $this->__('DEV DELETE ALL DATA'),
42
+ 'onclick' => sprintf("setLocation('%s')", $this->getUrl('*/*/delete')),
43
+ 'class' => 'delete',
44
+ ));
45
+ }
46
+ }
47
+
48
+
49
+ /**
50
+ * @return Mage_Core_Block_Abstract
51
+ */
52
+ protected function _prepareLayout()
53
+ {
54
+ /** @var NRApps_TSReviewManagement_Block_Adminhtml_Form_Form $form */
55
+ $form = $this->getLayout()->createBlock('nrapps_tsreviewmanagement/adminhtml_form_form', 'form');
56
+
57
+ $this->setChild('form', $form);
58
+
59
+ return Mage_Adminhtml_Block_Widget_Container::_prepareLayout();
60
+ }
61
+
62
+
63
+ /**
64
+ * @return string
65
+ */
66
+ public function getHeaderText()
67
+ {
68
+ return $this->__('Trusted Shops Customer Review Management');
69
+ }
70
+ }
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Form/Form.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_Form_Form
15
+ */
16
+ class NRApps_TSReviewManagement_Block_Adminhtml_Form_Form extends Mage_Adminhtml_Block_Widget_Form
17
+ {
18
+
19
+
20
+ /**
21
+ * @return Mage_Adminhtml_Block_Widget_Form
22
+ */
23
+ protected function _prepareForm()
24
+ {
25
+ $form = new Varien_Data_Form(array(
26
+ 'action' => $this->getUrl('*/*/import'),
27
+ 'id' => 'edit_form',
28
+ 'method' => 'post',
29
+ ));
30
+
31
+ $fieldset = $form->addFieldset('form', array(
32
+ 'legend' => $this->__('Import Reviews'),
33
+ ));
34
+
35
+ $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
36
+
37
+ $configuredStores = Mage::getModel('nrapps_tsreviewmanagement/shop')->getConfiguredStores();
38
+
39
+ if ($configuredStores) {
40
+
41
+ if (!Mage::app()->isSingleStoreMode()) {
42
+ $fieldset->addField('store_id', 'select', array(
43
+ 'name' => 'store_id',
44
+ 'label' => $this->__('Store'),
45
+ 'title' => $this->__('Store'),
46
+ 'required' => true,
47
+ 'values' => Mage::getSingleton('nrapps_tsreviewmanagement/system_store')->getConfiguredStoreValuesForForm($configuredStores),
48
+ ));
49
+ }
50
+
51
+ $fieldset->addField('start_date', 'date', array(
52
+ 'name' => 'start_date',
53
+ 'label' => $this->__('Start Date'),
54
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
55
+ 'format' => $dateFormatIso,
56
+ 'required' => true,
57
+ ));
58
+
59
+ $fieldset->addField('end_date', 'date', array(
60
+ 'name' => 'end_date',
61
+ 'label' => $this->__('End Date'),
62
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
63
+ 'format' => $dateFormatIso,
64
+ 'required' => true,
65
+ ));
66
+
67
+ /** @var Mage_Adminhtml_Block_Widget_Button $submitButton */
68
+ $submitButton = $this->getLayout()->createBlock('adminhtml/widget_button', null, array(
69
+ 'type' => 'submit',
70
+ 'label' => $this->__('Import'),
71
+ ));
72
+
73
+ $fieldset->addField('submit', 'note', array(
74
+ 'text' => $submitButton->toHtml(),
75
+ ));
76
+
77
+ } else {
78
+ $fieldset->addField('submit', 'note', array(
79
+ 'text' => $this->__('No configuration available.'),
80
+ ));
81
+ }
82
+
83
+ $form->setValues($this->_getValues());
84
+ $form->setData('use_container', true);
85
+ $this->setForm($form);
86
+
87
+ return parent::_prepareForm();
88
+ }
89
+
90
+
91
+ /**
92
+ * @return array
93
+ */
94
+ protected function _getValues()
95
+ {
96
+ $endDate = new DateTime();
97
+ $endDate->setTime(0, 0, 0);
98
+
99
+ $startDate = clone $endDate;
100
+ $startDate->sub(new DateInterval('P1D'));
101
+
102
+ return array(
103
+ 'start_date' => $startDate->format('Y-m-d'),
104
+ 'end_date' => $endDate->format('Y-m-d'),
105
+ );
106
+ }
107
+ }
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Grid/Container.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_Grid_Container
15
+ */
16
+ class NRApps_TSReviewManagement_Block_Adminhtml_Grid_Container extends Mage_Core_Block_Abstract
17
+ {
18
+
19
+
20
+ /**
21
+ * @return Mage_Core_Block_Abstract
22
+ */
23
+ protected function _toHtml()
24
+ {
25
+ return '<div id="nrapps_tsreviewmanagement_grid_container"></div>';
26
+ }
27
+ }
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Grid/GridForeign.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_Grid_GridForeign
15
+ */
16
+ class NRApps_TSReviewManagement_Block_Adminhtml_Grid_GridForeign extends Mage_Adminhtml_Block_Widget_Grid
17
+ {
18
+
19
+
20
+ /**
21
+ *
22
+ */
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+
27
+ $this->setId('grid_grid_foreign');
28
+ $this->setSaveParametersInSession(true);
29
+ $this->setDefaultSort('creation_date');
30
+ $this->setData('use_ajax', true);
31
+ $this->setData('row_click_callback', 'row_click_callback');
32
+ }
33
+
34
+
35
+ /**
36
+ * @return $this
37
+ */
38
+ protected function _prepareCollection()
39
+ {
40
+ /** @var NRApps_TSReviewManagement_Model_Resource_Review_Collection $collection */
41
+ $collection = Mage::getResourceModel('nrapps_tsreviewmanagement/review_collection');
42
+
43
+ $collection->getSelect()->joinLeft(
44
+ array('shop' => $collection->getTable('nrapps_tsreviewmanagement/shop')),
45
+ 'shop.entity_id = main_table.shop_id',
46
+ array('store_id' => 'store_id')
47
+ );
48
+
49
+ $collection->getSelect()->joinLeft(
50
+ array('statement' => $collection->getTable('nrapps_tsreviewmanagement/review_statement')),
51
+ 'statement.review_id = main_table.entity_id',
52
+ array('statement' => 'statement')
53
+ );
54
+
55
+ $collection->getSelect()->joinLeft(
56
+ array('order' => $collection->getTable('sales/order')),
57
+ "order.increment_id = main_table.order_reference",
58
+ null
59
+ );
60
+
61
+ $collection->getSelect()->where('order.entity_id IS NULL');
62
+
63
+ $this->setCollection($collection);
64
+
65
+ return parent::_prepareCollection();
66
+ }
67
+
68
+
69
+ /**
70
+ * @return $this
71
+ */
72
+ protected function _prepareColumns()
73
+ {
74
+ if (!Mage::app()->isSingleStoreMode()) {
75
+
76
+ $this->addColumn('shop_id', array(
77
+ 'index' => 'store_id',
78
+ 'filter_index' => 'shop.store_id',
79
+ 'type' => 'store',
80
+ 'header' => $this->__('Store'),
81
+ 'width' => '160px',
82
+ ));
83
+ }
84
+
85
+ $this->addColumn('order_reference', array(
86
+ 'index' => 'order_reference',
87
+ 'filter_index' => 'main_table.order_reference',
88
+ 'header' => $this->__('Order Reference'),
89
+ 'width' => '120px',
90
+ 'align' => 'center',
91
+ ));
92
+
93
+ $this->addColumn('order_date', array(
94
+ 'index' => 'order_date',
95
+ 'filter_index' => 'main_table.order_date',
96
+ 'type' => 'datetime',
97
+ 'header' => $this->__('Order Date'),
98
+ 'width' => '160px',
99
+ 'align' => 'center',
100
+ ));
101
+
102
+ $this->addColumn('creation_date', array(
103
+ 'index' => 'creation_date',
104
+ 'filter_index' => 'main_table.creation_date',
105
+ 'type' => 'datetime',
106
+ 'header' => $this->__('Review Date'),
107
+ 'width' => '160px',
108
+ 'align' => 'center',
109
+ ));
110
+
111
+ $this->addColumn('mark', array(
112
+ 'index' => 'mark_description',
113
+ 'filter_index' => 'main_table.mark_description',
114
+ 'type' => 'options',
115
+ 'options' => $this->_getMarkOptions(),
116
+ 'renderer' => 'nrapps_tsreviewmanagement/adminhtml_widget_grid_column_renderer_mark',
117
+ 'mark' => 'mark',
118
+ 'header' => $this->__('Overall Score'),
119
+ 'width' => '100px',
120
+ 'align' => 'center',
121
+ ));
122
+
123
+ $this->addColumn('comment', array(
124
+ 'index' => 'comment',
125
+ 'filter_index' => 'main_table.comment',
126
+ 'type' => 'text',
127
+ 'nl2br' => true,
128
+ 'truncate' => 80,
129
+ 'header' => $this->__('Comment'),
130
+ ));
131
+
132
+ $this->addColumn('statement', array(
133
+ 'index' => 'statement',
134
+ 'filter_index' => 'statement.statement',
135
+ 'type' => 'text',
136
+ 'nl2br' => true,
137
+ 'truncate' => 80,
138
+ 'header' => $this->__('Statement'),
139
+ ));
140
+
141
+ return parent::_prepareColumns();
142
+ }
143
+
144
+
145
+ /**
146
+ * @return string
147
+ */
148
+ public function getGridUrl()
149
+ {
150
+ return $this->getUrl('*/*/gridreviewforeign');
151
+ }
152
+
153
+
154
+ /**
155
+ * @param $row
156
+ *
157
+ * @return string
158
+ */
159
+ public function getRowUrl($row)
160
+ {
161
+ return $this->getUrl('*/*/view', array('id' => $row->getId()));
162
+ }
163
+
164
+
165
+ /**
166
+ * @return array
167
+ */
168
+ protected function _getMarkOptions()
169
+ {
170
+ return Mage::getSingleton('nrapps_tsreviewmanagement/review')->getMarkOptions();
171
+ }
172
+ }
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Grid/GridOrder.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_Grid_GridOrder
15
+ */
16
+ class NRApps_TSReviewManagement_Block_Adminhtml_Grid_GridOrder extends Mage_Adminhtml_Block_Widget_Grid
17
+ {
18
+
19
+
20
+ /**
21
+ *
22
+ */
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+
27
+ $this->setId('grid_grid_order');
28
+ $this->setSaveParametersInSession(true);
29
+ $this->setDefaultSort('order_created_at');
30
+ $this->setData('use_ajax', true);
31
+ $this->setData('row_click_callback', 'row_click_callback');
32
+ }
33
+
34
+
35
+ /**
36
+ * @return $this
37
+ */
38
+ protected function _prepareCollection()
39
+ {
40
+ $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection');
41
+ $shipmentCollection->getSelect()->reset();
42
+ $shipmentCollection->getSelect()->from(array('shipment' => $shipmentCollection->getMainTable()), null);
43
+ $shipmentCollection->getSelect()->columns(array('shipment_date' => 'shipment.created_at'));
44
+ $shipmentCollection->getSelect()->where('shipment.order_id = main_table.entity_id');
45
+ $shipmentCollection->getSelect()->order('shipment_date DESC');
46
+ $shipmentCollection->getSelect()->limit(1);
47
+
48
+ /** @var NRApps_TSReviewManagement_Model_Resource_Review_Collection $collection */
49
+ $collection = Mage::getResourceModel('sales/order_collection');
50
+ $collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
51
+ $collection->getSelect()->columns(array(
52
+ 'entity_id',
53
+ 'increment_id',
54
+ 'created_at',
55
+ 'store_id',
56
+ 'base_grand_total',
57
+ 'base_currency_code',
58
+ 'shipment_date' => new Zend_Db_Expr('(' . $shipmentCollection->getSelect() . ')'),
59
+ ));
60
+
61
+ $collection->getSelect()->joinLeft(
62
+ array('review' => $collection->getTable('nrapps_tsreviewmanagement/review')),
63
+ 'review.order_reference = main_table.increment_id',
64
+ array(
65
+ 'review_id' => 'entity_id',
66
+ 'review_creation_date' => 'creation_date',
67
+ 'review_mark' => 'mark',
68
+ 'review_mark_description' => 'mark_description',
69
+ 'review_comment' => 'comment',
70
+ )
71
+ );
72
+
73
+ $collection->getSelect()->joinLeft(
74
+ array('statement' => $collection->getTable('nrapps_tsreviewmanagement/review_statement')),
75
+ 'statement.review_id = review.entity_id',
76
+ array('statement' => 'statement')
77
+ );
78
+
79
+ $this->setCollection($collection);
80
+
81
+ return parent::_prepareCollection();
82
+ }
83
+
84
+
85
+ /**
86
+ * @return $this
87
+ */
88
+ protected function _prepareColumns()
89
+ {
90
+ if (!Mage::app()->isSingleStoreMode()) {
91
+
92
+ $this->addColumn('store_id', array(
93
+ 'index' => 'store_id',
94
+ 'filter_index' => 'main_table.store_id',
95
+ 'type' => 'store',
96
+ 'header' => $this->__('Store'),
97
+ 'width' => '160px',
98
+ ));
99
+ }
100
+
101
+ $this->addColumn('order_increment_id', array(
102
+ 'index' => 'increment_id',
103
+ 'filter_index' => 'main_table.increment_id',
104
+ 'renderer' => 'nrapps_tsreviewmanagement/adminhtml_widget_grid_column_renderer_order',
105
+ 'header' => $this->__('Order Reference'),
106
+ 'width' => '120px',
107
+ 'align' => 'center',
108
+ ));
109
+
110
+ $this->addColumn('order_created_at', array(
111
+ 'index' => 'created_at',
112
+ 'filter_index' => 'main_table.created_at',
113
+ 'type' => 'datetime',
114
+ 'header' => $this->__('Order Date'),
115
+ 'width' => '160px',
116
+ 'align' => 'center',
117
+ ));
118
+
119
+ $this->addColumn('review_creation_date', array(
120
+ 'index' => 'review_creation_date',
121
+ 'filter_index' => 'review.creation_date',
122
+ 'type' => 'datetime',
123
+ 'header' => $this->__('Review Date'),
124
+ 'width' => '160px',
125
+ 'align' => 'center',
126
+ ));
127
+
128
+ $this->addColumn('review_mark', array(
129
+ 'index' => 'review_mark_description',
130
+ 'filter_index' => 'review.mark_description',
131
+ 'type' => 'options',
132
+ 'options' => $this->_getMarkOptions(),
133
+ 'renderer' => 'nrapps_tsreviewmanagement/adminhtml_widget_grid_column_renderer_mark',
134
+ 'mark' => 'review_mark',
135
+ 'header' => $this->__('Overall Score'),
136
+ 'width' => '100px',
137
+ 'align' => 'center',
138
+ ));
139
+
140
+ $this->addColumn('base_grand_total', array(
141
+ 'header' => $this->__('Cart Amount'),
142
+ 'index' => 'base_grand_total',
143
+ 'type' => 'currency',
144
+ 'currency' => 'base_currency_code',
145
+ ));
146
+
147
+ $this->addColumn('shipment_date', array(
148
+ 'index' => 'shipment_date',
149
+ 'type' => 'datetime',
150
+ 'header' => $this->__('Delivery Date'),
151
+ 'width' => '160px',
152
+ 'align' => 'center',
153
+ ));
154
+
155
+ $this->addColumn('review_comment', array(
156
+ 'index' => 'review_comment',
157
+ 'filter_index' => 'review.comment',
158
+ 'type' => 'text',
159
+ 'nl2br' => true,
160
+ 'truncate' => 80,
161
+ 'header' => $this->__('Comment'),
162
+ ));
163
+
164
+ $this->addColumn('statement', array(
165
+ 'index' => 'statement',
166
+ 'filter_index' => 'statement.statement',
167
+ 'type' => 'text',
168
+ 'nl2br' => true,
169
+ 'truncate' => 80,
170
+ 'header' => $this->__('Statement'),
171
+ ));
172
+
173
+ return parent::_prepareColumns();
174
+ }
175
+
176
+
177
+ /**
178
+ * @return string
179
+ */
180
+ public function getGridUrl()
181
+ {
182
+ return $this->getUrl('*/*/gridrevieworder');
183
+ }
184
+
185
+
186
+ /**
187
+ * @param $row
188
+ *
189
+ * @return string
190
+ */
191
+ public function getRowUrl($row)
192
+ {
193
+ if($row->getData('review_id')) {
194
+ return $this->getUrl('*/*/view', array('id' => $row->getData('review_id')));
195
+ }
196
+
197
+ return null;
198
+ }
199
+
200
+
201
+ /**
202
+ * @return array
203
+ */
204
+ protected function _getMarkOptions()
205
+ {
206
+ return Mage::getSingleton('nrapps_tsreviewmanagement/review')->getMarkOptions();
207
+ }
208
+ }
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Grid/Tabs.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_Grid_Tabs
15
+ */
16
+ class NRApps_TSReviewManagement_Block_Adminhtml_Grid_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
17
+ {
18
+
19
+
20
+ /**
21
+ *
22
+ */
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('nrapps_tsreviewmanagement_grid_tabs');
27
+ $this->setDestElementId('nrapps_tsreviewmanagement_grid_container');
28
+ $this->setTemplate('widget/tabshoriz.phtml');
29
+ }
30
+
31
+
32
+ /**
33
+ * @return $this
34
+ */
35
+ protected function _prepareLayout()
36
+ {
37
+
38
+ $this->addTab('grid_gridOrder', array(
39
+ 'label' => $this->__('Reviews with reference'),
40
+ 'content' => $this->getLayout()->createBlock('nrapps_tsreviewmanagement/adminhtml_grid_gridOrder')->toHtml(),
41
+ ));
42
+
43
+ $this->addTab('grid_gridForeign', array(
44
+ 'label' => $this->__('Other Reviews'),
45
+ 'content' => $this->getLayout()->createBlock('nrapps_tsreviewmanagement/adminhtml_grid_gridForeign')->toHtml(),
46
+ ));
47
+ }
48
+ }
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Info.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_Info
15
+ */
16
+ class NRApps_TSReviewManagement_Block_Adminhtml_Info extends Mage_Adminhtml_Block_Template
17
+ {
18
+
19
+
20
+ /**
21
+ * @var string
22
+ */
23
+ protected $_template = 'nrapps_tsreviewmanagement/info.phtml';
24
+
25
+ /**
26
+ * @var NRApps_TSReviewManagement_Model_Review
27
+ */
28
+ protected $_review;
29
+
30
+
31
+ /**
32
+ * @param NRApps_TSReviewManagement_Model_Review $review
33
+ *
34
+ * @return $this
35
+ */
36
+ public function setReview(NRApps_TSReviewManagement_Model_Review $review)
37
+ {
38
+ $this->_review = $review;
39
+
40
+ return $this;
41
+ }
42
+
43
+
44
+ /**
45
+ * @return null|NRApps_TSReviewManagement_Model_Review
46
+ */
47
+ public function getReview()
48
+ {
49
+ return $this->_review;
50
+ }
51
+
52
+
53
+ /**
54
+ * @param $orderReference
55
+ *
56
+ * @return null|string
57
+ */
58
+ public function getOrderLink($orderReference)
59
+ {
60
+ /** @var Mage_Sales_Model_Resource_Order $orderResource */
61
+ $orderResource = Mage::getResourceModel('sales/order');
62
+ $incrementId = $orderResource->getIncrementId($orderReference);
63
+
64
+ if($incrementId ) {
65
+
66
+ $url = $this->getUrl('*/sales_order/view', array('order_id' => $orderReference));
67
+
68
+ return sprintf('<a target="_blank" href="%s">%s</div>', $url, $incrementId);
69
+ }
70
+
71
+ return $orderReference;
72
+ }
73
+
74
+ /**
75
+ * @param $mark
76
+ * @param $description
77
+ * @param bool $row
78
+ *
79
+ * @return string
80
+ */
81
+ public function getMarkInfo($mark, $description, $row = false)
82
+ {
83
+ $markOptions = $this->getReview() ? $this->getReview()->getMarkOptions() : array();
84
+
85
+ $iconColor = array(
86
+ 1 => 'yellow',
87
+ 2 => 'yellow',
88
+ 3 => 'yellow',
89
+ 4 => 'yellow',
90
+ 5 => 'yellow',
91
+ );
92
+
93
+ if (array_key_exists($description, $markOptions)) {
94
+ $description = $markOptions[$description];
95
+ }
96
+
97
+ $markIcon = $mark;
98
+ $markIcon = round($markIcon);
99
+ $markIconColor = array_key_exists((int)$markIcon, $iconColor) ? $iconColor[(int)$markIcon] : null;
100
+ $markIcon = str_repeat("&#9733;", $markIcon);
101
+
102
+ if ($row) {
103
+ return sprintf('<span style="display: inline-block; width: 80px; font-size: 14px; color: %s">%s</span> <span>%s (%s)</span>', $markIconColor, $markIcon, $description, (float)$mark);
104
+ }
105
+
106
+ return sprintf('<span style="font-size: 14px; color: %s">%s</span> <span>%s (%s)</span>', $markIconColor, $markIcon, $description, (float)$mark);
107
+ }
108
+ }
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/System/Config/Delete.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+ /**
13
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_System_Config_Delete
14
+ */
15
+ class NRApps_TSReviewManagement_Block_Adminhtml_System_Config_Delete extends Mage_Adminhtml_Block_System_Config_Form_Field
16
+ {
17
+
18
+
19
+ /**
20
+ * Unset some non-related element parameters
21
+ *
22
+ * @param Varien_Data_Form_Element_Abstract $element
23
+ *
24
+ * @return string
25
+ */
26
+ public function render(Varien_Data_Form_Element_Abstract $element)
27
+ {
28
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
29
+
30
+ return parent::render($element);
31
+ }
32
+
33
+
34
+ /**
35
+ * Get the button and scripts contents
36
+ *
37
+ * @param Varien_Data_Form_Element_Abstract $element
38
+ *
39
+ * @return string
40
+ */
41
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
42
+ {
43
+ $originalData = $element->getOriginalData();
44
+ $url = $this->getUrl('*/nrappstsreviewmanagement_index/delete', array('_current' => true));
45
+
46
+ return <<<BUTTON
47
+ <button onclick="setLocation('{$url}')" class="scalable" type="button" id="{$element->getHtmlId()}">
48
+ <span>{$this->escapeHtml($originalData['button_label'])}</span>
49
+ </button>
50
+ BUTTON;
51
+ }
52
+ }
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Widget/Grid/Column/Renderer/Line.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_Widget_Grid_Column_Renderer_Line
15
+ */
16
+ class NRApps_TSReviewManagement_Block_Adminhtml_Widget_Grid_Column_Renderer_Line extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Longtext
17
+ {
18
+
19
+
20
+ /**
21
+ * @param Varien_Object $row
22
+ *
23
+ * @return string
24
+ */
25
+ public function render(Varien_Object $row)
26
+ {
27
+ $value = parent::render($row);
28
+
29
+ return sprintf('<div style="height: 18px; overflow: hidden;">%s</div>', $value);
30
+ }
31
+ }
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Widget/Grid/Column/Renderer/Mark.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+ /**
13
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_Widget_Grid_Column_Renderer_Mark
14
+ */
15
+ class NRApps_TSReviewManagement_Block_Adminhtml_Widget_Grid_Column_Renderer_Mark extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Options
16
+ {
17
+
18
+
19
+ /**
20
+ * @param Varien_Object $row
21
+ *
22
+ * @return string
23
+ */
24
+ public function render(Varien_Object $row)
25
+ {
26
+ $value = parent::render($row);
27
+
28
+ $mark = (float)$row->getData($this->getColumn()->getData('mark'));
29
+
30
+ $iconColor = array(
31
+ 1 => 'yellow',
32
+ 2 => 'yellow',
33
+ 3 => 'yellow',
34
+ 4 => 'yellow',
35
+ 5 => 'yellow',
36
+ );
37
+
38
+ $markIcon = $row->getData($this->getColumn()->getData('mark'));
39
+ $markIcon = round($markIcon);
40
+ $markIconColor = array_key_exists((int)$markIcon, $iconColor) ? $iconColor[(int)$markIcon] : null;
41
+ $markIcon = str_repeat("&#9733;", $markIcon);
42
+
43
+ return sprintf('<span title="%s (%s)" style="font-size: 14px; color: %s">%s</span>', $value, $mark, $markIconColor, $markIcon);
44
+ }
45
+ }
app/code/community/NRApps/TSReviewManagement/Block/Adminhtml/Widget/Grid/Column/Renderer/Order.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+ /**
13
+ * Class NRApps_TSReviewManagement_Block_Adminhtml_Widget_Grid_Column_Renderer_Order
14
+ */
15
+ class NRApps_TSReviewManagement_Block_Adminhtml_Widget_Grid_Column_Renderer_Order extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
16
+ {
17
+
18
+
19
+ /**
20
+ * @param Varien_Object $row
21
+ *
22
+ * @return string
23
+ */
24
+ public function render(Varien_Object $row)
25
+ {
26
+ $orderId = $row->getData('entity_id');
27
+ $url = $this->getUrl('*/sales_order/view', array('order_id' => $orderId));
28
+ $value = $row->getData($this->getColumn()->getIndex());
29
+
30
+ if ($value) {
31
+ return sprintf('<a target="_blank" href="%s">%s</div>', $url, $value);
32
+ }
33
+ }
34
+ }
app/code/community/NRApps/TSReviewManagement/Helper/Data.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Helper_Data
15
+ */
16
+ class NRApps_TSReviewManagement_Helper_Data extends Mage_Core_Helper_Abstract
17
+ {
18
+
19
+
20
+ }
app/code/community/NRApps/TSReviewManagement/Model/Client.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Model_Client
15
+ */
16
+ class NRApps_TSReviewManagement_Model_Client
17
+ {
18
+
19
+
20
+ protected $_uri;
21
+ protected $_tsid;
22
+ protected $_user;
23
+ protected $_password;
24
+ protected $_startDate;
25
+ protected $_endDate;
26
+ protected $_betterThan;
27
+ protected $_worseThan;
28
+ protected $_page;
29
+ protected $_size;
30
+
31
+
32
+ /**
33
+ * @param string $uri
34
+ */
35
+ public function setUri($uri)
36
+ {
37
+ $this->_uri = $uri;
38
+ }
39
+
40
+
41
+ /**
42
+ * @return string
43
+ */
44
+ protected function _getUri()
45
+ {
46
+ return str_replace('{{tsid}}', $this->_tsid, $this->_uri);
47
+ }
48
+
49
+
50
+ /**
51
+ * @param string $tsid
52
+ */
53
+ public function setTsid($tsid)
54
+ {
55
+ $this->_tsid = $tsid;
56
+ }
57
+
58
+
59
+ /**
60
+ * @param string $user
61
+ */
62
+ public function setUser($user)
63
+ {
64
+ $this->_user = $user;
65
+ }
66
+
67
+
68
+ /**
69
+ * @param string $password
70
+ */
71
+ public function setPassword($password)
72
+ {
73
+ $this->_password = $password;
74
+ }
75
+
76
+
77
+ /**
78
+ * @param string $paramFrom
79
+ */
80
+ public function setStartDate($paramFrom)
81
+ {
82
+ $this->_startDate = $paramFrom;
83
+ }
84
+
85
+
86
+ /**
87
+ * @param string $paramTo
88
+ */
89
+ public function setEndDate($paramTo)
90
+ {
91
+ $this->_endDate = $paramTo;
92
+ }
93
+
94
+
95
+ /**
96
+ * @param integer $betterThan
97
+ */
98
+ public function setBetterThan($betterThan)
99
+ {
100
+ $this->_betterThan = $betterThan;
101
+ }
102
+
103
+
104
+ /**
105
+ * @param integer $worseThan
106
+ */
107
+ public function setWorseThan($worseThan)
108
+ {
109
+ $this->_worseThan = $worseThan;
110
+ }
111
+
112
+
113
+ /**
114
+ * @param integer $page
115
+ */
116
+ public function setPage($page)
117
+ {
118
+ $this->_page = $page;
119
+ }
120
+
121
+
122
+ /**
123
+ * @param integer $paramSize
124
+ */
125
+ public function setSize($paramSize)
126
+ {
127
+ $this->_size = $paramSize;
128
+ }
129
+
130
+
131
+ /**
132
+ * @throws Exception
133
+ *
134
+ * @return string
135
+ */
136
+ public function fetch()
137
+ {
138
+ $client = new Zend_Http_Client();
139
+
140
+ $client->setUri($this->_getUri());
141
+ $client->setAuth($this->_user, $this->_password);
142
+
143
+ if ($this->_startDate) {
144
+ $client->setParameterGet('startDate', $this->_startDate);
145
+ }
146
+
147
+ if ($this->_endDate) {
148
+ $client->setParameterGet('endDate', $this->_endDate);
149
+ }
150
+
151
+ if ($this->_betterThan) {
152
+ $client->setParameterGet('betterThan', $this->_betterThan);
153
+ }
154
+
155
+ if ($this->_worseThan) {
156
+ $client->setParameterGet('worseThan', $this->_worseThan);
157
+ }
158
+
159
+ if ($this->_page) {
160
+ $client->setParameterGet('page', $this->_page);
161
+ }
162
+
163
+ if ($this->_size) {
164
+ $client->setParameterGet('size', $this->_size);
165
+ }
166
+
167
+ /** @var Zend_Http_Response $response */
168
+ $response = $client->request();
169
+
170
+ if($response->isError()) {
171
+
172
+ $message = Mage::helper('nrapps_tsreviewmanagement')->__($response->getMessage());
173
+ $message = Mage::helper('nrapps_tsreviewmanagement')->__('Service Error: %1$s - %2$s', $response->getStatus(), $message);
174
+
175
+ throw new Exception($message);
176
+ }
177
+
178
+ return $response->getBody();
179
+ }
180
+ }
app/code/community/NRApps/TSReviewManagement/Model/Config.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Model_Config
15
+ */
16
+ class NRApps_TSReviewManagement_Model_Config
17
+ {
18
+
19
+
20
+ /**
21
+ * @return bool
22
+ */
23
+ public function isScheduling()
24
+ {
25
+ return Mage::getStoreConfigFlag('nrapps_tsreviewmanagement/settings/is_scheduling', Mage_Core_Model_App::ADMIN_STORE_ID);
26
+ }
27
+
28
+
29
+ /**
30
+ * @param null $store
31
+ *
32
+ * @return string
33
+ */
34
+ public function getTsid($store = null)
35
+ {
36
+ return trim(Mage::getStoreConfig('nrapps_tsreviewmanagement/settings/tsid', $store));
37
+ }
38
+
39
+
40
+ /**
41
+ * @param null $store
42
+ *
43
+ * @return string
44
+ */
45
+ public function getApiUri($store = null)
46
+ {
47
+ return trim(Mage::getStoreConfig('nrapps_tsreviewmanagement/settings/api_uri', $store));
48
+ }
49
+
50
+
51
+ /**
52
+ * @param null $store
53
+ *
54
+ * @return string
55
+ */
56
+ public function getApiUser($store = null)
57
+ {
58
+ return trim(Mage::getStoreConfig('nrapps_tsreviewmanagement/settings/api_user', $store));
59
+ }
60
+
61
+
62
+ /**
63
+ * @param null $store
64
+ *
65
+ * @return string
66
+ */
67
+ public function getApiPassword($store = null)
68
+ {
69
+ return Mage::helper('core')->decrypt(Mage::getStoreConfig('nrapps_tsreviewmanagement/settings/api_password', $store));
70
+ }
71
+
72
+
73
+ /**
74
+ * @param null $store
75
+ *
76
+ * @return string
77
+ */
78
+ public function getApiParamSize($store = null)
79
+ {
80
+ return trim(Mage::getStoreConfig('nrapps_tsreviewmanagement/settings/api_param_size', $store));
81
+ }
82
+
83
+ /**
84
+ * @return bool
85
+ */
86
+ public function isDevMode()
87
+ {
88
+ return Mage::getStoreConfigFlag('nrapps_tsreviewmanagement/settings/dev_mode');
89
+ }
90
+ }
app/code/community/NRApps/TSReviewManagement/Model/ImportService.php ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Model_ImportService
15
+ */
16
+ class NRApps_TSReviewManagement_Model_ImportService
17
+ {
18
+
19
+
20
+ /**
21
+ * max recursive api call iterations
22
+ */
23
+ const MAX_API_CALLS = 10;
24
+
25
+ /**
26
+ * @var NRApps_TSReviewManagement_Model_Config
27
+ */
28
+ protected $_config;
29
+
30
+ /**
31
+ * @var NRApps_TSReviewManagement_Model_Client
32
+ */
33
+ protected $_client;
34
+
35
+ /**
36
+ * @var NRApps_TSReviewManagement_Model_Response
37
+ */
38
+ protected $_response;
39
+
40
+ /**
41
+ * @var NRApps_TSReviewManagement_Model_Shop
42
+ */
43
+ protected $_shop;
44
+
45
+ /**
46
+ * @var boolean
47
+ */
48
+ protected $_isShopCreate = false;
49
+
50
+ /**
51
+ * @var boolean
52
+ */
53
+ protected $_isShopUpdate = false;
54
+
55
+ /**
56
+ * @var int
57
+ */
58
+ protected $_countReviewCreate = 0;
59
+
60
+ /**
61
+ * @var int
62
+ */
63
+ protected $_countReviewUpdate = 0;
64
+
65
+
66
+ /**
67
+ *
68
+ */
69
+ public function __construct()
70
+ {
71
+ $this->_config = Mage::getSingleton('nrapps_tsreviewmanagement/config');
72
+ $this->_client = Mage::getSingleton('nrapps_tsreviewmanagement/client');
73
+ $this->_response = Mage::getSingleton('nrapps_tsreviewmanagement/response');
74
+ $this->_shop = Mage::getSingleton('nrapps_tsreviewmanagement/shop');
75
+ }
76
+
77
+
78
+ /**
79
+ * @param $store
80
+ * @param DateTime $startDate
81
+ * @param DateTime $endDate
82
+ *
83
+ * @return bool
84
+ */
85
+ public function import($store, DateTime $startDate, DateTime $endDate = null)
86
+ {
87
+ $this->_client->setUri($this->_config->getApiUri($store));
88
+ $this->_client->setTsid($this->_config->getTsid($store));
89
+ $this->_client->setUser($this->_config->getApiUser($store));
90
+ $this->_client->setPassword($this->_config->getApiPassword($store));
91
+ $this->_client->setStartDate($startDate->format('Y-m-d'));
92
+ $this->_client->setEndDate($endDate ? $endDate->format('Y-m-d') : null);
93
+ $this->_client->setSize($this->_config->getApiParamSize($store));
94
+
95
+ return $this->_import(0, $store, $startDate, $endDate);
96
+ }
97
+
98
+
99
+ /**
100
+ * @param $page
101
+ * @param $store
102
+ * @param DateTime $startDate
103
+ * @param DateTime $endDate
104
+ *
105
+ * @return bool
106
+ */
107
+ protected function _import($page, $store, DateTime $startDate, DateTime $endDate = null)
108
+ {
109
+ $this->_client->setPage($page);
110
+
111
+ $data = $this->_client->fetch();
112
+ $data = Mage::helper('core')->jsonDecode($data);
113
+
114
+ $this->_response->setResponseData($data);
115
+
116
+ if ($error = $this->_response->getError()) {
117
+
118
+ $message = Mage::helper('nrapps_tsreviewmanagement')->__($error->getData('message'));
119
+ $message = Mage::helper('nrapps_tsreviewmanagement')->__('Service Error: %1$s/%2$s - %3$s', $error->getData('status'), $error->getData('code'), $message);
120
+
121
+ Mage::throwException($message);
122
+ }
123
+
124
+ /**
125
+ * create-update shop
126
+ */
127
+ if (!$this->_isShopUpdate && !$this->_isShopCreate) {
128
+
129
+ $shopInfo = $this->_response->getShopInfo();
130
+
131
+ $this->_shop->loadByTsid($shopInfo['tsid']);
132
+ $this->_shop->getId() ? ($this->_isShopUpdate = true) : ($this->_isShopCreate = true);
133
+ $this->_shop->addData($shopInfo);
134
+ $this->_shop->setData('store_id', $store);
135
+ $this->_shop->save();
136
+ }
137
+
138
+ /**
139
+ * create-update review
140
+ */
141
+ $reviewInfo = $this->_response->getReviewInfo();
142
+
143
+ foreach ($reviewInfo as $reviewData) {
144
+
145
+ $review = $this->_getReviewInstance();
146
+ $review->loadByUid($reviewData['uid']);
147
+ $review->getId() ? $this->_countReviewUpdate++ : $this->_countReviewCreate++;
148
+ $review->setShopId($this->_shop->getId());
149
+ $review->addData($reviewData);
150
+ $review->save();
151
+ }
152
+
153
+ /**
154
+ * recursive call
155
+ */
156
+ if (count($reviewInfo) == $this->_config->getApiParamSize($store) && $page < (self::MAX_API_CALLS - 1)) {
157
+
158
+ return $this->_import(++$page, $store, $startDate, $endDate);
159
+
160
+ } else if ($page == (self::MAX_API_CALLS - 1)) {
161
+
162
+ return false;
163
+ }
164
+
165
+ return true;
166
+ }
167
+
168
+
169
+ /**
170
+ * @return NRApps_TSReviewManagement_Model_Shop
171
+ */
172
+ protected function _getShopInstance()
173
+ {
174
+ return Mage::getModel('nrapps_tsreviewmanagement/shop');
175
+ }
176
+
177
+
178
+ /**
179
+ * @return NRApps_TSReviewManagement_Model_Review
180
+ */
181
+ protected function _getReviewInstance()
182
+ {
183
+ return Mage::getModel('nrapps_tsreviewmanagement/review');
184
+ }
185
+
186
+
187
+ /**
188
+ * @return NRApps_TSReviewManagement_Model_Shop
189
+ */
190
+ public function getShop()
191
+ {
192
+ return $this->_shop;
193
+ }
194
+
195
+
196
+ /**
197
+ * @return bool
198
+ */
199
+ public function isShopCreate()
200
+ {
201
+ return $this->_isShopCreate;
202
+ }
203
+
204
+
205
+ /**
206
+ * @return bool
207
+ */
208
+ public function isShopUpdate()
209
+ {
210
+ return $this->_isShopUpdate;
211
+ }
212
+
213
+
214
+ /**
215
+ * @return int
216
+ */
217
+ public function getCountReviewCreate()
218
+ {
219
+ return $this->_countReviewCreate;
220
+ }
221
+
222
+
223
+ /**
224
+ * @return int
225
+ */
226
+ public function getCountReviewUpdate()
227
+ {
228
+ return $this->_countReviewUpdate;
229
+ }
230
+ }
app/code/community/NRApps/TSReviewManagement/Model/Resource/Review.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Model_Resource_Review
15
+ */
16
+ class NRApps_TSReviewManagement_Model_Resource_Review extends Mage_Core_Model_Resource_Db_Abstract
17
+ {
18
+
19
+
20
+ /**
21
+ *
22
+ */
23
+ protected function _construct()
24
+ {
25
+ $this->_init('nrapps_tsreviewmanagement/review', 'entity_id');
26
+ }
27
+
28
+
29
+ /**
30
+ * @param Mage_Core_Model_Abstract|Varien_Object $object
31
+ *
32
+ * @return $this
33
+ */
34
+ public function _afterLoad(Mage_Core_Model_Abstract $object)
35
+ {
36
+ parent::_afterLoad($object);
37
+ $this->_loadCriterion($object);
38
+ $this->_loadStatement($object);
39
+ $this->_loadShop($object);
40
+
41
+ return $this;
42
+ }
43
+
44
+
45
+ /**
46
+ * @param Mage_Core_Model_Abstract $object
47
+ *
48
+ * @return $this
49
+ */
50
+ public function _afterSave(Mage_Core_Model_Abstract $object)
51
+ {
52
+ parent::_afterSave($object);
53
+ $this->_saveCriterion($object);
54
+ $this->_saveStatement($object);
55
+
56
+ return $this;
57
+ }
58
+
59
+
60
+ /**
61
+ * @param Mage_Core_Model_Abstract $object
62
+ *
63
+ * @return $this
64
+ */
65
+ public function _loadCriterion(Mage_Core_Model_Abstract $object)
66
+ {
67
+ $select = $this->getReadConnection()->select();
68
+ $select->from($this->getTable('nrapps_tsreviewmanagement/review_criterion'), '*');
69
+ $select->where('review_id = ?', $object->getId());
70
+
71
+ $criterion = $this->getReadConnection()->fetchAssoc($select);
72
+
73
+ foreach($criterion as $index => $_criterion) {
74
+ unset($criterion[$index]);
75
+ unset($_criterion['entity_id']);
76
+ unset($_criterion['review_id']);
77
+ $criterion[$_criterion['type']] = $_criterion;
78
+ }
79
+
80
+ if($criterion) {
81
+ $object->setData('criterion', $criterion);
82
+
83
+ }
84
+
85
+ return $this;
86
+ }
87
+
88
+
89
+ /**
90
+ * @param Mage_Core_Model_Abstract $object
91
+ *
92
+ * @return $this
93
+ */
94
+ public function _loadStatement(Mage_Core_Model_Abstract $object)
95
+ {
96
+ $select = $this->getReadConnection()->select();
97
+ $select->from($this->getTable('nrapps_tsreviewmanagement/review_statement'), '*');
98
+ $select->where('review_id = ?', $object->getId());
99
+
100
+ $statement = $this->getReadConnection()->fetchRow($select);
101
+
102
+ if($statement) {
103
+ unset($statement['entity_id']);
104
+ unset($statement['review_id']);
105
+ $object->setData('statement', $statement);
106
+ }
107
+
108
+ return $this;
109
+ }
110
+
111
+ /**
112
+ * @param Mage_Core_Model_Abstract $object
113
+ *
114
+ * @return $this
115
+ */
116
+ public function _loadShop(Mage_Core_Model_Abstract $object)
117
+ {
118
+ $select = $this->getReadConnection()->select();
119
+ $select->from($this->getTable('nrapps_tsreviewmanagement/shop'), '*');
120
+ $select->where('entity_id = ?', $object->getData('shop_id'));
121
+
122
+ $shop = $this->getReadConnection()->fetchRow($select);
123
+
124
+ if($shop) {
125
+ $object->setData('shop', $shop);
126
+ }
127
+
128
+ return $this;
129
+ }
130
+
131
+
132
+ /**
133
+ * @param Mage_Core_Model_Abstract $object
134
+ *
135
+ * @return $this
136
+ */
137
+ public function _saveCriterion(Mage_Core_Model_Abstract $object)
138
+ {
139
+ if ($object->hasData('criterion')) {
140
+
141
+ $criterion = $object->getData('criterion');
142
+
143
+ if (is_array($criterion) && count($criterion)) {
144
+
145
+ foreach ($criterion as $_criterion) {
146
+
147
+ $_criterion['review_id'] = $object->getId();
148
+
149
+ $this->_getWriteAdapter()->insertOnDuplicate(
150
+ $this->getTable('nrapps_tsreviewmanagement/review_criterion'),
151
+ $_criterion,
152
+ array('review_id', 'type')
153
+ );
154
+
155
+ $this->_getWriteAdapter()->delete(
156
+ $this->getTable('nrapps_tsreviewmanagement/review_criterion'),
157
+ array(
158
+ 'review_id = ?' => $object->getId(),
159
+ 'type NOT IN (?)' => array_keys($criterion),
160
+ )
161
+ );
162
+ }
163
+
164
+ } else {
165
+
166
+ $this->_getWriteAdapter()->delete(
167
+ $this->getTable('nrapps_tsreviewmanagement/review_criterion'),
168
+ array('review_id = ?' => $object->getId())
169
+ );
170
+ }
171
+ }
172
+
173
+ return $this;
174
+ }
175
+
176
+
177
+ /**
178
+ * @param Mage_Core_Model_Abstract $object
179
+ *
180
+ * @return $this
181
+ */
182
+ public function _saveStatement(Mage_Core_Model_Abstract $object)
183
+ {
184
+ if ($object->hasData('statement')) {
185
+
186
+ $statement = $object->getData('statement');
187
+
188
+ if (is_array($statement) && count($statement)) {
189
+
190
+ $statement['review_id'] = $object->getId();
191
+
192
+ $this->_getWriteAdapter()->insertOnDuplicate(
193
+ $this->getTable('nrapps_tsreviewmanagement/review_statement'),
194
+ $statement,
195
+ array('review_id')
196
+ );
197
+
198
+ } else {
199
+
200
+ $this->_getWriteAdapter()->delete(
201
+ $this->getTable('nrapps_tsreviewmanagement/review_statement'),
202
+ array('review_id = ?' => $object->getId())
203
+ );
204
+ }
205
+ }
206
+
207
+ return $this;
208
+ }
209
+ }
app/code/community/NRApps/TSReviewManagement/Model/Resource/Review/Collection.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Model_Resource_Review_Collection
15
+ */
16
+ class NRApps_TSReviewManagement_Model_Resource_Review_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
17
+ {
18
+
19
+
20
+ /**
21
+ *
22
+ */
23
+ protected function _construct()
24
+ {
25
+ $this->_init('nrapps_tsreviewmanagement/review');
26
+ }
27
+ }
app/code/community/NRApps/TSReviewManagement/Model/Resource/Shop.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Model_Resource_Shop
15
+ */
16
+ class NRApps_TSReviewManagement_Model_Resource_Shop extends Mage_Core_Model_Resource_Db_Abstract
17
+ {
18
+
19
+
20
+ /**
21
+ *
22
+ */
23
+ protected function _construct()
24
+ {
25
+ $this->_init('nrapps_tsreviewmanagement/shop', 'entity_id');
26
+ }
27
+
28
+
29
+ /**
30
+ * @param $storeId
31
+ */
32
+ public function deleteByStoreId($storeId)
33
+ {
34
+ $this->_getWriteAdapter()->delete(
35
+ $this->getMainTable(),
36
+ $this->_getWriteAdapter()->quoteInto('store_id' . ' = ?', $storeId)
37
+ );
38
+ }
39
+ }
app/code/community/NRApps/TSReviewManagement/Model/Resource/Shop/Collection.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Model_Resource_Review_Shop_Collection
15
+ */
16
+ class NRApps_TSReviewManagement_Model_Resource_Review_Shop_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
17
+ {
18
+
19
+
20
+ /**
21
+ *
22
+ */
23
+ protected function _construct()
24
+ {
25
+ $this->_init('nrapps_tsreviewmanagement/shop');
26
+ }
27
+ }
app/code/community/NRApps/TSReviewManagement/Model/Response.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Model_Response
15
+ */
16
+ class NRApps_TSReviewManagement_Model_Response
17
+ {
18
+
19
+
20
+ /**
21
+ * @var Varien_Object
22
+ */
23
+ protected $_responseData;
24
+
25
+
26
+ /**
27
+ * @param array $responseData
28
+ *
29
+ * @return $this
30
+ */
31
+ public function setResponseData(array $responseData)
32
+ {
33
+ $this->_responseData = new Varien_Object($responseData);
34
+
35
+ return $this;
36
+ }
37
+
38
+
39
+ /**
40
+ * @return null|Varien_Object
41
+ */
42
+ public function getError()
43
+ {
44
+ if ($this->_responseData->getData('response/code') != 200) {
45
+
46
+ return new Varien_Object(array(
47
+ 'code' => $this->_responseData->getData('response/code'),
48
+ 'status' => $this->_responseData->getData('response/status'),
49
+ 'message' => $this->_responseData->getData('response/message'),
50
+ ));
51
+ }
52
+
53
+ return null;
54
+ }
55
+
56
+
57
+ /**
58
+ * @return array
59
+ */
60
+ public function getShopInfo()
61
+ {
62
+ return array(
63
+ 'tsid' => $this->_responseData->getData('response/data/shop/tsId'),
64
+ 'url' => $this->_responseData->getData('response/data/shop/url'),
65
+ 'name' => $this->_responseData->getData('response/data/shop/name'),
66
+ 'language_iso2' => $this->_responseData->getData('response/data/shop/languageISO2'),
67
+ 'target_market_iso3' => $this->_responseData->getData('response/data/shop/targetMarketISO3'),
68
+ );
69
+ }
70
+
71
+
72
+ /**
73
+ * @return array
74
+ */
75
+ public function getReviewInfo()
76
+ {
77
+ $review = array();
78
+ $reviewsIndex = $this->_responseData->getData('response/data/shop/reviews');
79
+
80
+
81
+ if (is_array($reviewsIndex)) {
82
+
83
+
84
+ /**
85
+ * if one review in in response it is not wrapped in sub array
86
+ */
87
+ if (!array_key_exists('0', $reviewsIndex)) {
88
+ $reviewsIndex = array('-1' => true);
89
+ }
90
+
91
+ foreach (array_keys($reviewsIndex) as $_reviewsIndex) {
92
+
93
+ $dataKeyPrefix = "response/data/shop/reviews/{$_reviewsIndex}/";
94
+
95
+
96
+ $review[$_reviewsIndex] = array(
97
+ 'uid' => $this->_responseData->getData($dataKeyPrefix . 'UID'),
98
+ 'change_date' => $this->_date($this->_responseData->getData($dataKeyPrefix . 'changeDate')),
99
+ 'creation_date' => $this->_date($this->_responseData->getData($dataKeyPrefix . 'creationDate')),
100
+ 'confirmation_date' => $this->_date($this->_responseData->getData($dataKeyPrefix . 'confirmationDate')),
101
+ 'order_date' => $this->_date($this->_responseData->getData($dataKeyPrefix . 'orderDate')),
102
+ 'mark' => $this->_responseData->getData($dataKeyPrefix . 'mark'),
103
+ 'mark_description' => $this->_responseData->getData($dataKeyPrefix . 'markDescription'),
104
+ 'consumer_email' => $this->_responseData->getData($dataKeyPrefix . 'consumerEmail'),
105
+ 'comment' => $this->_responseData->getData($dataKeyPrefix . 'comment'),
106
+ 'order_reference' => $this->_responseData->getData($dataKeyPrefix . 'orderReference'),
107
+ 'criterion' => array(),
108
+ 'statement' => array(),
109
+ );
110
+
111
+
112
+ $criterionIndex = $this->_responseData->getData($dataKeyPrefix . 'criteria');
113
+
114
+ if (is_array($criterionIndex)) {
115
+
116
+ foreach (array_keys($criterionIndex) as $_criterionIndex) {
117
+
118
+ $criterionType = $this->_responseData->getData("{$dataKeyPrefix}criteria/{$_criterionIndex}/type");
119
+
120
+ $review[$_reviewsIndex]['criterion'][$criterionType] = array(
121
+ 'type' => $criterionType,
122
+ 'mark' => $this->_responseData->getData("{$dataKeyPrefix}criteria/{$_criterionIndex}/mark"),
123
+ 'mark_description' => $this->_responseData->getData("{$dataKeyPrefix}criteria/{$_criterionIndex}/markDescription"),
124
+ );
125
+ }
126
+ }
127
+
128
+
129
+ if ($this->_responseData->getData($dataKeyPrefix . 'statements')) {
130
+
131
+ $review[$_reviewsIndex]['statement'] = array(
132
+ 'uid' => $this->_responseData->getData($dataKeyPrefix . 'statements/0/UID'),
133
+ 'change_date' => $this->_date($this->_responseData->getData($dataKeyPrefix . 'statements/0/changeDate')),
134
+ 'creation_date' => $this->_date($this->_responseData->getData($dataKeyPrefix . 'statements/0/creationDate')),
135
+ 'statement' => $this->_responseData->getData($dataKeyPrefix . 'statements/0/comment'),
136
+ );
137
+ }
138
+ }
139
+ }
140
+
141
+ return $review;
142
+ }
143
+
144
+
145
+ /**
146
+ * @param $date
147
+ *
148
+ * @return null|string
149
+ */
150
+ protected function _date($date)
151
+ {
152
+ if ($date) {
153
+ $date = new DateTime($date);
154
+ return $date->format('Y-m-d H:i:s');
155
+ }
156
+
157
+ return null;
158
+ }
159
+ }
app/code/community/NRApps/TSReviewManagement/Model/Review.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Model_Review
15
+ *
16
+ * @method NRApps_TSReviewManagement_Model_Resource_Review getResource()
17
+ */
18
+ class NRApps_TSReviewManagement_Model_Review extends Mage_Core_Model_Abstract
19
+ {
20
+
21
+
22
+ /**
23
+ *
24
+ */
25
+ protected function _construct()
26
+ {
27
+ $this->_init('nrapps_tsreviewmanagement/review');
28
+ }
29
+
30
+
31
+ /**
32
+ * @param string $uid
33
+ *
34
+ * @return $this
35
+ */
36
+ public function loadByUid($uid)
37
+ {
38
+ $this->load($uid, 'uid');
39
+
40
+ return $this;
41
+ }
42
+
43
+
44
+ /**
45
+ * @param int $shopId
46
+ *
47
+ * @return $this
48
+ */
49
+ public function setShopId($shopId)
50
+ {
51
+ $this->setData('shop_id', $shopId);
52
+
53
+ return $this;
54
+ }
55
+
56
+
57
+ /**
58
+ * @return array
59
+ */
60
+ public function getMarkOptions()
61
+ {
62
+ return array(
63
+ 'EXCELLENT' => Mage::helper('nrapps_tsreviewmanagement')->__('Excellent'),
64
+ 'GOOD' => Mage::helper('nrapps_tsreviewmanagement')->__('Good'),
65
+ 'FAIR' => Mage::helper('nrapps_tsreviewmanagement')->__('Fair'),
66
+ 'POOR' => Mage::helper('nrapps_tsreviewmanagement')->__('Poor'),
67
+ 'VERY_POOR' => Mage::helper('nrapps_tsreviewmanagement')->__('Very Poor'),
68
+ );
69
+ }
70
+ }
app/code/community/NRApps/TSReviewManagement/Model/ScheduleService.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class class NRApps_TSReviewManagement_Model_ScheduleService
15
+ */
16
+ class NRApps_TSReviewManagement_Model_ScheduleService
17
+ {
18
+
19
+
20
+ /**
21
+ * @var NRApps_TSReviewManagement_Model_Config
22
+ */
23
+ protected $_config;
24
+
25
+ /**
26
+ * @var NRApps_TSReviewManagement_Model_Shop
27
+ */
28
+ protected $_shop;
29
+
30
+ /**
31
+ * @var NRApps_TSReviewManagement_Model_ImportService
32
+ */
33
+ protected $_importService;
34
+
35
+
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ $this->_config = Mage::getSingleton('nrapps_tsreviewmanagement/config');
42
+ $this->_shop = Mage::getSingleton('nrapps_tsreviewmanagement/shop');
43
+ $this->_importService = Mage::getSingleton('nrapps_tsreviewmanagement/importService');
44
+ }
45
+
46
+
47
+ /**
48
+ *
49
+ */
50
+ public function exec(Varien_Object $schedule = null)
51
+ {
52
+ if ($this->_config->isScheduling()) {
53
+
54
+ $message = array();
55
+
56
+ $startDate = new DateTime();
57
+ $startDate->sub(new DateInterval('P2D'));
58
+ $endDate = new DateTime();
59
+
60
+ $startDate2 = new DateTime();
61
+ $startDate2->sub(new DateInterval('P14D'));
62
+ $endDate2 = new DateTime();
63
+ $endDate2->sub(new DateInterval('P12D'));
64
+
65
+ foreach (array_keys($this->_shop->getConfiguredStores()) as $storeId) {
66
+
67
+ try {
68
+ $this->_importService->import($storeId, $startDate, $endDate);
69
+ } catch (Exception $e) {
70
+ $message[] = sprintf('Store Id: %1$s - %2$s',$storeId, $e->getMessage());
71
+ }
72
+
73
+ try {
74
+ $this->_importService->import($storeId, $startDate2, $endDate2);
75
+ } catch (Exception $e) {
76
+ $message[] = sprintf('Store Id: %1$s - %2$s',$storeId, $e->getMessage());
77
+ }
78
+ }
79
+
80
+ if ($schedule && $message) {
81
+
82
+ Mage::throwException(implode("\n", $message));
83
+ }
84
+ }
85
+ }
86
+ }
app/code/community/NRApps/TSReviewManagement/Model/Shop.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Model_Shop
15
+ *
16
+ * @method NRApps_TSReviewManagement_Model_Resource_Shop getResource()
17
+ */
18
+ class NRApps_TSReviewManagement_Model_Shop extends Mage_Core_Model_Abstract
19
+ {
20
+
21
+
22
+ /**
23
+ *
24
+ */
25
+ protected function _construct()
26
+ {
27
+ $this->_init('nrapps_tsreviewmanagement/shop');
28
+ }
29
+
30
+
31
+ /**
32
+ * @param string $tsid
33
+ *
34
+ * @return $this
35
+ */
36
+ public function loadByTsid($tsid)
37
+ {
38
+ $this->load($tsid, 'tsid');
39
+
40
+ return $this;
41
+ }
42
+
43
+
44
+ /**
45
+ * @return array
46
+ */
47
+ public function getConfiguredStores()
48
+ {
49
+ $configuredStores = array();
50
+
51
+ $config = Mage::getSingleton('nrapps_tsreviewmanagement/config');
52
+
53
+ /** @var Mage_Core_Model_Store $store */
54
+ foreach (Mage::app()->getStores() as $store) {
55
+
56
+ $tsid = $config->getTsid($store);
57
+
58
+ if ($tsid) {
59
+
60
+ $configuredStores[$store->getId()] = $store->getId();
61
+ }
62
+ }
63
+
64
+ return $configuredStores;
65
+ }
66
+ }
app/code/community/NRApps/TSReviewManagement/Model/System/Store.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+ /**
13
+ * Class NRApps_TSReviewManagement_Model_System_Store
14
+ */
15
+ class NRApps_TSReviewManagement_Model_System_Store extends Mage_Adminhtml_Model_System_Store
16
+ {
17
+
18
+
19
+ /**
20
+ * @param $configuredStores
21
+ *
22
+ * @return array
23
+ */
24
+ public function getConfiguredStoreValuesForForm($configuredStores)
25
+ {
26
+ foreach ($this->_storeCollection as $index => $store) {
27
+ if (!array_key_exists($store->getId(), $configuredStores)) {
28
+ unset($this->_storeCollection[$index]);
29
+ }
30
+ }
31
+
32
+ return $this->getStoreValuesForForm(false, false);
33
+ }
34
+ }
app/code/community/NRApps/TSReviewManagement/controllers/Adminhtml/Nrappstsreviewmanagement/IndexController.php ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /**
14
+ * Class NRApps_TSReviewManagement_Adminhtml_NrappsTSReviewManagement_IndexController
15
+ */
16
+ class NRApps_TSReviewManagement_Adminhtml_NrappsTSReviewManagement_IndexController extends Mage_Adminhtml_Controller_Action
17
+ {
18
+
19
+
20
+ /**
21
+ *
22
+ */
23
+ public function indexAction()
24
+ {
25
+ $this->loadLayout();
26
+
27
+ $this->_setActiveMenu('sales/nrapps_tsreviewmanagement');
28
+ $this->_title(Mage::helper('sales')->__('Sales'));
29
+ $this->_title($this->__('Trusted Shops Reviews'));
30
+ $this->getLayout()->getBlock('head')->addJs('nrapps_tsreviewmanagement/script.js');
31
+
32
+ $this->_addContent($this->getLayout()->createBlock('nrapps_tsreviewmanagement/adminhtml_form_container'));
33
+ $this->_addContent($this->getLayout()->createBlock('nrapps_tsreviewmanagement/adminhtml_grid_tabs'));
34
+ $this->_addContent($this->getLayout()->createBlock('nrapps_tsreviewmanagement/adminhtml_grid_container'));
35
+
36
+ $this->renderLayout();
37
+ }
38
+
39
+
40
+ /**
41
+ *
42
+ */
43
+ public function importAction()
44
+ {
45
+ try {
46
+ $postData = $this->getRequest()->getParams();
47
+ $postData = $this->_filterDates($postData, array('start_date', 'end_date'));
48
+
49
+ $storeId = $this->_getStoreId($postData);
50
+ $startDate = $this->_getStartDate($postData);
51
+ $endDate = $this->_getEndDate($postData);
52
+
53
+ $importService = Mage::getSingleton('nrapps_tsreviewmanagement/importService');
54
+ $importServiceStatus = $importService->import($storeId, $startDate, $endDate);
55
+
56
+ $dateFormat = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
57
+ $startDate = Mage::getSingleton('core/locale')->date($startDate->format('Y-m-d'), null, null, false)->toString($dateFormat);
58
+ $endDate = Mage::getSingleton('core/locale')->date($endDate->format('Y-m-d'), null, null, false)->toString($dateFormat);
59
+
60
+ if ($importServiceStatus) {
61
+ $this->_getSession()->addSuccess($this->__('Rewies import for time period %1$s to %2$s has been successfully completed.', $startDate, $endDate));
62
+ } else {
63
+ $max = Mage::getSingleton('nrapps_tsreviewmanagement/config')->getApiParamSize() * NRApps_TSReviewManagement_Model_ImportService::MAX_API_CALLS;
64
+ $this->_getSession()->addWarning($this->__('Reached maximum (%1$s) reviews import for time periode %2$s to %3$s, please choose a smaller time period.', $max, $startDate, $endDate));
65
+ }
66
+
67
+ $this->_getSession()->addSuccess($this->__('%s Reviews has been created.', $importService->getCountReviewCreate()));
68
+ $this->_getSession()->addSuccess($this->__('%s Reviews has been updated.', $importService->getCountReviewUpdate()));
69
+
70
+ } catch (Exception $e) {
71
+
72
+ $this->_getSession()->addError($e->getMessage());
73
+ Mage::logException($e);
74
+ }
75
+
76
+ $this->_redirect('*/*/index');
77
+ }
78
+
79
+
80
+ /**
81
+ * Review Order Grid AJAX Request Action
82
+ */
83
+ public function gridrevieworderAction()
84
+ {
85
+ /** @var NRApps_TSReviewManagement_Block_Adminhtml_Grid_GridOrder $grid */
86
+ $grid = $this->getLayout()->createBlock('nrapps_tsreviewmanagement/adminhtml_grid_gridOrder');
87
+
88
+ $this->getResponse()->setBody($grid->toHtml());
89
+ }
90
+
91
+
92
+ /**
93
+ * Review Foreign Grid AJAX Request Action
94
+ */
95
+ public function gridreviewforeignAction()
96
+ {
97
+ /** @var NRApps_TSReviewManagement_Block_Adminhtml_Grid_GridForeign $grid */
98
+ $grid = $this->getLayout()->createBlock('nrapps_tsreviewmanagement/adminhtml_grid_gridForeign');
99
+
100
+ $this->getResponse()->setBody($grid->toHtml());
101
+ }
102
+
103
+
104
+ /**
105
+ * Mass Delete
106
+ */
107
+ public function massDeleteAction()
108
+ {
109
+ foreach ((array)$this->getRequest()->getParam('entity_id') as $entityId) {
110
+
111
+ $review = Mage::getModel('nrapps_tsreviewmanagement/review');
112
+ $review->setId($entityId);
113
+ $review->delete();
114
+ }
115
+ }
116
+
117
+
118
+ /**
119
+ *
120
+ */
121
+ public function viewAction()
122
+ {
123
+ /** @var NRApps_TSReviewManagement_Model_Review $review */
124
+ $review = Mage::getModel('nrapps_tsreviewmanagement/review');
125
+ $review->load($this->getRequest()->getParam('id'));
126
+
127
+ /** @var NRApps_TSReviewManagement_Block_Adminhtml_Info $reviewInfo */
128
+ $reviewInfo = $this->getLayout()->createBlock('nrapps_tsreviewmanagement/adminhtml_info');
129
+ $reviewInfo->setReview($review);
130
+
131
+ $this->getResponse()->setBody($reviewInfo->toHtml());
132
+ }
133
+
134
+
135
+ /**
136
+ * @param $postData
137
+ *
138
+ * @throws Exception
139
+ *
140
+ * @return integer
141
+ */
142
+ protected function _getStoreId($postData)
143
+ {
144
+ $configuredStores = Mage::getModel('nrapps_tsreviewmanagement/shop')->getConfiguredStores();
145
+
146
+ if (array_key_exists('store_id', $postData)
147
+ && array_key_exists($postData['store_id'], $configuredStores)
148
+ ) {
149
+ return $postData['store_id'];
150
+
151
+ } elseif (count($configuredStores) === 1) {
152
+
153
+ return array_pop($configuredStores);
154
+ }
155
+
156
+ Mage::throwException($this->__('Trusted Shops Reviews store configuration error.'));
157
+ }
158
+
159
+ /**
160
+ *
161
+ */
162
+ public function deleteAction()
163
+ {
164
+ $store = $this->getRequest()->getParam('store');
165
+ $store = Mage::app()->getStore($store);
166
+
167
+ if($store && $store->getId()) {
168
+
169
+ try {
170
+ Mage::getResourceModel('nrapps_tsreviewmanagement/shop')->deleteByStoreId($store->getId());
171
+ $this->_getSession()->addSuccess($this->__('The store reviews has been deleted.'));
172
+
173
+ } catch (Exception $e) {
174
+ $this->_getSession()->addError($e->getMessage());
175
+ Mage::logException($e);
176
+ }
177
+ }
178
+
179
+ $this->_redirect('*/system_config/edit', array('_current' => true));
180
+ }
181
+
182
+
183
+ /**
184
+ * @param array $postData
185
+ *
186
+ * @return DateTime
187
+ */
188
+ protected function _getStartDate($postData)
189
+ {
190
+ $endDate = clone $this->_getEndDate($postData);
191
+
192
+ if (array_key_exists('start_date', $postData)) {
193
+ $startDate = DateTime::createFromFormat('Y-m-d', $postData['start_date']);
194
+ } else {
195
+ $startDate = clone $endDate;
196
+ }
197
+
198
+ if ($startDate > $endDate) {
199
+
200
+ return $endDate;
201
+ }
202
+
203
+ return $startDate;
204
+ }
205
+
206
+
207
+ /**
208
+ * @param array $postData
209
+ *
210
+ * @return DateTime
211
+ */
212
+ protected function _getEndDate($postData)
213
+ {
214
+ $nowDate = new DateTime();
215
+
216
+ if (array_key_exists('end_date', $postData)) {
217
+ $endDate = DateTime::createFromFormat('Y-m-d', $postData['end_date']);
218
+ } else {
219
+ $endDate = clone $nowDate;
220
+ }
221
+
222
+ if ($endDate > $nowDate) {
223
+ return $nowDate;
224
+ }
225
+
226
+ return $endDate;
227
+ }
228
+ }
app/code/community/NRApps/TSReviewManagement/data/nrapps_tsreviewmanagement_setup/data-install-1.0.0.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /* @var $installer Mage_Core_Model_Resource_Setup */
14
+ $installer = $this;
15
+ $installer->startSetup();
16
+
17
+ /**
18
+ * Copy TSID from Symmetrics_TrustedRating module config
19
+ */
20
+ foreach(Mage::app()->getStores() as $store) {
21
+
22
+ $tsid = trim(Mage::getStoreConfig('trustedrating/data/trustedrating_id', $store->getId()));
23
+
24
+ if($tsid) {
25
+ $installer->setConfigData('nrapps_tsreviewmanagement/settings/tsid', $tsid, 'stores', $store->getId());
26
+ }
27
+ }
app/code/community/NRApps/TSReviewManagement/etc/adminhtml.xml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category NRApps
5
+ * @package NRApps_TSReviewManagement
6
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
7
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
8
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
9
+ * @author integer_net GmbH <info@integer-net.de>
10
+ * @author Viktor Franz <vf@integer-net.de>
11
+ */
12
+ -->
13
+ <config>
14
+ <menu>
15
+ <sales>
16
+ <children>
17
+ <nrapps_tsreviewmanagement translate="title" module="nrapps_tsreviewmanagement">
18
+ <title>Trusted Shops Reviews</title>
19
+ <action>adminhtml/nrappstsreviewmanagement_index/index</action>
20
+ <sort_order>600</sort_order>
21
+ </nrapps_tsreviewmanagement>
22
+ </children>
23
+ </sales>
24
+ </menu>
25
+ <acl>
26
+ <resources>
27
+ <admin>
28
+ <children>
29
+ <sales>
30
+ <children>
31
+ <nrapps_tsreviewmanagement translate="title" module="nrapps_tsreviewmanagement">
32
+ <title>Trusted Shops Reviews</title>
33
+ </nrapps_tsreviewmanagement>
34
+ </children>
35
+ </sales>
36
+ <system>
37
+ <children>
38
+ <config>
39
+ <children>
40
+ <nrapps_tsreviewmanagement translate="title" module="nrapps_tsreviewmanagement">
41
+ <title>Trusted Shops Reviews</title>
42
+ </nrapps_tsreviewmanagement>
43
+ </children>
44
+ </config>
45
+ </children>
46
+ </system>
47
+ </children>
48
+ </admin>
49
+ </resources>
50
+ </acl>
51
+ </config>
app/code/community/NRApps/TSReviewManagement/etc/config.xml ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category NRApps
5
+ * @package NRApps_TSReviewManagement
6
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
7
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
8
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
9
+ * @author integer_net GmbH <info@integer-net.de>
10
+ * @author Viktor Franz <vf@integer-net.de>
11
+ */
12
+ -->
13
+ <config>
14
+ <modules>
15
+ <NRApps_TSReviewManagement>
16
+ <version>1.0.0</version>
17
+ </NRApps_TSReviewManagement>
18
+ </modules>
19
+ <global>
20
+ <helpers>
21
+ <nrapps_tsreviewmanagement>
22
+ <class>NRApps_TSReviewManagement_Helper</class>
23
+ </nrapps_tsreviewmanagement>
24
+ </helpers>
25
+ <blocks>
26
+ <nrapps_tsreviewmanagement>
27
+ <class>NRApps_TSReviewManagement_Block</class>
28
+ </nrapps_tsreviewmanagement>
29
+ </blocks>
30
+ <models>
31
+ <nrapps_tsreviewmanagement>
32
+ <class>NRApps_TSReviewManagement_Model</class>
33
+ <resourceModel>nrapps_tsreviewmanagement_resource</resourceModel>
34
+ </nrapps_tsreviewmanagement>
35
+ <nrapps_tsreviewmanagement_resource>
36
+ <class>NRApps_TSReviewManagement_Model_Resource</class>
37
+ <entities>
38
+ <shop>
39
+ <table>nrapps_tsreviewmanagement_shop</table>
40
+ </shop>
41
+ <review>
42
+ <table>nrapps_tsreviewmanagement_review</table>
43
+ </review>
44
+ <review_criterion>
45
+ <table>nrapps_tsreviewmanagement_review_criterion</table>
46
+ </review_criterion>
47
+ <review_statement>
48
+ <table>nrapps_tsreviewmanagement_review_statement</table>
49
+ </review_statement>
50
+ </entities>
51
+ </nrapps_tsreviewmanagement_resource>
52
+ </models>
53
+ <resources>
54
+ <nrapps_tsreviewmanagement_setup>
55
+ <setup>
56
+ <module>NRApps_TSReviewManagement</module>
57
+ <class>Mage_Core_Model_Resource_Setup</class>
58
+ </setup>
59
+ </nrapps_tsreviewmanagement_setup>
60
+ </resources>
61
+ </global>
62
+ <admin>
63
+ <routers>
64
+ <adminhtml>
65
+ <args>
66
+ <modules>
67
+ <nrapps_tsreviewmanagement before="Mage_Adminhtml">NRApps_TSReviewManagement_Adminhtml</nrapps_tsreviewmanagement>
68
+ </modules>
69
+ </args>
70
+ </adminhtml>
71
+ </routers>
72
+ </admin>
73
+ <adminhtml>
74
+ <translate>
75
+ <modules>
76
+ <NRApps_TSReviewManagement>
77
+ <files>
78
+ <default>NRApps_TSReviewManagement.csv</default>
79
+ </files>
80
+ </NRApps_TSReviewManagement>
81
+ </modules>
82
+ </translate>
83
+ </adminhtml>
84
+ <crontab>
85
+ <jobs>
86
+ <nrapps_tsreviewmanagement>
87
+ <schedule>
88
+ <cron_expr>0 2 * * *</cron_expr>
89
+ </schedule>
90
+ <run>
91
+ <model>nrapps_tsreviewmanagement/scheduleService::exec</model>
92
+ </run>
93
+ </nrapps_tsreviewmanagement>
94
+ </jobs>
95
+ </crontab>
96
+ <default>
97
+ <nrapps_tsreviewmanagement>
98
+ <settings>
99
+ <tsid/>
100
+ <api_user/>
101
+ <api_password/>
102
+ <api_uri><![CDATA[https://api.trustedshops.com/rest/restricted/v2/shops/{{tsid}}/reviews.json]]></api_uri>
103
+ <api_param_size>100</api_param_size>
104
+ <is_scheduling>0</is_scheduling>
105
+ <dev_mode>0</dev_mode>
106
+ </settings>
107
+ </nrapps_tsreviewmanagement>
108
+ </default>
109
+ </config>
app/code/community/NRApps/TSReviewManagement/etc/system.xml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category NRApps
5
+ * @package NRApps_TSReviewManagement
6
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
7
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
8
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
9
+ * @author integer_net GmbH <info@integer-net.de>
10
+ * @author Viktor Franz <vf@integer-net.de>
11
+ */
12
+ -->
13
+ <config>
14
+ <sections>
15
+ <nrapps_tsreviewmanagement translate="label description" module="nrapps_tsreviewmanagement">
16
+ <class>separator-top</class>
17
+ <label>Trusted Shops Reviews</label>
18
+ <tab>sales</tab>
19
+ <frontend_type>text</frontend_type>
20
+ <sort_order>1000</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>1</show_in_store>
24
+ <groups>
25
+ <settings>
26
+ <label>Settings (Please configure TSID, API User and Password on store view scope)</label>
27
+ <frontend_type>text</frontend_type>
28
+ <sort_order>10</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ <fields>
33
+ <tsid>
34
+ <label>TSID</label>
35
+ <frontend_type>text</frontend_type>
36
+ <sort_order>10</sort_order>
37
+ <show_in_default>0</show_in_default>
38
+ <show_in_website>0</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ </tsid>
41
+ <api_user>
42
+ <label>API User</label>
43
+ <frontend_type>text</frontend_type>
44
+ <sort_order>20</sort_order>
45
+ <show_in_default>0</show_in_default>
46
+ <show_in_website>0</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ </api_user>
49
+ <api_password>
50
+ <label>API Password</label>
51
+ <frontend_type>obscure</frontend_type>
52
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
53
+ <sort_order>30</sort_order>
54
+ <show_in_default>0</show_in_default>
55
+ <show_in_website>0</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </api_password>
58
+ <is_scheduling>
59
+ <label>Cron Scheduling</label>
60
+ <comment>Daily automatic import</comment>
61
+ <frontend_type>select</frontend_type>
62
+ <source_model>adminhtml/system_config_source_yesno</source_model>
63
+ <sort_order>40</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>0</show_in_website>
66
+ <show_in_store>0</show_in_store>
67
+ </is_scheduling>
68
+ <delete_reviews translate="button_label">
69
+ <label>Delete Imported Store Reviews</label>
70
+ <button_label>Delete</button_label>
71
+ <frontend_model>nrapps_tsreviewmanagement/adminhtml_system_config_delete</frontend_model>
72
+ <sort_order>50</sort_order>
73
+ <show_in_default>0</show_in_default>
74
+ <show_in_website>0</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </delete_reviews>
77
+ </fields>
78
+ </settings>
79
+ </groups>
80
+ </nrapps_tsreviewmanagement>
81
+ </sections>
82
+ </config>
app/code/community/NRApps/TSReviewManagement/sql/nrapps_tsreviewmanagement_setup/install-1.0.0.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /* @var $installer Mage_Core_Model_Resource_Setup */
14
+ $installer = $this;
15
+ $installer->startSetup();
16
+
17
+
18
+ /**
19
+ * NRApps_TSReviewManagement / Shop
20
+ */
21
+
22
+ if (!$installer->getConnection()->isTableExists($installer->getTable('nrapps_tsreviewmanagement/shop'))) {
23
+
24
+ $table = $installer->getConnection()
25
+ ->newTable($installer->getTable('nrapps_tsreviewmanagement/shop'))
26
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
27
+ 'identity' => true,
28
+ 'nullable' => false,
29
+ 'primary' => true,
30
+ 'unsigned' => true,
31
+ ), 'Entity Id')
32
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
33
+ 'nullable' => true,
34
+ 'unsigned' => true,
35
+ ), 'Store Id')
36
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
37
+ 'nullable' => false,
38
+ ), 'Creation Time')
39
+ ->addColumn('tsid', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
40
+ 'nullable' => false,
41
+ ), 'TSID')
42
+ ->addColumn('url', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
43
+ 'nullable' => true,
44
+ ), 'URL')
45
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
46
+ 'nullable' => true,
47
+ ), 'Name')
48
+ ->addColumn('language_iso2', Varien_Db_Ddl_Table::TYPE_TEXT, 2, array(
49
+ 'nullable' => true,
50
+ ), 'Language ISO 2')
51
+ ->addColumn('target_market_iso3', Varien_Db_Ddl_Table::TYPE_TEXT, 3, array(
52
+ 'nullable' => true,
53
+ ), 'Target Market ISO 3')
54
+ ->addIndex($installer->getIdxName('nrapps_tsreviewmanagement/shop', array('store_id')),
55
+ array('store_id'))
56
+ ->addForeignKey($installer->getFkName('nrapps_tsreviewmanagement/shop', 'store_id', 'core/store', 'store_id'),
57
+ 'store_id', $installer->getTable('core/store'), 'store_id',
58
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
59
+ ->setComment('NRApps_TSReviewManagement / Shop');
60
+ $installer->getConnection()->createTable($table);
61
+ }
62
+
63
+ /**
64
+ * NRApps_TSReviewManagement / Review
65
+ */
66
+
67
+ if (!$installer->getConnection()->isTableExists($installer->getTable('nrapps_tsreviewmanagement/review'))) {
68
+
69
+ $table = $installer->getConnection()
70
+ ->newTable($installer->getTable('nrapps_tsreviewmanagement/review'))
71
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
72
+ 'identity' => true,
73
+ 'nullable' => false,
74
+ 'primary' => true,
75
+ 'unsigned' => true,
76
+ ), 'Entity Id')
77
+ ->addColumn('shop_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
78
+ 'nullable' => true,
79
+ 'unsigned' => true,
80
+ ), 'Shop Id')
81
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
82
+ 'nullable' => false,
83
+ ), 'Creation Time')
84
+ ->addColumn('uid', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
85
+ 'nullable' => false,
86
+ ), 'UID')
87
+ ->addColumn('order_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
88
+ 'nullable' => true,
89
+ ), 'Order Date')
90
+ ->addColumn('creation_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
91
+ 'nullable' => true,
92
+ ), 'Creation Date')
93
+ ->addColumn('change_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
94
+ 'nullable' => true,
95
+ ), 'Change Date')
96
+ ->addColumn('confirmation_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
97
+ 'nullable' => true,
98
+ ), 'Confirmation Date')
99
+ ->addColumn('mark', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
100
+ 'nullable' => true,
101
+ ), 'Mark')
102
+ ->addColumn('mark_description', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
103
+ 'nullable' => true,
104
+ ), 'Mark Description')
105
+ ->addColumn('comment', Varien_Db_Ddl_Table::TYPE_TEXT, 1024, array(
106
+ 'nullable' => true,
107
+ ), 'Comment')
108
+ ->addColumn('consumer_email', Varien_Db_Ddl_Table::TYPE_TEXT, 128, array(
109
+ 'nullable' => true,
110
+ ), 'Consumer Email')
111
+ ->addColumn('order_reference', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
112
+ 'nullable' => true,
113
+ ), 'Order Reference')
114
+ ->addIndex($installer->getIdxName('nrapps_tsreviewmanagement/review', array('shop_id')),
115
+ array('shop_id'))
116
+ ->addForeignKey($installer->getFkName('nrapps_tsreviewmanagement/review', 'shop_id', 'nrapps_tsreviewmanagement/shop', 'entity_id'),
117
+ 'shop_id', $installer->getTable('nrapps_tsreviewmanagement/shop'), 'entity_id',
118
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
119
+ ->setComment('NRApps_TSReviewManagement / Review');
120
+ $installer->getConnection()->createTable($table);
121
+ }
122
+
123
+ /**
124
+ * NRApps_TSReviewManagement / Review Criterion
125
+ */
126
+
127
+ if (!$installer->getConnection()->isTableExists($installer->getTable('nrapps_tsreviewmanagement/review_criterion'))) {
128
+
129
+ $table = $installer->getConnection()
130
+ ->newTable($installer->getTable('nrapps_tsreviewmanagement/review_criterion'))
131
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
132
+ 'identity' => true,
133
+ 'nullable' => false,
134
+ 'primary' => true,
135
+ 'unsigned' => true,
136
+ ), 'Entity Id')
137
+ ->addColumn('review_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
138
+ 'nullable' => false,
139
+ 'unsigned' => true,
140
+ ), 'Review Id')
141
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
142
+ 'nullable' => false,
143
+ ), 'Creation Time')
144
+ ->addColumn('type', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
145
+ 'nullable' => false,
146
+ ), 'Type')
147
+ ->addColumn('mark', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
148
+ 'nullable' => true,
149
+ ), 'Mark')
150
+ ->addColumn('mark_description', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
151
+ 'nullable' => true,
152
+ ), 'Mark Description')
153
+ ->addIndex($installer->getIdxName('nrapps_tsreviewmanagement/review_statement', array('review_id', 'type'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE),
154
+ array('review_id', 'type'),
155
+ array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
156
+ ->addForeignKey($installer->getFkName('nrapps_tsreviewmanagement/review_criterion', 'review_id', 'nrapps_tsreviewmanagement/review', 'entity_id'),
157
+ 'review_id', $installer->getTable('nrapps_tsreviewmanagement/review'), 'entity_id',
158
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
159
+ ->setComment('NRApps_TSReviewManagement / Review Criterion');
160
+ $installer->getConnection()->createTable($table);
161
+ }
162
+
163
+ /**
164
+ * NRApps_TSReviewManagement / Review Statement
165
+ */
166
+
167
+ if (!$installer->getConnection()->isTableExists($installer->getTable('nrapps_tsreviewmanagement/review_statement'))) {
168
+
169
+ $table = $installer->getConnection()
170
+ ->newTable($installer->getTable('nrapps_tsreviewmanagement/review_statement'))
171
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
172
+ 'identity' => true,
173
+ 'nullable' => false,
174
+ 'primary' => true,
175
+ 'unsigned' => true,
176
+ ), 'Entity Id')
177
+ ->addColumn('review_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
178
+ 'nullable' => false,
179
+ 'unsigned' => true,
180
+ ), 'Review Id')
181
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
182
+ 'nullable' => false,
183
+ ), 'Creation Time')
184
+ ->addColumn('uid', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
185
+ 'nullable' => false,
186
+ ), 'UID')
187
+ ->addColumn('creation_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
188
+ 'nullable' => true,
189
+ ), 'Creation Date')
190
+ ->addColumn('change_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
191
+ 'nullable' => true,
192
+ ), 'Change Date')
193
+ ->addColumn('statement', Varien_Db_Ddl_Table::TYPE_TEXT, 1024, array(
194
+ 'nullable' => true,
195
+ ), 'Statement')
196
+ ->addIndex($installer->getIdxName('nrapps_tsreviewmanagement/review_statement', array('review_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE),
197
+ array('review_id'),
198
+ array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
199
+ ->addForeignKey($installer->getFkName('nrapps_tsreviewmanagement/review_statement', 'review_id', 'nrapps_tsreviewmanagement/review', 'entity_id'),
200
+ 'review_id', $installer->getTable('nrapps_tsreviewmanagement/review'), 'entity_id',
201
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
202
+ ->setComment('NRApps_TSReviewManagement / Statement Review');
203
+ $installer->getConnection()->createTable($table);
204
+ }
205
+
206
+ $installer->endSetup();
app/design/adminhtml/default/default/template/nrapps_tsreviewmanagement/info.phtml ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category NRApps
4
+ * @package NRApps_TSReviewManagement
5
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
6
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
7
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
8
+ * @author integer_net GmbH <info@integer-net.de>
9
+ * @author Viktor Franz <vf@integer-net.de>
10
+ */
11
+
12
+
13
+ /** @var $this NRApps_TSReviewManagement_Block_Adminhtml_Info */
14
+ ?>
15
+
16
+ <?php if($review = $this->getReview()): ?>
17
+
18
+ <div style="cursor: auto;">
19
+
20
+ <!--Review Review-->
21
+ <div class="box-left">
22
+ <div class="entry-edit">
23
+ <div class="entry-edit-head">
24
+ <h4 class="icon-head head-account"><?php echo $this->__('Review Details') ?></h4>
25
+ </div>
26
+ <div class="fieldset">
27
+ <table cellspacing="0" class="form-list">
28
+ <tr>
29
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('UID') ?></label></td>
30
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('uid') ?></strong></td>
31
+ </tr>
32
+ <?php if($orderDate = $review->getData('order_date')): ?>
33
+ <tr>
34
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Order Date') ?></label></td>
35
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $orderDate ?></strong></td>
36
+ </tr>
37
+ <?php endif; ?>
38
+ <tr>
39
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Creation Date') ?></label></td>
40
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $this->formatDate($review->getData('creation_date'), 'medium', true) ?></strong></td>
41
+ </tr>
42
+ <tr>
43
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Change Date') ?></label></td>
44
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $this->formatDate($review->getData('change_date'), 'medium', true) ?></strong></td>
45
+ </tr>
46
+ <tr>
47
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Confirmation Date') ?></label></td>
48
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $this->formatDate($review->getData('confirmation_date'), 'medium', true) ?></strong></td>
49
+ </tr>
50
+ <tr>
51
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Consumer Email') ?></label></td>
52
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('consumer_email') ?></strong></td>
53
+ </tr>
54
+ <tr>
55
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Order Reference') ?></label></td>
56
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $this->getOrderLink($review->getData('order_reference')) ?></strong></td>
57
+ </tr>
58
+ </table>
59
+ </div>
60
+ </div>
61
+ </div>
62
+
63
+ <!--Review Criterion-->
64
+ <div class="box-right">
65
+ <div class="entry-edit">
66
+ <div class="entry-edit-head">
67
+ <h4 class="icon-head head-account"><?php echo $this->__('Customer Review') ?></h4>
68
+ </div>
69
+ <div class="fieldset">
70
+ <table cellspacing="0" class="form-list">
71
+ <tr>
72
+ <td class="label" style="background-color: #fafafa !important; text-transform: uppercase; font-weight: bold;"><label><?php echo $this->__('Overall Score') ?></label></td>
73
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $this->getMarkInfo($review->getData('mark'), $review->getData('mark_description'), true) ?></strong></td>
74
+ </tr>
75
+ <?php if(is_array($review->getData('criterion'))) : ?>
76
+ <?php foreach($review->getData('criterion') as $index => $criterion) : ?>
77
+ <tr>
78
+ <td class="label" style="background-color: #fafafa !important; text-transform: uppercase;"><label><?php echo $this->__($review->getData("criterion/{$index}/type"))?></label></td>
79
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $this->getMarkInfo($review->getData("criterion/{$index}/mark"), $review->getData("criterion/{$index}/mark_description"), true) ?></strong></td>
80
+ </tr>
81
+ <?php endforeach; ?>
82
+ <?php endif; ?>
83
+ <tr>
84
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Comment') ?></label></td>
85
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('comment') ?></strong></td>
86
+ </tr>
87
+ <tr>
88
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Shop Statement') ?></label></td>
89
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('statement/statement') ?></strong></td>
90
+ </tr>
91
+ <tr>
92
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Shop Statement Date') ?></label></td>
93
+ <?php if($review->getData('statement/creation_date')) : ?>
94
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $this->formatDate($review->getData('statement/creation_date'), 'medium', true) ?></strong></td>
95
+ <?php endif; ?>
96
+ </tr>
97
+ </table>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ <div class="clear"></div>
102
+
103
+ <!--Review Review-->
104
+ <!-- div class="box-left">
105
+ <div class="entry-edit">
106
+ <div class="entry-edit-head">
107
+ <h4 class="icon-head head-account"><?php echo $this->__('Shop') ?></h4>
108
+ </div>
109
+ <div class="fieldset">
110
+ <table cellspacing="0" class="form-list">
111
+ <tr>
112
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('TSID') ?></label></td>
113
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('shop/tsid') ?></strong></td>
114
+ </tr>
115
+ <tr>
116
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('URL') ?></label></td>
117
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('shop/url') ?></strong></td>
118
+ </tr>
119
+ <tr>
120
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Name') ?></label></td>
121
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('shop/name') ?></strong></td>
122
+ </tr>
123
+ <tr>
124
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Language') ?></label></td>
125
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('shop/language_iso2') ?></strong></td>
126
+ </tr>
127
+ <tr>
128
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Target Market') ?></label></td>
129
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('shop/target_market_iso3') ?></strong></td>
130
+ </tr>
131
+ </table>
132
+ </div>
133
+ </div>
134
+ </div -->
135
+
136
+ <!--Review Statement-->
137
+ <!-- div class="box-right">
138
+ <div class="entry-edit">
139
+ <div class="entry-edit-head">
140
+ <h4 class="icon-head head-account"><?php echo $this->__('Statement') ?></h4>
141
+ </div>
142
+ <div class="fieldset">
143
+ <table cellspacing="0" class="form-list">
144
+ <tr>
145
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('UID') ?></label></td>
146
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('statement/uid') ?></strong></td>
147
+ </tr>
148
+ <tr>
149
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Creation Date') ?></label></td>
150
+ <?php if($review->getData('statement/creation_date')) : ?>
151
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $this->formatDate($review->getData('statement/creation_date'), 'medium', true) ?></strong></td>
152
+ <?php endif; ?>
153
+ </tr>
154
+ <tr>
155
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Change Date') ?></label></td>
156
+ <?php if($review->getData('statement/change_date')) : ?>
157
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $this->formatDate($review->getData('statement/change_date'), 'medium', true) ?></strong></td>
158
+ <?php endif; ?>
159
+ </tr>
160
+ <tr>
161
+ <td class="label" style="background-color: #fafafa !important;"><label><?php echo $this->__('Statement') ?></label></td>
162
+ <td class="value" style="background-color: #fafafa !important;"><strong><?php echo $review->getData('statement/statement') ?></strong></td>
163
+ </tr>
164
+ </table>
165
+ </div>
166
+ </div>
167
+ </div -->
168
+ </div>
169
+
170
+ <?php else : ?>
171
+
172
+ <?php echo $this->__('Failed to load the review data.') ?>
173
+
174
+ <?php endif; ?>
app/etc/modules/NRApps_TSReviewManagement.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category NRApps
5
+ * @package NRApps_TSReviewManagement
6
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
7
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
8
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
9
+ * @author integer_net GmbH <info@integer-net.de>
10
+ * @author Viktor Franz <vf@integer-net.de>
11
+ */
12
+ -->
13
+ <config>
14
+ <modules>
15
+ <NRApps_TSReviewManagement>
16
+ <active>true</active>
17
+ <codePool>community</codePool>
18
+ </NRApps_TSReviewManagement>
19
+ </modules>
20
+ </config>
app/locale/de_DE/NRApps_TSReviewManagement.csv ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Trusted Shops Reviews","Trusted Shops Bewertungen"
2
+ "Trusted Shops Customer Review Management","Trusted Shops Kundenbewertungs Management"
3
+ "Settings (Please configure TSID, API User and Password on store view scope)","Einstellungen (Bitte konfigurieren Sie TS-ID, API Benutzername und Passwort auf Storeview Ebene)"
4
+ "TSID","TS-ID"
5
+ "API User","API Benutzername"
6
+ "API Password","API Passwort"
7
+ "Cron Scheduling","Aktualisierung ber Cron"
8
+ "Daily automatic import","Automatischer Import (täglich)"
9
+ "Yes","Ja"
10
+ "No","Nein"
11
+ "Excellent","Sehr Gut"
12
+ "Good","Gut"
13
+ "Fair","Befriedigend"
14
+ "Poor","Ausreichend"
15
+ "Very Poor","Mangelhaft"
16
+ "Rewies import for time period %1$s to %2$s has been successfully completed.","Die Bewertungen im Zeitraum %1$s bis %2$s konnten erfolgreich importiert werden."
17
+ "Reached maximum (%1$s) reviews import for time periode %2$s to %3$s, please choose a smaller time period.","Die maximale Anzahl von API Anfragen wurde berschritten fr den gew„hlten Zeitraum %$1s bis %$2s. Bitte grenzen Sie den Zeitraum ein"
18
+ "%s Reviews has been created.","%s Bewertungen wurden neu importiert."
19
+ "%s Reviews has been updated.","%s Bewertungen wurden aktualisiert."
20
+ "TS Review Managemen store configuration error.","TS Review Management: Fehler der Store Konfiguration."
21
+ "Configuration","Konfiguration"
22
+ "Import Reviews","Bewertungen Importieren"
23
+ "Store","Store"
24
+ "Start Date","Import Startdatum"
25
+ "End Date","Import Enddatum"
26
+ "Import","Bewertungen importieren"
27
+ "No configuration available.","Kein Store konfiguriert."
28
+ "Other Reviews","Weitere Bewertungen"
29
+ "Reviews with reference","Bewertungen zu Shopbestellungen"
30
+ "Order","Bestellung"
31
+ "Order Date","Bestelldatum"
32
+ "Review Date","Datum der Bewertung"
33
+ "Mark","Mark"
34
+ "Overall Score","Gesamtbewertung"
35
+ "Cart Amount","Warenkorb"
36
+ "Criterion","Bewertungskategorie"
37
+ "Customer Review","Kundenbewertung"
38
+ "Delivery","Lieferung"
39
+ "Goods","Ware"
40
+ "Service","Service"
41
+ "Comment","Bewertung"
42
+ "Statement","Shopkommentar"
43
+ "Shop Statement","Shopkommentar"
44
+ "Shop Statement Date","Datum Shopkommentar"
45
+ "Order Reference","Bestellreferenz"
46
+ "Review","Bewertung"
47
+ "Review Details","Bewertungsdetails"
48
+ "UID","UID"
49
+ "Creation Date","Bewertungsdatum"
50
+ "Change Date","Letzte Änderung"
51
+ "Confirmation Date","Bestätigt am"
52
+ "Consumer Email","E-Mail Adresse"
53
+ "Shop","Shop"
54
+ "URL","URL"
55
+ "Name","Name"
56
+ "Language","Sprache"
57
+ "Target Market","Zielmarkt"
58
+ "Failed to load the review data.","Die Daten zu dieser Bewertung konnten nicht geladen werden."
59
+ "DELIVERY","LIEFERUNG"
60
+ "GOODS","WARE"
61
+ "SERVICE","SERVICE"
62
+ "Service Error: %1$s - %2$s","Service Error: %1$s - %2$s"
63
+ "Service Error: %1$s/%2$s - %3$s","Service Error: %1$s/%2$s - %3$s"
64
+ "Store Id: %1$s - %2$s","Store Id: %1$s - %2$s"
65
+ "TS_ID_INVALID","Die TS-ID ist ungültig"
66
+ "RESTRICTED_CONTENT_EXCLUDED","Der Server verweigert den Zugriff."
67
+ "TS_ID_NOT_FOUND","Die eingegebene TS-ID existiert nicht."
68
+ "BAD_REQUEST ERROR","Ungltige Anfrage. Bitte prfen Sie die angegebenen Parameter."
69
+ "FORBIDDEN","Zugriff verweigert"
70
+ "NOT_FOUND","Ungültige URL. Die angeforderte Resource existiert nicht."
71
+ "INTERNAL_SERVER_ERROR","Interner Server-Error"
72
+ "Delete Imported Store Reviews","Importierte Bewertungsdaten löschen"
73
+ "Delete","Löschen"
74
+ "The store reviews has been deleted.","Die Bewertungsdaten wurden gelöscht."
js/nrapps_tsreviewmanagement/script.js ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @category NRApps
3
+ * @package NRApps_TSReviewManagement
4
+ * @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
5
+ * @license http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf
6
+ * @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
7
+ * @author integer_net GmbH <info@integer-net.de>
8
+ * @author Viktor Franz <vf@integer-net.de>
9
+ */
10
+
11
+
12
+ var NRAppsTSReview_Management = Class.create();
13
+
14
+ NRAppsTSReview_Management.prototype = {
15
+
16
+ /**
17
+ *
18
+ */
19
+ initialize: function () {
20
+
21
+ window.setTimeout(this._removeMessage, 10000);
22
+
23
+ /**
24
+ *
25
+ */
26
+ Event.observe(window, 'load', function () {
27
+ var headers = $$('.content-header-floating');
28
+ if (headers.length) {
29
+ headers[0].remove();
30
+ }
31
+ });
32
+ },
33
+
34
+ /**
35
+ *
36
+ * @param grid
37
+ * @param event
38
+ */
39
+ unfoldToggle: function (grid, event) {
40
+
41
+ var row = Event.findElement(event, 'tr');
42
+ var actionUrl = row.title;
43
+
44
+ if (actionUrl) {
45
+ if (row.next() && row.next().hasClassName('sub-grid')) {
46
+ row.next().remove();
47
+ } else {
48
+
49
+ new Ajax.Request(actionUrl, {
50
+ onComplete: function (response) {
51
+
52
+ if (response.responseText) {
53
+
54
+ $$('tr.sub-grid').each(function (subGrid) {
55
+ subGrid.remove();
56
+ });
57
+
58
+ this._addRow(row, response.responseText);
59
+ }
60
+ }.bind(this)
61
+ });
62
+ }
63
+ }
64
+ },
65
+
66
+ /**
67
+ *
68
+ * @param sibling
69
+ * @param row
70
+ * @private
71
+ */
72
+ _addRow: function (sibling, row) {
73
+
74
+ row = '<div style="margin: 25px;" >' + row + '</div>';
75
+
76
+ var styleClasses = sibling.classNames();
77
+ styleClasses = styleClasses + ' sub-grid';
78
+
79
+ var td = new Element('td', {'colspan': 99, style: 'border-right: none;'}).update(row);
80
+ var tr = new Element('tr', {'class': styleClasses}).update(td);
81
+
82
+ sibling.insert({after: tr});
83
+ },
84
+
85
+ /**
86
+ *
87
+ * @private
88
+ */
89
+ _removeMessage: function () {
90
+ if ($('messages').hasChildNodes()) {
91
+ Effect.SlideUp('messages', { duration: 0.6 });
92
+ }
93
+ }
94
+ };
95
+
96
+ nrappstsreview_management = new NRAppsTSReview_Management();
97
+
98
+ /**
99
+ * @param grid
100
+ * @param event
101
+ */
102
+ row_click_callback = function (grid, event) {
103
+ if (['a', 'input', 'select', 'option'].indexOf(Event.element(event).tagName.toLowerCase()) != -1) {
104
+ return;
105
+ }
106
+
107
+ nrappstsreview_management.unfoldToggle(grid, event);
108
+ }
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>NRApps_TSReviewManagement</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.trustedshops.com/tsdocument/TS_EULA_en.pdf">Custom License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Trusted Shops review management Magento integration</summary>
10
+ <description>Trusted Shops review management Magento integration</description>
11
+ <notes>#productlove</notes>
12
+ <authors><author><name>nr-apps.com powered by integer_net GmbH</name><user>info</user><email>info@nr-apps.com</email></author></authors>
13
+ <date>2014-12-22</date>
14
+ <time>14:47:44</time>
15
+ <contents><target name="magecommunity"><dir name="NRApps"><dir name="TSReviewManagement"><dir name="Block"><dir name="Adminhtml"><dir name="Form"><file name="Container.php" hash="c721e5b277163e632c2eb0b245aea1b2"/><file name="Form.php" hash="4cc2a0628a91f1dbf1ccdedf192c6429"/></dir><dir name="Grid"><file name="Container.php" hash="39e38b23b58dda565a782c20f81b42e5"/><file name="GridForeign.php" hash="ec7c3bd0a344d8bdc2230119ad9c24cf"/><file name="GridOrder.php" hash="6ac4bbe68b9cf864339670220c850b11"/><file name="Tabs.php" hash="754000204867e1a421d44e3b546f89c5"/></dir><file name="Info.php" hash="e6a454196eef05d5ee2b5ccfbfdd2881"/><dir name="System"><dir name="Config"><file name="Delete.php" hash="1f97310fc9ad67d0562c6a86c4ac5ff3"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Line.php" hash="9639d7b5aa00ad0be60ee9ef84792684"/><file name="Mark.php" hash="adcfbee1fa6be931807434f9e49f18ac"/><file name="Order.php" hash="81b6dfc9705194da7c30e44006ff68df"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="990bb04b3ca5d3a27ed49dd9c1b6977e"/></dir><dir name="Model"><file name="Client.php" hash="71124067cb27706c78ecefb6f8f95217"/><file name="Config.php" hash="e034a1f8b3b8f5a64e6e8a4983eb7c6d"/><file name="ImportService.php" hash="de7231f11fb099f212bcb00944f23f4c"/><dir name="Resource"><dir name="Review"><file name="Collection.php" hash="2a7e412e06f8cfa4f429986f77903fa9"/></dir><file name="Review.php" hash="7c8306d04ae424bd59c87ee1ce261dfb"/><dir name="Shop"><file name="Collection.php" hash="38466d780d7f00070b23ce3997d571b5"/></dir><file name="Shop.php" hash="0f27279462fdb0c4d65c02936fbb5216"/></dir><file name="Response.php" hash="48c265638bacaecfe8b3fea70f5af414"/><file name="Review.php" hash="218621243120d665403af747e8c9cc79"/><file name="ScheduleService.php" hash="f49a9fa03ebcb382798473df52e1a815"/><file name="Shop.php" hash="c3f208a96ddffb8ae16820b9c15c3796"/><dir name="System"><file name="Store.php" hash="dc08f48bc738f15bf1bb537b9d0490d5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Nrappstsreviewmanagement"><file name="IndexController.php" hash="6fc9106de4d7a8eb8ea35eed22cd8ba7"/></dir></dir></dir><dir name="data"><dir name="nrapps_tsreviewmanagement_setup"><file name="data-install-1.0.0.php" hash="662d63e5063b6542de5551c20c0db990"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e8742bfcedb0ac8261977edc5de83449"/><file name="config.xml" hash="9719a2d179a3753fe800716763b21f7d"/><file name="system.xml" hash="0859b2025735193f1ed03f4adadc4d9f"/></dir><dir name="sql"><dir name="nrapps_tsreviewmanagement_setup"><file name="install-1.0.0.php" hash="f3b1d0ed19dc20c4e57a753249675997"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="nrapps_tsreviewmanagement"><file name="info.phtml" hash="db20ac42fa8c77f26496176e84c1e7da"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NRApps_TSReviewManagement.xml" hash="961aed9f904f0dcdb1eaf9aae49c0afa"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="NRApps_TSReviewManagement.csv" hash="6160ad6af825442441b48889a217b737"/></dir></target><target name="magelocal"><dir name="en_US"><file name="NRApps_TSReviewManagement.csv" hash=""/></dir></target><target name="mage"><dir name="js"><dir name="nrapps_tsreviewmanagement"><file name="script.js" hash="cf54a9b57a5e96afa46b713816c5ca27"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>5.5.99</max></php></required></dependencies>
18
+ </package>