How to get single record from collection in Magento 2

Posted at: September 21, 2018 5:05 PM

Create View.php Controller Action

Rsgitech\News\Controller\Index\View.php

Create ViewNews.php Block

Rsgitech\News\Block\ViewNews.php

Create news_index_view.xml Layout

Rsgitech\News\view\frontend\layout\news_index_view.xml

Create Template view.phtml File

Rsgitech\News\view\frontend\templates\view.phtml

Then run below commands


Complete!!

Speed Up Your Magento Store by 300%

Download source code: Download

You can watch video on How to get single record from collection in Magento 2


Fetch Single Record Collection

Please leave comments

1 Comments

truecodex launched free android app. You can download and install truecodex app on your mobile and get notification of the latest post.

Video Tutorials on YouTube