I have a custom table which contains product id, I want to add an extra attribute column. so how can I get dropdown attribute value of the product in my custom table? if the dropdown attribute is not selected the data will be display as blank.
namespace Demo\Test\Model\ResourceModel\Grid;
class Collection extends SearchResult
{
/**
* Initialize dependencies.
*
* @param EntityFactory $entityFactory
* @param Logger $logger
* @param FetchStrategy $fetchStrategy
* @param EventManager $eventManager
* @param string $mainTable
* @param string $resourceModel
*/
public function __construct(
EntityFactory $entityFactory,
Logger $logger,
FetchStrategy $fetchStrategy,
EventManager $eventManager,
$mainTable = 'custom_table',
$resourceModel = \Demo\Test\Model\ResourceModel\Load::class
) {
parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);
}
protected function _initSelect()
{
$this->getSelect()->from(['main_table' => $this->getMainTable()]);
return $this;
}
}