Skip to content

Commit 9cd1547

Browse files
author
Michael Logvin
committed
Merge branch 'MAGETWO-28011' of github.corp.ebay.com:magento-firedrakes/magento2ce into MAGETWO-28011
2 parents 791b2aa + 8b4d40b commit 9cd1547

File tree

2 files changed

+12
-32
lines changed

2 files changed

+12
-32
lines changed

app/code/Magento/Log/Model/Resource/Visitor/Collection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac
8181
* @var array
8282
*/
8383
protected $_fieldMap = [
84-
'customer_firstname' => 'customer_firstname_table.value',
85-
'customer_lastname' => 'customer_lastname_table.value',
84+
'customer_firstname' => 'customer_email_table.firstname',
85+
'customer_lastname' => 'customer_email_table.lastname',
8686
'customer_email' => 'customer_email_table.email',
8787
'customer_id' => 'customer_table.customer_id',
8888
'url' => 'url_info_table.url',

app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -65,39 +65,19 @@ public function addCustomerData()
6565
{
6666
// alias => attribute_code
6767
$attributes = [
68-
'customer_lastname' => 'lastname',
69-
'customer_firstname' => 'firstname',
70-
'customer_email' => 'email',
68+
'customer_lastname' => 'customer.lastname',
69+
'customer_firstname' => 'customer.firstname',
70+
'customer_email' => 'customer.email',
7171
];
7272

73-
foreach ($attributes as $alias => $attributeCode) {
74-
$attribute = $this->_eavHelper->getAttributeMetadata(
75-
\Magento\Customer\Api\CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
76-
$attributeCode
77-
);
73+
$this->getSelect()->joinLeft(
74+
['customer' => $this->getConnection()->getTableName('customer_entity')],
75+
'customer.entity_id=main_table.customer_id',
76+
$attributes
77+
);
7878

79-
$tableAlias = 'customer_' . $attributeCode;
79+
$this->_fields = array_merge($this->_fields, $attributes);
8080

81-
if ($attribute['backend_type'] == 'static') {
82-
$this->getSelect()->joinLeft(
83-
[$tableAlias => $attribute['attribute_table']],
84-
sprintf('%s.entity_id=main_table.customer_id', $tableAlias),
85-
[$alias => $attributeCode]
86-
);
87-
$this->_fields[$alias] = sprintf('%s.%s', $tableAlias, $attributeCode);
88-
} else {
89-
$joinConds = [
90-
sprintf('%s.entity_id=main_table.customer_id', $tableAlias),
91-
$this->getConnection()->quoteInto($tableAlias . '.attribute_id=?', $attribute['attribute_id']),
92-
];
93-
$this->getSelect()->joinLeft(
94-
[$tableAlias => $attribute['attribute_table']],
95-
join(' AND ', $joinConds),
96-
[$alias => 'value']
97-
);
98-
$this->_fields[$alias] = sprintf('%s.value', $tableAlias);
99-
}
100-
}
10181
$this->setFlag('has_customer_data', true);
10282
return $this;
10383
}
@@ -111,7 +91,7 @@ public function addCustomerData()
11191
public function addWebsiteFilter($websiteIds)
11292
{
11393
if ($this->getFlag('has_customer_data')) {
114-
$this->getSelect()->where('customer_email.website_id IN (?)', $websiteIds);
94+
$this->getSelect()->where('customer.website_id IN (?)', $websiteIds);
11595
}
11696
return $this;
11797
}

0 commit comments

Comments
 (0)