File tree 1 file changed +10
-8
lines changed
app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -128,14 +128,16 @@ public function execute()
128
128
$ attributeCode
129
129
);
130
130
131
- if ($ attribute ->getId () && !$ attributeId || in_array ($ attributeCode , static ::RESERVED_CODES )) {
132
- if (in_array ($ attributeCode , static ::RESERVED_CODES )) {
133
- $ message = __ ('Code (%1) is a reserved key and cannot be used as attribute code. ' , $ attributeCode );
134
- } else {
135
- $ message = strlen ($ this ->getRequest ()->getParam ('attribute_code ' ))
136
- ? __ ('An attribute with this code already exists. ' )
137
- : __ ('An attribute with the same code (%1) already exists. ' , $ attributeCode );
138
- }
131
+ if (in_array ($ attributeCode , self ::RESERVED_CODES )) {
132
+ $ message = __ ('Code (%1) is a reserved key and cannot be used as attribute code. ' , $ attributeCode );
133
+ $ this ->setMessageToResponse ($ response , [$ message ]);
134
+ $ response ->setError (true );
135
+ }
136
+
137
+ if ($ attribute ->getId () && !$ attributeId ) {
138
+ $ message = strlen ($ this ->getRequest ()->getParam ('attribute_code ' ))
139
+ ? __ ('An attribute with this code already exists. ' )
140
+ : __ ('An attribute with the same code (%1) already exists. ' , $ attributeCode );
139
141
$ this ->setMessageToResponse ($ response , [$ message ]);
140
142
141
143
$ response ->setError (true );
You can’t perform that action at this time.
0 commit comments