I want to display the products review below the product without Tab.
-
1please explain briefly or attach any screen shot for more idea– Ronak RathodCommented Jun 10, 2019 at 11:37
-
I think you want to show the reviews in the main content of the product view page. If yes, this might help you magento.stackexchange.com/questions/109703/…– Mohit Kumar AroraCommented Jun 10, 2019 at 13:09
-
No, It didn't work for me.– SIDDHANT JAINCommented Jun 10, 2019 at 13:29
Add a comment
|
1 Answer
Try following code
<?php
$productId = '323'; // Product ID
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create("Magento\Catalog\Model\Product")->load($productId);
$storeManager = $objectManager->get('Magento\Store\Model\StoreManagerInterface');
$currentStoreId = $storeManager->getStore()->getId();
$rating = $objectManager->get("Magento\Review\Model\ResourceModel\Review\CollectionFactory");
$collection = $rating->create()->addStoreFilter(
$currentStoreId
)->addStatusFilter(
\Magento\Review\Model\Review::STATUS_APPROVED
)->addEntityFilter(
'product',
$productId
)->setDateOrder();
print_r($collection->getData());
?>
You will get review data in $collection->getData(). you can display as per your requirement.
Please let me know still if you face issue.