0

class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider{ function getData(){ /** @var \Magento\Customer\Model\ResourceModel\Customer\Collection $collection */ $collection = $this->getCollection(); $collection->addNameToSelect() ->addFieldToFilter('group_id', ['in' => [1,7]]) ->addFieldToFilter('player_number', ['nin' => [null, '']]) ->addFieldToSelect('name') ->addAttributeToSelect(['player_number', 'player_nickname'], 'left') ->addAttributeToSelect(['team_id'], 'inner') ->getSelect()->joinLeft( 'sales_order_grid', 'sales_order_grid.customer_id=e.entity_id', 'customer_name' ); } }

  • message error : {"error":"The "customer_name" attribute name is invalid. Reset the name and try again.","errorcode":"0"}

  • 'e' is customer_entity.

1 Answer 1

0

There is no such attribute called customer_name in Magento 2. but you can fetch first_name, last_name instead.

3
  • 'customer_name' i find in table "sales_order_grid"
    – Hoi le
    Aug 30, 2020 at 6:31
  • Use sales_order_grid.customer_name there. Aug 30, 2020 at 15:51
  • thank you, I remove generated/* and It is working.
    – Hoi le
    Sep 2, 2020 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.