Hello Magento Friends,

In today’s blog, we will learn about How to Display Star Rating into Magento 2 Admin Grid.

Star ratings serve as a visual representation of customer satisfaction and product quality. Integrating them into your admin grids allows you to quickly assess product performance, identify top-rated items, and make informed decisions regarding inventory management, marketing strategies, and more.

Let’s move to the steps for displaying star ratings in the Magento 2 admin grid.

Steps to Display Star Rating into Magento 2 Admin Grid:

Step 1: Create database schema at the following path

{{magento_root}}\app\code\Vendor\Extension\Setup\InstallSchema.php

Then add the code as follows 

Step 2: Create a routes.xml file at the below-mentioned path

{{magento_root}}\app\code\Vendor\Extension\etc\adminhtml\

And add the following piece of code

Step 3: Create a menu.xml file at the path mentioned below

{{magento_root}}\app\code\Vendor\Extension\etc\adminhtml\

After that, add the code as mentioned below

Step 4: Create a di.xml file at the path given below

{{magento_root}}\app\code\Vendor\Extension\etc\

Then add the following code snippet

Step 5: Create a Custom.php Model file at the following path

{{magento_root}}\app\code\Vendor\Extension\Model\

And include the below-given code

Step 6: Create a Custom.php ResourceModel file at the following path

{{magento_root}}\app\code\Vendor\Extension\Model\ResourceModel\

Then add the code as follows

Step 7: Create a Collection.php file at the following path

{{magento_root}}\app\code\Vendor\Extension\Model\ResourceModel\Custom\

Now, include the code as follows

Step 8: Create a DataProvider.php file

{{magento_root}}\app\code\Vendor\Extension\Model\

And include the following piece of code

Step 9: Create an Index.php file in the Controller as the path given below

{{magento_root}}\app\code\Vendor\Extension\Controller\Adminhtml\Index\

Now include the following code

Step 10: Create an Add.php file at the below-mentioned path

{{magento_root}}\app\code\Vendor\Extension\Controller\Adminhtml\Index\

Add the code as follows

Step 11: In the layout folder, we will be adding a UI component grid and form in our demo project. Create a uiexample_index_index.xml file at the following path

{{magento_root}}\app\code\Vendor\Extension\view\adminhtml\layout\

Now include the below-mentioned code

Step 12: Create an uiexample_index_add.xml file at the following path

{{magento_root}}\app\code\Vendor\Extension\view\adminhtml\layout\

Now add the following code

Step 13: In the ui_component folder, produce the UI Grid and Form file. Create  custom_grid_listing.xml file at the path given below

{{magento_root}}\app\code\Vendor\Extension\view\adminhtml\ui_component\

Then add the code as follows

Step 14: Create a file in the given below path

{{magento_root}}\app\code\Vendor\Extension\Ui\Component\Listing\Columns\Rating.php

Then add the following code snippet

Step 15: Create a file in the path given below

{{magento_root}}\app\code\Vendor\Extension\view\adminhtml\web\template\rating.html

Now include the following code

Step 16: Create an uiexample_form.xml UI grid file at the following path

{{magento_root}}\app\code\Vendor\Extension\view\adminhtml\ui_component\

Then include the following piece of code

Step 17: Create a Save.php file at the following path

{{magento_root}}\app\code\Vendor\Extension\Block\Adminhtml\Edit\

Now include the below-mentioned piece of code

Step 18: Create a Save.php file at the following path

{{magento_root}}\app\code\Vendor\Extension\Controller\Adminhtml\Index\

And insert the code given below

 

Output:

Display Star Rating into Magento 2 Admin Grid

Conclusion:

By following these steps, you can seamlessly integrate star ratings into your Magento 2 admin grids, empowering you to make data-driven decisions and enhance the efficiency of your store management processes. Whether you’re analyzing product performance, identifying trends, or optimizing your inventory, star ratings provide valuable insights that can drive success in your e-commerce venture.

Learn,

Ready to elevate your Magento 2 admin interface with star ratings? Implement these steps and unlock the power of visual data representation in your store management workflow.

Happy Coding!

Click to rate this post!
[Total: 1 Average: 5]