Skip to content

Commit 746749b

Browse files
committed
MAGETWO-63736: 503 error when trying to make tax_class_id attribute Not Searchable
1 parent 0aa0031 commit 746749b

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ private function setMessageToResponse($response, $messages)
154154
*/
155155
private function checkUniqueOption(DataObject $response, array $options = null)
156156
{
157-
if (is_array($options) && !$this->isUniqueAdminValues($options['value'], $options['delete'])) {
157+
if (is_array($options)
158+
&& !empty($options['value'])
159+
&& !empty($options['delete'])
160+
&& !$this->isUniqueAdminValues($options['value'], $options['delete'])
161+
) {
158162
$this->setMessageToResponse($response, [__("The value of Admin must be unique.")]);
159163
$response->setError(true);
160164
}

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,16 @@ public function testUniqueValidation(array $options, $isError)
198198
public function provideUniqueData()
199199
{
200200
return [
201-
// valid options
202-
[
201+
'no values' => [
202+
[
203+
'delete' => [
204+
"option_0" => "",
205+
"option_1" => "",
206+
"option_2" => "",
207+
]
208+
], false
209+
],
210+
'valid options' => [
203211
[
204212
'value' => [
205213
"option_0" => [1, 0],
@@ -213,8 +221,7 @@ public function provideUniqueData()
213221
]
214222
], false
215223
],
216-
//with duplicate
217-
[
224+
'duplicate options' => [
218225
[
219226
'value' => [
220227
"option_0" => [1, 0],
@@ -228,8 +235,7 @@ public function provideUniqueData()
228235
]
229236
], true
230237
],
231-
//with duplicate but deleted
232-
[
238+
'duplicate and deleted' => [
233239
[
234240
'value' => [
235241
"option_0" => [1, 0],

0 commit comments

Comments
 (0)