I am trying to list all unique email id's (guest & customers) in admin grid to restrict specific email id to place order.
For that, I got an id's from customer collection and order collection.
But I need this in the single collection.
name | email
A | [email protected]
B | [email protected]
C | [email protected]
FYI:
/* \Magento\Customer\Model\CustomerFactory */
$customerCollection = $model->getCollection();
$customerCollection->getSelect()
->reset(\Zend_Db_Select::COLUMNS)
->columns(
[
'name' => "CONCAT(firstname, ' ', lastname)",
'email' => 'email'
]
);
/* \Magento\Sales\Model\OrderFactory */
$orderModel = $this->_orderFactory->create();
$orderCollection = $orderModel->getCollection();
$orderCollection->addAttributeToFilter('customer_is_guest', ['eq' => 1]);
$orderCollection->getSelect()
->reset(\Zend_Db_Select::COLUMNS)
->columns(
[
'name' => "CONCAT(customer_firstname, ' ', customer_lastname)",
'email' => 'customer_email'
]
);
Even I tried with preparing a new collection \Magento\Framework\Data\Collection
&& \Magento\Framework\DataObject
in this cases filter, page size, cur page not working.
After collecting those data need to list in admin grid.
Please suggest the possible way?
Thanks