Skip to content

Commit 8aec37b

Browse files
committed
MAGETWO-67623: Customer Segment - Multiple Select Attribute: MySQL Query Issue
1 parent ae53ec1 commit 8aec37b

File tree

1 file changed

+24
-0
lines changed
  • dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer

1 file changed

+24
-0
lines changed

dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Webapi.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class Webapi extends AbstractWebapi implements CustomerInterface
7070
'default_shipping',
7171
'addresses',
7272
'disable_auto_group_change',
73+
'custom_attribute',
7374
];
7475

7576
/**
@@ -115,6 +116,29 @@ protected function prepareData(Customer $customer)
115116
unset($data['customer']['password_confirmation']);
116117
$data = $this->prepareAddressData($data);
117118
$data = $this->prepareExtensionAttributes($data);
119+
$data = $this->prepareCustomAttributes($data);
120+
return $data;
121+
}
122+
123+
/**
124+
* Prepare Custom Attributes.
125+
*
126+
* @param array $data
127+
* @return array
128+
*/
129+
protected function prepareCustomAttributes(array $data)
130+
{
131+
if (isset($data['customer']['custom_attribute'])) {
132+
$data['customer']['custom_attribute']['attribute_code'] = $data['customer']['custom_attribute']['code'];
133+
unset($data['customer']['custom_attribute']['code']);
134+
if (is_array($data['customer']['custom_attribute']['value'])) {
135+
$data['customer']['custom_attribute']['value'] =
136+
implode(',', $data['customer']['custom_attribute']['value']);
137+
}
138+
$data['customer']['custom_attributes'][0] = $data['customer']['custom_attribute'];
139+
unset($data['customer']['custom_attribute']);
140+
}
141+
118142
return $data;
119143
}
120144

0 commit comments

Comments
 (0)