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]


/* \Magento\Customer\Model\CustomerFactory */
$customerCollection = $model->getCollection();
        'name' => "CONCAT(firstname, ' ', lastname)",
        'email' => 'email'

/* \Magento\Sales\Model\OrderFactory */
$orderModel = $this->_orderFactory->create();
$orderCollection = $orderModel->getCollection();
$orderCollection->addAttributeToFilter('customer_is_guest', ['eq' => 1]);
          '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?


  • you want a merge collection base of customer entity and another is ordered table?
    – Amit Bera
    Oct 5, 2018 at 10:31
  • why you want this , Can you please explain your purpose?
    – Amit Bera
    Oct 5, 2018 at 10:32
  • @AmitBera yes, i want just name, email for all guest and customer. some cases I need to restrict order placement for a specific customer and some fake mail ids. Note: here using offline payment
    – Sathish
    Oct 5, 2018 at 10:46
  • @AmitBera any updates
    – Sathish
    Oct 5, 2018 at 11:47

1 Answer 1


First, you don't have any idea on two different type of collection join.

So far my understanding, you can follow below also as an alternative solution.

Make two collections and filter those collections using email of current quote or order email

  • I have an idea, main problem union not working as expected in the collection. Make two collections and filter those collections using email of current quote or order email - i guess you didn't get my point.
    – Sathish
    Oct 5, 2018 at 14:40
  • Why you need a large collection without page size and limit , and it make page slow
    – Amit Bera
    Oct 5, 2018 at 15:20
  • Are you talk abount CONCAT(customer_firstname, ' ', customer_lastname)?
    – Amit Bera
    Oct 5, 2018 at 15:22
  • no, finally go with different solutions (creating a new model to store emails which needs to block from order placement). thanks amit
    – Sathish
    Oct 8, 2018 at 9:32

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.