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 ChatGPT with Laravel Application?

In this guide, we'll explore how to integrate ChatGPT, an AI-powered chatbot, with a Laravel…

1 day ago

What are Net Sales? How to Calculate Your Net Sales?

In the world of business, understanding financial metrics is crucial for making informed decisions and…

3 days ago

Magento 2 Extensions Digest April 2024 (New Release & Updates)

Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…

3 days ago

The ABCs of Geofencing: Definition, Features and Uses

In this era, businesses are always on the lookout for ways to engage with their…

4 days ago

How to Delete Product Variant in a Shopify Remix App using GraphQL Mutations?

Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…

5 days ago

6 Innovative Tools Revolutionizing E-Commerce Operations

E-commerce has transformed the way consumers shop for products and services and interact with businesses.…

1 week ago