@@ -116,10 +116,11 @@ public function addSubtotal($storeIds = '', $filter = null)
116
116
public function resolveCustomerNames ()
117
117
{
118
118
$ select = $ this ->customerResource ->getReadConnection ()->select ();
119
- $ customerName = $ select ->getAdapter ()->getConcatSql (['cust_fname.value ' , 'cust_lname.value ' ], ' ' );
119
+ $ customerName = $ select ->getAdapter ()->getConcatSql (['firstname ' , 'lastname ' ], ' ' );
120
120
121
121
$ select ->from (
122
- ['customer ' => $ this ->customerResource ->getTable ('customer_entity ' )]
122
+ ['customer ' => $ this ->customerResource ->getTable ('customer_entity ' )],
123
+ ['email ' ]
123
124
)->columns (
124
125
['customer_name ' => $ customerName ]
125
126
)->where (
@@ -129,41 +130,11 @@ public function resolveCustomerNames()
129
130
'customer_id '
130
131
)
131
132
);
132
- $ customersData = $ select ->getAdapter ()->fetchAll ($ this -> getCustomerNames ( $ select) );
133
+ $ customersData = $ select ->getAdapter ()->fetchAll ($ select );
133
134
134
135
foreach ($ this ->getItems () as $ item ) {
135
136
$ item ->setData (array_merge ($ item ->getData (), current ($ customersData )));
136
137
next ($ customersData );
137
138
}
138
139
}
139
-
140
- /**
141
- * @param \Magento\Framework\DB\Select $select
142
- * @return \Magento\Framework\DB\Select
143
- */
144
- protected function getCustomerNames ($ select )
145
- {
146
- $ attrFirstname = $ this ->customerResource ->getAttribute ('firstname ' );
147
- $ attrFirstnameId = (int )$ attrFirstname ->getAttributeId ();
148
- $ attrFirstnameTableName = $ attrFirstname ->getBackend ()->getTable ();
149
- $ attrLastname = $ this ->customerResource ->getAttribute ('lastname ' );
150
- $ attrLastnameId = (int )$ attrLastname ->getAttributeId ();
151
- $ attrLastnameTableName = $ attrLastname ->getBackend ()->getTable ();
152
- $ select ->joinInner (
153
- ['cust_fname ' => $ attrFirstnameTableName ],
154
- 'customer.entity_id = cust_fname.entity_id ' ,
155
- ['firstname ' => 'cust_fname.value ' ]
156
- )->joinInner (
157
- ['cust_lname ' => $ attrLastnameTableName ],
158
- 'customer.entity_id = cust_lname.entity_id ' ,
159
- ['lastname ' => 'cust_lname.value ' ]
160
- )->where (
161
- 'cust_fname.attribute_id = ? ' ,
162
- (int )$ attrFirstnameId
163
- )->where (
164
- 'cust_lname.attribute_id = ? ' ,
165
- (int )$ attrLastnameId
166
- );
167
- return $ select ;
168
- }
169
140
}
0 commit comments