Collection.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * Customer Grid Collection
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Sales\Model\ResourceModel\Order\Customer;
  9. class Collection extends \Magento\Customer\Model\ResourceModel\Customer\Collection
  10. {
  11. /**
  12. * @return $this
  13. */
  14. protected function _initSelect()
  15. {
  16. parent::_initSelect();
  17. $this->addNameToSelect()->addAttributeToSelect(
  18. 'email'
  19. )->addAttributeToSelect(
  20. 'created_at'
  21. )->joinAttribute(
  22. 'billing_postcode',
  23. 'customer_address/postcode',
  24. 'default_billing',
  25. null,
  26. 'left'
  27. )->joinAttribute(
  28. 'billing_city',
  29. 'customer_address/city',
  30. 'default_billing',
  31. null,
  32. 'left'
  33. )->joinAttribute(
  34. 'billing_telephone',
  35. 'customer_address/telephone',
  36. 'default_billing',
  37. null,
  38. 'left'
  39. )->joinAttribute(
  40. 'billing_regione',
  41. 'customer_address/region',
  42. 'default_billing',
  43. null,
  44. 'left'
  45. )->joinAttribute(
  46. 'billing_country_id',
  47. 'customer_address/country_id',
  48. 'default_billing',
  49. null,
  50. 'left'
  51. )->joinField(
  52. 'store_name',
  53. 'store',
  54. 'name',
  55. 'store_id=store_id',
  56. null,
  57. 'left'
  58. )->joinField(
  59. 'website_name',
  60. 'store_website',
  61. 'name',
  62. 'website_id=website_id',
  63. null,
  64. 'left'
  65. );
  66. return $this;
  67. }
  68. }