Question

I have created custom table and display the values as grid in admin by UI component.In my custom table already I have SKU column .now I need attribute set id Name of the product in custom grid .how to get attribute setid by joining in collection.what are the tables needs to be joined to get attribute set_id name ?

Was it helpful?

Solution

In your Collection.php which you are using for the Grid add below function code

protected function _initSelect()
{
    parent::_initSelect();

    $this->getSelect()
        ->columns('eas.attribute_set_name')
        ->join(
            ['cpe' => $this->getTable('catalog_product_entity')],
            'main_table.sku = cpe.sku',
            []
        )->join(
            ['eas' => $this->getTable('eav_attribute_set')],
            'cpe.attribute_set_id = eas.attribute_set_id',
            []
        );
}

OTHER TIPS

Not sure to really understand your issue. To give you a strict answer the attribute set is stored in the table eav_attribute_set where you can find the columns attribute_set_id and attribute_set_name

Now if what you try to do is add that value into a grid, we need more information and code about what you've done.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top