example: i have a table "table_1" i want to join product collection to get the product data? but I don't know how to join product collection? so everybody can help me pls?

  • List item

有帮助吗?

解决方案

Found this one, you can try it (this is untested):

$objectManager =  \Magento\Framework\App\ObjectManager::getInstance();
$collection = $objectManager->get('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory')->getCollection();
$collection->getSelect()->join( array('custom_table'=> 'table_1'), 'custom_table.id = main_table.entity_id', array('custom_table.sku'));   
许可以下: CC-BY-SA归因
scroll top