@@ -78,50 +78,13 @@ protected function _joinCustomers()
78
78
{
79
79
/** @var $adapter \Magento\Framework\DB\Adapter\AdapterInterface */
80
80
$ adapter = $ this ->getConnection ();
81
- /** @var $firstnameAttr \Magento\Eav\Model\Entity\Attribute */
82
- $ firstnameAttr = $ this ->_customerResource ->getAttribute ('firstname ' );
83
- /** @var $lastnameAttr \Magento\Eav\Model\Entity\Attribute */
84
- $ lastnameAttr = $ this ->_customerResource ->getAttribute ('lastname ' );
85
-
86
- $ firstnameCondition = ['table_customer_firstname.entity_id = detail.customer_id ' ];
87
-
88
- if ($ firstnameAttr ->getBackend ()->isStatic ()) {
89
- $ firstnameField = 'firstname ' ;
90
- } else {
91
- $ firstnameField = 'value ' ;
92
- $ firstnameCondition [] = $ adapter ->quoteInto (
93
- 'table_customer_firstname.attribute_id = ? ' ,
94
- (int )$ firstnameAttr ->getAttributeId ()
95
- );
96
- }
97
-
98
- $ this ->getSelect ()->joinInner (
99
- ['table_customer_firstname ' => $ firstnameAttr ->getBackend ()->getTable ()],
100
- implode (' AND ' , $ firstnameCondition ),
101
- []
102
- );
103
-
104
- $ lastnameCondition = ['table_customer_lastname.entity_id = detail.customer_id ' ];
105
- if ($ lastnameAttr ->getBackend ()->isStatic ()) {
106
- $ lastnameField = 'lastname ' ;
107
- } else {
108
- $ lastnameField = 'value ' ;
109
- $ lastnameCondition [] = $ adapter ->quoteInto (
110
- 'table_customer_lastname.attribute_id = ? ' ,
111
- (int )$ lastnameAttr ->getAttributeId ()
112
- );
113
- }
114
-
115
81
//Prepare fullname field result
116
- $ customerFullname = $ adapter ->getConcatSql (
117
- ["table_customer_firstname. {$ firstnameField }" , "table_customer_lastname. {$ lastnameField }" ],
118
- ' '
119
- );
82
+ $ customerFullname = $ adapter ->getConcatSql (['customer.firstname ' , 'customer.lastname ' ], ' ' );
120
83
$ this ->getSelect ()->reset (
121
84
\Zend_Db_Select::COLUMNS
122
85
)->joinInner (
123
- ['table_customer_lastname ' => $ lastnameAttr -> getBackend ()-> getTable ( )],
124
- implode ( ' AND ' , $ lastnameCondition ) ,
86
+ ['customer ' => $ adapter -> getTableName ( ' customer_entity ' )],
87
+ ' customer.entity_id = detail.customer_id ' ,
125
88
[]
126
89
)->columns (
127
90
[
0 commit comments