Categories: General

How to display product name instead of product id in Magento admin grid

Every business has its own need and to fulfill that Magento let the store owner integrates different extension or to customize their store as per their requirements. The main aim behind customizing Magento is to empower your store with the unique functionality that saves your tons of time and efforts to manage the store. Being a Magento developer, we always try our best to minimize the efforts of the store owner and serve enhanced store shopping experience to their customers with minimal efforts and save their tons of time in the long run.

Magento offers backend admin grid to Manage products and other backend services by using various columns that display detailed information like customer id, order name, and other details. But it becomes more difficult to identify the product from product id when there are thousands of products are in a store. Recently, while working with Magento backend Grid we came out with a requirement to display product name instead of product id column. After spending some time on coding, we pop out with a code that we would likely to share with you.

Firstly, you need to add your column in ‘Grid.php’ file available on the following location.
Vendor\Extension\adminhtml\Extension\Grid.php

 
Your Column name
 $this->addColumn('order_items', array(
            'header' => Mage::helper('extension')->__('Product Name'),
            'align' => 'left',
            'index' => 'order_items',
            'renderer'=>'Vendor_Extension_Block_Adminhtml_Extension_Renderer_Productname'
        ));

Once you are done you need to render that file in ‘Productname.php’ that is available on below path.
Vendor\Extension\Block\Adminhtml\Extension\Renderer


You can even customize this code as per your need to display product name in Magento admin grid.
Lastly, don’t forget to smash that down stars and comment down below if you face any issue while implementing this code.
Happy Coding.
Click to rate this post!
[Total: 6 Average: 4]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate ?️ Certified Magento Developer?‍?. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.?

Recent Posts

How to Integrate and Use MongoDB with Laravel?

MongoDB is a popular NoSQL database that offers flexibility and scalability when handling modern web…

10 hours ago

NodeJS | Callback Function

In NodeJS, callbacks empower developers to execute asynchronous operations like reading files, handling requests, and…

1 day ago

How to Show SKU in Order Summary in Magento 2?

Hello Magento Friends, In today’s blog, we will learn How to Show SKU in Order…

3 days ago

Best Colors to Use for CTA Buttons

The "Buy Now" and "Add to Cart" buttons serve as the primary call-to-action (CTA) elements…

5 days ago

Magento 2: How to Save Custom Field Value to quote_address for Multi-Shipping Orders

Hello Magento Friends, In Magento 2, the checkout process allows customers to choose multiple shipping…

6 days ago

Best Beginners Guide to Shopify Balance Account

If you are a Shopify admin, using a Shopify Balance Account for your business revenue…

6 days ago