-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathProductReview.php
More file actions
69 lines (63 loc) · 2.57 KB
/
ProductReview.php
File metadata and controls
69 lines (63 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
ini_set('display_startup_errors', 1);ini_set('display_errors', 1); error_reporting(-1);
//// Setup Base
$folder = 'magento2'; //Folder Name
$file = $folder ? dirname(__FILE__) . "/$folder/app/bootstrap.php" : "app/bootstrap.php";
$file = str_replace('.com/', '.coms/', $file);
$file = str_replace('/public_html/', '/magento2/', $file);
if(!file_exists ($file)) $file = "app/bootstrap.php";
if(file_exists ($file)){
require $file;
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
} else {die('Not found bootstrap.php');}
class reviewProduct extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$this->getReviewCollection();
//the method must end with this line
return $this->_response;
}
public function getReviewCollection()
{
$collections = $this->_objectManager->create('\Magento\Review\Model\ResourceModel\Review\Collection');
$reviewProduct = $collections->addFieldToSelect('*')
->setPageSize(10) // only get 10 reviews
->setCurPage(1)
->setOrder('review_id', 'ASC');
?>
<table>
<thead align="left" style="display: table-header-group">
<tr>
<th>review_id</th>
<th>entity_pk_value(Product ID)</th>
<th>title</th>
<th>detail</th>
<th>nickname</th>
<th>customer_id</th>
</tr>
</thead>
<tbody>
<?php foreach ($reviewProduct as $review) : ?>
<?php
echo '<pre>';
// var_dump($review->toArray());
echo '</pre>';
?>
<tr class="item_row">
<td> <?php echo $review->getData('review_id'); ?> </td>
<td> <?php echo $review->getData('entity_pk_value'); ?> </td>
<td> <?php echo $review->getData('title'); ?> </td>
<td> <?php echo $review->getData('detail'); ?> </td>
<td> <?php echo $review->getData('nickname'); ?></td>
<td> <?php echo $review->getData('customer_id'); ?> </td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('reviewProduct');
$bootstrap->run($app);