DigitalPianism_ExportReview - Version 0.0.2

Version Notes

Stable version.

Download this release

Release Info

Developer Digital Pianism
Extension DigitalPianism_ExportReview
Version 0.0.2
Comparing to
See all releases


Version 0.0.2

app/code/community/DigitalPianism/ExportReview/Block/Review/Grid.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Grid to add the export button
4
+ */
5
+
6
+ class DigitalPianism_ExportReview_Block_Review_Grid extends Mage_Adminhtml_Block_Review_Grid
7
+ {
8
+ protected function _prepareColumns()
9
+ {
10
+
11
+ $statuses = Mage::getModel('review/review')
12
+ ->getStatusCollection()
13
+ ->load()
14
+ ->toOptionArray();
15
+
16
+ $tmpArr = array();
17
+ foreach( $statuses as $key => $status ) {
18
+ $tmpArr[$status['value']] = $status['label'];
19
+ }
20
+
21
+ $statuses = $tmpArr;
22
+
23
+ $this->addColumn('review_id', array(
24
+ 'header' => Mage::helper('review')->__('Review ID'),
25
+ 'align' => 'right',
26
+ 'width' => '50px',
27
+ 'filter_index' => 'rt.review_id',
28
+ 'index' => 'review_id',
29
+ ));
30
+
31
+ $this->addColumn('created_at', array(
32
+ 'header' => Mage::helper('review')->__('Created On'),
33
+ 'align' => 'left',
34
+ 'type' => 'datetime',
35
+ 'width' => '100px',
36
+ 'filter_index' => 'rt.review_created_at',
37
+ 'index' => 'review_created_at',
38
+ ));
39
+
40
+ if( !Mage::registry('usePendingFilter') ) {
41
+ $this->addColumn('status', array(
42
+ 'header' => Mage::helper('review')->__('Status'),
43
+ 'align' => 'left',
44
+ 'type' => 'options',
45
+ 'options' => $statuses,
46
+ 'width' => '100px',
47
+ 'filter_index' => 'rt.status_id',
48
+ 'index' => 'status_id',
49
+ ));
50
+ }
51
+
52
+ $this->addColumn('title', array(
53
+ 'header' => Mage::helper('review')->__('Title'),
54
+ 'align' => 'left',
55
+ 'width' => '100px',
56
+ 'filter_index' => 'rdt.title',
57
+ 'index' => 'title',
58
+ 'type' => 'text',
59
+ //'truncate' => 50, // We remove the truncate to display the entire review title
60
+ 'escape' => true,
61
+ ));
62
+
63
+ $this->addColumn('nickname', array(
64
+ 'header' => Mage::helper('review')->__('Nickname'),
65
+ 'align' => 'left',
66
+ 'width' => '100px',
67
+ 'filter_index' => 'rdt.nickname',
68
+ 'index' => 'nickname',
69
+ 'type' => 'text',
70
+ 'truncate' => 50,
71
+ 'escape' => true,
72
+ ));
73
+
74
+ $this->addColumn('detail', array(
75
+ 'header' => Mage::helper('review')->__('Review'),
76
+ 'align' => 'left',
77
+ 'index' => 'detail',
78
+ 'filter_index' => 'rdt.detail',
79
+ 'type' => 'text',
80
+ //'truncate' => 50, // We remove the truncate to display the entire review details
81
+ 'nl2br' => true,
82
+ 'escape' => true,
83
+ ));
84
+
85
+ /**
86
+ * Check is single store mode
87
+ */
88
+ if (!Mage::app()->isSingleStoreMode()) {
89
+ $this->addColumn('visible_in', array(
90
+ 'header' => Mage::helper('review')->__('Visible In'),
91
+ 'index' => 'stores',
92
+ 'type' => 'store',
93
+ 'store_view' => true,
94
+ ));
95
+ }
96
+
97
+ $this->addColumn('type', array(
98
+ 'header' => Mage::helper('review')->__('Type'),
99
+ 'type' => 'select',
100
+ 'index' => 'type',
101
+ 'filter' => 'adminhtml/review_grid_filter_type',
102
+ 'renderer' => 'adminhtml/review_grid_renderer_type'
103
+ ));
104
+
105
+ $this->addColumn('name', array(
106
+ 'header' => Mage::helper('review')->__('Product Name'),
107
+ 'align' =>'left',
108
+ 'type' => 'text',
109
+ 'index' => 'name',
110
+ 'escape' => true
111
+ ));
112
+
113
+ $this->addColumn('sku', array(
114
+ 'header' => Mage::helper('review')->__('Product SKU'),
115
+ 'align' => 'right',
116
+ 'type' => 'text',
117
+ 'width' => '50px',
118
+ 'index' => 'sku',
119
+ 'escape' => true
120
+ ));
121
+
122
+ $this->addColumn('action',
123
+ array(
124
+ 'header' => Mage::helper('adminhtml')->__('Action'),
125
+ 'width' => '50px',
126
+ 'type' => 'action',
127
+ 'getter' => 'getReviewId',
128
+ 'actions' => array(
129
+ array(
130
+ 'caption' => Mage::helper('adminhtml')->__('Edit'),
131
+ 'url' => array(
132
+ 'base'=>'*/catalog_product_review/edit',
133
+ 'params'=> array(
134
+ 'productId' => $this->getProductId(),
135
+ 'customerId' => $this->getCustomerId(),
136
+ 'ret' => ( Mage::registry('usePendingFilter') ) ? 'pending' : null
137
+ )
138
+ ),
139
+ 'field' => 'id'
140
+ )
141
+ ),
142
+ 'filter' => false,
143
+ 'sortable' => false
144
+ ));
145
+
146
+ $this->addRssList('rss/catalog/review', Mage::helper('catalog')->__('Pending Reviews RSS'));
147
+
148
+ /* Add CSV and Excel export */
149
+ $this->addExportType('*/*/exportCsv', Mage::helper('review')->__('CSV'));
150
+ $this->addExportType('*/*/exportExcel', Mage::helper('review')->__('Excel'));
151
+
152
+ // We don't call the Mage_Adminhtml_Block_Review_Grid function as it would rewrite our columns
153
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
154
+ }
155
+ }
app/code/community/DigitalPianism/ExportReview/controllers/Catalog/Product/ReviewController.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Controller to add the CSV and XML export for the reviews */
5
+
6
+ include_once("Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php");
7
+
8
+ class DigitalPianism_ExportReview_Catalog_Product_ReviewController extends Mage_Adminhtml_Catalog_Product_ReviewController
9
+ {
10
+ /**
11
+ * Export order grid to CSV format
12
+ */
13
+ public function exportCsvAction()
14
+ {
15
+ $fileName = 'reviews.csv';
16
+ $grid = $this->getLayout()->createBlock('adminhtml/review_grid');
17
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
18
+ }
19
+
20
+ /**
21
+ * Export order grid to Excel XML format
22
+ */
23
+ public function exportExcelAction()
24
+ {
25
+ $fileName = 'reviews.xml';
26
+ $grid = $this->getLayout()->createBlock('adminhtml/review_grid');
27
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
28
+ }
29
+ }
app/code/community/DigitalPianism/ExportReview/etc/config.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+
4
+ <modules>
5
+ <DigitalPianism_ExportReview>
6
+ <version>0.0.2</version>
7
+ </DigitalPianism_ExportReview>
8
+ </modules>
9
+
10
+ <global>
11
+ <blocks>
12
+ <adminhtml>
13
+ <rewrite>
14
+ <!-- Mage_Adminhtml_Block_Review_Grid -->
15
+ <review_grid>DigitalPianism_ExportReview_Block_Review_Grid</review_grid>
16
+ </rewrite>
17
+ </adminhtml>
18
+ </blocks>
19
+ </global>
20
+
21
+ <admin>
22
+ <routers>
23
+ <adminhtml>
24
+ <args>
25
+ <modules>
26
+ <DigitalPianism_ExportReview before="Mage_Adminhtml">DigitalPianism_ExportReview</DigitalPianism_ExportReview>
27
+ </modules>
28
+ </args>
29
+ </adminhtml>
30
+ </routers>
31
+ </admin>
32
+
33
+ </config>
app/etc/modules/DigitalPianism_ExportReview.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <DigitalPianism_ExportReview>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </DigitalPianism_ExportReview>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>DigitalPianism_ExportReview</name>
4
+ <version>0.0.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Export Reviews to CSV/Excel for Magento.</summary>
10
+ <description>This extension allows users to export customer reviews in both CSV / Excel types.</description>
11
+ <notes>Stable version.</notes>
12
+ <authors><author><name>Digital Pianism</name><user>raphaelpetrini</user><email>raphael.petrini@free.fr</email></author></authors>
13
+ <date>2014-04-27</date>
14
+ <time>14:38:06</time>
15
+ <contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="ExportReview"><dir name="Block"><dir name="Review"><file name="Grid.php" hash="6c8eb08a6f5da9c9de84619def3768b6"/></dir></dir><dir name="controllers"><dir name="Catalog"><dir name="Product"><file name="ReviewController.php" hash="f75c281bb0f27e7df669a57db5ee550b"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="7d941bfec8d5b6d62f0f7b796db3597b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DigitalPianism_ExportReview.xml" hash="4f5f0512a60878f5d25ffd2d12da2265"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>