Join from custom table to customer_entity table and get all data customer in Magento 2

magento.stackexchange https://magento.stackexchange.com/questions/277545

  •  03-03-2021
  •  | 
  •  

سؤال

I used this code but it not working. Please help me!

$customerEntity = $locationList->getTable('customer_entity');

$locationList = $this->mpSellerMapLocatorModel->getCollection();
$locationList->getSelect()->join(
            $customerEntity.' as cpev',
            'main_table.seller_id = cpev.entity_id',
            ['firstname','lastname']
        );
هل كانت مفيدة؟

المحلول

Try below solution:

    $locationList->getSelect()
    ->join(array('cpev' => 'customer_entity'), 
    'cpev.entity_id=main_table.seller_id', 
array('firstname' => 'firstname', 'lastname' => 'lastname'));

Also donot call the collection using model class using $locationList = $this->mpSellerMapLocatorModel->getCollection();

Use Collection Class means {VendorName}/{ModuleName}/Model/ResourceModel/{Entity}/Collection

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top