cancel
Showing results for 
Search instead for 
Did you mean: 

How to show product category in admin grid

SOLVED

How to show product category in admin grid

I have a grid in admin where I am showing orders based on some filters,
I want to show the  category of ordered item in one of the column ,How can I do that?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to show product category in admin grid

Hello ,

I have resolved this by joining grid collection  with  table 

catalog_category_entity_varchar
  $categoryNameTable=$collection->getTable('catalog_category_entity_varchar');

 $collection->getSelect()->join(
            array('category_name'=>$categoryNameTable),
            '`category_product`.category_id = category_name.row_id AND category_name.attribute_id=45',
            ['catalog' => 'GROUP_CONCAT(DISTINCT category_name.value)']);

Thank you.

 

 

View solution in original post

1 REPLY 1

Re: How to show product category in admin grid

Hello ,

I have resolved this by joining grid collection  with  table 

catalog_category_entity_varchar
  $categoryNameTable=$collection->getTable('catalog_category_entity_varchar');

 $collection->getSelect()->join(
            array('category_name'=>$categoryNameTable),
            '`category_product`.category_id = category_name.row_id AND category_name.attribute_id=45',
            ['catalog' => 'GROUP_CONCAT(DISTINCT category_name.value)']);

Thank you.