I've created a custom grid using Ui Component, In my custom table I have a product_id, So instead of showing the product_id, I like to show the product name in my grid so that I have added the below code into my collection class.

protected function _initSelect()
            array('cpev' => $this->getTable('catalog_product_entity_varchar')),
            'main_table.product_id = cpev.entity_id and cpev.attribute_id=84',
        $this->getSelect()->order('main_table.id desc');
        return $this;

Then in my Ui component XML file, I added the product_name column as like follow

<column name="product_name">
        <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="sortOrder" xsi:type="number">150</item>
                    <item name="label" xsi:type="string" translate="true">Product Name</item>

Now in the grid, the product name is showing, but when I filter the product name I got the below log in exception.log file

Column not found: 1054 Unknown column 'product_name' in 'where clause', query was: SELECT COUNT(*) FROM `product_qa` AS `main_table`
 LEFT JOIN `catalog_product_entity_varchar` AS `cpev` ON main_table.product_id = cpev.entity_id and cpev.attribute_id=84 WHERE (`product_name` LIKE '%mi%')

The problem is the product_name columns is not exist in my customizable, So I want some input to accomplish the filter in my custom grid using the product name columns.

Thanks in advance for your better support.

  • are you got any solution?
    – mohan
    Sep 27, 2020 at 6:19


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.