product name not displaying in custom admin grid in magento2I created a custom module ,but getting error, not...

Where is this triangular-shaped space station from?

How to deny access to SQL Server to certain login over SSMS, but allow over .Net SqlClient Data Provider

Does music exist in Panem? And if so, what kinds of music?

Can you use a beast's innate abilities while polymorphed?

What is this waxed root vegetable?

Make me a metasequence

Contradiction with Banach Fixed Point Theorem

Reason Why Dimensional Travelling Would be Restricted

A "strange" unit radio astronomy

Difference between 小吃 and 零食

chrony vs. systemd-timesyncd – What are the differences and use cases as NTP clients?

What am I? I am in theaters and computer programs

Is there any relevance to Thor getting his hair cut other than comedic value?

Non-Italian European mafias in USA?

How can atoms be electrically neutral when there is a difference in the positions of the charges?

What is the wife of a henpecked husband called?

Logistics of a hovering watercraft in a fantasy setting

Use comma instead of & in table

Is there a low-level alternative to Animate Objects?

Borrowing Characters

Is there a frame of reference in which I was born before I was conceived?

I am on the US no-fly list. What can I do in order to be allowed on flights which go through US airspace?

What is the difference between throw e and throw new Exception(e)?

As a new poet, where can I find help from a professional to judge my work?



product name not displaying in custom admin grid in magento2


I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Why Getting categories and names on product view page Magento 2 fails?Magento 2.1 Create a filter in the product grid by new attributeUncaught Error: Call to a member function setItem() on boolean on product grid: Magento 2I have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridMagento 2: Add a product to the cart programmaticallyMagento 2 Create dynamic array From different Model Collection to use in multi select in gridI have created one field using product form field for my price i want save my field value at product creation time from backend magento2Magento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2 Create new “Catalog Input Type for Store Owner” Attribute













0















hello everyone I want to display the product name in custom admin grid code is below
info.php



$fieldset->addField(
'entity_id',
'text',
[
'name' => 'product name',
'label' => __('product name'),
'renderer' => 'MagnetoBookFreeLayoutBlockAdminhtmlExtensionGridRendererProductname',
'required' => true,

]
);


productname.php



<?php
namespace
MagnetoBookFreeLayoutBlockAdminhtmlExtensionGridRenderer;
use MagentoCatalogApiProductRepositoryInterface;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoFrameworkViewElementUiComponentFactory;
use MagentoUiComponentListingColumnsColumn;
class Productname extends Column
{
protected $_ProductRepository;
public function __construct(
ContextInterface $context,
UiComponentFactory $uiComponentFactory,
ProductRepositoryInterface $ProductRepository,
array $components = [],
array $data = [])
{
$this->_ProductRepository = $ProductRepository;
parent::__construct($context, $uiComponentFactory, $components,
$data);
}
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as $key => $items) {
$product = $this->_ProductRepository-
>getById($items["entity_id"]);
$dataSource['data']['items'][$key]['entity_id'] = $product-
>getName(); //to get product name
}
}
return $dataSource;
}
}


I have written this code but entity id is displaying entity id is the foreign key









share



























    0















    hello everyone I want to display the product name in custom admin grid code is below
    info.php



    $fieldset->addField(
    'entity_id',
    'text',
    [
    'name' => 'product name',
    'label' => __('product name'),
    'renderer' => 'MagnetoBookFreeLayoutBlockAdminhtmlExtensionGridRendererProductname',
    'required' => true,

    ]
    );


    productname.php



    <?php
    namespace
    MagnetoBookFreeLayoutBlockAdminhtmlExtensionGridRenderer;
    use MagentoCatalogApiProductRepositoryInterface;
    use MagentoFrameworkViewElementUiComponentContextInterface;
    use MagentoFrameworkViewElementUiComponentFactory;
    use MagentoUiComponentListingColumnsColumn;
    class Productname extends Column
    {
    protected $_ProductRepository;
    public function __construct(
    ContextInterface $context,
    UiComponentFactory $uiComponentFactory,
    ProductRepositoryInterface $ProductRepository,
    array $components = [],
    array $data = [])
    {
    $this->_ProductRepository = $ProductRepository;
    parent::__construct($context, $uiComponentFactory, $components,
    $data);
    }
    public function prepareDataSource(array $dataSource)
    {
    if (isset($dataSource['data']['items'])) {
    foreach ($dataSource['data']['items'] as $key => $items) {
    $product = $this->_ProductRepository-
    >getById($items["entity_id"]);
    $dataSource['data']['items'][$key]['entity_id'] = $product-
    >getName(); //to get product name
    }
    }
    return $dataSource;
    }
    }


    I have written this code but entity id is displaying entity id is the foreign key









    share

























      0












      0








      0








      hello everyone I want to display the product name in custom admin grid code is below
      info.php



      $fieldset->addField(
      'entity_id',
      'text',
      [
      'name' => 'product name',
      'label' => __('product name'),
      'renderer' => 'MagnetoBookFreeLayoutBlockAdminhtmlExtensionGridRendererProductname',
      'required' => true,

      ]
      );


      productname.php



      <?php
      namespace
      MagnetoBookFreeLayoutBlockAdminhtmlExtensionGridRenderer;
      use MagentoCatalogApiProductRepositoryInterface;
      use MagentoFrameworkViewElementUiComponentContextInterface;
      use MagentoFrameworkViewElementUiComponentFactory;
      use MagentoUiComponentListingColumnsColumn;
      class Productname extends Column
      {
      protected $_ProductRepository;
      public function __construct(
      ContextInterface $context,
      UiComponentFactory $uiComponentFactory,
      ProductRepositoryInterface $ProductRepository,
      array $components = [],
      array $data = [])
      {
      $this->_ProductRepository = $ProductRepository;
      parent::__construct($context, $uiComponentFactory, $components,
      $data);
      }
      public function prepareDataSource(array $dataSource)
      {
      if (isset($dataSource['data']['items'])) {
      foreach ($dataSource['data']['items'] as $key => $items) {
      $product = $this->_ProductRepository-
      >getById($items["entity_id"]);
      $dataSource['data']['items'][$key]['entity_id'] = $product-
      >getName(); //to get product name
      }
      }
      return $dataSource;
      }
      }


      I have written this code but entity id is displaying entity id is the foreign key









      share














      hello everyone I want to display the product name in custom admin grid code is below
      info.php



      $fieldset->addField(
      'entity_id',
      'text',
      [
      'name' => 'product name',
      'label' => __('product name'),
      'renderer' => 'MagnetoBookFreeLayoutBlockAdminhtmlExtensionGridRendererProductname',
      'required' => true,

      ]
      );


      productname.php



      <?php
      namespace
      MagnetoBookFreeLayoutBlockAdminhtmlExtensionGridRenderer;
      use MagentoCatalogApiProductRepositoryInterface;
      use MagentoFrameworkViewElementUiComponentContextInterface;
      use MagentoFrameworkViewElementUiComponentFactory;
      use MagentoUiComponentListingColumnsColumn;
      class Productname extends Column
      {
      protected $_ProductRepository;
      public function __construct(
      ContextInterface $context,
      UiComponentFactory $uiComponentFactory,
      ProductRepositoryInterface $ProductRepository,
      array $components = [],
      array $data = [])
      {
      $this->_ProductRepository = $ProductRepository;
      parent::__construct($context, $uiComponentFactory, $components,
      $data);
      }
      public function prepareDataSource(array $dataSource)
      {
      if (isset($dataSource['data']['items'])) {
      foreach ($dataSource['data']['items'] as $key => $items) {
      $product = $this->_ProductRepository-
      >getById($items["entity_id"]);
      $dataSource['data']['items'][$key]['entity_id'] = $product-
      >getName(); //to get product name
      }
      }
      return $dataSource;
      }
      }


      I have written this code but entity id is displaying entity id is the foreign key







      magento2





      share












      share










      share



      share










      asked 28 secs ago









      Ashish RamchandaniAshish Ramchandani

      17210




      17210






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f264379%2fproduct-name-not-displaying-in-custom-admin-grid-in-magento2%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f264379%2fproduct-name-not-displaying-in-custom-admin-grid-in-magento2%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...