1

I'm creating one grid which will have to below columns like SKU,Name and Color (Attribute)

So to achieve this We've to join color data to collection for that I've added _initSelect to collection class.

public function _initSelect()
    {
        parent::_initSelect();
         $select = $this->getSelect()->joinLeft(
            ['secondTable' => $this->getTable('catalog_product_entity_varchar')], //2nd table name by which you want to join
            'main_table.entity_id= secondTable.entity_id', 
            ['value']
        );


        return $select;
    }

I stuck here how can I join attribute label based on its value and render that column to grid ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.