Skip to content

Commit 580ffe5

Browse files
change error to code is reserved key instead of code already exists
1 parent f442fa9 commit 580ffe5

File tree

1 file changed

+7
-4
lines changed
  • app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,13 @@ public function execute()
128128
);
129129

130130
if ($attribute->getId() && !$attributeId || $attributeCode === 'product_type' || $attributeCode === 'type_id') {
131-
$message = strlen($this->getRequest()->getParam('attribute_code'))
132-
? __('An attribute with this code already exists.')
133-
: __('An attribute with the same code (%1) already exists.', $attributeCode);
134-
131+
if ($attributeCode === 'product_type' || $attributeCode === 'type_id') {
132+
$message = __('Code (%1) is a reserved key and cannot be used as attribute code.', $attributeCode);
133+
} else {
134+
$message = strlen($this->getRequest()->getParam('attribute_code'))
135+
? __('An attribute with this code already exists.')
136+
: __('An attribute with the same code (%1) already exists.', $attributeCode);
137+
}
135138
$this->setMessageToResponse($response, [$message]);
136139

137140
$response->setError(true);

0 commit comments

Comments
 (0)